Module: wine Branch: master Commit: a53b9b95b846b7fd9561177050db6e0121e86ce4 URL: http://source.winehq.org/git/wine.git/?a=commit;h=a53b9b95b846b7fd9561177050...
Author: Nikolay Sivov bunglehead@gmail.com Date: Sun Jul 13 11:52:23 2008 +0400
gdiplus: Fix for GdipPathIterNextMarker to handle path without markers. Fix tests.
---
dlls/gdiplus/pathiterator.c | 3 ++- dlls/gdiplus/tests/pathiterator.c | 33 +++++++++++++++++++++++++++++---- 2 files changed, 31 insertions(+), 5 deletions(-)
diff --git a/dlls/gdiplus/pathiterator.c b/dlls/gdiplus/pathiterator.c index 55b0782..95f1774 100644 --- a/dlls/gdiplus/pathiterator.c +++ b/dlls/gdiplus/pathiterator.c @@ -140,7 +140,8 @@ GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator* iterator, INT *result /* first call could start with second point as all subsequent, cause path couldn't contain only one */ for(i = iterator->marker_pos + 1; i < iterator->pathdata.Count; i++){ - if(iterator->pathdata.Types[i] & PathPointTypePathMarker){ + if((iterator->pathdata.Types[i] & PathPointTypePathMarker) || + (i == iterator->pathdata.Count - 1)){ *startIndex = iterator->marker_pos; if(iterator->marker_pos > 0) (*startIndex)++; *endIndex = iterator->marker_pos = i; diff --git a/dlls/gdiplus/tests/pathiterator.c b/dlls/gdiplus/tests/pathiterator.c index 071c1d5..a6adb19 100644 --- a/dlls/gdiplus/tests/pathiterator.c +++ b/dlls/gdiplus/tests/pathiterator.c @@ -95,7 +95,8 @@ static void test_nextmarker(void) GpPath *path; GpPathIterator *iter; GpStatus stat; - INT start, end, result; + INT start, end; + INT result;
/* NULL args BOOL out argument is local in wrapper class method, @@ -112,19 +113,34 @@ static void test_nextmarker(void)
/* no markers */ GdipCreatePathIter(&iter, path); + start = end = result = (INT)0xdeadbeef; stat = GdipPathIterNextMarker(iter, &result, &start, &end); expect(Ok, stat); + expect(0, start); + expect(3, end); + expect(4, result); + start = end = result = (INT)0xdeadbeef; + stat = GdipPathIterNextMarker(iter, &result, &start, &end); + /* start/end remain unchanged */ + expect((INT)0xdeadbeef, start); + expect((INT)0xdeadbeef, end); expect(0, result); GdipDeletePathIter(iter);
/* one marker */ GdipSetPathMarker(path); GdipCreatePathIter(&iter, path); + start = end = result = (INT)0xdeadbeef; stat = GdipPathIterNextMarker(iter, &result, &start, &end); expect(Ok, stat); - expect(TRUE, (start == 0) && (end == 3) && (result == 4)); + expect(0, start); + expect(3, end); + expect(4, result); + start = end = result = (INT)0xdeadbeef; stat = GdipPathIterNextMarker(iter, &result, &start, &end); expect(Ok, stat); + expect((INT)0xdeadbeef, start); + expect((INT)0xdeadbeef, end); expect(0, result); GdipDeletePathIter(iter);
@@ -132,14 +148,23 @@ static void test_nextmarker(void) GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0); GdipSetPathMarker(path); GdipCreatePathIter(&iter, path); + start = end = result = (INT)0xdeadbeef; stat = GdipPathIterNextMarker(iter, &result, &start, &end); expect(Ok, stat); - expect(TRUE, (start == 0) && (end == 3) && (result == 4)); + expect(0, start); + expect(3, end); + expect(4, result); + start = end = result = (INT)0xdeadbeef; stat = GdipPathIterNextMarker(iter, &result, &start, &end); expect(Ok, stat); - expect(TRUE, (start == 4) && (end == 5) && (result == 2)); + expect(4, start); + expect(5, end); + expect(2, result); + start = end = result = (INT)0xdeadbeef; stat = GdipPathIterNextMarker(iter, &result, &start, &end); expect(Ok, stat); + expect((INT)0xdeadbeef, start); + expect((INT)0xdeadbeef, end); expect(0, result); GdipDeletePathIter(iter);