reactos/rostests/apitests/user32api/tests/ScrollDC.c
Timo Kreuzer 58c6a293bc - make apitest.c into a static lib to be used by different tests
- add a gdi32 api test, based on the one in the win32 folder
- add a user32 api test
- change type of test functions to int
- implement a quick 'n dirty html api status output
- uncomment NtGdiTransormPoints in w32kdll.def
- add ASSERT1 macro (ASSERT is already used)
- include some more headers

svn path=/trunk/; revision=28169
2007-08-05 03:32:24 +00:00

58 lines
1.8 KiB
C

#include "../user32api.h"
INT
Test_ScrollDC(PTESTINFO pti)
{
HWND hWnd, hWnd2;
HDC hDC;
HRGN hrgn;
RECT rcClip;
/* Create a window */
hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
100, 100, 100, 100,
NULL, NULL, g_hInstance, 0);
UpdateWindow(hWnd);
hDC = GetDC(hWnd);
/* Assert that no update region is there */
hrgn = CreateRectRgn(0,0,0,0);
ASSERT1(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
/* Test normal scrolling */
TEST(ScrollDC(hDC, 0, 0, NULL, NULL, hrgn, NULL) == TRUE);
/* Scroll with invalid update region */
DeleteObject(hrgn);
TEST(ScrollDC(hDC, 50, 0, NULL, NULL, hrgn, NULL) == FALSE);
hrgn = CreateRectRgn(0,0,0,0);
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
/* Scroll with invalid update rect pointer */
TEST(ScrollDC(hDC, 50, 0, NULL, NULL, NULL, (PRECT)1) == 0);
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
/* Scroll with a clip rect */
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
TEST(ScrollDC(hDC, 50, 0, NULL, &rcClip, hrgn, NULL) == TRUE);
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
/* Scroll with a clip rect */
rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
TEST(ScrollDC(hDC, 50, 50, NULL, &rcClip, hrgn, NULL) == TRUE);
TEST(GetUpdateRgn(hWnd, hrgn, FALSE) == NULLREGION);
/* Overlap with another window */
hWnd2 = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
30, 160, 100, 100,
NULL, NULL, g_hInstance, 0);
UpdateWindow(hWnd2);
/* Cleanup */
ReleaseDC(hWnd, hDC);
DestroyWindow(hWnd);
DestroyWindow(hWnd2);
return APISTATUS_NORMAL;
}