29 HWND hwnd =
CreateWindowExA(0,
"BUTTON",
"test",
WS_VISIBLE|
WS_POPUP,0,0,100,100,
GetDesktopWindow(),0,0,0);
34 RECT ret_rc, window_rc;
36 ok(
hwnd != 0,
"CreateWindow failed\n" );
38 SetRect(&window_rc, 400, 300, 500, 400);
44 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
46 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
48 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
55 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
60 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
63 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
71 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
73 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
78 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
87 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
92 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
99 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
105 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
130 ok(
ret ==
sizeof(rgn.data.rdh),
"expected sizeof(rdh), got %u\n",
ret);
132 ok(
ret ==
sizeof(rgn.data.rdh) +
sizeof(
RECT),
"expected sizeof(rgn), got %u\n",
ret);
138 ok(
ret ==
sizeof(rgn.data.rdh),
"expected sizeof(rdh), got %u\n",
ret);
140 ok(
ret ==
sizeof(rgn.data.rdh) +
sizeof(
RECT),
"expected sizeof(rgn), got %u\n",
ret);
142 trace(
"size %u, type %u, count %u, rgn size %u, bound %s\n",
143 rgn.data.rdh.dwSize, rgn.data.rdh.iType, rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
145 if (rgn.data.rdh.nCount != 0)
147 rect = (
const RECT *)rgn.data.Buffer;
152 ok(rgn.data.rdh.dwSize ==
sizeof(rgn.data.rdh),
"expected sizeof(rdh), got %u\n", rgn.data.rdh.dwSize);
153 ok(rgn.data.rdh.iType ==
RDH_RECTANGLES,
"expected RDH_RECTANGLES, got %u\n", rgn.data.rdh.iType);
156 ok(rgn.data.rdh.nCount == 0,
"expected 0, got %u\n", rgn.data.rdh.nCount);
157 ok(rgn.data.rdh.nRgnSize == 0 ||
158 broken(rgn.data.rdh.nRgnSize == 168),
159 "expected 0, got %u\n", rgn.data.rdh.nRgnSize);
163 ok(rgn.data.rdh.nCount == 1,
"expected 1, got %u\n", rgn.data.rdh.nCount);
164 ok(rgn.data.rdh.nRgnSize ==
sizeof(
RECT) ||
165 broken(rgn.data.rdh.nRgnSize == 168),
166 "expected sizeof(RECT), got %u\n", rgn.data.rdh.nRgnSize);
168 ok(
EqualRect(&rgn.data.rdh.rcBound, rc),
"rects don't match\n");
173 static const RECT empty_rect;
174 static const RECT rc = { 111, 222, 333, 444 };
175 static const RECT arc[2] = { {0, 0, 10, 10}, {10, 10, 20, 20}};
176 static const RECT rc_xformed = { 76, 151, 187, 262 };
189 ok(!
hrgn,
"ExtCreateRegion should fail\n");
193 rgn.data.rdh.dwSize = 0;
194 rgn.data.rdh.iType = 0;
195 rgn.data.rdh.nCount = 0;
196 rgn.data.rdh.nRgnSize = 0;
198 memcpy(rgn.data.Buffer, &rc,
sizeof(rc));
202 ok(!
hrgn,
"ExtCreateRegion should fail\n");
205 rgn.data.rdh.dwSize =
sizeof(rgn.data.rdh) - 1;
209 ok(!
hrgn,
"ExtCreateRegion should fail\n");
214 rgn.data.rdh.dwSize =
sizeof(rgn.data.rdh);
227 ok(!
hrgn,
"ExtCreateRegion should fail\n");
236 rgn.data.rdh.nCount = 1;
238 memcpy(rgn.data.Buffer, &rc,
sizeof(rc));
253 rgn.data.rdh.dwSize =
sizeof(rgn.data.rdh) + 1;
273 rgn.data.rdh.dwSize =
sizeof(rgn.data.rdh);
281 rgn.data.rdh.nCount = 2;
283 memcpy(rgn.data.Buffer, arc,
sizeof(arc));
289 ok(!
hrgn,
"ExtCreateRegion should fail\n");
302 ok(
ret == -1,
"Expected GetClipRgn to return -1, got %d\n",
ret);
305 ok(
hdc !=
NULL,
"Expected GetDC to return a valid device context handle\n");
311 "Expected GetClipRgn to return 0, got %d\n",
ret);
316 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
320 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
324 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
328 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
333 ok(
ret == 0,
"Expected GetClipRgn to return 0, got %d\n",
ret);
338 "Expected EqualRgn to compare the two regions as equal, got %d\n",
ret);
343 "Expected SelectClipRgn to return NULLREGION, got %d\n",
ret);
348 ok(
ret == -1,
"Expected GetClipRgn to return -1, got %d\n",
ret);
351 ok(
ret == 1,
"Expected GetClipRgn to return 1, got %d\n",
ret);
355 "Expected EqualRgn to compare the two regions as equal, got %d\n",
ret);
360 "Expected SelectClipRgn to return SIMPLEREGION, got %d\n",
ret);
365 "Expected GetClipRgn to return 0, got %d\n",
ret);
368 ok(
ret == 0,
"Expected GetClipRgn to return 0, got %d\n",
ret);
372 "Expected EqualRgn to compare the two regions as equal, got %d\n",
ret);
384 HRGN
hrgn, hrgn_empty;
395 ok(
ret == 0,
"expected 0, got %d\n",
ret);
401 ok(
ret == 1,
"expected 1, got %d\n",
ret);
412 ok(
ret == 0,
"expected 0, got %d\n",
ret);
415 ok(
ret == 0,
"expected 0, got %d\n",
ret);
418 ok(
ret == 0,
"expected 0, got %d\n",
ret);
426 ok(
ret == 1,
"expected 1, got %d\n",
ret);
433 SetRect( &rc, 10, 10, 20, 20 );
437 SetRect( &rc, 20, 20, 10, 10 );
442 ok(
ret == 0,
"expected 0, got %d\n",
ret);
445 ok(
ret == 1,
"expected 1, got %d\n",
ret);
461 HRGN
hrgn, hrgn_empty;
463 RECT rc, virtual_rect;
464 int ret, screen_width, screen_height;
475 trace(
"screen resolution %d x %d\n", screen_width, screen_height);
478 -100, -100, screen_width * 2, screen_height * 2, 0, 0, 0,
NULL);
484 ok(
ret == 0,
"expected 0, got %d\n",
ret);
487 ok(
ret == 0,
"expected 0, got %d\n",
ret);
490 ok(
ret == 0,
"expected 0, got %d\n",
ret);
494 "expected SIMPLEREGION, got %d\n",
ret);
497 ok(
ret == 1,
"expected 1, got %d\n",
ret);
504 SetRect( &rc, 10, 10, 20, 20 );
508 SetRect( &rc, 20, 20, 10, 10 );
513 ok(
ret == 0,
"expected 0, got %d\n",
ret);
516 ok(
ret == 1,
"expected 1, got %d\n",
ret);
525 "expected SIMPLEREGION, got %d\n",
ret);
528 ok(
ret == 0,
"expected 0, got %d\n",
ret);
static const char * wine_dbgstr_rect(const RECT *prc)
struct _RGNDATAHEADER RGNDATAHEADER
static void test_memory_dc_clipping(void)
static void test_ExtCreateRegion(void)
static void test_GetClipRgn(void)
static void test_GetRandomRgn(void)
static void verify_region(HRGN hrgn, const RECT *rc)
static void test_window_dc_clipping(void)
#define ERROR_INVALID_PARAMETER
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
#define memcpy(s1, s2, n)
DWORD WINAPI GetVersion()
DWORD WINAPI GetLastError(void)
HRGN WINAPI CreateRectRgn(_In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI RectVisible(_In_ HDC, _In_ LPCRECT)
int WINAPI IntersectClipRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI EqualRgn(_In_ HRGN, _In_ HRGN)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
int WINAPI GetClipRgn(_In_ HDC, _In_ HRGN)
HRGN WINAPI ExtCreateRegion(_In_opt_ const XFORM *lpx, _In_ DWORD nCount, _In_reads_bytes_(nCount) const RGNDATA *lpData)
int WINAPI SetMetaRgn(_In_ HDC)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI GetRandomRgn(_In_ HDC, _In_ HRGN, _In_ INT)
DWORD WINAPI GetRegionData(_In_ HRGN hrgn, _In_ DWORD nCount, _Out_writes_bytes_to_opt_(nCount, return) LPRGNDATA lpRgnData)
BOOL WINAPI DeleteDC(_In_ HDC)
int WINAPI SelectClipRgn(_In_ HDC, _In_opt_ HRGN)
int WINAPI ExtSelectClipRgn(_In_ HDC, _In_opt_ HRGN, _In_ int)
int WINAPI GetRgnBox(_In_ HRGN, _Out_ LPRECT)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define SM_CYVIRTUALSCREEN
HDC WINAPI GetWindowDC(_In_opt_ HWND)
HWND WINAPI CreateWindowExA(_In_ DWORD dwExStyle, _In_opt_ LPCSTR lpClassName, _In_opt_ LPCSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
HWND WINAPI GetDesktopWindow(void)
#define SM_CXVIRTUALSCREEN
BOOL WINAPI IntersectRect(_Out_ LPRECT, _In_ LPCRECT, _In_ LPCRECT)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI SetRectEmpty(_Out_ LPRECT)
BOOL WINAPI OffsetRect(_Inout_ LPRECT, _In_ int, _In_ int)
#define SM_XVIRTUALSCREEN
BOOL WINAPI DestroyWindow(_In_ HWND)
BOOL WINAPI EqualRect(_In_ LPCRECT, _In_ LPCRECT)
int WINAPI GetSystemMetrics(_In_ int)
#define SM_YVIRTUALSCREEN
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)