gdiplus: Implemented GdipPathIterHasCurve with tests.

This commit is contained in:
Nikolay Sivov 2008-07-03 18:34:36 +04:00 committed by Alexandre Julliard
parent 70218092bb
commit c47b167657
4 changed files with 60 additions and 1 deletions

View file

@ -454,7 +454,7 @@
@ stdcall GdipPathIterEnumerate(ptr ptr ptr ptr long)
@ stdcall GdipPathIterGetCount(ptr ptr)
@ stub GdipPathIterGetSubpathCount
@ stub GdipPathIterHasCurve
@ stdcall GdipPathIterHasCurve(ptr ptr)
@ stub GdipPathIterIsValid
@ stub GdipPathIterNextMarker
@ stub GdipPathIterNextMarkerPath

View file

@ -87,6 +87,24 @@ GpStatus WINGDIPAPI GdipPathIterCopyData(GpPathIterator* iterator,
return Ok;
}
GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurve)
{
INT i;
if(!iterator)
return InvalidParameter;
*hasCurve = FALSE;
for(i = 0; i < iterator->pathdata.Count; i++)
if((iterator->pathdata.Types[i] & PathPointTypePathTypeMask) == PathPointTypeBezier){
*hasCurve = TRUE;
break;
}
return Ok;
}
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator* iterator,
INT *resultCount, INT* startIndex, INT* endIndex, BOOL* isClosed)
{

View file

@ -51,6 +51,45 @@ static void test_constructor_destructor(void)
GdipDeletePath(path);
}
static void test_hascurve(void)
{
GpPath *path;
GpPathIterator *iter;
GpStatus stat;
BOOL hasCurve;
GdipCreatePath(FillModeAlternate, &path);
GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
stat = GdipCreatePathIter(&iter, path);
expect(Ok, stat);
/* NULL args
BOOL out argument is local in wrapper class method,
so it always has not-NULL address */
stat = GdipPathIterHasCurve(NULL, &hasCurve);
expect(InvalidParameter, stat);
/* valid args */
stat = GdipPathIterHasCurve(iter, &hasCurve);
expect(Ok, stat);
expect(FALSE, hasCurve);
GdipDeletePathIter(iter);
GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0);
stat = GdipCreatePathIter(&iter, path);
expect(Ok, stat);
stat = GdipPathIterHasCurve(iter, &hasCurve);
expect(Ok, stat);
expect(TRUE, hasCurve);
GdipDeletePathIter(iter);
GdipDeletePath(path);
}
START_TEST(pathiterator)
{
struct GdiplusStartupInput gdiplusStartupInput;
@ -64,6 +103,7 @@ START_TEST(pathiterator)
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
test_hascurve();
GdiplusShutdown(gdiplusToken);
}

View file

@ -285,6 +285,7 @@ GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL*
GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*);
GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator*,INT*);
GpStatus WINGDIPAPI GdipPathIterEnumerate(GpPathIterator*,INT*,GpPointF*,BYTE*,INT);
GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator*,BOOL*);
GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap*,GpCustomLineCap**);
GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath*,GpPath*,GpLineCap,REAL,