mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 17:05:46 +00:00
Add tests for NtGdiCombineRgn (14), NtGdiCreateCompatibleDC (4), NtGdiDoPalette (1), NtGdiFlushUserBatch (10), NtGdiPolyPolyDraw (60), NtGdiselectBitmap (4), NtGdiSelectPen (6), NtGdiSetDIBitsToDeviceInternal (2), NtUserEnumDisplayMonitors (7), NtUserGetClassInfo (15), NtUserProcessConnect (1), NtUserSelectPalette (13), NtUserSystemParametersInfo (1) (= 138 new tests)
svn path=/trunk/; revision=38044
This commit is contained in:
parent
8a8705ed19
commit
4a3e577b8f
16 changed files with 705 additions and 9 deletions
49
rostests/apitests/w32knapi/ntgdi/NtGdiCombineRgn.c
Normal file
49
rostests/apitests/w32knapi/ntgdi/NtGdiCombineRgn.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiCombineRgn(PTESTINFO pti)
|
||||
{
|
||||
HRGN hRgnDest, hRgn1, hRgn2;
|
||||
// test what params are accepted for what operations
|
||||
// 0? invalid? are params maybe ignored in some cases?
|
||||
// LastError
|
||||
|
||||
/* Preparation */
|
||||
hRgnDest = CreateRectRgn(0,0,1,1);
|
||||
hRgn1 = CreateRectRgn(1,1,4,4);
|
||||
hRgn2 = CreateRectRgn(2,2,6,3);
|
||||
|
||||
/* RGN_AND = 1, RGN_OR = 2, RGN_XOR = 3, RGN_DIFF = 4, RGN_COPY = 5 */
|
||||
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 0) == ERROR);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, 6) == ERROR);
|
||||
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, 0, 0, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, 0, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, 0, hRgn1, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
TEST(NtGdiCombineRgn(0, hRgn1, hRgn2, RGN_AND) == ERROR);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
/* Create intersection */
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgn1, hRgn2, RGN_AND) == SIMPLEREGION);
|
||||
SetRectRgn(hRgn1, 2, 2, 4, 3);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR) == NULLREGION);
|
||||
|
||||
/* Create intersection with itself */
|
||||
SetRectRgn(hRgnDest, 2, 2, 4, 3);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgnDest, RGN_AND) == SIMPLEREGION);
|
||||
SetRectRgn(hRgn1, 2, 2, 4, 3);
|
||||
TEST(NtGdiCombineRgn(hRgnDest, hRgnDest, hRgn1, RGN_XOR) == NULLREGION);
|
||||
|
||||
|
||||
/* What if 2 regions are the same */
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
27
rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c
Normal file
27
rostests/apitests/w32knapi/ntgdi/NtGdiCreateCompatibleDC.c
Normal file
|
@ -0,0 +1,27 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiCreateCompatibleDC(PTESTINFO pti)
|
||||
{
|
||||
HDC hDC;
|
||||
HGDIOBJ hObj;
|
||||
|
||||
/* Test if aa NULL DC is accepted */
|
||||
hDC = NtGdiCreateCompatibleDC(NULL);
|
||||
TEST(hDC != NULL);
|
||||
|
||||
/* We select a nwe palette. Note: SelectObject doesn't work with palettes! */
|
||||
hObj = SelectPalette(hDC, GetStockObject(DEFAULT_PALETTE), 0);
|
||||
/* The old palette should be GetStockObject(DEFAULT_PALETTE) */
|
||||
TEST(hObj == GetStockObject(DEFAULT_PALETTE));
|
||||
|
||||
/* The default bitmap should be GetStockObject(21) */
|
||||
hObj = SelectObject(hDC, GetStockObject(21));
|
||||
TEST(hObj == GetStockObject(21));
|
||||
|
||||
/* The default pen should be GetStockObject(BLACK_PEN) */
|
||||
hObj = SelectObject(hDC, GetStockObject(WHITE_PEN));
|
||||
TEST(hObj == GetStockObject(BLACK_PEN));
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -102,7 +102,8 @@ Test_NtGdiDoPalette_GdiPalAnimate(PTESTINFO pti)
|
|||
INT
|
||||
Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal;
|
||||
HDC hDC;
|
||||
HPALETTE hPal, hOldPal;
|
||||
PALETTEENTRY palEntries[5] = {
|
||||
{0,0,0,0},
|
||||
{0xff,0xff,0xff,0},
|
||||
|
@ -156,6 +157,13 @@ Test_NtGdiDoPalette_GdiPalSetEntries(PTESTINFO pti)
|
|||
|
||||
/* Test that the buffer was not changed */
|
||||
|
||||
|
||||
/* Test with palette selected into dc */
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
hOldPal = SelectPalette(hDC, hPal, 0);
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 4, palEntries, GdiPalSetEntries, TRUE) == 4);
|
||||
SelectPalette(hDC, hOldPal, 0);
|
||||
|
||||
/* Test pEntries = NULL */
|
||||
RTEST(NtGdiDoPalette(hPal, 0, 1, NULL, GdiPalGetEntries, TRUE) == 0);
|
||||
|
||||
|
|
35
rostests/apitests/w32knapi/ntgdi/NtGdiFlushUserBatch.c
Normal file
35
rostests/apitests/w32knapi/ntgdi/NtGdiFlushUserBatch.c
Normal file
|
@ -0,0 +1,35 @@
|
|||
|
||||
INT
|
||||
Test_NtGdiFlushUserBatch(PTESTINFO pti)
|
||||
{
|
||||
PVOID pRet;
|
||||
PTEB pTeb;
|
||||
|
||||
pTeb = NtCurrentTeb();
|
||||
ASSERT(pTeb);
|
||||
|
||||
pRet = (PVOID)NtGdiFlushUserBatch();
|
||||
|
||||
TEST(pRet != 0);
|
||||
TEST(pRet == &pTeb->RealClientId);
|
||||
|
||||
TEST(pTeb->GdiBatchCount == 0);
|
||||
TEST(pTeb->GdiTebBatch.Offset == 0);
|
||||
TEST(pTeb->GdiTebBatch.HDC == 0);
|
||||
|
||||
/* Set up some bullshit */
|
||||
pTeb->InDbgPrint = 1;
|
||||
pTeb->GdiBatchCount = 12;
|
||||
pTeb->GdiTebBatch.Offset = 21;
|
||||
pTeb->GdiTebBatch.HDC = (HDC)123;
|
||||
|
||||
pRet = (PVOID)NtGdiFlushUserBatch();
|
||||
TEST(pRet == &pTeb->RealClientId);
|
||||
|
||||
TEST(pTeb->InDbgPrint == 0);
|
||||
TEST(pTeb->GdiBatchCount == 12);
|
||||
TEST(pTeb->GdiTebBatch.Offset == 0);
|
||||
TEST(pTeb->GdiTebBatch.HDC == 0);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
208
rostests/apitests/w32knapi/ntgdi/NtGdiPolyPolyDraw.c
Normal file
208
rostests/apitests/w32knapi/ntgdi/NtGdiPolyPolyDraw.c
Normal file
|
@ -0,0 +1,208 @@
|
|||
|
||||
|
||||
static
|
||||
INT
|
||||
Test_Params(PTESTINFO pti)
|
||||
{
|
||||
ULONG_PTR ret;
|
||||
ULONG Count1[4] = {3, 2, 4, 3};
|
||||
ULONG Count2[2] = {0, 3};
|
||||
ULONG Count3[2] = {0, 0};
|
||||
ULONG Count4[2] = {1, 3};
|
||||
ULONG Count5[2] = {0x80000001, 0x80000001};
|
||||
POINT Points[6] = {{0,0}, {1,1}, {3,-3}, {-2,2}, {4,2}, {2,4}};
|
||||
HDC hDC;
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 2);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 3);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 4);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 5);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(NULL, NULL, NULL, 0, 6);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Test with an invalid DC */
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(0, Points, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
hDC = (HDC)0x12345;
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 2);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 3);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 4);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 5);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 6);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw((HDC)1, Points, Count1, 1, 6);
|
||||
TEST((ret & GDI_HANDLE_BASETYPE_MASK) == GDI_OBJECT_TYPE_REGION);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw((HDC)0, Points, Count1, 1, 6);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 0, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count2, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_HANDLE);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, NULL, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, (PVOID)0x81000000, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, NULL, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, (PVOID)0x81000000, Count1, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/* Test with a valid DC */
|
||||
|
||||
hDC = CreateCompatibleDC(NULL);
|
||||
ASSERT(hDC);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 0);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 1);
|
||||
TEST(ret == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 2);
|
||||
TEST(ret == 1);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
#if 0
|
||||
SetLastError(0);
|
||||
// better don't do this on win xp!!! (random crashes)
|
||||
// ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 3);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
// better don't do this on win xp!!! (random crashes)
|
||||
// ret = NtGdiPolyPolyDraw(hDC, Points, Count1, 2, 4);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
#endif
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count2, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count3, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 0);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count4, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == ERROR_INVALID_PARAMETER);
|
||||
|
||||
SetLastError(0);
|
||||
ret = NtGdiPolyPolyDraw(hDC, Points, Count5, 2, 1);
|
||||
TEST(ret == 0);
|
||||
TEST(GetLastError() == 87);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiPolyPolyDraw(PTESTINFO pti)
|
||||
{
|
||||
Test_Params(pti);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
|
@ -3,11 +3,25 @@ Test_NtGdiSelectBitmap(PTESTINFO pti)
|
|||
{
|
||||
HDC hDC;
|
||||
HBITMAP hBmp, hOldBmp;
|
||||
HPALETTE hOldPalette, hPalette;
|
||||
LOGPALETTE logpal = {0x300, 1, {{12,13,14,15}}};
|
||||
|
||||
hBmp = CreateBitmap(2,2,1,1,NULL);
|
||||
ASSERT(hBmp);
|
||||
|
||||
/* We cannot select a bitmap into a display DC */
|
||||
hDC = GetDC(NULL);
|
||||
ASSERT(hDC);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hBmp);
|
||||
TEST(hOldBmp == NULL);
|
||||
|
||||
hDC = CreateCompatibleDC(GetDC(NULL));
|
||||
ASSERT(hDC);
|
||||
|
||||
hBmp = CreateBitmap(2,2,1,1,NULL);
|
||||
/* Check the palette before we mess it up*/
|
||||
hPalette = CreatePalette(&logpal);
|
||||
hOldPalette = SelectPalette(hDC, hPalette, 0);
|
||||
TEST(hOldPalette == GetStockObject(DEFAULT_PALETTE));
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
|
@ -27,20 +41,30 @@ Test_NtGdiSelectBitmap(PTESTINFO pti)
|
|||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL bitmap */
|
||||
/* Test bitmap with only index */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, (HBITMAP)((ULONG_PTR)hBmp & 0x0000ffff));
|
||||
TEST(hOldBmp == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid bitmap */
|
||||
/* Test valid bitmap */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hBmp);
|
||||
TEST(hOldBmp != NULL);
|
||||
/* The default bitmap should be GetStockObject(21) */
|
||||
TEST(hOldBmp == GetStockObject(21));
|
||||
|
||||
/* Check the palette */
|
||||
hOldPalette = SelectPalette(hDC, hOldPalette, 0);
|
||||
TEST(hOldPalette == hPalette);
|
||||
DeleteObject(hPalette);
|
||||
|
||||
/* Select the old one again and check */
|
||||
hOldBmp = NtGdiSelectBitmap(hDC, hOldBmp);
|
||||
TEST(hOldBmp == hBmp);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* cleanup */
|
||||
DeleteObject(hBmp);
|
||||
DeleteDC(hDC);
|
||||
|
||||
|
|
|
@ -3,8 +3,10 @@ Test_NtGdiSelectPen(PTESTINFO pti)
|
|||
{
|
||||
HDC hDC;
|
||||
HPEN hPen, hOldPen;
|
||||
LOGBRUSH logbrush;
|
||||
|
||||
hDC = CreateDCW(L"DISPLAY", NULL, NULL, NULL);
|
||||
hDC = GetDC(NULL);
|
||||
ASSERT(hDC);
|
||||
|
||||
hPen = GetStockObject(WHITE_PEN);
|
||||
|
||||
|
@ -26,19 +28,42 @@ Test_NtGdiSelectPen(PTESTINFO pti)
|
|||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL pen */
|
||||
/* Test invalid pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, (HPEN)((ULONG_PTR)hPen & 0x0000ffff));
|
||||
TEST(hOldPen == NULL);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test valid pen */
|
||||
SelectObject(hDC, GetStockObject(BLACK_PEN));
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, hPen);
|
||||
TEST(hOldPen == GetStockObject(BLACK_PEN));
|
||||
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
||||
TEST(hOldPen == hPen);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test extpen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
logbrush.lbStyle = BS_SOLID;
|
||||
logbrush.lbColor = RGB(0x12,0x34,0x56);
|
||||
hPen = ExtCreatePen(PS_COSMETIC|PS_ALTERNATE, 1, &logbrush, 0, NULL);
|
||||
ASSERT(hPen);
|
||||
hOldPen = NtGdiSelectPen(hDC, hPen);
|
||||
TEST(hOldPen != NULL);
|
||||
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
||||
TEST(hOldPen == hPen);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test deleting pen */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPen = NtGdiSelectPen(hDC, hPen);
|
||||
TEST(DeleteObject(hPen) == 1);
|
||||
hOldPen = NtGdiSelectPen(hDC, hOldPen);
|
||||
TEST(hOldPen == hPen);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test that fallback pen is BLACK_PEN */
|
||||
|
||||
DeleteDC(hDC);
|
||||
|
||||
|
|
|
@ -1,8 +1,25 @@
|
|||
|
||||
void
|
||||
ReadBits(HDC hDC, PDWORD OutBits)
|
||||
{
|
||||
int x,y;
|
||||
|
||||
for (y = 0; y < 8; y++)
|
||||
{
|
||||
DWORD Row = 0;
|
||||
for (x = 0; x < 8; x++)
|
||||
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
|
||||
OutBits[y] = Row;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
INT
|
||||
Test_NtGdiSetDIBitsToDeviceInternal(PTESTINFO pti)
|
||||
{
|
||||
static const DWORD InBits[8] = { 0x81, 0x7E, 0x5A, 0x7E, 0x7E, 0x42, 0x7E, 0x81 };
|
||||
DWORD OutBits[8];
|
||||
XFORM xform;
|
||||
|
||||
HWND hWnd = CreateWindowW(L"Static", NULL, WS_VISIBLE,
|
||||
100, 100, 200, 200,
|
||||
|
@ -35,6 +52,27 @@ Test_NtGdiSetDIBitsToDeviceInternal(PTESTINFO pti)
|
|||
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
|
||||
sizeof(InBits), sizeof(bmi), TRUE, NULL));
|
||||
|
||||
/* Now get the data from the screen, and see if it matches */
|
||||
ReadBits(hDC, OutBits);
|
||||
|
||||
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
|
||||
|
||||
/* Change transformation */
|
||||
GetWorldTransform(hDC, &xform);
|
||||
xform.eM11 = 2;
|
||||
xform.eM22 = 2;
|
||||
xform.eDx = 10;
|
||||
SetWorldTransform(hDC, &xform);
|
||||
|
||||
TEST(NtGdiSetDIBitsToDeviceInternal(hDC, 2, 3, 8, 8, 0, 0, 0, 8,
|
||||
(PVOID)InBits, (BITMAPINFO *)&bmi, DIB_RGB_COLORS,
|
||||
sizeof(InBits), sizeof(bmi), TRUE, NULL));
|
||||
|
||||
xform.eM11 = 1;
|
||||
xform.eM22 = 1;
|
||||
xform.eDx = 0;
|
||||
SetWorldTransform(hDC, &xform);
|
||||
|
||||
/* Now get the data from the screen, and see if it matches */
|
||||
for (y = 0; y < 8; y++)
|
||||
{
|
||||
|
@ -43,8 +81,10 @@ Test_NtGdiSetDIBitsToDeviceInternal(PTESTINFO pti)
|
|||
Row |= (0x80 & GetPixel(hDC, 2 + x, 3 + y)) >> x;
|
||||
OutBits[y] = Row;
|
||||
}
|
||||
|
||||
TEST(memcmp(InBits, OutBits, sizeof(InBits)) == 0);
|
||||
|
||||
|
||||
ReleaseDC(hWnd, hDC);
|
||||
DestroyWindow(hWnd);
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ Test_OneParamRoutine_MapDesktopObject(PTESTINFO pti) /* 0x30 */
|
|||
|
||||
hMenu = CreateMenu();
|
||||
pObject = NtUserCallOneParam((DWORD)hMenu, _ONEPARAM_ROUTINE_MAPDEKTOPOBJECT);
|
||||
DestroyMenu(hMenu);
|
||||
TEST(pObject > 0);
|
||||
TEST(pObject < 0x80000000);
|
||||
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
|
||||
ULONG gMonitorCount = 0;
|
||||
HDC ghdcMonitor = 0;
|
||||
RECT grcMonitor = {0};
|
||||
|
||||
BOOL
|
||||
NTAPI
|
||||
NtUserEnumDisplayMonitors1(
|
||||
HDC hDC,
|
||||
LPCRECT lprcClip,
|
||||
MONITORENUMPROC lpfnEnum,
|
||||
LPARAM dwData)
|
||||
{
|
||||
return (INT)Syscall(L"NtUserEnumDisplayMonitors", 4, &hDC);
|
||||
}
|
||||
|
||||
BOOL CALLBACK
|
||||
MonitorEnumProc(
|
||||
HMONITOR hMonitor,
|
||||
HDC hdcMonitor,
|
||||
LPRECT lprcMonitor,
|
||||
LPARAM dwData)
|
||||
{
|
||||
gMonitorCount++;
|
||||
if (gMonitorCount == 1)
|
||||
{
|
||||
ghdcMonitor = hdcMonitor;
|
||||
grcMonitor = *lprcMonitor;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserEnumDisplayMonitors(PTESTINFO pti)
|
||||
{
|
||||
BOOL ret;
|
||||
|
||||
// WILL crash!
|
||||
// TEST(NtUserEnumDisplayMonitors1(NULL, NULL, NULL, 0) == 0);
|
||||
|
||||
ret = NtUserEnumDisplayMonitors1(0, NULL, MonitorEnumProc, 0);
|
||||
TEST(ret == TRUE);
|
||||
TEST(gMonitorCount > 0);
|
||||
TEST(ghdcMonitor == 0);
|
||||
TEST(grcMonitor.left == 0);
|
||||
TEST(grcMonitor.right > 0);
|
||||
TEST(grcMonitor.top == 0);
|
||||
TEST(grcMonitor.bottom > 0);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
58
rostests/apitests/w32knapi/ntuser/NtUserGetClassInfo.c
Normal file
58
rostests/apitests/w32knapi/ntuser/NtUserGetClassInfo.c
Normal file
|
@ -0,0 +1,58 @@
|
|||
BOOL
|
||||
NTAPI
|
||||
NtUserGetClassInfo2(
|
||||
HINSTANCE hInstance,
|
||||
PUNICODE_STRING ClassName,
|
||||
LPWNDCLASSEXW wcex,
|
||||
LPWSTR *ppwstr,
|
||||
BOOL Ansi)
|
||||
{
|
||||
return (BOOL)Syscall(L"NtUserGetClassInfo", 5, &hInstance);
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserGetClassInfo(PTESTINFO pti)
|
||||
{
|
||||
WNDCLASSEXW wclex, wclex2 = {0};
|
||||
UNICODE_STRING us;
|
||||
PWSTR pwstr;
|
||||
|
||||
us.Length = 8;
|
||||
us.MaximumLength = 8;
|
||||
us.Buffer = L"test";
|
||||
|
||||
wclex.cbSize = sizeof(WNDCLASSEXW);
|
||||
wclex.style = 0;
|
||||
wclex.lpfnWndProc = NULL;
|
||||
wclex.cbClsExtra = 2;
|
||||
wclex.cbWndExtra = 4;
|
||||
wclex.hInstance = g_hInstance;
|
||||
wclex.hIcon = NULL;
|
||||
wclex.hCursor = NULL;
|
||||
wclex.hbrBackground = CreateSolidBrush(RGB(4,7,5));
|
||||
wclex.lpszMenuName = L"MyMenu";
|
||||
wclex.lpszClassName = us.Buffer;
|
||||
wclex.hIconSm = NULL;
|
||||
|
||||
ASSERT(RegisterClassExW(&wclex) != 0);
|
||||
|
||||
TEST(GetClassInfoExW(g_hInstance, us.Buffer, &wclex) != 0);
|
||||
wclex2.cbSize = sizeof(WNDCLASSEXW);
|
||||
TEST(NtUserGetClassInfo2(g_hInstance, &us, &wclex2, &pwstr, 0) != 0);
|
||||
|
||||
TEST(pwstr == wclex.lpszMenuName);
|
||||
TEST(wclex2.cbSize == wclex.cbSize);
|
||||
TEST(wclex2.style == wclex.style);
|
||||
TEST(wclex2.lpfnWndProc == wclex.lpfnWndProc);
|
||||
TEST(wclex2.cbClsExtra == wclex.cbClsExtra);
|
||||
TEST(wclex2.cbWndExtra == wclex.cbWndExtra);
|
||||
TEST(wclex2.hInstance == wclex.hInstance);
|
||||
TEST(wclex2.hIcon == wclex.hIcon);
|
||||
TEST(wclex2.hCursor == wclex.hCursor);
|
||||
TEST(wclex2.hbrBackground == wclex.hbrBackground);
|
||||
TEST(wclex2.lpszMenuName == 0);
|
||||
TEST(wclex2.lpszClassName == 0);
|
||||
TEST(wclex2.hIconSm == wclex.hIconSm);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
24
rostests/apitests/w32knapi/ntuser/NtUserProcessConnect.c
Normal file
24
rostests/apitests/w32knapi/ntuser/NtUserProcessConnect.c
Normal file
|
@ -0,0 +1,24 @@
|
|||
|
||||
INT
|
||||
Test_NtUserProcessConnect(PTESTINFO pti)
|
||||
{
|
||||
HANDLE hProcess;
|
||||
NTSTATUS Status;
|
||||
USERCONNECT UserConnect = {0};
|
||||
|
||||
hProcess = GetCurrentProcess();
|
||||
|
||||
UserConnect.ulVersion = MAKELONG(0, 5);
|
||||
Status = NtUserProcessConnect(hProcess, (USERCONNECT*)&UserConnect, sizeof(USERCONNECT));
|
||||
TEST(NT_SUCCESS(Status));
|
||||
|
||||
printf("UserConnect.ulVersion = 0x%lx\n", UserConnect.ulVersion);
|
||||
printf("UserConnect.ulCurrentVersion = 0x%lx\n", UserConnect.ulCurrentVersion);
|
||||
printf("UserConnect.dwDispatchCount = 0x%lx\n", UserConnect.dwDispatchCount);
|
||||
printf("UserConnect.siClient.psi = 0x%p\n", UserConnect.siClient.psi);
|
||||
printf("UserConnect.siClient.aheList = 0x%p\n", UserConnect.siClient.aheList);
|
||||
printf("UserConnect.siClient.pDispInfo = 0x%p\n", UserConnect.siClient.pDispInfo);
|
||||
printf("UserConnect.siClient.ulSharedDelta = 0x%lx\n", UserConnect.siClient.ulSharedDelta);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
92
rostests/apitests/w32knapi/ntuser/NtUserSelectPalette.c
Normal file
92
rostests/apitests/w32knapi/ntuser/NtUserSelectPalette.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
|
||||
|
||||
FORCEINLINE
|
||||
PALETTEENTRY
|
||||
PALENTRY(BYTE r, BYTE g, BYTE b)
|
||||
{
|
||||
PALETTEENTRY ret;
|
||||
|
||||
ret.peRed = r;
|
||||
ret.peGreen = g;
|
||||
ret.peBlue = b;
|
||||
ret.peFlags = 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserSelectPalette(PTESTINFO pti)
|
||||
{
|
||||
HPALETTE hPal, hOldPal;
|
||||
HWND hWnd;
|
||||
HDC hDC, hCompDC;
|
||||
struct
|
||||
{
|
||||
LOGPALETTE logpal;
|
||||
PALETTEENTRY entry[20];
|
||||
} pal;
|
||||
|
||||
ZeroMemory(&pal, sizeof(pal));
|
||||
|
||||
pal.logpal.palVersion = 0x300;
|
||||
pal.logpal.palNumEntries = 6;
|
||||
pal.entry[0] = PALENTRY(0,0,0);
|
||||
pal.entry[1] = PALENTRY(255,255,255);
|
||||
pal.entry[2] = PALENTRY(128,128,128);
|
||||
pal.entry[3] = PALENTRY(128,0,0);
|
||||
pal.entry[4] = PALENTRY(0,128,0);
|
||||
pal.entry[5] = PALENTRY(0,0,128);
|
||||
|
||||
hPal = CreatePalette(&pal.logpal);
|
||||
ASSERT(hPal);
|
||||
TEST(DeletePalette(hPal) == 1);
|
||||
hPal = CreatePalette(&pal.logpal);
|
||||
ASSERT(hPal);
|
||||
|
||||
/* Create a window */
|
||||
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
|
||||
NULL, NULL, g_hInstance, 0);
|
||||
hDC = GetDC(hWnd);
|
||||
ASSERT(hDC);
|
||||
hCompDC = CreateCompatibleDC(hDC);
|
||||
ASSERT(hCompDC);
|
||||
|
||||
/* Test NULL DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette(NULL, hPal, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid DC */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette((HDC)-1, hPal, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test NULL palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette(hDC, NULL, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test invalid palette */
|
||||
SetLastError(ERROR_SUCCESS);
|
||||
hOldPal = NtUserSelectPalette(hDC, (HPALETTE)-1, 0);
|
||||
TEST(hOldPal == 0);
|
||||
TEST(GetLastError() == ERROR_SUCCESS);
|
||||
|
||||
/* Test valid palette */
|
||||
hOldPal = NtUserSelectPalette(hDC, hPal, 0);
|
||||
TEST(hOldPal != 0);
|
||||
TEST(hOldPal == GetStockObject(DEFAULT_PALETTE));
|
||||
|
||||
/* We cannot Delete the palette */
|
||||
TEST(DeletePalette(hPal) == 0);
|
||||
|
||||
/* We can still select the Palette into a compatible DC */
|
||||
hOldPal = NtUserSelectPalette(hCompDC, hPal, 0);
|
||||
TEST(hOldPal != 0);
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
15
rostests/apitests/w32knapi/ntuser/NtUserSetTimer.c
Normal file
15
rostests/apitests/w32knapi/ntuser/NtUserSetTimer.c
Normal file
|
@ -0,0 +1,15 @@
|
|||
|
||||
|
||||
|
||||
INT
|
||||
Test_NtUserSetTimer(PTESTINFO pti)
|
||||
{
|
||||
|
||||
|
||||
// check valid argument
|
||||
// check for replacement / new timers
|
||||
// check when expiries are handled (msgs and calls)
|
||||
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
|
@ -337,13 +337,29 @@ Test_SPI_SETDESKWALLPAPER(PTESTINFO pti)
|
|||
return 0;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_SPI_GETSTICKYKEYS(PTESTINFO pti)
|
||||
{
|
||||
STICKYKEYS sk;
|
||||
|
||||
sk.cbSize = sizeof(STICKYKEYS)+1;
|
||||
TEST(NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0) == 0);
|
||||
|
||||
|
||||
sk.cbSize = sizeof(STICKYKEYS);
|
||||
NtUserSystemParametersInfo(SPI_GETSTICKYKEYS, 0, &sk, 0);
|
||||
printf("sk.dwFlags = %lx\n", sk.dwFlags);
|
||||
|
||||
return APISTATUS_NORMAL;
|
||||
}
|
||||
|
||||
INT
|
||||
Test_NtUserSystemParametersInfo(PTESTINFO pti)
|
||||
{
|
||||
HWND hWnd;
|
||||
|
||||
hWnd = CreateTestWindow();
|
||||
// ASSERT(hWnd);
|
||||
ASSERT(hWnd);
|
||||
Test_NtUserSystemParametersInfo_Params(pti);
|
||||
|
||||
Test_NtUserSystemParametersInfo_fWinIni(pti);
|
||||
|
@ -351,6 +367,8 @@ Test_NtUserSystemParametersInfo(PTESTINFO pti)
|
|||
Test_SPI_GETSETBEEP(pti);
|
||||
Test_SPI_SETDESKWALLPAPER(pti);
|
||||
|
||||
Test_SPI_GETSTICKYKEYS(pti);
|
||||
|
||||
Test_SPI_87_88(pti);
|
||||
|
||||
DestroyWindow(hWnd);
|
||||
|
|
|
@ -8,15 +8,20 @@
|
|||
|
||||
#include "ntgdi/NtGdiArcInternal.c"
|
||||
#include "ntgdi/NtGdiBitBlt.c"
|
||||
#include "ntgdi/NtGdiCombineRgn.c"
|
||||
#include "ntgdi/NtGdiCreateBitmap.c"
|
||||
#include "ntgdi/NtGdiCreateCompatibleBitmap.c"
|
||||
#include "ntgdi/NtGdiCreateCompatibleDC.c"
|
||||
#include "ntgdi/NtGdiDoPalette.c"
|
||||
#include "ntgdi/NtGdiEngCreatePalette.c"
|
||||
//#include "ntgdi/NtGdiEnumFontChunk.c"
|
||||
#include "ntgdi/NtGdiEnumFontOpen.c"
|
||||
//#include "ntgdi/NtGdiExtCreatePen.c"
|
||||
#include "ntgdi/NtGdiFlushUserBatch.c"
|
||||
#include "ntgdi/NtGdiGetBitmapBits.c"
|
||||
#include "ntgdi/NtGdiGetFontResourceInfoInternalW.c"
|
||||
#include "ntgdi/NtGdiGetRandomRgn.c"
|
||||
#include "ntgdi/NtGdiPolyPolyDraw.c"
|
||||
#include "ntgdi/NtGdiSelectBitmap.c"
|
||||
#include "ntgdi/NtGdiSelectBrush.c"
|
||||
#include "ntgdi/NtGdiSelectFont.c"
|
||||
|
@ -36,13 +41,18 @@
|
|||
#include "ntuser/NtUserCallOneParam.c"
|
||||
#include "ntuser/NtUserCountClipboardFormats.c"
|
||||
//#include "ntuser/NtUserCreateWindowEx.c"
|
||||
#include "ntuser/NtUserEnumDisplayMonitors.c"
|
||||
#include "ntuser/NtUserEnumDisplaySettings.c"
|
||||
#include "ntuser/NtUserFindExistingCursorIcon.c"
|
||||
#include "ntuser/NtUserGetClassInfo.c"
|
||||
#include "ntuser/NtUserGetTitleBarInfo.c"
|
||||
#include "ntuser/NtUserProcessConnect.c"
|
||||
#include "ntuser/NtUserRedrawWindow.c"
|
||||
#include "ntuser/NtUserScrollDC.c"
|
||||
#include "ntuser/NtUserSelectPalette.c"
|
||||
#include "ntuser/NtUserSetTimer.c"
|
||||
#include "ntuser/NtUserSystemParametersInfo.c"
|
||||
#include "ntuser/NtUserToUnicodeEx.c"
|
||||
#include "ntuser/NtUserGetTitleBarInfo.c"
|
||||
|
||||
/* The List of tests */
|
||||
TESTENTRY TestList[] =
|
||||
|
@ -55,15 +65,20 @@ TESTENTRY TestList[] =
|
|||
/* ntgdi */
|
||||
{ L"NtGdiArcInternal", Test_NtGdiArcInternal },
|
||||
{ L"NtGdiBitBlt", Test_NtGdiBitBlt },
|
||||
{ L"NtGdiCombineRgn", Test_NtGdiCombineRgn },
|
||||
{ L"NtGdiCreateBitmap", Test_NtGdiCreateBitmap },
|
||||
{ L"NtGdiCreateCompatibleBitmap", Test_NtGdiCreateCompatibleBitmap },
|
||||
{ L"NtGdiCreateCompatibleDC", Test_NtGdiCreateCompatibleDC },
|
||||
{ L"NtGdiDoPalette", Test_NtGdiDoPalette },
|
||||
{ L"NtGdiEngCreatePalette", Test_NtGdiEngCreatePalette },
|
||||
// { L"NtGdiEnumFontChunk", Test_NtGdiEnumFontChunk },
|
||||
{ L"NtGdiEnumFontOpen", Test_NtGdiEnumFontOpen },
|
||||
// { L"NtGdiExtCreatePen", Test_NtGdiExtCreatePen },
|
||||
{ L"NtGdiFlushUserBatch", Test_NtGdiFlushUserBatch },
|
||||
{ L"NtGdiGetBitmapBits", Test_NtGdiGetBitmapBits },
|
||||
{ L"NtGdiGetFontResourceInfoInternalW", Test_NtGdiGetFontResourceInfoInternalW },
|
||||
{ L"NtGdiGetRandomRgn", Test_NtGdiGetRandomRgn },
|
||||
{ L"NtGdiPolyPolyDraw", Test_NtGdiPolyPolyDraw },
|
||||
{ L"NtGdiSetBitmapBits", Test_NtGdiSetBitmapBits },
|
||||
{ L"NtGdiSetDIBitsToDeviceInternal", Test_NtGdiSetDIBitsToDeviceInternal },
|
||||
{ L"NtGdiSelectBitmap", Test_NtGdiSelectBitmap },
|
||||
|
@ -84,13 +99,18 @@ TESTENTRY TestList[] =
|
|||
{ L"NtUserCallOneParam", Test_NtUserCallOneParam },
|
||||
{ L"NtUserCountClipboardFormats", Test_NtUserCountClipboardFormats },
|
||||
// { L"NtUserCreateWindowEx", Test_NtUserCreateWindowEx },
|
||||
{ L"NtUserEnumDisplayMonitors", Test_NtUserEnumDisplayMonitors },
|
||||
{ L"NtUserEnumDisplaySettings", TEST_NtUserEnumDisplaySettings },
|
||||
{ L"NtUserFindExistingCursorIcon", Test_NtUserFindExistingCursoricon },
|
||||
{ L"NtUserGetClassInfo", Test_NtUserGetClassInfo },
|
||||
{ L"NtUserGetTitleBarInfo", Test_NtUserGetTitleBarInfo },
|
||||
{ L"NtUserProcessConnect", Test_NtUserProcessConnect },
|
||||
{ L"NtUserRedrawWindow", Test_NtUserRedrawWindow },
|
||||
{ L"NtUserScrollDC", Test_NtUserScrollDC },
|
||||
{ L"NtUserSelectPalette", Test_NtUserSelectPalette },
|
||||
{ L"NtUserSetTimer", Test_NtUserSetTimer },
|
||||
{ L"NtUserSystemParametersInfo", Test_NtUserSystemParametersInfo },
|
||||
{ L"NtUserToUnicodeEx", Test_NtUserToUnicodeEx },
|
||||
{ L"NtUserGetTitleBarInfo", Test_NtUserGetTitleBarInfo }
|
||||
};
|
||||
|
||||
/* The function that gives us the number of tests */
|
||||
|
|
Loading…
Reference in a new issue