gdi32/tests: Use wine_dbgstr_rect() to print RECTs.

Two old (win95 and winnt) broken() removed en passant.

Signed-off-by: Michael Stefaniuc <mstefani@redhat.de>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2016-06-20 11:56:26 +02:00 committed by Alexandre Julliard
parent 085a538ded
commit 75426bb926
5 changed files with 96 additions and 154 deletions

View File

@ -54,8 +54,7 @@ static void test_GetRandomRgn(void)
ret = GetRandomRgn(hdc, hrgn, 1);
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret = GetRandomRgn(hdc, hrgn, 2);
ok(ret == 0, "GetRandomRgn rets %d\n", ret);
@ -63,8 +62,7 @@ static void test_GetRandomRgn(void)
ret = GetRandomRgn(hdc, hrgn, 3);
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
/* Move the clip to the meta and clear the clip */
SetMetaRgn(hdc);
@ -74,14 +72,12 @@ static void test_GetRandomRgn(void)
ret = GetRandomRgn(hdc, hrgn, 2);
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret = GetRandomRgn(hdc, hrgn, 3);
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
/* Set a new clip (still got the meta) */
SetRect(&rc2, 10, 30, 70, 90);
@ -90,22 +86,19 @@ static void test_GetRandomRgn(void)
ret = GetRandomRgn(hdc, hrgn, 1);
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret = GetRandomRgn(hdc, hrgn, 2);
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
IntersectRect(&rc2, &rc, &rc2);
ret = GetRandomRgn(hdc, hrgn, 3);
ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret = GetRandomRgn(hdc, hrgn, SYSRGN);
@ -115,10 +108,7 @@ static void test_GetRandomRgn(void)
OffsetRect(&window_rc, -window_rc.left, -window_rc.top);
/* the window may be partially obscured so the region may be smaller */
IntersectRect( &window_rc, &ret_rc, &ret_rc );
ok(EqualRect(&window_rc, &ret_rc) ||
broken(IsRectEmpty(&ret_rc)), /* win95 */
"GetRandomRgn %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ok(EqualRect(&window_rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
DeleteObject(hrgn);
ReleaseDC(hwnd, hdc);
@ -149,15 +139,13 @@ static void verify_region(HRGN hrgn, const RECT *rc)
else
ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret);
trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
rgn.data.rdh.dwSize, rgn.data.rdh.iType,
rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top,
rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
trace("size %u, type %u, count %u, rgn size %u, bound %s\n",
rgn.data.rdh.dwSize, rgn.data.rdh.iType, rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
wine_dbgstr_rect(&rgn.data.rdh.rcBound));
if (rgn.data.rdh.nCount != 0)
{
rect = (const RECT *)rgn.data.Buffer;
trace("rect (%d,%d-%d,%d)\n", rect->left, rect->top, rect->right, rect->bottom);
trace("rect %s\n", wine_dbgstr_rect(rect));
ok(EqualRect(rect, rc), "rects don't match\n");
}
@ -415,7 +403,7 @@ static void test_memory_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == 1 && rc.bottom == 1,
"expected 0,0-1,1, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
"expected 0,0-1,1, got %s\n", wine_dbgstr_rect(&rc));
ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
@ -440,15 +428,15 @@ static void test_memory_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100,
"expected 0,0-100,100, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
"expected 0,0-100,100, got %s\n", wine_dbgstr_rect(&rc));
SetRect( &rc, 10, 10, 20, 20 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
ok(ret, "RectVisible failed for %s\n", wine_dbgstr_rect(&rc));
SetRect( &rc, 20, 20, 10, 10 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
ok(ret, "RectVisible failed for %s\n", wine_dbgstr_rect(&rc));
ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret);
@ -459,7 +447,7 @@ static void test_memory_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100,
"expected 0,0-100,100, got %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom);
"expected 0,0-100,100, got %s\n", wine_dbgstr_rect(&rc));
DeleteDC(hdc);
DeleteObject(hrgn);
@ -510,17 +498,16 @@ static void test_window_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(EqualRect(&rc, &virtual_rect), "expected %d,%d-%d,%d, got %d,%d-%d,%d\n",
virtual_rect.left, virtual_rect.top, virtual_rect.right, virtual_rect.bottom,
rc.left, rc.top, rc.right, rc.bottom);
ok(EqualRect(&rc, &virtual_rect), "expected %s, got %s\n", wine_dbgstr_rect(&virtual_rect),
wine_dbgstr_rect(&rc));
SetRect( &rc, 10, 10, 20, 20 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
ok( ret, "RectVisible failed for %s\n", wine_dbgstr_rect(&rc));
SetRect( &rc, 20, 20, 10, 10 );
ret = RectVisible( hdc, &rc );
ok( ret, "RectVisible failed for %d,%d-%d,%d\n", rc.left, rc.top, rc.right, rc.bottom );
ok( ret, "RectVisible failed for %s\n", wine_dbgstr_rect(&rc));
ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret);
@ -530,9 +517,8 @@ static void test_window_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(EqualRect(&rc, &virtual_rect), "expected %d,%d-%d,%d, got %d,%d-%d,%d\n",
virtual_rect.left, virtual_rect.top, virtual_rect.right, virtual_rect.bottom,
rc.left, rc.top, rc.right, rc.bottom);
ok(EqualRect(&rc, &virtual_rect), "expected %s, got %s\n", wine_dbgstr_rect(&virtual_rect),
wine_dbgstr_rect(&rc));
ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1),

View File

@ -134,14 +134,12 @@ static void test_savedc_2(void)
ret = GetClipRgn(hdc, hrgn);
ok(ret == 0, "GetClipRgn returned %d instead of 0\n", ret);
ret = GetRgnBox(hrgn, &rc);
ok(ret == NULLREGION, "GetRgnBox returned %d (%d,%d-%d,%d) instead of NULLREGION\n",
ret, rc.left, rc.top, rc.right, rc.bottom);
ok(ret == NULLREGION, "GetRgnBox returned %d %s instead of NULLREGION\n",
ret, wine_dbgstr_rect(&rc));
/*dump_region(hrgn);*/
SetRect(&rc, 0, 0, 100, 100);
ok(EqualRect(&rc, &rc_clip),
"rects are not equal: (%d,%d-%d,%d) - (%d,%d-%d,%d)\n",
rc.left, rc.top, rc.right, rc.bottom,
rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
wine_dbgstr_rect(&rc_clip));
ret = SaveDC(hdc);
ok(ret == 1, "ret = %d\n", ret);
@ -162,10 +160,8 @@ static void test_savedc_2(void)
ret = GetClipBox(hdc, &rc_clip);
ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
SetRect(&rc, 0, 0, 50, 50);
ok(EqualRect(&rc, &rc_clip),
"rects are not equal: (%d,%d-%d,%d) - (%d,%d-%d,%d)\n",
rc.left, rc.top, rc.right, rc.bottom,
rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
wine_dbgstr_rect(&rc_clip));
ret = RestoreDC(hdc, 1);
ok(ret, "ret = %d\n", ret);
@ -173,10 +169,8 @@ static void test_savedc_2(void)
ret = GetClipBox(hdc, &rc_clip);
ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
SetRect(&rc, 0, 0, 100, 100);
ok(EqualRect(&rc, &rc_clip),
"rects are not equal: (%d,%d-%d,%d) - (%d,%d-%d,%d)\n",
rc.left, rc.top, rc.right, rc.bottom,
rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
wine_dbgstr_rect(&rc_clip));
DeleteObject(hrgn);
ReleaseDC(hwnd, hdc);
@ -432,8 +426,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
"GetBoundsRect returned type %x for %s\n", type, descr );
if (type == DCB_RESET)
ok( rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0,
"GetBoundsRect returned %d,%d,%d,%d type %x for %s\n",
rect.left, rect.top, rect.right, rect.bottom, type, descr );
"GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
type, descr );
type = SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
ok( type == (DCB_RESET | DCB_DISABLE) || broken(type == (DCB_SET | DCB_ENABLE)) /* XP */,
"SetBoundsRect returned %x for %s (hdc type %d)\n", type, descr, GetObjectType( hdc ) );
@ -443,8 +437,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
type = GetBoundsRect( hdc, &rect, DCB_RESET );
todo_wine_if (GetObjectType( hdc ) == OBJ_ENHMETADC || (GetObjectType( hdc ) == OBJ_DC && GetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER))
ok( rect.left == 2 && rect.top == 2 && rect.right == 4 && rect.bottom == 4 && type == DCB_SET,
"GetBoundsRect returned %d,%d,%d,%d type %x for %s\n",
rect.left, rect.top, rect.right, rect.bottom, type, descr );
"GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
type, descr );
}
type = GetClipBox( ref_dc, &rect );
@ -477,8 +471,8 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
todo_wine_if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY && GetObjectType( hdc ) != OBJ_ENHMETADC &&
(GetSystemMetrics( SM_XVIRTUALSCREEN ) || GetSystemMetrics( SM_YVIRTUALSCREEN )))
ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %d,%d,%d,%d on %s\n",
rect.left, rect.top, rect.right, rect.bottom, descr );
ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %s on %s\n",
wine_dbgstr_rect( &rect ), descr );
}
SetBoundsRect( ref_dc, NULL, DCB_RESET | DCB_ACCUMULATE );
@ -488,8 +482,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
/* it may or may not work on non-memory DCs */
ok( (rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0 && type == DCB_RESET) ||
(rect.left == 3 && rect.top == 3 && rect.right == 5 && rect.bottom == 5 && type == DCB_SET),
"GetBoundsRect returned %d,%d,%d,%d type %x on %s\n",
rect.left, rect.top, rect.right, rect.bottom, type, descr );
"GetBoundsRect returned %s type %x on %s\n", wine_dbgstr_rect( &rect ), type, descr );
if (GetObjectType( hdc ) == OBJ_MEMDC)
{
@ -521,16 +514,15 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
type = GetClipBox( hdc, &rect );
ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr );
ok( rect.left == 0 && rect.top == 0 && rect.right == 16 && rect.bottom == 16,
"GetClipBox returned %d,%d,%d,%d on memdc for %s\n",
rect.left, rect.top, rect.right, rect.bottom, descr );
"GetClipBox returned %s on memdc for %s\n", wine_dbgstr_rect( &rect ), descr );
SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
SetMapMode( hdc, MM_TEXT );
Rectangle( hdc, 5, 5, 12, 14 );
type = GetBoundsRect( hdc, &rect, DCB_RESET );
ok( rect.left == 5 && rect.top == 5 && rect.right == 12 && rect.bottom == 14 && type == DCB_SET,
"GetBoundsRect returned %d,%d,%d,%d type %x on memdc for %s\n",
rect.left, rect.top, rect.right, rect.bottom, type, descr );
"GetBoundsRect returned %s type %x on memdc for %s\n", wine_dbgstr_rect( &rect ),
type, descr );
SelectObject( hdc, old );
DeleteObject( dib );
@ -891,10 +883,8 @@ static void test_boundsrect(void)
ok(ret == DCB_RESET,
"Expected GetBoundsRect to return DCB_RESET, got %u\n", ret);
SetRectEmpty(&expect);
ok(EqualRect(&rect, &expect) ||
broken(EqualRect(&rect, &set_rect)), /* nt4 sp1-5 */
"Expected output rectangle (0,0)-(0,0), got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Expected output rectangle (0,0)-(0,0), got %s\n",
wine_dbgstr_rect(&rect));
ret = GetBoundsRect(NULL, NULL, 0);
ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret);
@ -915,23 +905,20 @@ static void test_boundsrect(void)
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 10, 20, 40, 50);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetMapMode( hdc, MM_ANISOTROPIC );
SetViewportExtEx( hdc, 2, 2, NULL );
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 5, 10, 20, 25);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetViewportOrgEx( hdc, 20, 30, NULL );
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, -5, -5, 10, 10);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetRect(&set_rect, 10, 20, 40, 50);
ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
@ -940,16 +927,14 @@ static void test_boundsrect(void)
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 10, 20, 40, 50);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetMapMode( hdc, MM_TEXT );
SetViewportOrgEx( hdc, 0, 0, NULL );
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 40, 70, 100, 130);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
if (pSetLayout)
{
@ -957,23 +942,20 @@ static void test_boundsrect(void)
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 159, 70, 99, 130);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetRect(&set_rect, 50, 25, 30, 35);
ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 50, 25, 30, 35);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
pSetLayout( hdc, LAYOUT_LTR );
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 149, 25, 169, 35);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
}
/* empty rect resets, except on nt4 */
@ -986,8 +968,7 @@ static void test_boundsrect(void)
if (ret == DCB_RESET)
{
SetRectEmpty(&expect);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetRect(&expect, 20, 20, 20, 20);
ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
@ -995,8 +976,7 @@ static void test_boundsrect(void)
ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_RESET, "GetBoundsRect returned %x\n", ret);
SetRectEmpty(&expect);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
}
SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
@ -1005,47 +985,47 @@ static void test_boundsrect(void)
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 10, 10, 21, 21 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok( EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetRect( &rect, 8, 8, 23, 23 );
expect = rect;
SetBoundsRect( hdc, &rect, DCB_ACCUMULATE );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
level = SaveDC( hdc );
LineTo( hdc, 30, 25 );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 8, 8, 31, 26 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetBoundsRect( hdc, NULL, DCB_DISABLE );
LineTo( hdc, 40, 40 );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 8, 8, 31, 26 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetRect( &rect, 6, 6, 30, 30 );
SetBoundsRect( hdc, &rect, DCB_ACCUMULATE );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 31, 30 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
RestoreDC( hdc, level );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
LineTo( hdc, 40, 40 );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SelectObject( hdc, old );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 1, 1 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SetBoundsRect( hdc, NULL, DCB_ENABLE );
LineTo( hdc, 50, 40 );
@ -1053,13 +1033,13 @@ static void test_boundsrect(void)
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 51, 41 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
SelectObject( hdc, GetStockObject( NULL_PEN ));
LineTo( hdc, 50, 50 );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 51, 51 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
memset( buffer, 0, sizeof(buffer) );
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@ -1074,22 +1054,22 @@ static void test_boundsrect(void)
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 51, 51 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
LineTo( hdc, 55, 30 );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 56, 51 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
LineTo( hdc, 300, 30 );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 256, 51 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
LineTo( hdc, -300, -300 );
ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 0, 0, 256, 51 );
ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
/* test the wide pen heuristics */
SetBoundsRect( hdc, NULL, DCB_ENABLE | DCB_RESET );
@ -1130,10 +1110,8 @@ static void test_boundsrect(void)
expect.top = max( expect.top, 0 );
expect.right = min( expect.right, 256 );
expect.bottom = min( expect.bottom, 256 );
ok( EqualRect(&rect, &expect),
"Got %d,%d,%d,%d expected %d,%d,%d,%d %u/%x/%x\n",
rect.left, rect.top, rect.right, rect.bottom,
expect.left, expect.top, expect.right, expect.bottom, width, endcap, join );
ok(EqualRect(&rect, &expect), "Got %s expected %s %u/%x/%x\n", wine_dbgstr_rect(&rect),
wine_dbgstr_rect(&expect), width, endcap, join);
DeleteObject( SelectObject( hdc, old ));
}

View File

@ -1271,7 +1271,7 @@ static void compare_bounds( HDC hdc, const char *info )
current_bounds->right == -1 &&
current_bounds->bottom == -1)
{
ok( 0, "missing bounds, got { %d, %d, %d, %d },\n", rect.left, rect.top, rect.right, rect.bottom );
ok( 0, "missing bounds, got %s,\n", wine_dbgstr_rect( &rect ));
return;
}

View File

@ -309,27 +309,22 @@ static void test_dc_layout(void)
hrgn = CreateRectRgn( 0, 0, 0, 0 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
pSetLayout( hdc, LAYOUT_LTR );
SetRect( &rc, 80, 10, 90, 20 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
IntersectClipRect( hdc, 80, 10, 85, 20 );
pSetLayout( hdc, LAYOUT_RTL );
SetRect( &rc, 15, 10, 20, 20 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
SetRectRgn( hrgn, 60, 10, 80, 20 );
pSetLayout( hdc, LAYOUT_LTR );
ExtSelectClipRgn( hdc, hrgn, RGN_OR );
@ -337,19 +332,16 @@ static void test_dc_layout(void)
SetRect( &rc, 15, 10, 40, 20 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
/* OffsetClipRgn mirrors too */
OffsetClipRgn( hdc, 5, 5 );
OffsetRect( &rc, 5, 5 );
GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
/* GetRandomRgn returns the raw region */
if (pGetRandomRgn)
@ -357,8 +349,7 @@ static void test_dc_layout(void)
SetRect( &rc, 55, 15, 80, 25 );
pGetRandomRgn( hdc, hrgn, 1 );
GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n",
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
}
SetMapMode(hdc, MM_LOMETRIC);

View File

@ -2508,16 +2508,15 @@ static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
rgn1 = (const union _rgn *)clip->RgnData;
trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
trace("size %u, type %u, count %u, rgn size %u, bound %s\n",
rgn1->data.rdh.dwSize, rgn1->data.rdh.iType,
rgn1->data.rdh.nCount, rgn1->data.rdh.nRgnSize,
rgn1->data.rdh.rcBound.left, rgn1->data.rdh.rcBound.top,
rgn1->data.rdh.rcBound.right, rgn1->data.rdh.rcBound.bottom);
wine_dbgstr_rect(&rgn1->data.rdh.rcBound));
ok(EqualRect(&rgn1->data.rdh.rcBound, rc), "rects don't match\n");
rect = *(const RECT *)rgn1->data.Buffer;
trace("rect (%d,%d-%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom);
trace("rect %s\n", wine_dbgstr_rect(&rect));
ok(EqualRect(&rect, rc), "rects don't match\n");
ok(rgn1->data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn1->data.rdh.dwSize);
@ -2555,25 +2554,21 @@ static int CALLBACK clip_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
ret = GetRegionData(hrgn, sizeof(rgn2), &rgn2.data);
ok(ret == sizeof(rgn2), "expected sizeof(rgn2), got %u\n", ret);
trace("size %u, type %u, count %u, rgn size %u, bound (%d,%d-%d,%d)\n",
rgn2.data.rdh.dwSize, rgn2.data.rdh.iType,
rgn2.data.rdh.nCount, rgn2.data.rdh.nRgnSize,
rgn2.data.rdh.rcBound.left, rgn2.data.rdh.rcBound.top,
rgn2.data.rdh.rcBound.right, rgn2.data.rdh.rcBound.bottom);
trace("size %u, type %u, count %u, rgn size %u, bound %s\n", rgn2.data.rdh.dwSize,
rgn2.data.rdh.iType, rgn2.data.rdh.nCount, rgn2.data.rdh.nRgnSize,
wine_dbgstr_rect(&rgn2.data.rdh.rcBound));
rect = rgn2.data.rdh.rcBound;
rc_transformed = *rc;
translate((POINT *)&rc_transformed, 2, &xform);
trace("transformed (%d,%d-%d,%d)\n", rc_transformed.left, rc_transformed.top,
rc_transformed.right, rc_transformed.bottom);
trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
rect = *(const RECT *)rgn2.data.Buffer;
trace("rect (%d,%d-%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom);
trace("rect %s\n", wine_dbgstr_rect(&rect));
rc_transformed = *rc;
translate((POINT *)&rc_transformed, 2, &xform);
trace("transformed (%d,%d-%d,%d)\n", rc_transformed.left, rc_transformed.top,
rc_transformed.right, rc_transformed.bottom);
trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
ok(rgn2.data.rdh.dwSize == sizeof(rgn1->data.rdh), "expected sizeof(rdh), got %u\n", rgn2.data.rdh.dwSize);
@ -2645,10 +2640,8 @@ static void test_emf_clipping(void)
SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc_sclip),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
wine_dbgstr_rect(&rc_res));
OffsetRect(&rc_sclip, -100, -100);
ret = OffsetClipRgn(hdc, -100, -100);
@ -2656,10 +2649,8 @@ static void test_emf_clipping(void)
SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc_sclip),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
wine_dbgstr_rect(&rc_res));
ret = IntersectClipRect(hdc, 0, 0, 100, 100);
ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION) /* XP */, "got %d\n", ret);
@ -2674,10 +2665,8 @@ static void test_emf_clipping(void)
SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
rc.left, rc.top, rc.right, rc.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
ok(EqualRect(&rc_res, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rc),
wine_dbgstr_rect(&rc_res));
SetRect(&rc_sclip, 0, 0, 100, 50);
ret = ExcludeClipRect(hdc, 0, 50, 100, 100);
@ -2693,10 +2682,8 @@ static void test_emf_clipping(void)
SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc_sclip),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
wine_dbgstr_rect(&rc_res));
hemf = CloseEnhMetaFile(hdc);
DeleteEnhMetaFile(hemf);