diff --git a/rostests/winetests/gdi32/clipping.c b/rostests/winetests/gdi32/clipping.c index 64f2a1d179f..60bd31e8e40 100644 --- a/rostests/winetests/gdi32/clipping.c +++ b/rostests/winetests/gdi32/clipping.c @@ -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), diff --git a/rostests/winetests/gdi32/dc.c b/rostests/winetests/gdi32/dc.c index 7c5f2b35d1a..d24898929ea 100644 --- a/rostests/winetests/gdi32/dc.c +++ b/rostests/winetests/gdi32/dc.c @@ -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 )); } diff --git a/rostests/winetests/gdi32/dib.c b/rostests/winetests/gdi32/dib.c index c6cb44c2b5f..023b902b3a9 100644 --- a/rostests/winetests/gdi32/dib.c +++ b/rostests/winetests/gdi32/dib.c @@ -1275,14 +1275,12 @@ 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; } - ok( !memcmp( current_bounds, &rect, sizeof(RECT) ), - "%s: %s: expected bounds %d,%d,%d,%d got %d,%d,%d,%d\n", dst_format, info, - current_bounds->left, current_bounds->top, current_bounds->right, current_bounds->bottom, - rect.left, rect.top, rect.right, rect.bottom ); + ok( EqualRect( current_bounds, &rect ), "%s: %s: expected bounds %s got %s\n", dst_format, info, + wine_dbgstr_rect( current_bounds ), wine_dbgstr_rect( &rect )); current_bounds++; } diff --git a/rostests/winetests/gdi32/mapping.c b/rostests/winetests/gdi32/mapping.c index b8dd8ee6ee9..6635a72c18c 100644 --- a/rostests/winetests/gdi32/mapping.c +++ b/rostests/winetests/gdi32/mapping.c @@ -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); diff --git a/rostests/winetests/gdi32/metafile.c b/rostests/winetests/gdi32/metafile.c index f55686310ea..4ff67bf429e 100755 --- a/rostests/winetests/gdi32/metafile.c +++ b/rostests/winetests/gdi32/metafile.c @@ -2624,16 +2624,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); @@ -2671,25 +2670,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); @@ -2761,10 +2756,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); @@ -2772,10 +2765,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); @@ -2790,10 +2781,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); @@ -2809,10 +2798,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); @@ -3227,8 +3214,7 @@ static void test_SetWinMetaFileBits(void) if (!wmfDC) return; SetWindowExtEx(wmfDC, 100, 100, NULL); - rect.left = rect.top = 0; - rect.right = rect.bottom = 50; + SetRect(&rect, 0, 0, 50, 50); FillRect(wmfDC, &rect, GetStockObject(BLACK_BRUSH)); wmf = CloseMetaFile(wmfDC); ok(wmf != NULL, "Metafile creation failed\n"); @@ -3366,16 +3352,17 @@ static BOOL near_match(int x, int y) static void getwinmetafilebits(UINT mode, int scale, RECT *rc) { - HENHMETAFILE emf; + HENHMETAFILE emf, emf2; HDC display_dc, emf_dc; - ENHMETAHEADER *enh_header; - UINT size, emf_size, i; + ENHMETAHEADER *enh_header, *enh2_header; + UINT size, emf_size, i, emf2_size; WORD check = 0; DWORD rec_num = 0; METAHEADER *mh = NULL; METARECORD *rec; INT horz_res, vert_res, horz_size, vert_size; INT curve_caps, line_caps, poly_caps; + METAFILEPICT mfp; display_dc = GetDC(NULL); ok(display_dc != NULL, "display_dc is NULL\n"); @@ -3518,6 +3505,21 @@ static void getwinmetafilebits(UINT mode, int scale, RECT *rc) rec = (METARECORD*)((WORD*)rec + rec->rdSize); } + /* Show that we get the original back when we do the reverse conversion. + mfp is ignored in this case. */ + mfp.mm = MM_ISOTROPIC; + mfp.xExt = 0xcafe; + mfp.yExt = 0xbeef; + emf2 = SetWinMetaFileBits( size, (BYTE*)mh, NULL, &mfp ); + ok( !!emf2, "got NULL\n" ); + emf2_size = GetEnhMetaFileBits( emf2, 0, NULL ); + enh2_header = HeapAlloc( GetProcessHeap(), 0, emf2_size ); + emf2_size = GetEnhMetaFileBits( emf2, emf2_size, (BYTE*)enh2_header ); + ok( emf_size == emf2_size, "%d %d\n", emf_size, emf2_size ); + ok( !memcmp( enh_header, enh2_header, emf_size ), "mismatch\n" ); + HeapFree( GetProcessHeap(), 0, enh2_header ); + DeleteEnhMetaFile( emf2 ); + end: HeapFree(GetProcessHeap(), 0, mh); HeapFree(GetProcessHeap(), 0, enh_header); @@ -3697,15 +3699,15 @@ static void test_emf_polybezier(void) static const unsigned char EMF_PATH_BITS[] = { 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xef, 0xff, 0xff, 0xff, 0xea, 0xff, 0xff, 0xff, + 0x0a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, + 0x90, 0x01, 0x00, 0x00, 0x90, 0x01, 0x00, 0x00, + 0x70, 0x17, 0x00, 0x00, 0x70, 0x17, 0x00, 0x00, 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00, - 0x0c, 0x02, 0x00, 0x00, 0x11, 0x00, 0x00, 0x00, + 0xf8, 0x02, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x07, 0x00, 0x00, 0x3e, 0x04, 0x00, 0x00, + 0x20, 0x03, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, 0x40, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x04, 0x00, @@ -3728,7 +3730,12 @@ static const unsigned char EMF_PATH_BITS[] = 0x15, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, 0x1d, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, - 0x15, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, + 0x15, 0x00, 0x00, 0x00, 0x37, 0x00, 0x00, 0x00, + 0x28, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x1a, 0x00, 0x00, 0x00, 0x25, 0x00, 0x00, 0x00, + 0x1b, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x15, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x27, 0x00, 0x00, 0x00, @@ -3751,23 +3758,78 @@ static const unsigned char EMF_PATH_BITS[] = 0xff, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x14, 0x00, 0x14, 0x00, - 0x5a, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, + 0x59, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x02, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, + 0x14, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x14, 0x00, + 0x14, 0x00, 0x14, 0x00, 0x5a, 0x00, 0x00, 0x00, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x02, 0x00, 0x00, 0x00, + 0x04, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, + 0x14, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x14, 0x00, + 0x14, 0x00, 0x14, 0x00, 0x5c, 0x00, 0x00, 0x00, + 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x09, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x14, 0x00, 0x14, 0x00, 0x14, 0x00, - 0x3c, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00 + 0x1e, 0x00, 0x1e, 0x00, 0x28, 0x00, 0x14, 0x00, + 0x14, 0x00, 0x1e, 0x00, 0x14, 0x00, 0x14, 0x00, + 0x14, 0x00, 0x0a, 0x00, 0x06, 0x02, 0x04, 0x04, + 0x04, 0x02, 0x03, 0x06, 0x02, 0x00, 0x00, 0x00, + 0x29, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, + 0x25, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, + 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb4, 0x42, + 0x00, 0x00, 0x34, 0x43, 0x3c, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, + 0x0a, 0x00, 0x00, 0x00, 0x96, 0x00, 0x00, 0x00, + 0x96, 0x00, 0x00, 0x00, 0x3f, 0x00, 0x00, 0x00, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0x0e, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 }; -static void test_emf_GetPath(void) +static const unsigned char EMF_EMPTY_PATH_BITS[] = { - POINT pts[4] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}}; + 0x01, 0x00, 0x00, 0x00, 0x6c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xd8, 0xff, 0xff, 0xff, 0xd8, 0xff, 0xff, 0xff, + 0x20, 0x45, 0x4d, 0x46, 0x00, 0x00, 0x01, 0x00, + 0xc8, 0x00, 0x00, 0x00, 0x0b, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x03, 0x00, 0x00, 0x58, 0x02, 0x00, 0x00, + 0x40, 0x01, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xe2, 0x04, 0x00, + 0x80, 0xa9, 0x03, 0x00, 0x3b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x3d, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x3b, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, + 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00 +}; + +static void test_emf_paths(void) +{ + POINT pts[9] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}, {30, 30}, {40, 20}, {20, 30}, {20, 20}, {20, 10}}; DWORD counts[2] = {2, 2}; + BYTE types[9] = { PT_MOVETO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO, + PT_LINETO | PT_CLOSEFIGURE, PT_MOVETO, PT_LINETO }; HDC hdcMetafile; HENHMETAFILE hemf; BOOL ret; @@ -3791,24 +3853,67 @@ static void test_emf_GetPath(void) ok( ret, "LineTo error %d.\n", GetLastError()); Rectangle(hdcMetafile, 10, 10, 20, 20); Arc(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21); + ArcTo(hdcMetafile, 23, 23, 37, 27, 37, 27, 23, 23); Chord(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21); Pie(hdcMetafile, 21, 21, 39, 29, 39, 29, 21, 21); Ellipse(hdcMetafile, 10, 10, 20, 20); RoundRect(hdcMetafile, 10, 10, 20, 20, 3, 5); Polyline(hdcMetafile, pts, 4); + PolylineTo(hdcMetafile, pts, 4); PolyPolyline(hdcMetafile, pts, counts, 2); + PolyDraw(hdcMetafile, pts, types, 9); + AngleArc(hdcMetafile, 37, 36, 23, 90, 180); EndPath(hdcMetafile); size = GetPath(hdcMetafile, NULL, NULL, 0); - todo_wine ok( size == 77, "GetPath returned %d.\n", size); + ok( size == 112, "GetPath returned %d.\n", size); + + ret = StrokeAndFillPath( hdcMetafile ); + ok( ret, "StrokeAndFillPath failed err %d\n", GetLastError() ); + ret = StrokeAndFillPath( hdcMetafile ); + ok( !ret, "StrokeAndFillPath succeeded\n" ); hemf = CloseEnhMetaFile(hdcMetafile); ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError()); - if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_GetPath", FALSE) != 0) + if (compare_emf_bits(hemf, EMF_PATH_BITS, sizeof(EMF_PATH_BITS), "test_emf_paths", FALSE) != 0) { - dump_emf_bits(hemf, "test_emf_GetPath"); - dump_emf_records(hemf, "test_emf_GetPath"); + dump_emf_bits(hemf, "test_emf_paths"); + dump_emf_records(hemf, "test_emf_paths"); + } + + DeleteEnhMetaFile(hemf); + + SetLastError(0xdeadbeef); + hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL); + ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError()); + + ret = BeginPath(hdcMetafile); + ok( ret, "BeginPath failed error %d\n", GetLastError() ); + ret = CloseFigure(hdcMetafile); + ok( ret, "CloseFigure failed error %d\n", GetLastError() ); + ret = BeginPath(hdcMetafile); + ok( ret, "BeginPath failed error %d\n", GetLastError() ); + ret = EndPath(hdcMetafile); + ok( ret, "EndPath failed error %d\n", GetLastError() ); + ret = EndPath(hdcMetafile); + ok( !ret, "EndPath succeeded\n" ); + ret = CloseFigure(hdcMetafile); + ok( !ret, "CloseFigure succeeded\n" ); + ret = BeginPath(hdcMetafile); + ok( ret, "BeginPath failed error %d\n", GetLastError() ); + ret = AbortPath(hdcMetafile); + ok( ret, "AbortPath failed error %d\n", GetLastError() ); + ret = AbortPath(hdcMetafile); + ok( ret, "AbortPath failed error %d\n", GetLastError() ); + + hemf = CloseEnhMetaFile(hdcMetafile); + ok(hemf != 0, "CloseEnhMetaFile error %d\n", GetLastError()); + + if (compare_emf_bits(hemf, EMF_EMPTY_PATH_BITS, sizeof(EMF_EMPTY_PATH_BITS), "empty path", FALSE) != 0) + { + dump_emf_bits(hemf, "empty path"); + dump_emf_records(hemf, "empty path"); } DeleteEnhMetaFile(hemf); @@ -3925,7 +4030,7 @@ START_TEST(metafile) test_emf_ExtTextOut_on_path(); test_emf_clipping(); test_emf_polybezier(); - test_emf_GetPath(); + test_emf_paths(); test_emf_PolyPolyline(); test_emf_GradientFill(); diff --git a/rostests/winetests/gdi32/path.c b/rostests/winetests/gdi32/path.c index 223a027107b..48ef4f016a1 100644 --- a/rostests/winetests/gdi32/path.c +++ b/rostests/winetests/gdi32/path.c @@ -38,6 +38,7 @@ static void test_path_state(void) BYTE buffer[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)]; BITMAPINFO *bi = (BITMAPINFO *)buffer; HDC hdc; + HRGN rgn; HBITMAP orig, dib; void *bits; BOOL ret; @@ -138,6 +139,12 @@ static void test_path_state(void) ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef), "wrong error %u\n", GetLastError() ); + SetLastError( 0xdeadbeef ); + rgn = PathToRegion( hdc ); + ok( !rgn, "PathToRegion succeeded\n" ); + ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef), + "wrong error %u\n", GetLastError() ); + SetLastError( 0xdeadbeef ); ret = EndPath( hdc ); ok( !ret, "SelectClipPath succeeded\n" ); @@ -200,6 +207,15 @@ static void test_path_state(void) ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef), "wrong error %u\n", GetLastError() ); + AbortPath( hdc ); + BeginPath( hdc ); + Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */ + SetLastError( 0xdeadbeef ); + rgn = PathToRegion( hdc ); + ok( !rgn, "PathToRegion succeeded\n" ); + ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef), + "wrong error %u\n", GetLastError() ); + AbortPath( hdc ); BeginPath( hdc ); ret = CloseFigure( hdc ); @@ -211,39 +227,66 @@ static void test_path_state(void) EndPath( hdc ); ret = WidenPath( hdc ); ok( ret, "WidenPath failed\n" ); + ok( GetPath( hdc, NULL, NULL, 0 ) != -1, "path deleted\n" ); AbortPath( hdc ); BeginPath( hdc ); EndPath( hdc ); ret = FlattenPath( hdc ); ok( ret, "FlattenPath failed\n" ); + ok( GetPath( hdc, NULL, NULL, 0 ) != -1, "path deleted\n" ); AbortPath( hdc ); BeginPath( hdc ); EndPath( hdc ); ret = StrokePath( hdc ); ok( ret, "StrokePath failed\n" ); + ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" ); - AbortPath( hdc ); BeginPath( hdc ); EndPath( hdc ); ret = FillPath( hdc ); ok( ret, "FillPath failed\n" ); + ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" ); - AbortPath( hdc ); BeginPath( hdc ); EndPath( hdc ); ret = StrokeAndFillPath( hdc ); ok( ret, "StrokeAndFillPath failed\n" ); + ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" ); - AbortPath( hdc ); BeginPath( hdc ); Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */ EndPath( hdc ); ret = SelectClipPath( hdc, RGN_OR ); ok( ret, "SelectClipPath failed\n" ); + ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" ); + + BeginPath( hdc ); + EndPath( hdc ); + SetLastError( 0xdeadbeef ); + ret = SelectClipPath( hdc, RGN_OR ); + ok( !ret, "SelectClipPath succeeded on empty path\n" ); + ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() ); + ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" ); + + BeginPath( hdc ); + Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */ + EndPath( hdc ); + rgn = PathToRegion( hdc ); + ok( rgn != 0, "PathToRegion failed\n" ); + DeleteObject( rgn ); + ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" ); + + BeginPath( hdc ); + EndPath( hdc ); + SetLastError( 0xdeadbeef ); + rgn = PathToRegion( hdc ); + ok( !rgn, "PathToRegion succeeded on empty path\n" ); + ok( GetLastError() == 0xdeadbeef, "wrong error %u\n", GetLastError() ); + DeleteObject( rgn ); + ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" ); - AbortPath( hdc ); BeginPath( hdc ); EndPath( hdc ); SetLastError( 0xdeadbeef ); @@ -257,7 +300,7 @@ static void test_path_state(void) EndPath( hdc ); SetLastError( 0xdeadbeef ); ret = EndPath( hdc ); - ok( !ret, "SelectClipPath succeeded\n" ); + ok( !ret, "EndPath succeeded\n" ); ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef), "wrong error %u\n", GetLastError() ); @@ -338,15 +381,6 @@ typedef struct { int x, y; BYTE type; - - /* How many extra entries before this one only on wine - * but not on native? */ - int wine_only_entries_preceding; - - /* 0 - This entry matches on wine. - * 1 - This entry corresponds to a single entry on wine that does not match the native entry. - * 2 - This entry is currently skipped on wine but present on native. */ - int todo; } path_test_t; /* Helper function to verify that the current path in the given DC matches the expected path. @@ -364,25 +398,21 @@ typedef struct * greater than 2, the trace() output is a C path_test_t array structure, useful for making * new tests that use this function. */ -static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, int expected_size, BOOL todo_size) +static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, int expected_size) { static const char *type_string[8] = { "Unknown (0)", "PT_CLOSEFIGURE", "PT_LINETO", "PT_LINETO | PT_CLOSEFIGURE", "PT_BEZIERTO", "PT_BEZIERTO | PT_CLOSEFIGURE", "PT_MOVETO", "PT_MOVETO | PT_CLOSEFIGURE"}; - POINT *pnt = NULL; - BYTE *types = NULL; - int size, numskip, - idx = 0, eidx = 0; + POINT *pnt; + BYTE *types; + int size, idx; /* Get the path */ assert(hdc != 0); size = GetPath(hdc, NULL, NULL, 0); ok(size > 0, "GetPath returned size %d, last error %d\n", size, GetLastError()); - if (size <= 0) - { - skip("Cannot perform path comparisons due to failure to retrieve path.\n"); - return; - } + if (size <= 0) return; + pnt = HeapAlloc(GetProcessHeap(), 0, size*sizeof(POINT)); assert(pnt != 0); types = HeapAlloc(GetProcessHeap(), 0, size*sizeof(BYTE)); @@ -390,70 +420,62 @@ static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, size = GetPath(hdc, pnt, types, size); assert(size > 0); - todo_wine_if (todo_size) - ok(size == expected_size, "Path size %d does not match expected size %d\n", size, expected_size); + ok( size == expected_size, "%s: Path size %d does not match expected size %d\n", + path_name, size, expected_size); - if (winetest_debug > 2) - trace("static const path_test_t %s[] = {\n", path_name); - - numskip = expected_size ? expected[eidx].wine_only_entries_preceding : 0; - while (idx < size && eidx < expected_size) + for (idx = 0; idx < min( size, expected_size ); idx++) { /* We allow a few pixels fudge in matching X and Y coordinates to account for imprecision in * floating point to integer conversion */ - BOOL match = (types[idx] == expected[eidx].type) && - (pnt[idx].x >= expected[eidx].x-2 && pnt[idx].x <= expected[eidx].x+2) && - (pnt[idx].y >= expected[eidx].y-2 && pnt[idx].y <= expected[eidx].y+2); + static const int fudge = 2; - todo_wine_if (expected[eidx].todo || numskip) - ok(match, "Expected #%d: %s (%d,%d) but got %s (%d,%d)\n", eidx, - type_string[expected[eidx].type], expected[eidx].x, expected[eidx].y, - type_string[types[idx]], pnt[idx].x, pnt[idx].y); + ok( types[idx] == expected[idx].type, "%s: Expected #%d: %s (%d,%d) but got %s (%d,%d)\n", + path_name, idx, type_string[expected[idx].type], expected[idx].x, expected[idx].y, + type_string[types[idx]], pnt[idx].x, pnt[idx].y); - if (match || expected[eidx].todo != 2) - { - if (winetest_debug > 2) - trace(" {%d, %d, %s, 0, 0}%s /* %d */\n", pnt[idx].x, pnt[idx].y, - type_string[types[idx]], idx < size-1 ? "," : "};", idx); - idx++; - } - if (match || !numskip--) - numskip = expected[++eidx].wine_only_entries_preceding; + if (types[idx] == expected[idx].type) + ok( (pnt[idx].x >= expected[idx].x - fudge && pnt[idx].x <= expected[idx].x + fudge) && + (pnt[idx].y >= expected[idx].y - fudge && pnt[idx].y <= expected[idx].y + fudge), + "%s: Expected #%d: %s position (%d,%d) but got (%d,%d)\n", path_name, idx, + type_string[expected[idx].type], expected[idx].x, expected[idx].y, pnt[idx].x, pnt[idx].y); } - /* If we are debugging and the actual path is longer than the expected path, make - * sure to display the entire path */ - if (winetest_debug > 2 && idx < size) - for (; idx < size; idx++) - trace(" {%d, %d, %s, 0, 0}%s /* %d */\n", pnt[idx].x, pnt[idx].y, - type_string[types[idx]], idx < size-1 ? "," : "};", idx); + if (winetest_debug > 2) + { + printf("static const path_test_t %s[] =\n{\n", path_name); + for (idx = 0; idx < size; idx++) + printf(" {%d, %d, %s}, /* %d */\n", pnt[idx].x, pnt[idx].y, type_string[types[idx]], idx); + printf("};\n" ); + } HeapFree(GetProcessHeap(), 0, types); HeapFree(GetProcessHeap(), 0, pnt); } -static const path_test_t arcto_path[] = { - {0, 0, PT_MOVETO, 0, 0}, /* 0 */ - {229, 215, PT_LINETO, 0, 0}, /* 1 */ - {248, 205, PT_BEZIERTO, 0, 0}, /* 2 */ - {273, 200, PT_BEZIERTO, 0, 0}, /* 3 */ - {300, 200, PT_BEZIERTO, 0, 0}, /* 4 */ - {355, 200, PT_BEZIERTO, 0, 0}, /* 5 */ - {399, 222, PT_BEZIERTO, 0, 0}, /* 6 */ - {399, 250, PT_BEZIERTO, 0, 0}, /* 7 */ - {399, 263, PT_BEZIERTO, 0, 0}, /* 8 */ - {389, 275, PT_BEZIERTO, 0, 0}, /* 9 */ - {370, 285, PT_BEZIERTO, 0, 0}, /* 10 */ - {363, 277, PT_LINETO, 0, 0}, /* 11 */ - {380, 270, PT_BEZIERTO, 0, 0}, /* 12 */ - {389, 260, PT_BEZIERTO, 0, 0}, /* 13 */ - {389, 250, PT_BEZIERTO, 0, 0}, /* 14 */ - {389, 228, PT_BEZIERTO, 0, 0}, /* 15 */ - {349, 210, PT_BEZIERTO, 0, 0}, /* 16 */ - {300, 210, PT_BEZIERTO, 0, 0}, /* 17 */ - {276, 210, PT_BEZIERTO, 0, 0}, /* 18 */ - {253, 214, PT_BEZIERTO, 0, 0}, /* 19 */ - {236, 222, PT_BEZIERTO | PT_CLOSEFIGURE, 0, 0}}; /* 20 */ +static const path_test_t arcto_path[] = +{ + {0, 0, PT_MOVETO}, /* 0 */ + {229, 215, PT_LINETO}, /* 1 */ + {248, 205, PT_BEZIERTO}, /* 2 */ + {273, 200, PT_BEZIERTO}, /* 3 */ + {300, 200, PT_BEZIERTO}, /* 4 */ + {355, 200, PT_BEZIERTO}, /* 5 */ + {399, 222, PT_BEZIERTO}, /* 6 */ + {399, 250, PT_BEZIERTO}, /* 7 */ + {399, 263, PT_BEZIERTO}, /* 8 */ + {389, 275, PT_BEZIERTO}, /* 9 */ + {370, 285, PT_BEZIERTO}, /* 10 */ + {363, 277, PT_LINETO}, /* 11 */ + {380, 270, PT_BEZIERTO}, /* 12 */ + {389, 260, PT_BEZIERTO}, /* 13 */ + {389, 250, PT_BEZIERTO}, /* 14 */ + {389, 228, PT_BEZIERTO}, /* 15 */ + {349, 210, PT_BEZIERTO}, /* 16 */ + {300, 210, PT_BEZIERTO}, /* 17 */ + {276, 210, PT_BEZIERTO}, /* 18 */ + {253, 214, PT_BEZIERTO}, /* 19 */ + {236, 222, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 20 */ +}; static void test_arcto(void) { @@ -473,33 +495,35 @@ static void test_arcto(void) CloseFigure(hdc); EndPath(hdc); - ok_path(hdc, "arcto_path", arcto_path, sizeof(arcto_path)/sizeof(path_test_t), 0); + ok_path(hdc, "arcto_path", arcto_path, sizeof(arcto_path)/sizeof(path_test_t)); done: ReleaseDC(0, hdc); } -static const path_test_t anglearc_path[] = { - {0, 0, PT_MOVETO, 0, 0}, /* 0 */ - {371, 229, PT_LINETO, 0, 0}, /* 1 */ - {352, 211, PT_BEZIERTO, 0, 0}, /* 2 */ - {327, 200, PT_BEZIERTO, 0, 0}, /* 3 */ - {300, 200, PT_BEZIERTO, 0, 0}, /* 4 */ - {245, 200, PT_BEZIERTO, 0, 0}, /* 5 */ - {200, 245, PT_BEZIERTO, 0, 0}, /* 6 */ - {200, 300, PT_BEZIERTO, 0, 0}, /* 7 */ - {200, 300, PT_BEZIERTO, 0, 0}, /* 8 */ - {200, 300, PT_BEZIERTO, 0, 0}, /* 9 */ - {200, 300, PT_BEZIERTO, 0, 0}, /* 10 */ - {231, 260, PT_LINETO, 0, 0}, /* 11 */ - {245, 235, PT_BEZIERTO, 0, 0}, /* 12 */ - {271, 220, PT_BEZIERTO, 0, 0}, /* 13 */ - {300, 220, PT_BEZIERTO, 0, 0}, /* 14 */ - {344, 220, PT_BEZIERTO, 0, 0}, /* 15 */ - {380, 256, PT_BEZIERTO, 0, 0}, /* 16 */ - {380, 300, PT_BEZIERTO, 0, 0}, /* 17 */ - {380, 314, PT_BEZIERTO, 0, 0}, /* 18 */ - {376, 328, PT_BEZIERTO, 0, 0}, /* 19 */ - {369, 340, PT_BEZIERTO | PT_CLOSEFIGURE, 0, 0}}; /* 20 */ +static const path_test_t anglearc_path[] = +{ + {0, 0, PT_MOVETO}, /* 0 */ + {371, 229, PT_LINETO}, /* 1 */ + {352, 211, PT_BEZIERTO}, /* 2 */ + {327, 200, PT_BEZIERTO}, /* 3 */ + {300, 200, PT_BEZIERTO}, /* 4 */ + {245, 200, PT_BEZIERTO}, /* 5 */ + {200, 245, PT_BEZIERTO}, /* 6 */ + {200, 300, PT_BEZIERTO}, /* 7 */ + {200, 300, PT_BEZIERTO}, /* 8 */ + {200, 300, PT_BEZIERTO}, /* 9 */ + {200, 300, PT_BEZIERTO}, /* 10 */ + {231, 260, PT_LINETO}, /* 11 */ + {245, 235, PT_BEZIERTO}, /* 12 */ + {271, 220, PT_BEZIERTO}, /* 13 */ + {300, 220, PT_BEZIERTO}, /* 14 */ + {344, 220, PT_BEZIERTO}, /* 15 */ + {380, 256, PT_BEZIERTO}, /* 16 */ + {380, 300, PT_BEZIERTO}, /* 17 */ + {380, 314, PT_BEZIERTO}, /* 18 */ + {376, 328, PT_BEZIERTO}, /* 19 */ + {369, 340, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 20 */ +}; static void test_anglearc(void) { @@ -516,40 +540,45 @@ static void test_anglearc(void) CloseFigure(hdc); EndPath(hdc); - ok_path(hdc, "anglearc_path", anglearc_path, sizeof(anglearc_path)/sizeof(path_test_t), 0); + ok_path(hdc, "anglearc_path", anglearc_path, sizeof(anglearc_path)/sizeof(path_test_t)); done: ReleaseDC(0, hdc); } -static const path_test_t polydraw_path[] = { - {0, 0, PT_MOVETO, 0, 0}, /*0*/ - {10, 10, PT_LINETO, 0, 0}, /*1*/ - {10, 15, PT_LINETO | PT_CLOSEFIGURE, 0, 0}, /*2*/ - {100, 100, PT_MOVETO, 0, 0}, /*3*/ - {95, 95, PT_LINETO, 0, 0}, /*4*/ - {10, 10, PT_LINETO, 0, 0}, /*5*/ - {10, 15, PT_LINETO | PT_CLOSEFIGURE, 0, 0}, /*6*/ - {100, 100, PT_MOVETO, 0, 0}, /*7*/ - {15, 15, PT_LINETO, 0, 0}, /*8*/ - {25, 25, PT_MOVETO, 0, 0}, /*9*/ - {25, 30, PT_LINETO, 0, 0}, /*10*/ - {100, 100, PT_MOVETO, 0, 0}, /*11*/ - {30, 30, PT_BEZIERTO, 0, 0}, /*12*/ - {30, 35, PT_BEZIERTO, 0, 0}, /*13*/ - {35, 35, PT_BEZIERTO, 0, 0}, /*14*/ - {35, 40, PT_LINETO, 0, 0}, /*15*/ - {40, 40, PT_MOVETO, 0, 0}, /*16*/ - {40, 45, PT_LINETO, 0, 0}, /*17*/ - {35, 40, PT_MOVETO, 0, 0}, /*18*/ - {45, 50, PT_LINETO, 0, 0}, /*19*/ - {35, 40, PT_MOVETO, 0, 0}, /*20*/ - {50, 55, PT_LINETO, 0, 0}, /*21*/ - {45, 50, PT_LINETO, 0, 0}, /*22*/ - {35, 40, PT_MOVETO, 0, 0}, /*23*/ - {60, 60, PT_LINETO, 0, 0}, /*24*/ - {60, 65, PT_MOVETO, 0, 0}, /*25*/ - {65, 65, PT_LINETO, 0, 0} /*26*/ - }; +static const path_test_t polydraw_path[] = +{ + {-20, -20, PT_MOVETO}, /* 0 */ + {10, 10, PT_LINETO}, /* 1 */ + {10, 15, PT_LINETO | PT_CLOSEFIGURE}, /* 2 */ + {-20, -20, PT_MOVETO}, /* 3 */ + {-10, -10, PT_LINETO}, /* 4 */ + {100, 100, PT_MOVETO}, /* 5 */ + {95, 95, PT_LINETO}, /* 6 */ + {10, 10, PT_LINETO}, /* 7 */ + {10, 15, PT_LINETO | PT_CLOSEFIGURE}, /* 8 */ + {100, 100, PT_MOVETO}, /* 9 */ + {15, 15, PT_LINETO}, /* 10 */ + {25, 25, PT_MOVETO}, /* 11 */ + {25, 30, PT_LINETO}, /* 12 */ + {100, 100, PT_MOVETO}, /* 13 */ + {30, 30, PT_BEZIERTO}, /* 14 */ + {30, 35, PT_BEZIERTO}, /* 15 */ + {35, 35, PT_BEZIERTO}, /* 16 */ + {35, 40, PT_LINETO}, /* 17 */ + {40, 40, PT_MOVETO}, /* 18 */ + {40, 45, PT_LINETO}, /* 19 */ + {35, 40, PT_MOVETO}, /* 20 */ + {45, 50, PT_LINETO}, /* 21 */ + {35, 40, PT_MOVETO}, /* 22 */ + {50, 55, PT_LINETO}, /* 23 */ + {45, 50, PT_LINETO}, /* 24 */ + {35, 40, PT_MOVETO}, /* 25 */ + {60, 60, PT_LINETO}, /* 26 */ + {60, 65, PT_MOVETO}, /* 27 */ + {65, 65, PT_LINETO}, /* 28 */ + {75, 75, PT_MOVETO}, /* 29 */ + {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 30 */ +}; static POINT polydraw_pts[] = { {10, 10}, {10, 15}, @@ -559,7 +588,8 @@ static POINT polydraw_pts[] = { {40, 40}, {40, 45}, {45, 45}, {45, 50}, {50, 50}, {50, 55}, {45, 50}, {55, 60}, - {60, 60}, {60, 65}, {65, 65}}; + {60, 60}, {60, 65}, {65, 65}, + {70, 70}, {75, 70}, {75, 75}, {80, 80}}; static BYTE polydraw_tps[] = {PT_LINETO, PT_CLOSEFIGURE | PT_LINETO, /* 2 */ @@ -569,13 +599,20 @@ static BYTE polydraw_tps[] = PT_MOVETO, PT_LINETO, PT_CLOSEFIGURE, /* 15 */ PT_LINETO, PT_MOVETO | PT_CLOSEFIGURE, /* 17 */ PT_LINETO, PT_LINETO, PT_MOVETO | PT_CLOSEFIGURE, /* 20 */ - PT_LINETO, PT_MOVETO | PT_LINETO, PT_LINETO}; /* 23 */ + PT_LINETO, PT_MOVETO | PT_LINETO, PT_LINETO, /* 23 */ + PT_MOVETO, PT_MOVETO, PT_MOVETO, PT_LINETO | PT_CLOSEFIGURE}; /* 27 */ static void test_polydraw(void) { BOOL retb; + POINT pos; HDC hdc = GetDC(0); + + MoveToEx( hdc, -20, -20, NULL ); + BeginPath(hdc); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == -20 && pos.y == -20, "wrong pos %d,%d\n", pos.x, pos.y ); /* closefigure with no previous moveto */ if (!(retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2)) && @@ -586,50 +623,99 @@ static void test_polydraw(void) goto done; } expect(TRUE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y ); + LineTo(hdc, -10, -10); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == -10 && pos.y == -10, "wrong pos %d,%d\n", pos.x, pos.y ); MoveToEx(hdc, 100, 100, NULL); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y ); LineTo(hdc, 95, 95); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 95 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y ); /* closefigure with previous moveto */ retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2); expect(TRUE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y ); /* bad bezier points */ retb = PolyDraw(hdc, &(polydraw_pts[2]), &(polydraw_tps[2]), 4); expect(FALSE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y ); retb = PolyDraw(hdc, &(polydraw_pts[6]), &(polydraw_tps[6]), 4); expect(FALSE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y ); /* good bezier points */ retb = PolyDraw(hdc, &(polydraw_pts[8]), &(polydraw_tps[8]), 4); expect(TRUE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y ); /* does lineto or bezierto take precedence? */ retb = PolyDraw(hdc, &(polydraw_pts[12]), &(polydraw_tps[12]), 4); expect(FALSE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y ); /* bad point type, has already moved cursor position */ retb = PolyDraw(hdc, &(polydraw_pts[15]), &(polydraw_tps[15]), 4); expect(FALSE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y ); /* bad point type, cursor position is moved, but back to its original spot */ retb = PolyDraw(hdc, &(polydraw_pts[17]), &(polydraw_tps[17]), 4); expect(FALSE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y ); /* does lineto or moveto take precedence? */ retb = PolyDraw(hdc, &(polydraw_pts[20]), &(polydraw_tps[20]), 3); expect(TRUE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 65 && pos.y == 65, "wrong pos %d,%d\n", pos.x, pos.y ); + /* consecutive movetos */ + retb = PolyDraw(hdc, &(polydraw_pts[23]), &(polydraw_tps[23]), 4); + expect(TRUE, retb); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y ); EndPath(hdc); - ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t), 0); + ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t)); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y ); done: ReleaseDC(0, hdc); } static void test_closefigure(void) { int nSize, nSizeWitness; + POINT pos; HDC hdc = GetDC(0); + MoveToEx( hdc, 100, 100, NULL ); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y ); + BeginPath(hdc); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y ); MoveToEx(hdc, 95, 95, NULL); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 95 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y ); LineTo(hdc, 95, 0); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 95 && pos.y == 0, "wrong pos %d,%d\n", pos.x, pos.y ); LineTo(hdc, 0, 95); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y ); CloseFigure(hdc); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y ); EndPath(hdc); + GetCurrentPositionEx( hdc, &pos ); + ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y ); nSize = GetPath(hdc, NULL, NULL, 0); AbortPath(hdc); @@ -729,6 +815,1085 @@ static void test_linedda(void) ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n"); } +static const path_test_t rectangle_path[] = +{ + {39, 20, PT_MOVETO}, /* 0 */ + {20, 20, PT_LINETO}, /* 1 */ + {20, 39, PT_LINETO}, /* 2 */ + {39, 39, PT_LINETO | PT_CLOSEFIGURE}, /* 3 */ + {54, 35, PT_MOVETO}, /* 4 */ + {30, 35, PT_LINETO}, /* 5 */ + {30, 49, PT_LINETO}, /* 6 */ + {54, 49, PT_LINETO | PT_CLOSEFIGURE}, /* 7 */ + {59, 45, PT_MOVETO}, /* 8 */ + {35, 45, PT_LINETO}, /* 9 */ + {35, 59, PT_LINETO}, /* 10 */ + {59, 59, PT_LINETO | PT_CLOSEFIGURE}, /* 11 */ + {80, 80, PT_MOVETO}, /* 12 */ + {80, 80, PT_LINETO}, /* 13 */ + {80, 80, PT_LINETO}, /* 14 */ + {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 15 */ + {39, 39, PT_MOVETO}, /* 16 */ + {20, 39, PT_LINETO}, /* 17 */ + {20, 20, PT_LINETO}, /* 18 */ + {39, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 19 */ + {54, 49, PT_MOVETO}, /* 20 */ + {30, 49, PT_LINETO}, /* 21 */ + {30, 35, PT_LINETO}, /* 22 */ + {54, 35, PT_LINETO | PT_CLOSEFIGURE}, /* 23 */ + {59, 59, PT_MOVETO}, /* 24 */ + {35, 59, PT_LINETO}, /* 25 */ + {35, 45, PT_LINETO}, /* 26 */ + {59, 45, PT_LINETO | PT_CLOSEFIGURE}, /* 27 */ + {80, 80, PT_MOVETO}, /* 28 */ + {80, 80, PT_LINETO}, /* 29 */ + {80, 80, PT_LINETO}, /* 30 */ + {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 31 */ + {-41, 40, PT_MOVETO}, /* 32 */ + {-80, 40, PT_LINETO}, /* 33 */ + {-80, 79, PT_LINETO}, /* 34 */ + {-41, 79, PT_LINETO | PT_CLOSEFIGURE}, /* 35 */ + {-61, 70, PT_MOVETO}, /* 36 */ + {-110, 70, PT_LINETO}, /* 37 */ + {-110, 99, PT_LINETO}, /* 38 */ + {-61, 99, PT_LINETO | PT_CLOSEFIGURE}, /* 39 */ + {119, -120, PT_MOVETO}, /* 40 */ + {60, -120, PT_LINETO}, /* 41 */ + {60, -61, PT_LINETO}, /* 42 */ + {119, -61, PT_LINETO | PT_CLOSEFIGURE}, /* 43 */ + {164, -150, PT_MOVETO}, /* 44 */ + {90, -150, PT_LINETO}, /* 45 */ + {90, -106, PT_LINETO}, /* 46 */ + {164, -106, PT_LINETO | PT_CLOSEFIGURE}, /* 47 */ + {-4, -6, PT_MOVETO}, /* 48 */ + {-6, -6, PT_LINETO}, /* 49 */ + {-6, -4, PT_LINETO}, /* 50 */ + {-4, -4, PT_LINETO | PT_CLOSEFIGURE}, /* 51 */ + {40, 20, PT_MOVETO}, /* 52 */ + {20, 20, PT_LINETO}, /* 53 */ + {20, 40, PT_LINETO}, /* 54 */ + {40, 40, PT_LINETO | PT_CLOSEFIGURE}, /* 55 */ + {55, 35, PT_MOVETO}, /* 56 */ + {30, 35, PT_LINETO}, /* 57 */ + {30, 50, PT_LINETO}, /* 58 */ + {55, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 59 */ + {60, 45, PT_MOVETO}, /* 60 */ + {35, 45, PT_LINETO}, /* 61 */ + {35, 60, PT_LINETO}, /* 62 */ + {60, 60, PT_LINETO | PT_CLOSEFIGURE}, /* 63 */ + {70, 70, PT_MOVETO}, /* 64 */ + {50, 70, PT_LINETO}, /* 65 */ + {50, 70, PT_LINETO}, /* 66 */ + {70, 70, PT_LINETO | PT_CLOSEFIGURE}, /* 67 */ + {75, 75, PT_MOVETO}, /* 68 */ + {75, 75, PT_LINETO}, /* 69 */ + {75, 85, PT_LINETO}, /* 70 */ + {75, 85, PT_LINETO | PT_CLOSEFIGURE}, /* 71 */ + {81, 80, PT_MOVETO}, /* 72 */ + {80, 80, PT_LINETO}, /* 73 */ + {80, 81, PT_LINETO}, /* 74 */ + {81, 81, PT_LINETO | PT_CLOSEFIGURE}, /* 75 */ + {40, 40, PT_MOVETO}, /* 76 */ + {20, 40, PT_LINETO}, /* 77 */ + {20, 20, PT_LINETO}, /* 78 */ + {40, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 79 */ + {55, 50, PT_MOVETO}, /* 80 */ + {30, 50, PT_LINETO}, /* 81 */ + {30, 35, PT_LINETO}, /* 82 */ + {55, 35, PT_LINETO | PT_CLOSEFIGURE}, /* 83 */ + {60, 60, PT_MOVETO}, /* 84 */ + {35, 60, PT_LINETO}, /* 85 */ + {35, 45, PT_LINETO}, /* 86 */ + {60, 45, PT_LINETO | PT_CLOSEFIGURE}, /* 87 */ + {70, 70, PT_MOVETO}, /* 88 */ + {50, 70, PT_LINETO}, /* 89 */ + {50, 70, PT_LINETO}, /* 90 */ + {70, 70, PT_LINETO | PT_CLOSEFIGURE}, /* 91 */ + {75, 85, PT_MOVETO}, /* 92 */ + {75, 85, PT_LINETO}, /* 93 */ + {75, 75, PT_LINETO}, /* 94 */ + {75, 75, PT_LINETO | PT_CLOSEFIGURE}, /* 95 */ + {81, 81, PT_MOVETO}, /* 96 */ + {80, 81, PT_LINETO}, /* 97 */ + {80, 80, PT_LINETO}, /* 98 */ + {81, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 99 */ +}; + +static void test_rectangle(void) +{ + HDC hdc = GetDC( 0 ); + + BeginPath( hdc ); + Rectangle( hdc, 20, 20, 40, 40 ); + Rectangle( hdc, 30, 50, 55, 35 ); + Rectangle( hdc, 60, 60, 35, 45 ); + Rectangle( hdc, 70, 70, 50, 70 ); + Rectangle( hdc, 75, 75, 75, 85 ); + Rectangle( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_CLOCKWISE ); + Rectangle( hdc, 20, 20, 40, 40 ); + Rectangle( hdc, 30, 50, 55, 35 ); + Rectangle( hdc, 60, 60, 35, 45 ); + Rectangle( hdc, 70, 70, 50, 70 ); + Rectangle( hdc, 75, 75, 75, 85 ); + Rectangle( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_COUNTERCLOCKWISE ); + SetMapMode( hdc, MM_ANISOTROPIC ); + SetViewportExtEx( hdc, -2, 2, NULL ); + Rectangle( hdc, 20, 20, 40, 40 ); + Rectangle( hdc, 30, 50, 55, 35 ); + SetViewportExtEx( hdc, 3, -3, NULL ); + Rectangle( hdc, 20, 20, 40, 40 ); + Rectangle( hdc, 30, 50, 55, 35 ); + SetWindowExtEx( hdc, -20, 20, NULL ); + Rectangle( hdc, 20, 20, 40, 40 ); + Rectangle( hdc, 24, 22, 21, 20 ); + SetMapMode( hdc, MM_TEXT ); + SetGraphicsMode( hdc, GM_ADVANCED ); + Rectangle( hdc, 20, 20, 40, 40 ); + Rectangle( hdc, 30, 50, 55, 35 ); + Rectangle( hdc, 60, 60, 35, 45 ); + Rectangle( hdc, 70, 70, 50, 70 ); + Rectangle( hdc, 75, 75, 75, 85 ); + Rectangle( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_CLOCKWISE ); + Rectangle( hdc, 20, 20, 40, 40 ); + Rectangle( hdc, 30, 50, 55, 35 ); + Rectangle( hdc, 60, 60, 35, 45 ); + Rectangle( hdc, 70, 70, 50, 70 ); + Rectangle( hdc, 75, 75, 75, 85 ); + Rectangle( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_COUNTERCLOCKWISE ); + EndPath( hdc ); + SetMapMode( hdc, MM_TEXT ); + ok_path( hdc, "rectangle_path", rectangle_path, sizeof(rectangle_path)/sizeof(path_test_t) ); + ReleaseDC( 0, hdc ); +} + +static const path_test_t roundrect_path[] = +{ + {39, 25, PT_MOVETO}, /* 0 */ + {39, 22, PT_BEZIERTO}, /* 1 */ + {37, 20, PT_BEZIERTO}, /* 2 */ + {34, 20, PT_BEZIERTO}, /* 3 */ + {25, 20, PT_LINETO}, /* 4 */ + {22, 20, PT_BEZIERTO}, /* 5 */ + {20, 22, PT_BEZIERTO}, /* 6 */ + {20, 25, PT_BEZIERTO}, /* 7 */ + {20, 34, PT_LINETO}, /* 8 */ + {20, 37, PT_BEZIERTO}, /* 9 */ + {22, 39, PT_BEZIERTO}, /* 10 */ + {25, 39, PT_BEZIERTO}, /* 11 */ + {34, 39, PT_LINETO}, /* 12 */ + {37, 39, PT_BEZIERTO}, /* 13 */ + {39, 37, PT_BEZIERTO}, /* 14 */ + {39, 34, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 15 */ + {54, 42, PT_MOVETO}, /* 16 */ + {54, 38, PT_BEZIERTO}, /* 17 */ + {49, 35, PT_BEZIERTO}, /* 18 */ + {42, 35, PT_BEZIERTO}, /* 19 */ + {42, 35, PT_LINETO}, /* 20 */ + {35, 35, PT_BEZIERTO}, /* 21 */ + {30, 38, PT_BEZIERTO}, /* 22 */ + {30, 42, PT_BEZIERTO}, /* 23 */ + {30, 42, PT_LINETO}, /* 24 */ + {30, 46, PT_BEZIERTO}, /* 25 */ + {35, 49, PT_BEZIERTO}, /* 26 */ + {42, 49, PT_BEZIERTO}, /* 27 */ + {42, 49, PT_LINETO}, /* 28 */ + {49, 49, PT_BEZIERTO}, /* 29 */ + {54, 46, PT_BEZIERTO}, /* 30 */ + {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 31 */ + {59, 46, PT_MOVETO}, /* 32 */ + {59, 45, PT_BEZIERTO}, /* 33 */ + {58, 45, PT_BEZIERTO}, /* 34 */ + {57, 45, PT_BEZIERTO}, /* 35 */ + {37, 45, PT_LINETO}, /* 36 */ + {36, 45, PT_BEZIERTO}, /* 37 */ + {35, 45, PT_BEZIERTO}, /* 38 */ + {35, 46, PT_BEZIERTO}, /* 39 */ + {35, 58, PT_LINETO}, /* 40 */ + {35, 59, PT_BEZIERTO}, /* 41 */ + {36, 59, PT_BEZIERTO}, /* 42 */ + {37, 59, PT_BEZIERTO}, /* 43 */ + {57, 59, PT_LINETO}, /* 44 */ + {58, 59, PT_BEZIERTO}, /* 45 */ + {59, 59, PT_BEZIERTO}, /* 46 */ + {59, 58, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 47 */ + {80, 80, PT_MOVETO}, /* 48 */ + {80, 80, PT_BEZIERTO}, /* 49 */ + {80, 80, PT_BEZIERTO}, /* 50 */ + {80, 80, PT_BEZIERTO}, /* 51 */ + {80, 80, PT_LINETO}, /* 52 */ + {80, 80, PT_BEZIERTO}, /* 53 */ + {80, 80, PT_BEZIERTO}, /* 54 */ + {80, 80, PT_BEZIERTO}, /* 55 */ + {80, 80, PT_LINETO}, /* 56 */ + {80, 80, PT_BEZIERTO}, /* 57 */ + {80, 80, PT_BEZIERTO}, /* 58 */ + {80, 80, PT_BEZIERTO}, /* 59 */ + {80, 80, PT_LINETO}, /* 60 */ + {80, 80, PT_BEZIERTO}, /* 61 */ + {80, 80, PT_BEZIERTO}, /* 62 */ + {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 63 */ + {94, 85, PT_MOVETO}, /* 64 */ + {90, 85, PT_LINETO}, /* 65 */ + {90, 89, PT_LINETO}, /* 66 */ + {94, 89, PT_LINETO | PT_CLOSEFIGURE}, /* 67 */ + {39, 34, PT_MOVETO}, /* 68 */ + {39, 37, PT_BEZIERTO}, /* 69 */ + {37, 39, PT_BEZIERTO}, /* 70 */ + {34, 39, PT_BEZIERTO}, /* 71 */ + {25, 39, PT_LINETO}, /* 72 */ + {22, 39, PT_BEZIERTO}, /* 73 */ + {20, 37, PT_BEZIERTO}, /* 74 */ + {20, 34, PT_BEZIERTO}, /* 75 */ + {20, 25, PT_LINETO}, /* 76 */ + {20, 22, PT_BEZIERTO}, /* 77 */ + {22, 20, PT_BEZIERTO}, /* 78 */ + {25, 20, PT_BEZIERTO}, /* 79 */ + {34, 20, PT_LINETO}, /* 80 */ + {37, 20, PT_BEZIERTO}, /* 81 */ + {39, 22, PT_BEZIERTO}, /* 82 */ + {39, 25, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 83 */ + {54, 42, PT_MOVETO}, /* 84 */ + {54, 46, PT_BEZIERTO}, /* 85 */ + {49, 49, PT_BEZIERTO}, /* 86 */ + {42, 49, PT_BEZIERTO}, /* 87 */ + {42, 49, PT_LINETO}, /* 88 */ + {35, 49, PT_BEZIERTO}, /* 89 */ + {30, 46, PT_BEZIERTO}, /* 90 */ + {30, 42, PT_BEZIERTO}, /* 91 */ + {30, 42, PT_LINETO}, /* 92 */ + {30, 38, PT_BEZIERTO}, /* 93 */ + {35, 35, PT_BEZIERTO}, /* 94 */ + {42, 35, PT_BEZIERTO}, /* 95 */ + {42, 35, PT_LINETO}, /* 96 */ + {49, 35, PT_BEZIERTO}, /* 97 */ + {54, 38, PT_BEZIERTO}, /* 98 */ + {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 99 */ + {-41, 52, PT_MOVETO}, /* 100 */ + {-41, 45, PT_BEZIERTO}, /* 101 */ + {-47, 40, PT_BEZIERTO}, /* 102 */ + {-56, 40, PT_BEZIERTO}, /* 103 */ + {-65, 40, PT_LINETO}, /* 104 */ + {-73, 40, PT_BEZIERTO}, /* 105 */ + {-80, 45, PT_BEZIERTO}, /* 106 */ + {-80, 52, PT_BEZIERTO}, /* 107 */ + {-80, 67, PT_LINETO}, /* 108 */ + {-80, 74, PT_BEZIERTO}, /* 109 */ + {-73, 79, PT_BEZIERTO}, /* 110 */ + {-65, 79, PT_BEZIERTO}, /* 111 */ + {-56, 79, PT_LINETO}, /* 112 */ + {-47, 79, PT_BEZIERTO}, /* 113 */ + {-41, 74, PT_BEZIERTO}, /* 114 */ + {-41, 67, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 115 */ + {-61, 79, PT_MOVETO}, /* 116 */ + {-61, 74, PT_BEZIERTO}, /* 117 */ + {-64, 70, PT_BEZIERTO}, /* 118 */ + {-68, 70, PT_BEZIERTO}, /* 119 */ + {-103, 70, PT_LINETO}, /* 120 */ + {-107, 70, PT_BEZIERTO}, /* 121 */ + {-110, 74, PT_BEZIERTO}, /* 122 */ + {-110, 79, PT_BEZIERTO}, /* 123 */ + {-110, 90, PT_LINETO}, /* 124 */ + {-110, 95, PT_BEZIERTO}, /* 125 */ + {-107, 99, PT_BEZIERTO}, /* 126 */ + {-103, 99, PT_BEZIERTO}, /* 127 */ + {-68, 99, PT_LINETO}, /* 128 */ + {-64, 99, PT_BEZIERTO}, /* 129 */ + {-61, 95, PT_BEZIERTO}, /* 130 */ + {-61, 90, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 131 */ + {119, -102, PT_MOVETO}, /* 132 */ + {119, -112, PT_BEZIERTO}, /* 133 */ + {109, -120, PT_BEZIERTO}, /* 134 */ + {97, -120, PT_BEZIERTO}, /* 135 */ + {82, -120, PT_LINETO}, /* 136 */ + {70, -120, PT_BEZIERTO}, /* 137 */ + {60, -112, PT_BEZIERTO}, /* 138 */ + {60, -102, PT_BEZIERTO}, /* 139 */ + {60, -79, PT_LINETO}, /* 140 */ + {60, -69, PT_BEZIERTO}, /* 141 */ + {70, -61, PT_BEZIERTO}, /* 142 */ + {82, -61, PT_BEZIERTO}, /* 143 */ + {97, -61, PT_LINETO}, /* 144 */ + {109, -61, PT_BEZIERTO}, /* 145 */ + {119, -69, PT_BEZIERTO}, /* 146 */ + {119, -79, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 147 */ + {164, -144, PT_MOVETO}, /* 148 */ + {164, -147, PT_BEZIERTO}, /* 149 */ + {162, -150, PT_BEZIERTO}, /* 150 */ + {160, -150, PT_BEZIERTO}, /* 151 */ + {94, -150, PT_LINETO}, /* 152 */ + {92, -150, PT_BEZIERTO}, /* 153 */ + {90, -147, PT_BEZIERTO}, /* 154 */ + {90, -144, PT_BEZIERTO}, /* 155 */ + {90, -112, PT_LINETO}, /* 156 */ + {90, -109, PT_BEZIERTO}, /* 157 */ + {92, -106, PT_BEZIERTO}, /* 158 */ + {94, -106, PT_BEZIERTO}, /* 159 */ + {160, -106, PT_LINETO}, /* 160 */ + {162, -106, PT_BEZIERTO}, /* 161 */ + {164, -109, PT_BEZIERTO}, /* 162 */ + {164, -112, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 163 */ + {-4, -6, PT_MOVETO}, /* 164 */ + {-4, -6, PT_BEZIERTO}, /* 165 */ + {-4, -6, PT_BEZIERTO}, /* 166 */ + {-4, -6, PT_BEZIERTO}, /* 167 */ + {-6, -6, PT_LINETO}, /* 168 */ + {-6, -6, PT_BEZIERTO}, /* 169 */ + {-6, -6, PT_BEZIERTO}, /* 170 */ + {-6, -6, PT_BEZIERTO}, /* 171 */ + {-6, -4, PT_LINETO}, /* 172 */ + {-6, -4, PT_BEZIERTO}, /* 173 */ + {-6, -4, PT_BEZIERTO}, /* 174 */ + {-6, -4, PT_BEZIERTO}, /* 175 */ + {-4, -4, PT_LINETO}, /* 176 */ + {-4, -4, PT_BEZIERTO}, /* 177 */ + {-4, -4, PT_BEZIERTO}, /* 178 */ + {-4, -4, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 179 */ + {40, 25, PT_MOVETO}, /* 180 */ + {40, 22, PT_BEZIERTO}, /* 181 */ + {38, 20, PT_BEZIERTO}, /* 182 */ + {35, 20, PT_BEZIERTO}, /* 183 */ + {25, 20, PT_LINETO}, /* 184 */ + {22, 20, PT_BEZIERTO}, /* 185 */ + {20, 22, PT_BEZIERTO}, /* 186 */ + {20, 25, PT_BEZIERTO}, /* 187 */ + {20, 35, PT_LINETO}, /* 188 */ + {20, 38, PT_BEZIERTO}, /* 189 */ + {22, 40, PT_BEZIERTO}, /* 190 */ + {25, 40, PT_BEZIERTO}, /* 191 */ + {35, 40, PT_LINETO}, /* 192 */ + {38, 40, PT_BEZIERTO}, /* 193 */ + {40, 38, PT_BEZIERTO}, /* 194 */ + {40, 35, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 195 */ + {55, 43, PT_MOVETO}, /* 196 */ + {55, 38, PT_BEZIERTO}, /* 197 */ + {49, 35, PT_BEZIERTO}, /* 198 */ + {43, 35, PT_BEZIERTO}, /* 199 */ + {43, 35, PT_LINETO}, /* 200 */ + {36, 35, PT_BEZIERTO}, /* 201 */ + {30, 38, PT_BEZIERTO}, /* 202 */ + {30, 43, PT_BEZIERTO}, /* 203 */ + {30, 43, PT_LINETO}, /* 204 */ + {30, 47, PT_BEZIERTO}, /* 205 */ + {36, 50, PT_BEZIERTO}, /* 206 */ + {43, 50, PT_BEZIERTO}, /* 207 */ + {43, 50, PT_LINETO}, /* 208 */ + {49, 50, PT_BEZIERTO}, /* 209 */ + {55, 47, PT_BEZIERTO}, /* 210 */ + {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 211 */ + {60, 46, PT_MOVETO}, /* 212 */ + {60, 46, PT_BEZIERTO}, /* 213 */ + {59, 45, PT_BEZIERTO}, /* 214 */ + {58, 45, PT_BEZIERTO}, /* 215 */ + {38, 45, PT_LINETO}, /* 216 */ + {36, 45, PT_BEZIERTO}, /* 217 */ + {35, 46, PT_BEZIERTO}, /* 218 */ + {35, 46, PT_BEZIERTO}, /* 219 */ + {35, 59, PT_LINETO}, /* 220 */ + {35, 60, PT_BEZIERTO}, /* 221 */ + {36, 60, PT_BEZIERTO}, /* 222 */ + {38, 60, PT_BEZIERTO}, /* 223 */ + {58, 60, PT_LINETO}, /* 224 */ + {59, 60, PT_BEZIERTO}, /* 225 */ + {60, 60, PT_BEZIERTO}, /* 226 */ + {60, 59, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 227 */ + {70, 70, PT_MOVETO}, /* 228 */ + {70, 70, PT_BEZIERTO}, /* 229 */ + {70, 70, PT_BEZIERTO}, /* 230 */ + {70, 70, PT_BEZIERTO}, /* 231 */ + {50, 70, PT_LINETO}, /* 232 */ + {50, 70, PT_BEZIERTO}, /* 233 */ + {50, 70, PT_BEZIERTO}, /* 234 */ + {50, 70, PT_BEZIERTO}, /* 235 */ + {50, 70, PT_LINETO}, /* 236 */ + {50, 70, PT_BEZIERTO}, /* 237 */ + {50, 70, PT_BEZIERTO}, /* 238 */ + {50, 70, PT_BEZIERTO}, /* 239 */ + {70, 70, PT_LINETO}, /* 240 */ + {70, 70, PT_BEZIERTO}, /* 241 */ + {70, 70, PT_BEZIERTO}, /* 242 */ + {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 243 */ + {75, 75, PT_MOVETO}, /* 244 */ + {75, 75, PT_BEZIERTO}, /* 245 */ + {75, 75, PT_BEZIERTO}, /* 246 */ + {75, 75, PT_BEZIERTO}, /* 247 */ + {75, 75, PT_LINETO}, /* 248 */ + {75, 75, PT_BEZIERTO}, /* 249 */ + {75, 75, PT_BEZIERTO}, /* 250 */ + {75, 75, PT_BEZIERTO}, /* 251 */ + {75, 85, PT_LINETO}, /* 252 */ + {75, 85, PT_BEZIERTO}, /* 253 */ + {75, 85, PT_BEZIERTO}, /* 254 */ + {75, 85, PT_BEZIERTO}, /* 255 */ + {75, 85, PT_LINETO}, /* 256 */ + {75, 85, PT_BEZIERTO}, /* 257 */ + {75, 85, PT_BEZIERTO}, /* 258 */ + {75, 85, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 259 */ + {81, 81, PT_MOVETO}, /* 260 */ + {81, 80, PT_BEZIERTO}, /* 261 */ + {81, 80, PT_BEZIERTO}, /* 262 */ + {81, 80, PT_BEZIERTO}, /* 263 */ + {81, 80, PT_LINETO}, /* 264 */ + {80, 80, PT_BEZIERTO}, /* 265 */ + {80, 80, PT_BEZIERTO}, /* 266 */ + {80, 81, PT_BEZIERTO}, /* 267 */ + {80, 81, PT_LINETO}, /* 268 */ + {80, 81, PT_BEZIERTO}, /* 269 */ + {80, 81, PT_BEZIERTO}, /* 270 */ + {81, 81, PT_BEZIERTO}, /* 271 */ + {81, 81, PT_LINETO}, /* 272 */ + {81, 81, PT_BEZIERTO}, /* 273 */ + {81, 81, PT_BEZIERTO}, /* 274 */ + {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 275 */ + {95, 85, PT_MOVETO}, /* 276 */ + {90, 85, PT_LINETO}, /* 277 */ + {90, 90, PT_LINETO}, /* 278 */ + {95, 90, PT_LINETO | PT_CLOSEFIGURE}, /* 279 */ + {40, 35, PT_MOVETO}, /* 280 */ + {40, 38, PT_BEZIERTO}, /* 281 */ + {38, 40, PT_BEZIERTO}, /* 282 */ + {35, 40, PT_BEZIERTO}, /* 283 */ + {25, 40, PT_LINETO}, /* 284 */ + {22, 40, PT_BEZIERTO}, /* 285 */ + {20, 38, PT_BEZIERTO}, /* 286 */ + {20, 35, PT_BEZIERTO}, /* 287 */ + {20, 25, PT_LINETO}, /* 288 */ + {20, 22, PT_BEZIERTO}, /* 289 */ + {22, 20, PT_BEZIERTO}, /* 290 */ + {25, 20, PT_BEZIERTO}, /* 291 */ + {35, 20, PT_LINETO}, /* 292 */ + {38, 20, PT_BEZIERTO}, /* 293 */ + {40, 22, PT_BEZIERTO}, /* 294 */ + {40, 25, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 295 */ + {55, 43, PT_MOVETO}, /* 296 */ + {55, 47, PT_BEZIERTO}, /* 297 */ + {49, 50, PT_BEZIERTO}, /* 298 */ + {43, 50, PT_BEZIERTO}, /* 299 */ + {43, 50, PT_LINETO}, /* 300 */ + {36, 50, PT_BEZIERTO}, /* 301 */ + {30, 47, PT_BEZIERTO}, /* 302 */ + {30, 43, PT_BEZIERTO}, /* 303 */ + {30, 43, PT_LINETO}, /* 304 */ + {30, 38, PT_BEZIERTO}, /* 305 */ + {36, 35, PT_BEZIERTO}, /* 306 */ + {43, 35, PT_BEZIERTO}, /* 307 */ + {43, 35, PT_LINETO}, /* 308 */ + {49, 35, PT_BEZIERTO}, /* 309 */ + {55, 38, PT_BEZIERTO}, /* 310 */ + {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 311 */ +}; + +static void test_roundrect(void) +{ + HDC hdc = GetDC( 0 ); + + BeginPath( hdc ); + RoundRect( hdc, 20, 20, 40, 40, 10, 10 ); + RoundRect( hdc, 30, 50, 55, 35, -30, -30 ); + RoundRect( hdc, 60, 60, 35, 45, 5, 2 ); + RoundRect( hdc, 70, 70, 50, 70, 3, 5 ); + RoundRect( hdc, 75, 75, 75, 85, 6, 4 ); + RoundRect( hdc, 80, 80, 81, 81, 8, 9 ); + RoundRect( hdc, 90, 90, 95, 85, 0, 7 ); + SetArcDirection( hdc, AD_CLOCKWISE ); + RoundRect( hdc, 20, 20, 40, 40, 10, 10 ); + RoundRect( hdc, 30, 50, 55, 35, -30, -30 ); + SetArcDirection( hdc, AD_COUNTERCLOCKWISE ); + SetMapMode( hdc, MM_ANISOTROPIC ); + SetViewportExtEx( hdc, -2, 2, NULL ); + RoundRect( hdc, 20, 20, 40, 40, 15, 12 ); + RoundRect( hdc, 30, 50, 55, 35, 7, 9 ); + SetViewportExtEx( hdc, 3, -3, NULL ); + RoundRect( hdc, 20, 20, 40, 40, 15, 12 ); + RoundRect( hdc, 30, 50, 55, 35, 3, 4 ); + SetWindowExtEx( hdc, -20, 20, NULL ); + RoundRect( hdc, 20, 20, 40, 40, 2, 1 ); + RoundRect( hdc, 24, 22, 21, 20, 4, 4 ); + SetMapMode( hdc, MM_TEXT ); + SetGraphicsMode( hdc, GM_ADVANCED ); + RoundRect( hdc, 20, 20, 40, 40, 10, 10 ); + RoundRect( hdc, 30, 50, 55, 35, -30, -30 ); + RoundRect( hdc, 60, 60, 35, 45, 5, 2 ); + RoundRect( hdc, 70, 70, 50, 70, 3, 5 ); + RoundRect( hdc, 75, 75, 75, 85, 6, 4 ); + RoundRect( hdc, 80, 80, 81, 81, 8, 9 ); + RoundRect( hdc, 90, 90, 95, 85, 0, 7 ); + SetArcDirection( hdc, AD_CLOCKWISE ); + RoundRect( hdc, 20, 20, 40, 40, 10, 10 ); + RoundRect( hdc, 30, 50, 55, 35, -30, -30 ); + SetArcDirection( hdc, AD_COUNTERCLOCKWISE ); + EndPath( hdc ); + SetMapMode( hdc, MM_TEXT ); + ok_path( hdc, "roundrect_path", roundrect_path, sizeof(roundrect_path)/sizeof(path_test_t) ); + ReleaseDC( 0, hdc ); +} + +static const path_test_t ellipse_path[] = +{ + {39, 30, PT_MOVETO}, /* 0 */ + {39, 24, PT_BEZIERTO}, /* 1 */ + {35, 20, PT_BEZIERTO}, /* 2 */ + {30, 20, PT_BEZIERTO}, /* 3 */ + {24, 20, PT_BEZIERTO}, /* 4 */ + {20, 24, PT_BEZIERTO}, /* 5 */ + {20, 30, PT_BEZIERTO}, /* 6 */ + {20, 35, PT_BEZIERTO}, /* 7 */ + {24, 39, PT_BEZIERTO}, /* 8 */ + {30, 39, PT_BEZIERTO}, /* 9 */ + {35, 39, PT_BEZIERTO}, /* 10 */ + {39, 35, PT_BEZIERTO}, /* 11 */ + {39, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 12 */ + {54, 42, PT_MOVETO}, /* 13 */ + {54, 38, PT_BEZIERTO}, /* 14 */ + {49, 35, PT_BEZIERTO}, /* 15 */ + {42, 35, PT_BEZIERTO}, /* 16 */ + {35, 35, PT_BEZIERTO}, /* 17 */ + {30, 38, PT_BEZIERTO}, /* 18 */ + {30, 42, PT_BEZIERTO}, /* 19 */ + {30, 46, PT_BEZIERTO}, /* 20 */ + {35, 49, PT_BEZIERTO}, /* 21 */ + {42, 49, PT_BEZIERTO}, /* 22 */ + {49, 49, PT_BEZIERTO}, /* 23 */ + {54, 46, PT_BEZIERTO}, /* 24 */ + {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 25 */ + {59, 52, PT_MOVETO}, /* 26 */ + {59, 48, PT_BEZIERTO}, /* 27 */ + {54, 45, PT_BEZIERTO}, /* 28 */ + {47, 45, PT_BEZIERTO}, /* 29 */ + {40, 45, PT_BEZIERTO}, /* 30 */ + {35, 48, PT_BEZIERTO}, /* 31 */ + {35, 52, PT_BEZIERTO}, /* 32 */ + {35, 56, PT_BEZIERTO}, /* 33 */ + {40, 59, PT_BEZIERTO}, /* 34 */ + {47, 59, PT_BEZIERTO}, /* 35 */ + {54, 59, PT_BEZIERTO}, /* 36 */ + {59, 56, PT_BEZIERTO}, /* 37 */ + {59, 52, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 38 */ + {80, 80, PT_MOVETO}, /* 39 */ + {80, 80, PT_BEZIERTO}, /* 40 */ + {80, 80, PT_BEZIERTO}, /* 41 */ + {80, 80, PT_BEZIERTO}, /* 42 */ + {80, 80, PT_BEZIERTO}, /* 43 */ + {80, 80, PT_BEZIERTO}, /* 44 */ + {80, 80, PT_BEZIERTO}, /* 45 */ + {80, 80, PT_BEZIERTO}, /* 46 */ + {80, 80, PT_BEZIERTO}, /* 47 */ + {80, 80, PT_BEZIERTO}, /* 48 */ + {80, 80, PT_BEZIERTO}, /* 49 */ + {80, 80, PT_BEZIERTO}, /* 50 */ + {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 51 */ + {39, 30, PT_MOVETO}, /* 52 */ + {39, 35, PT_BEZIERTO}, /* 53 */ + {35, 39, PT_BEZIERTO}, /* 54 */ + {30, 39, PT_BEZIERTO}, /* 55 */ + {24, 39, PT_BEZIERTO}, /* 56 */ + {20, 35, PT_BEZIERTO}, /* 57 */ + {20, 30, PT_BEZIERTO}, /* 58 */ + {20, 24, PT_BEZIERTO}, /* 59 */ + {24, 20, PT_BEZIERTO}, /* 60 */ + {30, 20, PT_BEZIERTO}, /* 61 */ + {35, 20, PT_BEZIERTO}, /* 62 */ + {39, 24, PT_BEZIERTO}, /* 63 */ + {39, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 64 */ + {54, 42, PT_MOVETO}, /* 65 */ + {54, 46, PT_BEZIERTO}, /* 66 */ + {49, 49, PT_BEZIERTO}, /* 67 */ + {42, 49, PT_BEZIERTO}, /* 68 */ + {35, 49, PT_BEZIERTO}, /* 69 */ + {30, 46, PT_BEZIERTO}, /* 70 */ + {30, 42, PT_BEZIERTO}, /* 71 */ + {30, 38, PT_BEZIERTO}, /* 72 */ + {35, 35, PT_BEZIERTO}, /* 73 */ + {42, 35, PT_BEZIERTO}, /* 74 */ + {49, 35, PT_BEZIERTO}, /* 75 */ + {54, 38, PT_BEZIERTO}, /* 76 */ + {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 77 */ + {59, 52, PT_MOVETO}, /* 78 */ + {59, 56, PT_BEZIERTO}, /* 79 */ + {54, 59, PT_BEZIERTO}, /* 80 */ + {47, 59, PT_BEZIERTO}, /* 81 */ + {40, 59, PT_BEZIERTO}, /* 82 */ + {35, 56, PT_BEZIERTO}, /* 83 */ + {35, 52, PT_BEZIERTO}, /* 84 */ + {35, 48, PT_BEZIERTO}, /* 85 */ + {40, 45, PT_BEZIERTO}, /* 86 */ + {47, 45, PT_BEZIERTO}, /* 87 */ + {54, 45, PT_BEZIERTO}, /* 88 */ + {59, 48, PT_BEZIERTO}, /* 89 */ + {59, 52, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 90 */ + {80, 80, PT_MOVETO}, /* 91 */ + {80, 80, PT_BEZIERTO}, /* 92 */ + {80, 80, PT_BEZIERTO}, /* 93 */ + {80, 80, PT_BEZIERTO}, /* 94 */ + {80, 80, PT_BEZIERTO}, /* 95 */ + {80, 80, PT_BEZIERTO}, /* 96 */ + {80, 80, PT_BEZIERTO}, /* 97 */ + {80, 80, PT_BEZIERTO}, /* 98 */ + {80, 80, PT_BEZIERTO}, /* 99 */ + {80, 80, PT_BEZIERTO}, /* 100 */ + {80, 80, PT_BEZIERTO}, /* 101 */ + {80, 80, PT_BEZIERTO}, /* 102 */ + {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 103 */ + {-41, 60, PT_MOVETO}, /* 104 */ + {-41, 49, PT_BEZIERTO}, /* 105 */ + {-50, 40, PT_BEZIERTO}, /* 106 */ + {-60, 40, PT_BEZIERTO}, /* 107 */ + {-71, 40, PT_BEZIERTO}, /* 108 */ + {-80, 49, PT_BEZIERTO}, /* 109 */ + {-80, 60, PT_BEZIERTO}, /* 110 */ + {-80, 70, PT_BEZIERTO}, /* 111 */ + {-71, 79, PT_BEZIERTO}, /* 112 */ + {-60, 79, PT_BEZIERTO}, /* 113 */ + {-50, 79, PT_BEZIERTO}, /* 114 */ + {-41, 70, PT_BEZIERTO}, /* 115 */ + {-41, 60, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 116 */ + {-61, 85, PT_MOVETO}, /* 117 */ + {-61, 77, PT_BEZIERTO}, /* 118 */ + {-72, 70, PT_BEZIERTO}, /* 119 */ + {-85, 70, PT_BEZIERTO}, /* 120 */ + {-99, 70, PT_BEZIERTO}, /* 121 */ + {-110, 77, PT_BEZIERTO}, /* 122 */ + {-110, 85, PT_BEZIERTO}, /* 123 */ + {-110, 93, PT_BEZIERTO}, /* 124 */ + {-99, 99, PT_BEZIERTO}, /* 125 */ + {-85, 99, PT_BEZIERTO}, /* 126 */ + {-72, 99, PT_BEZIERTO}, /* 127 */ + {-61, 93, PT_BEZIERTO}, /* 128 */ + {-61, 85, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 129 */ + {119, -90, PT_MOVETO}, /* 130 */ + {119, -107, PT_BEZIERTO}, /* 131 */ + {106, -120, PT_BEZIERTO}, /* 132 */ + {90, -120, PT_BEZIERTO}, /* 133 */ + {73, -120, PT_BEZIERTO}, /* 134 */ + {60, -107, PT_BEZIERTO}, /* 135 */ + {60, -90, PT_BEZIERTO}, /* 136 */ + {60, -74, PT_BEZIERTO}, /* 137 */ + {73, -61, PT_BEZIERTO}, /* 138 */ + {90, -61, PT_BEZIERTO}, /* 139 */ + {106, -61, PT_BEZIERTO}, /* 140 */ + {119, -74, PT_BEZIERTO}, /* 141 */ + {119, -90, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 142 */ + {164, -128, PT_MOVETO}, /* 143 */ + {164, -140, PT_BEZIERTO}, /* 144 */ + {147, -150, PT_BEZIERTO}, /* 145 */ + {127, -150, PT_BEZIERTO}, /* 146 */ + {107, -150, PT_BEZIERTO}, /* 147 */ + {90, -140, PT_BEZIERTO}, /* 148 */ + {90, -128, PT_BEZIERTO}, /* 149 */ + {90, -116, PT_BEZIERTO}, /* 150 */ + {107, -106, PT_BEZIERTO}, /* 151 */ + {127, -106, PT_BEZIERTO}, /* 152 */ + {147, -106, PT_BEZIERTO}, /* 153 */ + {164, -116, PT_BEZIERTO}, /* 154 */ + {164, -128, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 155 */ + {-4, -5, PT_MOVETO}, /* 156 */ + {-4, -5, PT_BEZIERTO}, /* 157 */ + {-4, -6, PT_BEZIERTO}, /* 158 */ + {-5, -6, PT_BEZIERTO}, /* 159 */ + {-6, -6, PT_BEZIERTO}, /* 160 */ + {-6, -5, PT_BEZIERTO}, /* 161 */ + {-6, -5, PT_BEZIERTO}, /* 162 */ + {-6, -4, PT_BEZIERTO}, /* 163 */ + {-6, -4, PT_BEZIERTO}, /* 164 */ + {-5, -4, PT_BEZIERTO}, /* 165 */ + {-4, -4, PT_BEZIERTO}, /* 166 */ + {-4, -4, PT_BEZIERTO}, /* 167 */ + {-4, -5, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 168 */ + {40, 30, PT_MOVETO}, /* 169 */ + {40, 25, PT_BEZIERTO}, /* 170 */ + {36, 20, PT_BEZIERTO}, /* 171 */ + {30, 20, PT_BEZIERTO}, /* 172 */ + {24, 20, PT_BEZIERTO}, /* 173 */ + {20, 25, PT_BEZIERTO}, /* 174 */ + {20, 30, PT_BEZIERTO}, /* 175 */ + {20, 36, PT_BEZIERTO}, /* 176 */ + {24, 40, PT_BEZIERTO}, /* 177 */ + {30, 40, PT_BEZIERTO}, /* 178 */ + {36, 40, PT_BEZIERTO}, /* 179 */ + {40, 36, PT_BEZIERTO}, /* 180 */ + {40, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 181 */ + {55, 43, PT_MOVETO}, /* 182 */ + {55, 38, PT_BEZIERTO}, /* 183 */ + {49, 35, PT_BEZIERTO}, /* 184 */ + {43, 35, PT_BEZIERTO}, /* 185 */ + {36, 35, PT_BEZIERTO}, /* 186 */ + {30, 38, PT_BEZIERTO}, /* 187 */ + {30, 43, PT_BEZIERTO}, /* 188 */ + {30, 47, PT_BEZIERTO}, /* 189 */ + {36, 50, PT_BEZIERTO}, /* 190 */ + {43, 50, PT_BEZIERTO}, /* 191 */ + {49, 50, PT_BEZIERTO}, /* 192 */ + {55, 47, PT_BEZIERTO}, /* 193 */ + {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 194 */ + {60, 53, PT_MOVETO}, /* 195 */ + {60, 48, PT_BEZIERTO}, /* 196 */ + {54, 45, PT_BEZIERTO}, /* 197 */ + {48, 45, PT_BEZIERTO}, /* 198 */ + {41, 45, PT_BEZIERTO}, /* 199 */ + {35, 48, PT_BEZIERTO}, /* 200 */ + {35, 53, PT_BEZIERTO}, /* 201 */ + {35, 57, PT_BEZIERTO}, /* 202 */ + {41, 60, PT_BEZIERTO}, /* 203 */ + {48, 60, PT_BEZIERTO}, /* 204 */ + {54, 60, PT_BEZIERTO}, /* 205 */ + {60, 57, PT_BEZIERTO}, /* 206 */ + {60, 53, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 207 */ + {70, 70, PT_MOVETO}, /* 208 */ + {70, 70, PT_BEZIERTO}, /* 209 */ + {66, 70, PT_BEZIERTO}, /* 210 */ + {60, 70, PT_BEZIERTO}, /* 211 */ + {54, 70, PT_BEZIERTO}, /* 212 */ + {50, 70, PT_BEZIERTO}, /* 213 */ + {50, 70, PT_BEZIERTO}, /* 214 */ + {50, 70, PT_BEZIERTO}, /* 215 */ + {54, 70, PT_BEZIERTO}, /* 216 */ + {60, 70, PT_BEZIERTO}, /* 217 */ + {66, 70, PT_BEZIERTO}, /* 218 */ + {70, 70, PT_BEZIERTO}, /* 219 */ + {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 220 */ + {75, 80, PT_MOVETO}, /* 221 */ + {75, 77, PT_BEZIERTO}, /* 222 */ + {75, 75, PT_BEZIERTO}, /* 223 */ + {75, 75, PT_BEZIERTO}, /* 224 */ + {75, 75, PT_BEZIERTO}, /* 225 */ + {75, 77, PT_BEZIERTO}, /* 226 */ + {75, 80, PT_BEZIERTO}, /* 227 */ + {75, 83, PT_BEZIERTO}, /* 228 */ + {75, 85, PT_BEZIERTO}, /* 229 */ + {75, 85, PT_BEZIERTO}, /* 230 */ + {75, 85, PT_BEZIERTO}, /* 231 */ + {75, 83, PT_BEZIERTO}, /* 232 */ + {75, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 233 */ + {81, 81, PT_MOVETO}, /* 234 */ + {81, 80, PT_BEZIERTO}, /* 235 */ + {81, 80, PT_BEZIERTO}, /* 236 */ + {81, 80, PT_BEZIERTO}, /* 237 */ + {80, 80, PT_BEZIERTO}, /* 238 */ + {80, 80, PT_BEZIERTO}, /* 239 */ + {80, 81, PT_BEZIERTO}, /* 240 */ + {80, 81, PT_BEZIERTO}, /* 241 */ + {80, 81, PT_BEZIERTO}, /* 242 */ + {81, 81, PT_BEZIERTO}, /* 243 */ + {81, 81, PT_BEZIERTO}, /* 244 */ + {81, 81, PT_BEZIERTO}, /* 245 */ + {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 246 */ + {40, 30, PT_MOVETO}, /* 247 */ + {40, 36, PT_BEZIERTO}, /* 248 */ + {36, 40, PT_BEZIERTO}, /* 249 */ + {30, 40, PT_BEZIERTO}, /* 250 */ + {24, 40, PT_BEZIERTO}, /* 251 */ + {20, 36, PT_BEZIERTO}, /* 252 */ + {20, 30, PT_BEZIERTO}, /* 253 */ + {20, 24, PT_BEZIERTO}, /* 254 */ + {24, 20, PT_BEZIERTO}, /* 255 */ + {30, 20, PT_BEZIERTO}, /* 256 */ + {36, 20, PT_BEZIERTO}, /* 257 */ + {40, 24, PT_BEZIERTO}, /* 258 */ + {40, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 259 */ + {55, 43, PT_MOVETO}, /* 260 */ + {55, 47, PT_BEZIERTO}, /* 261 */ + {49, 50, PT_BEZIERTO}, /* 262 */ + {43, 50, PT_BEZIERTO}, /* 263 */ + {36, 50, PT_BEZIERTO}, /* 264 */ + {30, 47, PT_BEZIERTO}, /* 265 */ + {30, 43, PT_BEZIERTO}, /* 266 */ + {30, 38, PT_BEZIERTO}, /* 267 */ + {36, 35, PT_BEZIERTO}, /* 268 */ + {43, 35, PT_BEZIERTO}, /* 269 */ + {49, 35, PT_BEZIERTO}, /* 270 */ + {55, 38, PT_BEZIERTO}, /* 271 */ + {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 272 */ + {60, 53, PT_MOVETO}, /* 273 */ + {60, 57, PT_BEZIERTO}, /* 274 */ + {54, 60, PT_BEZIERTO}, /* 275 */ + {48, 60, PT_BEZIERTO}, /* 276 */ + {41, 60, PT_BEZIERTO}, /* 277 */ + {35, 57, PT_BEZIERTO}, /* 278 */ + {35, 53, PT_BEZIERTO}, /* 279 */ + {35, 48, PT_BEZIERTO}, /* 280 */ + {41, 45, PT_BEZIERTO}, /* 281 */ + {48, 45, PT_BEZIERTO}, /* 282 */ + {54, 45, PT_BEZIERTO}, /* 283 */ + {60, 48, PT_BEZIERTO}, /* 284 */ + {60, 53, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 285 */ + {70, 70, PT_MOVETO}, /* 286 */ + {70, 70, PT_BEZIERTO}, /* 287 */ + {66, 70, PT_BEZIERTO}, /* 288 */ + {60, 70, PT_BEZIERTO}, /* 289 */ + {54, 70, PT_BEZIERTO}, /* 290 */ + {50, 70, PT_BEZIERTO}, /* 291 */ + {50, 70, PT_BEZIERTO}, /* 292 */ + {50, 70, PT_BEZIERTO}, /* 293 */ + {54, 70, PT_BEZIERTO}, /* 294 */ + {60, 70, PT_BEZIERTO}, /* 295 */ + {66, 70, PT_BEZIERTO}, /* 296 */ + {70, 70, PT_BEZIERTO}, /* 297 */ + {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 298 */ + {75, 80, PT_MOVETO}, /* 299 */ + {75, 83, PT_BEZIERTO}, /* 300 */ + {75, 85, PT_BEZIERTO}, /* 301 */ + {75, 85, PT_BEZIERTO}, /* 302 */ + {75, 85, PT_BEZIERTO}, /* 303 */ + {75, 83, PT_BEZIERTO}, /* 304 */ + {75, 80, PT_BEZIERTO}, /* 305 */ + {75, 77, PT_BEZIERTO}, /* 306 */ + {75, 75, PT_BEZIERTO}, /* 307 */ + {75, 75, PT_BEZIERTO}, /* 308 */ + {75, 75, PT_BEZIERTO}, /* 309 */ + {75, 77, PT_BEZIERTO}, /* 310 */ + {75, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 311 */ + {81, 81, PT_MOVETO}, /* 312 */ + {81, 81, PT_BEZIERTO}, /* 313 */ + {81, 81, PT_BEZIERTO}, /* 314 */ + {81, 81, PT_BEZIERTO}, /* 315 */ + {80, 81, PT_BEZIERTO}, /* 316 */ + {80, 81, PT_BEZIERTO}, /* 317 */ + {80, 81, PT_BEZIERTO}, /* 318 */ + {80, 80, PT_BEZIERTO}, /* 319 */ + {80, 80, PT_BEZIERTO}, /* 320 */ + {81, 80, PT_BEZIERTO}, /* 321 */ + {81, 80, PT_BEZIERTO}, /* 322 */ + {81, 80, PT_BEZIERTO}, /* 323 */ + {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 324 */ +}; + +static void test_ellipse(void) +{ + HDC hdc = GetDC( 0 ); + + BeginPath( hdc ); + Ellipse( hdc, 20, 20, 40, 40 ); + Ellipse( hdc, 30, 50, 55, 35 ); + Ellipse( hdc, 60, 60, 35, 45 ); + Ellipse( hdc, 70, 70, 50, 70 ); + Ellipse( hdc, 75, 75, 75, 85 ); + Ellipse( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_CLOCKWISE ); + Ellipse( hdc, 20, 20, 40, 40 ); + Ellipse( hdc, 30, 50, 55, 35 ); + Ellipse( hdc, 60, 60, 35, 45 ); + Ellipse( hdc, 70, 70, 50, 70 ); + Ellipse( hdc, 75, 75, 75, 85 ); + Ellipse( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_COUNTERCLOCKWISE ); + SetMapMode( hdc, MM_ANISOTROPIC ); + SetViewportExtEx( hdc, -2, 2, NULL ); + Ellipse( hdc, 20, 20, 40, 40 ); + Ellipse( hdc, 30, 50, 55, 35 ); + SetViewportExtEx( hdc, 3, -3, NULL ); + Ellipse( hdc, 20, 20, 40, 40 ); + Ellipse( hdc, 30, 50, 55, 35 ); + SetWindowExtEx( hdc, -20, 20, NULL ); + Ellipse( hdc, 20, 20, 40, 40 ); + Ellipse( hdc, 24, 22, 21, 20 ); + SetMapMode( hdc, MM_TEXT ); + SetGraphicsMode( hdc, GM_ADVANCED ); + Ellipse( hdc, 20, 20, 40, 40 ); + Ellipse( hdc, 30, 50, 55, 35 ); + Ellipse( hdc, 60, 60, 35, 45 ); + Ellipse( hdc, 70, 70, 50, 70 ); + Ellipse( hdc, 75, 75, 75, 85 ); + Ellipse( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_CLOCKWISE ); + Ellipse( hdc, 20, 20, 40, 40 ); + Ellipse( hdc, 30, 50, 55, 35 ); + Ellipse( hdc, 60, 60, 35, 45 ); + Ellipse( hdc, 70, 70, 50, 70 ); + Ellipse( hdc, 75, 75, 75, 85 ); + Ellipse( hdc, 80, 80, 81, 81 ); + SetArcDirection( hdc, AD_COUNTERCLOCKWISE ); + EndPath( hdc ); + SetMapMode( hdc, MM_TEXT ); + ok_path( hdc, "ellipse_path", ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t) ); +} + +static const path_test_t all_funcs_path[] = +{ + {0, 0, PT_MOVETO}, /* 0 */ + {50, 150, PT_LINETO}, /* 1 */ + {50, 50, PT_MOVETO}, /* 2 */ + {150, 150, PT_LINETO}, /* 3 */ + {150, 50, PT_LINETO}, /* 4 */ + {50, 50, PT_LINETO}, /* 5 */ + {37, 13, PT_LINETO}, /* 6 */ + {24, 13, PT_BEZIERTO}, /* 7 */ + {14, 23, PT_BEZIERTO}, /* 8 */ + {14, 36, PT_BEZIERTO}, /* 9 */ + {14, 49, PT_BEZIERTO}, /* 10 */ + {24, 59, PT_BEZIERTO}, /* 11 */ + {37, 59, PT_BEZIERTO}, /* 12 */ + {37, 59, PT_BEZIERTO}, /* 13 */ + {37, 59, PT_BEZIERTO}, /* 14 */ + {37, 59, PT_BEZIERTO}, /* 15 */ + {10, 10, PT_MOVETO}, /* 16 */ + {20, 10, PT_LINETO}, /* 17 */ + {10, 20, PT_LINETO}, /* 18 */ + {20, 20, PT_LINETO}, /* 19 */ + {36, 27, PT_MOVETO}, /* 20 */ + {37, 26, PT_BEZIERTO}, /* 21 */ + {38, 25, PT_BEZIERTO}, /* 22 */ + {38, 25, PT_BEZIERTO}, /* 23 */ + {38, 23, PT_BEZIERTO}, /* 24 */ + {34, 21, PT_BEZIERTO}, /* 25 */ + {30, 21, PT_BEZIERTO}, /* 26 */ + {27, 21, PT_BEZIERTO}, /* 27 */ + {25, 21, PT_BEZIERTO}, /* 28 */ + {24, 22, PT_BEZIERTO}, /* 29 */ + {37, 59, PT_MOVETO}, /* 30 */ + {10, 10, PT_LINETO}, /* 31 */ + {20, 10, PT_LINETO}, /* 32 */ + {10, 20, PT_LINETO}, /* 33 */ + {20, 20, PT_LINETO}, /* 34 */ + {34, 26, PT_LINETO}, /* 35 */ + {35, 25, PT_BEZIERTO}, /* 36 */ + {36, 25, PT_BEZIERTO}, /* 37 */ + {36, 25, PT_BEZIERTO}, /* 38 */ + {36, 24, PT_BEZIERTO}, /* 39 */ + {33, 23, PT_BEZIERTO}, /* 40 */ + {30, 23, PT_BEZIERTO}, /* 41 */ + {28, 23, PT_BEZIERTO}, /* 42 */ + {26, 23, PT_BEZIERTO}, /* 43 */ + {25, 23, PT_BEZIERTO}, /* 44 */ + {10, 10, PT_MOVETO}, /* 45 */ + {20, 10, PT_LINETO}, /* 46 */ + {10, 20, PT_LINETO}, /* 47 */ + {20, 20, PT_LINETO}, /* 48 */ + {30, 30, PT_MOVETO}, /* 49 */ + {40, 20, PT_LINETO}, /* 50 */ + {20, 30, PT_LINETO}, /* 51 */ + {30, 40, PT_LINETO}, /* 52 */ + {10, 50, PT_LINETO}, /* 53 */ + {45, 45, PT_MOVETO}, /* 54 */ + {45, 45, PT_BEZIERTO}, /* 55 */ + {44, 46, PT_BEZIERTO}, /* 56 */ + {43, 47, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 57 */ + {10, 10, PT_MOVETO}, /* 58 */ + {20, 10, PT_LINETO}, /* 59 */ + {10, 20, PT_BEZIERTO}, /* 60 */ + {20, 20, PT_BEZIERTO}, /* 61 */ + {30, 30, PT_BEZIERTO}, /* 62 */ + {40, 20, PT_LINETO}, /* 63 */ + {20, 30, PT_LINETO | PT_CLOSEFIGURE}, /* 64 */ + {30, 40, PT_MOVETO}, /* 65 */ + {10, 50, PT_LINETO}, /* 66 */ + {55, 55, PT_MOVETO}, /* 67 */ + {54, 55, PT_BEZIERTO}, /* 68 */ + {54, 56, PT_BEZIERTO}, /* 69 */ + {54, 56, PT_BEZIERTO}, /* 70 */ + {58, 61, PT_LINETO | PT_CLOSEFIGURE}, /* 71 */ + {10, 10, PT_MOVETO}, /* 72 */ + {20, 10, PT_LINETO}, /* 73 */ + {10, 20, PT_LINETO}, /* 74 */ + {20, 20, PT_LINETO}, /* 75 */ + {30, 30, PT_LINETO}, /* 76 */ + {40, 20, PT_LINETO}, /* 77 */ + {20, 30, PT_LINETO}, /* 78 */ + {30, 40, PT_LINETO}, /* 79 */ + {10, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 80 */ + {43, 49, PT_MOVETO}, /* 81 */ + {43, 40, PT_BEZIERTO}, /* 82 */ + {38, 33, PT_BEZIERTO}, /* 83 */ + {33, 33, PT_BEZIERTO}, /* 84 */ + {27, 33, PT_BEZIERTO}, /* 85 */ + {22, 40, PT_BEZIERTO}, /* 86 */ + {22, 49, PT_BEZIERTO}, /* 87 */ + {22, 58, PT_BEZIERTO}, /* 88 */ + {27, 65, PT_BEZIERTO}, /* 89 */ + {33, 65, PT_BEZIERTO}, /* 90 */ + {38, 65, PT_BEZIERTO}, /* 91 */ + {43, 58, PT_BEZIERTO}, /* 92 */ + {43, 49, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 93 */ + {79, 70, PT_MOVETO}, /* 94 */ + {60, 70, PT_LINETO}, /* 95 */ + {60, 89, PT_LINETO}, /* 96 */ + {79, 89, PT_LINETO | PT_CLOSEFIGURE}, /* 97 */ + {199, 122, PT_MOVETO}, /* 98 */ + {199, 110, PT_BEZIERTO}, /* 99 */ + {191, 100, PT_BEZIERTO}, /* 100 */ + {182, 100, PT_BEZIERTO}, /* 101 */ + {117, 100, PT_LINETO}, /* 102 */ + {108, 100, PT_BEZIERTO}, /* 103 */ + {100, 110, PT_BEZIERTO}, /* 104 */ + {100, 122, PT_BEZIERTO}, /* 105 */ + {100, 177, PT_LINETO}, /* 106 */ + {100, 189, PT_BEZIERTO}, /* 107 */ + {108, 199, PT_BEZIERTO}, /* 108 */ + {117, 199, PT_BEZIERTO}, /* 109 */ + {182, 199, PT_LINETO}, /* 110 */ + {191, 199, PT_BEZIERTO}, /* 111 */ + {199, 189, PT_BEZIERTO}, /* 112 */ + {199, 177, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 113 */ + {10, 10, PT_MOVETO}, /* 114 */ + {20, 10, PT_BEZIERTO}, /* 115 */ + {10, 20, PT_BEZIERTO}, /* 116 */ + {20, 20, PT_BEZIERTO}, /* 117 */ + {30, 30, PT_BEZIERTO}, /* 118 */ + {40, 20, PT_BEZIERTO}, /* 119 */ + {20, 30, PT_BEZIERTO}, /* 120 */ + {10, 10, PT_MOVETO}, /* 121 */ + {20, 10, PT_LINETO}, /* 122 */ + {10, 20, PT_LINETO}, /* 123 */ + {20, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 124 */ + {30, 30, PT_MOVETO}, /* 125 */ + {40, 20, PT_LINETO}, /* 126 */ + {20, 30, PT_LINETO}, /* 127 */ + {30, 40, PT_LINETO}, /* 128 */ + {10, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 129 */ + {10, 50, PT_MOVETO}, /* 130 */ + {10, 10, PT_BEZIERTO}, /* 131 */ + {20, 10, PT_BEZIERTO}, /* 132 */ + {10, 20, PT_BEZIERTO}, /* 133 */ + {20, 20, PT_BEZIERTO}, /* 134 */ + {30, 30, PT_BEZIERTO}, /* 135 */ + {40, 20, PT_BEZIERTO}, /* 136 */ + {20, 30, PT_BEZIERTO}, /* 137 */ + {30, 40, PT_BEZIERTO}, /* 138 */ + {10, 50, PT_BEZIERTO}, /* 139 */ + {150, 150, PT_LINETO}, /* 140 */ +}; + +/* run once through all functions that support paths */ +static void test_all_functions(void) +{ + POINT pts[9] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}, {30, 30}, {40, 20}, + {20, 30}, {30, 40}, {10, 50}}; + DWORD counts[5] = {4, 5, 0, 1, 2}; + BYTE types[9] = { PT_MOVETO, PT_LINETO, PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, PT_LINETO, + PT_LINETO | PT_CLOSEFIGURE, PT_MOVETO, PT_LINETO }; + HDC hdc = GetDC( 0 ); + + BeginPath( hdc ); + LineTo( hdc, 50, 150 ); + MoveToEx( hdc, 50, 50, NULL ); + LineTo( hdc, 150, 150 ); + LineTo( hdc, 150, 50 ); + LineTo( hdc, 50, 50 ); + AngleArc( hdc, 37, 36, 23, 90, 180 ); + Polyline( hdc, pts, 4 ); + Arc( hdc, 21, 21, 39, 29, 39, 29, 21, 21 ); + PolylineTo( hdc, pts, 4 ); + ArcTo( hdc, 23, 23, 37, 27, 37, 27, 23, 23 ); + PolyPolyline( hdc, pts, counts, 2 ); + Chord( hdc, 42, 43, 57, 66, 39, 29, 21, 21 ); + PolyDraw( hdc, pts, types, 9 ); + Pie( hdc, 52, 54, 65, 68, 39, 29, 21, 21 ); + Polygon( hdc, pts, 9 ); + Ellipse( hdc, 22, 33, 44, 66 ); + Rectangle( hdc, 60, 70, 80, 90 ); + RoundRect( hdc, 100, 100, 200, 200, 35, 45 ); + PolyBezier( hdc, pts, 7 ); + PolyPolygon( hdc, pts, (int *)counts, 2 ); + PolyBezierTo( hdc, pts, 9 ); + LineTo( hdc, 150, 150 ); + /* FIXME: ExtTextOut */ + EndPath( hdc ); + ok_path( hdc, "all_funcs_path", all_funcs_path, sizeof(all_funcs_path)/sizeof(path_test_t) ); + ReleaseDC( 0, hdc ); +} + START_TEST(path) { test_path_state(); @@ -738,4 +1903,8 @@ START_TEST(path) test_polydraw(); test_closefigure(); test_linedda(); + test_rectangle(); + test_roundrect(); + test_ellipse(); + test_all_functions(); }