Andrew Eikum : gdiplus/tests: Add tests for GdipDrawCurveI.
Alexandre Julliard
julliard at winehq.org
Mon Jun 29 09:17:42 CDT 2009
Module: wine
Branch: master
Commit: fe55f0df2a8c8bb592a4794eb0c6d22f57aa4cda
URL: http://source.winehq.org/git/wine.git/?a=commit;h=fe55f0df2a8c8bb592a4794eb0c6d22f57aa4cda
Author: Andrew Eikum <andrew at brightnightgames.com>
Date: Sun Jun 28 13:33:52 2009 -0500
gdiplus/tests: Add tests for GdipDrawCurveI.
---
dlls/gdiplus/graphics.c | 2 +-
dlls/gdiplus/tests/graphics.c | 62 +++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 27cd6fb..4d7f096 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -1423,7 +1423,7 @@ GpStatus WINGDIPAPI GdipDrawCurveI(GpGraphics *graphics, GpPen *pen,
TRACE("(%p, %p, %p, %d)\n", graphics, pen, points, count);
- if(!points || count <= 0)
+ if(!points)
return InvalidParameter;
pointsF = GdipAlloc(sizeof(GpPointF)*count);
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index b738ae7..f83d012 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -489,6 +489,67 @@ static void test_GdipDrawCurve(void)
ReleaseDC(0, hdc);
}
+static void test_GdipDrawCurveI(void)
+{
+ GpStatus status;
+ GpGraphics *graphics = NULL;
+ GpPen *pen = NULL;
+ HDC hdc = GetDC(0);
+ GpPoint 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 = GdipDrawCurveI(NULL, NULL, points, 3);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawCurveI(graphics, NULL, points, 3);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawCurveI(NULL, pen, points, 3);
+ expect(InvalidParameter, status);
+
+ /* InvalidParameter cases: invalid count */
+ status = GdipDrawCurveI(graphics, pen, points, -1);
+ expect(OutOfMemory, status);
+
+ status = GdipDrawCurveI(graphics, pen, points, 0);
+ expect(InvalidParameter, status);
+
+ status = GdipDrawCurveI(graphics, pen, points, 1);
+ expect(InvalidParameter, status);
+
+ /* Valid test cases */
+ status = GdipDrawCurveI(graphics, pen, points, 2);
+ expect(Ok, status);
+
+ status = GdipDrawCurveI(graphics, pen, points, 3);
+ expect(Ok, status);
+
+ GdipDeletePen(pen);
+ GdipDeleteGraphics(graphics);
+
+ ReleaseDC(0, hdc);
+}
+
static void test_GdipDrawLineI(void)
{
GpStatus status;
@@ -1214,6 +1275,7 @@ START_TEST(graphics)
test_GdipDrawArc();
test_GdipDrawArcI();
test_GdipDrawCurve();
+ test_GdipDrawCurveI();
test_GdipDrawCurve2();
test_GdipDrawLineI();
test_GdipDrawLinesI();
More information about the wine-cvs
mailing list