ReactOS  0.4.15-dev-489-g75a0787
ScrollWindowEx.c
Go to the documentation of this file.
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  * Katayama Hirofumi MZ
7  */
8 
9 #include "precomp.h"
10 
11 void
13 {
14  HWND hWnd, hChild1, hChild2;
15  HRGN hrgn;
16  int Result;
17  RECT rc, rcChild1, rcChild2;
18  INT x1, y1, x2, y2, dx, dy;
19  DWORD style;
20 
21  /* Create a window */
23  hWnd = CreateWindowW(L"STATIC", L"TestWindow", style, CW_USEDEFAULT, CW_USEDEFAULT, 100, 100, NULL, NULL, 0, 0);
24  ok(hWnd != NULL, "hWnd was NULL.\n");
26 
27  /* Assert that no update region is there */
28  hrgn = CreateRectRgn(0, 0, 0, 0);
30  ok(Result == NULLREGION, "Result = %d\n", Result);
31 
32  Result = ScrollWindowEx(hWnd, 20, 0, NULL, NULL, NULL, NULL, 0);
33  ok(Result == SIMPLEREGION, "Result = %d\n", Result);
35  ok(Result == NULLREGION, "Result = %d\n", Result);
36 
38  ok(Result == SIMPLEREGION, "Result = %d\n", Result);
40  ok(Result == SIMPLEREGION, "Result = %d\n", Result);
42 
43  // test invalid update region
46  ok(Result == ERROR, "Result = %d\n", Result);
47  hrgn = CreateRectRgn(0, 0, 0, 0);
49 
50  // Test invalid updaterect pointer
52  ok(Result == ERROR, "Result = %d\n", Result);
54  ok(Result == SIMPLEREGION, "Result = %d\n", Result);
55 
56  /* create child window 1 */
57  x1 = 1;
58  y1 = 3;
60  hChild1 = CreateWindowW(L"STATIC", L"Child1", style, x1, y1, 10, 10, hWnd, NULL, 0, 0);
61  ok(hChild1 != NULL, "hChild1 was NULL.\n");
62  UpdateWindow(hChild1);
63 
64  /* create child window 2 */
65  x2 = 5;
66  y2 = 7;
68  hChild2 = CreateWindowW(L"STATIC", L"Child2", style, x2, y2, 10, 10, hWnd, NULL, 0, 0);
69  ok(hChild2 != NULL, "hChild2 was NULL.\n");
70  UpdateWindow(hChild2);
71 
72  /* scroll with child windows */
73  dx = 3;
74  dy = 8;
77 
78  /* check the positions */
79  GetWindowRect(hWnd, &rc);
80  GetWindowRect(hChild1, &rcChild1);
81  GetWindowRect(hChild2, &rcChild2);
82  ok_long(rcChild1.left - rc.left, x1 + dx);
83  ok_long(rcChild2.left - rc.left, x2 + dx);
84  ok_long(rcChild1.top - rc.top, y1 + dy);
85  ok_long(rcChild2.top - rc.top, y2 + dy);
86 
87  /* update */
88  x1 += dx;
89  y1 += dy;
90  x2 += dx;
91  y2 += dy;
92 
93  /* scroll with child windows */
94  dx = 9;
95  dy = -2;
98 
99  /* check the positions */
100  GetWindowRect(hWnd, &rc);
101  GetWindowRect(hChild1, &rcChild1);
102  GetWindowRect(hChild2, &rcChild2);
103  ok_long(rcChild1.left - rc.left, x1 + dx);
104  ok_long(rcChild2.left - rc.left, x2 + dx);
105  ok_long(rcChild1.top - rc.top, y1 + dy);
106  ok_long(rcChild2.top - rc.top, y2 + dy);
107 
108  DestroyWindow(hChild1);
109  DestroyWindow(hChild2);
112 }
113 
115 {
117 }
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG y1
Definition: winddi.h:3706
#define ERROR(name)
Definition: error_private.h:53
#define SS_BLACKRECT
Definition: pedump.c:696
GLint dy
Definition: linetemp.h:97
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG x1
Definition: winddi.h:3706
BOOL WINAPI UpdateWindow(_In_ HWND)
HWND hWnd
Definition: settings.c:17
#define NULLREGION
Definition: wingdi.h:360
LONG top
Definition: windef.h:307
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
#define WS_CHILD
Definition: pedump.c:617
LONG left
Definition: windef.h:306
#define ok_long(expression, result)
Definition: atltest.h:133
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4291
int32_t INT
Definition: typedefs.h:57
int WINAPI GetUpdateRgn(_In_ HWND, _In_ HRGN, _In_ BOOL)
#define CW_USEDEFAULT
Definition: winuser.h:225
smooth NULL
Definition: ftsmooth.c:416
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
int WINAPI ScrollWindowEx(_In_ HWND, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT, _In_ UINT)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
void Test_ScrollWindowEx()
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
static HRGN hrgn
Definition: win.c:55
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG _In_ LONG y2
Definition: winddi.h:3706
#define SW_INVALIDATE
Definition: winuser.h:2554
START_TEST(ScrollWindowEx)
#define SIMPLEREGION
Definition: wingdi.h:361
#define ok(value,...)
Definition: atltest.h:57
#define WS_POPUP
Definition: pedump.c:616
#define SW_SCROLLCHILDREN
Definition: winuser.h:2553
GLint dx
Definition: linetemp.h:97
_In_ CLIPOBJ _In_ BRUSHOBJ _In_ LONG _In_ LONG _In_ LONG x2
Definition: winddi.h:3706
BOOL WINAPI GetWindowRect(_In_ HWND, _Out_ LPRECT)
Arabic default style
Definition: afstyles.h:93
#define WS_VISIBLE
Definition: pedump.c:620
#define SS_WHITERECT
Definition: pedump.c:698