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); ret = GetRandomRgn(hdc, hrgn, 1);
ok(ret != 0, "GetRandomRgn rets %d\n", ret); ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n", ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ret = GetRandomRgn(hdc, hrgn, 2); ret = GetRandomRgn(hdc, hrgn, 2);
ok(ret == 0, "GetRandomRgn rets %d\n", ret); ok(ret == 0, "GetRandomRgn rets %d\n", ret);
@ -63,8 +62,7 @@ static void test_GetRandomRgn(void)
ret = GetRandomRgn(hdc, hrgn, 3); ret = GetRandomRgn(hdc, hrgn, 3);
ok(ret != 0, "GetRandomRgn rets %d\n", ret); ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n", ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
/* Move the clip to the meta and clear the clip */ /* Move the clip to the meta and clear the clip */
SetMetaRgn(hdc); SetMetaRgn(hdc);
@ -74,14 +72,12 @@ static void test_GetRandomRgn(void)
ret = GetRandomRgn(hdc, hrgn, 2); ret = GetRandomRgn(hdc, hrgn, 2);
ok(ret != 0, "GetRandomRgn rets %d\n", ret); ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n", ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ret = GetRandomRgn(hdc, hrgn, 3); ret = GetRandomRgn(hdc, hrgn, 3);
ok(ret != 0, "GetRandomRgn rets %d\n", ret); ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n", ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
/* Set a new clip (still got the meta) */ /* Set a new clip (still got the meta) */
SetRect(&rc2, 10, 30, 70, 90); SetRect(&rc2, 10, 30, 70, 90);
@ -90,22 +86,19 @@ static void test_GetRandomRgn(void)
ret = GetRandomRgn(hdc, hrgn, 1); ret = GetRandomRgn(hdc, hrgn, 1);
ok(ret != 0, "GetRandomRgn rets %d\n", ret); ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n", ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ret = GetRandomRgn(hdc, hrgn, 2); ret = GetRandomRgn(hdc, hrgn, 2);
ok(ret != 0, "GetRandomRgn rets %d\n", ret); ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n", ok(EqualRect(&rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
IntersectRect(&rc2, &rc, &rc2); IntersectRect(&rc2, &rc, &rc2);
ret = GetRandomRgn(hdc, hrgn, 3); ret = GetRandomRgn(hdc, hrgn, 3);
ok(ret != 0, "GetRandomRgn rets %d\n", ret); ok(ret != 0, "GetRandomRgn rets %d\n", ret);
GetRgnBox(hrgn, &ret_rc); GetRgnBox(hrgn, &ret_rc);
ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %d,%d - %d,%d\n", ok(EqualRect(&rc2, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&ret_rc));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom);
ret = GetRandomRgn(hdc, hrgn, SYSRGN); ret = GetRandomRgn(hdc, hrgn, SYSRGN);
@ -115,10 +108,7 @@ static void test_GetRandomRgn(void)
OffsetRect(&window_rc, -window_rc.left, -window_rc.top); OffsetRect(&window_rc, -window_rc.left, -window_rc.top);
/* the window may be partially obscured so the region may be smaller */ /* the window may be partially obscured so the region may be smaller */
IntersectRect( &window_rc, &ret_rc, &ret_rc ); IntersectRect( &window_rc, &ret_rc, &ret_rc );
ok(EqualRect(&window_rc, &ret_rc) || ok(EqualRect(&window_rc, &ret_rc), "GetRandomRgn %s\n", wine_dbgstr_rect(&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);
DeleteObject(hrgn); DeleteObject(hrgn);
ReleaseDC(hwnd, hdc); ReleaseDC(hwnd, hdc);
@ -149,15 +139,13 @@ static void verify_region(HRGN hrgn, const RECT *rc)
else else
ok(ret == sizeof(rgn.data.rdh) + sizeof(RECT), "expected sizeof(rgn), got %u\n", ret); 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", trace("size %u, type %u, count %u, rgn size %u, bound %s\n",
rgn.data.rdh.dwSize, rgn.data.rdh.iType, rgn.data.rdh.dwSize, rgn.data.rdh.iType, rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize,
rgn.data.rdh.nCount, rgn.data.rdh.nRgnSize, wine_dbgstr_rect(&rgn.data.rdh.rcBound));
rgn.data.rdh.rcBound.left, rgn.data.rdh.rcBound.top,
rgn.data.rdh.rcBound.right, rgn.data.rdh.rcBound.bottom);
if (rgn.data.rdh.nCount != 0) if (rgn.data.rdh.nCount != 0)
{ {
rect = (const RECT *)rgn.data.Buffer; 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"); ok(EqualRect(rect, rc), "rects don't match\n");
} }
@ -415,7 +403,7 @@ static void test_memory_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc); ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == 1 && rc.bottom == 1, 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); ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
@ -440,15 +428,15 @@ static void test_memory_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc); ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100, 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 ); SetRect( &rc, 10, 10, 20, 20 );
ret = RectVisible( hdc, &rc ); 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 ); SetRect( &rc, 20, 20, 10, 10 );
ret = RectVisible( hdc, &rc ); 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); ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret); ok(ret == 0, "expected 0, got %d\n", ret);
@ -459,7 +447,7 @@ static void test_memory_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc); ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret);
ok(rc.left == 0 && rc.top == 0 && rc.right == 100 && rc.bottom == 100, 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); DeleteDC(hdc);
DeleteObject(hrgn); DeleteObject(hrgn);
@ -510,17 +498,16 @@ static void test_window_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc); ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); 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", ok(EqualRect(&rc, &virtual_rect), "expected %s, got %s\n", wine_dbgstr_rect(&virtual_rect),
virtual_rect.left, virtual_rect.top, virtual_rect.right, virtual_rect.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
SetRect( &rc, 10, 10, 20, 20 ); SetRect( &rc, 10, 10, 20, 20 );
ret = RectVisible( hdc, &rc ); 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 ); SetRect( &rc, 20, 20, 10, 10 );
ret = RectVisible( hdc, &rc ); 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); ret = ExtSelectClipRgn(hdc, 0, RGN_DIFF);
ok(ret == 0, "expected 0, got %d\n", ret); ok(ret == 0, "expected 0, got %d\n", ret);
@ -530,9 +517,8 @@ static void test_window_dc_clipping(void)
ret = GetRgnBox(hrgn, &rc); ret = GetRgnBox(hrgn, &rc);
ok(ret == SIMPLEREGION, "expected SIMPLEREGION, got %d\n", ret); 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", ok(EqualRect(&rc, &virtual_rect), "expected %s, got %s\n", wine_dbgstr_rect(&virtual_rect),
virtual_rect.left, virtual_rect.top, virtual_rect.right, virtual_rect.bottom, wine_dbgstr_rect(&rc));
rc.left, rc.top, rc.right, rc.bottom);
ret = ExtSelectClipRgn(hdc, 0, RGN_COPY); ret = ExtSelectClipRgn(hdc, 0, RGN_COPY);
ok(ret == SIMPLEREGION || (ret == COMPLEXREGION && GetSystemMetrics(SM_CMONITORS) > 1), 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); ret = GetClipRgn(hdc, hrgn);
ok(ret == 0, "GetClipRgn returned %d instead of 0\n", ret); ok(ret == 0, "GetClipRgn returned %d instead of 0\n", ret);
ret = GetRgnBox(hrgn, &rc); ret = GetRgnBox(hrgn, &rc);
ok(ret == NULLREGION, "GetRgnBox returned %d (%d,%d-%d,%d) instead of NULLREGION\n", ok(ret == NULLREGION, "GetRgnBox returned %d %s instead of NULLREGION\n",
ret, rc.left, rc.top, rc.right, rc.bottom); ret, wine_dbgstr_rect(&rc));
/*dump_region(hrgn);*/ /*dump_region(hrgn);*/
SetRect(&rc, 0, 0, 100, 100); SetRect(&rc, 0, 0, 100, 100);
ok(EqualRect(&rc, &rc_clip), ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
"rects are not equal: (%d,%d-%d,%d) - (%d,%d-%d,%d)\n", wine_dbgstr_rect(&rc_clip));
rc.left, rc.top, rc.right, rc.bottom,
rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
ret = SaveDC(hdc); ret = SaveDC(hdc);
ok(ret == 1, "ret = %d\n", ret); ok(ret == 1, "ret = %d\n", ret);
@ -162,10 +160,8 @@ static void test_savedc_2(void)
ret = GetClipBox(hdc, &rc_clip); ret = GetClipBox(hdc, &rc_clip);
ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret); ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
SetRect(&rc, 0, 0, 50, 50); SetRect(&rc, 0, 0, 50, 50);
ok(EqualRect(&rc, &rc_clip), ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
"rects are not equal: (%d,%d-%d,%d) - (%d,%d-%d,%d)\n", wine_dbgstr_rect(&rc_clip));
rc.left, rc.top, rc.right, rc.bottom,
rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
ret = RestoreDC(hdc, 1); ret = RestoreDC(hdc, 1);
ok(ret, "ret = %d\n", ret); ok(ret, "ret = %d\n", ret);
@ -173,10 +169,8 @@ static void test_savedc_2(void)
ret = GetClipBox(hdc, &rc_clip); ret = GetClipBox(hdc, &rc_clip);
ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret); ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION), "GetClipBox returned %d instead of SIMPLEREGION\n", ret);
SetRect(&rc, 0, 0, 100, 100); SetRect(&rc, 0, 0, 100, 100);
ok(EqualRect(&rc, &rc_clip), ok(EqualRect(&rc, &rc_clip), "rects are not equal: %s - %s\n", wine_dbgstr_rect(&rc),
"rects are not equal: (%d,%d-%d,%d) - (%d,%d-%d,%d)\n", wine_dbgstr_rect(&rc_clip));
rc.left, rc.top, rc.right, rc.bottom,
rc_clip.left, rc_clip.top, rc_clip.right, rc_clip.bottom);
DeleteObject(hrgn); DeleteObject(hrgn);
ReleaseDC(hwnd, hdc); 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 ); "GetBoundsRect returned type %x for %s\n", type, descr );
if (type == DCB_RESET) if (type == DCB_RESET)
ok( rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0, ok( rect.left == 0 && rect.top == 0 && rect.right == 0 && rect.bottom == 0,
"GetBoundsRect returned %d,%d,%d,%d type %x for %s\n", "GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
rect.left, rect.top, rect.right, rect.bottom, type, descr ); type, descr );
type = SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE ); type = SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
ok( type == (DCB_RESET | DCB_DISABLE) || broken(type == (DCB_SET | DCB_ENABLE)) /* XP */, 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 ) ); "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 ); type = GetBoundsRect( hdc, &rect, DCB_RESET );
todo_wine_if (GetObjectType( hdc ) == OBJ_ENHMETADC || (GetObjectType( hdc ) == OBJ_DC && GetDeviceCaps( hdc, TECHNOLOGY ) == DT_RASPRINTER)) 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, 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", "GetBoundsRect returned %s type %x for %s\n", wine_dbgstr_rect( &rect ),
rect.left, rect.top, rect.right, rect.bottom, type, descr ); type, descr );
} }
type = GetClipBox( ref_dc, &rect ); 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 && todo_wine_if (GetDeviceCaps( ref_dc, TECHNOLOGY ) == DT_RASDISPLAY && GetObjectType( hdc ) != OBJ_ENHMETADC &&
(GetSystemMetrics( SM_XVIRTUALSCREEN ) || GetSystemMetrics( SM_YVIRTUALSCREEN ))) (GetSystemMetrics( SM_XVIRTUALSCREEN ) || GetSystemMetrics( SM_YVIRTUALSCREEN )))
ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %d,%d,%d,%d on %s\n", ok( EqualRect( &rect, &ref_rect ), "GetClipBox returned %s on %s\n",
rect.left, rect.top, rect.right, rect.bottom, descr ); wine_dbgstr_rect( &rect ), descr );
} }
SetBoundsRect( ref_dc, NULL, DCB_RESET | DCB_ACCUMULATE ); 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 */ /* 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) || 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), (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", "GetBoundsRect returned %s type %x on %s\n", wine_dbgstr_rect( &rect ), type, descr );
rect.left, rect.top, rect.right, rect.bottom, type, descr );
if (GetObjectType( hdc ) == OBJ_MEMDC) 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 ); type = GetClipBox( hdc, &rect );
ok( type == SIMPLEREGION, "GetClipBox returned %d on memdc for %s\n", type, descr ); 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, ok( rect.left == 0 && rect.top == 0 && rect.right == 16 && rect.bottom == 16,
"GetClipBox returned %d,%d,%d,%d on memdc for %s\n", "GetClipBox returned %s on memdc for %s\n", wine_dbgstr_rect( &rect ), descr );
rect.left, rect.top, rect.right, rect.bottom, descr );
SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE ); SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
SetMapMode( hdc, MM_TEXT ); SetMapMode( hdc, MM_TEXT );
Rectangle( hdc, 5, 5, 12, 14 ); Rectangle( hdc, 5, 5, 12, 14 );
type = GetBoundsRect( hdc, &rect, DCB_RESET ); type = GetBoundsRect( hdc, &rect, DCB_RESET );
ok( rect.left == 5 && rect.top == 5 && rect.right == 12 && rect.bottom == 14 && type == DCB_SET, 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", "GetBoundsRect returned %s type %x on memdc for %s\n", wine_dbgstr_rect( &rect ),
rect.left, rect.top, rect.right, rect.bottom, type, descr ); type, descr );
SelectObject( hdc, old ); SelectObject( hdc, old );
DeleteObject( dib ); DeleteObject( dib );
@ -891,10 +883,8 @@ static void test_boundsrect(void)
ok(ret == DCB_RESET, ok(ret == DCB_RESET,
"Expected GetBoundsRect to return DCB_RESET, got %u\n", ret); "Expected GetBoundsRect to return DCB_RESET, got %u\n", ret);
SetRectEmpty(&expect); SetRectEmpty(&expect);
ok(EqualRect(&rect, &expect) || ok(EqualRect(&rect, &expect), "Expected output rectangle (0,0)-(0,0), got %s\n",
broken(EqualRect(&rect, &set_rect)), /* nt4 sp1-5 */ wine_dbgstr_rect(&rect));
"Expected output rectangle (0,0)-(0,0), got (%d,%d)-(%d,%d)\n",
rect.left, rect.top, rect.right, rect.bottom);
ret = GetBoundsRect(NULL, NULL, 0); ret = GetBoundsRect(NULL, NULL, 0);
ok(ret == 0, "Expected GetBoundsRect to return 0, got %u\n", ret); 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); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 10, 20, 40, 50); SetRect(&expect, 10, 20, 40, 50);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
SetMapMode( hdc, MM_ANISOTROPIC ); SetMapMode( hdc, MM_ANISOTROPIC );
SetViewportExtEx( hdc, 2, 2, NULL ); SetViewportExtEx( hdc, 2, 2, NULL );
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 5, 10, 20, 25); SetRect(&expect, 5, 10, 20, 25);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
SetViewportOrgEx( hdc, 20, 30, NULL ); SetViewportOrgEx( hdc, 20, 30, NULL );
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, -5, -5, 10, 10); SetRect(&expect, -5, -5, 10, 10);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
SetRect(&set_rect, 10, 20, 40, 50); SetRect(&set_rect, 10, 20, 40, 50);
ret = SetBoundsRect(hdc, &set_rect, DCB_SET); ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
@ -940,16 +927,14 @@ static void test_boundsrect(void)
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 10, 20, 40, 50); SetRect(&expect, 10, 20, 40, 50);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
SetMapMode( hdc, MM_TEXT ); SetMapMode( hdc, MM_TEXT );
SetViewportOrgEx( hdc, 0, 0, NULL ); SetViewportOrgEx( hdc, 0, 0, NULL );
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 40, 70, 100, 130); SetRect(&expect, 40, 70, 100, 130);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
if (pSetLayout) if (pSetLayout)
{ {
@ -957,23 +942,20 @@ static void test_boundsrect(void)
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 159, 70, 99, 130); SetRect(&expect, 159, 70, 99, 130);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
SetRect(&set_rect, 50, 25, 30, 35); SetRect(&set_rect, 50, 25, 30, 35);
ret = SetBoundsRect(hdc, &set_rect, DCB_SET); ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret); ok(ret == (DCB_SET | DCB_DISABLE), "SetBoundsRect returned %x\n", ret);
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 50, 25, 30, 35); SetRect(&expect, 50, 25, 30, 35);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
pSetLayout( hdc, LAYOUT_LTR ); pSetLayout( hdc, LAYOUT_LTR );
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_SET, "GetBoundsRect returned %x\n", ret);
SetRect(&expect, 149, 25, 169, 35); SetRect(&expect, 149, 25, 169, 35);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
} }
/* empty rect resets, except on nt4 */ /* empty rect resets, except on nt4 */
@ -986,8 +968,7 @@ static void test_boundsrect(void)
if (ret == DCB_RESET) if (ret == DCB_RESET)
{ {
SetRectEmpty(&expect); SetRectEmpty(&expect);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
SetRect(&expect, 20, 20, 20, 20); SetRect(&expect, 20, 20, 20, 20);
ret = SetBoundsRect(hdc, &set_rect, DCB_SET); ret = SetBoundsRect(hdc, &set_rect, DCB_SET);
@ -995,8 +976,7 @@ static void test_boundsrect(void)
ret = GetBoundsRect(hdc, &rect, 0); ret = GetBoundsRect(hdc, &rect, 0);
ok(ret == DCB_RESET, "GetBoundsRect returned %x\n", ret); ok(ret == DCB_RESET, "GetBoundsRect returned %x\n", ret);
SetRectEmpty(&expect); SetRectEmpty(&expect);
ok(EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", ok(EqualRect(&rect, &expect), "Got %s\n", wine_dbgstr_rect(&rect));
rect.left, rect.top, rect.right, rect.bottom);
} }
SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE ); SetBoundsRect( hdc, NULL, DCB_RESET | DCB_ENABLE );
@ -1005,47 +985,47 @@ static void test_boundsrect(void)
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 10, 10, 21, 21 ); 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 ); SetRect( &rect, 8, 8, 23, 23 );
expect = rect; expect = rect;
SetBoundsRect( hdc, &rect, DCB_ACCUMULATE ); SetBoundsRect( hdc, &rect, DCB_ACCUMULATE );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); 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 ); level = SaveDC( hdc );
LineTo( hdc, 30, 25 ); LineTo( hdc, 30, 25 );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 8, 8, 31, 26 ); 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 ); SetBoundsRect( hdc, NULL, DCB_DISABLE );
LineTo( hdc, 40, 40 ); LineTo( hdc, 40, 40 );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 8, 8, 31, 26 ); 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 ); SetRect( &rect, 6, 6, 30, 30 );
SetBoundsRect( hdc, &rect, DCB_ACCUMULATE ); SetBoundsRect( hdc, &rect, DCB_ACCUMULATE );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 31, 30 ); 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 ); RestoreDC( hdc, level );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); 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 ); LineTo( hdc, 40, 40 );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); 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 ); SelectObject( hdc, old );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 1, 1 ); 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 ); SetBoundsRect( hdc, NULL, DCB_ENABLE );
LineTo( hdc, 50, 40 ); LineTo( hdc, 50, 40 );
@ -1053,13 +1033,13 @@ static void test_boundsrect(void)
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 51, 41 ); 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 )); SelectObject( hdc, GetStockObject( NULL_PEN ));
LineTo( hdc, 50, 50 ); LineTo( hdc, 50, 50 );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 51, 51 ); 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) ); memset( buffer, 0, sizeof(buffer) );
info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
@ -1074,22 +1054,22 @@ static void test_boundsrect(void)
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 51, 51 ); 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 ); LineTo( hdc, 55, 30 );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 56, 51 ); 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 ); LineTo( hdc, 300, 30 );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 6, 6, 256, 51 ); 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 ); LineTo( hdc, -300, -300 );
ret = GetBoundsRect( hdc, &rect, 0 ); ret = GetBoundsRect( hdc, &rect, 0 );
ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret ); ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
SetRect( &expect, 0, 0, 256, 51 ); 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 */ /* test the wide pen heuristics */
SetBoundsRect( hdc, NULL, DCB_ENABLE | DCB_RESET ); SetBoundsRect( hdc, NULL, DCB_ENABLE | DCB_RESET );
@ -1130,10 +1110,8 @@ static void test_boundsrect(void)
expect.top = max( expect.top, 0 ); expect.top = max( expect.top, 0 );
expect.right = min( expect.right, 256 ); expect.right = min( expect.right, 256 );
expect.bottom = min( expect.bottom, 256 ); expect.bottom = min( expect.bottom, 256 );
ok( EqualRect(&rect, &expect), ok(EqualRect(&rect, &expect), "Got %s expected %s %u/%x/%x\n", wine_dbgstr_rect(&rect),
"Got %d,%d,%d,%d expected %d,%d,%d,%d %u/%x/%x\n", wine_dbgstr_rect(&expect), width, endcap, join);
rect.left, rect.top, rect.right, rect.bottom,
expect.left, expect.top, expect.right, expect.bottom, width, endcap, join );
DeleteObject( SelectObject( hdc, old )); 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->right == -1 &&
current_bounds->bottom == -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; return;
} }

View File

@ -309,27 +309,22 @@ static void test_dc_layout(void)
hrgn = CreateRectRgn( 0, 0, 0, 0 ); hrgn = CreateRectRgn( 0, 0, 0, 0 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
pSetLayout( hdc, LAYOUT_LTR ); pSetLayout( hdc, LAYOUT_LTR );
SetRect( &rc, 80, 10, 90, 20 ); SetRect( &rc, 80, 10, 90, 20 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
GetClipBox( hdc, &ret_rc ); GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
IntersectClipRect( hdc, 80, 10, 85, 20 ); IntersectClipRect( hdc, 80, 10, 85, 20 );
pSetLayout( hdc, LAYOUT_RTL ); pSetLayout( hdc, LAYOUT_RTL );
SetRect( &rc, 15, 10, 20, 20 ); SetRect( &rc, 15, 10, 20, 20 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
GetClipBox( hdc, &ret_rc ); GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
SetRectRgn( hrgn, 60, 10, 80, 20 ); SetRectRgn( hrgn, 60, 10, 80, 20 );
pSetLayout( hdc, LAYOUT_LTR ); pSetLayout( hdc, LAYOUT_LTR );
ExtSelectClipRgn( hdc, hrgn, RGN_OR ); ExtSelectClipRgn( hdc, hrgn, RGN_OR );
@ -337,19 +332,16 @@ static void test_dc_layout(void)
SetRect( &rc, 15, 10, 40, 20 ); SetRect( &rc, 15, 10, 40, 20 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
GetClipBox( hdc, &ret_rc ); GetClipBox( hdc, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
/* OffsetClipRgn mirrors too */ /* OffsetClipRgn mirrors too */
OffsetClipRgn( hdc, 5, 5 ); OffsetClipRgn( hdc, 5, 5 );
OffsetRect( &rc, 5, 5 ); OffsetRect( &rc, 5, 5 );
GetClipRgn( hdc, hrgn ); GetClipRgn( hdc, hrgn );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
/* GetRandomRgn returns the raw region */ /* GetRandomRgn returns the raw region */
if (pGetRandomRgn) if (pGetRandomRgn)
@ -357,8 +349,7 @@ static void test_dc_layout(void)
SetRect( &rc, 55, 15, 80, 25 ); SetRect( &rc, 55, 15, 80, 25 );
pGetRandomRgn( hdc, hrgn, 1 ); pGetRandomRgn( hdc, hrgn, 1 );
GetRgnBox( hrgn, &ret_rc ); GetRgnBox( hrgn, &ret_rc );
ok( EqualRect( &rc, &ret_rc ), "wrong clip box %d,%d - %d,%d\n", ok( EqualRect( &rc, &ret_rc ), "wrong clip box %s\n", wine_dbgstr_rect( &ret_rc ));
ret_rc.left, ret_rc.top, ret_rc.right, ret_rc.bottom );
} }
SetMapMode(hdc, MM_LOMETRIC); 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; 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.dwSize, rgn1->data.rdh.iType,
rgn1->data.rdh.nCount, rgn1->data.rdh.nRgnSize, rgn1->data.rdh.nCount, rgn1->data.rdh.nRgnSize,
rgn1->data.rdh.rcBound.left, rgn1->data.rdh.rcBound.top, wine_dbgstr_rect(&rgn1->data.rdh.rcBound));
rgn1->data.rdh.rcBound.right, rgn1->data.rdh.rcBound.bottom);
ok(EqualRect(&rgn1->data.rdh.rcBound, rc), "rects don't match\n"); ok(EqualRect(&rgn1->data.rdh.rcBound, rc), "rects don't match\n");
rect = *(const RECT *)rgn1->data.Buffer; 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(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); 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); ret = GetRegionData(hrgn, sizeof(rgn2), &rgn2.data);
ok(ret == sizeof(rgn2), "expected sizeof(rgn2), got %u\n", ret); 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", trace("size %u, type %u, count %u, rgn size %u, bound %s\n", rgn2.data.rdh.dwSize,
rgn2.data.rdh.dwSize, rgn2.data.rdh.iType, rgn2.data.rdh.iType, rgn2.data.rdh.nCount, rgn2.data.rdh.nRgnSize,
rgn2.data.rdh.nCount, rgn2.data.rdh.nRgnSize, wine_dbgstr_rect(&rgn2.data.rdh.rcBound));
rgn2.data.rdh.rcBound.left, rgn2.data.rdh.rcBound.top,
rgn2.data.rdh.rcBound.right, rgn2.data.rdh.rcBound.bottom);
rect = rgn2.data.rdh.rcBound; rect = rgn2.data.rdh.rcBound;
rc_transformed = *rc; rc_transformed = *rc;
translate((POINT *)&rc_transformed, 2, &xform); translate((POINT *)&rc_transformed, 2, &xform);
trace("transformed (%d,%d-%d,%d)\n", rc_transformed.left, rc_transformed.top, trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
rc_transformed.right, rc_transformed.bottom);
ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n"); ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n");
rect = *(const RECT *)rgn2.data.Buffer; 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; rc_transformed = *rc;
translate((POINT *)&rc_transformed, 2, &xform); translate((POINT *)&rc_transformed, 2, &xform);
trace("transformed (%d,%d-%d,%d)\n", rc_transformed.left, rc_transformed.top, trace("transformed %s\n", wine_dbgstr_rect(&rc_transformed));
rc_transformed.right, rc_transformed.bottom);
ok(is_equal_rect(&rect, &rc_transformed), "rects don't match\n"); 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); 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); SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res); ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret); ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc_sclip), ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&rc_res));
rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
OffsetRect(&rc_sclip, -100, -100); OffsetRect(&rc_sclip, -100, -100);
ret = OffsetClipRgn(hdc, -100, -100); ret = OffsetClipRgn(hdc, -100, -100);
@ -2656,10 +2649,8 @@ static void test_emf_clipping(void)
SetRect(&rc_res, -1, -1, -1, -1); SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res); ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret); ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc_sclip), ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&rc_res));
rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
ret = IntersectClipRect(hdc, 0, 0, 100, 100); ret = IntersectClipRect(hdc, 0, 0, 100, 100);
ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION) /* XP */, "got %d\n", ret); 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); SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res); ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret); ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc), ok(EqualRect(&rc_res, &rc), "expected %s, got %s\n", wine_dbgstr_rect(&rc),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&rc_res));
rc.left, rc.top, rc.right, rc.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
SetRect(&rc_sclip, 0, 0, 100, 50); SetRect(&rc_sclip, 0, 0, 100, 50);
ret = ExcludeClipRect(hdc, 0, 50, 100, 100); ret = ExcludeClipRect(hdc, 0, 50, 100, 100);
@ -2693,10 +2682,8 @@ static void test_emf_clipping(void)
SetRect(&rc_res, -1, -1, -1, -1); SetRect(&rc_res, -1, -1, -1, -1);
ret = GetClipBox(hdc, &rc_res); ret = GetClipBox(hdc, &rc_res);
ok(ret == SIMPLEREGION, "got %d\n", ret); ok(ret == SIMPLEREGION, "got %d\n", ret);
ok(EqualRect(&rc_res, &rc_sclip), ok(EqualRect(&rc_res, &rc_sclip), "expected %s, got %s\n", wine_dbgstr_rect(&rc_sclip),
"expected (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n", wine_dbgstr_rect(&rc_res));
rc_sclip.left, rc_sclip.top, rc_sclip.right, rc_sclip.bottom,
rc_res.left, rc_res.top, rc_res.right, rc_res.bottom);
hemf = CloseEnhMetaFile(hdc); hemf = CloseEnhMetaFile(hdc);
DeleteEnhMetaFile(hemf); DeleteEnhMetaFile(hemf);