ReactOS 0.4.15-dev-7670-g69b08be
AddFontResource.c File Reference
#include "precomp.h"
Include dependency graph for AddFontResource.c:

Go to the source code of this file.

Macros

#define COUNT   26
 

Functions

void Test_AddFontResourceA ()
 
 START_TEST (AddFontResource)
 

Macro Definition Documentation

◆ COUNT

#define COUNT   26

Definition at line 10 of file AddFontResource.c.

Function Documentation

◆ START_TEST()

START_TEST ( AddFontResource  )

Definition at line 110 of file AddFontResource.c.

111{
113}
void Test_AddFontResourceA()

◆ Test_AddFontResourceA()

void Test_AddFontResourceA ( )

Definition at line 12 of file AddFontResource.c.

13{
14 CHAR szCurrentDir[MAX_PATH];
15 CHAR szFileNameFont1[MAX_PATH];
16 CHAR szFileNameFont2[MAX_PATH];
17 CHAR szFileName[MAX_PATH*2 + 3];
18 int result;
19
20 GetCurrentDirectoryA(MAX_PATH, szCurrentDir);
21
22 snprintf(szFileNameFont1, MAX_PATH, "%s\\testdata\\test.ttf", szCurrentDir);
23 snprintf(szFileNameFont2, MAX_PATH, "%s\\testdata\\test.otf", szCurrentDir);
24
25 //RtlZeroMemory(szFileNameA, sizeof(szFileNameA));
26
27 /* Testing NULL pointer */
30 ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
31 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
32
33 /* Testing -1 pointer */
36 ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
37 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
38
39 /* Testing address 1 pointer */
42 ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
43 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
44
45 /* Testing address empty string */
48 ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
49 ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%ld\n", GetLastError());
50
51 /* Testing one ttf font */
53 result = AddFontResourceA(szFileNameFont1);
54 ok(result == 1, "AddFontResourceA(\"%s\") failed, result=%d\n", szFileNameFont1, result);
55 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
56 RemoveFontResourceA(szFileNameFont1);
57
58 /* Testing one otf font */
60 result = AddFontResourceA(szFileNameFont2);
61 ok(result == 1, "AddFontResourceA failed, result=%d\n", result);
62 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
63 RemoveFontResourceA(szFileNameFont2);
64
65 /* Testing two fonts */
67 sprintf(szFileName,"%s|%s",szFileNameFont1, szFileNameFont2);
68 result = AddFontResourceA(szFileName);
69 ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
70 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
71
73 sprintf(szFileName,"%s |%s",szFileNameFont1, szFileNameFont2);
74 result = AddFontResourceA(szFileName);
75 ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
76 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
77
79 sprintf(szFileName,"%s | %s",szFileNameFont1, szFileNameFont2);
80 result = AddFontResourceA(szFileName);
81 ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
82 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
83
84 snprintf(szFileNameFont1, MAX_PATH, "%s\\testdata\\test.pfm", szCurrentDir);
85 snprintf(szFileNameFont2, MAX_PATH, "%s\\testdata\\test.pfb", szCurrentDir);
86
88
89 sprintf(szFileName,"%s|%s", szFileNameFont1, szFileNameFont2);
90 result = AddFontResourceA(szFileName);
91 ok(result == 1, "AddFontResourceA(\"%s|%s\") failed, result=%d\n",
92 szFileNameFont1, szFileNameFont2, result);
93 ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
94 RemoveFontResourceA(szFileName);
95
96 sprintf(szFileName,"%s | %s", szFileNameFont1, szFileNameFont2);
97 result = AddFontResourceA(szFileName);
98 ok(result == 0, "AddFontResourceA(\"%s | %s\") succeeded, result=%d\n",
99 szFileNameFont1, szFileNameFont2, result);
100 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
101 RemoveFontResourceA(szFileName);
102
103 sprintf(szFileName,"%s|%s", szFileNameFont2, szFileNameFont1);
104 result = AddFontResourceA(szFileName);
105 ok(result == 0, "AddFontResourceA(\"%s|%s\") succeeded, result=%d\n",
106 szFileNameFont2, szFileNameFont1, result);
107 ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
108}
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define SetLastError(x)
Definition: compat.h:752
#define MAX_PATH
Definition: compat.h:34
DWORD WINAPI GetCurrentDirectoryA(IN DWORD nBufferLength, OUT LPSTR lpBuffer)
Definition: path.c:2146
GLuint64EXT * result
Definition: glext.h:11304
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define sprintf(buf, format,...)
Definition: sprintf.c:55
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
int WINAPI AddFontResourceA(_In_ LPCSTR pszFilename)
BOOL WINAPI RemoveFontResourceA(_In_ LPCSTR)
#define snprintf
Definition: wintirpc.h:48
char CHAR
Definition: xmlstorage.h:175

Referenced by START_TEST().