ReactOS 0.4.17-dev-218-g5635d24
graphicspath.c
Go to the documentation of this file.
1/*
2 * Unit test suite for paths
3 *
4 * Copyright (C) 2007 Google (Evan Stade)
5 *
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.
10 *
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.
15 *
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
19 */
20
21#include "objbase.h"
22#include "gdiplus.h"
23#include "wine/test.h"
24#include <math.h>
25
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)
29
31{
32 *name = '\0';
33
36 strcat(name, "PathPointTypeStart");
37 break;
39 strcat(name, "PathPointTypeLine");
40 break;
42 strcat(name, "PathPointTypeBezier");
43 break;
44 default:
45 strcat(name, "Unknown type");
46 return;
47 }
48
49 type &= ~PathPointTypePathTypeMask;
51 *name = '\0';
52 strcat(name, "Unknown type");
53 return;
54 }
55
57 strcat(name, " | PathPointTypePathMarker");
59 strcat(name, " | PathPointTypeCloseSubpath");
60}
61
62/* this helper structure and function modeled after gdi path.c test */
63typedef struct
64{
66 BYTE type;
67
68 /* How many extra entries before this one only on wine
69 * but not on native? */
71
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. */
75 int todo;
77
78#define ok_path(a,b,c,d) _ok_path_fudge(a,b,c,d,1.0,__LINE__)
79#define ok_path_fudge(a,b,c,d,e) _ok_path_fudge(a,b,c,d,e,__LINE__)
80static void _ok_path_fudge(GpPath* path, const path_test_t *expected, INT expected_size,
81 BOOL todo_size, REAL fudge, int line)
82{
83 BYTE * types;
84 INT size, idx = 0, eidx = 0, numskip;
87
88 if(GdipGetPointCount(path, &size) != Ok){
89 skip("Cannot perform path comparisons due to failure to retrieve path.\n");
90 return;
91 }
92
93 todo_wine_if (todo_size)
94 ok_(__FILE__,line)(size == expected_size, "Path size %d does not match expected size %d\n",
95 size, expected_size);
96
97 points = malloc(size * sizeof(GpPointF));
98 types = malloc(size);
99
101 skip("Cannot perform path comparisons due to failure to retrieve path.\n");
102 goto end;
103 }
104
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) <= fudge &&
111 fabs(points[idx].Y - expected[eidx].Y) <= fudge;
112
113 stringify_point_type(expected[eidx].type, ename);
115
116 todo_wine_if (expected[eidx].todo || numskip)
117 ok_(__FILE__,line)(match, "Expected #%d: %s (%.6f,%.6f) but got %s (%.6f,%.6f)\n", eidx,
118 ename, expected[eidx].X, expected[eidx].Y,
119 name, points[idx].X, points[idx].Y);
120
121 if (match || expected[eidx].todo != 2)
122 idx++;
123 if (match || !numskip--)
124 numskip = expected[++eidx].wine_only_entries_preceding;
125 }
126
127end:
128 free(types);
129 free(points);
130}
131
133{
135 GpPath* path = NULL;
136
138 expect(Ok, status);
139 ok(path != NULL, "Expected path to be initialized\n");
140
143
145 expect(Ok, status);
146}
147
148static void test_getpathdata(void)
149{
150 GpPath *path;
153 INT count;
154
156 expect(Ok, status);
157 status = GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
158 expect(Ok, status);
159
161 expect(Ok, status);
162 expect(2, count);
163
164 data.Count = count;
165 data.Types = GdipAlloc(sizeof(BYTE) * count);
166 data.Points = GdipAlloc(sizeof(PointF) * count);
167
169 expect(Ok, status);
170 expect((data.Points[0].X == 5.0) && (data.Points[0].Y == 5.0) &&
171 (data.Points[1].X == 100.0) && (data.Points[1].Y == 50.0), TRUE);
172 expect((data.Types[0] == PathPointTypeStart) && (data.Types[1] == PathPointTypeLine), TRUE);
173
174 GdipFree(data.Points);
175 GdipFree(data.Types);
177}
178
179static void test_createpath2(void)
180{
182 GpPath* path = NULL;
184 INT i, count, expect_count;
185
186 PointF test_line_points[] = {{1.0,1.0}, {2.0,1.0}, {2.0,2.0}};
188
189 PointF test_bez_points[] = {{1.0,1.0}, {2.0,1.0}, {3.0,1.0}, {4.0,1.0},
190 {5.0,1.0}, {6.0,1.0}, {7.0,1.0}};
191 BYTE test_bez_types[] = {PathPointTypeStart, PathPointTypeBezier,
194
195 status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, &path);
196 expect(Ok, status);
198 expect(Ok, status);
199 expect(2, count);
201
202 status = GdipCreatePath2(test_line_points, test_line_types, 1, FillModeAlternate, &path);
203 expect(Ok, status);
205 expect(Ok, status);
206 expect(1, count);
208
209 path = (void *)0xdeadbeef;
210 status = GdipCreatePath2(test_line_points, test_line_types, 0, FillModeAlternate, &path);
212 ok(!path, "Expected NULL, got %p\n", path);
213 if(path && path != (void *)0xdeadbeef)
215
216 path = (void *)0xdeadbeef;
217 status = GdipCreatePath2(test_line_points, test_line_types, -1, FillModeAlternate, &path);
219 ok(!path, "Expected NULL, got %p\n", path);
220 if(path && path != (void *)0xdeadbeef)
222
223 path = (void *)0xdeadbeef;
224 status = GdipCreatePath2(NULL, test_line_types, 2, FillModeAlternate, &path);
226 ok(path == (void *)0xdeadbeef, "Expected %p, got %p\n", (void *)0xdeadbeef, path);
227 if(path && path != (void *)0xdeadbeef)
229
230 path = (void *)0xdeadbeef;
231 status = GdipCreatePath2(test_line_points, NULL, 2, FillModeAlternate, &path);
233 ok(path == (void *)0xdeadbeef, "Expected %p, got %p\n", (void *)0xdeadbeef, path);
234 if(path && path != (void *)0xdeadbeef)
236
237 status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, NULL);
239
240 /* Multi-point paths should not end with Start */
241 status = GdipCreatePath2(test_line_points, test_line_types, 3, FillModeAlternate, &path);
242 expect(Ok, status);
244 expect(Ok, status);
245 expect(0, count);
247
248 /* Zero-length line points do not get altered */
249 test_line_points[1].X = test_line_points[0].X;
250 test_line_points[1].Y = test_line_points[0].Y;
251 status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, &path);
252 expect(Ok, status);
254 expect(Ok, status);
255 expect(2, count);
257
258 /* The type of the first point is always converted to PathPointTypeStart */
259 test_line_types[0] = PathPointTypeLine;
260 status = GdipCreatePath2(test_line_points, test_line_types, 1, FillModeAlternate, &path);
261 expect(Ok, status);
263 expect(Ok, status);
264 expect(1, count);
265 data.Count = count;
266 data.Types = GdipAlloc(sizeof(BYTE) * count);
267 data.Points = GdipAlloc(sizeof(PointF) * count);
269 expect(Ok, status);
270 expect((data.Points[0].X == 1.0) && (data.Points[0].Y == 1.0), TRUE);
271 expect(data.Types[0], PathPointTypeStart);
272 GdipFree(data.Points);
273 GdipFree(data.Types);
275
276 /* Bezier points must come in groups of three */
277 for(i = 2; i <= 7; i++) {
278 expect_count = (i % 3 == 1) ? i : 0;
279 status = GdipCreatePath2(test_bez_points, test_bez_types, i, FillModeAlternate, &path);
280 expect(Ok, status);
282 expect(Ok, status);
283 expect(expect_count, count);
285 }
286}
287
289 {0.0, 50.0, PathPointTypeStart, 0, 0}, /*0*/
290 {5.0, 45.0, PathPointTypeLine, 0, 0}, /*1*/
291 {0.0, 40.0, PathPointTypeLine, 0, 0}, /*2*/
292 {15.0, 35.0, PathPointTypeLine, 0, 0}, /*3*/
293 {0.0, 30.0, PathPointTypeLine, 0, 0}, /*4*/
294 {25.0, 25.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*5*/
295 {0.0, 20.0, PathPointTypeStart, 0, 0}, /*6*/
296 {35.0, 15.0, PathPointTypeLine, 0, 0}, /*7*/
297 {0.0, 10.0, PathPointTypeLine, 0, 0} /*8*/
298 };
299
300static void test_line2(void)
301{
303 GpPath* path;
304 int i;
305 GpPointF line2_points[9];
306
307 for(i = 0; i < 9; i ++){
308 line2_points[i].X = i * 5.0 * (REAL)(i % 2);
309 line2_points[i].Y = 50.0 - i * 5.0;
310 }
311
313
314 status = GdipAddPathLine2(NULL, line2_points, 2);
318 status = GdipAddPathLine2(path, line2_points, 0);
320 status = GdipAddPathLine2(path, line2_points, -1);
322
323 status = GdipAddPathLine2(path, line2_points, 3);
324 expect(Ok, status);
325 status = GdipAddPathLine2(path, &(line2_points[3]), 3);
326 expect(Ok, status);
328 expect(Ok, status);
329 status = GdipAddPathLine2(path, &(line2_points[6]), 3);
330 expect(Ok, status);
331
333
335 status = GdipAddPathLine2(path, line2_points, 3);
336 expect(Ok, status);
337 status = GdipAddPathLine2(path, &(line2_points[2]), 3);
338 expect(Ok, status);
339
341
343}
344
346 {10.0, 10.0, PathPointTypeStart, 0, 0}, /*0*/
347 {20.0, 10.0, PathPointTypeBezier, 0, 0}, /*1*/
348 {20.0, 20.0, PathPointTypeBezier, 0, 0}, /*2*/
349 {30.0, 20.0, PathPointTypeBezier, 0, 0}, /*3*/
350 {40.0, 20.0, PathPointTypeBezier, 0, 0}, /*4*/
351 {40.0, 30.0, PathPointTypeBezier, 0, 0}, /*5*/
352 {50.0, 30.0, PathPointTypeBezier, 0, 0}, /*6*/
353 {50.0, 10.0, PathPointTypeLine, 0, 0}, /*7*/
354 {60.0, 10.0, PathPointTypeBezier, 0, 0}, /*8*/
355 {60.0, 20.0, PathPointTypeBezier, 0, 0}, /*9*/
356 {70.0, 20.0, PathPointTypeBezier, 0, 0} /*10*/
357 };
358
359static void test_bezier(void)
360{
362 GpPath* path;
363
365
366 status = GdipAddPathBezier(path, 10.0, 10.0, 20.0, 10.0, 20.0, 20.0, 30.0, 20.0);
367 expect(Ok, status);
368 status = GdipAddPathBezier(path, 30.0, 20.0, 40.0, 20.0, 40.0, 30.0, 50.0, 30.0);
369 expect(Ok, status);
370 status = GdipAddPathBezier(path, 50.0, 10.0, 60.0, 10.0, 60.0, 20.0, 70.0, 20.0);
371 expect(Ok, status);
372
374
376}
377
378static void test_beziers(void)
379{
381 GpPath* path;
382 PointF bezier_points1[] = {{10.0,10.0}, {20.0,10.0}, {20.0,20.0}, {30.0,20.0}};
383 PointF bezier_points2[] = {{30.0,20.0}, {40.0,20.0}, {40.0,30.0}, {50.0,30.0}};
384 PointF bezier_points3[] = {{50.0,10.0}, {60.0,10.0}, {60.0,20.0}, {70.0,20.0}};
385
387
388 status = GdipAddPathBeziers(path, bezier_points1, 4);
389 expect(Ok, status);
390 status = GdipAddPathBeziers(path, bezier_points2, 4);
391 expect(Ok, status);
392 status = GdipAddPathBeziers(path, bezier_points3, 4);
393 expect(Ok, status);
394
396
398}
399
401 {600.0, 450.0, PathPointTypeStart, 0, 0}, /*0*/
402 {600.0, 643.3, PathPointTypeBezier, 0, 0}, /*1*/
403 {488.1, 800.0, PathPointTypeBezier, 0, 0}, /*2*/
404 {350.0, 800.0, PathPointTypeBezier, 0, 0}, /*3*/
405 {600.0, 450.0, PathPointTypeLine, 0, 0}, /*4*/
406 {600.0, 643.3, PathPointTypeBezier, 0, 0}, /*5*/
407 {488.1, 800.0, PathPointTypeBezier, 0, 0}, /*6*/
408 {350.0, 800.0, PathPointTypeBezier, 0, 0}, /*7*/
409 {329.8, 800.0, PathPointTypeBezier, 0, 0}, /*8*/
410 {309.7, 796.6, PathPointTypeBezier, 0, 0}, /*9*/
411 {290.1, 789.8, PathPointTypeBezier, 0, 0}, /*10*/
412 {409.9, 110.2, PathPointTypeLine, 0, 0}, /*11*/
413 {544.0, 156.5, PathPointTypeBezier, 0, 0}, /*12*/
414 {625.8, 346.2, PathPointTypeBezier, 0, 0}, /*13*/
415 {592.7, 533.9, PathPointTypeBezier, 0, 0}, /*14*/
416 {592.5, 535.3, PathPointTypeBezier, 0, 0}, /*15*/
417 {592.2, 536.7, PathPointTypeBezier, 0, 0}, /*16*/
418 {592.0, 538.1, PathPointTypeBezier, 0, 0}, /*17*/
419 {409.9, 789.8, PathPointTypeLine, 0, 0}, /*18*/
420 {544.0, 743.5, PathPointTypeBezier, 0, 0}, /*19*/
421 {625.8, 553.8, PathPointTypeBezier, 0, 0}, /*20*/
422 {592.7, 366.1, PathPointTypeBezier, 0, 0}, /*21*/
423 {592.5, 364.7, PathPointTypeBezier, 0, 0}, /*22*/
424 {592.2, 363.3, PathPointTypeBezier, 0, 0}, /*23*/
425 {592.0, 361.9, PathPointTypeBezier, 0, 0}, /*24*/
426 {540.4, 676.9, PathPointTypeLine, 0, 0}, /*25*/
427 {629.9, 529.7, PathPointTypeBezier, 0, 0}, /*26*/
428 {617.2, 308.8, PathPointTypeBezier, 0, 0}, /*27*/
429 {512.1, 183.5, PathPointTypeBezier, 0, 0}, /*28*/
430 {406.9, 58.2, PathPointTypeBezier, 0, 0}, /*29*/
431 {249.1, 75.9, PathPointTypeBezier, 0, 0}, /*30*/
432 {159.6, 223.1, PathPointTypeBezier, 0, 0}, /*31*/
433 {70.1, 370.3, PathPointTypeBezier, 0, 0}, /*32*/
434 {82.8, 591.2, PathPointTypeBezier, 0, 0}, /*33*/
435 {187.9, 716.5, PathPointTypeBezier, 0, 0}, /*34*/
436 {293.1, 841.8, PathPointTypeBezier, 0, 0}, /*35*/
437 {450.9, 824.1, PathPointTypeBezier, 0, 0}, /*36*/
438 {540.4, 676.9, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 1} /*37*/
439 };
441 {1.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
442 {1.0, 0.5, PathPointTypeLine, 0, 0}, /*1*/
443 {1.0, 0.776142, PathPointTypeBezier, 0, 0}, /*2*/
444 {0.776142, 1.0, PathPointTypeBezier, 0, 0}, /*3*/
445 {0.5, 1.0, PathPointTypeBezier, 0, 0} /*4*/
446 };
447
448static void test_arc(void)
449{
451 GpPath* path;
452
454
455 status = GdipAddPathArc(path, 100.0, 100.0, 1.0, 0.0, 0.0, 90.0);
457
458 status = GdipAddPathArc(path, 100.0, 100.0, 0.0, 1.0, 0.0, 90.0);
460
461 status = GdipAddPathArc(path, 100.0, 100.0, -40, 1.0, 0.0, 90.0);
463
464 status = GdipAddPathArc(path, 100.0, 100.0, 1.0, -50.0, 0.0, 90.0);
466
468 /* Exactly 90 degrees */
469 status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
470 expect(Ok, status);
471 /* Over 90 degrees */
472 status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
473 expect(Ok, status);
474 /* Negative start angle */
475 status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
476 expect(Ok, status);
477 /* Negative sweep angle */
478 status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 80.0, -100.0);
479 expect(Ok, status);
480 /* More than a full revolution */
481 status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, -400.0);
482 expect(Ok, status);
483 /* 0 sweep angle */
484 status = GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 50.0, 0.0);
485 expect(Ok, status);
486
488
490 GdipAddPathLine(path, 1.0, 0.0, 1.0, 0.5);
491 status = GdipAddPathArc(path, 0.0, 0.0, 1.0, 1.0, 0.0, 90.0);
492 expect(Ok, status);
493
495
497}
498
499static void test_worldbounds(void)
500{
502 GpPath *path;
503 GpPen *pen;
505 GpRectF bounds;
506 GpPointF line2_points[10];
507 int i;
508
509 for(i = 0; i < 10; i ++){
510 line2_points[i].X = 200.0 + i * 50.0 * (i % 2);
511 line2_points[i].Y = 200.0 + i * 50.0 * !(i % 2);
512 }
513 GdipCreatePen1((ARGB)0xdeadbeef, 20.0, UnitWorld, &pen);
515 GdipCreateMatrix2(1.5, 0.0, 1.0, 1.2, 10.4, 10.2, &matrix);
516
518 GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
519 GdipAddPathLine2(path, &(line2_points[0]), 10);
521 expect(Ok, status);
523
524 expectf(200.0, bounds.X);
525 expectf(200.0, bounds.Y);
526 expectf(450.0, bounds.Width);
527 expectf(600.0, bounds.Height);
528
530 GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
531 GdipAddPathLine2(path, &(line2_points[0]), 10);
533 expect(Ok, status);
535
536 expectf(510.4, bounds.X);
537 expectf(250.2, bounds.Y);
538 expectf(1275.0, bounds.Width);
539 expectf(720.0, bounds.Height);
540
542 GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
543 GdipAddPathLine2(path, &(line2_points[0]), 10);
544 status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
545 expect(Ok, status);
547
548 expectf(100.0, bounds.X);
549 expectf(100.0, bounds.Y);
550 expectf(650.0, bounds.Width);
551 expectf(800.0, bounds.Height);
552
554 GdipAddPathLine2(path, &(line2_points[0]), 2);
555 status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
556 expect(Ok, status);
558
559 expectf(156.0, bounds.X);
560 expectf(156.0, bounds.Y);
561 expectf(138.0, bounds.Width);
562 expectf(88.0, bounds.Height);
563
564 line2_points[2].X = 2 * line2_points[1].X - line2_points[0].X;
565 line2_points[2].Y = 2 * line2_points[1].Y - line2_points[0].Y;
566
568 GdipAddPathLine2(path, &(line2_points[0]), 3);
569 status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
570 expect(Ok, status);
572
573 expectf(100.0, bounds.X);
574 expectf(100.0, bounds.Y);
575 expectf(300.0, bounds.Width);
576 expectf(200.0, bounds.Height);
577
579 GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 45.0, 20.0);
580 status = GdipGetPathWorldBounds(path, &bounds, NULL, pen);
581 expect(Ok, status);
583
584 expectf(386.7, bounds.X);
585 expectf(553.4, bounds.Y);
586 expectf(266.8, bounds.Width);
587 expectf(289.6, bounds.Height);
588
590 status = GdipGetPathWorldBounds(path, &bounds, matrix, pen);
591 expect(Ok, status);
593
594 expectf(0.0, bounds.X);
595 expectf(0.0, bounds.Y);
596 expectf(0.0, bounds.Width);
597 expectf(0.0, bounds.Height);
598
600 GdipAddPathLine2(path, &(line2_points[0]), 2);
601 status = GdipGetPathWorldBounds(path, &bounds, matrix, pen);
602 expect(Ok, status);
604
605 todo_wine{
606 expectf(427.9, bounds.X);
607 expectf(167.7, bounds.Y);
608 expectf(239.9, bounds.Width);
609 expectf(164.9, bounds.Height);
610 }
611
613 GdipCreateMatrix2(0.9, -0.5, -0.5, -1.2, 10.4, 10.2, &matrix);
615 GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, 0.0, 100.0);
616 GdipAddPathLine2(path, &(line2_points[0]), 10);
618 expect(Ok, status);
621
622 expectf(-209.6, bounds.X);
623 expectf(-1274.8, bounds.Y);
624 expectf(705.0, bounds.Width);
625 expectf(945.0, bounds.Height);
626
627 GdipDeletePen(pen);
628}
629
631 {600.00, 450.00, PathPointTypeStart, 0, 0}, /*0*/
632 {600.00, 643.30, PathPointTypeBezier, 0, 0}, /*1*/
633 {488.07, 800.00, PathPointTypeBezier, 0, 0}, /*2*/
634 {350.00, 800.00, PathPointTypeBezier, 0, 0}, /*3*/
635 {319.61, 797.40, PathPointTypeStart, 0, 0}, /*4*/
636 {182.56, 773.90, PathPointTypeBezier, 0, 0}, /*5*/
637 {85.07, 599.31, PathPointTypeBezier, 0, 0}, /*6*/
638 {101.85, 407.45, PathPointTypeBezier, 0, 0}, /*7*/
639 {102.54, 399.66, PathPointTypeBezier, 0, 0}, /*8*/
640 {103.40, 391.91, PathPointTypeBezier, 0, 0}, /*9*/
641 {104.46, 384.21, PathPointTypeBezier, 0, 0}, /*10*/
642 {409.92, 110.20, PathPointTypeLine, 0, 0}, /*11*/
643 {543.96, 156.53, PathPointTypeBezier, 0, 0}, /*12*/
644 {625.80, 346.22, PathPointTypeBezier, 0, 0}, /*13*/
645 {592.71, 533.88, PathPointTypeBezier, 0, 0}, /*14*/
646 {592.47, 535.28, PathPointTypeBezier, 0, 0}, /*15*/
647 {592.22, 536.67, PathPointTypeBezier, 0, 0}, /*16*/
648 {591.96, 538.06, PathPointTypeBezier, 0, 0}, /*17*/
649 {319.61, 797.40, PathPointTypeLine, 0, 0}, /*18*/
650 {182.56, 773.90, PathPointTypeBezier, 0, 0}, /*19*/
651 {85.07, 599.31, PathPointTypeBezier, 0, 0}, /*20*/
652 {101.85, 407.45, PathPointTypeBezier, 0, 0}, /*21*/
653 {102.54, 399.66, PathPointTypeBezier, 0, 0}, /*22*/
654 {103.40, 391.91, PathPointTypeBezier, 0, 0}, /*23*/
655 {104.46, 384.21, PathPointTypeBezier, 0, 0} /*24*/
656 };
657
658static void test_pathpath(void)
659{
661 GpPath* path1, *path2;
662
664 GdipAddPathArc(path2, 100.0, 100.0, 500.0, 700.0, 95.0, 100.0);
665
667 GdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, 0.0, 90.0);
669 expect(Ok, status);
670 GdipAddPathArc(path1, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
672 expect(Ok, status);
673
675
678}
679
681 {30.00, 125.25, PathPointTypeStart, 0, 0}, /*0*/
682 {30.00, 139.20, PathPointTypeBezier, 0, 0}, /*1*/
683 {25.52, 150.50, PathPointTypeBezier, 0, 0}, /*2*/
684 {20.00, 150.50, PathPointTypeBezier, 0, 0}, /*3*/
685 {14.48, 150.50, PathPointTypeBezier, 0, 0}, /*4*/
686 {10.00, 139.20, PathPointTypeBezier, 0, 0}, /*5*/
687 {10.00, 125.25, PathPointTypeBezier, 0, 0}, /*6*/
688 {10.00, 111.30, PathPointTypeBezier, 0, 0}, /*7*/
689 {14.48, 100.00, PathPointTypeBezier, 0, 0}, /*8*/
690 {20.00, 100.00, PathPointTypeBezier, 0, 0}, /*9*/
691 {25.52, 100.00, PathPointTypeBezier, 0, 0}, /*10*/
692 {30.00, 111.30, PathPointTypeBezier, 0, 0}, /*11*/
693 {30.00, 125.25, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0}, /*12*/
694 {7.00, 11.00, PathPointTypeStart, 0, 0}, /*13*/
695 {13.00, 17.00, PathPointTypeLine, 0, 0}, /*14*/
696 {5.00, 195.00, PathPointTypeStart, 0, 0}, /*15*/
697 {5.00, 192.24, PathPointTypeBezier, 0, 0}, /*16*/
698 {6.12, 190.00, PathPointTypeBezier, 0, 0}, /*17*/
699 {7.50, 190.00, PathPointTypeBezier, 0, 0}, /*18*/
700 {8.88, 190.00, PathPointTypeBezier, 0, 0}, /*19*/
701 {10.00, 192.24, PathPointTypeBezier, 0, 0}, /*20*/
702 {10.00, 195.00, PathPointTypeBezier, 0, 0}, /*21*/
703 {10.00, 197.76, PathPointTypeBezier, 0, 0}, /*22*/
704 {8.88, 200.00, PathPointTypeBezier, 0, 0}, /*23*/
705 {7.50, 200.00, PathPointTypeBezier, 0, 0}, /*24*/
706 {6.12, 200.00, PathPointTypeBezier, 0, 0}, /*25*/
707 {5.00, 197.76, PathPointTypeBezier, 0, 0}, /*26*/
708 {5.00, 195.00, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0}, /*27*/
709 {10.00, 300.50, PathPointTypeStart, 0, 0}, /*28*/
710 {10.00, 300.78, PathPointTypeBezier, 0, 0}, /*29*/
711 {10.00, 301.00, PathPointTypeBezier, 0, 0}, /*30*/
712 {10.00, 301.00, PathPointTypeBezier, 0, 0}, /*31*/
713 {10.00, 301.00, PathPointTypeBezier, 0, 0}, /*32*/
714 {10.00, 300.78, PathPointTypeBezier, 0, 0}, /*33*/
715 {10.00, 300.50, PathPointTypeBezier, 0, 0}, /*34*/
716 {10.00, 300.22, PathPointTypeBezier, 0, 0}, /*35*/
717 {10.00, 300.00, PathPointTypeBezier, 0, 0}, /*36*/
718 {10.00, 300.00, PathPointTypeBezier, 0, 0}, /*37*/
719 {10.00, 300.00, PathPointTypeBezier, 0, 0}, /*38*/
720 {10.00, 300.22, PathPointTypeBezier, 0, 0}, /*39*/
721 {10.00, 300.50, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0} /*40*/
722 };
723
724static void test_ellipse(void)
725{
727 GpPath *path;
728 GpPointF points[2];
729
730 points[0].X = 7.0;
731 points[0].Y = 11.0;
732 points[1].X = 13.0;
733 points[1].Y = 17.0;
734
736 status = GdipAddPathEllipse(path, 10.0, 100.0, 20.0, 50.5);
737 expect(Ok, status);
739 status = GdipAddPathEllipse(path, 10.0, 200.0, -5.0, -10.0);
740 expect(Ok, status);
742 status = GdipAddPathEllipse(path, 10.0, 300.0, 0.0, 1.0);
743 expect(Ok, status);
744
746
748}
749
751 {5.00, 5.00, PathPointTypeStart, 0, 0}, /*0*/
752 {6.00, 8.00, PathPointTypeLine, 0, 0}, /*1*/
753 {409.92, 110.20, PathPointTypeLine, 0, 0}, /*2*/
754 {543.96, 156.53, PathPointTypeBezier, 0, 0}, /*3*/
755 {625.80, 346.22, PathPointTypeBezier, 0, 0}, /*4*/
756 {592.71, 533.88, PathPointTypeBezier, 0, 0}, /*5*/
757 {592.47, 535.28, PathPointTypeBezier, 0, 0}, /*6*/
758 {592.22, 536.67, PathPointTypeBezier, 0, 0}, /*7*/
759 {591.96, 538.06, PathPointTypeBezier, 0, 0}, /*8*/
760 {15.00, 15.00, PathPointTypeLine, 0, 0}, /*9*/
761 {26.00, 28.00, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*10*/
762 {35.00, 35.00, PathPointTypeStart, 0, 0}, /*11*/
763 {36.00, 38.00, PathPointTypeLine, 0, 0}, /*12*/
764 {39.00, 40.00, PathPointTypeLine, 0, 0} /*13*/
765 };
766
767static void test_linei(void)
768{
770 GpPath *path;
771
773 status = GdipAddPathLineI(path, 5.0, 5.0, 6.0, 8.0);
774 expect(Ok, status);
775 GdipAddPathArc(path, 100.0, 100.0, 500.0, 700.0, -80.0, 100.0);
776 status = GdipAddPathLineI(path, 15.0, 15.0, 26.0, 28.0);
777 expect(Ok, status);
779 status = GdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0);
780 expect(Ok, status);
781 status = GdipAddPathLineI(path, 36, 38, 39, 40);
782 expect(Ok, status);
783
785
787}
788
790 {5.00, 5.00, PathPointTypeStart, 0, 0}, /*1*/
791 {6.00, 8.00, PathPointTypeLine, 0, 0}, /*2*/
792 {0.00, 0.00, PathPointTypeStart, 0, 0}, /*3*/
793 {10.00, 10.00, PathPointTypeLine, 0, 0}, /*4*/
794 {10.00, 20.00, PathPointTypeLine, 0, 0}, /*5*/
795 {30.00, 10.00, PathPointTypeLine, 0, 0}, /*6*/
796 {20.00, 0.00, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*7*/
797 };
798
799static void test_polygon(void)
800{
802 GpPath *path;
803 GpPointF points[5];
804
805 points[0].X = 0.0;
806 points[0].Y = 0.0;
807 points[1].X = 10.0;
808 points[1].Y = 10.0;
809 points[2].X = 10.0;
810 points[2].Y = 20.0;
811 points[3].X = 30.0;
812 points[3].Y = 10.0;
813 points[4].X = 20.0;
814 points[4].Y = 0.0;
815
817
818 /* NULL args */
823 /* Polygon should have 3 points at least */
826
827 /* to test how it prolongs not empty path */
828 status = GdipAddPathLine(path, 5.0, 5.0, 6.0, 8.0);
829 expect(Ok, status);
831 expect(Ok, status);
832 /* check resulting path */
834
836}
837
839 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
840 {105.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
841 {105.0, 55.0, PathPointTypeLine, 0, 0}, /*2*/
842 {5.0, 55.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*3*/
843
844 {100.0, 50.0, PathPointTypeStart, 0, 0}, /*4*/
845 {220.0, 50.0, PathPointTypeLine, 0, 0}, /*5*/
846 {220.0, 80.0, PathPointTypeLine, 0, 0}, /*6*/
847 {100.0, 80.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0} /*7*/
848 };
849
850static void test_rect(void)
851{
853 GpPath *path;
854 GpRectF rects[2];
855
857 status = GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
858 expect(Ok, status);
859 status = GdipAddPathRectangle(path, 100.0, 50.0, 120.0, 30.0);
860 expect(Ok, status);
861
863
865
867
868 rects[0].X = 5.0;
869 rects[0].Y = 5.0;
870 rects[0].Width = 100.0;
871 rects[0].Height = 50.0;
872 rects[1].X = 100.0;
873 rects[1].Y = 50.0;
874 rects[1].Width = 120.0;
875 rects[1].Height = 30.0;
876
878 expect(Ok, status);
879
881
883}
884
885static void test_lastpoint(void)
886{
888 GpPath *path;
889 GpPointF ptf;
890
892 status = GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
893 expect(Ok, status);
894
895 /* invalid args */
902
904 expect(Ok, status);
905 expect(TRUE, (ptf.X == 5.0) && (ptf.Y == 55.0));
906
908}
909
911 {0.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
912 {3.3, 3.3, PathPointTypeBezier, 0, 0}, /*1*/
913 {6.7, 3.3, PathPointTypeBezier, 0, 0}, /*2*/
914 {10.0, 10.0, PathPointTypeBezier, 0, 0}, /*3*/
915 {13.3, 16.7, PathPointTypeBezier, 0, 0}, /*4*/
916 {3.3, 20.0, PathPointTypeBezier, 0, 0}, /*5*/
917 {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*6*/
918 {16.7, 20.0, PathPointTypeBezier, 0, 0}, /*7*/
919 {23.3, 13.3, PathPointTypeBezier, 0, 0}, /*8*/
920 {30.0, 10.0, PathPointTypeBezier, 0, 0} /*9*/
921 };
923 {0.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
924 {1.66, 1.66, PathPointTypeBezier, 0, 0}, /*1*/
925 {8.33, 6.66, PathPointTypeBezier, 0, 0}, /*2*/
926 {10.0, 10.0, PathPointTypeBezier, 0, 0}, /*3*/
927 {11.6, 13.3, PathPointTypeBezier, 0, 0}, /*4*/
928 {6.66, 20.0, PathPointTypeBezier, 0, 0}, /*5*/
929 {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*6*/
930 {13.3, 20.0, PathPointTypeBezier, 0, 0}, /*7*/
931 {26.6, 11.6, PathPointTypeBezier, 0, 0}, /*8*/
932 {30.0, 10.0, PathPointTypeBezier, 0, 0} /*9*/
933 };
935 {100.0,120.0,PathPointTypeStart, 0, 0}, /*0*/
936 {123.0,10.0, PathPointTypeLine, 0, 0}, /*1*/
937 {0.0, 0.0, PathPointTypeLine, 0, 0}, /*2*/
938 {3.3, 3.3, PathPointTypeBezier, 0, 0}, /*3*/
939 {6.7, 3.3, PathPointTypeBezier, 0, 0}, /*4*/
940 {10.0, 10.0, PathPointTypeBezier, 0, 0}, /*5*/
941 {13.3, 16.7, PathPointTypeBezier, 0, 0}, /*6*/
942 {3.3, 20.0, PathPointTypeBezier, 0, 0}, /*7*/
943 {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*8*/
944 {16.7, 20.0, PathPointTypeBezier, 0, 0}, /*9*/
945 {23.3, 13.3, PathPointTypeBezier, 0, 0}, /*10*/
946 {30.0, 10.0, PathPointTypeBezier, 0, 0} /*11*/
947 };
949 {10.0, 10.0, PathPointTypeStart, 0, 0}, /*0*/
950 {13.3, 16.7, PathPointTypeBezier, 0, 0}, /*1*/
951 {3.3, 20.0, PathPointTypeBezier, 0, 0}, /*2*/
952 {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*3*/
953 {16.7, 20.0, PathPointTypeBezier, 0, 0}, /*4*/
954 {23.3, 13.3, PathPointTypeBezier, 0, 0}, /*5*/
955 {30.0, 10.0, PathPointTypeBezier, 0, 0} /*6*/
956 };
958 {0.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
959 {3.33, 3.33, PathPointTypeBezier, 0, 0}, /*1*/
960 {6.66, 3.33, PathPointTypeBezier, 0, 0}, /*2*/
961 {10.0, 10.0, PathPointTypeBezier, 0, 0}, /*3*/
962 };
964 {10.0, 10.0, PathPointTypeStart, 0, 0}, /*0*/
965 {13.3, 16.6, PathPointTypeBezier, 0, 0}, /*1*/
966 {3.33, 20.0, PathPointTypeBezier, 0, 0}, /*2*/
967 {10.0, 20.0, PathPointTypeBezier, 0, 0} /*3*/
968 };
969
970static void test_addcurve(void)
971{
973 GpPath *path;
974 GpPointF points[4];
975
976 points[0].X = 0.0;
977 points[0].Y = 0.0;
978 points[1].X = 10.0;
979 points[1].Y = 10.0;
980 points[2].X = 10.0;
981 points[2].Y = 20.0;
982 points[3].X = 30.0;
983 points[3].Y = 10.0;
984
986
987 /* NULL args */
988 status = GdipAddPathCurve2(NULL, NULL, 0, 0.0);
990 status = GdipAddPathCurve2(path, NULL, 0, 0.0);
992 status = GdipAddPathCurve2(path, points, -1, 0.0);
996
997 /* add to empty path */
999 expect(Ok, status);
1002
1003 /* add to empty path with default tension */
1006 expect(Ok, status);
1009
1010 /* add to notempty path and opened figure */
1012 GdipAddPathLine(path, 100.0, 120.0, 123.0, 10.0);
1013 status = GdipAddPathCurve2(path, points, 4, 1.0);
1014 expect(Ok, status);
1016
1017 /* NULL args */
1019 status = GdipAddPathCurve3(NULL, NULL, 0, 0, 0, 0.0);
1021 status = GdipAddPathCurve3(path, NULL, 0, 0, 0, 0.0);
1023 /* wrong count, offset.. */
1024 status = GdipAddPathCurve3(path, points, 0, 0, 0, 0.0);
1026 status = GdipAddPathCurve3(path, points, 4, 0, 0, 0.0);
1028 status = GdipAddPathCurve3(path, points, 4, 0, 4, 0.0);
1030 status = GdipAddPathCurve3(path, points, 4, 1, 3, 0.0);
1032 status = GdipAddPathCurve3(path, points, 4, 1, 0, 0.0);
1034 status = GdipAddPathCurve3(path, points, 4, 3, 1, 0.0);
1036
1037 /* use all points */
1038 status = GdipAddPathCurve3(path, points, 4, 0, 3, 1.0);
1039 expect(Ok, status);
1042
1043 /* Skip first point */
1044 status = GdipAddPathCurve3(path, points, 4, 1, 2, 1.0);
1045 expect(Ok, status);
1048
1049 /* Skip two last points */
1050 status = GdipAddPathCurve3(path, points, 4, 0, 1, 1.0);
1051 expect(Ok, status);
1054
1055 /* Skip first and last points */
1056 status = GdipAddPathCurve3(path, points, 4, 1, 1, 1.0);
1057 expect(Ok, status);
1060
1062}
1063
1065 {0.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
1066 {-6.7, 0.0, PathPointTypeBezier, 0, 0}, /*1*/
1067 {6.7, 3.3, PathPointTypeBezier, 0, 0}, /*2*/
1068 {10.0, 10.0, PathPointTypeBezier, 0, 0}, /*3*/
1069 {13.3, 16.7, PathPointTypeBezier, 0, 0}, /*4*/
1070 {3.3, 20.0, PathPointTypeBezier, 0, 0}, /*5*/
1071 {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*6*/
1072 {16.7, 20.0, PathPointTypeBezier, 0, 0}, /*7*/
1073 {33.3, 16.7, PathPointTypeBezier, 0, 0}, /*8*/
1074 {30.0, 10.0, PathPointTypeBezier, 0, 0}, /*9*/
1075 {26.7, 3.3, PathPointTypeBezier, 0, 0}, /*10*/
1076 {6.7, 0.0, PathPointTypeBezier, 0, 0}, /*11*/
1077 {0.0, 0.0, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0} /*12*/
1078 };
1080 {0.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
1081 {-3.33, 0.0, PathPointTypeBezier, 0, 0}, /*1*/
1082 {8.33, 6.66, PathPointTypeBezier, 0, 0}, /*2*/
1083 {10.0, 10.0, PathPointTypeBezier, 0, 0}, /*3*/
1084 {11.6, 13.3, PathPointTypeBezier, 0, 0}, /*4*/
1085 {6.66, 20.0, PathPointTypeBezier, 0, 0}, /*5*/
1086 {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*6*/
1087 {13.3, 20.0, PathPointTypeBezier, 0, 0}, /*7*/
1088 {31.6, 13.3, PathPointTypeBezier, 0, 0}, /*8*/
1089 {30.0, 10.0, PathPointTypeBezier, 0, 0}, /*9*/
1090 {28.3, 6.66, PathPointTypeBezier, 0, 0}, /*10*/
1091 {3.33, 0.0, PathPointTypeBezier, 0, 0}, /*11*/
1092 {0.0, 0.0, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0} /*12*/
1093 };
1094static void test_addclosedcurve(void)
1095{
1097 GpPath *path;
1098 GpPointF points[4];
1099
1100 points[0].X = 0.0;
1101 points[0].Y = 0.0;
1102 points[1].X = 10.0;
1103 points[1].Y = 10.0;
1104 points[2].X = 10.0;
1105 points[2].Y = 20.0;
1106 points[3].X = 30.0;
1107 points[3].Y = 10.0;
1108
1110
1111 /* NULL args */
1120
1121 /* add to empty path */
1123 expect(Ok, status);
1126
1127 /* add to empty path with default tension */
1130 expect(Ok, status);
1133}
1134
1136 {0.0, 20.0, PathPointTypeStart, 0, 0}, /*0*/
1137 {25.0, 25.0, PathPointTypeLine, 0, 0}, /*1*/
1138 {0.0, 30.0, PathPointTypeLine, 0, 0}, /*2*/
1139 {15.0, 35.0, PathPointTypeStart, 0, 0}, /*3*/
1140 {0.0, 40.0, PathPointTypeLine, 0, 0}, /*4*/
1141 {5.0, 45.0, PathPointTypeLine, 0, 0}, /*5*/
1142 {0.0, 50.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0} /*6*/
1143 };
1144
1145static void test_reverse(void)
1146{
1148 GpPath *path;
1149 GpPointF pts[7];
1150 INT i;
1151
1152 for(i = 0; i < 7; i++){
1153 pts[i].X = i * 5.0 * (REAL)(i % 2);
1154 pts[i].Y = 50.0 - i * 5.0;
1155 }
1156
1158
1159 /* NULL argument */
1162
1163 /* empty path */
1165 expect(Ok, status);
1166
1167 GdipAddPathLine2(path, pts, 4);
1169 GdipAddPathLine2(path, &(pts[4]), 3);
1170
1172 expect(Ok, status);
1174
1176}
1177
1179 {50.0, 25.0, PathPointTypeStart, 0, 0}, /*0*/
1180 {97.2, 33.3, PathPointTypeLine, 0, 0}, /*1*/
1181 {91.8, 40.9, PathPointTypeBezier,0, 0}, /*2*/
1182 {79.4, 46.8, PathPointTypeBezier,0, 0}, /*3*/
1183 {63.9, 49.0, PathPointTypeBezier | PathPointTypeCloseSubpath, 0, 0} /*4*/
1184 };
1186 {0.0, 30.0, PathPointTypeStart | PathPointTypeCloseSubpath, 0, 0} /*0*/
1187 };
1189 {30.0, 0.0, PathPointTypeStart | PathPointTypeCloseSubpath, 0, 0} /*0*/
1190 };
1191static void test_addpie(void)
1192{
1194 GpPath *path;
1195
1197
1198 /* NULL argument */
1199 status = GdipAddPathPie(NULL, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0);
1201
1202 status = GdipAddPathPie(path, 0.0, 0.0, 100.0, 50.0, 10.0, 50.0);
1203 expect(Ok, status);
1206 expect(Ok, status);
1207
1208 /* zero width base ellipse */
1209 status = GdipAddPathPie(path, 0.0, 0.0, 0.0, 60.0, -90.0, 24.0);
1213 expect(Ok, status);
1214
1215 /* zero height base ellipse */
1216 status = GdipAddPathPie(path, 0.0, 0.0, 60.0, 0.0 , -90.0, 24.0);
1219
1221}
1222
1224 {100.0, 25.0,PathPointTypeStart, 0, 0}, /*0*/
1225 {99.0, 30.0, PathPointTypeLine, 0, 0}, /*1*/
1226 {96.0, 34.8, PathPointTypeLine, 0, 0}, /*2*/
1227 {91.5, 39.0, PathPointTypeLine, 0, 0}, /*3*/
1228 {85.5, 42.8, PathPointTypeLine, 0, 0}, /*4*/
1229 {69.5, 48.0, PathPointTypeLine, 0, 1}, /*5*/
1230 {50.0, 50.0, PathPointTypeLine, 0, 1}, /*6*/
1231 {30.5, 48.0, PathPointTypeLine, 0, 1}, /*7*/
1232 {14.8, 42.8, PathPointTypeLine, 0, 1}, /*8*/
1233 {8.5, 39.0, PathPointTypeLine, 0, 1}, /*9*/
1234 {4.0, 34.8, PathPointTypeLine, 0, 1}, /*10*/
1235 {1.0, 30.0, PathPointTypeLine, 0, 1}, /*11*/
1236 {0.0, 25.0, PathPointTypeLine, 0, 1}, /*12*/
1237 {1.0, 20.0, PathPointTypeLine, 0, 1}, /*13*/
1238 {4.0, 15.3, PathPointTypeLine, 0, 1}, /*14*/
1239 {8.5, 11.0, PathPointTypeLine, 0, 1}, /*15*/
1240 {14.8, 7.3, PathPointTypeLine, 0, 1}, /*16*/
1241 {30.5, 2.0, PathPointTypeLine, 0, 1}, /*17*/
1242 {50.0, 0.0, PathPointTypeLine, 0, 1}, /*18*/
1243 {69.5, 2.0, PathPointTypeLine, 0, 1}, /*19*/
1244 {85.5, 7.3, PathPointTypeLine, 0, 1}, /*20*/
1245 {91.5, 11.0, PathPointTypeLine, 0, 1}, /*21*/
1246 {96.0, 15.3, PathPointTypeLine, 0, 1}, /*22*/
1247 {99.0, 20.0, PathPointTypeLine, 0, 1}, /*23*/
1248 {100.0,25.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 1} /*24*/
1249 };
1250
1252 {5.0, 10.0,PathPointTypeStart, 0, 0}, /*0*/
1253 {50.0, 100.0, PathPointTypeLine, 0, 0} /*1*/
1254 };
1255
1257 {100.0, 25.0,PathPointTypeStart, 0, 0}, /*0*/
1258 {99.0, 30.0, PathPointTypeLine, 0, 0}, /*1*/
1259 {96.0, 34.8, PathPointTypeLine, 0, 0}, /*2*/
1260 {91.5, 39.0, PathPointTypeLine, 0, 0}, /*3*/
1261 {85.5, 42.8, PathPointTypeLine, 0, 0}, /*4*/
1262 {69.5, 48.0, PathPointTypeLine, 0, 1}, /*5*/
1263 {50.0, 50.0, PathPointTypeLine, 0, 1} /*6*/
1264 };
1265
1267 {100.0, 50.0,PathPointTypeStart, 0, 0}, /*0*/
1268 {99.0, 60.0, PathPointTypeLine, 0, 0}, /*1*/
1269 {96.0, 69.5, PathPointTypeLine, 0, 0}, /*2*/
1270 {91.5, 78.0, PathPointTypeLine, 0, 0}, /*3*/
1271 {85.5, 85.5, PathPointTypeLine, 0, 0}, /*4*/
1272 {78.0, 91.5, PathPointTypeLine, 0, 0}, /*5*/
1273 {69.5, 96.0, PathPointTypeLine, 0, 0}, /*6*/
1274 {60.0, 99.0, PathPointTypeLine, 0, 0}, /*7*/
1275 {50.0, 100.0,PathPointTypeLine, 0, 0} /*8*/
1276 };
1277
1278static void test_flatten(void)
1279{
1281 GpPath *path;
1282 GpMatrix *m;
1283
1285 expect(Ok, status);
1287 expect(Ok, status);
1288
1289 /* NULL arguments */
1292 status = GdipFlattenPath(NULL, m, 0.0);
1294
1295 /* flatten empty path */
1297 expect(Ok, status);
1298
1300 expect(Ok, status);
1301
1302 status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 50.0);
1303 expect(Ok, status);
1304
1306 expect(Ok, status);
1308
1310 expect(Ok, status);
1311 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 100.0);
1312 expect(Ok, status);
1314 expect(Ok, status);
1316
1318 expect(Ok, status);
1319 status = GdipAddPathArc(path, 0.0, 0.0, 100.0, 50.0, 0.0, 90.0);
1320 expect(Ok, status);
1322 expect(Ok, status);
1324
1325 /* easy case - quater of a full circle */
1327 expect(Ok, status);
1328 status = GdipAddPathArc(path, 0.0, 0.0, 100.0, 100.0, 0.0, 90.0);
1329 expect(Ok, status);
1331 expect(Ok, status);
1333
1335 expect(Ok, status);
1337 expect(Ok, status);
1338
1339 /* path seen in the wild that caused a stack overflow */
1340 /* same path but redo with the manual points that caused a crash */
1341 status = GdipAddPathBezier(path, 154.950806, 33.391144, 221.586075, 15.536285, 291.747314, 15.536285, 358.382568, 33.391144);
1342 expect(Ok, status);
1343 status = GdipAddPathBezier(path, 256.666809, 412.999512, 256.666718, 412.999481, 256.666656, 412.999481, 256.666565, 412.999512);
1344 expect(Ok, status);
1346 expect(Ok, status);
1348 expect(Ok, status);
1349
1352}
1353
1355 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1356 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1357 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1358 {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/
1359 };
1360
1362 {5.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
1363 {50.0, 0.0, PathPointTypeLine, 0, 0}, /*1*/
1364 {50.0, 20.0, PathPointTypeLine, 0, 0}, /*2*/
1365 {5.0, 20.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/
1366 };
1367
1369 {5.0, 0.0, PathPointTypeStart, 0, 0}, /*0*/
1370 {35.0, 0.0, PathPointTypeLine, 0, 0}, /*1*/
1371 {35.0, 10.0, PathPointTypeLine, 0, 0}, /*2*/
1372 {5.0, 10.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1373 {45.0, 0.0, PathPointTypeStart, 0, 0}, /*4*/
1374 {50.0, 0.0, PathPointTypeLine, 0, 0}, /*5*/
1375 {50.0, 10.0, PathPointTypeLine, 0, 0}, /*6*/
1376 {45.0, 10.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
1377 };
1378
1380 {5.0, 4.75, PathPointTypeStart, 0, 0}, /*0*/
1381 {8.0, 4.75, PathPointTypeLine, 0, 0}, /*1*/
1382 {8.0, 5.25, PathPointTypeLine, 0, 0}, /*2*/
1383 {5.0, 5.25, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1384 {9.0, 4.75, PathPointTypeStart, 0, 0}, /*4*/
1385 {9.5, 4.75, PathPointTypeLine, 0, 0}, /*5*/
1386 {9.5, 5.25, PathPointTypeLine, 0, 0}, /*6*/
1387 {9.0, 5.25, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
1388 };
1389
1391 {5.0, 9.5, PathPointTypeStart, 0, 0}, /*0*/
1392 {50.0, 9.5, PathPointTypeLine, 0, 0}, /*1*/
1393 {50.0, 10.5, PathPointTypeLine, 0, 0}, /*2*/
1394 {5.0, 10.5, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/
1395 };
1396
1397static void test_widen(void)
1398{
1400 GpPath *path;
1401 GpPen *pen;
1402 GpMatrix *m;
1403 INT count=-1;
1404
1406 expect(Ok, status);
1407 status = GdipCreatePen1(0xffffffff, 10.0, UnitPixel, &pen);
1408 expect(Ok, status);
1410 expect(Ok, status);
1411
1412 /* NULL arguments */
1413 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0);
1414 expect(Ok, status);
1415 status = GdipWidenPath(NULL, NULL, NULL, 0.0);
1417 status = GdipWidenPath(path, pen, m, 0.0);
1418 expect(Ok, status);
1419 status = GdipWidenPath(path, pen, NULL, 1.0);
1420 expect(Ok, status);
1421 status = GdipWidenPath(path, NULL, m, 1.0);
1423 status = GdipWidenPath(NULL, pen, m, 1.0);
1425
1426 /* widen empty path */
1428 expect(Ok, status);
1429 status = GdipWidenPath(path, pen, m, 1.0);
1431
1432 /* horizontal line */
1434 expect(Ok, status);
1435 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0);
1436 expect(Ok, status);
1437
1438 status = GdipWidenPath(path, pen, m, 1.0);
1439 expect(Ok, status);
1441
1442 /* horizontal 2x stretch */
1444 expect(Ok, status);
1445 status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0);
1446 expect(Ok, status);
1447
1449 expect(Ok, status);
1450
1451 status = GdipWidenPath(path, pen, m, 1.0);
1452 expect(Ok, status);
1454
1455 /* vertical 2x stretch */
1457 expect(Ok, status);
1458 status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0);
1459 expect(Ok, status);
1460
1462 expect(Ok, status);
1463
1464 status = GdipWidenPath(path, pen, m, 1.0);
1465 expect(Ok, status);
1467
1469 expect(Ok, status);
1470
1471 /* dashed line */
1473 expect(Ok, status);
1474 status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0);
1475 expect(Ok, status);
1476
1478 expect(Ok, status);
1479
1480 status = GdipWidenPath(path, pen, m, 1.0);
1481 expect(Ok, status);
1483
1485 expect(Ok, status);
1486
1487 /* dashed line less than 1 pixel wide */
1488 GdipDeletePen(pen);
1489 GdipCreatePen1(0xffffffff, 0.5, UnitPixel, &pen);
1491
1493 GdipAddPathLine(path, 5.0, 5.0, 9.5, 5.0);
1494
1495 status = GdipWidenPath(path, pen, m, 1.0);
1496 expect(Ok, status);
1498
1499 /* pen width in UnitWorld */
1500 GdipDeletePen(pen);
1501 status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen);
1502 expect(Ok, status);
1503
1505 expect(Ok, status);
1506 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0);
1507 expect(Ok, status);
1508
1509 status = GdipWidenPath(path, pen, m, 1.0);
1510 expect(Ok, status);
1512
1513 /* horizontal 2x stretch */
1515 expect(Ok, status);
1516 status = GdipAddPathLine(path, 2.5, 10.0, 25.0, 10.0);
1517 expect(Ok, status);
1518
1520 expect(Ok, status);
1521
1522 status = GdipWidenPath(path, pen, m, 1.0);
1523 expect(Ok, status);
1525
1526 /* vertical 2x stretch */
1528 expect(Ok, status);
1529 status = GdipAddPathLine(path, 5.0, 5.0, 50.0, 5.0);
1530 expect(Ok, status);
1531
1533 expect(Ok, status);
1534
1535 status = GdipWidenPath(path, pen, m, 1.0);
1536 expect(Ok, status);
1538
1540 expect(Ok, status);
1541
1542 /* pen width in UnitInch */
1543 GdipDeletePen(pen);
1544 status = GdipCreatePen1(0xffffffff, 10.0, UnitWorld, &pen);
1545 expect(Ok, status);
1546
1548 expect(Ok, status);
1549 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0);
1550 expect(Ok, status);
1551
1552 status = GdipWidenPath(path, pen, m, 1.0);
1553 expect(Ok, status);
1555
1556 /* pen width = 0 pixels - native fails to widen but can draw with this pen */
1557 GdipDeletePen(pen);
1558 status = GdipCreatePen1(0xffffffff, 0.0, UnitPixel, &pen);
1559 expect(Ok, status);
1560
1562 expect(Ok, status);
1563 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0);
1564 expect(Ok, status);
1565
1566 status = GdipWidenPath(path, pen, m, 1.0);
1567 expect(Ok, status);
1568
1570 expect(Ok, status);
1571 ok(count == 0 || broken(count == 4), "expected 0, got %i\n", count);
1572
1573 /* pen width = 0 pixels, UnitWorld - result is a path 1 unit wide */
1574 GdipDeletePen(pen);
1575 status = GdipCreatePen1(0xffffffff, 0.0, UnitWorld, &pen);
1576 expect(Ok, status);
1577
1579 expect(Ok, status);
1580 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0);
1581 expect(Ok, status);
1582
1583 status = GdipWidenPath(path, pen, m, 1.0);
1584 expect(Ok, status);
1585
1587 expect(Ok, status);
1589
1591 GdipDeletePen(pen);
1593}
1594
1596 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1597 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1598 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1599 {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/
1600 };
1601
1603 {0.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1604 {55.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1605 {55.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1606 {0.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*3*/
1607 };
1608
1610 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1611 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1612 {52.761421, 5.0, PathPointTypeBezier, 0, 0}, /*2*/
1613 {55.0, 7.238576, PathPointTypeBezier, 0, 0}, /*3*/
1614 {55.0, 10.0, PathPointTypeBezier, 0, 0}, /*4*/
1615 {55.0, 12.761423, PathPointTypeBezier, 0, 0}, /*5*/
1616 {52.761421, 15.0, PathPointTypeBezier, 0, 0}, /*6*/
1617 {50.0, 15.0, PathPointTypeBezier, 0, 0}, /*7*/
1618 {5.0, 15.0, PathPointTypeLine, 0, 0}, /*8*/
1619 {2.238576, 15.0, PathPointTypeBezier, 0, 0}, /*9*/
1620 {0.0, 12.761423, PathPointTypeBezier, 0, 0}, /*10*/
1621 {0.0, 10.0, PathPointTypeBezier, 0, 0}, /*11*/
1622 {0.0, 7.238576, PathPointTypeBezier, 0, 0}, /*12*/
1623 {2.238576, 5.0, PathPointTypeBezier, 0, 0}, /*13*/
1624 {5.0, 5.0, PathPointTypeBezier|PathPointTypeCloseSubpath, 0, 0}, /*14*/
1625 };
1626
1628 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1629 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1630 {55.0, 10.0, PathPointTypeLine, 0, 0}, /*2*/
1631 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*3*/
1632 {5.0, 15.0, PathPointTypeLine, 0, 0}, /*4*/
1633 {0.0, 10.0, PathPointTypeLine, 0, 0}, /*5*/
1634 {5.0, 5.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0} /*6*/
1635 };
1636
1638 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1639 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1640 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1641 {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1642 {12.071068, 2.928932, PathPointTypeStart, 0, 0}, /*4*/
1643 {12.071068, 17.071066, PathPointTypeLine, 0, 0}, /*5*/
1644 {-2.071068, 17.071066, PathPointTypeLine, 0, 0}, /*6*/
1645 {-2.071068, 2.928932, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
1646 {42.928928, 17.071068, PathPointTypeStart, 0, 0}, /*8*/
1647 {42.928928, 2.928932, PathPointTypeLine, 0, 0}, /*9*/
1648 {57.071068, 2.928932, PathPointTypeLine, 0, 0}, /*10*/
1649 {57.071068, 17.071068, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*11*/
1650 };
1651
1653 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1654 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1655 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1656 {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1657 {5.0, 20.0, PathPointTypeStart, 0, 0}, /*4*/
1658 {-0.522847, 20.0, PathPointTypeBezier, 0, 0}, /*5*/
1659 {-5.0, 15.522846, PathPointTypeBezier, 0, 0}, /*6*/
1660 {-5.0, 10.0, PathPointTypeBezier, 0, 0}, /*7*/
1661 {-5.0, 4.477152, PathPointTypeBezier, 0, 0}, /*8*/
1662 {-0.522847, 0.0, PathPointTypeBezier, 0, 0}, /*9*/
1663 {5.0, 0.0, PathPointTypeBezier, 0, 0}, /*10*/
1664 {10.522847, 0.0, PathPointTypeBezier, 0, 0}, /*11*/
1665 {15.0, 4.477152, PathPointTypeBezier, 0, 0}, /*12*/
1666 {15.0, 10.0, PathPointTypeBezier, 0, 0}, /*13*/
1667 {15.0, 15.522846, PathPointTypeBezier, 0, 0}, /*14*/
1668 {10.522847, 20.0, PathPointTypeBezier, 0, 0}, /*15*/
1669 {5.0, 20.0, PathPointTypeBezier|PathPointTypeCloseSubpath, 0, 0}, /*16*/
1670 {50.0, 0.0, PathPointTypeStart, 0, 0}, /*17*/
1671 {55.522846, 0.0, PathPointTypeBezier, 0, 0}, /*18*/
1672 {60.0, 4.477153, PathPointTypeBezier, 0, 0}, /*19*/
1673 {60.0, 10.0, PathPointTypeBezier, 0, 0}, /*20*/
1674 {60.0, 15.522847, PathPointTypeBezier, 0, 0}, /*21*/
1675 {55.522846, 20.0, PathPointTypeBezier, 0, 0}, /*22*/
1676 {50.0, 20.0, PathPointTypeBezier, 0, 0}, /*23*/
1677 {44.477150, 20.0, PathPointTypeBezier, 0, 0}, /*24*/
1678 {40.0, 15.522847, PathPointTypeBezier, 0, 0}, /*25*/
1679 {40.0, 10.0, PathPointTypeBezier, 0, 0}, /*26*/
1680 {40.0, 4.477153, PathPointTypeBezier, 0, 0}, /*27*/
1681 {44.477150, 0.0, PathPointTypeBezier, 0, 0}, /*28*/
1682 {50.0, 0.0, PathPointTypeBezier|PathPointTypeCloseSubpath, 0, 0}, /*29*/
1683 };
1684
1686 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1687 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1688 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1689 {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1690 {-5.0, 10.0, PathPointTypeStart, 0, 0}, /*4*/
1691 {5.0, 0.0, PathPointTypeLine, 0, 0}, /*5*/
1692 {15.0, 10.0, PathPointTypeLine, 0, 0}, /*6*/
1693 {5.0, 20.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
1694 {60.0, 10.0, PathPointTypeStart, 0, 0}, /*8*/
1695 {50.0, 20.0, PathPointTypeLine, 0, 0}, /*9*/
1696 {40.0, 10.0, PathPointTypeLine, 0, 0}, /*10*/
1697 {50.0, 0.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*11*/
1698 };
1699
1701 {15.0, 5.0, PathPointTypeStart, 0, 1}, /*0*/
1702 {40.0, 5.0, PathPointTypeLine, 0, 1}, /*1*/
1703 {40.0, 15.0, PathPointTypeLine, 0, 1}, /*2*/
1704 {15.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 1}, /*3*/
1705 {5.0, 10.0, PathPointTypeStart, 0, 0}, /*4*/
1706 {22.320507, 0.0, PathPointTypeLine, 0, 0}, /*5*/
1707 {22.320507, 20.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*6*/
1708 {50.0, 10.0, PathPointTypeStart, 0, 0}, /*7*/
1709 {32.679489, 20.0, PathPointTypeLine, 0, 0}, /*8*/
1710 {32.679489, 0.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*9*/
1711 };
1712
1714 {6.414213, 8.585786, PathPointTypeStart, 0, 0}, /*0*/
1715 {6.414213, 11.414213, PathPointTypeLine, 0, 0}, /*1*/
1716 {3.585786, 11.414213, PathPointTypeLine, 0, 0}, /*2*/
1717 {3.585786, 8.585786, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1718 {48.585785, 11.414213, PathPointTypeStart, 0, 0}, /*4*/
1719 {48.585785, 8.585786, PathPointTypeLine, 0, 0}, /*5*/
1720 {51.414211, 8.585786, PathPointTypeLine, 0, 0}, /*6*/
1721 {51.414211, 11.414213, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
1722 };
1723
1725 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1726 {35.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1727 {35.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1728 {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1729 {45.0, 5.0, PathPointTypeStart, 0, 0}, /*4*/
1730 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*5*/
1731 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*6*/
1732 {45.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
1733 {12.071068, 2.928932, PathPointTypeStart, 0, 0}, /*8*/
1734 {12.071068, 17.071066, PathPointTypeLine, 0, 0}, /*9*/
1735 {-2.071068, 17.071066, PathPointTypeLine, 0, 0}, /*10*/
1736 {-2.071068, 2.928932, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*11*/
1737 {42.928928, 17.071068, PathPointTypeStart, 0, 0}, /*12*/
1738 {42.928928, 2.928932, PathPointTypeLine, 0, 0}, /*13*/
1739 {57.071068, 2.928932, PathPointTypeLine, 0, 0}, /*14*/
1740 {57.071068, 17.071068, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*15*/
1741 };
1742
1744 {5.0, 5.0, PathPointTypeStart, 0, 0}, /*0*/
1745 {25.0, 5.0, PathPointTypeLine, 0, 0}, /*1*/
1746 {25.0, 15.0, PathPointTypeLine, 0, 0}, /*2*/
1747 {5.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*3*/
1748 {30.0, 5.0, PathPointTypeStart, 0, 0}, /*4*/
1749 {50.0, 5.0, PathPointTypeLine, 0, 0}, /*5*/
1750 {50.0, 15.0, PathPointTypeLine, 0, 0}, /*6*/
1751 {30.0, 15.0, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*7*/
1752 {12.071068, 2.928932, PathPointTypeStart, 0, 0}, /*8*/
1753 {12.071068, 17.071066, PathPointTypeLine, 0, 0}, /*9*/
1754 {-2.071068, 17.071066, PathPointTypeLine, 0, 0}, /*10*/
1755 {-2.071068, 2.928932, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*11*/
1756 {17.928930, 17.071068, PathPointTypeStart, 0, 0}, /*12*/
1757 {17.928930, 2.928932, PathPointTypeLine, 0, 0}, /*13*/
1758 {32.071068, 2.928932, PathPointTypeLine, 0, 0}, /*14*/
1759 {32.071068, 17.071068, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*15*/
1760 {37.071068, 2.928932, PathPointTypeStart, 0, 0}, /*16*/
1761 {37.071068, 17.071066, PathPointTypeLine, 0, 0}, /*17*/
1762 {22.928930, 17.071066, PathPointTypeLine, 0, 0}, /*18*/
1763 {22.928930, 2.928932, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*19*/
1764 {42.928928, 17.071068, PathPointTypeStart, 0, 0}, /*20*/
1765 {42.928928, 2.928932, PathPointTypeLine, 0, 0}, /*21*/
1766 {57.071068, 2.928932, PathPointTypeLine, 0, 0}, /*22*/
1767 {57.071068, 17.071068, PathPointTypeLine|PathPointTypeCloseSubpath, 0, 0}, /*23*/
1768 };
1769
1771 {6.0, 9.5, PathPointTypeStart}, /*0*/
1772 {24.0, 9.5, PathPointTypeLine}, /*1*/
1773 {24.0, 10.5, PathPointTypeLine}, /*2*/
1775 {30.5, 11.0, PathPointTypeStart}, /*4*/
1776 {30.5, 29.0, PathPointTypeLine}, /*5*/
1777 {29.5, 29.0, PathPointTypeLine}, /*6*/
1778 {29.5, 11.0, PathPointTypeLine|PathPointTypeCloseSubpath}, /*7*/
1779 {13.0, 14.0, PathPointTypeStart}, /*8*/
1780 {5.0, 10.0, PathPointTypeLine}, /*9*/
1781 {13.0, 6.0, PathPointTypeLine}, /*10*/
1782 {11.0, 10.0, PathPointTypeLine|PathPointTypeCloseSubpath}, /*11*/
1783 {17.0, 6.0, PathPointTypeStart}, /*12*/
1784 {25.0, 10.0, PathPointTypeLine}, /*13*/
1785 {17.0, 14.0, PathPointTypeLine}, /*14*/
1786 {19.0, 10.0, PathPointTypeLine|PathPointTypeCloseSubpath}, /*15*/
1787 {26.0, 18.0, PathPointTypeStart}, /*16*/
1788 {30.0, 10.0, PathPointTypeLine}, /*17*/
1789 {34.0, 18.0, PathPointTypeLine}, /*18*/
1790 {30.0, 16.0, PathPointTypeLine|PathPointTypeCloseSubpath}, /*19*/
1791 {34.0, 22.0, PathPointTypeStart}, /*20*/
1792 {30.0, 30.0, PathPointTypeLine}, /*21*/
1793 {26.0, 22.0, PathPointTypeLine}, /*22*/
1794 {30.0, 24.0, PathPointTypeLine|PathPointTypeCloseSubpath}, /*23*/
1795 };
1796
1797static void test_widen_cap(void)
1798{
1799 struct
1800 {
1801 LineCap type;
1803 const path_test_t *expected;
1804 INT expected_size;
1805 BOOL dashed;
1806 }
1807 caps[] =
1808 {
1831 };
1832
1833 GpAdjustableArrowCap *arrowcap;
1835 GpPath *path;
1836 GpPen *pen;
1837
1838 int i;
1839
1841 expect(Ok, status);
1842
1843 for (i = 0; i < ARRAY_SIZE(caps); i++)
1844 {
1845 status = GdipCreatePen1(0xffffffff, caps[i].line_width, UnitPixel, &pen);
1846 expect(Ok, status);
1847 if (caps[i].dashed)
1848 {
1850 expect(Ok, status);
1851 }
1852
1854 expect(Ok, status);
1855 status = GdipAddPathLine(path, 5.0, 10.0, 50.0, 10.0);
1856 expect(Ok, status);
1857 status = GdipSetPenStartCap(pen, caps[i].type);
1858 expect(Ok, status);
1859 status = GdipSetPenEndCap(pen, caps[i].type);
1860 expect(Ok, status);
1861
1863 expect(Ok, status);
1864
1865 if (i == 9)
1866 {
1867 INT size;
1869 expect(Ok, status);
1870 ok(size == caps[i].expected_size || broken(size == 12), "unexpected path size %i\n", size);
1871
1872 if (size == 12)
1873 {
1874 GdipDeletePen(pen);
1875 continue;
1876 }
1877 }
1878
1879 ok_path_fudge(path, caps[i].expected, caps[i].expected_size, FALSE, 0.000005);
1880
1881 GdipDeletePen(pen);
1882 }
1883
1884 status = GdipCreatePen1(0xffffffff, 10.0, UnitPixel, &pen);
1885 expect(Ok, status);
1887 expect(Ok, status);
1888 status = GdipAddPathLine(path, 5.0, 10.0, 25.0, 10.0);
1889 expect(Ok, status);
1891 expect(Ok, status);
1892 status = GdipAddPathLine(path, 30.0, 10.0, 50.0, 10.0);
1893 expect(Ok, status);
1895 expect(Ok, status);
1897 expect(Ok, status);
1899 expect(Ok, status);
1902
1904 expect(Ok, status);
1905 status = GdipAddPathLine(path, 5.0, 10.0, 25.0, 10.0);
1906 expect(Ok, status);
1908 expect(Ok, status);
1909 status = GdipAddPathLine(path, 30.0, 10.0, 30.0, 30.0);
1910 expect(Ok, status);
1911 status = GdipCreateAdjustableArrowCap(4.0, 4.0, TRUE, &arrowcap);
1912 ok(status == Ok, "Failed to create adjustable cap, %d\n", status);
1914 ok(status == Ok, "Failed to set middle inset inadjustable cap, %d\n", status);
1916 ok(status == Ok, "Failed to create custom end cap, %d\n", status);
1918 ok(status == Ok, "Failed to create custom end cap, %d\n", status);
1919 status = GdipSetPenWidth(pen, 1.0);
1920 expect(Ok, status);
1922 expect(Ok, status);
1925
1926 GdipDeletePen(pen);
1927
1929}
1930
1931static void test_isvisible(void)
1932{
1933 GpPath *path;
1934 GpGraphics *graphics = NULL;
1935 HDC hdc = GetDC(0);
1936 BOOL result;
1938
1939 status = GdipCreateFromHDC(hdc, &graphics);
1940 expect(Ok, status);
1942 expect(Ok, status);
1943
1944 /* NULL */
1951 status = GdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, NULL);
1953
1954 /* empty path */
1955 result = TRUE;
1957 expect(Ok, status);
1959 /* rect */
1960 status = GdipAddPathRectangle(path, 0.0, 0.0, 10.0, 10.0);
1961 expect(Ok, status);
1962 result = FALSE;
1964 expect(Ok, status);
1965 expect(TRUE, result);
1966 result = TRUE;
1967 status = GdipIsVisiblePathPoint(path, 11.0, 11.0, NULL, &result);
1968 expect(Ok, status);
1970 /* not affected by clipping */
1971 status = GdipSetClipRect(graphics, 5.0, 5.0, 5.0, 5.0, CombineModeReplace);
1972 expect(Ok, status);
1973 result = FALSE;
1974 status = GdipIsVisiblePathPoint(path, 0.0, 0.0, graphics, &result);
1975 expect(Ok, status);
1976 expect(TRUE, result);
1977 /* not affected by world transform */
1978 status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
1979 expect(Ok, status);
1980 result = FALSE;
1981 status = GdipIsVisiblePathPoint(path, 9.0, 9.0, graphics, &result);
1982 expect(Ok, status);
1983 expect(TRUE, result);
1984 result = TRUE;
1985 status = GdipIsVisiblePathPoint(path, 11.0, 11.0, graphics, &result);
1986 expect(Ok, status);
1988 GdipResetWorldTransform(graphics);
1989
1991 GdipDeleteGraphics(graphics);
1992 ReleaseDC(0, hdc);
1993}
1994
1996{
1997 BOOL result;
1999 GpGraphics *graphics = NULL;
2000 GpPath *path;
2001 GpPen *pen = NULL;
2003 static const int width = 20, height = 20;
2004
2005 /* Graphics associated with an Image object.*/
2007 expect(Ok, status);
2009 expect(Ok, status);
2010 ok(graphics != NULL, "Expected the graphics context to be initialized.\n");
2011
2013 expect(Ok, status);
2014
2015 status = GdipAddPathRectangle(path, 2.0, 0.0, 13.0, 15.0);
2016 expect(Ok, status);
2017
2018 status = GdipCreatePen1((ARGB)0xffff00ff, 3.0f, UnitPixel, &pen);
2019 expect(Ok, status);
2020 ok(pen != NULL, "Expected pen to be initialized\n");
2021
2022 /* With NULL pen */
2023 result = 9;
2024 status = GdipIsOutlineVisiblePathPoint(path, 0.0, 1.0, NULL, graphics, &result);
2026 expect(9, result);
2027
2028 /* Without transformation */
2029 result = TRUE;
2030 status = GdipIsOutlineVisiblePathPoint(path, 0.0, 1.0, pen, graphics, &result);
2031 expect(Ok, status);
2033 result = FALSE;
2034 status = GdipIsOutlineVisiblePathPoint(path, 1.0, 1.0, pen, graphics, &result);
2035 expect(Ok, status);
2036 expect(TRUE, result);
2037 result = FALSE;
2038 status = GdipIsOutlineVisiblePathPoint(path, 10.0, 1.0, pen, graphics, &result);
2039 expect(Ok, status);
2040 expect(TRUE, result);
2041 result = FALSE;
2042 status = GdipIsOutlineVisiblePathPoint(path, 16.0, 1.0, pen, graphics, &result);
2043 expect(Ok, status);
2044 expect(TRUE, result);
2045 result = TRUE;
2046 status = GdipIsOutlineVisiblePathPoint(path, 17.0, 1.0, pen, graphics, &result);
2047 expect(Ok, status);
2049
2050 /* Translating */
2051 status = GdipTranslateWorldTransform(graphics, 50.0, 50.0, MatrixOrderPrepend);
2052 expect(Ok, status);
2053 result = FALSE;
2054 status = GdipIsOutlineVisiblePathPoint(path, 10.0, 1.0, pen, graphics, &result);
2055 expect(Ok, status);
2056 expect(TRUE, result);
2057 result = FALSE;
2058 status = GdipIsOutlineVisiblePathPoint(path, 15.0, 1.0, pen, graphics, &result);
2059 expect(Ok, status);
2060 expect(TRUE, result);
2061 result = FALSE;
2062 status = GdipIsOutlineVisiblePathPoint(path, 16.0, 1.0, pen, graphics, &result);
2063 expect(Ok, status);
2064 expect(TRUE, result);
2065
2066 /* Scaling */
2067 status = GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
2068 expect(Ok, status);
2069 result = TRUE;
2070 status = GdipIsOutlineVisiblePathPoint(path, 0.0, 1.0, pen, graphics, &result);
2071 expect(Ok, status);
2073 result = TRUE;
2074 status = GdipIsOutlineVisiblePathPoint(path, 1.0, 1.0, pen, graphics, &result);
2075 expect(Ok, status);
2077 result = FALSE;
2078 status = GdipIsOutlineVisiblePathPoint(path, 2.0, 1.0, pen, graphics, &result);
2079 expect(Ok, status);
2080 expect(TRUE, result);
2081 result = TRUE;
2082 status = GdipIsOutlineVisiblePathPoint(path, 3.0, 1.0, pen, graphics, &result);
2083 expect(Ok, status);
2085 result = TRUE;
2086 status = GdipIsOutlineVisiblePathPoint(path, 14.0, 1.0, pen, graphics, &result);
2087 expect(Ok, status);
2089 result = FALSE;
2090 status = GdipIsOutlineVisiblePathPoint(path, 15.0, 1.0, pen, graphics, &result);
2091 expect(Ok, status);
2092 expect(TRUE, result);
2093 result = TRUE;
2094 status = GdipIsOutlineVisiblePathPoint(path, 16.0, 1.0, pen, graphics, &result);
2095 expect(Ok, status);
2097
2098 /* Page Unit */
2099 GdipResetWorldTransform(graphics);
2101 expect(Ok, status);
2102 result = TRUE;
2103 status = GdipIsOutlineVisiblePathPoint(path, 0.0, 1.0, pen, graphics, &result);
2104 expect(Ok, status);
2106 result = TRUE;
2107 status = GdipIsOutlineVisiblePathPoint(path, 1.0, 1.0, pen, graphics, &result);
2108 expect(Ok, status);
2110 result = FALSE;
2111 status = GdipIsOutlineVisiblePathPoint(path, 2.0, 1.0, pen, graphics, &result);
2112 expect(Ok, status);
2113 expect(TRUE, result);
2114 result = TRUE;
2115 status = GdipIsOutlineVisiblePathPoint(path, 3.0, 1.0, pen, graphics, &result);
2116 expect(Ok, status);
2118 result = TRUE;
2119 status = GdipIsOutlineVisiblePathPoint(path, 14.0, 1.0, pen, graphics, &result);
2120 expect(Ok, status);
2122 result = FALSE;
2123 status = GdipIsOutlineVisiblePathPoint(path, 15.0, 1.0, pen, graphics, &result);
2124 expect(Ok, status);
2125 expect(TRUE, result);
2126 result = TRUE;
2127 status = GdipIsOutlineVisiblePathPoint(path, 16.0, 1.0, pen, graphics, &result);
2128 expect(Ok, status);
2130
2131 GdipResetWorldTransform(graphics);
2133 GdipDeleteGraphics(graphics);
2134}
2135
2136static void test_empty_rect(void)
2137{
2138 GpPath *path;
2140 INT count;
2141 BOOL result;
2142
2144 expect(Ok, status);
2145
2146 status = GdipAddPathRectangle(path, 0.0, 0.0, -5.0, 5.0);
2147 expect(Ok, status);
2148
2150 expect(Ok, status);
2151 expect(0, count);
2152
2153 status = GdipIsVisiblePathPoint(path, -2.0, 2.0, NULL, &result);
2154 expect(Ok, status);
2156
2157 status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, -5.0);
2158 expect(Ok, status);
2159
2161 expect(Ok, status);
2162 expect(0, count);
2163
2164 status = GdipAddPathRectangle(path, 0.0, 0.0, 0.0, 5.0);
2165 expect(Ok, status);
2166
2168 expect(Ok, status);
2169 expect(0, count);
2170
2171 status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.0);
2172 expect(Ok, status);
2173
2175 expect(Ok, status);
2176 expect(0, count);
2177
2178 status = GdipAddPathRectangle(path, 0.0, 0.0, 5.0, 0.1);
2179 expect(Ok, status);
2180
2182 expect(Ok, status);
2183 expect(4, count);
2184
2186}
2187
2189 {1.0, 4.0, PathPointTypeStart, 0, 0}, /*0*/
2190 {17.0, 4.0, PathPointTypeLine, 0, 0}, /*1*/
2191 {17.0, 68.0, PathPointTypeLine, 0, 0}, /*2*/
2192 {1.0, 68.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*3*/
2193 {1.0, 8.0, PathPointTypeStart, 0, 0}, /*4*/
2194 {17.0, 8.0, PathPointTypeLine, 0, 0} /*5*/
2195 };
2196
2197static void test_rect_line(void)
2198{
2200 GpPath* path;
2201
2203
2204 status = GdipAddPathRectangleI(path, 1, 4, 16, 64);
2205 expect(Ok, status);
2206
2207 status = GdipAddPathLineI(path, 1, 8, 17, 8);
2208 expect(Ok, status);
2209
2211
2213}
2214
2215START_TEST(graphicspath)
2216{
2217 struct GdiplusStartupInput gdiplusStartupInput;
2218 ULONG_PTR gdiplusToken;
2219 HMODULE hmsvcrt;
2220 int (CDECL * _controlfp_s)(unsigned int *cur, unsigned int newval, unsigned int mask);
2221
2222 /* Enable all FP exceptions except _EM_INEXACT, which gdi32 can trigger */
2223 hmsvcrt = LoadLibraryA("msvcrt");
2224 _controlfp_s = (void*)GetProcAddress(hmsvcrt, "_controlfp_s");
2225 if (_controlfp_s) _controlfp_s(0, 0, 0x0008001e);
2226
2227 gdiplusStartupInput.GdiplusVersion = 1;
2228 gdiplusStartupInput.DebugEventCallback = NULL;
2229 gdiplusStartupInput.SuppressBackgroundThread = 0;
2230 gdiplusStartupInput.SuppressExternalCodecs = 0;
2231
2232 GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
2233
2237 test_line2();
2238 test_bezier();
2239 test_beziers();
2240 test_arc();
2242 test_pathpath();
2243 test_ellipse();
2244 test_linei();
2245 test_rect();
2246 test_polygon();
2248 test_addcurve();
2250 test_reverse();
2251 test_addpie();
2252 test_flatten();
2253 test_widen();
2259
2260 GdiplusShutdown(gdiplusToken);
2261}
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ok_(x1, x2)
Definition: atltest.h:61
#define ARRAY_SIZE(A)
Definition: main.h:20
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int idx
Definition: utils.c:41
float REAL
Definition: types.h:41
#define Y(I)
#define CDECL
Definition: compat.h:29
#define GetProcAddress(x, y)
Definition: compat.h:753
GpStatus WINGDIPAPI GdipCreateAdjustableArrowCap(REAL height, REAL width, BOOL fill, GpAdjustableArrowCap **cap)
GpStatus WINGDIPAPI GdipSetAdjustableArrowCapMiddleInset(GpAdjustableArrowCap *cap, REAL middle)
GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics)
Definition: graphics.c:2434
GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics)
Definition: graphics.c:2616
GpStatus WINGDIPAPI GdipScaleWorldTransform(GpGraphics *graphics, REAL sx, REAL sy, GpMatrixOrder order)
Definition: graphics.c:6406
GpStatus WINGDIPAPI GdipTranslateWorldTransform(GpGraphics *graphics, REAL dx, REAL dy, GpMatrixOrder order)
Definition: graphics.c:6748
GpStatus WINGDIPAPI GdipSetClipRect(GpGraphics *graphics, REAL x, REAL y, REAL width, REAL height, CombineMode mode)
Definition: graphics.c:6842
GpStatus WINGDIPAPI GdipSetPageUnit(GpGraphics *graphics, GpUnit unit)
Definition: graphics.c:6560
GpStatus WINGDIPAPI GdipResetWorldTransform(GpGraphics *graphics)
Definition: graphics.c:6194
GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, INT count, INT offset, INT nseg, REAL tension)
Definition: graphicspath.c:595
GpStatus WINGDIPAPI GdipAddPathRectangleI(GpPath *path, INT x, INT y, INT width, INT height)
GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
GpStatus WINGDIPAPI GdipAddPathPie(GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
Definition: graphicspath.c:864
GpStatus WINGDIPAPI GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2)
Definition: graphicspath.c:804
GpStatus WINGDIPAPI GdipAddPathRectangle(GpPath *path, REAL x, REAL y, REAL width, REAL height)
GpStatus WINGDIPAPI GdipAddPathCurve(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:581
GpStatus WINGDIPAPI GdipIsOutlineVisiblePathPoint(GpPath *path, REAL x, REAL y, GpPen *pen, GpGraphics *graphics, BOOL *result)
GpStatus WINGDIPAPI GdipGetPathData(GpPath *path, GpPathData *pathData)
GpStatus WINGDIPAPI GdipResetPath(GpPath *path)
GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF *points, GDIPCONST BYTE *types, INT count, GpFillMode fill, GpPath **path)
GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:743
GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix *matrix, REAL flatness)
GpStatus WINGDIPAPI GdipGetPathLastPoint(GpPath *path, GpPointF *lastPoint)
GpStatus WINGDIPAPI GdipClosePathFigure(GpPath *path)
GpStatus WINGDIPAPI GdipAddPathPolygon(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:932
GpStatus WINGDIPAPI GdipTransformPath(GpPath *path, GpMatrix *matrix)
GpStatus WINGDIPAPI GdipAddPathLineI(GpPath *path, INT x1, INT y1, INT x2, INT y2)
Definition: graphicspath.c:826
GpStatus WINGDIPAPI GdipAddPathPath(GpPath *path, GDIPCONST GpPath *addingPath, BOOL connect)
Definition: graphicspath.c:833
GpStatus WINGDIPAPI GdipWidenPath(GpPath *path, GpPen *pen, GpMatrix *matrix, REAL flatness)
GpStatus WINGDIPAPI GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:429
GpStatus WINGDIPAPI GdipGetPathWorldBounds(GpPath *path, GpRectF *bounds, GDIPCONST GpMatrix *matrix, GDIPCONST GpPen *pen)
GpStatus WINGDIPAPI GdipAddPathRectangles(GpPath *path, GDIPCONST GpRectF *rects, INT count)
GpStatus WINGDIPAPI GdipIsVisiblePathPoint(GpPath *path, REAL x, REAL y, GpGraphics *graphics, BOOL *result)
GpStatus WINGDIPAPI GdipAddPathCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension)
Definition: graphicspath.c:667
GpStatus WINGDIPAPI GdipGetPointCount(GpPath *path, INT *count)
GpStatus WINGDIPAPI GdipGetPathPoints(GpPath *path, GpPointF *points, INT count)
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 GdipReversePath(GpPath *path)
GpStatus WINGDIPAPI GdipGetPathTypes(GpPath *path, BYTE *types, INT count)
GpStatus WINGDIPAPI GdipStartPathFigure(GpPath *path)
GpStatus WINGDIPAPI GdipAddPathArc(GpPath *path, REAL x, REAL y, REAL width, REAL height, REAL startAngle, REAL sweepAngle)
Definition: graphicspath.c:353
GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, REAL height)
Definition: graphicspath.c:703
GpStatus WINGDIPAPI GdipAddPathClosedCurve(GpPath *path, GDIPCONST GpPointF *points, INT count)
Definition: graphicspath.c:467
GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *points, INT count, REAL tension)
Definition: graphicspath.c:483
GpStatus WINGDIPAPI GdipCreateBitmapFromScan0(INT width, INT height, INT stride, PixelFormat format, BYTE *scan0, GpBitmap **bitmap)
Definition: image.c:1793
GpStatus WINGDIPAPI GdipGetImageGraphicsContext(GpImage *image, GpGraphics **graphics)
Definition: image.c:2195
GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY, GpMatrixOrder order)
Definition: matrix.c:288
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22, REAL dx, REAL dy, GpMatrix **matrix)
Definition: matrix.c:59
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
Definition: matrix.c:156
GpStatus WINGDIPAPI GdipCreateMatrix(GpMatrix **matrix)
Definition: matrix.c:136
GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, REAL width, GpUnit unit, GpPen **pen)
Definition: pen.c:146
GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen)
Definition: pen.c:204
GpStatus WINGDIPAPI GdipSetPenDashStyle(GpPen *pen, GpDashStyle dash)
Definition: pen.c:688
GpStatus WINGDIPAPI GdipSetPenWidth(GpPen *pen, REAL width)
Definition: pen.c:784
GpStatus WINGDIPAPI GdipSetPenCustomEndCap(GpPen *pen, GpCustomLineCap *customCap)
Definition: pen.c:590
GpStatus WINGDIPAPI GdipSetPenEndCap(GpPen *pen, GpLineCap cap)
Definition: pen.c:709
GpStatus WINGDIPAPI GdipSetPenStartCap(GpPen *pen, GpLineCap cap)
Definition: pen.c:771
GpStatus WINGDIPAPI GdipSetPenCustomStartCap(GpPen *pen, GpCustomLineCap *customCap)
Definition: pen.c:609
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
_ACRTIMP double __cdecl fabs(double)
unsigned int(__cdecl typeof(jpeg_read_scanlines))(struct jpeg_decompress_struct *
Definition: typeof.h:31
unsigned int BOOL
Definition: ntddk_ex.h:94
FxCollectionEntry * cur
void WINGDIPAPI GdipFree(void *ptr)
Definition: gdiplus.c:152
Status WINAPI GdiplusStartup(ULONG_PTR *token, const struct GdiplusStartupInput *input, struct GdiplusStartupOutput *output)
Definition: gdiplus.c:83
void *WINGDIPAPI GdipAlloc(SIZE_T size)
Definition: gdiplus.c:144
@ CombineModeReplace
Definition: gdiplusenums.h:388
LineCap
Definition: gdiplusenums.h:60
@ LineCapTriangle
Definition: gdiplusenums.h:64
@ LineCapArrowAnchor
Definition: gdiplusenums.h:70
@ LineCapNoAnchor
Definition: gdiplusenums.h:66
@ LineCapSquare
Definition: gdiplusenums.h:62
@ LineCapSquareAnchor
Definition: gdiplusenums.h:67
@ LineCapRound
Definition: gdiplusenums.h:63
@ LineCapRoundAnchor
Definition: gdiplusenums.h:68
@ LineCapFlat
Definition: gdiplusenums.h:61
@ LineCapDiamondAnchor
Definition: gdiplusenums.h:69
@ FillModeAlternate
Definition: gdiplusenums.h:55
@ DashStyleSolid
Definition: gdiplusenums.h:177
@ DashStyleDash
Definition: gdiplusenums.h:178
@ MatrixOrderAppend
Definition: gdiplusenums.h:188
@ MatrixOrderPrepend
Definition: gdiplusenums.h:187
@ UnitMillimeter
Definition: gdiplusenums.h:33
@ UnitWorld
Definition: gdiplusenums.h:27
@ UnitPixel
Definition: gdiplusenums.h:29
PathPointType
Definition: gdiplusenums.h:82
@ PathPointTypePathMarker
Definition: gdiplusenums.h:88
@ PathPointTypePathTypeMask
Definition: gdiplusenums.h:86
@ PathPointTypeBezier
Definition: gdiplusenums.h:85
@ PathPointTypeLine
Definition: gdiplusenums.h:84
@ PathPointTypeCloseSubpath
Definition: gdiplusenums.h:89
@ PathPointTypeStart
Definition: gdiplusenums.h:83
#define FlatnessDefault
Definition: gdiplusenums.h:759
#define GDIPCONST
Definition: gdiplusflat.h:24
void WINAPI GdiplusShutdown(ULONG_PTR)
DWORD ARGB
#define PixelFormat32bppRGB
Status
Definition: gdiplustypes.h:24
@ Ok
Definition: gdiplustypes.h:25
@ InvalidParameter
Definition: gdiplustypes.h:27
@ OutOfMemory
Definition: gdiplustypes.h:28
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint GLuint end
Definition: gl.h:1545
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLint GLint GLsizei GLsizei height
Definition: gl.h:1546
GLint GLint GLsizei width
Definition: gl.h:1546
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLuint mask
Definition: glext.h:6028
GLuint GLenum matrix
Definition: glext.h:9407
GLuint64EXT * result
Definition: glext.h:11304
GLsizei const GLfloat * points
Definition: glext.h:8112
const GLfloat * m
Definition: glext.h:10848
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define todo_wine_if(is_todo)
Definition: minitest.h:81
#define todo_wine
Definition: minitest.h:80
HDC hdc
Definition: main.c:9
static HDC
Definition: imagelist.c:88
BOOL todo
Definition: filedlg.c:313
BOOL expected
Definition: store.c:2000
static void stringify_point_type(PathPointType type, char *name)
Definition: graphicspath.c:30
static void test_addclosedcurve(void)
static path_test_t widenline_capdiamondanchor_path[]
static void test_is_outline_visible_path_point(void)
static void test_createpath2(void)
Definition: graphicspath.c:179
static path_test_t linei_path[]
Definition: graphicspath.c:750
static path_test_t ellipse_path[]
Definition: graphicspath.c:680
#define POINT_TYPE_MAX_LEN
Definition: graphicspath.c:28
static path_test_t widenline_capround_path[]
static path_test_t bezier_path[]
Definition: graphicspath.c:345
static path_test_t pathpath_path[]
Definition: graphicspath.c:630
static path_test_t widenline_capsquareanchor_multifigure_path[]
static void test_addcurve(void)
Definition: graphicspath.c:970
static path_test_t addclosedcurve_path_default_tension[]
#define ok_path_fudge(a, b, c, d, e)
Definition: graphicspath.c:79
static path_test_t widenline_unit_path[]
static void test_empty_rect(void)
static path_test_t widenline_capsquareanchor_thin_path[]
static path_test_t widenline_capsquareanchor_dashed_path[]
static path_test_t widenline_thin_dash_path[]
static void test_ellipse(void)
Definition: graphicspath.c:724
static void test_beziers(void)
Definition: graphicspath.c:378
static path_test_t poly_path[]
Definition: graphicspath.c:789
static void test_bezier(void)
Definition: graphicspath.c:359
static path_test_t line2_path[]
Definition: graphicspath.c:288
static void test_line2(void)
Definition: graphicspath.c:300
static path_test_t flattenarc_path[]
static path_test_t widenline_path[]
static void _ok_path_fudge(GpPath *path, const path_test_t *expected, INT expected_size, BOOL todo_size, REAL fudge, int line)
Definition: graphicspath.c:80
static path_test_t arc_path[]
Definition: graphicspath.c:400
static void test_linei(void)
Definition: graphicspath.c:767
static path_test_t flattenellipse_path[]
static path_test_t addcurve_path2[]
Definition: graphicspath.c:934
static path_test_t rect_line_path[]
static path_test_t flattenquater_path[]
static void test_reverse(void)
static path_test_t addcurve_path4[]
Definition: graphicspath.c:957
static path_test_t addcurve_path[]
Definition: graphicspath.c:910
#define expect(expected, got)
Definition: graphicspath.c:26
static path_test_t addcurve_path_default_tension[]
Definition: graphicspath.c:922
static void test_isvisible(void)
static void test_pathpath(void)
Definition: graphicspath.c:658
static void test_widen(void)
static path_test_t addcurve_path3[]
Definition: graphicspath.c:948
static void test_widen_cap(void)
static void test_polygon(void)
Definition: graphicspath.c:799
static path_test_t widenline_capsquareanchor_path[]
static void test_getpathdata(void)
Definition: graphicspath.c:148
#define ok_path(a, b, c, d)
Definition: graphicspath.c:78
static path_test_t addcurve_path5[]
Definition: graphicspath.c:963
static path_test_t addpie_path2[]
static path_test_t addclosedcurve_path[]
static void test_rect_line(void)
static void test_lastpoint(void)
Definition: graphicspath.c:885
static path_test_t widenline_caparrowanchor_path[]
static path_test_t widenline_dash_path[]
#define expectf(expected, got)
Definition: graphicspath.c:27
static path_test_t arc_path2[]
Definition: graphicspath.c:440
static path_test_t reverse_path[]
static path_test_t widenline_captriangle_path[]
static void test_addpie(void)
static path_test_t rect_path[]
Definition: graphicspath.c:838
static path_test_t widenline_caproundanchor_path[]
static path_test_t widenline_capflat_path[]
static path_test_t widenline_customarrow_multifigure_path[]
static void test_flatten(void)
static path_test_t widenline_wide_path[]
static void test_worldbounds(void)
Definition: graphicspath.c:499
static void test_constructor_destructor(void)
Definition: graphicspath.c:132
static path_test_t addpie_path3[]
static path_test_t addpie_path[]
static void test_rect(void)
Definition: graphicspath.c:850
static void test_arc(void)
Definition: graphicspath.c:448
static path_test_t flattenline_path[]
static path_test_t widenline_capsquare_path[]
static const WCHAR path1[]
Definition: path.c:28
static const WCHAR path2[]
Definition: path.c:29
const int line_width
Definition: patblt.cpp:81
strcat
Definition: string.h:92
BOOL SuppressBackgroundThread
Definition: gdiplusinit.h:36
DebugEventProc DebugEventCallback
Definition: gdiplusinit.h:35
REAL Y
Definition: gdiplustypes.h:644
REAL X
Definition: gdiplustypes.h:643
REAL Height
Definition: gdiplustypes.h:659
REAL X
Definition: gdiplustypes.h:656
REAL Width
Definition: gdiplustypes.h:658
REAL Y
Definition: gdiplustypes.h:657
Definition: uimain.c:89
Definition: parser.c:49
Definition: match.c:28
Definition: name.c:39
int wine_only_entries_preceding
Definition: graphicspath.c:70
Definition: ps.c:97
Definition: cmds.c:130
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG_PTR
Definition: typedefs.h:65
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HDC WINAPI GetDC(_In_opt_ HWND)
unsigned char BYTE
Definition: xxhash.c:193