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
21 #define WIN32_NO_STATUS
23 #define COM_NO_WINDOWS_H
25 //#include "windows.h"
26 #include <wine/test.h>
32 #define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
33 #define expectf(expected, got) ok(fabs(expected - got) < 2.0, "Expected %.2f, got %.2f\n", expected, got)
34 #define POINT_TYPE_MAX_LEN (75)
36 static void stringify_point_type(PathPointType type
, char * name
)
40 switch(type
& PathPointTypePathTypeMask
){
41 case PathPointTypeStart
:
42 strcat(name
, "PathPointTypeStart");
44 case PathPointTypeLine
:
45 strcat(name
, "PathPointTypeLine");
47 case PathPointTypeBezier
:
48 strcat(name
, "PathPointTypeBezier");
51 strcat(name
, "Unknown type");
55 type
&= ~PathPointTypePathTypeMask
;
56 if(type
& ~((PathPointTypePathMarker
| PathPointTypeCloseSubpath
))){
58 strcat(name
, "Unknown type");
62 if(type
& PathPointTypePathMarker
)
63 strcat(name
, " | PathPointTypePathMarker");
64 if(type
& PathPointTypeCloseSubpath
)
65 strcat(name
, " | PathPointTypeCloseSubpath");
68 /* this helper structure and function modeled after gdi path.c test */
74 /* How many extra entries before this one only on wine
75 * but not on native? */
76 int wine_only_entries_preceding
;
78 /* 0 - This entry matches on wine.
79 * 1 - This entry corresponds to a single entry on wine that does not match the native entry.
80 * 2 - This entry is currently skipped on wine but present on native. */
84 static void ok_path(GpPath
* path
, const path_test_t
*expected
, INT expected_size
, BOOL todo_size
)
87 INT size
, idx
= 0, eidx
= 0, numskip
;
89 char ename
[POINT_TYPE_MAX_LEN
], name
[POINT_TYPE_MAX_LEN
];
91 if(GdipGetPointCount(path
, &size
) != Ok
){
92 skip("Cannot perform path comparisons due to failure to retrieve path.\n");
96 if(todo_size
) todo_wine
97 ok(size
== expected_size
, "Path size %d does not match expected size %d\n",
100 ok(size
== expected_size
, "Path size %d does not match expected size %d\n",
101 size
, expected_size
);
103 points
= HeapAlloc(GetProcessHeap(), 0, size
* sizeof(GpPointF
));
104 types
= HeapAlloc(GetProcessHeap(), 0, size
);
106 if(GdipGetPathPoints(path
, points
, size
) != Ok
|| GdipGetPathTypes(path
, types
, size
) != Ok
){
107 skip("Cannot perform path comparisons due to failure to retrieve path.\n");
111 numskip
= expected_size
? expected
[eidx
].wine_only_entries_preceding
: 0;
112 while (idx
< size
&& eidx
< expected_size
){
113 /* We allow a few pixels fudge in matching X and Y coordinates to account for imprecision in
114 * floating point to integer conversion */
115 BOOL match
= (types
[idx
] == expected
[eidx
].type
) &&
116 fabs(points
[idx
].X
- expected
[eidx
].X
) <= 2.0 &&
117 fabs(points
[idx
].Y
- expected
[eidx
].Y
) <= 2.0;
119 stringify_point_type(expected
[eidx
].type
, ename
);
120 stringify_point_type(types
[idx
], name
);
122 if (expected
[eidx
].todo
|| numskip
) todo_wine
123 ok(match
, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx
,
124 ename
, expected
[eidx
].X
, expected
[eidx
].Y
,
125 name
, points
[idx
].X
, points
[idx
].Y
);
127 ok(match
, "Expected #%d: %s (%.1f,%.1f) but got %s (%.1f,%.1f)\n", eidx
,
128 ename
, expected
[eidx
].X
, expected
[eidx
].Y
,
129 name
, points
[idx
].X
, points
[idx
].Y
);
131 if (match
|| expected
[eidx
].todo
!= 2)
133 if (match
|| !numskip
--)
134 numskip
= expected
[++eidx
].wine_only_entries_preceding
;
138 HeapFree(GetProcessHeap(), 0, types
);
139 HeapFree(GetProcessHeap(), 0, points
);
142 static void test_constructor_destructor(void)
147 status
= GdipCreatePath(FillModeAlternate
, &path
);
149 ok(path
!= NULL
, "Expected path to be initialized\n");
151 status
= GdipDeletePath(NULL
);
152 expect(InvalidParameter
, status
);
154 status
= GdipDeletePath(path
);
158 static void test_getpathdata(void)
165 status
= GdipCreatePath(FillModeAlternate
, &path
);
167 status
= GdipAddPathLine(path
, 5.0, 5.0, 100.0, 50.0);
170 status
= GdipGetPointCount(path
, &count
);
175 data
.Types
= GdipAlloc(sizeof(BYTE
) * count
);
176 data
.Points
= GdipAlloc(sizeof(PointF
) * count
);
178 status
= GdipGetPathData(path
, &data
);
180 expect((data
.Points
[0].X
== 5.0) && (data
.Points
[0].Y
== 5.0) &&
181 (data
.Points
[1].X
== 100.0) && (data
.Points
[1].Y
== 50.0), TRUE
);
182 expect((data
.Types
[0] == PathPointTypeStart
) && (data
.Types
[1] == PathPointTypeLine
), TRUE
);
184 GdipFree(data
.Points
);
185 GdipFree(data
.Types
);
186 GdipDeletePath(path
);
189 static path_test_t line2_path
[] = {
190 {0.0, 50.0, PathPointTypeStart
, 0, 0}, /*0*/
191 {5.0, 45.0, PathPointTypeLine
, 0, 0}, /*1*/
192 {0.0, 40.0, PathPointTypeLine
, 0, 0}, /*2*/
193 {15.0, 35.0, PathPointTypeLine
, 0, 0}, /*3*/
194 {0.0, 30.0, PathPointTypeLine
, 0, 0}, /*4*/
195 {25.0, 25.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0}, /*5*/
196 {0.0, 20.0, PathPointTypeStart
, 0, 0}, /*6*/
197 {35.0, 15.0, PathPointTypeLine
, 0, 0}, /*7*/
198 {0.0, 10.0, PathPointTypeLine
, 0, 0} /*8*/
201 static void test_line2(void)
206 GpPointF line2_points
[9];
208 for(i
= 0; i
< 9; i
++){
209 line2_points
[i
].X
= i
* 5.0 * (REAL
)(i
% 2);
210 line2_points
[i
].Y
= 50.0 - i
* 5.0;
213 GdipCreatePath(FillModeAlternate
, &path
);
214 status
= GdipAddPathLine2(path
, line2_points
, 3);
216 status
= GdipAddPathLine2(path
, &(line2_points
[3]), 3);
218 status
= GdipClosePathFigure(path
);
220 status
= GdipAddPathLine2(path
, &(line2_points
[6]), 3);
223 ok_path(path
, line2_path
, sizeof(line2_path
)/sizeof(path_test_t
), FALSE
);
225 GdipDeletePath(path
);
228 static path_test_t arc_path
[] = {
229 {600.0, 450.0, PathPointTypeStart
, 0, 0}, /*0*/
230 {600.0, 643.3, PathPointTypeBezier
, 0, 0}, /*1*/
231 {488.1, 800.0, PathPointTypeBezier
, 0, 0}, /*2*/
232 {350.0, 800.0, PathPointTypeBezier
, 0, 0}, /*3*/
233 {600.0, 450.0, PathPointTypeLine
, 0, 0}, /*4*/
234 {600.0, 643.3, PathPointTypeBezier
, 0, 0}, /*5*/
235 {488.1, 800.0, PathPointTypeBezier
, 0, 0}, /*6*/
236 {350.0, 800.0, PathPointTypeBezier
, 0, 0}, /*7*/
237 {329.8, 800.0, PathPointTypeBezier
, 0, 0}, /*8*/
238 {309.7, 796.6, PathPointTypeBezier
, 0, 0}, /*9*/
239 {290.1, 789.8, PathPointTypeBezier
, 0, 0}, /*10*/
240 {409.9, 110.2, PathPointTypeLine
, 0, 0}, /*11*/
241 {544.0, 156.5, PathPointTypeBezier
, 0, 0}, /*12*/
242 {625.8, 346.2, PathPointTypeBezier
, 0, 0}, /*13*/
243 {592.7, 533.9, PathPointTypeBezier
, 0, 0}, /*14*/
244 {592.5, 535.3, PathPointTypeBezier
, 0, 0}, /*15*/
245 {592.2, 536.7, PathPointTypeBezier
, 0, 0}, /*16*/
246 {592.0, 538.1, PathPointTypeBezier
, 0, 0}, /*17*/
247 {409.9, 789.8, PathPointTypeLine
, 0, 0}, /*18*/
248 {544.0, 743.5, PathPointTypeBezier
, 0, 0}, /*19*/
249 {625.8, 553.8, PathPointTypeBezier
, 0, 0}, /*20*/
250 {592.7, 366.1, PathPointTypeBezier
, 0, 0}, /*21*/
251 {592.5, 364.7, PathPointTypeBezier
, 0, 0}, /*22*/
252 {592.2, 363.3, PathPointTypeBezier
, 0, 0}, /*23*/
253 {592.0, 361.9, PathPointTypeBezier
, 0, 0}, /*24*/
254 {540.4, 676.9, PathPointTypeLine
, 0, 0}, /*25*/
255 {629.9, 529.7, PathPointTypeBezier
, 0, 0}, /*26*/
256 {617.2, 308.8, PathPointTypeBezier
, 0, 0}, /*27*/
257 {512.1, 183.5, PathPointTypeBezier
, 0, 0}, /*28*/
258 {406.9, 58.2, PathPointTypeBezier
, 0, 0}, /*29*/
259 {249.1, 75.9, PathPointTypeBezier
, 0, 0}, /*30*/
260 {159.6, 223.1, PathPointTypeBezier
, 0, 0}, /*31*/
261 {70.1, 370.3, PathPointTypeBezier
, 0, 0}, /*32*/
262 {82.8, 591.2, PathPointTypeBezier
, 0, 0}, /*33*/
263 {187.9, 716.5, PathPointTypeBezier
, 0, 0}, /*34*/
264 {293.1, 841.8, PathPointTypeBezier
, 0, 0}, /*35*/
265 {450.9, 824.1, PathPointTypeBezier
, 0, 0}, /*36*/
266 {540.4, 676.9, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 1} /*37*/
269 static void test_arc(void)
274 GdipCreatePath(FillModeAlternate
, &path
);
275 /* Exactly 90 degrees */
276 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
278 /* Over 90 degrees */
279 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
281 /* Negative start angle */
282 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
284 /* Negative sweep angle */
285 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 80.0, -100.0);
287 /* More than a full revolution */
288 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 50.0, -400.0);
291 status
= GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0);
294 ok_path(path
, arc_path
, sizeof(arc_path
)/sizeof(path_test_t
), FALSE
);
296 GdipDeletePath(path
);
299 static void test_worldbounds(void)
306 GpPointF line2_points
[10];
309 for(i
= 0; i
< 10; i
++){
310 line2_points
[i
].X
= 200.0 + i
* 50.0 * (i
% 2);
311 line2_points
[i
].Y
= 200.0 + i
* 50.0 * !(i
% 2);
313 GdipCreatePen1((ARGB
)0xdeadbeef, 20.0, UnitWorld
, &pen
);
314 GdipSetPenEndCap(pen
, LineCapSquareAnchor
);
315 GdipCreateMatrix2(1.5, 0.0, 1.0, 1.2, 10.4, 10.2, &matrix
);
317 GdipCreatePath(FillModeAlternate
, &path
);
318 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
319 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
320 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, NULL
);
322 GdipDeletePath(path
);
324 expectf(200.0, bounds
.X
);
325 expectf(200.0, bounds
.Y
);
326 expectf(450.0, bounds
.Width
);
327 expectf(600.0, bounds
.Height
);
329 GdipCreatePath(FillModeAlternate
, &path
);
330 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
331 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
332 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, NULL
);
334 GdipDeletePath(path
);
336 expectf(510.4, bounds
.X
);
337 expectf(250.2, bounds
.Y
);
338 expectf(1275.0, bounds
.Width
);
339 expectf(720.0, bounds
.Height
);
341 GdipCreatePath(FillModeAlternate
, &path
);
342 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
343 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
344 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
346 GdipDeletePath(path
);
348 expectf(100.0, bounds
.X
);
349 expectf(100.0, bounds
.Y
);
350 expectf(650.0, bounds
.Width
);
351 expectf(800.0, bounds
.Height
);
353 GdipCreatePath(FillModeAlternate
, &path
);
354 GdipAddPathLine2(path
, &(line2_points
[0]), 2);
355 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
357 GdipDeletePath(path
);
359 expectf(156.0, bounds
.X
);
360 expectf(156.0, bounds
.Y
);
361 expectf(138.0, bounds
.Width
);
362 expectf(88.0, bounds
.Height
);
364 line2_points
[2].X
= 2 * line2_points
[1].X
- line2_points
[0].X
;
365 line2_points
[2].Y
= 2 * line2_points
[1].Y
- line2_points
[0].Y
;
367 GdipCreatePath(FillModeAlternate
, &path
);
368 GdipAddPathLine2(path
, &(line2_points
[0]), 3);
369 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
371 GdipDeletePath(path
);
373 expectf(100.0, bounds
.X
);
374 expectf(100.0, bounds
.Y
);
375 expectf(300.0, bounds
.Width
);
376 expectf(200.0, bounds
.Height
);
378 GdipCreatePath(FillModeAlternate
, &path
);
379 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 45.0, 20.0);
380 status
= GdipGetPathWorldBounds(path
, &bounds
, NULL
, pen
);
382 GdipDeletePath(path
);
384 expectf(386.7, bounds
.X
);
385 expectf(553.4, bounds
.Y
);
386 expectf(266.8, bounds
.Width
);
387 expectf(289.6, bounds
.Height
);
389 GdipCreatePath(FillModeAlternate
, &path
);
390 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, pen
);
392 GdipDeletePath(path
);
394 expectf(0.0, bounds
.X
);
395 expectf(0.0, bounds
.Y
);
396 expectf(0.0, bounds
.Width
);
397 expectf(0.0, bounds
.Height
);
399 GdipCreatePath(FillModeAlternate
, &path
);
400 GdipAddPathLine2(path
, &(line2_points
[0]), 2);
401 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, pen
);
403 GdipDeletePath(path
);
406 expectf(427.9, bounds
.X
);
407 expectf(167.7, bounds
.Y
);
408 expectf(239.9, bounds
.Width
);
409 expectf(164.9, bounds
.Height
);
412 GdipDeleteMatrix(matrix
);
413 GdipCreateMatrix2(0.9, -0.5, -0.5, -1.2, 10.4, 10.2, &matrix
);
414 GdipCreatePath(FillModeAlternate
, &path
);
415 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
416 GdipAddPathLine2(path
, &(line2_points
[0]), 10);
417 status
= GdipGetPathWorldBounds(path
, &bounds
, matrix
, NULL
);
419 GdipDeletePath(path
);
420 GdipDeleteMatrix(matrix
);
422 expectf(-209.6, bounds
.X
);
423 expectf(-1274.8, bounds
.Y
);
424 expectf(705.0, bounds
.Width
);
425 expectf(945.0, bounds
.Height
);
430 static path_test_t pathpath_path
[] = {
431 {600.00, 450.00, PathPointTypeStart
, 0, 0}, /*0*/
432 {600.00, 643.30, PathPointTypeBezier
, 0, 0}, /*1*/
433 {488.07, 800.00, PathPointTypeBezier
, 0, 0}, /*2*/
434 {350.00, 800.00, PathPointTypeBezier
, 0, 0}, /*3*/
435 {319.61, 797.40, PathPointTypeStart
, 0, 0}, /*4*/
436 {182.56, 773.90, PathPointTypeBezier
, 0, 0}, /*5*/
437 {85.07, 599.31, PathPointTypeBezier
, 0, 0}, /*6*/
438 {101.85, 407.45, PathPointTypeBezier
, 0, 0}, /*7*/
439 {102.54, 399.66, PathPointTypeBezier
, 0, 0}, /*8*/
440 {103.40, 391.91, PathPointTypeBezier
, 0, 0}, /*9*/
441 {104.46, 384.21, PathPointTypeBezier
, 0, 0}, /*10*/
442 {409.92, 110.20, PathPointTypeLine
, 0, 0}, /*11*/
443 {543.96, 156.53, PathPointTypeBezier
, 0, 0}, /*12*/
444 {625.80, 346.22, PathPointTypeBezier
, 0, 0}, /*13*/
445 {592.71, 533.88, PathPointTypeBezier
, 0, 0}, /*14*/
446 {592.47, 535.28, PathPointTypeBezier
, 0, 0}, /*15*/
447 {592.22, 536.67, PathPointTypeBezier
, 0, 0}, /*16*/
448 {591.96, 538.06, PathPointTypeBezier
, 0, 0}, /*17*/
449 {319.61, 797.40, PathPointTypeLine
, 0, 0}, /*18*/
450 {182.56, 773.90, PathPointTypeBezier
, 0, 0}, /*19*/
451 {85.07, 599.31, PathPointTypeBezier
, 0, 0}, /*20*/
452 {101.85, 407.45, PathPointTypeBezier
, 0, 0}, /*21*/
453 {102.54, 399.66, PathPointTypeBezier
, 0, 0}, /*22*/
454 {103.40, 391.91, PathPointTypeBezier
, 0, 0}, /*23*/
455 {104.46, 384.21, PathPointTypeBezier
, 0, 0} /*24*/
458 static void test_pathpath(void)
461 GpPath
* path1
, *path2
;
463 GdipCreatePath(FillModeAlternate
, &path2
);
464 GdipAddPathArc(path2
, 100.0, 100.0, 500.0, 700.0, 95.0, 100.0);
466 GdipCreatePath(FillModeAlternate
, &path1
);
467 GdipAddPathArc(path1
, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
468 status
= GdipAddPathPath(path1
, path2
, FALSE
);
470 GdipAddPathArc(path1
, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
471 status
= GdipAddPathPath(path1
, path2
, TRUE
);
474 ok_path(path1
, pathpath_path
, sizeof(pathpath_path
)/sizeof(path_test_t
), FALSE
);
476 GdipDeletePath(path1
);
477 GdipDeletePath(path2
);
480 static path_test_t ellipse_path
[] = {
481 {30.00, 125.25, PathPointTypeStart
, 0, 0}, /*0*/
482 {30.00, 139.20, PathPointTypeBezier
, 0, 0}, /*1*/
483 {25.52, 150.50, PathPointTypeBezier
, 0, 0}, /*2*/
484 {20.00, 150.50, PathPointTypeBezier
, 0, 0}, /*3*/
485 {14.48, 150.50, PathPointTypeBezier
, 0, 0}, /*4*/
486 {10.00, 139.20, PathPointTypeBezier
, 0, 0}, /*5*/
487 {10.00, 125.25, PathPointTypeBezier
, 0, 0}, /*6*/
488 {10.00, 111.30, PathPointTypeBezier
, 0, 0}, /*7*/
489 {14.48, 100.00, PathPointTypeBezier
, 0, 0}, /*8*/
490 {20.00, 100.00, PathPointTypeBezier
, 0, 0}, /*9*/
491 {25.52, 100.00, PathPointTypeBezier
, 0, 0}, /*10*/
492 {30.00, 111.30, PathPointTypeBezier
, 0, 0}, /*11*/
493 {30.00, 125.25, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0}, /*12*/
494 {7.00, 11.00, PathPointTypeStart
, 0, 0}, /*13*/
495 {13.00, 17.00, PathPointTypeLine
, 0, 0}, /*14*/
496 {5.00, 195.00, PathPointTypeStart
, 0, 0}, /*15*/
497 {5.00, 192.24, PathPointTypeBezier
, 0, 0}, /*16*/
498 {6.12, 190.00, PathPointTypeBezier
, 0, 0}, /*17*/
499 {7.50, 190.00, PathPointTypeBezier
, 0, 0}, /*18*/
500 {8.88, 190.00, PathPointTypeBezier
, 0, 0}, /*19*/
501 {10.00, 192.24, PathPointTypeBezier
, 0, 0}, /*20*/
502 {10.00, 195.00, PathPointTypeBezier
, 0, 0}, /*21*/
503 {10.00, 197.76, PathPointTypeBezier
, 0, 0}, /*22*/
504 {8.88, 200.00, PathPointTypeBezier
, 0, 0}, /*23*/
505 {7.50, 200.00, PathPointTypeBezier
, 0, 0}, /*24*/
506 {6.12, 200.00, PathPointTypeBezier
, 0, 0}, /*25*/
507 {5.00, 197.76, PathPointTypeBezier
, 0, 0}, /*26*/
508 {5.00, 195.00, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0}, /*27*/
509 {10.00, 300.50, PathPointTypeStart
, 0, 0}, /*28*/
510 {10.00, 300.78, PathPointTypeBezier
, 0, 0}, /*29*/
511 {10.00, 301.00, PathPointTypeBezier
, 0, 0}, /*30*/
512 {10.00, 301.00, PathPointTypeBezier
, 0, 0}, /*31*/
513 {10.00, 301.00, PathPointTypeBezier
, 0, 0}, /*32*/
514 {10.00, 300.78, PathPointTypeBezier
, 0, 0}, /*33*/
515 {10.00, 300.50, PathPointTypeBezier
, 0, 0}, /*34*/
516 {10.00, 300.22, PathPointTypeBezier
, 0, 0}, /*35*/
517 {10.00, 300.00, PathPointTypeBezier
, 0, 0}, /*36*/
518 {10.00, 300.00, PathPointTypeBezier
, 0, 0}, /*37*/
519 {10.00, 300.00, PathPointTypeBezier
, 0, 0}, /*38*/
520 {10.00, 300.22, PathPointTypeBezier
, 0, 0}, /*39*/
521 {10.00, 300.50, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0} /*40*/
524 static void test_ellipse(void)
535 GdipCreatePath(FillModeAlternate
, &path
);
536 status
= GdipAddPathEllipse(path
, 10.0, 100.0, 20.0, 50.5);
538 GdipAddPathLine2(path
, points
, 2);
539 status
= GdipAddPathEllipse(path
, 10.0, 200.0, -5.0, -10.0);
541 GdipClosePathFigure(path
);
542 status
= GdipAddPathEllipse(path
, 10.0, 300.0, 0.0, 1.0);
545 ok_path(path
, ellipse_path
, sizeof(ellipse_path
)/sizeof(path_test_t
), FALSE
);
547 GdipDeletePath(path
);
550 static path_test_t linei_path
[] = {
551 {5.00, 5.00, PathPointTypeStart
, 0, 0}, /*0*/
552 {6.00, 8.00, PathPointTypeLine
, 0, 0}, /*1*/
553 {409.92, 110.20, PathPointTypeLine
, 0, 0}, /*2*/
554 {543.96, 156.53, PathPointTypeBezier
, 0, 0}, /*3*/
555 {625.80, 346.22, PathPointTypeBezier
, 0, 0}, /*4*/
556 {592.71, 533.88, PathPointTypeBezier
, 0, 0}, /*5*/
557 {592.47, 535.28, PathPointTypeBezier
, 0, 0}, /*6*/
558 {592.22, 536.67, PathPointTypeBezier
, 0, 0}, /*7*/
559 {591.96, 538.06, PathPointTypeBezier
, 0, 0}, /*8*/
560 {15.00, 15.00, PathPointTypeLine
, 0, 0}, /*9*/
561 {26.00, 28.00, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0}, /*10*/
562 {35.00, 35.00, PathPointTypeStart
, 0, 0}, /*11*/
563 {36.00, 38.00, PathPointTypeLine
, 0, 0} /*12*/
566 static void test_linei(void)
571 GdipCreatePath(FillModeAlternate
, &path
);
572 status
= GdipAddPathLineI(path
, 5.0, 5.0, 6.0, 8.0);
574 GdipAddPathArc(path
, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
575 status
= GdipAddPathLineI(path
, 15.0, 15.0, 26.0, 28.0);
577 GdipClosePathFigure(path
);
578 status
= GdipAddPathLineI(path
, 35.0, 35.0, 36.0, 38.0);
581 ok_path(path
, linei_path
, sizeof(linei_path
)/sizeof(path_test_t
), FALSE
);
583 GdipDeletePath(path
);
586 static path_test_t poly_path
[] = {
587 {5.00, 5.00, PathPointTypeStart
, 0, 0}, /*1*/
588 {6.00, 8.00, PathPointTypeLine
, 0, 0}, /*2*/
589 {0.00, 0.00, PathPointTypeStart
, 0, 0}, /*3*/
590 {10.00, 10.00, PathPointTypeLine
, 0, 0}, /*4*/
591 {10.00, 20.00, PathPointTypeLine
, 0, 0}, /*5*/
592 {30.00, 10.00, PathPointTypeLine
, 0, 0}, /*6*/
593 {20.00, 0.00, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0}, /*7*/
596 static void test_polygon(void)
613 GdipCreatePath(FillModeAlternate
, &path
);
616 status
= GdipAddPathPolygon(NULL
, points
, 5);
617 expect(InvalidParameter
, status
);
618 status
= GdipAddPathPolygon(path
, NULL
, 5);
619 expect(InvalidParameter
, status
);
620 /* Polygon should have 3 points at least */
621 status
= GdipAddPathPolygon(path
, points
, 2);
622 expect(InvalidParameter
, status
);
624 /* to test how it prolongs not empty path */
625 status
= GdipAddPathLine(path
, 5.0, 5.0, 6.0, 8.0);
627 status
= GdipAddPathPolygon(path
, points
, 5);
629 /* check resulting path */
630 ok_path(path
, poly_path
, sizeof(poly_path
)/sizeof(path_test_t
), FALSE
);
632 GdipDeletePath(path
);
635 static path_test_t rect_path
[] = {
636 {5.0, 5.0, PathPointTypeStart
, 0, 0}, /*0*/
637 {105.0, 5.0, PathPointTypeLine
, 0, 0}, /*1*/
638 {105.0, 55.0, PathPointTypeLine
, 0, 0}, /*2*/
639 {5.0, 55.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0}, /*3*/
641 {100.0, 50.0, PathPointTypeStart
, 0, 0}, /*4*/
642 {220.0, 50.0, PathPointTypeLine
, 0, 0}, /*5*/
643 {220.0, 80.0, PathPointTypeLine
, 0, 0}, /*6*/
644 {100.0, 80.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0} /*7*/
647 static void test_rect(void)
653 GdipCreatePath(FillModeAlternate
, &path
);
654 status
= GdipAddPathRectangle(path
, 5.0, 5.0, 100.0, 50.0);
656 status
= GdipAddPathRectangle(path
, 100.0, 50.0, 120.0, 30.0);
659 ok_path(path
, rect_path
, sizeof(rect_path
)/sizeof(path_test_t
), FALSE
);
661 GdipDeletePath(path
);
663 GdipCreatePath(FillModeAlternate
, &path
);
667 rects
[0].Width
= 100.0;
668 rects
[0].Height
= 50.0;
671 rects
[1].Width
= 120.0;
672 rects
[1].Height
= 30.0;
674 status
= GdipAddPathRectangles(path
, (GDIPCONST GpRectF
*)&rects
, 2);
677 ok_path(path
, rect_path
, sizeof(rect_path
)/sizeof(path_test_t
), FALSE
);
679 GdipDeletePath(path
);
682 static void test_lastpoint(void)
688 GdipCreatePath(FillModeAlternate
, &path
);
689 status
= GdipAddPathRectangle(path
, 5.0, 5.0, 100.0, 50.0);
693 status
= GdipGetPathLastPoint(NULL
, &ptf
);
694 expect(InvalidParameter
, status
);
695 status
= GdipGetPathLastPoint(path
, NULL
);
696 expect(InvalidParameter
, status
);
697 status
= GdipGetPathLastPoint(NULL
, NULL
);
698 expect(InvalidParameter
, status
);
700 status
= GdipGetPathLastPoint(path
, &ptf
);
702 expect(TRUE
, (ptf
.X
== 5.0) && (ptf
.Y
== 55.0));
704 GdipDeletePath(path
);
707 static path_test_t addcurve_path
[] = {
708 {0.0, 0.0, PathPointTypeStart
, 0, 0}, /*0*/
709 {3.3, 3.3, PathPointTypeBezier
, 0, 0}, /*1*/
710 {6.7, 3.3, PathPointTypeBezier
, 0, 0}, /*2*/
711 {10.0, 10.0, PathPointTypeBezier
, 0, 0}, /*3*/
712 {13.3, 16.7, PathPointTypeBezier
, 0, 0}, /*4*/
713 {3.3, 20.0, PathPointTypeBezier
, 0, 0}, /*5*/
714 {10.0, 20.0, PathPointTypeBezier
, 0, 0}, /*6*/
715 {16.7, 20.0, PathPointTypeBezier
, 0, 0}, /*7*/
716 {23.3, 13.3, PathPointTypeBezier
, 0, 0}, /*8*/
717 {30.0, 10.0, PathPointTypeBezier
, 0, 0} /*9*/
719 static path_test_t addcurve_path2
[] = {
720 {100.0,120.0,PathPointTypeStart
, 0, 0}, /*0*/
721 {123.0,10.0, PathPointTypeLine
, 0, 0}, /*1*/
722 {0.0, 0.0, PathPointTypeLine
, 0, 0}, /*2*/
723 {3.3, 3.3, PathPointTypeBezier
, 0, 0}, /*3*/
724 {6.7, 3.3, PathPointTypeBezier
, 0, 0}, /*4*/
725 {10.0, 10.0, PathPointTypeBezier
, 0, 0}, /*5*/
726 {13.3, 16.7, PathPointTypeBezier
, 0, 0}, /*6*/
727 {3.3, 20.0, PathPointTypeBezier
, 0, 0}, /*7*/
728 {10.0, 20.0, PathPointTypeBezier
, 0, 0}, /*8*/
729 {16.7, 20.0, PathPointTypeBezier
, 0, 0}, /*9*/
730 {23.3, 13.3, PathPointTypeBezier
, 0, 0}, /*10*/
731 {30.0, 10.0, PathPointTypeBezier
, 0, 0} /*11*/
733 static path_test_t addcurve_path3
[] = {
734 {10.0, 10.0, PathPointTypeStart
, 0, 0}, /*0*/
735 {13.3, 16.7, PathPointTypeBezier
, 0, 1}, /*1*/
736 {3.3, 20.0, PathPointTypeBezier
, 0, 0}, /*2*/
737 {10.0, 20.0, PathPointTypeBezier
, 0, 0}, /*3*/
738 {16.7, 20.0, PathPointTypeBezier
, 0, 0}, /*4*/
739 {23.3, 13.3, PathPointTypeBezier
, 0, 0}, /*5*/
740 {30.0, 10.0, PathPointTypeBezier
, 0, 0} /*6*/
742 static void test_addcurve(void)
757 GdipCreatePath(FillModeAlternate
, &path
);
760 status
= GdipAddPathCurve2(NULL
, NULL
, 0, 0.0);
761 expect(InvalidParameter
, status
);
762 status
= GdipAddPathCurve2(path
, NULL
, 0, 0.0);
763 expect(InvalidParameter
, status
);
764 status
= GdipAddPathCurve2(path
, points
, -1, 0.0);
765 expect(InvalidParameter
, status
);
766 status
= GdipAddPathCurve2(path
, points
, 1, 1.0);
767 expect(InvalidParameter
, status
);
769 /* add to empty path */
770 status
= GdipAddPathCurve2(path
, points
, 4, 1.0);
772 ok_path(path
, addcurve_path
, sizeof(addcurve_path
)/sizeof(path_test_t
), FALSE
);
773 GdipDeletePath(path
);
775 /* add to notempty path and opened figure */
776 GdipCreatePath(FillModeAlternate
, &path
);
777 GdipAddPathLine(path
, 100.0, 120.0, 123.0, 10.0);
778 status
= GdipAddPathCurve2(path
, points
, 4, 1.0);
780 ok_path(path
, addcurve_path2
, sizeof(addcurve_path2
)/sizeof(path_test_t
), FALSE
);
784 status
= GdipAddPathCurve3(NULL
, NULL
, 0, 0, 0, 0.0);
785 expect(InvalidParameter
, status
);
786 status
= GdipAddPathCurve3(path
, NULL
, 0, 0, 0, 0.0);
787 expect(InvalidParameter
, status
);
788 /* wrong count, offset.. */
789 status
= GdipAddPathCurve3(path
, points
, 0, 0, 0, 0.0);
790 expect(InvalidParameter
, status
);
791 status
= GdipAddPathCurve3(path
, points
, 4, 0, 0, 0.0);
792 expect(InvalidParameter
, status
);
793 status
= GdipAddPathCurve3(path
, points
, 4, 0, 4, 0.0);
794 expect(InvalidParameter
, status
);
795 status
= GdipAddPathCurve3(path
, points
, 4, 1, 3, 0.0);
796 expect(InvalidParameter
, status
);
797 status
= GdipAddPathCurve3(path
, points
, 4, 1, 0, 0.0);
798 expect(InvalidParameter
, status
);
799 status
= GdipAddPathCurve3(path
, points
, 4, 3, 1, 0.0);
800 expect(InvalidParameter
, status
);
803 status
= GdipAddPathCurve3(path
, points
, 4, 0, 3, 1.0);
805 ok_path(path
, addcurve_path
, sizeof(addcurve_path
)/sizeof(path_test_t
), FALSE
);
808 status
= GdipAddPathCurve3(path
, points
, 4, 1, 2, 1.0);
810 ok_path(path
, addcurve_path3
, sizeof(addcurve_path3
)/sizeof(path_test_t
), FALSE
);
812 GdipDeletePath(path
);
815 static path_test_t addclosedcurve_path
[] = {
816 {0.0, 0.0, PathPointTypeStart
, 0, 0}, /*0*/
817 {-6.7, 0.0, PathPointTypeBezier
, 0, 0}, /*1*/
818 {6.7, 3.3, PathPointTypeBezier
, 0, 0}, /*2*/
819 {10.0, 10.0, PathPointTypeBezier
, 0, 0}, /*3*/
820 {13.3, 16.7, PathPointTypeBezier
, 0, 0}, /*4*/
821 {3.3, 20.0, PathPointTypeBezier
, 0, 0}, /*5*/
822 {10.0, 20.0, PathPointTypeBezier
, 0, 0}, /*6*/
823 {16.7, 20.0, PathPointTypeBezier
, 0, 0}, /*7*/
824 {33.3, 16.7, PathPointTypeBezier
, 0, 0}, /*8*/
825 {30.0, 10.0, PathPointTypeBezier
, 0, 0}, /*9*/
826 {26.7, 3.3, PathPointTypeBezier
, 0, 0}, /*10*/
827 {6.7, 0.0, PathPointTypeBezier
, 0, 0}, /*11*/
828 {0.0, 0.0, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0} /*12*/
830 static void test_addclosedcurve(void)
845 GdipCreatePath(FillModeAlternate
, &path
);
848 status
= GdipAddPathClosedCurve2(NULL
, NULL
, 0, 0.0);
849 expect(InvalidParameter
, status
);
850 status
= GdipAddPathClosedCurve2(path
, NULL
, 0, 0.0);
851 expect(InvalidParameter
, status
);
852 status
= GdipAddPathClosedCurve2(path
, points
, -1, 0.0);
853 expect(InvalidParameter
, status
);
854 status
= GdipAddPathClosedCurve2(path
, points
, 1, 1.0);
855 expect(InvalidParameter
, status
);
857 /* add to empty path */
858 status
= GdipAddPathClosedCurve2(path
, points
, 4, 1.0);
860 ok_path(path
, addclosedcurve_path
, sizeof(addclosedcurve_path
)/sizeof(path_test_t
), FALSE
);
861 GdipDeletePath(path
);
864 static path_test_t reverse_path
[] = {
865 {0.0, 20.0, PathPointTypeStart
, 0, 0}, /*0*/
866 {25.0, 25.0, PathPointTypeLine
, 0, 0}, /*1*/
867 {0.0, 30.0, PathPointTypeLine
, 0, 0}, /*2*/
868 {15.0, 35.0, PathPointTypeStart
, 0, 0}, /*3*/
869 {0.0, 40.0, PathPointTypeLine
, 0, 0}, /*4*/
870 {5.0, 45.0, PathPointTypeLine
, 0, 0}, /*5*/
871 {0.0, 50.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 0} /*6*/
874 static void test_reverse(void)
881 for(i
= 0; i
< 7; i
++){
882 pts
[i
].X
= i
* 5.0 * (REAL
)(i
% 2);
883 pts
[i
].Y
= 50.0 - i
* 5.0;
886 GdipCreatePath(FillModeAlternate
, &path
);
889 status
= GdipReversePath(NULL
);
890 expect(InvalidParameter
, status
);
893 status
= GdipReversePath(path
);
896 GdipAddPathLine2(path
, pts
, 4);
897 GdipClosePathFigure(path
);
898 GdipAddPathLine2(path
, &(pts
[4]), 3);
900 status
= GdipReversePath(path
);
902 ok_path(path
, reverse_path
, sizeof(reverse_path
)/sizeof(path_test_t
), FALSE
);
904 GdipDeletePath(path
);
907 static path_test_t addpie_path
[] = {
908 {50.0, 25.0, PathPointTypeStart
, 0, 0}, /*0*/
909 {97.2, 33.3, PathPointTypeLine
, 0, 0}, /*1*/
910 {91.8, 40.9, PathPointTypeBezier
,0, 0}, /*2*/
911 {79.4, 46.8, PathPointTypeBezier
,0, 0}, /*3*/
912 {63.9, 49.0, PathPointTypeBezier
| PathPointTypeCloseSubpath
, 0, 0} /*4*/
914 static path_test_t addpie_path2
[] = {
915 {0.0, 30.0, PathPointTypeStart
| PathPointTypeCloseSubpath
, 0, 0} /*0*/
917 static path_test_t addpie_path3
[] = {
918 {30.0, 0.0, PathPointTypeStart
| PathPointTypeCloseSubpath
, 0, 0} /*0*/
920 static void test_addpie(void)
925 GdipCreatePath(FillModeAlternate
, &path
);
928 status
= GdipAddPathPie(NULL
, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
929 expect(InvalidParameter
, status
);
931 status
= GdipAddPathPie(path
, 0.0, 0.0, 100.0, 50.0, 10.0, 50.0);
933 ok_path(path
, addpie_path
, sizeof(addpie_path
)/sizeof(path_test_t
), FALSE
);
934 status
= GdipResetPath(path
);
937 /* zero width base ellipse */
938 status
= GdipAddPathPie(path
, 0.0, 0.0, 0.0, 60.0, -90.0, 24.0);
939 expect(InvalidParameter
, status
);
940 ok_path(path
, addpie_path2
, sizeof(addpie_path2
)/sizeof(path_test_t
), FALSE
);
941 status
= GdipResetPath(path
);
944 /* zero height base ellipse */
945 status
= GdipAddPathPie(path
, 0.0, 0.0, 60.0, 0.0 , -90.0, 24.0);
946 expect(InvalidParameter
, status
);
947 ok_path(path
, addpie_path3
, sizeof(addpie_path3
)/sizeof(path_test_t
), FALSE
);
949 GdipDeletePath(path
);
952 static path_test_t flattenellipse_path
[] = {
953 {100.0, 25.0,PathPointTypeStart
, 0, 0}, /*0*/
954 {99.0, 30.0, PathPointTypeLine
, 0, 0}, /*1*/
955 {96.0, 34.8, PathPointTypeLine
, 0, 0}, /*2*/
956 {91.5, 39.0, PathPointTypeLine
, 0, 0}, /*3*/
957 {85.5, 42.8, PathPointTypeLine
, 0, 0}, /*4*/
958 {69.5, 48.0, PathPointTypeLine
, 0, 1}, /*5*/
959 {50.0, 50.0, PathPointTypeLine
, 0, 1}, /*6*/
960 {30.5, 48.0, PathPointTypeLine
, 0, 1}, /*7*/
961 {14.8, 42.8, PathPointTypeLine
, 0, 1}, /*8*/
962 {8.5, 39.0, PathPointTypeLine
, 0, 1}, /*9*/
963 {4.0, 34.8, PathPointTypeLine
, 0, 1}, /*10*/
964 {1.0, 30.0, PathPointTypeLine
, 0, 1}, /*11*/
965 {0.0, 25.0, PathPointTypeLine
, 0, 1}, /*12*/
966 {1.0, 20.0, PathPointTypeLine
, 0, 1}, /*13*/
967 {4.0, 15.3, PathPointTypeLine
, 0, 1}, /*14*/
968 {8.5, 11.0, PathPointTypeLine
, 0, 1}, /*15*/
969 {14.8, 7.3, PathPointTypeLine
, 0, 1}, /*16*/
970 {30.5, 2.0, PathPointTypeLine
, 0, 1}, /*17*/
971 {50.0, 0.0, PathPointTypeLine
, 0, 1}, /*18*/
972 {69.5, 2.0, PathPointTypeLine
, 0, 1}, /*19*/
973 {85.5, 7.3, PathPointTypeLine
, 0, 1}, /*20*/
974 {91.5, 11.0, PathPointTypeLine
, 0, 1}, /*21*/
975 {96.0, 15.3, PathPointTypeLine
, 0, 1}, /*22*/
976 {99.0, 20.0, PathPointTypeLine
, 0, 1}, /*23*/
977 {100.0,25.0, PathPointTypeLine
| PathPointTypeCloseSubpath
, 0, 1} /*24*/
980 static path_test_t flattenline_path
[] = {
981 {5.0, 10.0,PathPointTypeStart
, 0, 0}, /*0*/
982 {50.0, 100.0, PathPointTypeLine
, 0, 0} /*1*/
985 static path_test_t flattenarc_path
[] = {
986 {100.0, 25.0,PathPointTypeStart
, 0, 0}, /*0*/
987 {99.0, 30.0, PathPointTypeLine
, 0, 0}, /*1*/
988 {96.0, 34.8, PathPointTypeLine
, 0, 0}, /*2*/
989 {91.5, 39.0, PathPointTypeLine
, 0, 0}, /*3*/
990 {85.5, 42.8, PathPointTypeLine
, 0, 0}, /*4*/
991 {69.5, 48.0, PathPointTypeLine
, 0, 1}, /*5*/
992 {50.0, 50.0, PathPointTypeLine
, 0, 1} /*6*/
995 static path_test_t flattenquater_path
[] = {
996 {100.0, 50.0,PathPointTypeStart
, 0, 0}, /*0*/
997 {99.0, 60.0, PathPointTypeLine
, 0, 0}, /*1*/
998 {96.0, 69.5, PathPointTypeLine
, 0, 0}, /*2*/
999 {91.5, 78.0, PathPointTypeLine
, 0, 0}, /*3*/
1000 {85.5, 85.5, PathPointTypeLine
, 0, 0}, /*4*/
1001 {78.0, 91.5, PathPointTypeLine
, 0, 0}, /*5*/
1002 {69.5, 96.0, PathPointTypeLine
, 0, 0}, /*6*/
1003 {60.0, 99.0, PathPointTypeLine
, 0, 0}, /*7*/
1004 {50.0, 100.0,PathPointTypeLine
, 0, 0} /*8*/
1007 static void test_flatten(void)
1013 status
= GdipCreatePath(FillModeAlternate
, &path
);
1015 status
= GdipCreateMatrix(&m
);
1018 /* NULL arguments */
1019 status
= GdipFlattenPath(NULL
, NULL
, 0.0);
1020 expect(InvalidParameter
, status
);
1021 status
= GdipFlattenPath(NULL
, m
, 0.0);
1022 expect(InvalidParameter
, status
);
1024 /* flatten empty path */
1025 status
= GdipFlattenPath(path
, NULL
, 1.0);
1028 status
= GdipAddPathEllipse(path
, 0.0, 0.0, 100.0, 50.0);
1031 status
= GdipFlattenPath(path
, NULL
, 1.0);
1033 ok_path(path
, flattenellipse_path
, sizeof(flattenellipse_path
)/sizeof(path_test_t
), TRUE
);
1035 status
= GdipResetPath(path
);
1037 status
= GdipAddPathLine(path
, 5.0, 10.0, 50.0, 100.0);
1039 status
= GdipFlattenPath(path
, NULL
, 1.0);
1041 ok_path(path
, flattenline_path
, sizeof(flattenline_path
)/sizeof(path_test_t
), FALSE
);
1043 status
= GdipResetPath(path
);
1045 status
= GdipAddPathArc(path
, 0.0, 0.0, 100.0, 50.0, 0.0, 90.0);
1047 status
= GdipFlattenPath(path
, NULL
, 1.0);
1049 ok_path(path
, flattenarc_path
, sizeof(flattenarc_path
)/sizeof(path_test_t
), TRUE
);
1051 /* easy case - quater of a full circle */
1052 status
= GdipResetPath(path
);
1054 status
= GdipAddPathArc(path
, 0.0, 0.0, 100.0, 100.0, 0.0, 90.0);
1056 status
= GdipFlattenPath(path
, NULL
, 1.0);
1058 ok_path(path
, flattenquater_path
, sizeof(flattenquater_path
)/sizeof(path_test_t
), FALSE
);
1060 GdipDeleteMatrix(m
);
1061 GdipDeletePath(path
);
1064 static void test_isvisible(void)
1067 GpGraphics
*graphics
= NULL
;
1072 status
= GdipCreateFromHDC(hdc
, &graphics
);
1074 status
= GdipCreatePath(FillModeAlternate
, &path
);
1078 status
= GdipIsVisiblePathPoint(NULL
, 0.0, 0.0, NULL
, NULL
);
1079 expect(InvalidParameter
, status
);
1080 status
= GdipIsVisiblePathPoint(path
, 0.0, 0.0, NULL
, NULL
);
1081 expect(InvalidParameter
, status
);
1082 status
= GdipIsVisiblePathPoint(path
, 0.0, 0.0, NULL
, NULL
);
1083 expect(InvalidParameter
, status
);
1084 status
= GdipIsVisiblePathPoint(path
, 0.0, 0.0, graphics
, NULL
);
1085 expect(InvalidParameter
, status
);
1089 status
= GdipIsVisiblePathPoint(path
, 0.0, 0.0, NULL
, &result
);
1091 expect(FALSE
, result
);
1093 status
= GdipAddPathRectangle(path
, 0.0, 0.0, 10.0, 10.0);
1096 status
= GdipIsVisiblePathPoint(path
, 0.0, 0.0, NULL
, &result
);
1098 expect(TRUE
, result
);
1100 status
= GdipIsVisiblePathPoint(path
, 11.0, 11.0, NULL
, &result
);
1102 expect(FALSE
, result
);
1103 /* not affected by clipping */
1104 status
= GdipSetClipRect(graphics
, 5.0, 5.0, 5.0, 5.0, CombineModeReplace
);
1107 status
= GdipIsVisiblePathPoint(path
, 0.0, 0.0, graphics
, &result
);
1109 expect(TRUE
, result
);
1111 GdipDeletePath(path
);
1112 GdipDeleteGraphics(graphics
);
1116 static void test_empty_rect(void)
1122 status
= GdipCreatePath(FillModeAlternate
, &path
);
1125 status
= GdipAddPathRectangle(path
, 0.0, 0.0, -5.0, 5.0);
1128 status
= GdipIsVisiblePathPoint(path
, -2.0, 2.0, NULL
, &result
);
1130 expect(FALSE
, status
);
1132 status
= GdipAddPathRectangle(path
, 0.0, 0.0, 5.0, -5.0);
1135 status
= GdipAddPathRectangle(path
, 0.0, 0.0, 0.0, 5.0);
1138 status
= GdipAddPathRectangle(path
, 0.0, 0.0, 5.0, 0.0);
1141 GdipDeletePath(path
);
1144 START_TEST(graphicspath
)
1146 struct GdiplusStartupInput gdiplusStartupInput
;
1147 ULONG_PTR gdiplusToken
;
1149 gdiplusStartupInput
.GdiplusVersion
= 1;
1150 gdiplusStartupInput
.DebugEventCallback
= NULL
;
1151 gdiplusStartupInput
.SuppressBackgroundThread
= 0;
1152 gdiplusStartupInput
.SuppressExternalCodecs
= 0;
1154 GdiplusStartup(&gdiplusToken
, &gdiplusStartupInput
, NULL
);
1156 test_constructor_destructor();
1168 test_addclosedcurve();
1175 GdiplusShutdown(gdiplusToken
);