[1/2] gdi32: Added PolyDraw tests to tests/path.c [try6]

Evan Stade estade at gmail.com
Fri Jul 6 18:14:51 CDT 2007


Hi,

resubmit. ( I assume there is nothing wrong with the test itself)

 dlls/gdi32/tests/path.c |   83 +++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 83 insertions(+), 0 deletions(-)

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index e9b8e2f..8e389f3 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -31,6 +31,8 @@ #include "wine/test.h"
 #include "winuser.h"
 #include "winerror.h"
 
+#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
+
 static void test_widenpath(void)
 {
     HDC hdc = GetDC(0);
@@ -291,9 +293,90 @@ done:
     ReleaseDC(0, hdc);
 }
 
+static const path_test_t polydraw_path[] = {
+    {0, 0, 6, 0, 0}, /*0*/
+    {10, 10, 2, 0, 0}, /*1*/
+    {10, 15, 3, 0, 0}, /*2*/
+    {100, 100, 6, 0, 0}, /*3*/
+    {95, 95, 2, 0, 0}, /*4*/
+    {10, 10, 2, 0, 0}, /*5*/
+    {10, 15, 3, 0, 0}, /*6*/
+    {100, 100, 6, 0, 1}, /*7*/
+    {15, 15, 2, 0, 1}, /*8*/
+    {100, 100, 6, 0, 1}, /*9*/
+    {30, 30, 4, 0, 1}, /*10*/
+    {30, 35, 4, 0, 1}, /*11*/
+    {35, 35, 4, 0, 1}, /*12*/
+    {45, 50, 2, 0, 0}, /*13*/
+    {35, 35, 6, 0, 0}, /*14*/
+    {50, 55, 2, 0, 0}, /*15*/
+    {45, 50, 2, 0, 0}, /*16*/
+    {35, 35, 6, 0, 0}, /*17*/
+    {60, 60, 2, 0, 0}, /*18*/
+    {60, 65, 2, 0, 0}, /*19*/
+    };
+
+static POINT polydraw_pts[] = {
+    {10, 10}, {10, 15},
+    {15, 15}, {15, 20}, {20, 20},
+    {30, 30}, {30, 35}, {35, 35},
+    {45, 50}, {50, 50},
+    {50, 55}, {45, 50}, {55, 60},
+    {60, 60}, {60, 65}};
+
+static BYTE polydraw_tps[] =
+    {PT_LINETO, PT_CLOSEFIGURE | PT_LINETO, /* 2 */
+     PT_LINETO, PT_BEZIERTO, PT_LINETO, /* 5 */
+     PT_BEZIERTO, PT_BEZIERTO, PT_BEZIERTO, /* 8 */
+     PT_LINETO, PT_MOVETO | PT_CLOSEFIGURE, /* 10 */
+     PT_LINETO, PT_LINETO, PT_MOVETO | PT_CLOSEFIGURE, /* 13 */
+     PT_LINETO, PT_LINETO}; /* 15 */
+
+static void test_polydraw(void)
+{
+    HDC hdc = GetDC(0);
+    BOOL retb;
+    BeginPath(hdc);
+
+        /* closefigure with no previous moveto */
+    if (!(retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2)) &&
+        GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+    {
+        /* PolyDraw is only available on Win2k and later */
+        skip("PolyDraw is not available\n");
+        goto done;
+    }
+
+    MoveToEx(hdc, 100, 100, NULL);
+    LineTo(hdc, 95, 95);
+    retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2);
+    expect(TRUE, retb);
+    /* bad bezier points */
+    retb = PolyDraw(hdc, &(polydraw_pts[2]), &(polydraw_tps[2]), 3);
+    expect(FALSE, retb);
+    /* good bezier points */
+    retb = PolyDraw(hdc, &(polydraw_pts[5]), &(polydraw_tps[5]), 3);
+    expect(TRUE, retb);
+    /* bad point type, has already moved cursor position */
+    retb = PolyDraw(hdc, &(polydraw_pts[8]), &(polydraw_tps[8]), 5);
+    expect(FALSE, retb);
+    /* bad point type, cursor position is moved, but back to its original spot */
+    retb = PolyDraw(hdc, &(polydraw_pts[10]), &(polydraw_tps[10]), 3);
+    expect(FALSE, retb);
+    retb = PolyDraw(hdc, &(polydraw_pts[13]), &(polydraw_tps[13]), 2);
+    expect(TRUE, retb);
+
+    EndPath(hdc);
+
+    ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t), 1);
+done:
+    ReleaseDC(0, hdc);
+}
+
 START_TEST(path)
 {
     test_widenpath();
     test_arcto();
     test_anglearc();
+    test_polydraw();
 }
-- 
1.4.1


More information about the wine-patches mailing list