2 * PROJECT: ReactOS API tests
3 * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory
4 * PURPOSE: Test for EnumFontFamilies[Ex]
5 * PROGRAMMERS: Thomas Faber <thomas.faber@reactos.org>
14 static BYTE ContextContinue
;
15 static BYTE ContextStop
;
17 static int EnumProcCalls
;
18 static ENUMLOGFONTA LastFontA
;
19 static ENUMLOGFONTW LastFontW
;
25 _In_
const LOGFONTA
*elf
,
26 _In_
const TEXTMETRICA
*ntm
,
32 ok(lParam
== (LPARAM
)&ContextContinue
||
33 lParam
== (LPARAM
)&ContextStop
,
34 "Context is %p, expected %p or %p\n",
35 (PVOID
)lParam
, &ContextContinue
, &ContextStop
);
37 LastFontA
= *(ENUMLOGFONTA
*)elf
;
38 return lParam
== (LPARAM
)&ContextContinue
? 7 : 0;
45 _In_
const LOGFONTW
*elf
,
46 _In_
const TEXTMETRICW
*ntm
,
52 ok(lParam
== (LPARAM
)&ContextContinue
||
53 lParam
== (LPARAM
)&ContextStop
,
54 "Context is %p, expected %p or %p\n",
55 (PVOID
)lParam
, &ContextContinue
, &ContextStop
);
57 LastFontW
= *(ENUMLOGFONTW
*)elf
;
58 return lParam
== (LPARAM
)&ContextContinue
? 7 : 0;
63 TestEnumFontFamiliesA(
71 SetLastError(0xdeadbeef);
72 ret
= EnumFontFamiliesA(hdc
,
75 (LPARAM
)&ContextContinue
);
76 error
= GetLastError();
77 ok(ret
== 1, "ret is %d, expected 1\n", ret
);
78 ok(error
== 0xdeadbeef, "error is %lu\n", error
);
79 ok(EnumProcCalls
== 0, "EnumProcCalls is %d\n", EnumProcCalls
);
84 TestEnumFontFamiliesW(
92 SetLastError(0xdeadbeef);
93 ret
= EnumFontFamiliesW(hdc
,
96 (LPARAM
)&ContextContinue
);
97 error
= GetLastError();
98 ok(ret
== 1, "ret is %d, expected 1\n", ret
);
99 ok(error
== 0xdeadbeef, "error is %lu\n", error
);
100 ok(EnumProcCalls
== 0, "EnumProcCalls is %d\n", EnumProcCalls
);
105 TestEnumFontFamiliesExA(
114 ZeroMemory(&lf
, sizeof(lf
));
115 lf
.lfCharSet
= DEFAULT_CHARSET
;
116 lf
.lfPitchAndFamily
= 0;
117 StringCbCopyA(lf
.lfFaceName
, sizeof(lf
.lfFaceName
), FontName
);
118 SetLastError(0xdeadbeef);
119 ret
= EnumFontFamiliesExA(hdc
,
122 (LPARAM
)&ContextContinue
,
124 error
= GetLastError();
125 ok(ret
== 1, "ret is %d, expected 1\n", ret
);
126 ok(error
== 0xdeadbeef, "error is %lu\n", error
);
127 ok(EnumProcCalls
== 0, "EnumProcCalls is %d\n", EnumProcCalls
);
132 TestEnumFontFamiliesExW(
134 _In_ PCWSTR FontName
)
141 ZeroMemory(&lf
, sizeof(lf
));
142 lf
.lfCharSet
= DEFAULT_CHARSET
;
143 lf
.lfPitchAndFamily
= 0;
144 StringCbCopyW(lf
.lfFaceName
, sizeof(lf
.lfFaceName
), FontName
);
145 SetLastError(0xdeadbeef);
146 ret
= EnumFontFamiliesExW(hdc
,
149 (LPARAM
)&ContextContinue
,
151 error
= GetLastError();
152 ok(ret
== 1, "ret is %d, expected 1\n", ret
);
153 ok(error
== 0xdeadbeef, "error is %lu\n", error
);
154 ok(EnumProcCalls
== 0, "EnumProcCalls is %d\n", EnumProcCalls
);
157 START_TEST(EnumFontFamilies
)
161 hdc
= CreateCompatibleDC(NULL
);
168 TestEnumFontFamiliesA(hdc
, "ThisFontDoesNotExist");
169 TestEnumFontFamiliesW(hdc
, L
"ThisFontDoesNotExist");
170 TestEnumFontFamiliesExA(hdc
, "ThisFontDoesNotExist");
171 TestEnumFontFamiliesExW(hdc
, L
"ThisFontDoesNotExist");