ReactOS 0.4.15-dev-7961-gdcf9eb0
ScrollDC.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 ScrollDC
5 * PROGRAMMERS: Timo Kreuzer
6 */
7
8#include "precomp.h"
9
11{
13 HDC hDC;
14 HRGN hrgn;
15 RECT rcClip;
16 int iResult;
17
18 /* Create a window */
19 hWnd = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
20 100, 100, 100, 100,
21 NULL, NULL, 0, 0);
23 hDC = GetDC(hWnd);
24
25 /* Test that no update region is there */
26 hrgn = CreateRectRgn(0,0,0,0);
27 iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
28 ok (iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
29
30 /* Test normal scrolling */
31 ok(ScrollDC(hDC, 0, 0, NULL, NULL, hrgn, NULL) == TRUE, "ScrollDC failed\n");
32
33 /* Scroll with invalid update region */
35 ok(ScrollDC(hDC, 50, 0, NULL, NULL, (HRGN)0x12345678, NULL) == FALSE, "ScrollDC successed\n");
36 ok(ScrollDC(hDC, 50, 0, NULL, NULL, hrgn, NULL) == FALSE, "ScrollDC successed\n");
37 hrgn = CreateRectRgn(0,0,0,0);
38 iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
39 ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
40
41 /* Scroll with invalid update rect pointer */
42 ok(ScrollDC(hDC, 50, 0, NULL, NULL, NULL, (PRECT)1) == FALSE, "ScrollDC failed\n");
43 iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
44 ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
45
46 /* Scroll with a clip rect */
47 rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
48 ok(ScrollDC(hDC, 50, 0, NULL, &rcClip, hrgn, NULL) == TRUE, "ScrollDC failed\n");
49 iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
50 ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
51
52 /* Scroll with a clip rect */
53 rcClip.left = 50; rcClip.top = 0; rcClip.right = 100; rcClip.bottom = 100;
54 ok(ScrollDC(hDC, 50, 50, NULL, &rcClip, hrgn, NULL) == TRUE, "ScrollDC failed\n");
55 iResult = GetUpdateRgn(hWnd, hrgn, FALSE);
56 ok(iResult == NULLREGION, "Expected NULLREGION, got %d\n", iResult);
57
58 /* Overlap with another window */
59 hWnd2 = CreateWindowW(L"BUTTON", L"TestWindow", WS_OVERLAPPEDWINDOW | WS_VISIBLE,
60 30, 160, 100, 100,
61 NULL, NULL, 0, 0);
63
64 /* Cleanup */
68
69}
70
72{
74}
static HDC hDC
Definition: 3dtext.c:33
static HRGN hrgn
void Test_ScrollDC()
Definition: ScrollDC.c:10
#define ok(value,...)
Definition: atltest.h:57
#define START_TEST(x)
Definition: atltest.h:75
HWND hWnd
Definition: settings.c:17
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
pKey DeleteObject()
HWND hWnd2
Definition: button.c:416
static HDC
Definition: imagelist.c:92
#define L(x)
Definition: ntvdm.h:50
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
#define WS_VISIBLE
Definition: pedump.c:620
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define NULLREGION
Definition: wingdi.h:361
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI ScrollDC(_In_ HDC, _In_ int, _In_ int, _In_opt_ LPCRECT, _In_opt_ LPCRECT, _In_opt_ HRGN, _Out_opt_ LPRECT)
int WINAPI GetUpdateRgn(_In_ HWND, _In_ HRGN, _In_ BOOL)
BOOL WINAPI UpdateWindow(_In_ HWND)
HDC WINAPI GetDC(_In_opt_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4316
BOOL WINAPI DestroyWindow(_In_ HWND)