ReactOS 0.4.17-dev-243-g1369312
pathiterator.c File Reference
#include "objbase.h"
#include "gdiplus.h"
#include "wine/test.h"
Include dependency graph for pathiterator.c:

Go to the source code of this file.

Macros

#define expect(expected, got)   ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
 

Functions

static void test_constructor_destructor (void)
 
static void test_hascurve (void)
 
static void test_nextmarker (void)
 
static void test_nextmarkerpath (void)
 
static void test_getsubpathcount (void)
 
static void test_isvalid (void)
 
static void test_nextsubpathpath (void)
 
static void test_nextsubpath (void)
 
static void test_nextpathtype (void)
 
 START_TEST (pathiterator)
 

Macro Definition Documentation

◆ expect

#define expect (   expected,
  got 
)    ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)

Definition at line 25 of file pathiterator.c.

Function Documentation

◆ START_TEST()

START_TEST ( pathiterator  )

Definition at line 789 of file pathiterator.c.

790{
791 struct GdiplusStartupInput gdiplusStartupInput;
792 ULONG_PTR gdiplusToken;
793 HMODULE hmsvcrt;
794 int (CDECL * _controlfp_s)(unsigned int *cur, unsigned int newval, unsigned int mask);
795
796 /* Enable all FP exceptions except _EM_INEXACT, which gdi32 can trigger */
797 hmsvcrt = LoadLibraryA("msvcrt");
798 _controlfp_s = (void*)GetProcAddress(hmsvcrt, "_controlfp_s");
799 if (_controlfp_s) _controlfp_s(0, 0, 0x0008001e);
800
801 gdiplusStartupInput.GdiplusVersion = 1;
802 gdiplusStartupInput.DebugEventCallback = NULL;
803 gdiplusStartupInput.SuppressBackgroundThread = 0;
804 gdiplusStartupInput.SuppressExternalCodecs = 0;
805
806 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
807
813 test_isvalid();
817
818 GdiplusShutdown(gdiplusToken);
819}
#define NULL
Definition: types.h:112
#define CDECL
Definition: compat.h:29
#define GetProcAddress(x, y)
Definition: compat.h:753
HINSTANCE WINAPI DECLSPEC_HOTPATCH LoadLibraryA(LPCSTR lpLibFileName)
Definition: loader.c:111
_ACRTIMP errno_t __cdecl _controlfp_s(unsigned int *, unsigned int, unsigned int)
Definition: math.c:1304
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
FxCollectionEntry * cur
Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
Definition: gdiplus.c:83
void WINAPI GdiplusShutdown(ULONG_PTR)
GLenum GLint GLuint mask
Definition: glext.h:6028
static void test_nextsubpathpath(void)
Definition: pathiterator.c:349
static void test_nextmarkerpath(void)
Definition: pathiterator.c:179
static void test_nextsubpath(void)
Definition: pathiterator.c:462
static void test_nextmarker(void)
Definition: pathiterator.c:97
static void test_hascurve(void)
Definition: pathiterator.c:57
static void test_getsubpathcount(void)
Definition: pathiterator.c:262
static void test_isvalid(void)
Definition: pathiterator.c:305
static void test_nextpathtype(void)
Definition: pathiterator.c:505
static void test_constructor_destructor(void)
Definition: pathiterator.c:27
uint32_t ULONG_PTR
Definition: typedefs.h:65

◆ test_constructor_destructor()

static void test_constructor_destructor ( void  )
static

Definition at line 27 of file pathiterator.c.

28{
29 GpPath *path;
30 GpPathIterator *iter;
32
34 GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
35
36 /* NULL args */
39 iter = NULL;
41 expect(Ok, stat);
42 ok(iter != NULL, "Expected iterator to be created\n");
48
49 /* valid args */
51 expect(Ok, stat);
52
55}
#define stat
Definition: acwin.h:100
#define ok(value,...)
Definition: atltest.h:57
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height)
GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator *iter)
Definition: pathiterator.c:69
GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator **iterator, GpPath *path)
Definition: pathiterator.c:34
@ FillModeAlternate
Definition: gdiplusenums.h:55
Status
Definition: gdiplustypes.h:24
@ Ok
Definition: gdiplustypes.h:25
@ InvalidParameter
Definition: gdiplustypes.h:27
#define expect(expected, got)
Definition: pathiterator.c:25
Definition: stat.h:66

Referenced by START_TEST().

◆ test_getsubpathcount()

static void test_getsubpathcount ( void  )
static

Definition at line 262 of file pathiterator.c.

263{
264 GpPath *path;
265 GpPathIterator *iter;
267 INT count;
268
269 /* NULL args */
274
276
277 /* empty path */
278 GdipCreatePathIter(&iter, path);
280 expect(Ok, stat);
281 expect(0, count);
282 GdipDeletePathIter(iter);
283
284 GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
285
286 /* open figure */
287 GdipCreatePathIter(&iter, path);
289 expect(Ok, stat);
290 expect(1, count);
291 GdipDeletePathIter(iter);
292
293 /* manually start new figure */
295 GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
296 GdipCreatePathIter(&iter, path);
298 expect(Ok, stat);
299 expect(2, count);
300 GdipDeletePathIter(iter);
301
303}
GpStatus WINGDIPAPI GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2)
Definition: graphicspath.c:804
GpStatus WINGDIPAPI GdipStartPathFigure(GpPath *path)
GpStatus WINGDIPAPI GdipPathIterGetSubpathCount(GpPathIterator *iterator, INT *count)
Definition: pathiterator.c:127
GLuint GLuint GLsizei count
Definition: gl.h:1545
int32_t INT
Definition: typedefs.h:58

Referenced by START_TEST().

◆ test_hascurve()

static void test_hascurve ( void  )
static

Definition at line 57 of file pathiterator.c.

58{
59 GpPath *path;
60 GpPathIterator *iter;
62 BOOL hasCurve;
63
65 GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
66
68 expect(Ok, stat);
69
70 /* NULL args
71 BOOL out argument is local in wrapper class method,
72 so it always has not-NULL address */
73 stat = GdipPathIterHasCurve(NULL, &hasCurve);
75
76 /* valid args */
77 stat = GdipPathIterHasCurve(iter, &hasCurve);
78 expect(Ok, stat);
79 expect(FALSE, hasCurve);
80
82
83 stat = GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0);
84 expect(Ok, stat);
85
87 expect(Ok, stat);
88
89 stat = GdipPathIterHasCurve(iter, &hasCurve);
90 expect(Ok, stat);
91 expect(TRUE, hasCurve);
92
95}
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, REAL height)
Definition: graphicspath.c:703
GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator *iterator, BOOL *hasCurve)
Definition: pathiterator.c:107
unsigned int BOOL
Definition: ntddk_ex.h:94

Referenced by START_TEST().

◆ test_isvalid()

static void test_isvalid ( void  )
static

Definition at line 305 of file pathiterator.c.

306{
307 GpPath *path;
308 GpPathIterator *iter;
310 BOOL isvalid;
312
314
315 /* NULL args */
316 GdipCreatePathIter(&iter, path);
321 stat = GdipPathIterIsValid(NULL, &isvalid);
323 GdipDeletePathIter(iter);
324
325 /* on empty path */
326 GdipCreatePathIter(&iter, path);
327 isvalid = FALSE;
328 stat = GdipPathIterIsValid(iter, &isvalid);
329 expect(Ok, stat);
330 expect(TRUE, isvalid);
331 GdipDeletePathIter(iter);
332
333 /* no markers */
334 stat = GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
335 expect(Ok, stat);
336 stat = GdipCreatePathIter(&iter, path);
337 expect(Ok, stat);
339 expect(Ok, stat);
340 isvalid = FALSE;
341 stat = GdipPathIterIsValid(iter, &isvalid);
342 expect(Ok, stat);
343 expect(TRUE, isvalid);
344 GdipDeletePathIter(iter);
345
347}
GpStatus WINGDIPAPI GdipPathIterIsValid(GpPathIterator *iterator, BOOL *valid)
Definition: pathiterator.c:286
GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator *iterator, INT *resultCount, INT *startIndex, INT *endIndex)
Definition: pathiterator.c:145
GLuint start
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLuint64EXT * result
Definition: glext.h:11304

Referenced by START_TEST().

◆ test_nextmarker()

static void test_nextmarker ( void  )
static

Definition at line 97 of file pathiterator.c.

98{
99 GpPath *path;
100 GpPathIterator *iter;
102 INT start, end;
103 INT result;
104
105 /* NULL args
106 BOOL out argument is local in wrapper class method,
107 so it always has not-NULL address */
114
116 GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
117
118 /* no markers */
119 GdipCreatePathIter(&iter, path);
120 start = end = result = (INT)0xdeadbeef;
122 expect(Ok, stat);
123 expect(0, start);
124 expect(3, end);
125 expect(4, result);
126 start = end = result = (INT)0xdeadbeef;
128 expect(Ok, stat);
129 /* start/end remain unchanged */
130 expect((INT)0xdeadbeef, start);
131 expect((INT)0xdeadbeef, end);
132 expect(0, result);
133 GdipDeletePathIter(iter);
134
135 /* one marker */
137 GdipCreatePathIter(&iter, path);
138 start = end = result = (INT)0xdeadbeef;
140 expect(Ok, stat);
141 expect(0, start);
142 expect(3, end);
143 expect(4, result);
144 start = end = result = (INT)0xdeadbeef;
146 expect(Ok, stat);
147 expect((INT)0xdeadbeef, start);
148 expect((INT)0xdeadbeef, end);
149 expect(0, result);
150 GdipDeletePathIter(iter);
151
152 /* two markers */
153 GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
155 GdipCreatePathIter(&iter, path);
156 start = end = result = (INT)0xdeadbeef;
158 expect(Ok, stat);
159 expect(0, start);
160 expect(3, end);
161 expect(4, result);
162 start = end = result = (INT)0xdeadbeef;
164 expect(Ok, stat);
165 expect(4, start);
166 expect(5, end);
167 expect(2, result);
168 start = end = result = (INT)0xdeadbeef;
170 expect(Ok, stat);
171 expect((INT)0xdeadbeef, start);
172 expect((INT)0xdeadbeef, end);
173 expect(0, result);
174 GdipDeletePathIter(iter);
175
177}
GpStatus WINGDIPAPI GdipSetPathMarker(GpPath *path)
#define INT
Definition: polytest.cpp:20

Referenced by START_TEST().

◆ test_nextmarkerpath()

static void test_nextmarkerpath ( void  )
static

Definition at line 179 of file pathiterator.c.

180{
181 GpPath *path, *retpath;
182 GpPathIterator *iter;
185
187
188 /* NULL */
195
196 GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
197
198 /* no markers */
200 GdipCreatePathIter(&iter, path);
201 result = -1;
202 stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
203 expect(Ok, stat);
204 expect(4, result);
205 count = -1;
206 GdipGetPointCount(retpath, &count);
207 expect(4, count);
208 result = -1;
209 stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
210 expect(Ok, stat);
211 expect(0, result);
212 count = -1;
213 GdipGetPointCount(retpath, &count);
214 expect(4, count);
215 GdipDeletePathIter(iter);
216 GdipDeletePath(retpath);
217
218 /* one marker */
221 GdipCreatePathIter(&iter, path);
222 result = -1;
223 stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
224 expect(Ok, stat);
225 expect(4, result);
226 count = -1;
227 GdipGetPointCount(retpath, &count);
228 expect(4, count);
229 result = -1;
230 stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
231 expect(Ok, stat);
232 expect(0, result);
233 count = -1;
234 GdipGetPointCount(retpath, &count);
235 expect(4, count);
236 GdipDeletePathIter(iter);
237 GdipDeletePath(retpath);
238
239 /* two markers */
240 GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
243 GdipCreatePathIter(&iter, path);
244 result = -1;
245 stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
246 expect(Ok, stat);
247 expect(4, result);
248 result = -1;
249 stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
250 expect(Ok, stat);
251 expect(2, result);
252 result = -1;
253 stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
254 expect(Ok, stat);
255 expect(0, result);
256 GdipDeletePathIter(iter);
257 GdipDeletePath(retpath);
258
260}
GpStatus WINGDIPAPI GdipGetPointCount(GpPath *path, INT *count)
GpStatus WINGDIPAPI GdipPathIterNextMarkerPath(GpPathIterator *iterator, INT *result, GpPath *path)
Definition: pathiterator.c:173

Referenced by START_TEST().

◆ test_nextpathtype()

static void test_nextpathtype ( void  )
static

Definition at line 505 of file pathiterator.c.

506{
507 GpPath *path;
508 GpPathIterator *iter;
511 BYTE type;
512 BOOL closed;
514
516 GdipCreatePathIter(&iter, path);
517
518 /* NULL arguments */
533
534 /* empty path */
535 result = start = end = (INT)0xdeadbeef;
536 type = 255; /* out of range */
538 expect(Ok, stat);
539 expect(0, result);
540 expect(255, type);
541 expect((INT)0xdeadbeef, start);
542 expect((INT)0xdeadbeef, end);
543 GdipDeletePathIter(iter);
544
545
546 /* Single PathPointTypeStart point */
547 point.X = 1.0;
548 point.Y = 2.0;
550 expect(Ok, stat);
551 stat = GdipCreatePathIter(&iter, path);
552 expect(Ok, stat);
553
554 result = start = end = closed = (INT)0xdeadbeef;
555 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
556 expect(Ok, stat);
557 expect(1, result);
558 expect(0, start);
559 expect(0, end);
560 expect(FALSE, closed);
561
562 result = start = end = (INT)0xdeadbeef;
563 type = 255; /* out of range */
565 expect(Ok, stat);
566 expect(1, result);
567 expect(255, type);
568 expect(0, start);
569 expect(0, end);
570
571 GdipDeletePathIter(iter);
573
574
575 /* Figure with three subpaths */
577 stat = GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
578 expect(Ok, stat);
579 stat = GdipAddPathRectangle(path, 1.0, 2.0, 3.0, 4.0);
580 expect(Ok, stat);
581 stat = GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0);
582 expect(Ok, stat);
583 stat = GdipCreatePathIter(&iter, path);
584 expect(Ok, stat);
585
586 /* When subPath is not set,
587 it is not possible to get Path Type */
588 result = start = end = (INT)0xdeadbeef;
589 type = 255; /* out of range */
591 expect(Ok, stat);
592 expect(0, result);
593 expect(255, type);
594 expect((INT)0xdeadbeef, start);
595 expect((INT)0xdeadbeef, end);
596
597 /* When subPath is not set,
598 it is possible to get number of path points */
600 expect(Ok, stat);
601 expect(19, count);
602
603 /* Set subPath (Line) */
604 result = start = end = closed = (INT)0xdeadbeef;
605 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
606 expect(Ok, stat);
607 expect(2, result);
608 expect(0, start);
609 expect(1, end);
610 expect(FALSE, closed);
611
612 /* When subPath is set (Line), return position of points with the same type */
613 result = start = end = (INT)0xdeadbeef;
614 type = 255; /* out of range */
616 expect(Ok, stat);
617 expect(2, result);
619 expect(0, start);
620 expect(1, end);
621
622 /* When NextSubpath is running twice, without invocation NextPathType
623 (skipping Rectangle figure), make sure that PathType index is updated */
624 result = start = end = closed = (INT)0xdeadbeef;
625 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
626 expect(Ok, stat);
627 expect(4, result);
628 expect(2, start);
629 expect(5, end);
630 expect(TRUE, closed);
631
632 /* Increment subPath (to Ellipse figure) */
633 result = start = end = closed = (INT)0xdeadbeef;
634 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
635 expect(Ok, stat);
636 expect(13, result);
637 expect(6, start);
638 expect(18, end);
639 expect(TRUE, closed);
640
641 /* When subPath is set to Ellipse figure, the type is PathPointTypeBezier */
642 result = start = end = (INT)0xdeadbeef;
643 type = 255; /* out of range */
645 expect(Ok, stat);
646 expect(13, result);
648 expect(6, start);
649 expect(18, end);
650
651 /* As there is no more subpaths, when subPath is incremented,
652 it returns zeros */
653 result = start = end = closed = (INT)0xdeadbeef;
654 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
655 expect(Ok, stat);
656 expect(0, result);
657 expect(0, start);
658 expect(0, end);
659 expect(TRUE, closed);
660
661 /* When no more elements, after invoking NextPathType
662 the output numbers are not changed */
663 start = end = result = (INT)0xdeadbeef;
664 type = 255; /* out of range */
666 expect(Ok, stat);
667 expect(0, result);
668 expect(255, type);
669 expect((INT)0xdeadbeef, start);
670 expect((INT)0xdeadbeef, end);
671
672 GdipDeletePathIter(iter);
674
675
676 /* Single PathPointTypeStart point */
678 point.X = 1.0;
679 point.Y = 2.0;
681 expect(Ok, stat);
682 stat = GdipCreatePathIter(&iter, path);
683 expect(Ok, stat);
684
685 result = start = end = closed = (INT)0xdeadbeef;
686 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
687 expect(Ok, stat);
688 expect(1, result);
689 expect(0, start);
690 expect(0, end);
691 expect(FALSE, closed);
692
693 result = start = end = (INT)0xdeadbeef;
694 type = 255; /* out of range */
696 expect(Ok, stat);
697 expect(1, result);
698 expect(255, type);
699 expect(0, start);
700 expect(0, end);
701
702 GdipDeletePathIter(iter);
704
705
706 /* Mixed PathPointTypeLine and PathPointTypeBezier points */
708 stat = GdipAddPathLine(path, -1.0, 1.0, 10.0, 15.0);
709 expect(Ok, stat);
710 /* Starting point of Bezier figure, is the same
711 as ending point of previous figure (10.0, 15.0) */
712 stat = GdipAddPathBezier(path, 10.0, 15.0, 9.0, 9.0, 6.0, 7.0, 9.0, 0.0);
713 expect(Ok, stat);
714 /* Starting point of figure, is different that ending point of previous figure */
715 stat = GdipAddPathLine(path, -1.0, -1.0, 7.5, 12.0);
716 expect(Ok, stat);
718 expect(Ok, stat);
719 stat = GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
720 expect(Ok, stat);
721 stat = GdipCreatePathIter(&iter, path);
722 expect(Ok, stat);
723
724 result = start = end = closed = (INT)0xdeadbeef;
725 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
726 expect(Ok, stat);
727 expect(7, result);
728 expect(0, start);
729 expect(6, end);
730 expect(FALSE, closed);
731
732 result = start = end = (INT)0xdeadbeef;
733 type = 255; /* out of range */
735 expect(Ok, stat);
736 expect(2, result);
738 expect(0, start);
739 expect(1, end);
740
741 result = start = end = (INT)0xdeadbeef;
742 type = 255; /* out of range */
744 expect(Ok, stat);
745 expect(4, result);
747 expect(1, start);
748 expect(4, end);
749
750 result = start = end = (INT)0xdeadbeef;
751 type = 255; /* out of range */
753 expect(Ok, stat);
754 expect(3, result);
756 expect(4, start);
757 expect(6, end);
758
759 result = start = end = (INT)0xdeadbeef;
760 type = 255; /* out of range */
762 expect(Ok, stat);
763 expect(0, result);
764 expect(255, type);
765 expect((INT)0xdeadbeef, start);
766 expect((INT)0xdeadbeef, end);
767
768 result = start = end = closed = (INT)0xdeadbeef;
769 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
770 expect(Ok, stat);
771 expect(2, result);
772 expect(7, start);
773 expect(8, end);
774 expect(FALSE, closed);
775
776 result = start = end = (INT)0xdeadbeef;
777 type = 255; /* out of range */
779 expect(Ok, stat);
780 expect(2, result);
782 expect(7, start);
783 expect(8, end);
784
785 GdipDeletePathIter(iter);
787}
GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:743
GpStatus WINGDIPAPI GdipAddPathBezier(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2, REAL x3, REAL y3, REAL x4, REAL y4)
Definition: graphicspath.c:396
GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator *iterator, INT *count)
Definition: pathiterator.c:258
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator *iterator, INT *resultCount, INT *startIndex, INT *endIndex, BOOL *isClosed)
Definition: pathiterator.c:199
GpStatus WINGDIPAPI GdipPathIterNextPathType(GpPathIterator *iter, INT *result, BYTE *type, INT *start, INT *end)
Definition: pathiterator.c:298
POINTL point
Definition: edittest.c:50
@ PathPointTypeBezier
Definition: gdiplusenums.h:85
@ PathPointTypeLine
Definition: gdiplusenums.h:84
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_nextsubpath()

static void test_nextsubpath ( void  )
static

Definition at line 462 of file pathiterator.c.

463{
464 GpPath *path;
465 GpPathIterator *iter;
468 BOOL closed;
469
470 /* empty path */
472 GdipCreatePathIter(&iter, path);
473
474 result = start = end = closed = (INT)0xdeadbeef;
475 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
476 expect(Ok, stat);
477 expect(0, result);
478 expect((INT)0xdeadbeef, start);
479 expect((INT)0xdeadbeef, end);
480 expect((INT)0xdeadbeef, closed);
481
482 /* four points figure */
483 GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
484 GdipAddPathLine(path, -10.0, 5.0, 15.0, 8.0);
485 GdipCreatePathIter(&iter, path);
486 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
487 expect(Ok, stat);
488 expect(4, result);
489 expect(0, start);
490 expect(3, end);
491 expect(FALSE, closed);
492
493 /* No more subpaths*/
494 stat = GdipPathIterNextSubpath(iter, &result, &start, &end, &closed);
495 expect(Ok, stat);
496 expect(0, result);
497 expect(0, start);
498 expect(0, end);
499 expect(TRUE, closed);
500
501 GdipDeletePathIter(iter);
503}

Referenced by START_TEST().

◆ test_nextsubpathpath()

static void test_nextsubpathpath ( void  )
static

Definition at line 349 of file pathiterator.c.

350{
351 GpPath *path, *retpath;
352 GpPathIterator *iter;
354 BOOL closed;
356
358
359 /* NULL args */
361 GdipCreatePathIter(&iter, path);
368 stat = GdipPathIterNextSubpathPath(iter, &result, NULL, &closed);
369 expect(Ok, stat);
370 stat = GdipPathIterNextSubpathPath(iter, NULL, NULL, &closed);
372 stat = GdipPathIterNextSubpathPath(iter, NULL, retpath, NULL);
374 stat = GdipPathIterNextSubpathPath(iter, &result, retpath, NULL);
376 GdipDeletePathIter(iter);
377 GdipDeletePath(retpath);
378
379 /* empty path */
381 GdipCreatePathIter(&iter, path);
382 result = -2;
383 closed = TRUE;
384 stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
385 expect(Ok, stat);
386 expect(0, result);
387 expect(TRUE, closed);
388 count = -1;
389 GdipGetPointCount(retpath, &count);
390 expect(0, count);
391 GdipDeletePathIter(iter);
392 GdipDeletePath(retpath);
393
394 /* open figure */
395 GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
396
398 GdipCreatePathIter(&iter, path);
399 result = -2;
400 closed = TRUE;
401 stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
402 expect(Ok, stat);
403 expect(2, result);
404 expect(FALSE, closed);
405 count = -1;
406 GdipGetPointCount(retpath, &count);
407 expect(2, count);
408 /* subsequent call */
409 result = -2;
410 closed = TRUE;
411 stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
412 expect(Ok, stat);
413 expect(0, result);
414 expect(TRUE, closed);
415 count = -1;
416 GdipGetPointCount(retpath, &count);
417 expect(2, count);
418 GdipDeletePathIter(iter);
419
420 /* closed figure, check does it extend retpath or reset it */
421 GdipAddPathLine(retpath, 50.0, 55.0, 200.0, 150.0);
422
424 GdipAddPathLine(path, 50.0, 55.0, 200.0, 150.0);
426
427 GdipCreatePathIter(&iter, path);
428 result = -2;
429 closed = FALSE;
430 stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
431 expect(Ok, stat);
432 expect(2, result);
433 expect(TRUE, closed);
434 count = -1;
435 GdipGetPointCount(retpath, &count);
436 expect(2, count);
437 /* subsequent call */
438 result = -2;
439 closed = FALSE;
440 stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
441 expect(Ok, stat);
442 expect(2, result);
443 expect(TRUE, closed);
444 count = -1;
445 GdipGetPointCount(retpath, &count);
446 expect(2, count);
447 result = -2;
448 closed = FALSE;
449 stat = GdipPathIterNextSubpathPath(iter, &result, retpath, &closed);
450 expect(Ok, stat);
451 expect(0, result);
452 expect(TRUE, closed);
453 count = -1;
454 GdipGetPointCount(retpath, &count);
455 expect(2, count);
456 GdipDeletePathIter(iter);
457
458 GdipDeletePath(retpath);
460}
GpStatus WINGDIPAPI GdipClosePathFigure(GpPath *path)
GpStatus WINGDIPAPI GdipPathIterNextSubpathPath(GpPathIterator *iter, INT *result, GpPath *path, BOOL *closed)
Definition: pathiterator.c:333

Referenced by START_TEST().