ReactOS 0.4.15-dev-7924-g5949c20
NtUserScrollDC.c File Reference
#include "../win32nt.h"
Include dependency graph for NtUserScrollDC.c:

Go to the source code of this file.

Functions

 START_TEST (NtUserScrollDC)
 

Function Documentation

◆ START_TEST()

START_TEST ( NtUserScrollDC  )

Definition at line 10 of file NtUserScrollDC.c.

11{
13 HWND hWnd;
14 HDC hDC;
15 HRGN hRgn, hTmpRgn;
16 RECT rcScroll, rcClip, rcUpdate;
17 RECT rect = {0,0,100,100};
18 INT Result;
19
20 hWnd = CreateWindowA("BUTTON",
21 "Test",
23 0,
24 0,
25 50,
26 100,
27 NULL,
28 NULL,
29 hinst,
30 0);
31 ASSERT(hWnd);
33
34 hDC = GetDC(hWnd);
35 ASSERT(hDC);
36
37 hRgn = CreateRectRgn(0,0,10,10);
38
39
40 /* Test inverted clip rect */
41 rcScroll.left = 0;
42 rcScroll.top = 25;
43 rcScroll.right = 100;
44 rcScroll.bottom = 40;
45 rcClip.left = 0;
46 rcClip.top = 35;
47 rcClip.right = -70;
48 rcClip.bottom = -1000;
50 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
51 RTEST(Result == 1);
53
54 /* Test inverted scroll rect */
55 rcScroll.left = 0;
56 rcScroll.top = 25;
57 rcScroll.right = -100;
58 rcScroll.bottom = -40;
59 rcClip.left = 0;
60 rcClip.top = 35;
61 rcClip.right = 70;
62 rcClip.bottom = 1000;
64 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
65 RTEST(Result == 1);
67
68 rcScroll.left = 0;
69 rcScroll.top = 25;
70 rcScroll.right = 100;
71 rcScroll.bottom = 40;
72
73 /* Test invalid update region */
75 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate);
76 RTEST(Result == 0);
78
79 /* Test invalid dc */
81 Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
82 RTEST(Result == 0);
84
85 /* Test invalid update rect */
87 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)(LONG_PTR)0x80001000);
88 RTEST(Result == 0);
90
91 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
92
93 RTEST(Result == TRUE);
94 RTEST(rcUpdate.left == 0);
95 RTEST(rcUpdate.top == 35);
96 RTEST(rcUpdate.right == 70);
97 RTEST(rcUpdate.bottom == 55);
98
99 hTmpRgn = CreateRectRgn(10,45,70,55);
100 Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
102
103 SetRectRgn(hTmpRgn,0,35,70,40);
104 Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
106
107 DeleteObject(hTmpRgn);
108
109 /* TODO: Test with another window in front */
110 /* TODO: Test with different viewport extension */
111
115
116}
static HDC hDC
Definition: 3dtext.c:33
HWND hWnd
Definition: settings.c:17
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define SetLastError(x)
Definition: compat.h:752
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
pKey DeleteObject()
BOOL NTAPI NtUserScrollDC(HDC hDC, int dx, int dy, CONST RECT *lprcScroll, CONST RECT *lprcClip, HRGN hrgnUpdate, LPRECT lprcUpdate)
#define ASSERT(a)
Definition: mode.c:44
#define TEST(x)
Definition: precomp.h:20
#define RTEST(x)
Definition: precomp.h:21
static HINSTANCE hinst
Definition: edit.c:551
static HDC
Definition: imagelist.c:92
static HRGN hRgn
Definition: mapping.c:33
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define WS_VISIBLE
Definition: pedump.c:620
#define BS_PUSHBUTTON
Definition: pedump.c:651
& rect
Definition: startmenu.cpp:1413
LONG right
Definition: windef.h:308
LONG bottom
Definition: windef.h:309
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetModuleHandle
Definition: winbase.h:3827
#define ERROR_NOACCESS
Definition: winerror.h:578
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define NULLREGION
Definition: wingdi.h:361
int WINAPI CombineRgn(_In_opt_ HRGN hrgnDest, _In_opt_ HRGN hrgnSrc1, _In_opt_ HRGN hrgnSrc2, _In_ int fnCombineMode)
#define SIMPLEREGION
Definition: wingdi.h:362
#define RGN_XOR
Definition: wingdi.h:360
BOOL WINAPI SetRectRgn(_In_ HRGN, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
BOOL WINAPI RedrawWindow(_In_opt_ HWND, _In_opt_ LPCRECT, _In_opt_ HRGN, _In_ UINT)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4315
#define RDW_UPDATENOW
Definition: winuser.h:1220
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI DestroyWindow(_In_ HWND)
_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:409