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 "precomp.h"
9 
10 void Test_ScrollWindowEx()
11 {
12 	HWND hWnd;
13 	HRGN hrgn;
14 	int Result;
15 
16 	/* Create a window */
17 	hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
18 	                    CW_USEDEFAULT, CW_USEDEFAULT, 100, 100,
19 	                    NULL, NULL, 0, 0);
20 	UpdateWindow(hWnd);
21 
22 	/* Assert that no update region is there */
23 	hrgn = CreateRectRgn(0,0,0,0);
24 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
25 	ok(Result == NULLREGION, "Result = %d\n", Result);
26 
27 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, 0);
28 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
29 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
30 	ok(Result == NULLREGION, "Result = %d\n", Result);
31 
32 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, SW_INVALIDATE);
33 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
34 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
35 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
36 	UpdateWindow(hWnd);
37 
38 	// test invalid update region
39 	DeleteObject(hrgn);
40 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, hrgn, NULL, SW_INVALIDATE);
41 	ok(Result == ERROR, "Result = %d\n", Result);
42 	hrgn = CreateRectRgn(0,0,0,0);
43 	UpdateWindow(hWnd);
44 
45 	// Test invalid updaterect pointer
46 	Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, (LPRECT)1, SW_INVALIDATE);
47 	ok(Result == ERROR, "Result = %d\n", Result);
48 	Result = GetUpdateRgn(hWnd, hrgn, FALSE);
49 	ok(Result == SIMPLEREGION, "Result = %d\n", Result);
50 
51 // test for alignment of rects
52 
53 	DeleteObject(hrgn);
54     DestroyWindow(hWnd);
55 }
56 
57 START_TEST(ScrollWindowEx)
58 {
59     Test_ScrollWindowEx();
60 }
61