ReactOS 0.4.15-dev-8219-ge8b88cf
ScrollDC.c File Reference
#include "precomp.h"
Include dependency graph for ScrollDC.c:

Go to the source code of this file.

Functions

void Test_ScrollDC ()
 
 START_TEST (ScrollDC)
 

Function Documentation

◆ START_TEST()

START_TEST ( ScrollDC  )

Definition at line 71 of file ScrollDC.c.

72{
74}
void Test_ScrollDC()
Definition: ScrollDC.c:10

◆ Test_ScrollDC()

void Test_ScrollDC ( )

Definition at line 10 of file ScrollDC.c.

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}
static HDC hDC
Definition: 3dtext.c:33
static HRGN hrgn
#define ok(value,...)
Definition: atltest.h:57
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)

Referenced by START_TEST().