2 * Unit test suite for paths
4 * Copyright (C) 2007 Google (Evan Stade)
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23 #include "wine/test.h"
26 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
27 #define expectf(expected, got) ok(fabs(expected - got) < 2.0, "Expected %.2f, got %.2f\n", expected, got)
28 #define POINT_TYPE_MAX_LEN (75)
30 static void stringify_point_type(PathPointType type
, char * name
)
34 switch(type
& PathPointTypePathTypeMask
){
35 case PathPointTypeStart
:
36 strcat(name
, "PathPointTypeStart");
38 case PathPointTypeLine
:
39 strcat(name
, "PathPointTypeLine");
41 case PathPointTypeBezier
:
42 strcat(name
, "PathPointTypeBezier");
45 strcat(name
, "Unknown type");
49 type
&= ~PathPointTypePathTypeMask
;
50 if(type
& ~((PathPointTypePathMarker
| PathPointTypeCloseSubpath
))){
52 strcat(name
, "Unknown type");
56 if(type
& PathPointTypePathMarker
)
57 strcat(name
, " | PathPointTypePathMarker");
58 if(type
& PathPointTypeCloseSubpath
)
59 strcat(name
, " | PathPointTypeCloseSubpath");
62 /* this helper structure and function modeled after gdi path.c test */
68 /* How many extra entries before this one only on wine
69 * but not on native? */
70 int wine_only_entries_preceding
;
72 /* 0 - This entry matches on wine.
73 * 1 - This entry corresponds to a single entry on wine that does not match the native entry.
74 * 2 - This entry is currently skipped on wine but present on native. */
78 static void ok_path(GpPath
* path
, const path_test_t
*expected
, INT expected_size
, BOOL todo_size
)
81 INT size
, idx
= 0, eidx
= 0, numskip
;
83 char ename
[POINT_TYPE_MAX_LEN
], name
[POINT_TYPE_MAX_LEN
];
85 if(GdipGetPointCount(path
, &size
) != Ok
){
86 skip("Cannot perform path comparisons due to failure to retrieve path.\n");
90 if(todo_size
) todo_wine
91 ok(size
== expected_size
, "Path size %d does not match expected size %d\n",
94 ok(size
== expected_size
, "Path size %d does not match expected size %d\n",
97 points
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(GpPointF
));
98 types
= HeapAlloc(GetProcessHeap(), 0, size
);
100 if(GdipGetPathPoints(path
, points
, size
) != Ok
|| GdipGetPathTypes(path
, types
, size
) != Ok
){
101 skip("Cannot perform path comparisons due to failure to retrieve path.\n");
105 numskip
= expected_size
? expected
[eidx
].wine_only_entries_preceding
: 0;
106 while (idx
< size
&& eidx
< expected_size
){
107 /* We allow a few pixels fudge in matching X and Y coordinates to account for imprecision in
108 * floating point to integer conversion */
109 BOOL match
= (types
[idx
] == expected
[eidx
].type
) &&
110 fabs(points
[idx
].X
- expected
[eidx
].X
) <= 2.0 &&
111 fabs(points
[idx
].Y
- expected
[eidx
].Y
) <= 2.0;
113 stringify_point_type(expected
[eidx
].type
, ename
);
114 stringify_point_type(types
[idx
], name
);
116 if (expected
[eidx
].todo
|| numskip
) todo_wine
117 ok(match
, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx
,
118 ename
, expected
[eidx
].X
, expected
[eidx
].Y
,
119 name
, points
[idx
].X
, points
[idx
].Y
);
121 ok(match
, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx
,
122 ename
, expected
[eidx
].X
, expected
[eidx
].Y
,
123 name
, points
[idx
].X
, points
[idx
].Y
);
125 if (match
|| expected
[eidx
].todo
!= 2)
127 if (match
|| !numskip
--)
128 numskip
= expected
[++eidx
].wine_only_entries_preceding
;
132 HeapFree(GetProcessHeap(), 0, types
);
133 HeapFree(GetProcessHeap(), 0, points
);
136 static void test_constructor_destructor(void)
141 status
= GdipCreatePath(FillModeAlternate
, &path
);
143 ok(path
!= NULL
, "Expected path to be initialized\n");
145 status
= GdipDeletePath(NULL
);
146 expect(InvalidParameter
, status
);
148 status
= GdipDeletePath(path
);
152 static void test_getpathdata(void)
158 GdipCreatePath(FillModeAlternate
, &path
);
159 status
= GdipAddPathLine(path
, 5.0, 5.0, 100.0, 50.0);
162 status
= GdipGetPathData(path
, &data
);
164 expect((data
.Count
== 2), TRUE
);
165 expect((data
.Points
[0].X
== 5.0) && (data
.Points
[0].Y
== 5.0) &&
166 (data
.Points
[1].X
== 100.0) && (data
.Points
[1].Y
== 50.0), TRUE
);
167 expect((data
.Types
[0] == PathPointTypeStart
) && (data
.Types
[1] == PathPointTypeLine
), TRUE
);
169 GdipFree(data
.Points
);
170 GdipFree(data
.Types
);
171 GdipDeletePath(path
);
174 static path_test_t line2_path
[] = {
175 {0.0, 50.0, PathPointTypeStart
, 0, 0}, /*0*/
176 {5.0, 45.0, PathPointTypeLine
, 0, 0}, /*1*/
177 {0.0, 40.0, PathPointTypeLine
, 0, 0}, /*2*/
178 {15.0, 35.0, PathPointTypeLine
, 0, 0}, /*3*/
179 {0.0, 30.0, PathPointTypeLine
, 0, 0}, /*4*/
180 {25.0, 25.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0}, /*5*/
181 {0.0, 20.0, PathPointTypeStart
, 0, 0}, /*6*/
182 {35.0, 15.0, PathPointTypeLine
, 0, 0}, /*7*/
183 {0.0, 10.0, PathPointTypeLine
, 0, 0} /*8*/
186 static void test_line2(void)
191 GpPointF line2_points
[9];
193 for(i
= 0; i
< 9; i
++){
194 line2_points
[i
].X
= i
* 5.0 * (REAL
)(i
% 2);
195 line2_points
[i
].Y
= 50.0 - i
* 5.0;
198 GdipCreatePath(FillModeAlternate
, &path
);
199 status
= GdipAddPathLine2(path
, line2_points
, 3);
201 status
= GdipAddPathLine2(path
, &(line2_points
[3]), 3);
203 status
= GdipClosePathFigure(path
);
205 status
= GdipAddPathLine2(path
, &(line2_points
[6]), 3);
208 ok_path(path
, line2_path
, sizeof(line2_path
)/sizeof(path_test_t
), FALSE
);
211 static path_test_t arc_path
[] = {
212 {600.0, 450.0, PathPointTypeStart
, 0, 0}, /*0*/
213 {600.0, 643.3, PathPointTypeBezier
, 0, 0}, /*1*/
214 {488.1, 800.0, PathPointTypeBezier
, 0, 0}, /*2*/
215 {350.0, 800.0, PathPointTypeBezier
, 0, 0}, /*3*/
216 {600.0, 450.0, PathPointTypeLine
, 0, 0}, /*4*/
217 {600.0, 643.3, PathPointTypeBezier
, 0, 0}, /*5*/
218 {488.1, 800.0, PathPointTypeBezier
, 0, 0}, /*6*/
219 {350.0, 800.0, PathPointTypeBezier
, 0, 0}, /*7*/
220 {329.8, 800.0, PathPointTypeBezier
, 0, 0}, /*8*/
221 {309.7, 796.6, PathPointTypeBezier
, 0, 0}, /*9*/
222 {290.1, 789.8, PathPointTypeBezier
, 0, 0}, /*10*/
223 {409.9, 110.2, PathPointTypeLine
, 0, 0}, /*11*/
224 {544.0, 156.5, PathPointTypeBezier
, 0, 0}, /*12*/
225 {625.8, 346.2, PathPointTypeBezier
, 0, 0}, /*13*/
226 {592.7, 533.9, PathPointTypeBezier
, 0, 0}, /*14*/
227 {592.5, 535.3, PathPointTypeBezier
, 0, 0}, /*15*/
228 {592.2, 536.7, PathPointTypeBezier
, 0, 0}, /*16*/
229 {592.0, 538.1, PathPointTypeBezier
, 0, 0}, /*17*/
230 {409.9, 789.8, PathPointTypeLine
, 0, 0}, /*18*/
231 {544.0, 743.5, PathPointTypeBezier
, 0, 0}, /*19*/
232 {625.8, 553.8, PathPointTypeBezier
, 0, 0}, /*20*/
233 {592.7, 366.1, PathPointTypeBezier
, 0, 0}, /*21*/
234 {592.5, 364.7, PathPointTypeBezier
, 0, 0}, /*22*/
235 {592.2, 363.3, PathPointTypeBezier
, 0, 0}, /*23*/
236 {592.0, 361.9, PathPointTypeBezier
, 0, 0}, /*24*/
237 {540.4, 676.9, PathPointTypeLine
, 0, 0}, /*25*/
238 {629.9, 529.7, PathPointTypeBezier
, 0, 0}, /*26*/
239 {617.2, 308.8, PathPointTypeBezier
, 0, 0}, /*27*/
240 {512.1, 183.5, PathPointTypeBezier
, 0, 0}, /*28*/
241 {406.9, 58.2, PathPointTypeBezier
, 0, 0}, /*29*/
242 {249.1, 75.9, PathPointTypeBezier
, 0, 0}, /*30*/
243 {159.6, 223.1, PathPointTypeBezier
, 0, 0}, /*31*/
244 {70.1, 370.3, PathPointTypeBezier
, 0, 0}, /*32*/
245 {82.8, 591.2, PathPointTypeBezier
, 0, 0}, /*33*/
246 {187.9, 716.5, PathPointTypeBezier
, 0, 0}, /*34*/
247 {293.1, 841.8, PathPointTypeBezier
, 0, 0}, /*35*/
248 {450.9, 824.1, PathPointTypeBezier
, 0, 0}, /*36*/
249 {540.4, 676.9, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 1} /*37*/
252 static void test_arc(void)
257 GdipCreatePath(FillModeAlternate
, &path
);
258 /* Exactly 90 degrees */
259 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
261 /* Over 90 degrees */
262 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
264 /* Negative start angle */
265 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
267 /* Negative sweep angle */
268 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 80.0, -100.0);
270 /* More than a full revolution */
271 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 50.0, -400.0);
274 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0);
277 ok_path(path
, arc_path
, sizeof(arc_path
)/sizeof(path_test_t
), FALSE
);
280 static void test_worldbounds(void)
287 GpPointF line2_points
[10];
290 for(i
= 0; i
< 10; i
++){
291 line2_points
[i
].X
= 200.0 + i
* 50.0 * (i
% 2);
292 line2_points
[i
].Y
= 200.0 + i
* 50.0 * !(i
% 2);
294 GdipCreatePen1((ARGB
)0xdeadbeef, 20.0, UnitWorld
, &pen
);
295 GdipSetPenEndCap(pen
, LineCapSquareAnchor
);
296 GdipCreateMatrix2(1.5, 0.0, 1.0, 1.2, 10.4, 10.2, &matrix
);
298 GdipCreatePath(FillModeAlternate
, &path
);
299 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
300 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
301 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, NULL
);
303 GdipDeletePath(path
);
305 expectf(200.0, bounds
.X
);
306 expectf(200.0, bounds
.Y
);
307 expectf(450.0, bounds
.Width
);
308 expectf(600.0, bounds
.Height
);
310 GdipCreatePath(FillModeAlternate
, &path
);
311 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
312 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
313 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, NULL
);
315 GdipDeletePath(path
);
317 expectf(510.4, bounds
.X
);
318 expectf(250.2, bounds
.Y
);
319 expectf(1275.0, bounds
.Width
);
320 expectf(720.0, bounds
.Height
);
322 GdipCreatePath(FillModeAlternate
, &path
);
323 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
324 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
325 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
327 GdipDeletePath(path
);
329 expectf(100.0, bounds
.X
);
330 expectf(100.0, bounds
.Y
);
331 expectf(650.0, bounds
.Width
);
332 expectf(800.0, bounds
.Height
);
334 GdipCreatePath(FillModeAlternate
, &path
);
335 GdipAddPathLine2(path
, &(line2_points
[0]), 2);
336 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
338 GdipDeletePath(path
);
340 expectf(156.0, bounds
.X
);
341 expectf(156.0, bounds
.Y
);
342 expectf(138.0, bounds
.Width
);
343 expectf(88.0, bounds
.Height
);
345 line2_points
[2].X
= 2 * line2_points
[1].X
- line2_points
[0].X
;
346 line2_points
[2].Y
= 2 * line2_points
[1].Y
- line2_points
[0].Y
;
348 GdipCreatePath(FillModeAlternate
, &path
);
349 GdipAddPathLine2(path
, &(line2_points
[0]), 3);
350 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
352 GdipDeletePath(path
);
354 expectf(100.0, bounds
.X
);
355 expectf(100.0, bounds
.Y
);
356 expectf(300.0, bounds
.Width
);
357 expectf(200.0, bounds
.Height
);
359 GdipCreatePath(FillModeAlternate
, &path
);
360 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 45.0, 20.0);
361 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
363 GdipDeletePath(path
);
365 expectf(386.7, bounds
.X
);
366 expectf(553.4, bounds
.Y
);
367 expectf(266.8, bounds
.Width
);
368 expectf(289.6, bounds
.Height
);
370 GdipCreatePath(FillModeAlternate
, &path
);
371 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, pen
);
373 GdipDeletePath(path
);
375 expectf(0.0, bounds
.X
);
376 expectf(0.0, bounds
.Y
);
377 expectf(0.0, bounds
.Width
);
378 expectf(0.0, bounds
.Height
);
380 GdipCreatePath(FillModeAlternate
, &path
);
381 GdipAddPathLine2(path
, &(line2_points
[0]), 2);
382 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, pen
);
384 GdipDeletePath(path
);
387 expectf(427.9, bounds
.X
);
388 expectf(167.7, bounds
.Y
);
389 expectf(239.9, bounds
.Width
);
390 expectf(164.9, bounds
.Height
);
393 GdipDeleteMatrix(matrix
);
394 GdipCreateMatrix2(0.9, -0.5, -0.5, -1.2, 10.4, 10.2, &matrix
);
395 GdipCreatePath(FillModeAlternate
, &path
);
396 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
397 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
398 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, NULL
);
400 GdipDeletePath(path
);
402 expectf(-209.6, bounds
.X
);
403 expectf(-1274.8, bounds
.Y
);
404 expectf(705.0, bounds
.Width
);
405 expectf(945.0, bounds
.Height
);
408 static path_test_t pathpath_path
[] = {
409 {600.00, 450.00, PathPointTypeStart
, 0, 0}, /*0*/
410 {600.00, 643.30, PathPointTypeBezier
, 0, 0}, /*1*/
411 {488.07, 800.00, PathPointTypeBezier
, 0, 0}, /*2*/
412 {350.00, 800.00, PathPointTypeBezier
, 0, 0}, /*3*/
413 {319.61, 797.40, PathPointTypeStart
, 0, 0}, /*4*/
414 {182.56, 773.90, PathPointTypeBezier
, 0, 0}, /*5*/
415 {85.07, 599.31, PathPointTypeBezier
, 0, 0}, /*6*/
416 {101.85, 407.45, PathPointTypeBezier
, 0, 0}, /*7*/
417 {102.54, 399.66, PathPointTypeBezier
, 0, 0}, /*8*/
418 {103.40, 391.91, PathPointTypeBezier
, 0, 0}, /*9*/
419 {104.46, 384.21, PathPointTypeBezier
, 0, 0}, /*10*/
420 {409.92, 110.20, PathPointTypeLine
, 0, 0}, /*11*/
421 {543.96, 156.53, PathPointTypeBezier
, 0, 0}, /*12*/
422 {625.80, 346.22, PathPointTypeBezier
, 0, 0}, /*13*/
423 {592.71, 533.88, PathPointTypeBezier
, 0, 0}, /*14*/
424 {592.47, 535.28, PathPointTypeBezier
, 0, 0}, /*15*/
425 {592.22, 536.67, PathPointTypeBezier
, 0, 0}, /*16*/
426 {591.96, 538.06, PathPointTypeBezier
, 0, 0}, /*17*/
427 {319.61, 797.40, PathPointTypeLine
, 0, 0}, /*18*/
428 {182.56, 773.90, PathPointTypeBezier
, 0, 0}, /*19*/
429 {85.07, 599.31, PathPointTypeBezier
, 0, 0}, /*20*/
430 {101.85, 407.45, PathPointTypeBezier
, 0, 0}, /*21*/
431 {102.54, 399.66, PathPointTypeBezier
, 0, 0}, /*22*/
432 {103.40, 391.91, PathPointTypeBezier
, 0, 0}, /*23*/
433 {104.46, 384.21, PathPointTypeBezier
, 0, 0} /*24*/
436 static void test_pathpath(void)
439 GpPath
* path1
, *path2
;
441 GdipCreatePath(FillModeAlternate
, &path2
);
442 GdipAddPathArc(path2
, 100.0, 100.0, 500.0, 700.0, 95.0, 100.0);
444 GdipCreatePath(FillModeAlternate
, &path1
);
445 GdipAddPathArc(path1
, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
446 status
= GdipAddPathPath(path1
, path2
, FALSE
);
448 GdipAddPathArc(path1
, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
449 status
= GdipAddPathPath(path1
, path2
, TRUE
);
452 ok_path(path1
, pathpath_path
, sizeof(pathpath_path
)/sizeof(path_test_t
), FALSE
);
454 GdipDeletePath(path1
);
455 GdipDeletePath(path2
);
458 static path_test_t ellipse_path
[] = {
459 {30.00, 125.25, PathPointTypeStart
, 0, 0}, /*0*/
460 {30.00, 139.20, PathPointTypeBezier
, 0, 0}, /*1*/
461 {25.52, 150.50, PathPointTypeBezier
, 0, 0}, /*2*/
462 {20.00, 150.50, PathPointTypeBezier
, 0, 0}, /*3*/
463 {14.48, 150.50, PathPointTypeBezier
, 0, 0}, /*4*/
464 {10.00, 139.20, PathPointTypeBezier
, 0, 0}, /*5*/
465 {10.00, 125.25, PathPointTypeBezier
, 0, 0}, /*6*/
466 {10.00, 111.30, PathPointTypeBezier
, 0, 0}, /*7*/
467 {14.48, 100.00, PathPointTypeBezier
, 0, 0}, /*8*/
468 {20.00, 100.00, PathPointTypeBezier
, 0, 0}, /*9*/
469 {25.52, 100.00, PathPointTypeBezier
, 0, 0}, /*10*/
470 {30.00, 111.30, PathPointTypeBezier
, 0, 0}, /*11*/
471 {30.00, 125.25, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0}, /*12*/
472 {7.00, 11.00, PathPointTypeStart
, 0, 0}, /*13*/
473 {13.00, 17.00, PathPointTypeLine
, 0, 0}, /*14*/
474 {5.00, 195.00, PathPointTypeStart
, 0, 0}, /*15*/
475 {5.00, 192.24, PathPointTypeBezier
, 0, 0}, /*16*/
476 {6.12, 190.00, PathPointTypeBezier
, 0, 0}, /*17*/
477 {7.50, 190.00, PathPointTypeBezier
, 0, 0}, /*18*/
478 {8.88, 190.00, PathPointTypeBezier
, 0, 0}, /*19*/
479 {10.00, 192.24, PathPointTypeBezier
, 0, 0}, /*20*/
480 {10.00, 195.00, PathPointTypeBezier
, 0, 0}, /*21*/
481 {10.00, 197.76, PathPointTypeBezier
, 0, 0}, /*22*/
482 {8.88, 200.00, PathPointTypeBezier
, 0, 0}, /*23*/
483 {7.50, 200.00, PathPointTypeBezier
, 0, 0}, /*24*/
484 {6.12, 200.00, PathPointTypeBezier
, 0, 0}, /*25*/
485 {5.00, 197.76, PathPointTypeBezier
, 0, 0}, /*26*/
486 {5.00, 195.00, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0}, /*27*/
487 {10.00, 300.50, PathPointTypeStart
, 0, 0}, /*28*/
488 {10.00, 300.78, PathPointTypeBezier
, 0, 0}, /*29*/
489 {10.00, 301.00, PathPointTypeBezier
, 0, 0}, /*30*/
490 {10.00, 301.00, PathPointTypeBezier
, 0, 0}, /*31*/
491 {10.00, 301.00, PathPointTypeBezier
, 0, 0}, /*32*/
492 {10.00, 300.78, PathPointTypeBezier
, 0, 0}, /*33*/
493 {10.00, 300.50, PathPointTypeBezier
, 0, 0}, /*34*/
494 {10.00, 300.22, PathPointTypeBezier
, 0, 0}, /*35*/
495 {10.00, 300.00, PathPointTypeBezier
, 0, 0}, /*36*/
496 {10.00, 300.00, PathPointTypeBezier
, 0, 0}, /*37*/
497 {10.00, 300.00, PathPointTypeBezier
, 0, 0}, /*38*/
498 {10.00, 300.22, PathPointTypeBezier
, 0, 0}, /*39*/
499 {10.00, 300.50, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0} /*40*/
502 static void test_ellipse(void)
513 GdipCreatePath(FillModeAlternate
, &path
);
514 status
= GdipAddPathEllipse(path
, 10.0, 100.0, 20.0, 50.5);
516 GdipAddPathLine2(path
, points
, 2);
517 status
= GdipAddPathEllipse(path
, 10.0, 200.0, -5.0, -10.0);
519 GdipClosePathFigure(path
);
520 status
= GdipAddPathEllipse(path
, 10.0, 300.0, 0.0, 1.0);
523 ok_path(path
, ellipse_path
, sizeof(ellipse_path
)/sizeof(path_test_t
), FALSE
);
525 GdipDeletePath(path
);
528 static path_test_t linei_path
[] = {
529 {5.00, 5.00, PathPointTypeStart
, 0, 0}, /*0*/
530 {6.00, 8.00, PathPointTypeLine
, 0, 0}, /*1*/
531 {409.92, 110.20, PathPointTypeLine
, 0, 0}, /*2*/
532 {543.96, 156.53, PathPointTypeBezier
, 0, 0}, /*3*/
533 {625.80, 346.22, PathPointTypeBezier
, 0, 0}, /*4*/
534 {592.71, 533.88, PathPointTypeBezier
, 0, 0}, /*5*/
535 {592.47, 535.28, PathPointTypeBezier
, 0, 0}, /*6*/
536 {592.22, 536.67, PathPointTypeBezier
, 0, 0}, /*7*/
537 {591.96, 538.06, PathPointTypeBezier
, 0, 0}, /*8*/
538 {15.00, 15.00, PathPointTypeLine
, 0, 0}, /*9*/
539 {26.00, 28.00, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0}, /*10*/
540 {35.00, 35.00, PathPointTypeStart
, 0, 0}, /*11*/
541 {36.00, 38.00, PathPointTypeLine
, 0, 0} /*12*/
544 static void test_linei(void)
555 GdipCreatePath(FillModeAlternate
, &path
);
556 status
= GdipAddPathLineI(path
, 5.0, 5.0, 6.0, 8.0);
558 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
559 status
= GdipAddPathLineI(path
, 15.0, 15.0, 26.0, 28.0);
561 GdipClosePathFigure(path
);
562 status
= GdipAddPathLineI(path
, 35.0, 35.0, 36.0, 38.0);
565 ok_path(path
, linei_path
, sizeof(linei_path
)/sizeof(path_test_t
), FALSE
);
567 GdipDeletePath(path
);
570 static path_test_t rect_path
[] = {
571 {5.0, 5.0, PathPointTypeStart
, 0, 0}, /*0*/
572 {105.0, 5.0, PathPointTypeLine
, 0, 0}, /*1*/
573 {105.0, 55.0, PathPointTypeLine
, 0, 0}, /*2*/
574 {5.0, 55.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0}, /*3*/
576 {100.0, 50.0, PathPointTypeStart
, 0, 0}, /*4*/
577 {220.0, 50.0, PathPointTypeLine
, 0, 0}, /*5*/
578 {220.0, 80.0, PathPointTypeLine
, 0, 0}, /*6*/
579 {100.0, 80.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0} /*7*/
582 static void test_rect(void)
588 GdipCreatePath(FillModeAlternate
, &path
);
589 status
= GdipAddPathRectangle(path
, 5.0, 5.0, 100.0, 50.0);
591 status
= GdipAddPathRectangle(path
, 100.0, 50.0, 120.0, 30.0);
594 ok_path(path
, rect_path
, sizeof(rect_path
)/sizeof(path_test_t
), FALSE
);
596 GdipDeletePath(path
);
598 GdipCreatePath(FillModeAlternate
, &path
);
602 rects
[0].Width
= 100.0;
603 rects
[0].Height
= 50.0;
606 rects
[1].Width
= 120.0;
607 rects
[1].Height
= 30.0;
609 status
= GdipAddPathRectangles(path
, (GDIPCONST GpRectF
*)&rects
, 2);
612 ok_path(path
, rect_path
, sizeof(rect_path
)/sizeof(path_test_t
), FALSE
);
614 GdipDeletePath(path
);
617 START_TEST(graphicspath
)
619 struct GdiplusStartupInput gdiplusStartupInput
;
620 ULONG_PTR gdiplusToken
;
622 gdiplusStartupInput
.GdiplusVersion
= 1;
623 gdiplusStartupInput
.DebugEventCallback
= NULL
;
624 gdiplusStartupInput
.SuppressBackgroundThread
= 0;
625 gdiplusStartupInput
.SuppressExternalCodecs
= 0;
627 GdiplusStartup(&gdiplusToken
, &gdiplusStartupInput
, NULL
);
629 test_constructor_destructor();
639 GdiplusShutdown(gdiplusToken
);