mirror of
https://github.com/reactos/reactos.git
synced 2024-11-03 05:18:55 +00:00
e3a2103631
svn path=/trunk/; revision=48617
97 lines
3.3 KiB
C
97 lines
3.3 KiB
C
/*
|
|
* PROJECT: ReactOS api tests
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
* PURPOSE: Test for AddFontResource
|
|
* PROGRAMMERS: Timo Kreuzer
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <wine/test.h>
|
|
#include <windows.h>
|
|
|
|
#define COUNT 26
|
|
|
|
void Test_AddFontResourceA()
|
|
{
|
|
CHAR szFileNameA[MAX_PATH];
|
|
CHAR szFileNameFont1A[MAX_PATH];
|
|
CHAR szFileNameFont2A[MAX_PATH];
|
|
int result;
|
|
|
|
GetCurrentDirectoryA(MAX_PATH,szFileNameA);
|
|
|
|
memcpy(szFileNameFont1A,szFileNameA,MAX_PATH );
|
|
strcat(szFileNameFont1A, "\\testdata\\test.ttf");
|
|
|
|
memcpy(szFileNameFont2A,szFileNameA,MAX_PATH );
|
|
strcat(szFileNameFont2A, "\\testdata\\test.otf");
|
|
|
|
RtlZeroMemory(szFileNameA,MAX_PATH);
|
|
|
|
/*
|
|
* Start testing Ansi version
|
|
*
|
|
*/
|
|
|
|
/* Testing NULL pointer */
|
|
SetLastError(ERROR_SUCCESS);
|
|
result = AddFontResourceA(NULL);
|
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
/* Testing -1 pointer */
|
|
SetLastError(ERROR_SUCCESS);
|
|
result = AddFontResourceA((CHAR*)-1);
|
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
/* Testing address 1 pointer */
|
|
SetLastError(ERROR_SUCCESS);
|
|
result = AddFontResourceA((CHAR*)1);
|
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
/* Testing address empty string */
|
|
SetLastError(ERROR_SUCCESS);
|
|
result = AddFontResourceA("");
|
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_INVALID_PARAMETER, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
/* Testing one ttf font */
|
|
SetLastError(ERROR_SUCCESS);
|
|
result = AddFontResourceA(szFileNameFont1A);
|
|
ok(result == 1, "AddFontResourceA(\"%s\") failed, result=%d\n", szFileNameFont1A, result);
|
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
/* Testing one otf font */
|
|
SetLastError(ERROR_SUCCESS);
|
|
result = AddFontResourceA(szFileNameFont2A);
|
|
ok(result == 1, "AddFontResourceA failed, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
/* Testing two fonts */
|
|
SetLastError(ERROR_SUCCESS);
|
|
sprintf(szFileNameA,"%s|%s",szFileNameFont1A, szFileNameFont2A);
|
|
result = AddFontResourceA(szFileNameA);
|
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
sprintf(szFileNameA,"%s |%s",szFileNameFont1A, szFileNameFont2A);
|
|
result = AddFontResourceA(szFileNameA);
|
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_SUCCESS, "GetLastError()=%ld\n", GetLastError());
|
|
|
|
SetLastError(ERROR_SUCCESS);
|
|
sprintf(szFileNameA,"%s | %s",szFileNameFont1A, szFileNameFont2A);
|
|
result = AddFontResourceA(szFileNameA);
|
|
ok(result == 0, "AddFontResourceA succeeded, result=%d\n", result);
|
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "GetLastError()=%ld\n", GetLastError());
|
|
}
|
|
|
|
START_TEST(AddFontResource)
|
|
{
|
|
Test_AddFontResourceA();
|
|
}
|
|
|