2 * PROJECT: ReactOS api tests
3 * LICENSE: GPL - See COPYING in the top level directory
4 * PURPOSE: Test for AddFontResourceEx
5 * PROGRAMMERS: Timo Kreuzer
10 void Test_AddFontResourceExW()
12 WCHAR szFileName
[MAX_PATH
];
15 /* Test NULL filename */
16 SetLastError(ERROR_SUCCESS
);
18 /* Windows crashes, need SEH here */
21 result
= AddFontResourceExW(NULL
, 0, 0);
23 _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER
)
26 SetLastError(_SEH2_GetExceptionCode());
29 ok(result
== -1, "AddFontResourceExW should throw an exception!, result == %d\n", result
);
30 ok(GetLastError() == 0xc0000005, "GetLastError()==%lx\n", GetLastError());
32 /* Test "" filename */
33 SetLastError(ERROR_SUCCESS
);
34 result
= AddFontResourceExW(L
"", 0, 0);
35 ok(result
== 0, "AddFontResourceExW(L"", 0, 0) succeeded, result==%d\n", result
);
36 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
38 GetEnvironmentVariableW(L
"systemroot", szFileName
, MAX_PATH
);
39 wcscat(szFileName
, L
"\\Fonts\\cour.ttf");
42 SetLastError(ERROR_SUCCESS
);
43 result
= AddFontResourceExW(szFileName
, 0, 0);
44 ok(result
== 1, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
45 ok(GetLastError() == ERROR_SUCCESS
, "GetLastError()==%ld\n", GetLastError());
47 SetLastError(ERROR_SUCCESS
);
48 result
= AddFontResourceExW(szFileName
, 256, 0);
49 ok(result
== 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
50 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
52 /* Test invalid pointer as last parameter */
53 result
= AddFontResourceExW(szFileName
, 0, (void*)-1);
54 ok(result
!= 0, "AddFontResourceExW(L"", 0, 0) failed, result==%d\n", result
);
55 ok(GetLastError() == ERROR_INVALID_PARAMETER
, "GetLastError()==%ld\n", GetLastError());
59 START_TEST(AddFontResourceEx
)
61 Test_AddFontResourceExW();