ReactOS 0.4.17-dev-116-ga4b6fe9
path.c
Go to the documentation of this file.
1/*
2 * Unit test suite for paths
3 *
4 * Copyright 2007 Laurent Vromman
5 * Copyright 2007 Misha Koshelev
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#include <stdarg.h>
23#include <stdio.h>
24#include <assert.h>
25#include "windef.h"
26#include "winbase.h"
27#include "wingdi.h"
28
29#include "wine/test.h"
30
31#include "winuser.h"
32#include "winerror.h"
33
34#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got)
35
36static void test_path_state(void)
37{
38 BYTE buffer[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
40 HDC hdc;
41 HRGN rgn;
42 HBITMAP orig, dib;
43 void *bits;
44 BOOL ret;
45
47 memset( buffer, 0, sizeof(buffer) );
48 bi->bmiHeader.biSize = sizeof(bi->bmiHeader);
49 bi->bmiHeader.biHeight = 256;
50 bi->bmiHeader.biWidth = 256;
51 bi->bmiHeader.biBitCount = 32;
52 bi->bmiHeader.biPlanes = 1;
54 dib = CreateDIBSection( 0, bi, DIB_RGB_COLORS, &bits, NULL, 0 );
55 orig = SelectObject( hdc, dib );
56
57 BeginPath( hdc );
58 LineTo( hdc, 100, 100 );
59 ret = WidenPath( hdc );
60 ok( !ret, "WidenPath succeeded\n" );
61
62 /* selecting another bitmap doesn't affect the path */
63 SelectObject( hdc, orig );
64 ret = WidenPath( hdc );
65 ok( !ret, "WidenPath succeeded\n" );
66
67 SelectObject( hdc, dib );
68 ret = WidenPath( hdc );
69 ok( !ret, "WidenPath succeeded\n" );
70
71 ret = EndPath( hdc );
72 ok( ret, "EndPath failed error %lu\n", GetLastError() );
73 ret = WidenPath( hdc );
74 ok( ret, "WidenPath failed error %lu\n", GetLastError() );
75
76 SelectObject( hdc, orig );
77 ret = WidenPath( hdc );
78 ok( ret, "WidenPath failed error %lu\n", GetLastError() );
79
80 BeginPath( hdc );
81 LineTo( hdc, 100, 100 );
82 ret = WidenPath( hdc );
83 ok( !ret, "WidenPath succeeded\n" );
84 SaveDC( hdc );
85 SelectObject( hdc, dib );
86 ret = EndPath( hdc );
87 ok( ret, "EndPath failed error %lu\n", GetLastError() );
88 ret = WidenPath( hdc );
89 ok( ret, "WidenPath failed error %lu\n", GetLastError() );
90
91 /* path should be open again after RestoreDC */
92 RestoreDC( hdc, -1 );
93 ret = WidenPath( hdc );
94 ok( !ret, "WidenPath succeeded\n" );
95 ret = EndPath( hdc );
96 ok( ret, "EndPath failed error %lu\n", GetLastError() );
97
98 SaveDC( hdc );
99 BeginPath( hdc );
100 RestoreDC( hdc, -1 );
101 ret = WidenPath( hdc );
102 ok( ret, "WidenPath failed error %lu\n", GetLastError() );
103
104 /* test all functions with no path at all */
105 AbortPath( hdc );
106 SetLastError( 0xdeadbeef );
107 ret = WidenPath( hdc );
108 ok( !ret, "WidenPath succeeded\n" );
109 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
110 "wrong error %lu\n", GetLastError() );
111
112 SetLastError( 0xdeadbeef );
113 ret = FlattenPath( hdc );
114 ok( !ret, "FlattenPath succeeded\n" );
115 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
116 "wrong error %lu\n", GetLastError() );
117
118 SetLastError( 0xdeadbeef );
119 ret = StrokePath( hdc );
120 ok( !ret, "StrokePath succeeded\n" );
121 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
122 "wrong error %lu\n", GetLastError() );
123
124 SetLastError( 0xdeadbeef );
125 ret = FillPath( hdc );
126 ok( !ret, "FillPath succeeded\n" );
127 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
128 "wrong error %lu\n", GetLastError() );
129
130 SetLastError( 0xdeadbeef );
132 ok( !ret, "StrokeAndFillPath succeeded\n" );
133 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
134 "wrong error %lu\n", GetLastError() );
135
136 SetLastError( 0xdeadbeef );
138 ok( !ret, "SelectClipPath succeeded\n" );
139 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
140 "wrong error %lu\n", GetLastError() );
141
142 SetLastError( 0xdeadbeef );
143 rgn = PathToRegion( hdc );
144 ok( !rgn, "PathToRegion succeeded\n" );
145 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
146 "wrong error %lu\n", GetLastError() );
147
148 SetLastError( 0xdeadbeef );
149 ret = EndPath( hdc );
150 ok( !ret, "SelectClipPath succeeded\n" );
151 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
152 "wrong error %lu\n", GetLastError() );
153
154 SetLastError( 0xdeadbeef );
155 ret = CloseFigure( hdc );
156 ok( !ret, "CloseFigure succeeded\n" );
157 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
158 "wrong error %lu\n", GetLastError() );
159
160 /* test all functions with an open path */
161 AbortPath( hdc );
162 BeginPath( hdc );
163 SetLastError( 0xdeadbeef );
164 ret = WidenPath( hdc );
165 ok( !ret, "WidenPath succeeded\n" );
166 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
167 "wrong error %lu\n", GetLastError() );
168
169 AbortPath( hdc );
170 BeginPath( hdc );
171 SetLastError( 0xdeadbeef );
172 ret = FlattenPath( hdc );
173 ok( !ret, "FlattenPath succeeded\n" );
174 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
175 "wrong error %lu\n", GetLastError() );
176
177 AbortPath( hdc );
178 BeginPath( hdc );
179 SetLastError( 0xdeadbeef );
180 ret = StrokePath( hdc );
181 ok( !ret, "StrokePath succeeded\n" );
182 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
183 "wrong error %lu\n", GetLastError() );
184
185 AbortPath( hdc );
186 BeginPath( hdc );
187 SetLastError( 0xdeadbeef );
188 ret = FillPath( hdc );
189 ok( !ret, "FillPath succeeded\n" );
190 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
191 "wrong error %lu\n", GetLastError() );
192
193 AbortPath( hdc );
194 BeginPath( hdc );
195 SetLastError( 0xdeadbeef );
197 ok( !ret, "StrokeAndFillPath succeeded\n" );
198 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
199 "wrong error %lu\n", GetLastError() );
200
201 AbortPath( hdc );
202 BeginPath( hdc );
203 Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */
204 SetLastError( 0xdeadbeef );
206 ok( !ret, "SelectClipPath succeeded\n" );
207 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
208 "wrong error %lu\n", GetLastError() );
209
210 AbortPath( hdc );
211 BeginPath( hdc );
212 Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */
213 SetLastError( 0xdeadbeef );
214 rgn = PathToRegion( hdc );
215 ok( !rgn, "PathToRegion succeeded\n" );
216 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
217 "wrong error %lu\n", GetLastError() );
218
219 AbortPath( hdc );
220 BeginPath( hdc );
221 ret = CloseFigure( hdc );
222 ok( ret, "CloseFigure failed\n" );
223
224 /* test all functions with a closed path */
225 AbortPath( hdc );
226 BeginPath( hdc );
227 EndPath( hdc );
228 ret = WidenPath( hdc );
229 ok( ret, "WidenPath failed\n" );
230 ok( GetPath( hdc, NULL, NULL, 0 ) != -1, "path deleted\n" );
231
232 AbortPath( hdc );
233 BeginPath( hdc );
234 EndPath( hdc );
235 ret = FlattenPath( hdc );
236 ok( ret, "FlattenPath failed\n" );
237 ok( GetPath( hdc, NULL, NULL, 0 ) != -1, "path deleted\n" );
238
239 AbortPath( hdc );
240 BeginPath( hdc );
241 EndPath( hdc );
242 ret = StrokePath( hdc );
243 ok( ret, "StrokePath failed\n" );
244 ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
245
246 BeginPath( hdc );
247 EndPath( hdc );
248 ret = FillPath( hdc );
249 ok( ret, "FillPath failed\n" );
250 ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
251
252 BeginPath( hdc );
253 EndPath( hdc );
255 ok( ret, "StrokeAndFillPath failed\n" );
256 ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
257
258 BeginPath( hdc );
259 Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */
260 EndPath( hdc );
262 ok( ret, "SelectClipPath failed\n" );
263 ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
264
265 BeginPath( hdc );
266 EndPath( hdc );
267 SetLastError( 0xdeadbeef );
269 ok( !ret, "SelectClipPath succeeded on empty path\n" );
270 ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
271 ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
272
273 BeginPath( hdc );
274 Rectangle( hdc, 1, 1, 10, 10 ); /* region needs some contents */
275 EndPath( hdc );
276 rgn = PathToRegion( hdc );
277 ok( rgn != 0, "PathToRegion failed\n" );
278 DeleteObject( rgn );
279 ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
280
281 BeginPath( hdc );
282 EndPath( hdc );
283 SetLastError( 0xdeadbeef );
284 rgn = PathToRegion( hdc );
285 ok( !rgn, "PathToRegion succeeded on empty path\n" );
286 ok( GetLastError() == 0xdeadbeef, "wrong error %lu\n", GetLastError() );
287 DeleteObject( rgn );
288 ok( GetPath( hdc, NULL, NULL, 0 ) == -1, "path not deleted\n" );
289
290 BeginPath( hdc );
291 EndPath( hdc );
292 SetLastError( 0xdeadbeef );
293 ret = CloseFigure( hdc );
294 ok( !ret, "CloseFigure succeeded\n" );
295 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
296 "wrong error %lu\n", GetLastError() );
297
298 AbortPath( hdc );
299 BeginPath( hdc );
300 EndPath( hdc );
301 SetLastError( 0xdeadbeef );
302 ret = EndPath( hdc );
303 ok( !ret, "EndPath succeeded\n" );
304 ok( GetLastError() == ERROR_CAN_NOT_COMPLETE || broken(GetLastError() == 0xdeadbeef),
305 "wrong error %lu\n", GetLastError() );
306
307 DeleteDC( hdc );
308 DeleteObject( dib );
309}
310
311static void test_widenpath(void)
312{
313 HDC hdc = GetDC(0);
314 HPEN greenPen, narrowPen;
315 POINT pnt[6];
316 INT nSize;
317 BOOL ret;
318
319 /* Create a pen to be used in WidenPath */
320 greenPen = CreatePen(PS_SOLID, 10, RGB(0,0,0));
321 SelectObject(hdc, greenPen);
322
323 /* Prepare a path */
324 pnt[0].x = 100;
325 pnt[0].y = 0;
326 pnt[1].x = 200;
327 pnt[1].y = 0;
328 pnt[2].x = 300;
329 pnt[2].y = 100;
330 pnt[3].x = 300;
331 pnt[3].y = 200;
332 pnt[4].x = 200;
333 pnt[4].y = 300;
334 pnt[5].x = 100;
335 pnt[5].y = 300;
336
337 /* Set a polyline path */
338 BeginPath(hdc);
339 Polyline(hdc, pnt, 6);
340 EndPath(hdc);
341
342 /* Widen the polyline path */
343 ok(WidenPath(hdc), "WidenPath fails while widening a poyline path.\n");
344
345 /* Test if WidenPath seems to have done his job */
346 nSize = GetPath(hdc, NULL, NULL, 0);
347 ok(nSize != -1, "GetPath fails after calling WidenPath.\n");
348 ok(nSize > 6, "Path number of points is too low. Should be more than 6 but is %d\n", nSize);
349
350 AbortPath(hdc);
351
352 /* Test WidenPath with an open path (last error only set on Win2k and later) */
353 SetLastError(0xdeadbeef);
354 BeginPath(hdc);
355 ret = WidenPath(hdc);
356 ok(ret == FALSE && (GetLastError() == ERROR_CAN_NOT_COMPLETE || GetLastError() == 0xdeadbeef),
357 "WidenPath fails while widening an open path. Return value is %d, should be %d. Error is %lu\n", ret, FALSE, GetLastError());
358
359 AbortPath(hdc);
360
361 /* Test when the pen width is equal to 1. The path should change too */
362 narrowPen = CreatePen(PS_SOLID, 1, RGB(0,0,0));
363 SelectObject(hdc, narrowPen);
364 BeginPath(hdc);
365 Polyline(hdc, pnt, 6);
366 EndPath(hdc);
367 ret = WidenPath(hdc);
368 ok(ret == TRUE, "WidenPath failed: %ld\n", GetLastError());
369 nSize = GetPath(hdc, NULL, NULL, 0);
370 ok(nSize > 6, "WidenPath should compute a widened path with a 1px wide pen. Path length is %d, should be more than 6\n", nSize);
371
372 ReleaseDC(0, hdc);
373 return;
374}
375
376/*
377 * Tests for GDI drawing functions in paths
378 */
379
380typedef struct
381{
382 int x, y;
385
386/* Helper function to verify that the current path in the given DC matches the expected path.
387 *
388 * We use a "smart" matching algorithm that allows us to detect partial improvements
389 * in conformance. Specifically, two running indices are kept, one through the actual
390 * path and one through the expected path. The actual path index increases unless there is
391 * no match and the todo field of the appropriate path_test_t element is 2. Similarly,
392 * if the wine_entries_preceding field of the appropriate path_test_t element is non-zero,
393 * the expected path index does not increase for that many elements as long as there
394 * is no match. This allows us to todo_wine extra path elements that are present only
395 * on wine but not on native and vice versa.
396 *
397 * Note that if expected_size is zero and the WINETEST_DEBUG environment variable is
398 * greater than 2, the trace() output is a C path_test_t array structure, useful for making
399 * new tests that use this function.
400 */
401static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, int expected_size)
402{
403 static const char *type_string[8] = { "Unknown (0)", "PT_CLOSEFIGURE", "PT_LINETO",
404 "PT_LINETO | PT_CLOSEFIGURE", "PT_BEZIERTO",
405 "PT_BEZIERTO | PT_CLOSEFIGURE", "PT_MOVETO", "PT_MOVETO | PT_CLOSEFIGURE"};
406 POINT *pnt;
407 BYTE *types;
408 int size, idx;
409
410 /* Get the path */
411 assert(hdc != 0);
412 size = GetPath(hdc, NULL, NULL, 0);
413 ok(size > 0, "GetPath returned size %d, last error %ld\n", size, GetLastError());
414 if (size <= 0) return;
415
416 pnt = malloc(size * sizeof(POINT));
417 assert(pnt != 0);
418 types = malloc(size);
419 assert(types != 0);
420 size = GetPath(hdc, pnt, types, size);
421 assert(size > 0);
422
423 ok( size == expected_size, "%s: Path size %d does not match expected size %d\n",
424 path_name, size, expected_size);
425
426 for (idx = 0; idx < min( size, expected_size ); idx++)
427 {
428 /* We allow a few pixels fudge in matching X and Y coordinates to account for imprecision in
429 * floating point to integer conversion */
430 static const int fudge = 2;
431
432 ok( types[idx] == expected[idx].type, "%s: Expected #%d: %s (%d,%d) but got %s (%ld,%ld)\n",
433 path_name, idx, type_string[expected[idx].type], expected[idx].x, expected[idx].y,
434 type_string[types[idx]], pnt[idx].x, pnt[idx].y);
435
436 if (types[idx] == expected[idx].type)
437 ok( (pnt[idx].x >= expected[idx].x - fudge && pnt[idx].x <= expected[idx].x + fudge) &&
438 (pnt[idx].y >= expected[idx].y - fudge && pnt[idx].y <= expected[idx].y + fudge),
439 "%s: Expected #%d: %s position (%d,%d) but got (%ld,%ld)\n", path_name, idx,
440 type_string[expected[idx].type], expected[idx].x, expected[idx].y, pnt[idx].x, pnt[idx].y);
441 }
442
443 if (winetest_debug > 2)
444 {
445 printf("static const path_test_t %s[] =\n{\n", path_name);
446 for (idx = 0; idx < size; idx++)
447 printf(" {%ld, %ld, %s}, /* %d */\n", pnt[idx].x, pnt[idx].y, type_string[types[idx]], idx);
448 printf("};\n" );
449 }
450
451 free(types);
452 free(pnt);
453}
454
455static const path_test_t arcto_path[] =
456{
457 {0, 0, PT_MOVETO}, /* 0 */
458 {229, 215, PT_LINETO}, /* 1 */
459 {248, 205, PT_BEZIERTO}, /* 2 */
460 {273, 200, PT_BEZIERTO}, /* 3 */
461 {300, 200, PT_BEZIERTO}, /* 4 */
462 {355, 200, PT_BEZIERTO}, /* 5 */
463 {399, 222, PT_BEZIERTO}, /* 6 */
464 {399, 250, PT_BEZIERTO}, /* 7 */
465 {399, 263, PT_BEZIERTO}, /* 8 */
466 {389, 275, PT_BEZIERTO}, /* 9 */
467 {370, 285, PT_BEZIERTO}, /* 10 */
468 {363, 277, PT_LINETO}, /* 11 */
469 {380, 270, PT_BEZIERTO}, /* 12 */
470 {389, 260, PT_BEZIERTO}, /* 13 */
471 {389, 250, PT_BEZIERTO}, /* 14 */
472 {389, 228, PT_BEZIERTO}, /* 15 */
473 {349, 210, PT_BEZIERTO}, /* 16 */
474 {300, 210, PT_BEZIERTO}, /* 17 */
475 {276, 210, PT_BEZIERTO}, /* 18 */
476 {253, 214, PT_BEZIERTO}, /* 19 */
477 {236, 222, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 20 */
478};
479
480static void test_arcto(void)
481{
482 HDC hdc = GetDC(0);
483
484 BeginPath(hdc);
486 if (!ArcTo(hdc, 200, 200, 400, 300, 200, 200, 400, 300) &&
488 {
489 /* ArcTo is only available on Win2k and later */
490 win_skip("ArcTo is not available\n");
491 goto done;
492 }
494 ArcTo(hdc, 210, 210, 390, 290, 390, 290, 210, 210);
496 EndPath(hdc);
497
498 ok_path(hdc, "arcto_path", arcto_path, ARRAY_SIZE(arcto_path));
499done:
500 ReleaseDC(0, hdc);
501}
502
504{
505 {0, 0, PT_MOVETO}, /* 0 */
506 {371, 229, PT_LINETO}, /* 1 */
507 {352, 211, PT_BEZIERTO}, /* 2 */
508 {327, 200, PT_BEZIERTO}, /* 3 */
509 {300, 200, PT_BEZIERTO}, /* 4 */
510 {245, 200, PT_BEZIERTO}, /* 5 */
511 {200, 245, PT_BEZIERTO}, /* 6 */
512 {200, 300, PT_BEZIERTO}, /* 7 */
513 {200, 300, PT_BEZIERTO}, /* 8 */
514 {200, 300, PT_BEZIERTO}, /* 9 */
515 {200, 300, PT_BEZIERTO}, /* 10 */
516 {231, 260, PT_LINETO}, /* 11 */
517 {245, 235, PT_BEZIERTO}, /* 12 */
518 {271, 220, PT_BEZIERTO}, /* 13 */
519 {300, 220, PT_BEZIERTO}, /* 14 */
520 {344, 220, PT_BEZIERTO}, /* 15 */
521 {380, 256, PT_BEZIERTO}, /* 16 */
522 {380, 300, PT_BEZIERTO}, /* 17 */
523 {380, 314, PT_BEZIERTO}, /* 18 */
524 {376, 328, PT_BEZIERTO}, /* 19 */
525 {369, 340, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 20 */
526};
527
528static void test_anglearc(void)
529{
530 HDC hdc = GetDC(0);
531 BeginPath(hdc);
532 if (!AngleArc(hdc, 300, 300, 100, 45.0, 135.0) &&
534 {
535 /* AngleArc is only available on Win2k and later */
536 win_skip("AngleArc is not available\n");
537 goto done;
538 }
539 AngleArc(hdc, 300, 300, 80, 150.0, -180.0);
541 EndPath(hdc);
542
543 ok_path(hdc, "anglearc_path", anglearc_path, ARRAY_SIZE(anglearc_path));
544done:
545 ReleaseDC(0, hdc);
546}
547
549{
550 {-20, -20, PT_MOVETO}, /* 0 */
551 {10, 10, PT_LINETO}, /* 1 */
552 {10, 15, PT_LINETO | PT_CLOSEFIGURE}, /* 2 */
553 {-20, -20, PT_MOVETO}, /* 3 */
554 {-10, -10, PT_LINETO}, /* 4 */
555 {100, 100, PT_MOVETO}, /* 5 */
556 {95, 95, PT_LINETO}, /* 6 */
557 {10, 10, PT_LINETO}, /* 7 */
558 {10, 15, PT_LINETO | PT_CLOSEFIGURE}, /* 8 */
559 {100, 100, PT_MOVETO}, /* 9 */
560 {15, 15, PT_LINETO}, /* 10 */
561 {25, 25, PT_MOVETO}, /* 11 */
562 {25, 30, PT_LINETO}, /* 12 */
563 {100, 100, PT_MOVETO}, /* 13 */
564 {30, 30, PT_BEZIERTO}, /* 14 */
565 {30, 35, PT_BEZIERTO}, /* 15 */
566 {35, 35, PT_BEZIERTO}, /* 16 */
567 {35, 40, PT_LINETO}, /* 17 */
568 {40, 40, PT_MOVETO}, /* 18 */
569 {40, 45, PT_LINETO}, /* 19 */
570 {35, 40, PT_MOVETO}, /* 20 */
571 {45, 50, PT_LINETO}, /* 21 */
572 {35, 40, PT_MOVETO}, /* 22 */
573 {50, 55, PT_LINETO}, /* 23 */
574 {45, 50, PT_LINETO}, /* 24 */
575 {35, 40, PT_MOVETO}, /* 25 */
576 {60, 60, PT_LINETO}, /* 26 */
577 {60, 65, PT_MOVETO}, /* 27 */
578 {65, 65, PT_LINETO}, /* 28 */
579 {75, 75, PT_MOVETO}, /* 29 */
580 {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 30 */
581};
582
583static POINT polydraw_pts[] = {
584 {10, 10}, {10, 15},
585 {15, 15}, {15, 20}, {20, 20}, {20, 25},
586 {25, 25}, {25, 30},
587 {30, 30}, {30, 35}, {35, 35}, {35, 40},
588 {40, 40}, {40, 45}, {45, 45},
589 {45, 50}, {50, 50},
590 {50, 55}, {45, 50}, {55, 60},
591 {60, 60}, {60, 65}, {65, 65},
592 {70, 70}, {75, 70}, {75, 75}, {80, 80}};
593
597 PT_MOVETO, PT_LINETO, /* 8 */
604
605static void test_polydraw(void)
606{
607 BOOL retb;
608 POINT pos;
609 HDC hdc = GetDC(0);
610 HWND hwnd;
611
612 MoveToEx( hdc, -20, -20, NULL );
613
614 BeginPath(hdc);
616 ok( pos.x == -20 && pos.y == -20, "wrong pos %ld,%ld\n", pos.x, pos.y );
617
618 /* closefigure with no previous moveto */
619 if (!(retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2)) &&
621 {
622 /* PolyDraw is only available on Win2k and later */
623 win_skip("PolyDraw is not available\n");
624 ReleaseDC(0, hdc);
625 return;
626 }
627 expect(TRUE, retb);
629 ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
630 LineTo(hdc, -10, -10);
632 ok( pos.x == -10 && pos.y == -10, "wrong pos %ld,%ld\n", pos.x, pos.y );
633
634 MoveToEx(hdc, 100, 100, NULL);
636 ok( pos.x == 100 && pos.y == 100, "wrong pos %ld,%ld\n", pos.x, pos.y );
637 LineTo(hdc, 95, 95);
639 ok( pos.x == 95 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
640 /* closefigure with previous moveto */
642 expect(TRUE, retb);
644 ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
645 /* bad bezier points */
646 retb = PolyDraw(hdc, &(polydraw_pts[2]), &(polydraw_tps[2]), 4);
647 expect(FALSE, retb);
649 ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
650 retb = PolyDraw(hdc, &(polydraw_pts[6]), &(polydraw_tps[6]), 4);
651 expect(FALSE, retb);
653 ok( pos.x == 10 && pos.y == 15, "wrong pos %ld,%ld\n", pos.x, pos.y );
654 /* good bezier points */
655 retb = PolyDraw(hdc, &(polydraw_pts[8]), &(polydraw_tps[8]), 4);
656 expect(TRUE, retb);
658 ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
659 /* does lineto or bezierto take precedence? */
660 retb = PolyDraw(hdc, &(polydraw_pts[12]), &(polydraw_tps[12]), 4);
661 expect(FALSE, retb);
663 ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
664 /* bad point type, has already moved cursor position */
665 retb = PolyDraw(hdc, &(polydraw_pts[15]), &(polydraw_tps[15]), 4);
666 expect(FALSE, retb);
668 ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
669 /* bad point type, cursor position is moved, but back to its original spot */
670 retb = PolyDraw(hdc, &(polydraw_pts[17]), &(polydraw_tps[17]), 4);
671 expect(FALSE, retb);
673 ok( pos.x == 35 && pos.y == 40, "wrong pos %ld,%ld\n", pos.x, pos.y );
674 /* does lineto or moveto take precedence? */
675 retb = PolyDraw(hdc, &(polydraw_pts[20]), &(polydraw_tps[20]), 3);
676 expect(TRUE, retb);
678 ok( pos.x == 65 && pos.y == 65, "wrong pos %ld,%ld\n", pos.x, pos.y );
679 /* consecutive movetos */
680 retb = PolyDraw(hdc, &(polydraw_pts[23]), &(polydraw_tps[23]), 4);
681 expect(TRUE, retb);
683 ok( pos.x == 80 && pos.y == 80, "wrong pos %ld,%ld\n", pos.x, pos.y );
684
685 EndPath(hdc);
686 ok_path(hdc, "polydraw_path", polydraw_path, ARRAY_SIZE(polydraw_path));
688 ok( pos.x == 80 && pos.y == 80, "wrong pos %ld,%ld\n", pos.x, pos.y );
689 ReleaseDC(0, hdc);
690
691 /* Test a special case that GDI path driver is created before window driver */
692 hwnd = CreateWindowA("static", NULL, 0, 0, 0, 0, 0, 0, 0, 0, NULL);
693 hdc = GetDC(hwnd);
694
695 BeginPath(hdc);
696 SetWindowPos(hwnd, 0, 0, 0, 100, 100, SWP_NOZORDER | SWP_NOMOVE | SWP_SHOWWINDOW);
698 ok(retb, "PolyDraw failed, error %#lx\n", GetLastError());
699 EndPath(hdc);
700
703}
704
705static void test_closefigure(void) {
706 int nSize, nSizeWitness;
707 POINT pos;
708 HDC hdc = GetDC(0);
709
710 MoveToEx( hdc, 100, 100, NULL );
712 ok( pos.x == 100 && pos.y == 100, "wrong pos %ld,%ld\n", pos.x, pos.y );
713
714 BeginPath(hdc);
716 ok( pos.x == 100 && pos.y == 100, "wrong pos %ld,%ld\n", pos.x, pos.y );
717 MoveToEx(hdc, 95, 95, NULL);
719 ok( pos.x == 95 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
720 LineTo(hdc, 95, 0);
722 ok( pos.x == 95 && pos.y == 0, "wrong pos %ld,%ld\n", pos.x, pos.y );
723 LineTo(hdc, 0, 95);
725 ok( pos.x == 0 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
726
729 ok( pos.x == 0 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
730 EndPath(hdc);
732 ok( pos.x == 0 && pos.y == 95, "wrong pos %ld,%ld\n", pos.x, pos.y );
733 nSize = GetPath(hdc, NULL, NULL, 0);
734
735 AbortPath(hdc);
736
737 BeginPath(hdc);
738 MoveToEx(hdc, 95, 95, NULL);
739 LineTo(hdc, 95, 0);
740 LineTo(hdc, 0, 95);
741
742 EndPath(hdc);
743 nSizeWitness = GetPath(hdc, NULL, NULL, 0);
744
745 /* This test shows CloseFigure does not have to add a point at the end of the path */
746 ok(nSize == nSizeWitness, "Wrong number of points, no point should be added by CloseFigure\n");
747
748 ReleaseDC(0, hdc);
749}
750
752{
753 POINT **pt = (POINT**)lparam;
754 ok((*pt)->x == x && (*pt)->y == y, "point mismatch expect(%ld,%ld) got(%d,%d)\n",
755 (*pt)->x, (*pt)->y, x, y);
756
757 (*pt)++;
758 return;
759}
760
761static void test_linedda(void)
762{
763 const POINT *pt;
764 static const POINT array_10_20_20_40[] = {{10,20},{10,21},{11,22},{11,23},
765 {12,24},{12,25},{13,26},{13,27},
766 {14,28},{14,29},{15,30},{15,31},
767 {16,32},{16,33},{17,34},{17,35},
768 {18,36},{18,37},{19,38},{19,39},
769 {-1,-1}};
770 static const POINT array_10_20_20_43[] = {{10,20},{10,21},{11,22},{11,23},
771 {12,24},{12,25},{13,26},{13,27},
772 {13,28},{14,29},{14,30},{15,31},
773 {15,32},{16,33},{16,34},{17,35},
774 {17,36},{17,37},{18,38},{18,39},
775 {19,40},{19,41},{20,42},{-1,-1}};
776
777 static const POINT array_10_20_10_20[] = {{-1,-1}};
778 static const POINT array_10_20_11_27[] = {{10,20},{10,21},{10,22},{10,23},
779 {11,24},{11,25},{11,26},{-1,-1}};
780
781 static const POINT array_20_43_10_20[] = {{20,43},{20,42},{19,41},{19,40},
782 {18,39},{18,38},{17,37},{17,36},
783 {17,35},{16,34},{16,33},{15,32},
784 {15,31},{14,30},{14,29},{13,28},
785 {13,27},{13,26},{12,25},{12,24},
786 {11,23},{11,22},{10,21},{-1,-1}};
787
788 static const POINT array_20_20_10_43[] = {{20,20},{20,21},{19,22},{19,23},
789 {18,24},{18,25},{17,26},{17,27},
790 {17,28},{16,29},{16,30},{15,31},
791 {15,32},{14,33},{14,34},{13,35},
792 {13,36},{13,37},{12,38},{12,39},
793 {11,40},{11,41},{10,42},{-1,-1}};
794
795 static const POINT array_20_20_43_10[] = {{20,20},{21,20},{22,19},{23,19},
796 {24,18},{25,18},{26,17},{27,17},
797 {28,17},{29,16},{30,16},{31,15},
798 {32,15},{33,14},{34,14},{35,13},
799 {36,13},{37,13},{38,12},{39,12},
800 {40,11},{41,11},{42,10},{-1,-1}};
801
802
803 pt = array_10_20_20_40;
804 LineDDA(10, 20, 20, 40, linedda_callback, (LPARAM)&pt);
805 ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
806
807 pt = array_10_20_20_43;
808 LineDDA(10, 20, 20, 43, linedda_callback, (LPARAM)&pt);
809 ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
810
811 pt = array_10_20_10_20;
812 LineDDA(10, 20, 10, 20, linedda_callback, (LPARAM)&pt);
813 ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
814
815 pt = array_10_20_11_27;
816 LineDDA(10, 20, 11, 27, linedda_callback, (LPARAM)&pt);
817 ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
818
819 pt = array_20_43_10_20;
820 LineDDA(20, 43, 10, 20, linedda_callback, (LPARAM)&pt);
821 ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
822
823 pt = array_20_20_10_43;
824 LineDDA(20, 20, 10, 43, linedda_callback, (LPARAM)&pt);
825 ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
826
827 pt = array_20_20_43_10;
828 LineDDA(20, 20, 43, 10, linedda_callback, (LPARAM)&pt);
829 ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
830}
831
833{
834 {39, 20, PT_MOVETO}, /* 0 */
835 {20, 20, PT_LINETO}, /* 1 */
836 {20, 39, PT_LINETO}, /* 2 */
837 {39, 39, PT_LINETO | PT_CLOSEFIGURE}, /* 3 */
838 {54, 35, PT_MOVETO}, /* 4 */
839 {30, 35, PT_LINETO}, /* 5 */
840 {30, 49, PT_LINETO}, /* 6 */
841 {54, 49, PT_LINETO | PT_CLOSEFIGURE}, /* 7 */
842 {59, 45, PT_MOVETO}, /* 8 */
843 {35, 45, PT_LINETO}, /* 9 */
844 {35, 59, PT_LINETO}, /* 10 */
845 {59, 59, PT_LINETO | PT_CLOSEFIGURE}, /* 11 */
846 {80, 80, PT_MOVETO}, /* 12 */
847 {80, 80, PT_LINETO}, /* 13 */
848 {80, 80, PT_LINETO}, /* 14 */
849 {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 15 */
850 {39, 39, PT_MOVETO}, /* 16 */
851 {20, 39, PT_LINETO}, /* 17 */
852 {20, 20, PT_LINETO}, /* 18 */
853 {39, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 19 */
854 {54, 49, PT_MOVETO}, /* 20 */
855 {30, 49, PT_LINETO}, /* 21 */
856 {30, 35, PT_LINETO}, /* 22 */
857 {54, 35, PT_LINETO | PT_CLOSEFIGURE}, /* 23 */
858 {59, 59, PT_MOVETO}, /* 24 */
859 {35, 59, PT_LINETO}, /* 25 */
860 {35, 45, PT_LINETO}, /* 26 */
861 {59, 45, PT_LINETO | PT_CLOSEFIGURE}, /* 27 */
862 {80, 80, PT_MOVETO}, /* 28 */
863 {80, 80, PT_LINETO}, /* 29 */
864 {80, 80, PT_LINETO}, /* 30 */
865 {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 31 */
866 {-41, 40, PT_MOVETO}, /* 32 */
867 {-80, 40, PT_LINETO}, /* 33 */
868 {-80, 79, PT_LINETO}, /* 34 */
869 {-41, 79, PT_LINETO | PT_CLOSEFIGURE}, /* 35 */
870 {-61, 70, PT_MOVETO}, /* 36 */
871 {-110, 70, PT_LINETO}, /* 37 */
872 {-110, 99, PT_LINETO}, /* 38 */
873 {-61, 99, PT_LINETO | PT_CLOSEFIGURE}, /* 39 */
874 {119, -120, PT_MOVETO}, /* 40 */
875 {60, -120, PT_LINETO}, /* 41 */
876 {60, -61, PT_LINETO}, /* 42 */
877 {119, -61, PT_LINETO | PT_CLOSEFIGURE}, /* 43 */
878 {164, -150, PT_MOVETO}, /* 44 */
879 {90, -150, PT_LINETO}, /* 45 */
880 {90, -106, PT_LINETO}, /* 46 */
881 {164, -106, PT_LINETO | PT_CLOSEFIGURE}, /* 47 */
882 {-4, -6, PT_MOVETO}, /* 48 */
883 {-6, -6, PT_LINETO}, /* 49 */
884 {-6, -4, PT_LINETO}, /* 50 */
885 {-4, -4, PT_LINETO | PT_CLOSEFIGURE}, /* 51 */
886 {40, 20, PT_MOVETO}, /* 52 */
887 {20, 20, PT_LINETO}, /* 53 */
888 {20, 40, PT_LINETO}, /* 54 */
889 {40, 40, PT_LINETO | PT_CLOSEFIGURE}, /* 55 */
890 {55, 35, PT_MOVETO}, /* 56 */
891 {30, 35, PT_LINETO}, /* 57 */
892 {30, 50, PT_LINETO}, /* 58 */
893 {55, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 59 */
894 {60, 45, PT_MOVETO}, /* 60 */
895 {35, 45, PT_LINETO}, /* 61 */
896 {35, 60, PT_LINETO}, /* 62 */
897 {60, 60, PT_LINETO | PT_CLOSEFIGURE}, /* 63 */
898 {70, 70, PT_MOVETO}, /* 64 */
899 {50, 70, PT_LINETO}, /* 65 */
900 {50, 70, PT_LINETO}, /* 66 */
901 {70, 70, PT_LINETO | PT_CLOSEFIGURE}, /* 67 */
902 {75, 75, PT_MOVETO}, /* 68 */
903 {75, 75, PT_LINETO}, /* 69 */
904 {75, 85, PT_LINETO}, /* 70 */
905 {75, 85, PT_LINETO | PT_CLOSEFIGURE}, /* 71 */
906 {81, 80, PT_MOVETO}, /* 72 */
907 {80, 80, PT_LINETO}, /* 73 */
908 {80, 81, PT_LINETO}, /* 74 */
909 {81, 81, PT_LINETO | PT_CLOSEFIGURE}, /* 75 */
910 {40, 40, PT_MOVETO}, /* 76 */
911 {20, 40, PT_LINETO}, /* 77 */
912 {20, 20, PT_LINETO}, /* 78 */
913 {40, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 79 */
914 {55, 50, PT_MOVETO}, /* 80 */
915 {30, 50, PT_LINETO}, /* 81 */
916 {30, 35, PT_LINETO}, /* 82 */
917 {55, 35, PT_LINETO | PT_CLOSEFIGURE}, /* 83 */
918 {60, 60, PT_MOVETO}, /* 84 */
919 {35, 60, PT_LINETO}, /* 85 */
920 {35, 45, PT_LINETO}, /* 86 */
921 {60, 45, PT_LINETO | PT_CLOSEFIGURE}, /* 87 */
922 {70, 70, PT_MOVETO}, /* 88 */
923 {50, 70, PT_LINETO}, /* 89 */
924 {50, 70, PT_LINETO}, /* 90 */
925 {70, 70, PT_LINETO | PT_CLOSEFIGURE}, /* 91 */
926 {75, 85, PT_MOVETO}, /* 92 */
927 {75, 85, PT_LINETO}, /* 93 */
928 {75, 75, PT_LINETO}, /* 94 */
929 {75, 75, PT_LINETO | PT_CLOSEFIGURE}, /* 95 */
930 {81, 81, PT_MOVETO}, /* 96 */
931 {80, 81, PT_LINETO}, /* 97 */
932 {80, 80, PT_LINETO}, /* 98 */
933 {81, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 99 */
934};
935
936static void test_rectangle(void)
937{
938 HDC hdc = GetDC( 0 );
939
940 BeginPath( hdc );
941 Rectangle( hdc, 20, 20, 40, 40 );
942 Rectangle( hdc, 30, 50, 55, 35 );
943 Rectangle( hdc, 60, 60, 35, 45 );
944 Rectangle( hdc, 70, 70, 50, 70 );
945 Rectangle( hdc, 75, 75, 75, 85 );
946 Rectangle( hdc, 80, 80, 81, 81 );
948 Rectangle( hdc, 20, 20, 40, 40 );
949 Rectangle( hdc, 30, 50, 55, 35 );
950 Rectangle( hdc, 60, 60, 35, 45 );
951 Rectangle( hdc, 70, 70, 50, 70 );
952 Rectangle( hdc, 75, 75, 75, 85 );
953 Rectangle( hdc, 80, 80, 81, 81 );
956 SetViewportExtEx( hdc, -2, 2, NULL );
957 Rectangle( hdc, 20, 20, 40, 40 );
958 Rectangle( hdc, 30, 50, 55, 35 );
959 SetViewportExtEx( hdc, 3, -3, NULL );
960 Rectangle( hdc, 20, 20, 40, 40 );
961 Rectangle( hdc, 30, 50, 55, 35 );
962 SetWindowExtEx( hdc, -20, 20, NULL );
963 Rectangle( hdc, 20, 20, 40, 40 );
964 Rectangle( hdc, 24, 22, 21, 20 );
967 Rectangle( hdc, 20, 20, 40, 40 );
968 Rectangle( hdc, 30, 50, 55, 35 );
969 Rectangle( hdc, 60, 60, 35, 45 );
970 Rectangle( hdc, 70, 70, 50, 70 );
971 Rectangle( hdc, 75, 75, 75, 85 );
972 Rectangle( hdc, 80, 80, 81, 81 );
974 Rectangle( hdc, 20, 20, 40, 40 );
975 Rectangle( hdc, 30, 50, 55, 35 );
976 Rectangle( hdc, 60, 60, 35, 45 );
977 Rectangle( hdc, 70, 70, 50, 70 );
978 Rectangle( hdc, 75, 75, 75, 85 );
979 Rectangle( hdc, 80, 80, 81, 81 );
981 EndPath( hdc );
983 ok_path( hdc, "rectangle_path", rectangle_path, ARRAY_SIZE(rectangle_path) );
984 ReleaseDC( 0, hdc );
985}
986
988{
989 {39, 25, PT_MOVETO}, /* 0 */
990 {39, 22, PT_BEZIERTO}, /* 1 */
991 {37, 20, PT_BEZIERTO}, /* 2 */
992 {34, 20, PT_BEZIERTO}, /* 3 */
993 {25, 20, PT_LINETO}, /* 4 */
994 {22, 20, PT_BEZIERTO}, /* 5 */
995 {20, 22, PT_BEZIERTO}, /* 6 */
996 {20, 25, PT_BEZIERTO}, /* 7 */
997 {20, 34, PT_LINETO}, /* 8 */
998 {20, 37, PT_BEZIERTO}, /* 9 */
999 {22, 39, PT_BEZIERTO}, /* 10 */
1000 {25, 39, PT_BEZIERTO}, /* 11 */
1001 {34, 39, PT_LINETO}, /* 12 */
1002 {37, 39, PT_BEZIERTO}, /* 13 */
1003 {39, 37, PT_BEZIERTO}, /* 14 */
1004 {39, 34, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 15 */
1005 {54, 42, PT_MOVETO}, /* 16 */
1006 {54, 38, PT_BEZIERTO}, /* 17 */
1007 {49, 35, PT_BEZIERTO}, /* 18 */
1008 {42, 35, PT_BEZIERTO}, /* 19 */
1009 {42, 35, PT_LINETO}, /* 20 */
1010 {35, 35, PT_BEZIERTO}, /* 21 */
1011 {30, 38, PT_BEZIERTO}, /* 22 */
1012 {30, 42, PT_BEZIERTO}, /* 23 */
1013 {30, 42, PT_LINETO}, /* 24 */
1014 {30, 46, PT_BEZIERTO}, /* 25 */
1015 {35, 49, PT_BEZIERTO}, /* 26 */
1016 {42, 49, PT_BEZIERTO}, /* 27 */
1017 {42, 49, PT_LINETO}, /* 28 */
1018 {49, 49, PT_BEZIERTO}, /* 29 */
1019 {54, 46, PT_BEZIERTO}, /* 30 */
1020 {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 31 */
1021 {59, 46, PT_MOVETO}, /* 32 */
1022 {59, 45, PT_BEZIERTO}, /* 33 */
1023 {58, 45, PT_BEZIERTO}, /* 34 */
1024 {57, 45, PT_BEZIERTO}, /* 35 */
1025 {37, 45, PT_LINETO}, /* 36 */
1026 {36, 45, PT_BEZIERTO}, /* 37 */
1027 {35, 45, PT_BEZIERTO}, /* 38 */
1028 {35, 46, PT_BEZIERTO}, /* 39 */
1029 {35, 58, PT_LINETO}, /* 40 */
1030 {35, 59, PT_BEZIERTO}, /* 41 */
1031 {36, 59, PT_BEZIERTO}, /* 42 */
1032 {37, 59, PT_BEZIERTO}, /* 43 */
1033 {57, 59, PT_LINETO}, /* 44 */
1034 {58, 59, PT_BEZIERTO}, /* 45 */
1035 {59, 59, PT_BEZIERTO}, /* 46 */
1036 {59, 58, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 47 */
1037 {80, 80, PT_MOVETO}, /* 48 */
1038 {80, 80, PT_BEZIERTO}, /* 49 */
1039 {80, 80, PT_BEZIERTO}, /* 50 */
1040 {80, 80, PT_BEZIERTO}, /* 51 */
1041 {80, 80, PT_LINETO}, /* 52 */
1042 {80, 80, PT_BEZIERTO}, /* 53 */
1043 {80, 80, PT_BEZIERTO}, /* 54 */
1044 {80, 80, PT_BEZIERTO}, /* 55 */
1045 {80, 80, PT_LINETO}, /* 56 */
1046 {80, 80, PT_BEZIERTO}, /* 57 */
1047 {80, 80, PT_BEZIERTO}, /* 58 */
1048 {80, 80, PT_BEZIERTO}, /* 59 */
1049 {80, 80, PT_LINETO}, /* 60 */
1050 {80, 80, PT_BEZIERTO}, /* 61 */
1051 {80, 80, PT_BEZIERTO}, /* 62 */
1052 {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 63 */
1053 {94, 85, PT_MOVETO}, /* 64 */
1054 {90, 85, PT_LINETO}, /* 65 */
1055 {90, 89, PT_LINETO}, /* 66 */
1056 {94, 89, PT_LINETO | PT_CLOSEFIGURE}, /* 67 */
1057 {39, 34, PT_MOVETO}, /* 68 */
1058 {39, 37, PT_BEZIERTO}, /* 69 */
1059 {37, 39, PT_BEZIERTO}, /* 70 */
1060 {34, 39, PT_BEZIERTO}, /* 71 */
1061 {25, 39, PT_LINETO}, /* 72 */
1062 {22, 39, PT_BEZIERTO}, /* 73 */
1063 {20, 37, PT_BEZIERTO}, /* 74 */
1064 {20, 34, PT_BEZIERTO}, /* 75 */
1065 {20, 25, PT_LINETO}, /* 76 */
1066 {20, 22, PT_BEZIERTO}, /* 77 */
1067 {22, 20, PT_BEZIERTO}, /* 78 */
1068 {25, 20, PT_BEZIERTO}, /* 79 */
1069 {34, 20, PT_LINETO}, /* 80 */
1070 {37, 20, PT_BEZIERTO}, /* 81 */
1071 {39, 22, PT_BEZIERTO}, /* 82 */
1072 {39, 25, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 83 */
1073 {54, 42, PT_MOVETO}, /* 84 */
1074 {54, 46, PT_BEZIERTO}, /* 85 */
1075 {49, 49, PT_BEZIERTO}, /* 86 */
1076 {42, 49, PT_BEZIERTO}, /* 87 */
1077 {42, 49, PT_LINETO}, /* 88 */
1078 {35, 49, PT_BEZIERTO}, /* 89 */
1079 {30, 46, PT_BEZIERTO}, /* 90 */
1080 {30, 42, PT_BEZIERTO}, /* 91 */
1081 {30, 42, PT_LINETO}, /* 92 */
1082 {30, 38, PT_BEZIERTO}, /* 93 */
1083 {35, 35, PT_BEZIERTO}, /* 94 */
1084 {42, 35, PT_BEZIERTO}, /* 95 */
1085 {42, 35, PT_LINETO}, /* 96 */
1086 {49, 35, PT_BEZIERTO}, /* 97 */
1087 {54, 38, PT_BEZIERTO}, /* 98 */
1088 {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 99 */
1089 {-41, 52, PT_MOVETO}, /* 100 */
1090 {-41, 45, PT_BEZIERTO}, /* 101 */
1091 {-47, 40, PT_BEZIERTO}, /* 102 */
1092 {-56, 40, PT_BEZIERTO}, /* 103 */
1093 {-65, 40, PT_LINETO}, /* 104 */
1094 {-73, 40, PT_BEZIERTO}, /* 105 */
1095 {-80, 45, PT_BEZIERTO}, /* 106 */
1096 {-80, 52, PT_BEZIERTO}, /* 107 */
1097 {-80, 67, PT_LINETO}, /* 108 */
1098 {-80, 74, PT_BEZIERTO}, /* 109 */
1099 {-73, 79, PT_BEZIERTO}, /* 110 */
1100 {-65, 79, PT_BEZIERTO}, /* 111 */
1101 {-56, 79, PT_LINETO}, /* 112 */
1102 {-47, 79, PT_BEZIERTO}, /* 113 */
1103 {-41, 74, PT_BEZIERTO}, /* 114 */
1104 {-41, 67, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 115 */
1105 {-61, 79, PT_MOVETO}, /* 116 */
1106 {-61, 74, PT_BEZIERTO}, /* 117 */
1107 {-64, 70, PT_BEZIERTO}, /* 118 */
1108 {-68, 70, PT_BEZIERTO}, /* 119 */
1109 {-103, 70, PT_LINETO}, /* 120 */
1110 {-107, 70, PT_BEZIERTO}, /* 121 */
1111 {-110, 74, PT_BEZIERTO}, /* 122 */
1112 {-110, 79, PT_BEZIERTO}, /* 123 */
1113 {-110, 90, PT_LINETO}, /* 124 */
1114 {-110, 95, PT_BEZIERTO}, /* 125 */
1115 {-107, 99, PT_BEZIERTO}, /* 126 */
1116 {-103, 99, PT_BEZIERTO}, /* 127 */
1117 {-68, 99, PT_LINETO}, /* 128 */
1118 {-64, 99, PT_BEZIERTO}, /* 129 */
1119 {-61, 95, PT_BEZIERTO}, /* 130 */
1120 {-61, 90, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 131 */
1121 {119, -102, PT_MOVETO}, /* 132 */
1122 {119, -112, PT_BEZIERTO}, /* 133 */
1123 {109, -120, PT_BEZIERTO}, /* 134 */
1124 {97, -120, PT_BEZIERTO}, /* 135 */
1125 {82, -120, PT_LINETO}, /* 136 */
1126 {70, -120, PT_BEZIERTO}, /* 137 */
1127 {60, -112, PT_BEZIERTO}, /* 138 */
1128 {60, -102, PT_BEZIERTO}, /* 139 */
1129 {60, -79, PT_LINETO}, /* 140 */
1130 {60, -69, PT_BEZIERTO}, /* 141 */
1131 {70, -61, PT_BEZIERTO}, /* 142 */
1132 {82, -61, PT_BEZIERTO}, /* 143 */
1133 {97, -61, PT_LINETO}, /* 144 */
1134 {109, -61, PT_BEZIERTO}, /* 145 */
1135 {119, -69, PT_BEZIERTO}, /* 146 */
1136 {119, -79, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 147 */
1137 {164, -144, PT_MOVETO}, /* 148 */
1138 {164, -147, PT_BEZIERTO}, /* 149 */
1139 {162, -150, PT_BEZIERTO}, /* 150 */
1140 {160, -150, PT_BEZIERTO}, /* 151 */
1141 {94, -150, PT_LINETO}, /* 152 */
1142 {92, -150, PT_BEZIERTO}, /* 153 */
1143 {90, -147, PT_BEZIERTO}, /* 154 */
1144 {90, -144, PT_BEZIERTO}, /* 155 */
1145 {90, -112, PT_LINETO}, /* 156 */
1146 {90, -109, PT_BEZIERTO}, /* 157 */
1147 {92, -106, PT_BEZIERTO}, /* 158 */
1148 {94, -106, PT_BEZIERTO}, /* 159 */
1149 {160, -106, PT_LINETO}, /* 160 */
1150 {162, -106, PT_BEZIERTO}, /* 161 */
1151 {164, -109, PT_BEZIERTO}, /* 162 */
1152 {164, -112, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 163 */
1153 {-4, -6, PT_MOVETO}, /* 164 */
1154 {-4, -6, PT_BEZIERTO}, /* 165 */
1155 {-4, -6, PT_BEZIERTO}, /* 166 */
1156 {-4, -6, PT_BEZIERTO}, /* 167 */
1157 {-6, -6, PT_LINETO}, /* 168 */
1158 {-6, -6, PT_BEZIERTO}, /* 169 */
1159 {-6, -6, PT_BEZIERTO}, /* 170 */
1160 {-6, -6, PT_BEZIERTO}, /* 171 */
1161 {-6, -4, PT_LINETO}, /* 172 */
1162 {-6, -4, PT_BEZIERTO}, /* 173 */
1163 {-6, -4, PT_BEZIERTO}, /* 174 */
1164 {-6, -4, PT_BEZIERTO}, /* 175 */
1165 {-4, -4, PT_LINETO}, /* 176 */
1166 {-4, -4, PT_BEZIERTO}, /* 177 */
1167 {-4, -4, PT_BEZIERTO}, /* 178 */
1168 {-4, -4, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 179 */
1169 {40, 25, PT_MOVETO}, /* 180 */
1170 {40, 22, PT_BEZIERTO}, /* 181 */
1171 {38, 20, PT_BEZIERTO}, /* 182 */
1172 {35, 20, PT_BEZIERTO}, /* 183 */
1173 {25, 20, PT_LINETO}, /* 184 */
1174 {22, 20, PT_BEZIERTO}, /* 185 */
1175 {20, 22, PT_BEZIERTO}, /* 186 */
1176 {20, 25, PT_BEZIERTO}, /* 187 */
1177 {20, 35, PT_LINETO}, /* 188 */
1178 {20, 38, PT_BEZIERTO}, /* 189 */
1179 {22, 40, PT_BEZIERTO}, /* 190 */
1180 {25, 40, PT_BEZIERTO}, /* 191 */
1181 {35, 40, PT_LINETO}, /* 192 */
1182 {38, 40, PT_BEZIERTO}, /* 193 */
1183 {40, 38, PT_BEZIERTO}, /* 194 */
1184 {40, 35, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 195 */
1185 {55, 43, PT_MOVETO}, /* 196 */
1186 {55, 38, PT_BEZIERTO}, /* 197 */
1187 {49, 35, PT_BEZIERTO}, /* 198 */
1188 {43, 35, PT_BEZIERTO}, /* 199 */
1189 {43, 35, PT_LINETO}, /* 200 */
1190 {36, 35, PT_BEZIERTO}, /* 201 */
1191 {30, 38, PT_BEZIERTO}, /* 202 */
1192 {30, 43, PT_BEZIERTO}, /* 203 */
1193 {30, 43, PT_LINETO}, /* 204 */
1194 {30, 47, PT_BEZIERTO}, /* 205 */
1195 {36, 50, PT_BEZIERTO}, /* 206 */
1196 {43, 50, PT_BEZIERTO}, /* 207 */
1197 {43, 50, PT_LINETO}, /* 208 */
1198 {49, 50, PT_BEZIERTO}, /* 209 */
1199 {55, 47, PT_BEZIERTO}, /* 210 */
1200 {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 211 */
1201 {60, 46, PT_MOVETO}, /* 212 */
1202 {60, 46, PT_BEZIERTO}, /* 213 */
1203 {59, 45, PT_BEZIERTO}, /* 214 */
1204 {58, 45, PT_BEZIERTO}, /* 215 */
1205 {38, 45, PT_LINETO}, /* 216 */
1206 {36, 45, PT_BEZIERTO}, /* 217 */
1207 {35, 46, PT_BEZIERTO}, /* 218 */
1208 {35, 46, PT_BEZIERTO}, /* 219 */
1209 {35, 59, PT_LINETO}, /* 220 */
1210 {35, 60, PT_BEZIERTO}, /* 221 */
1211 {36, 60, PT_BEZIERTO}, /* 222 */
1212 {38, 60, PT_BEZIERTO}, /* 223 */
1213 {58, 60, PT_LINETO}, /* 224 */
1214 {59, 60, PT_BEZIERTO}, /* 225 */
1215 {60, 60, PT_BEZIERTO}, /* 226 */
1216 {60, 59, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 227 */
1217 {70, 70, PT_MOVETO}, /* 228 */
1218 {70, 70, PT_BEZIERTO}, /* 229 */
1219 {70, 70, PT_BEZIERTO}, /* 230 */
1220 {70, 70, PT_BEZIERTO}, /* 231 */
1221 {50, 70, PT_LINETO}, /* 232 */
1222 {50, 70, PT_BEZIERTO}, /* 233 */
1223 {50, 70, PT_BEZIERTO}, /* 234 */
1224 {50, 70, PT_BEZIERTO}, /* 235 */
1225 {50, 70, PT_LINETO}, /* 236 */
1226 {50, 70, PT_BEZIERTO}, /* 237 */
1227 {50, 70, PT_BEZIERTO}, /* 238 */
1228 {50, 70, PT_BEZIERTO}, /* 239 */
1229 {70, 70, PT_LINETO}, /* 240 */
1230 {70, 70, PT_BEZIERTO}, /* 241 */
1231 {70, 70, PT_BEZIERTO}, /* 242 */
1232 {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 243 */
1233 {75, 75, PT_MOVETO}, /* 244 */
1234 {75, 75, PT_BEZIERTO}, /* 245 */
1235 {75, 75, PT_BEZIERTO}, /* 246 */
1236 {75, 75, PT_BEZIERTO}, /* 247 */
1237 {75, 75, PT_LINETO}, /* 248 */
1238 {75, 75, PT_BEZIERTO}, /* 249 */
1239 {75, 75, PT_BEZIERTO}, /* 250 */
1240 {75, 75, PT_BEZIERTO}, /* 251 */
1241 {75, 85, PT_LINETO}, /* 252 */
1242 {75, 85, PT_BEZIERTO}, /* 253 */
1243 {75, 85, PT_BEZIERTO}, /* 254 */
1244 {75, 85, PT_BEZIERTO}, /* 255 */
1245 {75, 85, PT_LINETO}, /* 256 */
1246 {75, 85, PT_BEZIERTO}, /* 257 */
1247 {75, 85, PT_BEZIERTO}, /* 258 */
1248 {75, 85, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 259 */
1249 {81, 81, PT_MOVETO}, /* 260 */
1250 {81, 80, PT_BEZIERTO}, /* 261 */
1251 {81, 80, PT_BEZIERTO}, /* 262 */
1252 {81, 80, PT_BEZIERTO}, /* 263 */
1253 {81, 80, PT_LINETO}, /* 264 */
1254 {80, 80, PT_BEZIERTO}, /* 265 */
1255 {80, 80, PT_BEZIERTO}, /* 266 */
1256 {80, 81, PT_BEZIERTO}, /* 267 */
1257 {80, 81, PT_LINETO}, /* 268 */
1258 {80, 81, PT_BEZIERTO}, /* 269 */
1259 {80, 81, PT_BEZIERTO}, /* 270 */
1260 {81, 81, PT_BEZIERTO}, /* 271 */
1261 {81, 81, PT_LINETO}, /* 272 */
1262 {81, 81, PT_BEZIERTO}, /* 273 */
1263 {81, 81, PT_BEZIERTO}, /* 274 */
1264 {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 275 */
1265 {95, 85, PT_MOVETO}, /* 276 */
1266 {90, 85, PT_LINETO}, /* 277 */
1267 {90, 90, PT_LINETO}, /* 278 */
1268 {95, 90, PT_LINETO | PT_CLOSEFIGURE}, /* 279 */
1269 {40, 35, PT_MOVETO}, /* 280 */
1270 {40, 38, PT_BEZIERTO}, /* 281 */
1271 {38, 40, PT_BEZIERTO}, /* 282 */
1272 {35, 40, PT_BEZIERTO}, /* 283 */
1273 {25, 40, PT_LINETO}, /* 284 */
1274 {22, 40, PT_BEZIERTO}, /* 285 */
1275 {20, 38, PT_BEZIERTO}, /* 286 */
1276 {20, 35, PT_BEZIERTO}, /* 287 */
1277 {20, 25, PT_LINETO}, /* 288 */
1278 {20, 22, PT_BEZIERTO}, /* 289 */
1279 {22, 20, PT_BEZIERTO}, /* 290 */
1280 {25, 20, PT_BEZIERTO}, /* 291 */
1281 {35, 20, PT_LINETO}, /* 292 */
1282 {38, 20, PT_BEZIERTO}, /* 293 */
1283 {40, 22, PT_BEZIERTO}, /* 294 */
1284 {40, 25, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 295 */
1285 {55, 43, PT_MOVETO}, /* 296 */
1286 {55, 47, PT_BEZIERTO}, /* 297 */
1287 {49, 50, PT_BEZIERTO}, /* 298 */
1288 {43, 50, PT_BEZIERTO}, /* 299 */
1289 {43, 50, PT_LINETO}, /* 300 */
1290 {36, 50, PT_BEZIERTO}, /* 301 */
1291 {30, 47, PT_BEZIERTO}, /* 302 */
1292 {30, 43, PT_BEZIERTO}, /* 303 */
1293 {30, 43, PT_LINETO}, /* 304 */
1294 {30, 38, PT_BEZIERTO}, /* 305 */
1295 {36, 35, PT_BEZIERTO}, /* 306 */
1296 {43, 35, PT_BEZIERTO}, /* 307 */
1297 {43, 35, PT_LINETO}, /* 308 */
1298 {49, 35, PT_BEZIERTO}, /* 309 */
1299 {55, 38, PT_BEZIERTO}, /* 310 */
1300 {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 311 */
1301};
1302
1303static void test_roundrect(void)
1304{
1305 HDC hdc = GetDC( 0 );
1306
1307 BeginPath( hdc );
1308 RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1309 RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1310 RoundRect( hdc, 60, 60, 35, 45, 5, 2 );
1311 RoundRect( hdc, 70, 70, 50, 70, 3, 5 );
1312 RoundRect( hdc, 75, 75, 75, 85, 6, 4 );
1313 RoundRect( hdc, 80, 80, 81, 81, 8, 9 );
1314 RoundRect( hdc, 90, 90, 95, 85, 0, 7 );
1316 RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1317 RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1320 SetViewportExtEx( hdc, -2, 2, NULL );
1321 RoundRect( hdc, 20, 20, 40, 40, 15, 12 );
1322 RoundRect( hdc, 30, 50, 55, 35, 7, 9 );
1323 SetViewportExtEx( hdc, 3, -3, NULL );
1324 RoundRect( hdc, 20, 20, 40, 40, 15, 12 );
1325 RoundRect( hdc, 30, 50, 55, 35, 3, 4 );
1326 SetWindowExtEx( hdc, -20, 20, NULL );
1327 RoundRect( hdc, 20, 20, 40, 40, 2, 1 );
1328 RoundRect( hdc, 24, 22, 21, 20, 4, 4 );
1331 RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1332 RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1333 RoundRect( hdc, 60, 60, 35, 45, 5, 2 );
1334 RoundRect( hdc, 70, 70, 50, 70, 3, 5 );
1335 RoundRect( hdc, 75, 75, 75, 85, 6, 4 );
1336 RoundRect( hdc, 80, 80, 81, 81, 8, 9 );
1337 RoundRect( hdc, 90, 90, 95, 85, 0, 7 );
1339 RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1340 RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1342 EndPath( hdc );
1344 ok_path( hdc, "roundrect_path", roundrect_path, ARRAY_SIZE(roundrect_path) );
1345 ReleaseDC( 0, hdc );
1346}
1347
1349{
1350 {39, 30, PT_MOVETO}, /* 0 */
1351 {39, 24, PT_BEZIERTO}, /* 1 */
1352 {35, 20, PT_BEZIERTO}, /* 2 */
1353 {30, 20, PT_BEZIERTO}, /* 3 */
1354 {24, 20, PT_BEZIERTO}, /* 4 */
1355 {20, 24, PT_BEZIERTO}, /* 5 */
1356 {20, 30, PT_BEZIERTO}, /* 6 */
1357 {20, 35, PT_BEZIERTO}, /* 7 */
1358 {24, 39, PT_BEZIERTO}, /* 8 */
1359 {30, 39, PT_BEZIERTO}, /* 9 */
1360 {35, 39, PT_BEZIERTO}, /* 10 */
1361 {39, 35, PT_BEZIERTO}, /* 11 */
1362 {39, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 12 */
1363 {54, 42, PT_MOVETO}, /* 13 */
1364 {54, 38, PT_BEZIERTO}, /* 14 */
1365 {49, 35, PT_BEZIERTO}, /* 15 */
1366 {42, 35, PT_BEZIERTO}, /* 16 */
1367 {35, 35, PT_BEZIERTO}, /* 17 */
1368 {30, 38, PT_BEZIERTO}, /* 18 */
1369 {30, 42, PT_BEZIERTO}, /* 19 */
1370 {30, 46, PT_BEZIERTO}, /* 20 */
1371 {35, 49, PT_BEZIERTO}, /* 21 */
1372 {42, 49, PT_BEZIERTO}, /* 22 */
1373 {49, 49, PT_BEZIERTO}, /* 23 */
1374 {54, 46, PT_BEZIERTO}, /* 24 */
1375 {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 25 */
1376 {59, 52, PT_MOVETO}, /* 26 */
1377 {59, 48, PT_BEZIERTO}, /* 27 */
1378 {54, 45, PT_BEZIERTO}, /* 28 */
1379 {47, 45, PT_BEZIERTO}, /* 29 */
1380 {40, 45, PT_BEZIERTO}, /* 30 */
1381 {35, 48, PT_BEZIERTO}, /* 31 */
1382 {35, 52, PT_BEZIERTO}, /* 32 */
1383 {35, 56, PT_BEZIERTO}, /* 33 */
1384 {40, 59, PT_BEZIERTO}, /* 34 */
1385 {47, 59, PT_BEZIERTO}, /* 35 */
1386 {54, 59, PT_BEZIERTO}, /* 36 */
1387 {59, 56, PT_BEZIERTO}, /* 37 */
1388 {59, 52, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 38 */
1389 {80, 80, PT_MOVETO}, /* 39 */
1390 {80, 80, PT_BEZIERTO}, /* 40 */
1391 {80, 80, PT_BEZIERTO}, /* 41 */
1392 {80, 80, PT_BEZIERTO}, /* 42 */
1393 {80, 80, PT_BEZIERTO}, /* 43 */
1394 {80, 80, PT_BEZIERTO}, /* 44 */
1395 {80, 80, PT_BEZIERTO}, /* 45 */
1396 {80, 80, PT_BEZIERTO}, /* 46 */
1397 {80, 80, PT_BEZIERTO}, /* 47 */
1398 {80, 80, PT_BEZIERTO}, /* 48 */
1399 {80, 80, PT_BEZIERTO}, /* 49 */
1400 {80, 80, PT_BEZIERTO}, /* 50 */
1401 {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 51 */
1402 {39, 30, PT_MOVETO}, /* 52 */
1403 {39, 35, PT_BEZIERTO}, /* 53 */
1404 {35, 39, PT_BEZIERTO}, /* 54 */
1405 {30, 39, PT_BEZIERTO}, /* 55 */
1406 {24, 39, PT_BEZIERTO}, /* 56 */
1407 {20, 35, PT_BEZIERTO}, /* 57 */
1408 {20, 30, PT_BEZIERTO}, /* 58 */
1409 {20, 24, PT_BEZIERTO}, /* 59 */
1410 {24, 20, PT_BEZIERTO}, /* 60 */
1411 {30, 20, PT_BEZIERTO}, /* 61 */
1412 {35, 20, PT_BEZIERTO}, /* 62 */
1413 {39, 24, PT_BEZIERTO}, /* 63 */
1414 {39, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 64 */
1415 {54, 42, PT_MOVETO}, /* 65 */
1416 {54, 46, PT_BEZIERTO}, /* 66 */
1417 {49, 49, PT_BEZIERTO}, /* 67 */
1418 {42, 49, PT_BEZIERTO}, /* 68 */
1419 {35, 49, PT_BEZIERTO}, /* 69 */
1420 {30, 46, PT_BEZIERTO}, /* 70 */
1421 {30, 42, PT_BEZIERTO}, /* 71 */
1422 {30, 38, PT_BEZIERTO}, /* 72 */
1423 {35, 35, PT_BEZIERTO}, /* 73 */
1424 {42, 35, PT_BEZIERTO}, /* 74 */
1425 {49, 35, PT_BEZIERTO}, /* 75 */
1426 {54, 38, PT_BEZIERTO}, /* 76 */
1427 {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 77 */
1428 {59, 52, PT_MOVETO}, /* 78 */
1429 {59, 56, PT_BEZIERTO}, /* 79 */
1430 {54, 59, PT_BEZIERTO}, /* 80 */
1431 {47, 59, PT_BEZIERTO}, /* 81 */
1432 {40, 59, PT_BEZIERTO}, /* 82 */
1433 {35, 56, PT_BEZIERTO}, /* 83 */
1434 {35, 52, PT_BEZIERTO}, /* 84 */
1435 {35, 48, PT_BEZIERTO}, /* 85 */
1436 {40, 45, PT_BEZIERTO}, /* 86 */
1437 {47, 45, PT_BEZIERTO}, /* 87 */
1438 {54, 45, PT_BEZIERTO}, /* 88 */
1439 {59, 48, PT_BEZIERTO}, /* 89 */
1440 {59, 52, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 90 */
1441 {80, 80, PT_MOVETO}, /* 91 */
1442 {80, 80, PT_BEZIERTO}, /* 92 */
1443 {80, 80, PT_BEZIERTO}, /* 93 */
1444 {80, 80, PT_BEZIERTO}, /* 94 */
1445 {80, 80, PT_BEZIERTO}, /* 95 */
1446 {80, 80, PT_BEZIERTO}, /* 96 */
1447 {80, 80, PT_BEZIERTO}, /* 97 */
1448 {80, 80, PT_BEZIERTO}, /* 98 */
1449 {80, 80, PT_BEZIERTO}, /* 99 */
1450 {80, 80, PT_BEZIERTO}, /* 100 */
1451 {80, 80, PT_BEZIERTO}, /* 101 */
1452 {80, 80, PT_BEZIERTO}, /* 102 */
1453 {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 103 */
1454 {-41, 60, PT_MOVETO}, /* 104 */
1455 {-41, 49, PT_BEZIERTO}, /* 105 */
1456 {-50, 40, PT_BEZIERTO}, /* 106 */
1457 {-60, 40, PT_BEZIERTO}, /* 107 */
1458 {-71, 40, PT_BEZIERTO}, /* 108 */
1459 {-80, 49, PT_BEZIERTO}, /* 109 */
1460 {-80, 60, PT_BEZIERTO}, /* 110 */
1461 {-80, 70, PT_BEZIERTO}, /* 111 */
1462 {-71, 79, PT_BEZIERTO}, /* 112 */
1463 {-60, 79, PT_BEZIERTO}, /* 113 */
1464 {-50, 79, PT_BEZIERTO}, /* 114 */
1465 {-41, 70, PT_BEZIERTO}, /* 115 */
1466 {-41, 60, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 116 */
1467 {-61, 85, PT_MOVETO}, /* 117 */
1468 {-61, 77, PT_BEZIERTO}, /* 118 */
1469 {-72, 70, PT_BEZIERTO}, /* 119 */
1470 {-85, 70, PT_BEZIERTO}, /* 120 */
1471 {-99, 70, PT_BEZIERTO}, /* 121 */
1472 {-110, 77, PT_BEZIERTO}, /* 122 */
1473 {-110, 85, PT_BEZIERTO}, /* 123 */
1474 {-110, 93, PT_BEZIERTO}, /* 124 */
1475 {-99, 99, PT_BEZIERTO}, /* 125 */
1476 {-85, 99, PT_BEZIERTO}, /* 126 */
1477 {-72, 99, PT_BEZIERTO}, /* 127 */
1478 {-61, 93, PT_BEZIERTO}, /* 128 */
1479 {-61, 85, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 129 */
1480 {119, -90, PT_MOVETO}, /* 130 */
1481 {119, -107, PT_BEZIERTO}, /* 131 */
1482 {106, -120, PT_BEZIERTO}, /* 132 */
1483 {90, -120, PT_BEZIERTO}, /* 133 */
1484 {73, -120, PT_BEZIERTO}, /* 134 */
1485 {60, -107, PT_BEZIERTO}, /* 135 */
1486 {60, -90, PT_BEZIERTO}, /* 136 */
1487 {60, -74, PT_BEZIERTO}, /* 137 */
1488 {73, -61, PT_BEZIERTO}, /* 138 */
1489 {90, -61, PT_BEZIERTO}, /* 139 */
1490 {106, -61, PT_BEZIERTO}, /* 140 */
1491 {119, -74, PT_BEZIERTO}, /* 141 */
1492 {119, -90, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 142 */
1493 {164, -128, PT_MOVETO}, /* 143 */
1494 {164, -140, PT_BEZIERTO}, /* 144 */
1495 {147, -150, PT_BEZIERTO}, /* 145 */
1496 {127, -150, PT_BEZIERTO}, /* 146 */
1497 {107, -150, PT_BEZIERTO}, /* 147 */
1498 {90, -140, PT_BEZIERTO}, /* 148 */
1499 {90, -128, PT_BEZIERTO}, /* 149 */
1500 {90, -116, PT_BEZIERTO}, /* 150 */
1501 {107, -106, PT_BEZIERTO}, /* 151 */
1502 {127, -106, PT_BEZIERTO}, /* 152 */
1503 {147, -106, PT_BEZIERTO}, /* 153 */
1504 {164, -116, PT_BEZIERTO}, /* 154 */
1505 {164, -128, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 155 */
1506 {-4, -5, PT_MOVETO}, /* 156 */
1507 {-4, -5, PT_BEZIERTO}, /* 157 */
1508 {-4, -6, PT_BEZIERTO}, /* 158 */
1509 {-5, -6, PT_BEZIERTO}, /* 159 */
1510 {-6, -6, PT_BEZIERTO}, /* 160 */
1511 {-6, -5, PT_BEZIERTO}, /* 161 */
1512 {-6, -5, PT_BEZIERTO}, /* 162 */
1513 {-6, -4, PT_BEZIERTO}, /* 163 */
1514 {-6, -4, PT_BEZIERTO}, /* 164 */
1515 {-5, -4, PT_BEZIERTO}, /* 165 */
1516 {-4, -4, PT_BEZIERTO}, /* 166 */
1517 {-4, -4, PT_BEZIERTO}, /* 167 */
1518 {-4, -5, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 168 */
1519 {40, 30, PT_MOVETO}, /* 169 */
1520 {40, 25, PT_BEZIERTO}, /* 170 */
1521 {36, 20, PT_BEZIERTO}, /* 171 */
1522 {30, 20, PT_BEZIERTO}, /* 172 */
1523 {24, 20, PT_BEZIERTO}, /* 173 */
1524 {20, 25, PT_BEZIERTO}, /* 174 */
1525 {20, 30, PT_BEZIERTO}, /* 175 */
1526 {20, 36, PT_BEZIERTO}, /* 176 */
1527 {24, 40, PT_BEZIERTO}, /* 177 */
1528 {30, 40, PT_BEZIERTO}, /* 178 */
1529 {36, 40, PT_BEZIERTO}, /* 179 */
1530 {40, 36, PT_BEZIERTO}, /* 180 */
1531 {40, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 181 */
1532 {55, 43, PT_MOVETO}, /* 182 */
1533 {55, 38, PT_BEZIERTO}, /* 183 */
1534 {49, 35, PT_BEZIERTO}, /* 184 */
1535 {43, 35, PT_BEZIERTO}, /* 185 */
1536 {36, 35, PT_BEZIERTO}, /* 186 */
1537 {30, 38, PT_BEZIERTO}, /* 187 */
1538 {30, 43, PT_BEZIERTO}, /* 188 */
1539 {30, 47, PT_BEZIERTO}, /* 189 */
1540 {36, 50, PT_BEZIERTO}, /* 190 */
1541 {43, 50, PT_BEZIERTO}, /* 191 */
1542 {49, 50, PT_BEZIERTO}, /* 192 */
1543 {55, 47, PT_BEZIERTO}, /* 193 */
1544 {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 194 */
1545 {60, 53, PT_MOVETO}, /* 195 */
1546 {60, 48, PT_BEZIERTO}, /* 196 */
1547 {54, 45, PT_BEZIERTO}, /* 197 */
1548 {48, 45, PT_BEZIERTO}, /* 198 */
1549 {41, 45, PT_BEZIERTO}, /* 199 */
1550 {35, 48, PT_BEZIERTO}, /* 200 */
1551 {35, 53, PT_BEZIERTO}, /* 201 */
1552 {35, 57, PT_BEZIERTO}, /* 202 */
1553 {41, 60, PT_BEZIERTO}, /* 203 */
1554 {48, 60, PT_BEZIERTO}, /* 204 */
1555 {54, 60, PT_BEZIERTO}, /* 205 */
1556 {60, 57, PT_BEZIERTO}, /* 206 */
1557 {60, 53, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 207 */
1558 {70, 70, PT_MOVETO}, /* 208 */
1559 {70, 70, PT_BEZIERTO}, /* 209 */
1560 {66, 70, PT_BEZIERTO}, /* 210 */
1561 {60, 70, PT_BEZIERTO}, /* 211 */
1562 {54, 70, PT_BEZIERTO}, /* 212 */
1563 {50, 70, PT_BEZIERTO}, /* 213 */
1564 {50, 70, PT_BEZIERTO}, /* 214 */
1565 {50, 70, PT_BEZIERTO}, /* 215 */
1566 {54, 70, PT_BEZIERTO}, /* 216 */
1567 {60, 70, PT_BEZIERTO}, /* 217 */
1568 {66, 70, PT_BEZIERTO}, /* 218 */
1569 {70, 70, PT_BEZIERTO}, /* 219 */
1570 {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 220 */
1571 {75, 80, PT_MOVETO}, /* 221 */
1572 {75, 77, PT_BEZIERTO}, /* 222 */
1573 {75, 75, PT_BEZIERTO}, /* 223 */
1574 {75, 75, PT_BEZIERTO}, /* 224 */
1575 {75, 75, PT_BEZIERTO}, /* 225 */
1576 {75, 77, PT_BEZIERTO}, /* 226 */
1577 {75, 80, PT_BEZIERTO}, /* 227 */
1578 {75, 83, PT_BEZIERTO}, /* 228 */
1579 {75, 85, PT_BEZIERTO}, /* 229 */
1580 {75, 85, PT_BEZIERTO}, /* 230 */
1581 {75, 85, PT_BEZIERTO}, /* 231 */
1582 {75, 83, PT_BEZIERTO}, /* 232 */
1583 {75, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 233 */
1584 {81, 81, PT_MOVETO}, /* 234 */
1585 {81, 80, PT_BEZIERTO}, /* 235 */
1586 {81, 80, PT_BEZIERTO}, /* 236 */
1587 {81, 80, PT_BEZIERTO}, /* 237 */
1588 {80, 80, PT_BEZIERTO}, /* 238 */
1589 {80, 80, PT_BEZIERTO}, /* 239 */
1590 {80, 81, PT_BEZIERTO}, /* 240 */
1591 {80, 81, PT_BEZIERTO}, /* 241 */
1592 {80, 81, PT_BEZIERTO}, /* 242 */
1593 {81, 81, PT_BEZIERTO}, /* 243 */
1594 {81, 81, PT_BEZIERTO}, /* 244 */
1595 {81, 81, PT_BEZIERTO}, /* 245 */
1596 {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 246 */
1597 {40, 30, PT_MOVETO}, /* 247 */
1598 {40, 36, PT_BEZIERTO}, /* 248 */
1599 {36, 40, PT_BEZIERTO}, /* 249 */
1600 {30, 40, PT_BEZIERTO}, /* 250 */
1601 {24, 40, PT_BEZIERTO}, /* 251 */
1602 {20, 36, PT_BEZIERTO}, /* 252 */
1603 {20, 30, PT_BEZIERTO}, /* 253 */
1604 {20, 24, PT_BEZIERTO}, /* 254 */
1605 {24, 20, PT_BEZIERTO}, /* 255 */
1606 {30, 20, PT_BEZIERTO}, /* 256 */
1607 {36, 20, PT_BEZIERTO}, /* 257 */
1608 {40, 24, PT_BEZIERTO}, /* 258 */
1609 {40, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 259 */
1610 {55, 43, PT_MOVETO}, /* 260 */
1611 {55, 47, PT_BEZIERTO}, /* 261 */
1612 {49, 50, PT_BEZIERTO}, /* 262 */
1613 {43, 50, PT_BEZIERTO}, /* 263 */
1614 {36, 50, PT_BEZIERTO}, /* 264 */
1615 {30, 47, PT_BEZIERTO}, /* 265 */
1616 {30, 43, PT_BEZIERTO}, /* 266 */
1617 {30, 38, PT_BEZIERTO}, /* 267 */
1618 {36, 35, PT_BEZIERTO}, /* 268 */
1619 {43, 35, PT_BEZIERTO}, /* 269 */
1620 {49, 35, PT_BEZIERTO}, /* 270 */
1621 {55, 38, PT_BEZIERTO}, /* 271 */
1622 {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 272 */
1623 {60, 53, PT_MOVETO}, /* 273 */
1624 {60, 57, PT_BEZIERTO}, /* 274 */
1625 {54, 60, PT_BEZIERTO}, /* 275 */
1626 {48, 60, PT_BEZIERTO}, /* 276 */
1627 {41, 60, PT_BEZIERTO}, /* 277 */
1628 {35, 57, PT_BEZIERTO}, /* 278 */
1629 {35, 53, PT_BEZIERTO}, /* 279 */
1630 {35, 48, PT_BEZIERTO}, /* 280 */
1631 {41, 45, PT_BEZIERTO}, /* 281 */
1632 {48, 45, PT_BEZIERTO}, /* 282 */
1633 {54, 45, PT_BEZIERTO}, /* 283 */
1634 {60, 48, PT_BEZIERTO}, /* 284 */
1635 {60, 53, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 285 */
1636 {70, 70, PT_MOVETO}, /* 286 */
1637 {70, 70, PT_BEZIERTO}, /* 287 */
1638 {66, 70, PT_BEZIERTO}, /* 288 */
1639 {60, 70, PT_BEZIERTO}, /* 289 */
1640 {54, 70, PT_BEZIERTO}, /* 290 */
1641 {50, 70, PT_BEZIERTO}, /* 291 */
1642 {50, 70, PT_BEZIERTO}, /* 292 */
1643 {50, 70, PT_BEZIERTO}, /* 293 */
1644 {54, 70, PT_BEZIERTO}, /* 294 */
1645 {60, 70, PT_BEZIERTO}, /* 295 */
1646 {66, 70, PT_BEZIERTO}, /* 296 */
1647 {70, 70, PT_BEZIERTO}, /* 297 */
1648 {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 298 */
1649 {75, 80, PT_MOVETO}, /* 299 */
1650 {75, 83, PT_BEZIERTO}, /* 300 */
1651 {75, 85, PT_BEZIERTO}, /* 301 */
1652 {75, 85, PT_BEZIERTO}, /* 302 */
1653 {75, 85, PT_BEZIERTO}, /* 303 */
1654 {75, 83, PT_BEZIERTO}, /* 304 */
1655 {75, 80, PT_BEZIERTO}, /* 305 */
1656 {75, 77, PT_BEZIERTO}, /* 306 */
1657 {75, 75, PT_BEZIERTO}, /* 307 */
1658 {75, 75, PT_BEZIERTO}, /* 308 */
1659 {75, 75, PT_BEZIERTO}, /* 309 */
1660 {75, 77, PT_BEZIERTO}, /* 310 */
1661 {75, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 311 */
1662 {81, 81, PT_MOVETO}, /* 312 */
1663 {81, 81, PT_BEZIERTO}, /* 313 */
1664 {81, 81, PT_BEZIERTO}, /* 314 */
1665 {81, 81, PT_BEZIERTO}, /* 315 */
1666 {80, 81, PT_BEZIERTO}, /* 316 */
1667 {80, 81, PT_BEZIERTO}, /* 317 */
1668 {80, 81, PT_BEZIERTO}, /* 318 */
1669 {80, 80, PT_BEZIERTO}, /* 319 */
1670 {80, 80, PT_BEZIERTO}, /* 320 */
1671 {81, 80, PT_BEZIERTO}, /* 321 */
1672 {81, 80, PT_BEZIERTO}, /* 322 */
1673 {81, 80, PT_BEZIERTO}, /* 323 */
1674 {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 324 */
1675};
1676
1677static void test_ellipse(void)
1678{
1679 HDC hdc = GetDC( 0 );
1680
1681 BeginPath( hdc );
1682 Ellipse( hdc, 20, 20, 40, 40 );
1683 Ellipse( hdc, 30, 50, 55, 35 );
1684 Ellipse( hdc, 60, 60, 35, 45 );
1685 Ellipse( hdc, 70, 70, 50, 70 );
1686 Ellipse( hdc, 75, 75, 75, 85 );
1687 Ellipse( hdc, 80, 80, 81, 81 );
1689 Ellipse( hdc, 20, 20, 40, 40 );
1690 Ellipse( hdc, 30, 50, 55, 35 );
1691 Ellipse( hdc, 60, 60, 35, 45 );
1692 Ellipse( hdc, 70, 70, 50, 70 );
1693 Ellipse( hdc, 75, 75, 75, 85 );
1694 Ellipse( hdc, 80, 80, 81, 81 );
1697 SetViewportExtEx( hdc, -2, 2, NULL );
1698 Ellipse( hdc, 20, 20, 40, 40 );
1699 Ellipse( hdc, 30, 50, 55, 35 );
1700 SetViewportExtEx( hdc, 3, -3, NULL );
1701 Ellipse( hdc, 20, 20, 40, 40 );
1702 Ellipse( hdc, 30, 50, 55, 35 );
1703 SetWindowExtEx( hdc, -20, 20, NULL );
1704 Ellipse( hdc, 20, 20, 40, 40 );
1705 Ellipse( hdc, 24, 22, 21, 20 );
1708 Ellipse( hdc, 20, 20, 40, 40 );
1709 Ellipse( hdc, 30, 50, 55, 35 );
1710 Ellipse( hdc, 60, 60, 35, 45 );
1711 Ellipse( hdc, 70, 70, 50, 70 );
1712 Ellipse( hdc, 75, 75, 75, 85 );
1713 Ellipse( hdc, 80, 80, 81, 81 );
1715 Ellipse( hdc, 20, 20, 40, 40 );
1716 Ellipse( hdc, 30, 50, 55, 35 );
1717 Ellipse( hdc, 60, 60, 35, 45 );
1718 Ellipse( hdc, 70, 70, 50, 70 );
1719 Ellipse( hdc, 75, 75, 75, 85 );
1720 Ellipse( hdc, 80, 80, 81, 81 );
1722 EndPath( hdc );
1724 ok_path( hdc, "ellipse_path", ellipse_path, ARRAY_SIZE(ellipse_path) );
1725}
1726
1728{
1729 {0, 0, PT_MOVETO}, /* 0 */
1730 {50, 150, PT_LINETO}, /* 1 */
1731 {50, 50, PT_MOVETO}, /* 2 */
1732 {150, 150, PT_LINETO}, /* 3 */
1733 {150, 50, PT_LINETO}, /* 4 */
1734 {50, 50, PT_LINETO}, /* 5 */
1735 {37, 13, PT_LINETO}, /* 6 */
1736 {24, 13, PT_BEZIERTO}, /* 7 */
1737 {14, 23, PT_BEZIERTO}, /* 8 */
1738 {14, 36, PT_BEZIERTO}, /* 9 */
1739 {14, 49, PT_BEZIERTO}, /* 10 */
1740 {24, 59, PT_BEZIERTO}, /* 11 */
1741 {37, 59, PT_BEZIERTO}, /* 12 */
1742 {37, 59, PT_BEZIERTO}, /* 13 */
1743 {37, 59, PT_BEZIERTO}, /* 14 */
1744 {37, 59, PT_BEZIERTO}, /* 15 */
1745 {10, 10, PT_MOVETO}, /* 16 */
1746 {20, 10, PT_LINETO}, /* 17 */
1747 {10, 20, PT_LINETO}, /* 18 */
1748 {20, 20, PT_LINETO}, /* 19 */
1749 {36, 27, PT_MOVETO}, /* 20 */
1750 {37, 26, PT_BEZIERTO}, /* 21 */
1751 {38, 25, PT_BEZIERTO}, /* 22 */
1752 {38, 25, PT_BEZIERTO}, /* 23 */
1753 {38, 23, PT_BEZIERTO}, /* 24 */
1754 {34, 21, PT_BEZIERTO}, /* 25 */
1755 {30, 21, PT_BEZIERTO}, /* 26 */
1756 {27, 21, PT_BEZIERTO}, /* 27 */
1757 {25, 21, PT_BEZIERTO}, /* 28 */
1758 {24, 22, PT_BEZIERTO}, /* 29 */
1759 {37, 59, PT_MOVETO}, /* 30 */
1760 {10, 10, PT_LINETO}, /* 31 */
1761 {20, 10, PT_LINETO}, /* 32 */
1762 {10, 20, PT_LINETO}, /* 33 */
1763 {20, 20, PT_LINETO}, /* 34 */
1764 {34, 26, PT_LINETO}, /* 35 */
1765 {35, 25, PT_BEZIERTO}, /* 36 */
1766 {36, 25, PT_BEZIERTO}, /* 37 */
1767 {36, 25, PT_BEZIERTO}, /* 38 */
1768 {36, 24, PT_BEZIERTO}, /* 39 */
1769 {33, 23, PT_BEZIERTO}, /* 40 */
1770 {30, 23, PT_BEZIERTO}, /* 41 */
1771 {28, 23, PT_BEZIERTO}, /* 42 */
1772 {26, 23, PT_BEZIERTO}, /* 43 */
1773 {25, 23, PT_BEZIERTO}, /* 44 */
1774 {10, 10, PT_MOVETO}, /* 45 */
1775 {20, 10, PT_LINETO}, /* 46 */
1776 {10, 20, PT_LINETO}, /* 47 */
1777 {20, 20, PT_LINETO}, /* 48 */
1778 {30, 30, PT_MOVETO}, /* 49 */
1779 {40, 20, PT_LINETO}, /* 50 */
1780 {20, 30, PT_LINETO}, /* 51 */
1781 {30, 40, PT_LINETO}, /* 52 */
1782 {10, 50, PT_LINETO}, /* 53 */
1783 {45, 45, PT_MOVETO}, /* 54 */
1784 {45, 45, PT_BEZIERTO}, /* 55 */
1785 {44, 46, PT_BEZIERTO}, /* 56 */
1786 {43, 47, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 57 */
1787 {10, 10, PT_MOVETO}, /* 58 */
1788 {20, 10, PT_LINETO}, /* 59 */
1789 {10, 20, PT_BEZIERTO}, /* 60 */
1790 {20, 20, PT_BEZIERTO}, /* 61 */
1791 {30, 30, PT_BEZIERTO}, /* 62 */
1792 {40, 20, PT_LINETO}, /* 63 */
1793 {20, 30, PT_LINETO | PT_CLOSEFIGURE}, /* 64 */
1794 {30, 40, PT_MOVETO}, /* 65 */
1795 {10, 50, PT_LINETO}, /* 66 */
1796 {55, 55, PT_MOVETO}, /* 67 */
1797 {54, 55, PT_BEZIERTO}, /* 68 */
1798 {54, 56, PT_BEZIERTO}, /* 69 */
1799 {54, 56, PT_BEZIERTO}, /* 70 */
1800 {58, 61, PT_LINETO | PT_CLOSEFIGURE}, /* 71 */
1801 {10, 10, PT_MOVETO}, /* 72 */
1802 {20, 10, PT_LINETO}, /* 73 */
1803 {10, 20, PT_LINETO}, /* 74 */
1804 {20, 20, PT_LINETO}, /* 75 */
1805 {30, 30, PT_LINETO}, /* 76 */
1806 {40, 20, PT_LINETO}, /* 77 */
1807 {20, 30, PT_LINETO}, /* 78 */
1808 {30, 40, PT_LINETO}, /* 79 */
1809 {10, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 80 */
1810 {43, 49, PT_MOVETO}, /* 81 */
1811 {43, 40, PT_BEZIERTO}, /* 82 */
1812 {38, 33, PT_BEZIERTO}, /* 83 */
1813 {33, 33, PT_BEZIERTO}, /* 84 */
1814 {27, 33, PT_BEZIERTO}, /* 85 */
1815 {22, 40, PT_BEZIERTO}, /* 86 */
1816 {22, 49, PT_BEZIERTO}, /* 87 */
1817 {22, 58, PT_BEZIERTO}, /* 88 */
1818 {27, 65, PT_BEZIERTO}, /* 89 */
1819 {33, 65, PT_BEZIERTO}, /* 90 */
1820 {38, 65, PT_BEZIERTO}, /* 91 */
1821 {43, 58, PT_BEZIERTO}, /* 92 */
1822 {43, 49, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 93 */
1823 {79, 70, PT_MOVETO}, /* 94 */
1824 {60, 70, PT_LINETO}, /* 95 */
1825 {60, 89, PT_LINETO}, /* 96 */
1826 {79, 89, PT_LINETO | PT_CLOSEFIGURE}, /* 97 */
1827 {199, 122, PT_MOVETO}, /* 98 */
1828 {199, 110, PT_BEZIERTO}, /* 99 */
1829 {191, 100, PT_BEZIERTO}, /* 100 */
1830 {182, 100, PT_BEZIERTO}, /* 101 */
1831 {117, 100, PT_LINETO}, /* 102 */
1832 {108, 100, PT_BEZIERTO}, /* 103 */
1833 {100, 110, PT_BEZIERTO}, /* 104 */
1834 {100, 122, PT_BEZIERTO}, /* 105 */
1835 {100, 177, PT_LINETO}, /* 106 */
1836 {100, 189, PT_BEZIERTO}, /* 107 */
1837 {108, 199, PT_BEZIERTO}, /* 108 */
1838 {117, 199, PT_BEZIERTO}, /* 109 */
1839 {182, 199, PT_LINETO}, /* 110 */
1840 {191, 199, PT_BEZIERTO}, /* 111 */
1841 {199, 189, PT_BEZIERTO}, /* 112 */
1842 {199, 177, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 113 */
1843 {10, 10, PT_MOVETO}, /* 114 */
1844 {20, 10, PT_BEZIERTO}, /* 115 */
1845 {10, 20, PT_BEZIERTO}, /* 116 */
1846 {20, 20, PT_BEZIERTO}, /* 117 */
1847 {30, 30, PT_BEZIERTO}, /* 118 */
1848 {40, 20, PT_BEZIERTO}, /* 119 */
1849 {20, 30, PT_BEZIERTO}, /* 120 */
1850 {10, 10, PT_MOVETO}, /* 121 */
1851 {20, 10, PT_LINETO}, /* 122 */
1852 {10, 20, PT_LINETO}, /* 123 */
1853 {20, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 124 */
1854 {30, 30, PT_MOVETO}, /* 125 */
1855 {40, 20, PT_LINETO}, /* 126 */
1856 {20, 30, PT_LINETO}, /* 127 */
1857 {30, 40, PT_LINETO}, /* 128 */
1858 {10, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 129 */
1859 {10, 50, PT_MOVETO}, /* 130 */
1860 {10, 10, PT_BEZIERTO}, /* 131 */
1861 {20, 10, PT_BEZIERTO}, /* 132 */
1862 {10, 20, PT_BEZIERTO}, /* 133 */
1863 {20, 20, PT_BEZIERTO}, /* 134 */
1864 {30, 30, PT_BEZIERTO}, /* 135 */
1865 {40, 20, PT_BEZIERTO}, /* 136 */
1866 {20, 30, PT_BEZIERTO}, /* 137 */
1867 {30, 40, PT_BEZIERTO}, /* 138 */
1868 {10, 50, PT_BEZIERTO}, /* 139 */
1869 {150, 150, PT_LINETO}, /* 140 */
1870};
1871
1872/* run once through all functions that support paths */
1873static void test_all_functions(void)
1874{
1875 POINT pts[9] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}, {30, 30}, {40, 20},
1876 {20, 30}, {30, 40}, {10, 50}};
1877 DWORD counts[5] = {4, 5, 0, 1, 2};
1880 HDC hdc = GetDC( 0 );
1881
1882 BeginPath( hdc );
1883 LineTo( hdc, 50, 150 );
1884 MoveToEx( hdc, 50, 50, NULL );
1885 LineTo( hdc, 150, 150 );
1886 LineTo( hdc, 150, 50 );
1887 LineTo( hdc, 50, 50 );
1888 AngleArc( hdc, 37, 36, 23, 90, 180 );
1889 Polyline( hdc, pts, 4 );
1890 Arc( hdc, 21, 21, 39, 29, 39, 29, 21, 21 );
1891 PolylineTo( hdc, pts, 4 );
1892 ArcTo( hdc, 23, 23, 37, 27, 37, 27, 23, 23 );
1893 PolyPolyline( hdc, pts, counts, 2 );
1894 Chord( hdc, 42, 43, 57, 66, 39, 29, 21, 21 );
1895 PolyDraw( hdc, pts, types, 9 );
1896 Pie( hdc, 52, 54, 65, 68, 39, 29, 21, 21 );
1897 Polygon( hdc, pts, 9 );
1898 Ellipse( hdc, 22, 33, 44, 66 );
1899 Rectangle( hdc, 60, 70, 80, 90 );
1900 RoundRect( hdc, 100, 100, 200, 200, 35, 45 );
1901 PolyBezier( hdc, pts, 7 );
1902 PolyPolygon( hdc, pts, (int *)counts, 2 );
1903 PolyBezierTo( hdc, pts, 9 );
1904 LineTo( hdc, 150, 150 );
1905 /* FIXME: ExtTextOut */
1906 EndPath( hdc );
1907 ok_path( hdc, "all_funcs_path", all_funcs_path, ARRAY_SIZE(all_funcs_path) );
1908 ReleaseDC( 0, hdc );
1909}
1910
1912{
1913 const POINT pts[3] = {{-10, -10}, {10, -5}, {0, 10}};
1914 HBRUSH brush, oldbrush;
1915 HBITMAP bmp, oldbmp;
1916 HDC hdc, memdc;
1917 COLORREF col;
1918
1919 hdc = GetDC( 0 );
1920 memdc = CreateCompatibleDC( hdc );
1921 bmp = CreateCompatibleBitmap( hdc, 20, 20 );
1922 brush = CreateSolidBrush( RGB( 0x11, 0x22, 0x33 ) );
1923 oldbrush = SelectObject( memdc, brush );
1924 oldbmp = SelectObject( memdc, bmp );
1925 Polygon( memdc, pts, ARRAY_SIZE(pts) );
1926 col = GetPixel( memdc, 1, 1 );
1927 ok( col == RGB( 0x11, 0x22, 0x33 ), "got %06lx\n", col );
1928 SelectObject( memdc, oldbrush );
1929 SelectObject( memdc, oldbmp );
1930 DeleteObject( brush );
1931 DeleteObject( bmp );
1932 DeleteDC( memdc );
1933 ReleaseDC( 0, hdc );
1934}
1935
1937{
1940 test_arcto();
1941 test_anglearc();
1942 test_polydraw();
1944 test_linedda();
1947 test_ellipse();
1950}
@ lparam
Definition: SystemMenu.c:31
#define ok(value,...)
Definition: atltest.h:57
#define broken(x)
Definition: atltest.h:178
#define START_TEST(x)
Definition: atltest.h:75
#define ARRAY_SIZE(A)
Definition: main.h:20
DWORD GetPixel(LPDIRECTDRAWSURFACE7 Surface, UINT x, UINT y)
Definition: blt.cpp:2
Definition: arc.h:55
#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
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:102
#define SetLastError(x)
Definition: compat.h:752
#define assert(_expr)
Definition: assert.h:32
#define pt(x, y)
Definition: drawing.c:79
#define RGB(r, g, b)
Definition: precomp.h:67
ULONG RGBQUAD
Definition: precomp.h:47
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
#define printf
Definition: freeldr.h:103
static char * path_name(DOS_FILE *file)
Definition: check.c:208
pKey DeleteObject()
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
GLuint buffer
Definition: glext.h:5915
GLsizeiptr size
Definition: glext.h:5919
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
#define bits
Definition: infblock.c:15
int winetest_debug
#define win_skip
Definition: minitest.h:67
LONG_PTR LPARAM
Definition: minwindef.h:175
BITMAP bmp
Definition: alphablend.c:62
HDC hdc
Definition: main.c:9
static HBITMAP
Definition: button.c:44
static HDC
Definition: imagelist.c:88
BOOL expected
Definition: store.c:2000
static void test_arcto(void)
Definition: path.c:480
static void test_widenpath(void)
Definition: path.c:311
static void test_all_functions(void)
Definition: path.c:1873
static void WINAPI linedda_callback(INT x, INT y, LPARAM lparam)
Definition: path.c:751
static void test_ellipse(void)
Definition: path.c:1677
static void test_clipped_polygon_fill(void)
Definition: path.c:1911
static const path_test_t roundrect_path[]
Definition: path.c:987
static const path_test_t arcto_path[]
Definition: path.c:455
static void test_path_state(void)
Definition: path.c:36
static void test_rectangle(void)
Definition: path.c:936
static const path_test_t all_funcs_path[]
Definition: path.c:1727
static const path_test_t anglearc_path[]
Definition: path.c:503
#define expect(expected, got)
Definition: path.c:34
static POINT polydraw_pts[]
Definition: path.c:583
static void test_closefigure(void)
Definition: path.c:705
static const path_test_t ellipse_path[]
Definition: path.c:1348
static void ok_path(HDC hdc, const char *path_name, const path_test_t *expected, int expected_size)
Definition: path.c:401
static void test_roundrect(void)
Definition: path.c:1303
static const path_test_t rectangle_path[]
Definition: path.c:832
static void test_linedda(void)
Definition: path.c:761
static void test_polydraw(void)
Definition: path.c:605
static BYTE polydraw_tps[]
Definition: path.c:594
static const path_test_t polydraw_path[]
Definition: path.c:548
static void test_anglearc(void)
Definition: path.c:528
#define min(a, b)
Definition: monoChain.cc:55
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
#define memset(x, y, z)
Definition: compat.h:39
int x
Definition: path.c:382
BYTE type
Definition: path.c:383
USHORT biBitCount
Definition: precomp.h:34
ULONG biCompression
Definition: precomp.h:35
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1922
long y
Definition: polytest.cpp:48
long x
Definition: polytest.cpp:48
Definition: cmds.c:130
int32_t INT
Definition: typedefs.h:58
#define BI_RGB
Definition: uefivid.c:46
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:245
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:1834
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
DWORD COLORREF
Definition: windef.h:100
#define WINAPI
Definition: msvc.h:6
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:906
int WINAPI SetMapMode(_In_ HDC, _In_ int)
BOOL WINAPI ArcTo(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom, _In_ INT xRadial1, _In_ INT yRadial1, _In_ INT xRadial2, _In_ INT yRadial2)
Definition: arc.c:79
#define DIB_RGB_COLORS
Definition: wingdi.h:367
BOOL WINAPI Chord(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom, _In_ INT xRadial1, _In_ INT yRadial1, _In_ INT xRadial2, _In_ INT yRadial2)
Definition: arc.c:119
BOOL WINAPI PolyBezier(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:263
BOOL WINAPI Polyline(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ int cpt)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI PolylineTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:397
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1233
#define GM_ADVANCED
Definition: wingdi.h:865
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465
BOOL WINAPI GetCurrentPositionEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:241
BOOL WINAPI PolyBezierTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:281
BOOL WINAPI LineDDA(_In_ int, _In_ int, _In_ int, _In_ int, _In_ LINEDDAPROC, _In_opt_ LPARAM)
int WINAPI SetArcDirection(_In_ HDC, _In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
BOOL WINAPI SelectClipPath(_In_ HDC, _In_ int)
BOOL WINAPI FlattenPath(_In_ HDC)
#define MM_ANISOTROPIC
Definition: wingdi.h:867
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI FillPath(_In_ HDC)
#define PT_LINETO
Definition: wingdi.h:885
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
HRGN WINAPI PathToRegion(_In_ HDC)
BOOL WINAPI StrokePath(_In_ HDC)
#define RGN_OR
Definition: wingdi.h:359
#define PT_CLOSEFIGURE
Definition: wingdi.h:887
#define AD_COUNTERCLOCKWISE
Definition: wingdi.h:667
#define MM_TEXT
Definition: wingdi.h:873
#define PT_MOVETO
Definition: wingdi.h:884
BOOL WINAPI StrokeAndFillPath(_In_ HDC)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
#define PT_BEZIERTO
Definition: wingdi.h:886
BOOL WINAPI WidenPath(_In_ HDC)
struct tagBITMAPINFO BITMAPINFO
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI RoundRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI PolyDraw(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_reads_(cpt) const BYTE *aj, _In_ int cpt)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI PolyPolygon(_In_ HDC hdc, _In_ const POINT *apt, _In_reads_(csz) const INT *asz, _In_ int csz)
#define AD_CLOCKWISE
Definition: wingdi.h:668
BOOL WINAPI EndPath(_In_ HDC)
BOOL WINAPI AngleArc(_In_ HDC hdc, _In_ INT x, _In_ INT y, _In_ DWORD dwRadius, _In_ FLOAT eStartAngle, _In_ FLOAT eSweepAngle)
Definition: arc.c:49
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
BOOL WINAPI BeginPath(_In_ HDC hdc)
#define PS_SOLID
Definition: wingdi.h:586
BOOL WINAPI PolyPolyline(_In_ HDC hdc, _In_ const POINT *apt, _In_reads_(csz) const DWORD *asz, _In_ DWORD csz)
int WINAPI SaveDC(_In_ HDC)
BOOL WINAPI CloseFigure(_In_ HDC hdc)
int WINAPI GetPath(_In_ HDC hdc, _Out_writes_opt_(cpt) LPPOINT apt, _Out_writes_opt_(cpt) LPBYTE aj, int cpt)
BOOL WINAPI AbortPath(_In_ HDC hdc)
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CreateWindowA(a, b, c, d, e, f, g, h, i, j, k)
Definition: winuser.h:4469
BOOL WINAPI SetWindowPos(_In_ HWND, _In_opt_ HWND, _In_ int, _In_ int, _In_ int, _In_ int, _In_ UINT)
#define SWP_NOMOVE
Definition: winuser.h:1255
#define SWP_SHOWWINDOW
Definition: winuser.h:1259
HDC WINAPI GetDC(_In_opt_ HWND)
#define SWP_NOZORDER
Definition: winuser.h:1258
BOOL WINAPI DestroyWindow(_In_ HWND)
unsigned char BYTE
Definition: xxhash.c:193