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);
50 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
57 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
62 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
65 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
73 ok(
ret == 0,
"GetRandomRgn rets %d\n",
ret);
75 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
80 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
89 ok(
ret > 0,
"GetRandomRgn rets %d\n",
ret);
94 ok(
ret == -1,
"GetRandomRgn rets %d\n",
ret);
97 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
104 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
110 ok(
ret != 0,
"GetRandomRgn rets %d\n",
ret);
135 ok(
ret ==
sizeof(rgn.data.rdh),
"expected sizeof(rdh), got %lu\n",
ret);
137 ok(
ret ==
sizeof(rgn.data.rdh) +
sizeof(
RECT),
"expected sizeof(rgn), got %lu\n",
ret);
143 ok(
ret ==
sizeof(rgn.data.rdh),
"expected sizeof(rdh), got %lu\n",
ret);
145 ok(
ret ==
sizeof(rgn.data.rdh) +
sizeof(
RECT),
"expected sizeof(rgn), got %lu\n",
ret);
147 trace(
"size %lu, type %lu, count %lu, rgn size %lu, bound %s\n",
148 rgn.data.rdh.dwSize, rgn.data.rdh.iType, rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
150 if (rgn.data.rdh.nCount != 0)
152 rect = (
const RECT *)rgn.data.Buffer;
157 ok(rgn.data.rdh.dwSize ==
sizeof(rgn.data.rdh),
"expected sizeof(rdh), got %lu\n", rgn.data.rdh.dwSize);
158 ok(rgn.data.rdh.iType ==
RDH_RECTANGLES,
"expected RDH_RECTANGLES, got %lu\n", rgn.data.rdh.iType);
161 ok(rgn.data.rdh.nCount == 0,
"expected 0, got %lu\n", rgn.data.rdh.nCount);
162 ok(rgn.data.rdh.nRgnSize == 0 ||
163 broken(rgn.data.rdh.nRgnSize == 168),
164 "expected 0, got %lu\n", rgn.data.rdh.nRgnSize);
168 ok(rgn.data.rdh.nCount == 1,
"expected 1, got %lu\n", rgn.data.rdh.nCount);
169 ok(rgn.data.rdh.nRgnSize ==
sizeof(
RECT) ||
170 broken(rgn.data.rdh.nRgnSize == 168),
171 "expected sizeof(RECT), got %lu\n", rgn.data.rdh.nRgnSize);
173 ok(
EqualRect(&rgn.data.rdh.rcBound, rc),
"rects don't match\n");
178 static const RECT empty_rect;
179 static const RECT rc = { 111, 222, 333, 444 };
180 static const RECT arc[2] = { {0, 0, 10, 10}, {10, 10, 20, 20}};
181 static const RECT rc_xformed = { 76, 151, 187, 262 };
192 ok(!
hrgn,
"ExtCreateRegion should fail\n");
195 rgn.data.rdh.dwSize = 0;
196 rgn.data.rdh.iType = 0;
197 rgn.data.rdh.nCount = 0;
198 rgn.data.rdh.nRgnSize = 0;
200 memcpy(rgn.data.Buffer, &rc,
sizeof(rc));
204 ok(!
hrgn,
"ExtCreateRegion should fail\n");
207 rgn.data.rdh.dwSize =
sizeof(rgn.data.rdh) - 1;
211 ok(!
hrgn,
"ExtCreateRegion should fail\n");
216 rgn.data.rdh.dwSize =
sizeof(rgn.data.rdh);
229 ok(!
hrgn,
"ExtCreateRegion should fail\n");
240 rgn.data.rdh.nCount = 1;
242 memcpy(rgn.data.Buffer, &rc,
sizeof(rc));
263 rgn.data.rdh.nCount = 2;
265 memcpy(rgn.data.Buffer, arc,
sizeof(arc));
271 ok(!
hrgn,
"ExtCreateRegion should fail\n");
284 ok(
ret == -1,
"Expected GetClipRgn to return -1, got %d\n",
ret);
287 ok(
hdc !=
NULL,
"Expected GetDC to return a valid device context handle\n");
291 ok(
ret == 0,
"Expected GetClipRgn to return 0, got %d\n",
ret);
296 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
300 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
304 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
308 "Expected CreateRectRgn to return a handle to a new rectangular region\n");
313 ok(
ret == 0,
"Expected GetClipRgn to return 0, got %d\n",
ret);
318 "Expected EqualRgn to compare the two regions as equal, got %d\n",
ret);
323 "Expected SelectClipRgn to return NULLREGION, got %d\n",
ret);
328 ok(
ret == -1,
"Expected GetClipRgn to return -1, got %d\n",
ret);
331 ok(
ret == 1,
"Expected GetClipRgn to return 1, got %d\n",
ret);
335 "Expected EqualRgn to compare the two regions as equal, got %d\n",
ret);
340 "Expected SelectClipRgn to return SIMPLEREGION, got %d\n",
ret);
343 ok(
ret == 0,
"Expected GetClipRgn to return 0, got %d\n",
ret);
346 ok(
ret == 0,
"Expected GetClipRgn to return 0, got %d\n",
ret);
350 "Expected EqualRgn to compare the two regions as equal, got %d\n",
ret);
362 HRGN
hrgn, hrgn_empty;
373 ok(
ret == 0,
"expected 0, got %d\n",
ret);
379 ok(
ret == 1,
"expected 1, got %d\n",
ret);
390 ok(
ret == 0,
"expected 0, got %d\n",
ret);
393 ok(
ret == 0,
"expected 0, got %d\n",
ret);
396 ok(
ret == 0,
"expected 0, got %d\n",
ret);
404 ok(
ret == 1,
"expected 1, got %d\n",
ret);
411 SetRect( &rc, 10, 10, 20, 20 );
415 SetRect( &rc, 20, 20, 10, 10 );
420 ok(
ret == 0,
"expected 0, got %d\n",
ret);
423 ok(
ret == 1,
"expected 1, got %d\n",
ret);
439 HRGN
hrgn, hrgn_empty;
441 RECT rc, virtual_rect;
442 int ret, screen_width, screen_height;
453 trace(
"screen resolution %d x %d\n", screen_width, screen_height);
456 -100, -100, screen_width * 2, screen_height * 2, 0, 0, 0,
NULL);
462 ok(
ret == 0,
"expected 0, got %d\n",
ret);
465 ok(
ret == 0,
"expected 0, got %d\n",
ret);
468 ok(
ret == 0,
"expected 0, got %d\n",
ret);
472 "expected SIMPLEREGION, got %d\n",
ret);
475 ok(
ret == 1,
"expected 1, got %d\n",
ret);
482 SetRect( &rc, 10, 10, 20, 20 );
486 SetRect( &rc, 20, 20, 10, 10 );
491 ok(
ret == 0,
"expected 0, got %d\n",
ret);
494 ok(
ret == 1,
"expected 1, got %d\n",
ret);
503 "expected SIMPLEREGION, got %d\n",
ret);
506 ok(
ret == 0,
"expected 0, got %d\n",
ret);
517 POINT points_zero[] = { {0, 0}, {0, 0}, {0, 0} };
518 POINT points_mixed[] = { {0, 0}, {0, 0}, {0, 0}, {6, 6}, {6, 6}, {6, 6} };
519 POINT points_six[] = { {6, 6}, {6, 6}, {6, 6} };
520 POINT points_line[] = { {1, 0}, {11, 0}, {21, 0}};
521 POINT points_overflow[] = { {0, 0}, {1, 0}, {0, 0x80000000} };
522 INT counts_single_poly[] = { 3 };
523 INT counts_two_poly[] = { 3, 3 };
531 ok (region !=
NULL,
"region must not be NULL\n");
537 ok (region !=
NULL,
"region must not be NULL\n");
543 ok (region !=
NULL,
"region must not be NULL\n");
549 ok (region !=
NULL,
"region must not be NULL\n");
556 ok (region !=
NULL,
"region must not be NULL\n");
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_CreatePolyPolygonRgn(void)
static void test_window_dc_clipping(void)
#define ERROR_INVALID_PARAMETER
DWORD WINAPI GetVersion(void)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum GLuint GLenum GLsizei const GLchar * buf
#define memcpy(s1, s2, n)
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)
HRGN WINAPI CreatePolyPolygonRgn(_In_ const POINT *pptl, _In_reads_(cPoly) const INT *pc, _In_ int cPoly, _In_ int iMode)
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)