Commit 0a9937c5 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus: GdipPathIterNextMarker implementation with tests.

parent ebded163
......@@ -456,7 +456,7 @@
@ stub GdipPathIterGetSubpathCount
@ stdcall GdipPathIterHasCurve(ptr ptr)
@ stub GdipPathIterIsValid
@ stub GdipPathIterNextMarker
@ stdcall GdipPathIterNextMarker(ptr ptr ptr ptr)
@ stub GdipPathIterNextMarkerPath
@ stub GdipPathIterNextPathType
@ stdcall GdipPathIterNextSubpath(ptr ptr ptr ptr ptr)
......
......@@ -105,6 +105,31 @@ GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurv
return Ok;
}
GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount,
INT* startIndex, INT* endIndex)
{
INT i;
if(!iterator || !startIndex || !endIndex)
return InvalidParameter;
*resultCount = 0;
/* 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){
*startIndex = iterator->marker_pos;
if(iterator->marker_pos > 0) (*startIndex)++;
*endIndex = iterator->marker_pos = i;
*resultCount= *endIndex - *startIndex + 1;
break;
}
}
return Ok;
}
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator* iterator,
INT *resultCount, INT* startIndex, INT* endIndex, BOOL* isClosed)
{
......
......@@ -90,6 +90,62 @@ static void test_hascurve(void)
GdipDeletePath(path);
}
static void test_nextmarker(void)
{
GpPath *path;
GpPathIterator *iter;
GpStatus stat;
INT start, end, result;
/* NULL args
BOOL out argument is local in wrapper class method,
so it always has not-NULL address */
stat = GdipPathIterNextMarker(NULL, &result, NULL, NULL);
expect(InvalidParameter, stat);
stat = GdipPathIterNextMarker(NULL, &result, &start, NULL);
expect(InvalidParameter, stat);
stat = GdipPathIterNextMarker(NULL, &result, NULL, &end);
expect(InvalidParameter, stat);
GdipCreatePath(FillModeAlternate, &path);
GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
/* no markers */
GdipCreatePathIter(&iter, path);
stat = GdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(0, result);
GdipDeletePathIter(iter);
/* one marker */
GdipSetPathMarker(path);
GdipCreatePathIter(&iter, path);
stat = GdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(TRUE, (start == 0) && (end == 3) && (result == 4));
stat = GdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(0, result);
GdipDeletePathIter(iter);
/* two markers */
GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
GdipSetPathMarker(path);
GdipCreatePathIter(&iter, path);
stat = GdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(TRUE, (start == 0) && (end == 3) && (result == 4));
stat = GdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(TRUE, (start == 4) && (end == 5) && (result == 2));
stat = GdipPathIterNextMarker(iter, &result, &start, &end);
expect(Ok, stat);
expect(0, result);
GdipDeletePathIter(iter);
GdipDeletePath(path);
}
START_TEST(pathiterator)
{
struct GdiplusStartupInput gdiplusStartupInput;
......@@ -104,6 +160,7 @@ START_TEST(pathiterator)
test_constructor_destructor();
test_hascurve();
test_nextmarker();
GdiplusShutdown(gdiplusToken);
}
......@@ -281,6 +281,7 @@ GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator**,GpPath*);
GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator*);
GpStatus WINGDIPAPI GdipPathIterCopyData(GpPathIterator*,INT*,GpPointF*,BYTE*,
INT,INT);
GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator*,INT*,INT*,INT*);
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL*);
GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*);
GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator*,INT*);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment