Dmitry Timoshkov : gdi32: Add more EMF clipping tests.

Alexandre Julliard julliard at winehq.org
Thu Feb 14 15:01:31 CST 2013


Module: wine
Branch: master
Commit: 498b18f25fd1055060279427b9cca80c7a7fdb6f
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=498b18f25fd1055060279427b9cca80c7a7fdb6f

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Feb 14 13:37:11 2013 +0800

gdi32: Add more EMF clipping tests.

---

 dlls/gdi32/tests/metafile.c |   70 ++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 69 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 2623847..115db07 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -60,6 +60,20 @@ static void init_function_pointers(void)
     GDI_GET_PROC(SetDCPenColor);
 }
 
+static DWORD rgn_rect_count(HRGN hrgn)
+{
+    DWORD size;
+    RGNDATA *data;
+
+    if (!hrgn) return 0;
+    if (!(size = GetRegionData(hrgn, 0, NULL))) return 0;
+    if (!(data = HeapAlloc(GetProcessHeap(), 0, size))) return 0;
+    GetRegionData(hrgn, size, data);
+    size = data->rdh.nCount;
+    HeapFree(GetProcessHeap(), 0, data);
+    return size;
+}
+
 static int CALLBACK eto_emf_enum_proc(HDC hdc, HANDLETABLE *handle_table,
     const ENHMETARECORD *emr, int n_objs, LPARAM param)
 {
@@ -2481,10 +2495,64 @@ static void test_emf_clipping(void)
     ret = GetClipBox(hdc, &rc_res);
     ok(ret == SIMPLEREGION, "got %d\n", ret);
     ok(EqualRect(&rc_res, &rc_sclip),
-       "expected rc_res (%d,%d)-(%d,%d), got (%d,%d)-(%d,%d)\n",
+       "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);
+
+    OffsetRect(&rc_sclip, -100, -100);
+    ret = OffsetClipRgn(hdc, -100, -100);
+todo_wine
+    ok(ret == SIMPLEREGION, "got %d\n", ret);
+    SetRect(&rc_res, -1, -1, -1, -1);
+    ret = GetClipBox(hdc, &rc_res);
+    ok(ret == SIMPLEREGION, "got %d\n", ret);
+todo_wine
+    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);
 
+    ret = IntersectClipRect(hdc, 0, 0, 100, 100);
+todo_wine
+    ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION) /* XP */, "got %d\n", ret);
+    if (ret == COMPLEXREGION)
+    {
+        /* XP returns COMPLEXREGION although region contains only 1 rect */
+        ret = GetClipRgn(hdc, hrgn);
+        ok(ret == 1, "expected 1, got %d\n", ret);
+        ret = rgn_rect_count(hrgn);
+        ok(ret == 1, "expected 1, got %d\n", ret);
+    }
+    SetRect(&rc_res, -1, -1, -1, -1);
+    ret = GetClipBox(hdc, &rc_res);
+    ok(ret == SIMPLEREGION, "got %d\n", ret);
+todo_wine
+    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);
+
+    SetRect(&rc_sclip, 0, 0, 100, 50);
+    ret = ExcludeClipRect(hdc, 0, 50, 100, 100);
+todo_wine
+    ok(ret == SIMPLEREGION || broken(ret == COMPLEXREGION) /* XP */, "got %d\n", ret);
+    if (ret == COMPLEXREGION)
+    {
+        /* XP returns COMPLEXREGION although region contains only 1 rect */
+        ret = GetClipRgn(hdc, hrgn);
+        ok(ret == 1, "expected 1, got %d\n", ret);
+        ret = rgn_rect_count(hrgn);
+        ok(ret == 1, "expected 1, got %d\n", ret);
+    }
+    SetRect(&rc_res, -1, -1, -1, -1);
+    ret = GetClipBox(hdc, &rc_res);
+    ok(ret == SIMPLEREGION, "got %d\n", ret);
+todo_wine
+    ok(EqualRect(&rc_res, &rc_sclip),
+       "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);
+
     hemf = CloseEnhMetaFile(hdc);
     DeleteEnhMetaFile(hemf);
     DeleteObject(hrgn);




More information about the wine-cvs mailing list