Commit 75426bb9 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

Two old (win95 and winnt) broken() removed en passant. Signed-off-by: 's avatarMichael Stefaniuc <mstefani@redhat.de> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 085a538d
......@@ -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),
......
......@@ -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;
}
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment