[1/2] gdiplus: implemented GdipPathIterIsValid with tests

Nikolay Sivov bunglehead at gmail.com
Tue Aug 5 11:56:17 CDT 2008


Changelog:
    - implemented GdipPathIterIsValid with tests

---
 dlls/gdiplus/gdiplus.spec         |    2 +-
 dlls/gdiplus/pathiterator.c       |   10 ++++++++
 dlls/gdiplus/tests/pathiterator.c |   42 +++++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h             |    1 +
 4 files changed, 54 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 57f9734..625c5a0 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -455,7 +455,7 @@
 @ stdcall GdipPathIterGetCount(ptr ptr)
 @ stdcall GdipPathIterGetSubpathCount(ptr ptr)
 @ stdcall GdipPathIterHasCurve(ptr ptr)
-@ stub GdipPathIterIsValid
+@ stdcall GdipPathIterIsValid(ptr ptr)
 @ stdcall GdipPathIterNextMarker(ptr ptr ptr ptr)
 @ stub GdipPathIterNextMarkerPath
 @ stub GdipPathIterNextPathType
diff --git a/dlls/gdiplus/pathiterator.c b/dlls/gdiplus/pathiterator.c
index 95f1774..5269b0c 100644
--- a/dlls/gdiplus/pathiterator.c
+++ b/dlls/gdiplus/pathiterator.c
@@ -225,3 +225,13 @@ GpStatus WINGDIPAPI GdipPathIterEnumerate(GpPathIterator* iterator, INT* resultC
 
     return GdipPathIterCopyData(iterator, resultCount, points, types, 0, count-1);
 }
+
+GpStatus WINGDIPAPI GdipPathIterIsValid(GpPathIterator* iterator, BOOL* valid)
+{
+    if(!iterator || !valid)
+        return InvalidParameter;
+
+    *valid = TRUE;
+
+    return Ok;
+}
diff --git a/dlls/gdiplus/tests/pathiterator.c b/dlls/gdiplus/tests/pathiterator.c
index a6adb19..d318360 100644
--- a/dlls/gdiplus/tests/pathiterator.c
+++ b/dlls/gdiplus/tests/pathiterator.c
@@ -214,6 +214,47 @@ static void test_getsubpathcount(void)
     GdipDeletePath(path);
 }
 
+static void test_isvalid(void)
+{
+    GpPath *path;
+    GpPathIterator *iter;
+    GpStatus stat;
+    BOOL isvalid;
+    INT start, end, result;
+
+    GdipCreatePath(FillModeAlternate, &path);
+
+    /* NULL args */
+    GdipCreatePathIter(&iter, path);
+    stat = GdipPathIterIsValid(NULL, NULL);
+    expect(InvalidParameter, stat);
+    stat = GdipPathIterIsValid(iter, NULL);
+    expect(InvalidParameter, stat);
+    stat = GdipPathIterIsValid(NULL, &isvalid);
+    expect(InvalidParameter, stat);
+    GdipDeletePathIter(iter);
+
+    /* on empty path */
+    GdipCreatePathIter(&iter, path);
+    isvalid = FALSE;
+    stat = GdipPathIterIsValid(iter, &isvalid);
+    expect(Ok, stat);
+    expect(TRUE, isvalid);
+    GdipDeletePathIter(iter);
+
+    /* no markers */
+    GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
+    GdipCreatePathIter(&iter, path);
+    GdipPathIterNextMarker(iter, &result, &start, &end);
+    isvalid = FALSE;
+    stat = GdipPathIterIsValid(iter, &isvalid);
+    expect(Ok, stat);
+    expect(TRUE, isvalid);
+    GdipDeletePathIter(iter);
+
+    GdipDeletePath(path);
+}
+
 START_TEST(pathiterator)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -230,6 +271,7 @@ START_TEST(pathiterator)
     test_hascurve();
     test_nextmarker();
     test_getsubpathcount();
+    test_isvalid();
 
     GdiplusShutdown(gdiplusToken);
 }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index ed88096..d7baf52 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -333,6 +333,7 @@ GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator*,INT*);
 GpStatus WINGDIPAPI GdipPathIterGetSubpathCount(GpPathIterator*,INT*);
 GpStatus WINGDIPAPI GdipPathIterEnumerate(GpPathIterator*,INT*,GpPointF*,BYTE*,INT);
 GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator*,BOOL*);
+GpStatus WINGDIPAPI GdipPathIterIsValid(GpPathIterator*,BOOL*);
 
 GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap*,GpCustomLineCap**);
 GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath*,GpPath*,GpLineCap,REAL,
-- 
1.4.4.4






More information about the wine-patches mailing list