mscms: move repetitive code to a helper macros
Saulius Krasuckas
saulius2 at ar.fi.lt
Tue Dec 13 06:56:36 CST 2005
sizeP variable isn't actually required by the code, but it helps me to
write out several calls to macros as a single, tight and nice table.
(which will become even more readable after the todo_wines are removed)
Two blank spaces before the second parameter to macros are put
intentionaly, as all zeroes are planned to be replaced with '-1'.
Log message:
Saulius Krasuckas <saulius.krasuckas at ieee.org>
Move code of repetitive checks to a two helper macros.
Index: dlls/mscms/tests/profile.c
===================================================================
RCS file: /home/wine/wine/dlls/mscms/tests/profile.c,v
retrieving revision 1.20
diff -p -u -r1.20 profile.c
--- dlls/mscms/tests/profile.c 12 Dec 2005 17:16:01 -0000 1.20
+++ dlls/mscms/tests/profile.c 13 Dec 2005 11:54:10 -0000
@@ -439,46 +439,35 @@ static void test_GetCountColorProfileEle
}
}
+#define fail_GSCSPA(pMachName, dwProfID, pProfName, pdwSz, dwSz, GLE_OK) \
+do { \
+ size = dwSz; \
+ SetLastError(0); \
+ ret = pGetStandardColorSpaceProfileA(pMachName, dwProfID, pProfName, pdwSz);\
+ GLE = GetLastError(); \
+ ok( !ret && GLE_OK, \
+ "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE ); \
+} while (0)
+
static void test_GetStandardColorSpaceProfileA(void)
{
BOOL ret;
- DWORD size, GLE;
+ DWORD size, sizeP, GLE;
CHAR oldprofile[MAX_PATH];
CHAR newprofile[MAX_PATH];
+ sizeP = sizeof(newprofile);
+
/* Parameter checks */
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileA( NULL, 0, newprofile, NULL );
- GLE = GetLastError();
- todo_wine
- ok( !ret && GLE == ERROR_INVALID_PARAMETER,
- "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE );
-
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileA( machine, 0, newprofile, &size );
- GLE = GetLastError();
- todo_wine
- ok( !ret && (GLE == ERROR_INVALID_PARAMETER || GLE == ERROR_NOT_SUPPORTED),
- "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE );
-
- size = 0;
-
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileA( NULL, 0, NULL, &size );
- GLE = GetLastError();
- todo_wine
- ok( !ret && (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND),
- "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE );
-
- size = sizeof(newprofile);
-
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileA( NULL, 0, newprofile, &size );
- GLE = GetLastError();
- todo_wine
- ok( !ret && GLE == ERROR_FILE_NOT_FOUND,
- "GetStandardColorSpaceProfileA() returns %d (GLE=%ld)\n", ret, GLE );
+ todo_wine
+ fail_GSCSPA(machine, 0, newprofile, &size, 0, (GLE == ERROR_INVALID_PARAMETER || GLE == ERROR_NOT_SUPPORTED));
+ todo_wine
+ fail_GSCSPA(NULL, 0, newprofile, NULL, 0, (GLE == ERROR_INVALID_PARAMETER));
+ todo_wine
+ fail_GSCSPA(NULL, 0, NULL, &size, 0, (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND));
+ todo_wine
+ fail_GSCSPA(NULL, 0, newprofile, &size, sizeP, (GLE == ERROR_FILE_NOT_FOUND));
/* Functional checks */
@@ -504,46 +493,35 @@ static void test_GetStandardColorSpacePr
}
}
+#define fail_GSCSPW(pMachName, dwProfID, pProfName, pdwSz, dwSz, GLE_OK) \
+do { \
+ size = dwSz; \
+ SetLastError(0); \
+ ret = pGetStandardColorSpaceProfileW(pMachName, dwProfID, pProfName, pdwSz);\
+ GLE = GetLastError(); \
+ ok( !ret && GLE_OK, \
+ "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GLE ); \
+} while (0)
+
static void test_GetStandardColorSpaceProfileW(void)
{
BOOL ret;
- DWORD size, GLE;
+ DWORD size, sizeP, GLE;
WCHAR oldprofile[MAX_PATH];
WCHAR newprofile[MAX_PATH];
+ sizeP = sizeof(newprofile);
+
/* Parameter checks */
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileW( NULL, 0, newprofile, NULL );
- GLE = GetLastError();
- todo_wine
- ok( !ret && GLE == ERROR_INVALID_PARAMETER,
- "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GLE );
-
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileW( machineW, 0, newprofile, &size );
- GLE = GetLastError();
- todo_wine
- ok( !ret && GLE == ERROR_INVALID_PARAMETER,
- "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GLE );
-
- size = 0;
-
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileW( NULL, 0, NULL, &size );
- GLE = GetLastError();
- todo_wine
- ok( !ret && (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND),
- "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GLE );
-
- size = sizeof(newprofile);
-
- SetLastError(0);
- ret = pGetStandardColorSpaceProfileW( NULL, 0, newprofile, &size );
- GLE = GetLastError();
- todo_wine
- ok( !ret && GLE == ERROR_FILE_NOT_FOUND,
- "GetStandardColorSpaceProfileW() returns %d (GLE=%ld)\n", ret, GLE );
+ todo_wine
+ fail_GSCSPW(machineW, 0, newprofile, &size, 0, (GLE == ERROR_INVALID_PARAMETER));
+ todo_wine
+ fail_GSCSPW(NULL, 0, newprofile, NULL, 0, (GLE == ERROR_INVALID_PARAMETER));
+ todo_wine
+ fail_GSCSPW(NULL, 0, NULL, &size, 0, (GLE == ERROR_INSUFFICIENT_BUFFER || GLE == ERROR_FILE_NOT_FOUND));
+ todo_wine
+ fail_GSCSPW(NULL, 0, newprofile, &size, sizeP, (GLE == ERROR_FILE_NOT_FOUND));
/* Functional checks */
More information about the wine-patches
mailing list