Andrew Eikum : gdiplus/tests: Add tests for GdipDrawCurve2.

Alexandre Julliard julliard at winehq.org
Mon Jun 29 09:17:42 CDT 2009


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

Author: Andrew Eikum <andrew at brightnightgames.com>
Date:   Sun Jun 28 12:37:11 2009 -0500

gdiplus/tests: Add tests for GdipDrawCurve2.

---

 dlls/gdiplus/tests/graphics.c |   68 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 68c0e29..b738ae7 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -361,6 +361,73 @@ static void test_GdipDrawBezierI(void)
     ReleaseDC(0, hdc);
 }
 
+static void test_GdipDrawCurve2(void)
+{
+    GpStatus status;
+    GpGraphics *graphics = NULL;
+    GpPen *pen = NULL;
+    HDC hdc = GetDC(0);
+    GpPointF points[3];
+
+    points[0].X = 0;
+    points[0].Y = 0;
+
+    points[1].X = 40;
+    points[1].Y = 20;
+
+    points[2].X = 10;
+    points[2].Y = 40;
+
+    /* make a graphics object and pen object */
+    ok(hdc != NULL, "Expected HDC to be initialized\n");
+
+    status = GdipCreateFromHDC(hdc, &graphics);
+    expect(Ok, status);
+    ok(graphics != NULL, "Expected graphics to be initialized\n");
+
+    status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen);
+    expect(Ok, status);
+    ok(pen != NULL, "Expected pen to be initialized\n");
+
+    /* InvalidParameter cases: null graphics, null pen */
+    status = GdipDrawCurve2(NULL, NULL, points, 3, 1);
+    expect(InvalidParameter, status);
+
+    status = GdipDrawCurve2(graphics, NULL, points, 3, 1);
+    expect(InvalidParameter, status);
+
+    status = GdipDrawCurve2(NULL, pen, points, 3, 1);
+    expect(InvalidParameter, status);
+
+    /* InvalidParameter cases: invalid count */
+    status = GdipDrawCurve2(graphics, pen, points, -1, 1);
+    expect(InvalidParameter, status);
+
+    status = GdipDrawCurve2(graphics, pen, points, 0, 1);
+    expect(InvalidParameter, status);
+
+    status = GdipDrawCurve2(graphics, pen, points, 1, 1);
+    expect(InvalidParameter, status);
+
+    /* Valid test cases */
+    status = GdipDrawCurve2(graphics, pen, points, 2, 1);
+    expect(Ok, status);
+
+    status = GdipDrawCurve2(graphics, pen, points, 3, 2);
+    expect(Ok, status);
+
+    status = GdipDrawCurve2(graphics, pen, points, 3, -2);
+    expect(Ok, status);
+
+    status = GdipDrawCurve2(graphics, pen, points, 3, 0);
+    expect(Ok, status);
+
+    GdipDeletePen(pen);
+    GdipDeleteGraphics(graphics);
+
+    ReleaseDC(0, hdc);
+}
+
 static void test_GdipDrawCurve(void)
 {
     GpStatus status;
@@ -1147,6 +1214,7 @@ START_TEST(graphics)
     test_GdipDrawArc();
     test_GdipDrawArcI();
     test_GdipDrawCurve();
+    test_GdipDrawCurve2();
     test_GdipDrawLineI();
     test_GdipDrawLinesI();
     test_GdipDrawString();




More information about the wine-cvs mailing list