Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
e56f6a38
Commit
e56f6a38
authored
Apr 21, 2006
by
Paul Vriens
Committed by
Alexandre Julliard
Apr 21, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
usp10: Fix return codes of ScriptGetFontProperties + tests.
parent
d2a59d86
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
11 deletions
+90
-11
usp10.c
dlls/usp10/tests/usp10.c
+78
-1
usp10.c
dlls/usp10/usp10.c
+12
-10
No files found.
dlls/usp10/tests/usp10.c
View file @
e56f6a38
...
...
@@ -32,6 +32,82 @@
#include <winerror.h>
#include <usp10.h>
void
test_ScriptGetFontProperties
(
void
)
{
HRESULT
hr
;
HDC
hdc
;
HWND
hwnd
;
SCRIPT_CACHE
psc
,
old_psc
;
SCRIPT_FONTPROPERTIES
sfp
;
/* Only do the bare minumum to get a valid hdc */
hwnd
=
CreateWindowExA
(
0
,
"static"
,
""
,
WS_POPUP
,
0
,
0
,
100
,
100
,
0
,
0
,
0
,
NULL
);
assert
(
hwnd
!=
0
);
hdc
=
GetDC
(
hwnd
);
ok
(
hdc
!=
NULL
,
"HDC failed to be created %p
\n
"
,
hdc
);
/* Some sanity checks for ScriptGetFontProperties */
hr
=
ScriptGetFontProperties
(
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"(NULL,NULL,NULL), expected E_INVALIDARG, got %08x
\n
"
,
(
unsigned
int
)
hr
);
hr
=
ScriptGetFontProperties
(
NULL
,
NULL
,
&
sfp
);
ok
(
hr
==
E_INVALIDARG
,
"(NULL,NULL,&sfp), expected E_INVALIDARG, got %08x
\n
"
,
(
unsigned
int
)
hr
);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc
=
NULL
;
hr
=
ScriptGetFontProperties
(
NULL
,
&
psc
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"(NULL,&psc,NULL), expected E_INVALIDARG, got %08x
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
==
NULL
,
"Expected psc to be NULL, got %p
\n
"
,
psc
);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc
=
NULL
;
hr
=
ScriptGetFontProperties
(
NULL
,
&
psc
,
&
sfp
);
ok
(
hr
==
E_PENDING
,
"(NULL,&psc,&sfp), expected E_PENDING, got %08x
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
==
NULL
,
"Expected psc to be NULL, got %p
\n
"
,
psc
);
hr
=
ScriptGetFontProperties
(
hdc
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"(hdc,NULL,NULL), expected E_INVALIDARG, got %08x
\n
"
,
(
unsigned
int
)
hr
);
hr
=
ScriptGetFontProperties
(
hdc
,
NULL
,
&
sfp
);
ok
(
hr
==
E_INVALIDARG
,
"(hdc,NULL,&sfp), expected E_INVALIDARG, got %08x
\n
"
,
(
unsigned
int
)
hr
);
/* Set psc to NULL, to be able to check if a pointer is returned in psc */
psc
=
NULL
;
hr
=
ScriptGetFontProperties
(
hdc
,
&
psc
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"(hdc,&psc,NULL), expected E_INVALIDARG, got %08x
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
==
NULL
,
"Expected psc to be NULL, got %p
\n
"
,
psc
);
/* Pass an uninitialized sfp */
psc
=
NULL
;
hr
=
ScriptGetFontProperties
(
hdc
,
&
psc
,
&
sfp
);
ok
(
hr
==
E_INVALIDARG
,
"(hdc,&psc,&sfp) partly uninitialized, expected E_INVALIDARG, got %08x
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
!=
NULL
,
"Expected a pointer in psc, got NULL
\n
"
);
ScriptFreeCache
(
&
psc
);
ok
(
psc
==
NULL
,
"Expected psc to be NULL, got %p
\n
"
,
psc
);
/* Give it the correct cBytes, we don't care about what's coming back */
sfp
.
cBytes
=
sizeof
(
SCRIPT_FONTPROPERTIES
);
psc
=
NULL
;
hr
=
ScriptGetFontProperties
(
hdc
,
&
psc
,
&
sfp
);
ok
(
hr
==
S_OK
,
"(hdc,&psc,&sfp) partly initialized, expected S_OK, got %08x
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
!=
NULL
,
"Expected a pointer in psc, got NULL
\n
"
);
/* Save the psc pointer */
old_psc
=
psc
;
/* Now a NULL hdc again */
hr
=
ScriptGetFontProperties
(
NULL
,
&
psc
,
&
sfp
);
ok
(
hr
==
S_OK
,
"(NULL,&psc,&sfp), expected S_OK, got %08x
\n
"
,
(
unsigned
int
)
hr
);
ok
(
psc
==
old_psc
,
"Expected psc not to be changed, was %p is now %p
\n
"
,
old_psc
,
psc
);
ScriptFreeCache
(
&
psc
);
ok
(
psc
==
NULL
,
"Expected psc to be NULL, got %p
\n
"
,
psc
);
/* Cleanup */
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
}
START_TEST
(
usp10
)
{
HRESULT
hr
;
...
...
@@ -211,5 +287,6 @@ START_TEST(usp10)
DeleteObject
(
hrgn
);
ReleaseDC
(
hwnd
,
hdc
);
DestroyWindow
(
hwnd
);
return
;
test_ScriptGetFontProperties
();
}
dlls/usp10/usp10.c
View file @
e56f6a38
...
...
@@ -126,6 +126,10 @@ HRESULT WINAPI ScriptGetFontProperties(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPR
TEXTMETRICW
ptm
;
TRACE
(
"%p,%p,%p
\n
"
,
hdc
,
psc
,
sfp
);
if
(
!
psc
||
!
sfp
)
return
E_INVALIDARG
;
if
(
!
hdc
&&
!*
psc
)
{
TRACE
(
"No Script_Cache (psc) and no hdc. Ask for one. Hdc=%p, psc=%p
\n
"
,
hdc
,
*
psc
);
return
E_PENDING
;
...
...
@@ -145,16 +149,14 @@ HRESULT WINAPI ScriptGetFontProperties(HDC hdc, SCRIPT_CACHE *psc, SCRIPT_FONTPR
return
E_INVALIDARG
;
/* return something sensible? */
if
(
NULL
!=
sfp
)
{
sfp
->
wgBlank
=
0
;
if
(
GetTextMetricsW
(
phdc
,
&
ptm
))
sfp
->
wgDefault
=
ptm
.
tmDefaultChar
;
else
sfp
->
wgDefault
=
0
;
sfp
->
wgInvalid
=
0
;
sfp
->
wgKashida
=
0xffff
;
sfp
->
iKashidaWidth
=
0
;
}
sfp
->
wgBlank
=
0
;
if
(
GetTextMetricsW
(
phdc
,
&
ptm
))
sfp
->
wgDefault
=
ptm
.
tmDefaultChar
;
else
sfp
->
wgDefault
=
0
;
sfp
->
wgInvalid
=
0
;
sfp
->
wgKashida
=
0xffff
;
sfp
->
iKashidaWidth
=
0
;
return
0
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment