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
1b041c92
Commit
1b041c92
authored
Feb 14, 2011
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Feb 24, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gdi32: Add a EnumFontFamilies test to see how it handles various font faces.
parent
2aaf6c2c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
0 deletions
+96
-0
font.c
dlls/gdi32/tests/font.c
+96
-0
No files found.
dlls/gdi32/tests/font.c
View file @
1b041c92
...
...
@@ -3483,6 +3483,101 @@ static void test_AddFontMemResource(void)
free_font
(
font
);
}
static
INT
CALLBACK
enum_fonts_proc
(
const
LOGFONT
*
elf
,
const
TEXTMETRIC
*
ntm
,
DWORD
type
,
LPARAM
lparam
)
{
LOGFONT
*
lf
;
if
(
type
!=
TRUETYPE_FONTTYPE
)
return
1
;
ok
(
ntm
->
tmWeight
==
elf
->
lfWeight
,
"expected %d got %d
\n
"
,
ntm
->
tmWeight
,
elf
->
lfWeight
);
lf
=
(
LOGFONT
*
)
lparam
;
*
lf
=
*
elf
;
return
0
;
}
static
INT
CALLBACK
enum_all_fonts_proc
(
const
LOGFONT
*
elf
,
const
TEXTMETRIC
*
ntm
,
DWORD
type
,
LPARAM
lparam
)
{
int
ret
;
LOGFONT
*
lf
;
if
(
type
!=
TRUETYPE_FONTTYPE
)
return
1
;
lf
=
(
LOGFONT
*
)
lparam
;
ret
=
strcmp
(
lf
->
lfFaceName
,
elf
->
lfFaceName
);
if
(
ret
==
0
)
{
ok
(
ntm
->
tmWeight
==
elf
->
lfWeight
,
"expected %d got %d
\n
"
,
ntm
->
tmWeight
,
elf
->
lfWeight
);
*
lf
=
*
elf
;
return
0
;
}
return
1
;
}
static
void
test_EnumFonts
(
void
)
{
int
ret
;
LOGFONT
lf
;
HDC
hdc
;
if
(
!
is_truetype_font_installed
(
"Arial"
))
{
skip
(
"Arial is not installed
\n
"
);
return
;
}
/* Windows uses localized font face names, so Arial Bold won't be found */
if
(
PRIMARYLANGID
(
GetUserDefaultLangID
())
!=
LANG_ENGLISH
)
{
skip
(
"User locale is not English, skipping the test
\n
"
);
return
;
}
hdc
=
CreateCompatibleDC
(
0
);
ret
=
EnumFontFamilies
(
hdc
,
"Arial"
,
enum_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
!
ret
,
"font Arial is not enumerated
\n
"
);
ret
=
strcmp
(
lf
.
lfFaceName
,
"Arial"
);
ok
(
!
ret
,
"expected Arial got %s
\n
"
,
lf
.
lfFaceName
);
ok
(
lf
.
lfWeight
==
FW_NORMAL
,
"expected FW_NORMAL got %d
\n
"
,
lf
.
lfWeight
);
lstrcpy
(
lf
.
lfFaceName
,
"Arial"
);
ret
=
EnumFontFamilies
(
hdc
,
NULL
,
enum_all_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
!
ret
,
"font Arial is not enumerated
\n
"
);
ret
=
strcmp
(
lf
.
lfFaceName
,
"Arial"
);
ok
(
!
ret
,
"expected Arial got %s
\n
"
,
lf
.
lfFaceName
);
ok
(
lf
.
lfWeight
==
FW_NORMAL
,
"expected FW_NORMAL got %d
\n
"
,
lf
.
lfWeight
);
ret
=
EnumFontFamilies
(
hdc
,
"Arial Bold"
,
enum_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
!
ret
,
"font Arial Bold is not enumerated
\n
"
);
ret
=
strcmp
(
lf
.
lfFaceName
,
"Arial"
);
ok
(
!
ret
,
"expected Arial got %s
\n
"
,
lf
.
lfFaceName
);
ok
(
lf
.
lfWeight
==
FW_BOLD
,
"expected FW_BOLD got %d
\n
"
,
lf
.
lfWeight
);
lstrcpy
(
lf
.
lfFaceName
,
"Arial Bold"
);
ret
=
EnumFontFamilies
(
hdc
,
NULL
,
enum_all_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
ret
,
"font Arial Bold should not be enumerated
\n
"
);
ret
=
EnumFontFamilies
(
hdc
,
"Arial Bold Italic"
,
enum_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
!
ret
,
"font Arial Bold Italic is not enumerated
\n
"
);
ret
=
strcmp
(
lf
.
lfFaceName
,
"Arial"
);
ok
(
!
ret
,
"expected Arial got %s
\n
"
,
lf
.
lfFaceName
);
ok
(
lf
.
lfWeight
==
FW_BOLD
,
"expected FW_BOLD got %d
\n
"
,
lf
.
lfWeight
);
lstrcpy
(
lf
.
lfFaceName
,
"Arial Bold Italic"
);
ret
=
EnumFontFamilies
(
hdc
,
NULL
,
enum_all_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
ret
,
"font Arial Bold Italic should not be enumerated
\n
"
);
ret
=
EnumFontFamilies
(
hdc
,
"Arial Italic Bold"
,
enum_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
ret
,
"font Arial Italic Bold should not be enumerated
\n
"
);
lstrcpy
(
lf
.
lfFaceName
,
"Arial Italic Bold"
);
ret
=
EnumFontFamilies
(
hdc
,
NULL
,
enum_all_fonts_proc
,
(
LPARAM
)
&
lf
);
ok
(
ret
,
"font Arial Italic Bold should not be enumerated
\n
"
);
DeleteDC
(
hdc
);
}
START_TEST
(
font
)
{
init
();
...
...
@@ -3504,6 +3599,7 @@ START_TEST(font)
test_orientation
();
test_height_selection
();
test_AddFontMemResource
();
test_EnumFonts
();
/* On Windows Arial has a lot of default charset aliases such as Arial Cyr,
* I'd like to avoid them in this test.
...
...
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