ReactOS  0.4.15-dev-1177-g6cb3b62
OffsetClipRgn.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 OffsetClipRgn
5  * PROGRAMMERS: Timo Kreuzer
6  */
7 
8 #include "precomp.h"
9 
11 {
12  HDC hdc;
13  HRGN hrgn, hrgn2;
14  //RECT rect;
15 
17  ok(hdc != 0, "CreateCompatibleDC failed, skipping tests.\n");
18  if (!hdc) return;
19 
20  hrgn2 = CreateRectRgn(0, 0, 0, 0);
21 
22  /* Test NULL DC */
23  SetLastError(0x12345);
24  ok_int(OffsetClipRgn(NULL, 0, 0), ERROR);
26 
27  /* Test invalid DC */
28  SetLastError(0x12345);
29  ok_int(OffsetClipRgn((HDC)(ULONG_PTR)0x12345, 0, 0), ERROR);
30  ok((GetLastError() == 0x12345) || (GetLastError() == ERROR_INVALID_HANDLE), "Expected 0x12345 or ERROR_INVALID_HANDLE, got %ld\n", GetLastError());
31  SetLastError(0x12345);
32 
33  /* Test without a clip region set */
34  SetLastError(0x12345);
37  ok_int(GetLastError(), 0x12345);
38  SetLastError(0x12345);
39 
40  /* Set a clip region */
41  hrgn = CreateRectRgn(10, 10, 20, 30);
46  hrgn = CreateRectRgn(20, 20, 30, 40);
48 
49  /* Set different scaling */
51  ok_int(SetViewportExtEx(hdc, 100, 100, NULL), 1);
52  ok_int(SetWindowExtEx(hdc, 200, 50, NULL), 1);
55  hrgn = CreateRectRgn(25, 40, 35, 60);
57 
58 #if 0
59  /* Set different scaling */
61  ok_int(SetViewportExtEx(hdc, 100, 100, NULL), 1);
62  ok_int(SetWindowExtEx(hdc, 80, 350, NULL), 1);
65  hrgn = CreateRectRgn(33, 23, 43, 43);
67 #endif
68 
69  ok_int(GetLastError(), 0x12345);
70 
71 }
72 
74 {
76 }
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
#define TRUE
Definition: types.h:120
#define ERROR(name)
Definition: error_private.h:53
static HRGN hrgn2
#define ERROR_INVALID_HANDLE
Definition: compat.h:98
static HDC
Definition: imagelist.c:92
#define NULLREGION
Definition: wingdi.h:360
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
void Test_OffsetClipRgn()
Definition: OffsetClipRgn.c:10
uint32_t ULONG_PTR
Definition: typedefs.h:65
int WINAPI SetMapMode(_In_ HDC, _In_ int)
int WINAPI OffsetClipRgn(_In_ HDC, _In_ int, _In_ int)
smooth NULL
Definition: ftsmooth.c:416
#define ok_int(expression, result)
Definition: atltest.h:134
BOOL WINAPI EqualRgn(_In_ HRGN, _In_ HRGN)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
#define CLIPRGN
Definition: precomp.h:18
#define SetLastError(x)
Definition: compat.h:500
HDC hdc
Definition: main.c:9
#define MM_ANISOTROPIC
Definition: wingdi.h:866
static HRGN hrgn
Definition: win.c:55
#define SIMPLEREGION
Definition: wingdi.h:361
#define ok(value,...)
Definition: atltest.h:57
START_TEST(OffsetClipRgn)
Definition: OffsetClipRgn.c:73
int WINAPI GetRandomRgn(_In_ HDC, _In_ HRGN, _In_ INT)
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465