2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for GetTextFace
5 * PROGRAMMERS: Timo Kreuzer
12 /* Exported by gdi32.dll but undocumented */
18 OUT LPWSTR lpAliasName
);
20 void Test_GetTextFace(void)
27 hDC
= CreateCompatibleDC(NULL
);
28 ok(hDC
!= 0, "CreateCompatibleDC failed, skipping tests.\n");
31 /* Whether asking for the string size (NULL buffer) ignores the size argument */
32 SetLastError(0xE000BEEF);
33 ret
= GetTextFaceW(hDC
, 0, NULL
);
38 SetLastError(0xE000BEEF);
39 ret
= GetTextFaceW(hDC
, -1, NULL
);
45 SetLastError(0xE000BEEF);
46 ret
= GetTextFaceW(hDC
, 10000, NULL
);
52 /* Whether the buffer is correctly filled */
53 SetLastError(0xE000BEEF);
54 ret
= GetTextFaceW(hDC
, 20, Buffer
);
57 ok_int(Buffer
[ret
- 1], 0);
60 SetLastError(0xE000BEEF);
61 ret
= GetTextFaceW(hDC
, 1, Buffer
);
63 ok_int(Buffer
[ret
- 1], 0);
66 SetLastError(0xE000BEEF);
67 ret
= GetTextFaceW(hDC
, 2, Buffer
);
69 ok_int(Buffer
[ret
- 1], 0);
72 /* Whether invalid buffer sizes are correctly ignored */
73 SetLastError(0xE000BEEF);
74 ret
= GetTextFaceW(hDC
, 0, Buffer
);
76 ok_err(ERROR_INVALID_PARAMETER
);
78 SetLastError(0xE000BEEF);
79 ret
= GetTextFaceW(hDC
, -1, Buffer
);
81 ok_err(ERROR_INVALID_PARAMETER
);
86 void Test_GetTextFaceAliasW(void)
93 HFONT hFontOld
, hFont
;
94 WCHAR buf1
[LF_FACESIZE
];
95 WCHAR buf2
[LF_FACESIZE
];
100 LPCWSTR lpExpectedFaceName
;
101 LPCWSTR lpExpectedAlias
;
104 {L
"Arial", L
"Arial", L
"Arial"},
105 {L
"Tahoma", L
"Tahoma", L
"Tahoma"},
106 // {L"Tahoma Bold", L"MS Sans Serif", L"MS Sans Serif"}, // That's what Windows 2003 and 7/10 returns. But not WHS testbot.
107 {L
"Helv", L
"Helv", L
"Helv"},
108 {L
"Tms Rmn", L
"Tms Rmn", L
"Tms Rmn"},
109 {L
"Times", L
"Times", L
"Times"},
110 {L
"invalid", L
"MS Sans Serif", L
"MS Sans Serif"}
113 hDC
= CreateCompatibleDC(NULL
);
114 ok(hDC
!= 0, "CreateCompatibleDC failed, skipping tests.\n");
117 for (i
= 0; i
< ARRAYSIZE(FaceTests
); ++i
)
119 ZeroMemory(&lf
, sizeof(lf
));
120 StringCchCopyW(lf
.lfFaceName
, ARRAYSIZE(lf
.lfFaceName
), FaceTests
[i
].lpFaceName
);
122 hFont
= CreateFontIndirectW(&lf
);
125 trace("Failed to create font '%S'!\n", lf
.lfFaceName
);
129 hFontOld
= SelectObject(hDC
, hFont
);
131 ret
= GetTextFaceW(hDC
, ARRAYSIZE(buf1
), buf1
);
132 ok(ret
!= 0, "%S GetTextFaceW failed.\n", FaceTests
[i
].lpFaceName
);
133 ok(wcscmp(buf1
, FaceTests
[i
].lpExpectedFaceName
) == 0, "'%S' GetTextFaceW failed, got '%S', expected '%S'.\n",
134 FaceTests
[i
].lpFaceName
, buf1
, FaceTests
[i
].lpExpectedFaceName
);
136 ret2
= GetTextFaceAliasW(hDC
, ARRAYSIZE(buf2
), buf2
);
137 ok(ret2
!= 0, "%S GetTextFaceAliasW failed.\n", FaceTests
[i
].lpFaceName
);
138 ok(wcscmp(buf2
, FaceTests
[i
].lpExpectedAlias
) == 0, "'%S' GetTextFaceAliasW failed, got '%S', expected '%S'.\n",
139 FaceTests
[i
].lpFaceName
, buf2
, FaceTests
[i
].lpExpectedAlias
);
141 SelectObject(hDC
, hFontOld
);
148 START_TEST(GetTextFace
)
151 Test_GetTextFaceAliasW();