mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
- convert a bunch of tests to regression tests as they succeed on ros
- add tests for NtGdiGetRandomRgn svn path=/trunk/; revision=28182
This commit is contained in:
parent
619203c31c
commit
174418b0d1
10 changed files with 113 additions and 37 deletions
|
@ -13,7 +13,7 @@ Test_CreateCompatibleDC(PTESTINFO pti)
|
|||
}
|
||||
|
||||
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 @@ Test_CreateCompatibleDC(PTESTINFO pti)
|
|||
DeleteDC(hDC);
|
||||
hDC = CreateCompatibleDC(hDCScreen);
|
||||
hDC2 = CreateCompatibleDC(hOldDC);
|
||||
TEST(hDC2 == NULL);
|
||||
RTEST(hDC2 == NULL);
|
||||
if (hDC2 != NULL) DeleteDC(hDC2);
|
||||
|
||||
// cleanup
|
||||
|
|
|
@ -12,10 +12,10 @@ Test_CreateFont(PTESTINFO pti)
|
|||
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;
|
||||
|
|
|
@ -22,36 +22,36 @@ Test_CreatePen(PTESTINFO pti)
|
|||
/* 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;
|
||||
}
|
||||
|
|
|
@ -14,14 +14,14 @@ Test_ExtCreatePen(PTESTINFO pti)
|
|||
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);
|
||||
|
||||
|
|
|
@ -276,18 +276,18 @@ Test_ExtPen(PTESTINFO pti)
|
|||
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;
|
||||
|
|
|
@ -9,19 +9,19 @@ Test_GetStockObject(PTESTINFO pti)
|
|||
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;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ Test_SetDCPenColor(PTESTINFO pti)
|
|||
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_SetDCPenColor(PTESTINFO pti)
|
|||
|
||||
// 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);
|
||||
|
|
|
@ -18,11 +18,11 @@ Test_SetSysColors(PTESTINFO pti)
|
|||
}
|
||||
|
||||
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);
|
||||
|
|
74
rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c
Normal file
74
rostests/apitests/w32knapi/ntgdi/NtGdiGetRandomRgn.c
Normal file
|
@ -0,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;
|
||||
}
|
|
@ -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 @@ TESTENTRY TestList[] =
|
|||
{ 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 },
|
||||
|
||||
|
|
Loading…
Reference in a new issue