mscms: Eliminate complex test macro to make source navigation easier.

This commit is contained in:
Saulius Krasuckas 2006-06-12 20:49:31 +03:00 committed by Alexandre Julliard
parent 3f46314e33
commit 3692219db4
1 changed files with 94 additions and 51 deletions

View File

@ -577,55 +577,73 @@ static void check_registry(void)
RegCloseKey( hkIcmKey ); RegCloseKey( hkIcmKey );
} }
#define fail_GSCSP(AW, pMachName, dwProfID, pProfName, pdwSz, dwSz, bCanSucceed, GLE_MATCHES)\
do { \
size = dwSz; \
SetLastError(0xfaceabad); \
ret = pGetStandardColorSpaceProfile##AW(pMachName, dwProfID, pProfName, pdwSz); \
GLE = GetLastError(); \
ok( (!ret && GLE_MATCHES) || \
(bCanSucceed && ret && !lstrcmpi##AW( pProfName, empty##AW ) && GLE == 0xfaceabad), \
"GetStandardColorSpaceProfile%s() returns %d (GLE=%ld)\n", #AW, ret, GLE ); \
} while (0)
static void test_GetStandardColorSpaceProfileA(void) static void test_GetStandardColorSpaceProfileA(void)
{ {
BOOL ret; BOOL ret;
DWORD size, sizeP, GLE; DWORD size;
CHAR oldprofile[MAX_PATH]; CHAR oldprofile[MAX_PATH];
CHAR newprofile[MAX_PATH]; CHAR newprofile[MAX_PATH];
CHAR emptyA[] = ""; const CHAR emptyA[] = "";
DWORD zero = 0;
sizeP = sizeof(newprofile); DWORD sizeP = sizeof(newprofile);
/* Parameter checks */ /* Parameter checks */
#define A /* Single invalid parameter checks: */
/* Single invalid parameter checks */
fail_GSCSP(A, machine, SPACE_RGB, newprofile, &size, sizeP, FALSE, (GLE == ERROR_NOT_SUPPORTED)); SetLastError(0xfaceabee); /* 1st param, */
ret = pGetStandardColorSpaceProfileA(machine, SPACE_RGB, newprofile, &sizeP);
ok( !ret && GetLastError() == ERROR_NOT_SUPPORTED, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* 2nd param, */
ret = pGetStandardColorSpaceProfileA(NULL, (DWORD)-1, newprofile, &sizeP);
todo_wine todo_wine
fail_GSCSP(A, NULL, (DWORD)-1, newprofile, &size, sizeP, FALSE, (GLE == ERROR_FILE_NOT_FOUND)); ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
fail_GSCSP(A, NULL, SPACE_RGB, newprofile, NULL, sizeP, FALSE, (GLE == ERROR_INVALID_PARAMETER));
SetLastError(0xfaceabee); /* 4th param, */
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, newprofile, NULL);
ok( !ret && GetLastError() == ERROR_INVALID_PARAMETER, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
if (query_colorspace(SPACE_RGB)) if (query_colorspace(SPACE_RGB))
{ {
fail_GSCSP(A, NULL, SPACE_RGB, NULL, &size, sizeP, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER)); SetLastError(0xfaceabee); /* 3rd param, */
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, NULL, &sizeP);
ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* dereferenced 4th param, */
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, newprofile, &zero);
todo_wine todo_wine
fail_GSCSP(A, NULL, SPACE_RGB, newprofile, &size, 0, FALSE, (GLE == ERROR_MORE_DATA || GLE == ERROR_INSUFFICIENT_BUFFER)); ok( !ret && (GetLastError() == ERROR_MORE_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER), "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
} else { } else {
SetLastError(0xfaceabee); /* 3rd param, */
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, NULL, &sizeP);
todo_wine todo_wine
fail_GSCSP(A, NULL, SPACE_RGB, NULL, &size, sizeP, FALSE, (GLE == ERROR_FILE_NOT_FOUND)); ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* dereferenced 4th param. */
ret = pGetStandardColorSpaceProfileA(NULL, SPACE_RGB, newprofile, &sizeP);
todo_wine todo_wine
fail_GSCSP(A, NULL, SPACE_RGB, newprofile, &size, 0, FALSE, (GLE == ERROR_FILE_NOT_FOUND)); ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
} }
/* Several invalid parameter checks */ /* Several invalid parameter checks: */
fail_GSCSP(A, machine, 0, newprofile, &size, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER || GLE == ERROR_NOT_SUPPORTED));
fail_GSCSP(A, NULL, 0, newprofile, NULL, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER)); SetLastError(0xfaceabee); /* 1st, maybe 2nd and then dereferenced 4th param, */
fail_GSCSP(A, NULL, 0, NULL, &size, 0, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND)); ret = pGetStandardColorSpaceProfileA(machine, 0, newprofile, &zero);
todo_wine ok( !ret && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_NOT_SUPPORTED), "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
fail_GSCSP(A, NULL, 0, newprofile, &size, sizeP, TRUE, (GLE == ERROR_FILE_NOT_FOUND));
#undef A SetLastError(0xfaceabee); /* maybe 2nd and then 4th param, */
ret = pGetStandardColorSpaceProfileA(NULL, 0, newprofile, NULL);
ok( !ret && GetLastError() == ERROR_INVALID_PARAMETER, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* maybe 2nd, then 3rd and dereferenced 4th param, */
ret = pGetStandardColorSpaceProfileA(NULL, 0, NULL, &zero);
ok( !ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER || GetLastError() == ERROR_FILE_NOT_FOUND), "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* maybe 2nd param. */
ret = pGetStandardColorSpaceProfileA(NULL, 0, newprofile, &sizeP);
if (!ret) todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
else ok( !lstrcmpiA( newprofile, emptyA ) && GetLastError() == 0xfaceabee, "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GetLastError() );
/* Functional checks */ /* Functional checks */
@ -654,32 +672,57 @@ static void test_GetStandardColorSpaceProfileA(void)
static void test_GetStandardColorSpaceProfileW(void) static void test_GetStandardColorSpaceProfileW(void)
{ {
BOOL ret; BOOL ret;
DWORD size, sizeP, GLE; DWORD size;
WCHAR oldprofile[MAX_PATH]; WCHAR oldprofile[MAX_PATH];
WCHAR newprofile[MAX_PATH]; WCHAR newprofile[MAX_PATH];
WCHAR emptyW[] = {0}; const WCHAR emptyW[] = {0};
DWORD zero = 0;
sizeP = sizeof(newprofile); DWORD sizeP = sizeof(newprofile);
/* Parameter checks */ /* Parameter checks */
#define W /* Single invalid parameter checks: */
/* Single invalid parameter checks */
fail_GSCSP(W, machineW, SPACE_RGB, newprofile, &size, sizeP, FALSE, (GLE == ERROR_NOT_SUPPORTED));
todo_wine
fail_GSCSP(W, NULL, (DWORD)-1, newprofile, &size, sizeP, FALSE, (GLE == ERROR_FILE_NOT_FOUND));
fail_GSCSP(W, NULL, SPACE_RGB, NULL, &size, sizeP, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER));
fail_GSCSP(W, NULL, SPACE_RGB, newprofile, NULL, sizeP, FALSE, (GLE == ERROR_INVALID_PARAMETER));
todo_wine
fail_GSCSP(W, NULL, SPACE_RGB, newprofile, &size, 0, FALSE, (GLE == ERROR_MORE_DATA || GLE == ERROR_INSUFFICIENT_BUFFER));
/* Several invalid parameter checks */ SetLastError(0xfaceabee); /* 1st param, */
fail_GSCSP(W, machineW, 0, newprofile, &size, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER || GLE == ERROR_NOT_SUPPORTED)); ret = pGetStandardColorSpaceProfileW(machineW, SPACE_RGB, newprofile, &sizeP);
fail_GSCSP(W, NULL, 0, newprofile, NULL, 0, FALSE, (GLE == ERROR_INVALID_PARAMETER)); ok( !ret && GetLastError() == ERROR_NOT_SUPPORTED, "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
fail_GSCSP(W, NULL, 0, NULL, &size, 0, FALSE, (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND));
todo_wine SetLastError(0xfaceabee); /* 2nd param, */
fail_GSCSP(W, NULL, 0, newprofile, &size, sizeP, TRUE, (GLE == ERROR_FILE_NOT_FOUND)); ret = pGetStandardColorSpaceProfileW(NULL, (DWORD)-1, newprofile, &sizeP);
#undef W todo_wine
ok( !ret && GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* 3th param, */
ret = pGetStandardColorSpaceProfileW(NULL, SPACE_RGB, NULL, &sizeP);
ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* 4th param, */
ret = pGetStandardColorSpaceProfileW(NULL, SPACE_RGB, newprofile, NULL);
ok( !ret && GetLastError() == ERROR_INVALID_PARAMETER, "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* dereferenced 4th param. */
ret = pGetStandardColorSpaceProfileW(NULL, SPACE_RGB, newprofile, &zero);
todo_wine
ok( !ret && (GetLastError() == ERROR_MORE_DATA || GetLastError() == ERROR_INSUFFICIENT_BUFFER), "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
/* Several invalid parameter checks: */
SetLastError(0xfaceabee); /* 1st, maybe 2nd and then dereferenced 4th param, */
ret = pGetStandardColorSpaceProfileW(machineW, 0, newprofile, &zero);
ok( !ret && (GetLastError() == ERROR_INVALID_PARAMETER || GetLastError() == ERROR_NOT_SUPPORTED), "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* maybe 2nd and then 4th param, */
ret = pGetStandardColorSpaceProfileW(NULL, 0, newprofile, NULL);
ok( !ret && GetLastError() == ERROR_INVALID_PARAMETER, "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* maybe 2nd, then 3rd and dereferenced 4th param, */
ret = pGetStandardColorSpaceProfileW(NULL, 0, NULL, &zero);
ok( !ret && (GetLastError() == ERROR_INSUFFICIENT_BUFFER || GetLastError() == ERROR_FILE_NOT_FOUND), "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
SetLastError(0xfaceabee); /* maybe 2nd param. */
ret = pGetStandardColorSpaceProfileW(NULL, 0, newprofile, &sizeP);
if (!ret) todo_wine ok( GetLastError() == ERROR_FILE_NOT_FOUND, "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
else ok( !lstrcmpiW( newprofile, emptyW ) && GetLastError() == 0xfaceabee, "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GetLastError() );
/* Functional checks */ /* Functional checks */