gdiplus: Fix for GdipPathIterNextMarker to handle path without markers. Fix tests.

This commit is contained in:
Nikolay Sivov 2008-07-13 11:52:23 +04:00 committed by Alexandre Julliard
parent dcfbe58ef7
commit a53b9b95b8
2 changed files with 31 additions and 5 deletions

View File

@ -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;

View File

@ -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);