ReactOS  0.4.14-dev-317-g96040ec
AddFontResourceEx.c File Reference
#include "precomp.h"
Include dependency graph for AddFontResourceEx.c:

Go to the source code of this file.

Functions

void Test_AddFontResourceExW ()
 
 START_TEST (AddFontResourceEx)
 

Function Documentation

◆ START_TEST()

START_TEST ( AddFontResourceEx  )

Definition at line 59 of file AddFontResourceEx.c.

60 {
62 }
void Test_AddFontResourceExW()

◆ Test_AddFontResourceExW()

void Test_AddFontResourceExW ( )

Definition at line 10 of file AddFontResourceEx.c.

11 {
12  WCHAR szFileName[MAX_PATH];
13  int result;
14 
15  /* Test NULL filename */
17 
18  /* Windows crashes, need SEH here */
19  _SEH2_TRY
20  {
22  }
24  {
25  result = -1;
27  }
28  _SEH2_END
29  ok(result == -1, "AddFontResourceExW should throw an exception!, result == %d\n", result);
30  ok(GetLastError() == 0xc0000005, "GetLastError()==%lx\n", GetLastError());
31 
32  /* Test "" filename */
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());
37 
38  GetEnvironmentVariableW(L"systemroot", szFileName, MAX_PATH);
39  wcscat(szFileName, L"\\Fonts\\cour.ttf");
40 
41  /* Test flags = 0 */
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());
46 
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());
51 
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());
56 
57 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:91
#define ERROR_SUCCESS
Definition: deptool.c:10
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
_SEH2_TRY
Definition: create.c:4250
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
INT WINAPI AddFontResourceExW(_In_ LPCWSTR pszFilename, _In_ DWORD fl, _Reserved_ PVOID pvReserved)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
#define SetLastError(x)
Definition: compat.h:409
static const WCHAR L[]
Definition: oid.c:1250
_SEH2_END
Definition: create.c:4424
#define ok(value,...)
Definition: atltest.h:57
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:6
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:12
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:412
GLuint64EXT * result
Definition: glext.h:11304

Referenced by START_TEST().