ReactOS  0.4.15-dev-1374-g8d3e80e
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 {
73  Test_ScrollDC();
74 }
void Test_ScrollDC()
Definition: ScrollDC.c:10

◆ Test_ScrollDC()

void Test_ScrollDC ( )

Definition at line 10 of file ScrollDC.c.

11 {
12  HWND hWnd, hWnd2;
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 */
65  ReleaseDC(hWnd, hDC);
68 
69 }
HDC WINAPI GetDC(_In_opt_ HWND)
#define TRUE
Definition: types.h:120
static HDC
Definition: imagelist.c:92
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)
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
BOOL WINAPI DestroyWindow(_In_ HWND)
#define CreateWindowW(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4291
#define FALSE
Definition: types.h:117
int WINAPI GetUpdateRgn(_In_ HWND, _In_ HRGN, _In_ BOOL)
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)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
HWND hWnd2
Definition: button.c:416
static const WCHAR L[]
Definition: oid.c:1250
static HRGN hrgn
Definition: win.c:55
static HDC hDC
Definition: 3dtext.c:33
#define ok(value,...)
Definition: atltest.h:57
#define NULL
Definition: types.h:112
#define WS_OVERLAPPEDWINDOW
Definition: pedump.c:637
LONG bottom
Definition: windef.h:309
#define WS_VISIBLE
Definition: pedump.c:620

Referenced by START_TEST().