ReactOS 0.4.16-dev-2104-gb84fa49
NtUserScrollDC.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 NtUserScrollDC
5 * PROGRAMMERS:
6 */
7
8#include "../win32nt.h"
9
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 /* Test inverted clip rect */
40 rcScroll.left = 0;
41 rcScroll.top = 25;
42 rcScroll.right = 100;
43 rcScroll.bottom = 40;
44 rcClip.left = 0;
45 rcClip.top = 35;
46 rcClip.right = -70;
47 rcClip.bottom = -1000;
49 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
52
53 /* Test inverted scroll rect */
54 rcScroll.left = 0;
55 rcScroll.top = 25;
56 rcScroll.right = -100;
57 rcScroll.bottom = -40;
58 rcClip.left = 0;
59 rcClip.top = 35;
60 rcClip.right = 70;
61 rcClip.bottom = 1000;
63 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
66
67 rcScroll.left = 0;
68 rcScroll.top = 25;
69 rcScroll.right = 100;
70 rcScroll.bottom = 40;
71
72 /* Test invalid update region */
74 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, (HRGN)0x123456, &rcUpdate);
77
78 /* Test invalid dc */
80 Result = NtUserScrollDC((HDC)0x123456, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
83
84 /* Test invalid update rect */
86 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, (PVOID)(LONG_PTR)0x80001000);
89
90 Result = NtUserScrollDC(hDC, 10, 20, &rcScroll, &rcClip, hRgn, &rcUpdate);
91
93 ok_eq_long(rcUpdate.left, 0);
94 ok_eq_long(rcUpdate.top, 35);
95 ok_eq_long(rcUpdate.right, 70);
96 ok_eq_long(rcUpdate.bottom, 55);
97
98 hTmpRgn = CreateRectRgn(10,45,70,55);
99 Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
101
102 SetRectRgn(hTmpRgn,0,35,70,40);
103 Result = CombineRgn(hRgn, hRgn, hTmpRgn, RGN_XOR);
105
106 DeleteObject(hTmpRgn);
107
108 /* TODO: Test with another window in front */
109 /* TODO: Test with different viewport extension */
110
114
115}
116
static HDC hDC
Definition: 3dtext.c:33
#define ok_eq_ulong(value, expected)
Definition: apitest.h:120
#define ok_eq_long(value, expected)
Definition: apitest.h:119
#define ok_eq_int(value, expected)
Definition: apitest.h:117
#define START_TEST(x)
Definition: atltest.h:75
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 FALSE
Definition: types.h:117
#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
static HINSTANCE hinst
Definition: edit.c:551
static HDC
Definition: imagelist.c:88
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
Definition: windef.h:99
LONG right
Definition: windef.h:102
LONG bottom
Definition: windef.h:103
LONG top
Definition: windef.h:101
LONG left
Definition: windef.h:100
int32_t INT
Definition: typedefs.h:58
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define GetModuleHandle
Definition: winbase.h:3576
#define ERROR_NOACCESS
Definition: winerror.h:902
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:4417
#define RDW_UPDATENOW
Definition: winuser.h:1231
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