Author: tkreuzer
Date: Mon Aug 6 03:05:02 2007
New Revision: 28182
URL:
http://svn.reactos.org/svn/reactos?rev=28182&view=rev
Log:
- convert a bunch of tests to regression tests as they succeed on ros
- add tests for NtGdiGetRandomRgn
Added:
trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c
Modified:
trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c
trunk/rostests/apitests/gdi32api/tests/CreateFont.c
trunk/rostests/apitests/gdi32api/tests/CreatePen.c
trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c
trunk/rostests/apitests/gdi32api/tests/GetObject.c
trunk/rostests/apitests/gdi32api/tests/GetStockObject.c
trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c
trunk/rostests/apitests/gdi32api/tests/SetSysColors.c
trunk/rostests/apitests/w32knapi/testlist.c
Modified: trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/CreateCompatibleDC.c Mon Aug 6 03:05:02 2007
@@ -13,7 +13,7 @@
}
hDC = CreateCompatibleDC(hDCScreen);
- TEST(hDC != NULL);
+ RTEST(hDC != NULL);
// Test if first selected pen is BLACK_PEN (? or same as screen DC's pen?)
TEST(SelectObject(hDC, GetStockObject(DC_PEN)) == GetStockObject(BLACK_PEN));
@@ -27,7 +27,7 @@
DeleteDC(hDC);
hDC = CreateCompatibleDC(hDCScreen);
hDC2 = CreateCompatibleDC(hOldDC);
- TEST(hDC2 == NULL);
+ RTEST(hDC2 == NULL);
if (hDC2 != NULL) DeleteDC(hDC2);
// cleanup
Modified: trunk/rostests/apitests/gdi32api/tests/CreateFont.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/CreateFont.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/CreateFont.c Mon Aug 6 03:05:02 2007
@@ -12,10 +12,10 @@
hFont = CreateFontA(15, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE,
DEFAULT_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, DEFAULT_PITCH, INVALIDFONT);
- TEST(hFont);
- TEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA));
- TEST(memcmp(logfonta.lfFaceName, INVALIDFONT, strlen(INVALIDFONT)) == 0);
- TEST(logfonta.lfWeight == FW_DONTCARE);
+ RTEST(hFont);
+ RTEST(GetObjectA(hFont, sizeof(LOGFONTA), &logfonta) == sizeof(LOGFONTA));
+ RTEST(memcmp(logfonta.lfFaceName, INVALIDFONT, strlen(INVALIDFONT)) == 0);
+ RTEST(logfonta.lfWeight == FW_DONTCARE);
return APISTATUS_NORMAL;
Modified: trunk/rostests/apitests/gdi32api/tests/CreatePen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/C…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/CreatePen.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/CreatePen.c Mon Aug 6 03:05:02 2007
@@ -22,36 +22,36 @@
/* PS_GEOMETRIC | PS_DASHDOT = 0x00001011 will become PS_SOLID */
logpen.lopnStyle = 22;
hPen = CreatePen(PS_GEOMETRIC | PS_DASHDOT, 5, RGB(1,2,3));
- TEST(hPen);
+ RTEST(hPen);
GetObject(hPen, sizeof(logpen), &logpen);
- TEST(logpen.lopnStyle == PS_SOLID);
+ RTEST(logpen.lopnStyle == PS_SOLID);
DeleteObject(hPen);
/* PS_USERSTYLE will become PS_SOLID */
logpen.lopnStyle = 22;
hPen = CreatePen(PS_USERSTYLE, 5, RGB(1,2,3));
- TEST(hPen);
+ RTEST(hPen);
GetObject(hPen, sizeof(logpen), &logpen);
- TEST(logpen.lopnStyle == PS_SOLID);
+ RTEST(logpen.lopnStyle == PS_SOLID);
DeleteObject(hPen);
/* PS_ALTERNATE will become PS_SOLID */
logpen.lopnStyle = 22;
hPen = CreatePen(PS_ALTERNATE, 5, RGB(1,2,3));
- TEST(hPen);
+ RTEST(hPen);
GetObject(hPen, sizeof(logpen), &logpen);
- TEST(logpen.lopnStyle == PS_SOLID);
+ RTEST(logpen.lopnStyle == PS_SOLID);
DeleteObject(hPen);
/* PS_INSIDEFRAME is ok */
logpen.lopnStyle = 22;
hPen = CreatePen(PS_INSIDEFRAME, 5, RGB(1,2,3));
- TEST(hPen);
+ RTEST(hPen);
GetObject(hPen, sizeof(logpen), &logpen);
- TEST(logpen.lopnStyle == PS_INSIDEFRAME);
+ RTEST(logpen.lopnStyle == PS_INSIDEFRAME);
DeleteObject(hPen);
- TEST(GetLastError() == ERROR_SUCCESS);
+ RTEST(GetLastError() == ERROR_SUCCESS);
return APISTATUS_NORMAL;
}
Modified: trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/E…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/ExtCreatePen.c Mon Aug 6 03:05:02 2007
@@ -14,14 +14,14 @@
if (!hPen) return FALSE;
/* Test if we have an EXTPEN */
- TEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
+ RTEST(GDI_HANDLE_GET_TYPE(hPen) == GDI_OBJECT_TYPE_EXTPEN);
DeleteObject(hPen);
/* test userstyles */
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 17, (CONST
DWORD*)&dwStyles);
- TEST(hPen == 0);
+ RTEST(hPen == 0);
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST
DWORD*)&dwStyles);
- TEST(hPen != 0);
+ RTEST(hPen != 0);
DeleteObject(hPen);
Modified: trunk/rostests/apitests/gdi32api/tests/GetObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/GetObject.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/GetObject.c Mon Aug 6 03:05:02 2007
@@ -276,18 +276,18 @@
TEST(extlogpen.elpPenStyle == (PS_GEOMETRIC | PS_DASH));
TEST(extlogpen.elpWidth == 5);
TEST(extlogpen.elpBrushStyle == 0);
- TEST(extlogpen.elpColor == RGB(1,2,3));
- TEST(extlogpen.elpHatch == 22);
- TEST(extlogpen.elpNumEntries == 0);
+ RTEST(extlogpen.elpColor == RGB(1,2,3));
+ RTEST(extlogpen.elpHatch == 22);
+ RTEST(extlogpen.elpNumEntries == 0);
DeleteObject(hPen);
/* A maximum of 16 Styles is allowed */
hPen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 5, &logbrush, 16, (CONST
DWORD*)&dwStyles);
- TEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
- TEST(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) ==
sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
- TEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[0] == 0);
- TEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[1] == 1);
- TEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[15] == 15);
+ RTEST(GetObject(hPen, 0, NULL) == sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
+ RTEST(GetObject(hPen, sizeof(EXTLOGPEN) + 15*sizeof(DWORD), &elpUserStyle) ==
sizeof(EXTLOGPEN) + 15*sizeof(DWORD));
+ RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[0] == 0);
+ RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[1] == 1);
+ RTEST(((EXTLOGPEN*)&elpUserStyle)->elpStyleEntry[15] == 15);
DeleteObject(hPen);
return TRUE;
Modified: trunk/rostests/apitests/gdi32api/tests/GetStockObject.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/G…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/GetStockObject.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/GetStockObject.c Mon Aug 6 03:05:02 2007
@@ -9,19 +9,19 @@
TEST(GetStockObject(21) != NULL);
TEST(GetStockObject(-1) == NULL);
TEST(GetStockObject(9) == NULL);
- TEST(GetStockObject(22) == NULL);
- TEST(GetLastError() == ERROR_SUCCESS);
+ RTEST(GetStockObject(22) == NULL);
+ RTEST(GetLastError() == ERROR_SUCCESS);
/* Test for the stock bit */
- TEST((UINT)GetStockObject(WHITE_BRUSH) && GDI_HANDLE_STOCK_MASK);
+ RTEST((UINT)GetStockObject(WHITE_BRUSH) && GDI_HANDLE_STOCK_MASK);
/* Test for correct types */
- TEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_BRUSH)) == GDI_OBJECT_TYPE_BRUSH);
+ RTEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_BRUSH)) == GDI_OBJECT_TYPE_BRUSH);
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DC_BRUSH)) == GDI_OBJECT_TYPE_BRUSH);
- TEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_PEN)) == GDI_OBJECT_TYPE_PEN);
+ RTEST(GDI_HANDLE_GET_TYPE(GetStockObject(WHITE_PEN)) == GDI_OBJECT_TYPE_PEN);
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DC_PEN)) == GDI_OBJECT_TYPE_PEN);
TEST(GDI_HANDLE_GET_TYPE(GetStockObject(ANSI_VAR_FONT)) == GDI_OBJECT_TYPE_FONT);
- TEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEFAULT_PALETTE)) == GDI_OBJECT_TYPE_PALETTE);
+ RTEST(GDI_HANDLE_GET_TYPE(GetStockObject(DEFAULT_PALETTE)) == GDI_OBJECT_TYPE_PALETTE);
return APISTATUS_NORMAL;
}
Modified: trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/S…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/SetDCPenColor.c Mon Aug 6 03:05:02 2007
@@ -6,7 +6,7 @@
HDC hScreenDC, hDC;
// Test an incorrect DC
- TEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
+ RTEST(SetDCPenColor(0, RGB(0,0,0)) == CLR_INVALID);
// Get the Screen DC
hScreenDC = GetDC(NULL);
@@ -34,7 +34,7 @@
// Test CLR_INVALID, it sets CLR_INVALID!
SetDCPenColor(hDC, CLR_INVALID);
- TEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
+ RTEST(SetDCPenColor(hDC, RGB(0,0,0)) == CLR_INVALID);
// Delete the DC
DeleteDC(hDC);
Modified: trunk/rostests/apitests/gdi32api/tests/SetSysColors.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/gdi32api/tests/S…
==============================================================================
--- trunk/rostests/apitests/gdi32api/tests/SetSysColors.c (original)
+++ trunk/rostests/apitests/gdi32api/tests/SetSysColors.c Mon Aug 6 03:05:02 2007
@@ -18,11 +18,11 @@
}
TEST((UINT)SetSysColors(0, nElements, crColors) == 1);
- TEST((UINT)SetSysColors(1, nElements, crColors) == 1);
- TEST((UINT)SetSysColors(2, nElements, crColors) == 1);
+ RTEST((UINT)SetSysColors(1, nElements, crColors) == 1);
+ RTEST((UINT)SetSysColors(2, nElements, crColors) == 1);
/* try more than NUM_SYSCOLORS */
- TEST((UINT)SetSysColors(55, nElements, crColors) == 1);
+ RTEST((UINT)SetSysColors(55, nElements, crColors) == 1);
/* restore old SysColors */
SetSysColors(NUM_SYSCOLORS, nElements, crOldColors);
Added: trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/ntgdi/N…
==============================================================================
--- trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c (added)
+++ trunk/rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c Mon Aug 6 03:05:02 2007
@@ -1,0 +1,74 @@
+#include "../w32knapi.h"
+
+W32KAPI
+INT
+APIENTRY
+NtGdiGetRandomRgn(
+ IN HDC hdc,
+ IN HRGN hrgn,
+ IN INT iRgn)
+{
+ return (INT)Syscall(L"NtGdiGetRandomRgn", 3, &hdc);
+}
+
+
+INT
+Test_NtGdiGetRandomRgn(PTESTINFO pti)
+{
+ HWND hWnd;
+ HDC hDC;
+ HRGN hrgn, hrgn2;
+
+ /* Create a window */
+ hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW |
WS_VISIBLE,
+ CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
+ NULL, NULL, g_hInstance, 0);
+// UpdateWindow(hWnd);
+ hDC = GetDC(hWnd);
+
+ ASSERT1(hDC != NULL);
+
+ hrgn = CreateRectRgn(0,0,0,0);
+ hrgn2 = CreateRectRgn(3,3,10,10);
+ SetLastError(ERROR_SUCCESS);
+ TEST(NtGdiGetRandomRgn(0, hrgn, 0) == -1);
+ TEST(GetLastError() == ERROR_INVALID_HANDLE);
+
+ SetLastError(ERROR_SUCCESS);
+ TEST(NtGdiGetRandomRgn(hDC, 0, 0) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, (HRGN)-5, 0) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 0) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 2) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 3) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 5) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 10) == 0);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, -10) == 0);
+ RTEST(GetLastError() == ERROR_SUCCESS);
+
+ SelectClipRgn(hDC, hrgn2);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
+ TEST(CombineRgn(hrgn, hrgn, hrgn, RGN_OR) == SIMPLEREGION);
+ TEST(CombineRgn(hrgn, hrgn, hrgn2, RGN_XOR) == NULLREGION);
+
+ SetRectRgn(hrgn2,0,0,0,0);
+ SelectClipRgn(hDC, hrgn2);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 1);
+
+ TEST(CombineRgn(hrgn2, hrgn, hrgn2, RGN_XOR) == NULLREGION);
+ TEST(CombineRgn(hrgn2, hrgn, hrgn, RGN_OR) == NULLREGION);
+
+ SelectClipRgn(hDC, NULL);
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 1) == 0);
+
+
+ TEST(NtGdiGetRandomRgn(hDC, hrgn, 4) == 1);
+
+ RTEST(GetLastError() == ERROR_SUCCESS);
+
+ DeleteDC(hDC);
+ DestroyWindow(hWnd);
+
+ return APISTATUS_NORMAL;
+}
Modified: trunk/rostests/apitests/w32knapi/testlist.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/apitests/w32knapi/testlis…
==============================================================================
--- trunk/rostests/apitests/w32knapi/testlist.c (original)
+++ trunk/rostests/apitests/w32knapi/testlist.c Mon Aug 6 03:05:02 2007
@@ -9,6 +9,7 @@
#include "ntgdi/NtGdiArcInternal.c"
//#include "ntgdi/NtGdiDoPalette.c"
#include "ntgdi/NtGdiGetBitmapBits.c"
+#include "ntgdi/NtGdiGetRandomRgn.c"
#include "ntgdi/NtGdiSetBitmapBits.c"
//#include "ntgdi/NtGdiSTROBJ_vEnumStart.c"
@@ -26,6 +27,7 @@
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
// { L"NtGdiDoPalette", Test_NtGdiDoPalette },
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
+ { L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
// { L"NtGdiSTROBJ_vEnumStart", Test_NtGdiSTROBJ_vEnumStart },