gdiplus: Implementation of GdipPathIterGetSubpathCount with tests.
This commit is contained in:
parent
0a9937c534
commit
20501e4ca8
|
@ -453,7 +453,7 @@
|
|||
@ stdcall GdipPathIterCopyData(ptr ptr ptr ptr long long)
|
||||
@ stdcall GdipPathIterEnumerate(ptr ptr ptr ptr long)
|
||||
@ stdcall GdipPathIterGetCount(ptr ptr)
|
||||
@ stub GdipPathIterGetSubpathCount
|
||||
@ stdcall GdipPathIterGetSubpathCount(ptr ptr)
|
||||
@ stdcall GdipPathIterHasCurve(ptr ptr)
|
||||
@ stub GdipPathIterIsValid
|
||||
@ stdcall GdipPathIterNextMarker(ptr ptr ptr ptr)
|
||||
|
|
|
@ -105,6 +105,22 @@ GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurv
|
|||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipPathIterGetSubpathCount(GpPathIterator* iterator, INT* count)
|
||||
{
|
||||
INT i;
|
||||
|
||||
if(!iterator || !count)
|
||||
return InvalidParameter;
|
||||
|
||||
*count = 0;
|
||||
for(i = 0; i < iterator->pathdata.Count; i++){
|
||||
if(iterator->pathdata.Types[i] == PathPointTypeStart)
|
||||
(*count)++;
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount,
|
||||
INT* startIndex, INT* endIndex)
|
||||
{
|
||||
|
|
|
@ -146,6 +146,49 @@ static void test_nextmarker(void)
|
|||
GdipDeletePath(path);
|
||||
}
|
||||
|
||||
static void test_getsubpathcount(void)
|
||||
{
|
||||
GpPath *path;
|
||||
GpPathIterator *iter;
|
||||
GpStatus stat;
|
||||
INT count;
|
||||
|
||||
/* NULL args */
|
||||
stat = GdipPathIterGetSubpathCount(NULL, NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
stat = GdipPathIterGetSubpathCount(NULL, &count);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
GdipCreatePath(FillModeAlternate, &path);
|
||||
|
||||
/* empty path */
|
||||
GdipCreatePathIter(&iter, path);
|
||||
stat = GdipPathIterGetSubpathCount(iter, &count);
|
||||
expect(Ok, stat);
|
||||
expect(0, count);
|
||||
GdipDeletePathIter(iter);
|
||||
|
||||
GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
|
||||
|
||||
/* open figure */
|
||||
GdipCreatePathIter(&iter, path);
|
||||
stat = GdipPathIterGetSubpathCount(iter, &count);
|
||||
expect(Ok, stat);
|
||||
expect(1, count);
|
||||
GdipDeletePathIter(iter);
|
||||
|
||||
/* manually start new figure */
|
||||
GdipStartPathFigure(path);
|
||||
GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
|
||||
GdipCreatePathIter(&iter, path);
|
||||
stat = GdipPathIterGetSubpathCount(iter, &count);
|
||||
expect(Ok, stat);
|
||||
expect(2, count);
|
||||
GdipDeletePathIter(iter);
|
||||
|
||||
GdipDeletePath(path);
|
||||
}
|
||||
|
||||
START_TEST(pathiterator)
|
||||
{
|
||||
struct GdiplusStartupInput gdiplusStartupInput;
|
||||
|
@ -161,6 +204,7 @@ START_TEST(pathiterator)
|
|||
test_constructor_destructor();
|
||||
test_hascurve();
|
||||
test_nextmarker();
|
||||
test_getsubpathcount();
|
||||
|
||||
GdiplusShutdown(gdiplusToken);
|
||||
}
|
||||
|
|
|
@ -285,6 +285,7 @@ GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator*,INT*,INT*,INT*);
|
|||
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL*);
|
||||
GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*);
|
||||
GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator*,INT*);
|
||||
GpStatus WINGDIPAPI GdipPathIterGetSubpathCount(GpPathIterator*,INT*);
|
||||
GpStatus WINGDIPAPI GdipPathIterEnumerate(GpPathIterator*,INT*,GpPointF*,BYTE*,INT);
|
||||
GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator*,BOOL*);
|
||||
|
||||
|
|
Loading…
Reference in New Issue