mirror of
https://github.com/reactos/reactos.git
synced 2024-12-31 19:42:51 +00:00
[GDI32_APITEST] Clean up loaded fonts
This commit is contained in:
parent
8a437ac528
commit
9e6b0b16e9
1 changed files with 32 additions and 42 deletions
|
@ -11,25 +11,18 @@
|
||||||
|
|
||||||
void Test_AddFontResourceA()
|
void Test_AddFontResourceA()
|
||||||
{
|
{
|
||||||
CHAR szFileNameA[MAX_PATH*2 + 3];
|
CHAR szCurrentDir[MAX_PATH];
|
||||||
CHAR szFileNameFont1A[MAX_PATH];
|
CHAR szFileNameFont1[MAX_PATH];
|
||||||
CHAR szFileNameFont2A[MAX_PATH];
|
CHAR szFileNameFont2[MAX_PATH];
|
||||||
|
CHAR szFileName[MAX_PATH*2 + 3];
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
GetCurrentDirectoryA(MAX_PATH, szFileNameA);
|
GetCurrentDirectoryA(MAX_PATH, szCurrentDir);
|
||||||
|
|
||||||
memcpy(szFileNameFont1A, szFileNameA, MAX_PATH );
|
snprintf(szFileNameFont1, MAX_PATH, "%s\\testdata\\test.ttf", szCurrentDir);
|
||||||
strcat(szFileNameFont1A, "\\testdata\\test.ttf");
|
snprintf(szFileNameFont2, MAX_PATH, "%s\\testdata\\test.otf", szCurrentDir);
|
||||||
|
|
||||||
memcpy(szFileNameFont2A, szFileNameA, MAX_PATH );
|
//RtlZeroMemory(szFileNameA, sizeof(szFileNameA));
|
||||||
strcat(szFileNameFont2A, "\\testdata\\test.otf");
|
|
||||||
|
|
||||||
RtlZeroMemory(szFileNameA, sizeof(szFileNameA));
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Start testing Ansi version
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Testing NULL pointer */
|
/* Testing NULL pointer */
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
@ -57,64 +50,61 @@ void Test_AddFontResourceA()
|
||||||
|
|
||||||
/* Testing one ttf font */
|
/* Testing one ttf font */
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
result = AddFontResourceA(szFileNameFont1A);
|
result = AddFontResourceA(szFileNameFont1);
|
||||||
ok(result == 1, "AddFontResourceA(\"%s\") failed, result=%d\n", szFileNameFont1A, result);
|
ok(result == 1, "AddFontResourceA(\"%s\") failed, result=%d\n", szFileNameFont1, result);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
RemoveFontResourceA(szFileNameFont1);
|
||||||
|
|
||||||
/* Testing one otf font */
|
/* Testing one otf font */
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
result = AddFontResourceA(szFileNameFont2A);
|
result = AddFontResourceA(szFileNameFont2);
|
||||||
ok(result == 1, "AddFontResourceA failed, result=%d\n", result);
|
ok(result == 1, "AddFontResourceA failed, result=%d\n", result);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
RemoveFontResourceA(szFileNameFont2);
|
||||||
|
|
||||||
/* Testing two fonts */
|
/* Testing two fonts */
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
sprintf(szFileNameA,"%s|%s",szFileNameFont1A, szFileNameFont2A);
|
sprintf(szFileName,"%s|%s",szFileNameFont1, szFileNameFont2);
|
||||||
result = AddFontResourceA(szFileNameA);
|
result = AddFontResourceA(szFileName);
|
||||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
sprintf(szFileNameA,"%s |%s",szFileNameFont1A, szFileNameFont2A);
|
sprintf(szFileName,"%s |%s",szFileNameFont1, szFileNameFont2);
|
||||||
result = AddFontResourceA(szFileNameA);
|
result = AddFontResourceA(szFileName);
|
||||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
sprintf(szFileNameA,"%s | %s",szFileNameFont1A, szFileNameFont2A);
|
sprintf(szFileName,"%s | %s",szFileNameFont1, szFileNameFont2);
|
||||||
result = AddFontResourceA(szFileNameA);
|
result = AddFontResourceA(szFileName);
|
||||||
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
|
snprintf(szFileNameFont1, MAX_PATH, "%s\\testdata\\test.pfm", szCurrentDir);
|
||||||
GetCurrentDirectoryA(MAX_PATH, szFileNameA);
|
snprintf(szFileNameFont2, MAX_PATH, "%s\\testdata\\test.pfb", szCurrentDir);
|
||||||
strcpy(szFileNameFont1A, szFileNameA);
|
|
||||||
strcat(szFileNameFont1A, "\\testdata\\test.pfm");
|
|
||||||
|
|
||||||
strcpy(szFileNameFont2A, szFileNameA);
|
|
||||||
strcat(szFileNameFont2A, "\\testdata\\test.pfb");
|
|
||||||
|
|
||||||
SetLastError(ERROR_SUCCESS);
|
SetLastError(ERROR_SUCCESS);
|
||||||
|
|
||||||
sprintf(szFileNameA,"%s|%s", szFileNameFont1A, szFileNameFont2A);
|
sprintf(szFileName,"%s|%s", szFileNameFont1, szFileNameFont2);
|
||||||
result = AddFontResourceA(szFileNameA);
|
result = AddFontResourceA(szFileName);
|
||||||
ok(result == 1, "AddFontResourceA(\"%s|%s\") failed, result=%d\n",
|
ok(result == 1, "AddFontResourceA(\"%s|%s\") failed, result=%d\n",
|
||||||
szFileNameFont1A, szFileNameFont2A, result);
|
szFileNameFont1, szFileNameFont2, result);
|
||||||
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
RemoveFontResourceA(szFileName);
|
||||||
|
|
||||||
sprintf(szFileNameA,"%s | %s", szFileNameFont1A, szFileNameFont2A);
|
sprintf(szFileName,"%s | %s", szFileNameFont1, szFileNameFont2);
|
||||||
result = AddFontResourceA(szFileNameA);
|
result = AddFontResourceA(szFileName);
|
||||||
ok(result == 0, "AddFontResourceA(\"%s | %s\") succeeded, result=%d\n",
|
ok(result == 0, "AddFontResourceA(\"%s | %s\") succeeded, result=%d\n",
|
||||||
szFileNameFont1A, szFileNameFont2A, result);
|
szFileNameFont1, szFileNameFont2, result);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
RemoveFontResourceA(szFileName);
|
||||||
|
|
||||||
sprintf(szFileNameA,"%s|%s", szFileNameFont2A, szFileNameFont1A);
|
sprintf(szFileName,"%s|%s", szFileNameFont2, szFileNameFont1);
|
||||||
result = AddFontResourceA(szFileNameA);
|
result = AddFontResourceA(szFileName);
|
||||||
ok(result == 0, "AddFontResourceA(\"%s|%s\") succeeded, result=%d\n",
|
ok(result == 0, "AddFontResourceA(\"%s|%s\") succeeded, result=%d\n",
|
||||||
szFileNameFont2A, szFileNameFont1A, result);
|
szFileNameFont2, szFileNameFont1, result);
|
||||||
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
START_TEST(AddFontResource)
|
START_TEST(AddFontResource)
|
||||||
|
|
Loading…
Reference in a new issue