Author: rharabien
Date: Mon Mar 21 14:36:32 2011
New Revision: 51107
URL:
http://svn.reactos.org/svn/reactos?rev=51107&view=rev
Log:
Improve GetClipRgn and SetSysColors apitests
Modified:
trunk/rostests/apitests/gdi32/GetClipRgn.c
trunk/rostests/apitests/gdi32/SetSysColors.c
Modified: trunk/rostests/apitests/gdi32/GetClipRgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/GetClipRgn…
==============================================================================
--- trunk/rostests/apitests/gdi32/GetClipRgn.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/GetClipRgn.c [iso-8859-1] Mon Mar 21 14:36:32 2011
@@ -14,6 +14,7 @@
HWND hWnd;
HDC hDC;
HRGN hrgn;//, hrgn2;
+ int ret;
/* Create a window */
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW |
WS_VISIBLE,
@@ -25,13 +26,15 @@
/* Test invalid DC */
SetLastError(ERROR_SUCCESS);
- ok(GetClipRgn((HDC)0x12345, hrgn) == -1, "\n");
- ok(GetLastError() == ERROR_INVALID_PARAMETER, "\n");
+ ret = GetClipRgn((HDC)0x12345, hrgn);
+ ok(ret == -1, "Expected -1, got %d\n", ret);
+ ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER,
got %ld\n", GetLastError());
/* Test invalid hrgn */
SetLastError(ERROR_SUCCESS);
- ok(GetClipRgn(hDC, (HRGN)0x12345) == 0, "\n");
- ok(GetLastError() == ERROR_SUCCESS, "\n");
+ ret = GetClipRgn(hDC, (HRGN)0x12345);
+ ok(ret == 0, "Expected 0, got %d\n", ret);
+ ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %ld\n",
GetLastError());
ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);
Modified: trunk/rostests/apitests/gdi32/SetSysColors.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32/SetSysColo…
==============================================================================
--- trunk/rostests/apitests/gdi32/SetSysColors.c [iso-8859-1] (original)
+++ trunk/rostests/apitests/gdi32/SetSysColors.c [iso-8859-1] Mon Mar 21 14:36:32 2011
@@ -10,16 +10,15 @@
#include <windows.h>
#define TEST(x) ok(x, #x"\n")
-#define RTEST(x) ok(x, #x"\n")
#define NUM_SYSCOLORS 31
void Test_SetSysColors()
{
INT i;
- INT nElements[NUM_SYSCOLORS];
+ INT nElements[NUM_SYSCOLORS+1];
COLORREF crOldColors[NUM_SYSCOLORS];
- COLORREF crColors[3] = {RGB(212, 208, 200),2,3};
+ COLORREF crColors[NUM_SYSCOLORS+1];
/* First save the Old colors */
for (i = 0; i < NUM_SYSCOLORS; i++)
@@ -27,13 +26,30 @@
nElements[i] = i;
crOldColors[i] = GetSysColor(i);
}
-
- TEST((UINT)SetSysColors(0, nElements, crColors) == 1);
- RTEST((UINT)SetSysColors(1, nElements, crColors) == 1);
- RTEST((UINT)SetSysColors(2, nElements, crColors) == 1);
+
+ for (i = 0; i < NUM_SYSCOLORS+1; i++)
+ crColors[i] = RGB(i, 255-i, i*3);
+ nElements[NUM_SYSCOLORS] = nElements[0];
+
+ SetLastError(0xdeadbeef);
+ ok(SetSysColors(-1, nElements, crColors) == FALSE, "Expected FALSE, got
TRUE\n");
+ ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_INVALID_PARAMETER, got
%ld\n", GetLastError());
+ ok(SetSysColors(0, nElements, crColors) == TRUE, "Expected TRUE, got
FALSE\n");
+ ok(SetSysColors(0, NULL, crColors) == TRUE, "Expected TRUE, got FALSE\n");
+ ok(SetSysColors(0, nElements, NULL) == TRUE, "Expected TRUE, got FALSE\n");
+ ok(SetSysColors(1, NULL, crColors) == FALSE, "Expected FALSE, got TRUE\n");
+ ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_INVALID_PARAMETER, got
%ld\n", GetLastError());
+ ok(SetSysColors(1, nElements, NULL) == FALSE, "Expected FALSE, got TRUE\n");
+ ok(GetLastError() == ERROR_NOACCESS, "Expected ERROR_INVALID_PARAMETER, got
%ld\n", GetLastError());
+ ok(SetSysColors(1, nElements, crColors) == TRUE, "Expected TRUE, got
FALSE\n");
+ ok(SetSysColors(NUM_SYSCOLORS, nElements, crColors) == TRUE, "Expected TRUE, got
FALSE\n");
+ for (i = 0; i < NUM_SYSCOLORS; i++)
+ ok(GetSysColor(nElements[i]) == crColors[i], "Expected %06lx, got %06lx\n",
crColors[i], GetSysColor(nElements[i]));
/* try more than NUM_SYSCOLORS */
- RTEST((UINT)SetSysColors(55, nElements, crColors) == 1);
+ ok(SetSysColors(NUM_SYSCOLORS+1, nElements, crColors) == TRUE, "Expected TRUE, got
FALSE\n");
+ nElements[NUM_SYSCOLORS] = 10000;
+ ok(SetSysColors(NUM_SYSCOLORS+1, nElements, crColors) == TRUE, "Expected TRUE, got
FALSE\n");
/* restore old SysColors */
SetSysColors(NUM_SYSCOLORS, nElements, crOldColors);