1 /*
2  * PROJECT:         ReactOS api tests
3  * LICENSE:         GPL - See COPYING in the top level directory
4  * PURPOSE:         Test for ScrollWindowEx
5  * PROGRAMMERS:     Timo Kreuzer
6  */
7 
8 #include <apitest.h>
9 
10 #include <wingdi.h>
11 #include <winuser.h>
12 
13 void Test_ScrollWindowEx()
14 {
15 	HWND hWnd;
16 	HRGN hrgn;
17 	int Result;
18 
19 	/* Create a window */
20 	hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
21 	                    CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
22 	                    NULL, NULL, 0, 0);
23 	UpdateWindow(hWnd);
24 
25 	/* Assert that no update region is there */
26 	hrgn = CreateRectRgn(0,0,0,0);
27 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
28 	ok(Result == NULLREGION, "Result = %d\n", Result);
29 
30 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, 0);
31 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
32 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
33 	ok(Result == NULLREGION, "Result = %d\n", Result);
34 
35 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE);
36 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
37 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
38 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
39 	UpdateWindow(hWnd);
40 
41 	// test invalid update region
42 	DeleteObject(hrgn);
43 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, hrgn, NULL, SW_INVALIDATE);
44 	ok(Result == ERROR, "Result = %d\n", Result);
45 	hrgn = CreateRectRgn(0,0,0,0);
46 	UpdateWindow(hWnd);
47 
48 	// Test invalid updaterect pointer
49 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, (LPRECT)1, SW_INVALIDATE);
50 	ok(Result == ERROR, "Result = %d\n", Result);
51 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
52 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
53 
54 // test for alignment of rects
55 
56 	DeleteObject(hrgn);
57     DestroyWindow(hWnd);
58 }
59 
60 START_TEST(ScrollWindowEx)
61 {
62     Test_ScrollWindowEx();
63 }
64 
65