mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:32:59 +00:00
[APITESTS]
- Add more Rectangle function tests - Improve ScrollDC tests svn path=/trunk/; revision=52045
This commit is contained in:
parent
d159b215ee
commit
77760f12f6
2 changed files with 39 additions and 11 deletions
|
@ -15,6 +15,7 @@ void Test_Rectangle(void)
|
||||||
HBITMAP hBmp;
|
HBITMAP hBmp;
|
||||||
BOOL ret;
|
BOOL ret;
|
||||||
HBRUSH hBrush;
|
HBRUSH hBrush;
|
||||||
|
HPEN hPen;
|
||||||
COLORREF color;
|
COLORREF color;
|
||||||
|
|
||||||
hdc = CreateCompatibleDC(NULL);
|
hdc = CreateCompatibleDC(NULL);
|
||||||
|
@ -63,6 +64,28 @@ void Test_Rectangle(void)
|
||||||
color = GetPixel(hdc, 1, 1);
|
color = GetPixel(hdc, 1, 1);
|
||||||
ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
|
ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
|
||||||
|
|
||||||
|
/* tests with NULL pen */
|
||||||
|
hPen = SelectObject(hdc, GetStockObject(NULL_PEN));
|
||||||
|
|
||||||
|
/* Blank the bitmap */
|
||||||
|
ret = BitBlt(hdc, 0, 0, 4, 4, NULL, 0, 0, WHITENESS);
|
||||||
|
ok(ret, "BitBlt failed to blank the bitmap!\n");
|
||||||
|
|
||||||
|
ret = Rectangle(hdc, 0, 0, 3, 3);
|
||||||
|
ok(ret, "Rectangle failed!");
|
||||||
|
color = GetPixel(hdc, 0, 0);
|
||||||
|
ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
|
||||||
|
color = GetPixel(hdc, 2, 2);
|
||||||
|
ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
|
||||||
|
color = GetPixel(hdc, 0, 2);
|
||||||
|
ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
|
||||||
|
color = GetPixel(hdc, 2, 0);
|
||||||
|
ok( color == RGB(255, 255, 255), "Expected 0x00FFFFFF, got 0x%08x\n", (UINT)color);
|
||||||
|
color = GetPixel(hdc, 1, 1);
|
||||||
|
ok( color == RGB(0, 0, 0), "Expected 0, got 0x%08x\n", (UINT)color);
|
||||||
|
|
||||||
|
SelectObject(hdc, hPen);
|
||||||
|
|
||||||
/* Same tests with GM_ADVANCED */
|
/* Same tests with GM_ADVANCED */
|
||||||
ok(SetGraphicsMode(hdc, GM_ADVANCED) == GM_COMPATIBLE, "Default mode for the DC is not GM_COMPATIBLE.\n");
|
ok(SetGraphicsMode(hdc, GM_ADVANCED) == GM_COMPATIBLE, "Default mode for the DC is not GM_COMPATIBLE.\n");
|
||||||
|
|
||||||
|
|
|
@ -27,30 +27,35 @@ void Test_ScrollDC()
|
||||||
/* Test that no update region is there */
|
/* Test that no update region is there */
|
||||||
hrgn = CreateRectRgn(0,0,0,0);
|
hrgn = CreateRectRgn(0,0,0,0);
|
||||||
iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
|
iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
|
||||||
ok (iResult == NULLREGION, "\n");
|
ok (iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
|
||||||
|
|
||||||
/* Test normal scrolling */
|
/* Test normal scrolling */
|
||||||
ok(ScrollDC(hDC, 0, 0, NULL, NULL, hrgn, NULL) == TRUE, "\n");
|
ok(ScrollDC(hDC, 0, 0, NULL, NULL, hrgn, NULL) == TRUE, "ScrollDC failed\n");
|
||||||
|
|
||||||
/* Scroll with invalid update region */
|
/* Scroll with invalid update region */
|
||||||
DeleteObject(hrgn);
|
DeleteObject(hrgn);
|
||||||
ok(ScrollDC(hDC, 50, 0, NULL, NULL, hrgn, NULL) == FALSE, "\n");
|
ok(ScrollDC(hDC, 50, 0, NULL, NULL, (HRGN)0x12345678, NULL) == FALSE, "ScrollDC successed\n");
|
||||||
|
ok(ScrollDC(hDC, 50, 0, NULL, NULL, hrgn, NULL) == FALSE, "ScrollDC successed\n");
|
||||||
hrgn = CreateRectRgn(0,0,0,0);
|
hrgn = CreateRectRgn(0,0,0,0);
|
||||||
ok(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION, "\n");
|
iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
|
||||||
|
ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
|
||||||
|
|
||||||
/* Scroll with invalid update rect pointer */
|
/* Scroll with invalid update rect pointer */
|
||||||
ok(ScrollDC(hDC, 50, 0, NULL, NULL, NULL, (PRECT)1) == 0, "\n");
|
ok(ScrollDC(hDC, 50, 0, NULL, NULL, NULL, (PRECT)1) == FALSE, "ScrollDC failed\n");
|
||||||
ok(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION, "\n");
|
iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
|
||||||
|
ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
|
||||||
|
|
||||||
/* Scroll with a clip rect */
|
/* Scroll with a clip rect */
|
||||||
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
||||||
ok(ScrollDC(hDC, 50, 0, NULL, &rcClip, hrgn, NULL) == TRUE, "\n");
|
ok(ScrollDC(hDC, 50, 0, NULL, &rcClip, hrgn, NULL) == TRUE, "ScrollDC failed\n");
|
||||||
ok(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION, "\n");
|
iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
|
||||||
|
ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
|
||||||
|
|
||||||
/* Scroll with a clip rect */
|
/* Scroll with a clip rect */
|
||||||
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
|
||||||
ok(ScrollDC(hDC, 50, 50, NULL, &rcClip, hrgn, NULL) == TRUE, "\n");
|
ok(ScrollDC(hDC, 50, 50, NULL, &rcClip, hrgn, NULL) == TRUE, "ScrollDC failed\n");
|
||||||
ok(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION, "\n");
|
iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
|
||||||
|
ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
|
||||||
|
|
||||||
/* Overlap with another window */
|
/* Overlap with another window */
|
||||||
hWnd2 = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
hWnd2 = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue