Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
9473bcbb
Commit
9473bcbb
authored
Aug 22, 2005
by
Walt Ogburn
Committed by
Alexandre Julliard
Aug 22, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for olefont size functions & conversions.
parent
2bcc1c07
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
10 deletions
+96
-10
olefont.c
dlls/oleaut32/tests/olefont.c
+96
-10
No files found.
dlls/oleaut32/tests/olefont.c
View file @
9473bcbb
...
...
@@ -42,26 +42,112 @@ static HMODULE hOleaut32;
static
HRESULT
(
WINAPI
*
pOleCreateFontIndirect
)(
LPFONTDESC
,
REFIID
,
LPVOID
*
);
START_TEST
(
olefont
)
/* Create a font with cySize given by lo_size, hi_size, */
/* SetRatio to ratio_logical, ratio_himetric, */
/* check that resulting hfont has height hfont_height. */
/* Various checks along the way. */
static
void
test_ifont_sizes
(
long
lo_size
,
long
hi_size
,
long
ratio_logical
,
long
ratio_himetric
,
long
hfont_height
,
const
char
*
test_name
)
{
FONTDESC
fd
;
static
const
WCHAR
fname
[]
=
{
'S'
,
'y'
,
's'
,
't'
,
'e'
,
'm'
,
0
};
LPVOID
pvObj
=
NULL
;
IFont
*
ifnt
=
NULL
;
HFONT
hfont
;
LOGFONT
lf
;
CY
psize
;
HRESULT
hres
;
IFont
*
font
=
NULL
;
fd
.
cbSizeofstruct
=
sizeof
(
FONTDESC
);
fd
.
lpstrName
=
(
WCHAR
*
)
fname
;
S
(
fd
.
cySize
).
Lo
=
lo_size
;
S
(
fd
.
cySize
).
Hi
=
hi_size
;
fd
.
sWeight
=
0
;
fd
.
sCharset
=
0
;
fd
.
fItalic
=
0
;
fd
.
fUnderline
=
0
;
fd
.
fStrikethrough
=
0
;
/* Create font, test that it worked. */
hres
=
pOleCreateFontIndirect
(
&
fd
,
&
IID_IFont
,
&
pvObj
);
ifnt
=
pvObj
;
ok
(
hres
==
S_OK
,
"%s: OCFI returns 0x%08lx instead of S_OK."
,
test_name
,
hres
);
ok
(
pvObj
!=
NULL
,
"%s: OCFI returns NULL.
\n
"
,
test_name
);
/* Read back size. Hi part was ignored. */
hres
=
IFont_get_Size
(
ifnt
,
&
psize
);
ok
(
hres
==
S_OK
,
"%s: IFont_get_size returns 0x%08lx instead of S_OK.
\n
"
,
test_name
,
hres
);
ok
(
S
(
psize
).
Lo
==
lo_size
&&
S
(
psize
).
Hi
==
0
,
"%s: get_Size: Lo=%ld, Hi=%ld; expected Lo=%ld, Hi=%ld.
\n
"
,
test_name
,
S
(
psize
).
Lo
,
S
(
psize
).
Hi
,
lo_size
,
0L
);
/* Change ratio, check size unchanged. Standard is 72, 2540. */
hres
=
IFont_SetRatio
(
ifnt
,
ratio_logical
,
ratio_himetric
);
ok
(
hres
==
S_OK
,
"%s: IFont_SR returns 0x%08lx instead of S_OK.
\n
"
,
test_name
,
hres
);
hres
=
IFont_get_Size
(
ifnt
,
&
psize
);
ok
(
hres
==
S_OK
,
"%s: IFont_get_size returns 0x%08lx instead of S_OK.
\n
"
,
test_name
,
hres
);
ok
(
S
(
psize
).
Lo
==
lo_size
&&
S
(
psize
).
Hi
==
0
,
"%s: gS after SR: Lo=%ld, Hi=%ld; expected Lo=%ld, Hi=%ld.
\n
"
,
test_name
,
S
(
psize
).
Lo
,
S
(
psize
).
Hi
,
lo_size
,
0L
);
/* Check hFont size with this ratio. This tests an important */
/* conversion for which MSDN is very wrong. */
hres
=
IFont_get_hFont
(
ifnt
,
&
hfont
);
ok
(
hres
==
S_OK
,
"%s: IFont_get_hFont returns 0x%08lx instead of S_OK.
\n
"
,
test_name
,
hres
);
hres
=
GetObject
(
hfont
,
sizeof
(
LOGFONT
),
&
lf
);
ok
(
lf
.
lfHeight
==
hfont_height
,
"%s: hFont has lf.lfHeight=%ld, expected %ld.
\n
"
,
test_name
,
lf
.
lfHeight
,
hfont_height
);
/* Free IFont. */
IFont_Release
(
ifnt
);
}
void
test_QueryInterface
(
void
)
{
LPVOID
pvObj
=
NULL
;
HRESULT
hres
;
IFont
*
font
=
NULL
;
hres
=
pOleCreateFontIndirect
(
NULL
,
&
IID_IFont
,
&
pvObj
);
font
=
pvObj
;
ok
(
hres
==
S_OK
,
"OCFI (NULL,..) does not return 0, but 0x%08lx
\n
"
,
hres
);
ok
(
font
!=
NULL
,
"OCFI (NULL,..) returns NULL, instead of !NULL
\n
"
);
pvObj
=
NULL
;
hres
=
IFont_QueryInterface
(
font
,
&
IID_IFont
,
&
pvObj
);
ok
(
hres
==
S_OK
,
"IFont_QI does not return S_OK, but 0x%08lx
\n
"
,
hres
);
ok
(
pvObj
!=
NULL
,
"IFont_QI does return NULL, instead of a ptr
\n
"
);
IFont_Release
(
font
);
}
START_TEST
(
olefont
)
{
hOleaut32
=
LoadLibraryA
(
"oleaut32.dll"
);
pOleCreateFontIndirect
=
(
void
*
)
GetProcAddress
(
hOleaut32
,
"OleCreateFontIndirect"
);
if
(
!
pOleCreateFontIndirect
)
return
;
hres
=
pOleCreateFontIndirect
(
NULL
,
&
IID_IFont
,
&
pvObj
);
font
=
pvObj
;
test_QueryInterface
();
ok
(
hres
==
S_OK
,
"OCFI (NULL,..) does not return 0, but 0x%08lx
\n
"
,
hres
);
ok
(
font
!=
NULL
,
"OCFI (NULL,..) returns NULL, instead of !NULL
\n
"
);
/* Test various size operations and conversions. */
/* Add more as needed. */
test_ifont_sizes
(
180000
,
0
,
72
,
2540
,
-
18
,
"default"
);
test_ifont_sizes
(
180000
,
0
,
144
,
2540
,
-
36
,
"ratio1"
);
/* change ratio */
test_ifont_sizes
(
180000
,
0
,
72
,
1270
,
-
36
,
"ratio2"
);
/* 2nd part of ratio */
pvObj
=
NULL
;
hres
=
IFont_QueryInterface
(
font
,
&
IID_IFont
,
&
pvObj
);
/* These depend on details of how IFont rounds sizes internally. */
/* test_ifont_sizes(0, 0, 72, 2540, 0, "zero size"); */
/* zero size */
/* test_ifont_sizes(186000, 0, 72, 2540, -19, "rounding"); */
/* test rounding */
ok
(
hres
==
S_OK
,
"IFont_QI does not return S_OK, but 0x%08lx
\n
"
,
hres
);
ok
(
pvObj
!=
NULL
,
"IFont_QI does return NULL, instead of a ptr
\n
"
);
}
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