7b6f52b9d35afd14a73a0fa7e5f138040161155e
[reactos.git] / rostests / apitests / gdi32api / tests / AddFontResourceEx.c
1 #define STAMP_DESIGNVECTOR (0x8000000 + 'd' + ('v' << 8))
2
3 INT
4 Test_AddFontResourceEx(PTESTINFO pti)
5 {
6 WCHAR szFileName[MAX_PATH];
7
8 /* Test NULL filename */
9 SetLastError(ERROR_SUCCESS);
10 /* Windows crashes, would need SEH here */
11 // TEST(AddFontResourceExW(NULL, 0, 0) != 0);
12 // TEST(GetLastError() == ERROR_SUCCESS);
13
14 /* Test "" filename */
15 SetLastError(ERROR_SUCCESS);
16 RTEST(AddFontResourceExW(L"", 0, 0) == 0);
17 TEST(GetLastError() == ERROR_INVALID_PARAMETER);
18
19 GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH);
20 wcscat(szFileName, L"\\Fonts\\cour.ttf");
21
22 /* Test flags = 0 */
23 SetLastError(ERROR_SUCCESS);
24 TEST(AddFontResourceExW(szFileName, 0, 0) != 0);
25 RTEST(GetLastError() == ERROR_SUCCESS);
26
27 SetLastError(ERROR_SUCCESS);
28 RTEST(AddFontResourceExW(szFileName, 256, 0) == 0);
29 RTEST(GetLastError() == ERROR_INVALID_PARAMETER);
30
31 /* Test invalid pointer as last parameter */
32 TEST(AddFontResourceExW(szFileName, 0, (void*)-1) != 0);
33
34
35 return APISTATUS_NORMAL;
36 }