ReactOS  0.4.14-dev-49-gfb4591c
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 
36 static void test_path_state(void)
37 {
38  BYTE buffer[sizeof(BITMAPINFO) + 256 * sizeof(RGBQUAD)];
39  BITMAPINFO *bi = (BITMAPINFO *)buffer;
40  HDC hdc;
41  HRGN rgn;
42  HBITMAP orig, dib;
43  void *bits;
44  BOOL ret;
45 
46  hdc = CreateCompatibleDC( 0 );
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, (void**)&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 %u\n", GetLastError() );
73  ret = WidenPath( hdc );
74  ok( ret, "WidenPath failed error %u\n", GetLastError() );
75 
76  SelectObject( hdc, orig );
77  ret = WidenPath( hdc );
78  ok( ret, "WidenPath failed error %u\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 %u\n", GetLastError() );
88  ret = WidenPath( hdc );
89  ok( ret, "WidenPath failed error %u\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 %u\n", GetLastError() );
97 
98  SaveDC( hdc );
99  BeginPath( hdc );
100  RestoreDC( hdc, -1 );
101  ret = WidenPath( hdc );
102  ok( ret, "WidenPath failed error %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\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 %u\n", GetLastError() );
306 
307  DeleteDC( hdc );
308  DeleteObject( dib );
309 }
310 
311 static 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 %u\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: %d\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 
380 typedef struct
381 {
382  int x, y;
384 } path_test_t;
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  */
401 static 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 %d\n", size, GetLastError());
414  if (size <= 0) return;
415 
416  pnt = HeapAlloc(GetProcessHeap(), 0, size*sizeof(POINT));
417  assert(pnt != 0);
418  types = HeapAlloc(GetProcessHeap(), 0, size*sizeof(BYTE));
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 (%d,%d)\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 (%d,%d)\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(" {%d, %d, %s}, /* %d */\n", pnt[idx].x, pnt[idx].y, type_string[types[idx]], idx);
448  printf("};\n" );
449  }
450 
452  HeapFree(GetProcessHeap(), 0, pnt);
453 }
454 
455 static 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 
480 static 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);
495  CloseFigure(hdc);
496  EndPath(hdc);
497 
498  ok_path(hdc, "arcto_path", arcto_path, sizeof(arcto_path)/sizeof(path_test_t));
499 done:
500  ReleaseDC(0, hdc);
501 }
502 
503 static const path_test_t anglearc_path[] =
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 
528 static 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);
540  CloseFigure(hdc);
541  EndPath(hdc);
542 
543  ok_path(hdc, "anglearc_path", anglearc_path, sizeof(anglearc_path)/sizeof(path_test_t));
544 done:
545  ReleaseDC(0, hdc);
546 }
547 
548 static const path_test_t polydraw_path[] =
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 
583 static 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 
594 static BYTE polydraw_tps[] =
595  {PT_LINETO, PT_CLOSEFIGURE | PT_LINETO, /* 2 */
597  PT_MOVETO, PT_LINETO, /* 8 */
600  PT_LINETO, PT_MOVETO | PT_CLOSEFIGURE, /* 17 */
602  PT_LINETO, PT_MOVETO | PT_LINETO, PT_LINETO, /* 23 */
604 
605 static void test_polydraw(void)
606 {
607  BOOL retb;
608  POINT pos;
609  HDC hdc = GetDC(0);
610 
611  MoveToEx( hdc, -20, -20, NULL );
612 
613  BeginPath(hdc);
615  ok( pos.x == -20 && pos.y == -20, "wrong pos %d,%d\n", pos.x, pos.y );
616 
617  /* closefigure with no previous moveto */
618  if (!(retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2)) &&
620  {
621  /* PolyDraw is only available on Win2k and later */
622  win_skip("PolyDraw is not available\n");
623  goto done;
624  }
625  expect(TRUE, retb);
627  ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
628  LineTo(hdc, -10, -10);
630  ok( pos.x == -10 && pos.y == -10, "wrong pos %d,%d\n", pos.x, pos.y );
631 
632  MoveToEx(hdc, 100, 100, NULL);
634  ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y );
635  LineTo(hdc, 95, 95);
637  ok( pos.x == 95 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
638  /* closefigure with previous moveto */
639  retb = PolyDraw(hdc, polydraw_pts, polydraw_tps, 2);
640  expect(TRUE, retb);
642  ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
643  /* bad bezier points */
644  retb = PolyDraw(hdc, &(polydraw_pts[2]), &(polydraw_tps[2]), 4);
645  expect(FALSE, retb);
647  ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
648  retb = PolyDraw(hdc, &(polydraw_pts[6]), &(polydraw_tps[6]), 4);
649  expect(FALSE, retb);
651  ok( pos.x == 10 && pos.y == 15, "wrong pos %d,%d\n", pos.x, pos.y );
652  /* good bezier points */
653  retb = PolyDraw(hdc, &(polydraw_pts[8]), &(polydraw_tps[8]), 4);
654  expect(TRUE, retb);
656  ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
657  /* does lineto or bezierto take precedence? */
658  retb = PolyDraw(hdc, &(polydraw_pts[12]), &(polydraw_tps[12]), 4);
659  expect(FALSE, retb);
661  ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
662  /* bad point type, has already moved cursor position */
663  retb = PolyDraw(hdc, &(polydraw_pts[15]), &(polydraw_tps[15]), 4);
664  expect(FALSE, retb);
666  ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
667  /* bad point type, cursor position is moved, but back to its original spot */
668  retb = PolyDraw(hdc, &(polydraw_pts[17]), &(polydraw_tps[17]), 4);
669  expect(FALSE, retb);
671  ok( pos.x == 35 && pos.y == 40, "wrong pos %d,%d\n", pos.x, pos.y );
672  /* does lineto or moveto take precedence? */
673  retb = PolyDraw(hdc, &(polydraw_pts[20]), &(polydraw_tps[20]), 3);
674  expect(TRUE, retb);
676  ok( pos.x == 65 && pos.y == 65, "wrong pos %d,%d\n", pos.x, pos.y );
677  /* consecutive movetos */
678  retb = PolyDraw(hdc, &(polydraw_pts[23]), &(polydraw_tps[23]), 4);
679  expect(TRUE, retb);
681  ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
682 
683  EndPath(hdc);
684  ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t));
686  ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
687 done:
688  ReleaseDC(0, hdc);
689 }
690 
691 static void test_closefigure(void) {
692  int nSize, nSizeWitness;
693  POINT pos;
694  HDC hdc = GetDC(0);
695 
696  MoveToEx( hdc, 100, 100, NULL );
698  ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y );
699 
700  BeginPath(hdc);
702  ok( pos.x == 100 && pos.y == 100, "wrong pos %d,%d\n", pos.x, pos.y );
703  MoveToEx(hdc, 95, 95, NULL);
705  ok( pos.x == 95 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
706  LineTo(hdc, 95, 0);
708  ok( pos.x == 95 && pos.y == 0, "wrong pos %d,%d\n", pos.x, pos.y );
709  LineTo(hdc, 0, 95);
711  ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
712 
713  CloseFigure(hdc);
715  ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
716  EndPath(hdc);
718  ok( pos.x == 0 && pos.y == 95, "wrong pos %d,%d\n", pos.x, pos.y );
719  nSize = GetPath(hdc, NULL, NULL, 0);
720 
721  AbortPath(hdc);
722 
723  BeginPath(hdc);
724  MoveToEx(hdc, 95, 95, NULL);
725  LineTo(hdc, 95, 0);
726  LineTo(hdc, 0, 95);
727 
728  EndPath(hdc);
729  nSizeWitness = GetPath(hdc, NULL, NULL, 0);
730 
731  /* This test shows CloseFigure does not have to add a point at the end of the path */
732  ok(nSize == nSizeWitness, "Wrong number of points, no point should be added by CloseFigure\n");
733 
734  ReleaseDC(0, hdc);
735 }
736 
738 {
739  POINT **pt = (POINT**)lparam;
740  ok((*pt)->x == x && (*pt)->y == y, "point mismatch expect(%d,%d) got(%d,%d)\n",
741  (*pt)->x, (*pt)->y, x, y);
742 
743  (*pt)++;
744  return;
745 }
746 
747 static void test_linedda(void)
748 {
749  const POINT *pt;
750  static const POINT array_10_20_20_40[] = {{10,20},{10,21},{11,22},{11,23},
751  {12,24},{12,25},{13,26},{13,27},
752  {14,28},{14,29},{15,30},{15,31},
753  {16,32},{16,33},{17,34},{17,35},
754  {18,36},{18,37},{19,38},{19,39},
755  {-1,-1}};
756  static const POINT array_10_20_20_43[] = {{10,20},{10,21},{11,22},{11,23},
757  {12,24},{12,25},{13,26},{13,27},
758  {13,28},{14,29},{14,30},{15,31},
759  {15,32},{16,33},{16,34},{17,35},
760  {17,36},{17,37},{18,38},{18,39},
761  {19,40},{19,41},{20,42},{-1,-1}};
762 
763  static const POINT array_10_20_10_20[] = {{-1,-1}};
764  static const POINT array_10_20_11_27[] = {{10,20},{10,21},{10,22},{10,23},
765  {11,24},{11,25},{11,26},{-1,-1}};
766 
767  static const POINT array_20_43_10_20[] = {{20,43},{20,42},{19,41},{19,40},
768  {18,39},{18,38},{17,37},{17,36},
769  {17,35},{16,34},{16,33},{15,32},
770  {15,31},{14,30},{14,29},{13,28},
771  {13,27},{13,26},{12,25},{12,24},
772  {11,23},{11,22},{10,21},{-1,-1}};
773 
774  static const POINT array_20_20_10_43[] = {{20,20},{20,21},{19,22},{19,23},
775  {18,24},{18,25},{17,26},{17,27},
776  {17,28},{16,29},{16,30},{15,31},
777  {15,32},{14,33},{14,34},{13,35},
778  {13,36},{13,37},{12,38},{12,39},
779  {11,40},{11,41},{10,42},{-1,-1}};
780 
781  static const POINT array_20_20_43_10[] = {{20,20},{21,20},{22,19},{23,19},
782  {24,18},{25,18},{26,17},{27,17},
783  {28,17},{29,16},{30,16},{31,15},
784  {32,15},{33,14},{34,14},{35,13},
785  {36,13},{37,13},{38,12},{39,12},
786  {40,11},{41,11},{42,10},{-1,-1}};
787 
788 
789  pt = array_10_20_20_40;
790  LineDDA(10, 20, 20, 40, linedda_callback, (LPARAM)&pt);
791  ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
792 
793  pt = array_10_20_20_43;
794  LineDDA(10, 20, 20, 43, linedda_callback, (LPARAM)&pt);
795  ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
796 
797  pt = array_10_20_10_20;
798  LineDDA(10, 20, 10, 20, linedda_callback, (LPARAM)&pt);
799  ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
800 
801  pt = array_10_20_11_27;
802  LineDDA(10, 20, 11, 27, linedda_callback, (LPARAM)&pt);
803  ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
804 
805  pt = array_20_43_10_20;
806  LineDDA(20, 43, 10, 20, linedda_callback, (LPARAM)&pt);
807  ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
808 
809  pt = array_20_20_10_43;
810  LineDDA(20, 20, 10, 43, linedda_callback, (LPARAM)&pt);
811  ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
812 
813  pt = array_20_20_43_10;
814  LineDDA(20, 20, 43, 10, linedda_callback, (LPARAM)&pt);
815  ok(pt->x == -1 && pt->y == -1, "didn't find terminator\n");
816 }
817 
818 static const path_test_t rectangle_path[] =
819 {
820  {39, 20, PT_MOVETO}, /* 0 */
821  {20, 20, PT_LINETO}, /* 1 */
822  {20, 39, PT_LINETO}, /* 2 */
823  {39, 39, PT_LINETO | PT_CLOSEFIGURE}, /* 3 */
824  {54, 35, PT_MOVETO}, /* 4 */
825  {30, 35, PT_LINETO}, /* 5 */
826  {30, 49, PT_LINETO}, /* 6 */
827  {54, 49, PT_LINETO | PT_CLOSEFIGURE}, /* 7 */
828  {59, 45, PT_MOVETO}, /* 8 */
829  {35, 45, PT_LINETO}, /* 9 */
830  {35, 59, PT_LINETO}, /* 10 */
831  {59, 59, PT_LINETO | PT_CLOSEFIGURE}, /* 11 */
832  {80, 80, PT_MOVETO}, /* 12 */
833  {80, 80, PT_LINETO}, /* 13 */
834  {80, 80, PT_LINETO}, /* 14 */
835  {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 15 */
836  {39, 39, PT_MOVETO}, /* 16 */
837  {20, 39, PT_LINETO}, /* 17 */
838  {20, 20, PT_LINETO}, /* 18 */
839  {39, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 19 */
840  {54, 49, PT_MOVETO}, /* 20 */
841  {30, 49, PT_LINETO}, /* 21 */
842  {30, 35, PT_LINETO}, /* 22 */
843  {54, 35, PT_LINETO | PT_CLOSEFIGURE}, /* 23 */
844  {59, 59, PT_MOVETO}, /* 24 */
845  {35, 59, PT_LINETO}, /* 25 */
846  {35, 45, PT_LINETO}, /* 26 */
847  {59, 45, PT_LINETO | PT_CLOSEFIGURE}, /* 27 */
848  {80, 80, PT_MOVETO}, /* 28 */
849  {80, 80, PT_LINETO}, /* 29 */
850  {80, 80, PT_LINETO}, /* 30 */
851  {80, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 31 */
852  {-41, 40, PT_MOVETO}, /* 32 */
853  {-80, 40, PT_LINETO}, /* 33 */
854  {-80, 79, PT_LINETO}, /* 34 */
855  {-41, 79, PT_LINETO | PT_CLOSEFIGURE}, /* 35 */
856  {-61, 70, PT_MOVETO}, /* 36 */
857  {-110, 70, PT_LINETO}, /* 37 */
858  {-110, 99, PT_LINETO}, /* 38 */
859  {-61, 99, PT_LINETO | PT_CLOSEFIGURE}, /* 39 */
860  {119, -120, PT_MOVETO}, /* 40 */
861  {60, -120, PT_LINETO}, /* 41 */
862  {60, -61, PT_LINETO}, /* 42 */
863  {119, -61, PT_LINETO | PT_CLOSEFIGURE}, /* 43 */
864  {164, -150, PT_MOVETO}, /* 44 */
865  {90, -150, PT_LINETO}, /* 45 */
866  {90, -106, PT_LINETO}, /* 46 */
867  {164, -106, PT_LINETO | PT_CLOSEFIGURE}, /* 47 */
868  {-4, -6, PT_MOVETO}, /* 48 */
869  {-6, -6, PT_LINETO}, /* 49 */
870  {-6, -4, PT_LINETO}, /* 50 */
871  {-4, -4, PT_LINETO | PT_CLOSEFIGURE}, /* 51 */
872  {40, 20, PT_MOVETO}, /* 52 */
873  {20, 20, PT_LINETO}, /* 53 */
874  {20, 40, PT_LINETO}, /* 54 */
875  {40, 40, PT_LINETO | PT_CLOSEFIGURE}, /* 55 */
876  {55, 35, PT_MOVETO}, /* 56 */
877  {30, 35, PT_LINETO}, /* 57 */
878  {30, 50, PT_LINETO}, /* 58 */
879  {55, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 59 */
880  {60, 45, PT_MOVETO}, /* 60 */
881  {35, 45, PT_LINETO}, /* 61 */
882  {35, 60, PT_LINETO}, /* 62 */
883  {60, 60, PT_LINETO | PT_CLOSEFIGURE}, /* 63 */
884  {70, 70, PT_MOVETO}, /* 64 */
885  {50, 70, PT_LINETO}, /* 65 */
886  {50, 70, PT_LINETO}, /* 66 */
887  {70, 70, PT_LINETO | PT_CLOSEFIGURE}, /* 67 */
888  {75, 75, PT_MOVETO}, /* 68 */
889  {75, 75, PT_LINETO}, /* 69 */
890  {75, 85, PT_LINETO}, /* 70 */
891  {75, 85, PT_LINETO | PT_CLOSEFIGURE}, /* 71 */
892  {81, 80, PT_MOVETO}, /* 72 */
893  {80, 80, PT_LINETO}, /* 73 */
894  {80, 81, PT_LINETO}, /* 74 */
895  {81, 81, PT_LINETO | PT_CLOSEFIGURE}, /* 75 */
896  {40, 40, PT_MOVETO}, /* 76 */
897  {20, 40, PT_LINETO}, /* 77 */
898  {20, 20, PT_LINETO}, /* 78 */
899  {40, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 79 */
900  {55, 50, PT_MOVETO}, /* 80 */
901  {30, 50, PT_LINETO}, /* 81 */
902  {30, 35, PT_LINETO}, /* 82 */
903  {55, 35, PT_LINETO | PT_CLOSEFIGURE}, /* 83 */
904  {60, 60, PT_MOVETO}, /* 84 */
905  {35, 60, PT_LINETO}, /* 85 */
906  {35, 45, PT_LINETO}, /* 86 */
907  {60, 45, PT_LINETO | PT_CLOSEFIGURE}, /* 87 */
908  {70, 70, PT_MOVETO}, /* 88 */
909  {50, 70, PT_LINETO}, /* 89 */
910  {50, 70, PT_LINETO}, /* 90 */
911  {70, 70, PT_LINETO | PT_CLOSEFIGURE}, /* 91 */
912  {75, 85, PT_MOVETO}, /* 92 */
913  {75, 85, PT_LINETO}, /* 93 */
914  {75, 75, PT_LINETO}, /* 94 */
915  {75, 75, PT_LINETO | PT_CLOSEFIGURE}, /* 95 */
916  {81, 81, PT_MOVETO}, /* 96 */
917  {80, 81, PT_LINETO}, /* 97 */
918  {80, 80, PT_LINETO}, /* 98 */
919  {81, 80, PT_LINETO | PT_CLOSEFIGURE}, /* 99 */
920 };
921 
922 static void test_rectangle(void)
923 {
924  HDC hdc = GetDC( 0 );
925 
926  BeginPath( hdc );
927  Rectangle( hdc, 20, 20, 40, 40 );
928  Rectangle( hdc, 30, 50, 55, 35 );
929  Rectangle( hdc, 60, 60, 35, 45 );
930  Rectangle( hdc, 70, 70, 50, 70 );
931  Rectangle( hdc, 75, 75, 75, 85 );
932  Rectangle( hdc, 80, 80, 81, 81 );
934  Rectangle( hdc, 20, 20, 40, 40 );
935  Rectangle( hdc, 30, 50, 55, 35 );
936  Rectangle( hdc, 60, 60, 35, 45 );
937  Rectangle( hdc, 70, 70, 50, 70 );
938  Rectangle( hdc, 75, 75, 75, 85 );
939  Rectangle( hdc, 80, 80, 81, 81 );
942  SetViewportExtEx( hdc, -2, 2, NULL );
943  Rectangle( hdc, 20, 20, 40, 40 );
944  Rectangle( hdc, 30, 50, 55, 35 );
945  SetViewportExtEx( hdc, 3, -3, NULL );
946  Rectangle( hdc, 20, 20, 40, 40 );
947  Rectangle( hdc, 30, 50, 55, 35 );
948  SetWindowExtEx( hdc, -20, 20, NULL );
949  Rectangle( hdc, 20, 20, 40, 40 );
950  Rectangle( hdc, 24, 22, 21, 20 );
951  SetMapMode( hdc, MM_TEXT );
953  Rectangle( hdc, 20, 20, 40, 40 );
954  Rectangle( hdc, 30, 50, 55, 35 );
955  Rectangle( hdc, 60, 60, 35, 45 );
956  Rectangle( hdc, 70, 70, 50, 70 );
957  Rectangle( hdc, 75, 75, 75, 85 );
958  Rectangle( hdc, 80, 80, 81, 81 );
960  Rectangle( hdc, 20, 20, 40, 40 );
961  Rectangle( hdc, 30, 50, 55, 35 );
962  Rectangle( hdc, 60, 60, 35, 45 );
963  Rectangle( hdc, 70, 70, 50, 70 );
964  Rectangle( hdc, 75, 75, 75, 85 );
965  Rectangle( hdc, 80, 80, 81, 81 );
967  EndPath( hdc );
968  SetMapMode( hdc, MM_TEXT );
969  ok_path( hdc, "rectangle_path", rectangle_path, sizeof(rectangle_path)/sizeof(path_test_t) );
970  ReleaseDC( 0, hdc );
971 }
972 
973 static const path_test_t roundrect_path[] =
974 {
975  {39, 25, PT_MOVETO}, /* 0 */
976  {39, 22, PT_BEZIERTO}, /* 1 */
977  {37, 20, PT_BEZIERTO}, /* 2 */
978  {34, 20, PT_BEZIERTO}, /* 3 */
979  {25, 20, PT_LINETO}, /* 4 */
980  {22, 20, PT_BEZIERTO}, /* 5 */
981  {20, 22, PT_BEZIERTO}, /* 6 */
982  {20, 25, PT_BEZIERTO}, /* 7 */
983  {20, 34, PT_LINETO}, /* 8 */
984  {20, 37, PT_BEZIERTO}, /* 9 */
985  {22, 39, PT_BEZIERTO}, /* 10 */
986  {25, 39, PT_BEZIERTO}, /* 11 */
987  {34, 39, PT_LINETO}, /* 12 */
988  {37, 39, PT_BEZIERTO}, /* 13 */
989  {39, 37, PT_BEZIERTO}, /* 14 */
990  {39, 34, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 15 */
991  {54, 42, PT_MOVETO}, /* 16 */
992  {54, 38, PT_BEZIERTO}, /* 17 */
993  {49, 35, PT_BEZIERTO}, /* 18 */
994  {42, 35, PT_BEZIERTO}, /* 19 */
995  {42, 35, PT_LINETO}, /* 20 */
996  {35, 35, PT_BEZIERTO}, /* 21 */
997  {30, 38, PT_BEZIERTO}, /* 22 */
998  {30, 42, PT_BEZIERTO}, /* 23 */
999  {30, 42, PT_LINETO}, /* 24 */
1000  {30, 46, PT_BEZIERTO}, /* 25 */
1001  {35, 49, PT_BEZIERTO}, /* 26 */
1002  {42, 49, PT_BEZIERTO}, /* 27 */
1003  {42, 49, PT_LINETO}, /* 28 */
1004  {49, 49, PT_BEZIERTO}, /* 29 */
1005  {54, 46, PT_BEZIERTO}, /* 30 */
1006  {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 31 */
1007  {59, 46, PT_MOVETO}, /* 32 */
1008  {59, 45, PT_BEZIERTO}, /* 33 */
1009  {58, 45, PT_BEZIERTO}, /* 34 */
1010  {57, 45, PT_BEZIERTO}, /* 35 */
1011  {37, 45, PT_LINETO}, /* 36 */
1012  {36, 45, PT_BEZIERTO}, /* 37 */
1013  {35, 45, PT_BEZIERTO}, /* 38 */
1014  {35, 46, PT_BEZIERTO}, /* 39 */
1015  {35, 58, PT_LINETO}, /* 40 */
1016  {35, 59, PT_BEZIERTO}, /* 41 */
1017  {36, 59, PT_BEZIERTO}, /* 42 */
1018  {37, 59, PT_BEZIERTO}, /* 43 */
1019  {57, 59, PT_LINETO}, /* 44 */
1020  {58, 59, PT_BEZIERTO}, /* 45 */
1021  {59, 59, PT_BEZIERTO}, /* 46 */
1022  {59, 58, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 47 */
1023  {80, 80, PT_MOVETO}, /* 48 */
1024  {80, 80, PT_BEZIERTO}, /* 49 */
1025  {80, 80, PT_BEZIERTO}, /* 50 */
1026  {80, 80, PT_BEZIERTO}, /* 51 */
1027  {80, 80, PT_LINETO}, /* 52 */
1028  {80, 80, PT_BEZIERTO}, /* 53 */
1029  {80, 80, PT_BEZIERTO}, /* 54 */
1030  {80, 80, PT_BEZIERTO}, /* 55 */
1031  {80, 80, PT_LINETO}, /* 56 */
1032  {80, 80, PT_BEZIERTO}, /* 57 */
1033  {80, 80, PT_BEZIERTO}, /* 58 */
1034  {80, 80, PT_BEZIERTO}, /* 59 */
1035  {80, 80, PT_LINETO}, /* 60 */
1036  {80, 80, PT_BEZIERTO}, /* 61 */
1037  {80, 80, PT_BEZIERTO}, /* 62 */
1038  {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 63 */
1039  {94, 85, PT_MOVETO}, /* 64 */
1040  {90, 85, PT_LINETO}, /* 65 */
1041  {90, 89, PT_LINETO}, /* 66 */
1042  {94, 89, PT_LINETO | PT_CLOSEFIGURE}, /* 67 */
1043  {39, 34, PT_MOVETO}, /* 68 */
1044  {39, 37, PT_BEZIERTO}, /* 69 */
1045  {37, 39, PT_BEZIERTO}, /* 70 */
1046  {34, 39, PT_BEZIERTO}, /* 71 */
1047  {25, 39, PT_LINETO}, /* 72 */
1048  {22, 39, PT_BEZIERTO}, /* 73 */
1049  {20, 37, PT_BEZIERTO}, /* 74 */
1050  {20, 34, PT_BEZIERTO}, /* 75 */
1051  {20, 25, PT_LINETO}, /* 76 */
1052  {20, 22, PT_BEZIERTO}, /* 77 */
1053  {22, 20, PT_BEZIERTO}, /* 78 */
1054  {25, 20, PT_BEZIERTO}, /* 79 */
1055  {34, 20, PT_LINETO}, /* 80 */
1056  {37, 20, PT_BEZIERTO}, /* 81 */
1057  {39, 22, PT_BEZIERTO}, /* 82 */
1058  {39, 25, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 83 */
1059  {54, 42, PT_MOVETO}, /* 84 */
1060  {54, 46, PT_BEZIERTO}, /* 85 */
1061  {49, 49, PT_BEZIERTO}, /* 86 */
1062  {42, 49, PT_BEZIERTO}, /* 87 */
1063  {42, 49, PT_LINETO}, /* 88 */
1064  {35, 49, PT_BEZIERTO}, /* 89 */
1065  {30, 46, PT_BEZIERTO}, /* 90 */
1066  {30, 42, PT_BEZIERTO}, /* 91 */
1067  {30, 42, PT_LINETO}, /* 92 */
1068  {30, 38, PT_BEZIERTO}, /* 93 */
1069  {35, 35, PT_BEZIERTO}, /* 94 */
1070  {42, 35, PT_BEZIERTO}, /* 95 */
1071  {42, 35, PT_LINETO}, /* 96 */
1072  {49, 35, PT_BEZIERTO}, /* 97 */
1073  {54, 38, PT_BEZIERTO}, /* 98 */
1074  {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 99 */
1075  {-41, 52, PT_MOVETO}, /* 100 */
1076  {-41, 45, PT_BEZIERTO}, /* 101 */
1077  {-47, 40, PT_BEZIERTO}, /* 102 */
1078  {-56, 40, PT_BEZIERTO}, /* 103 */
1079  {-65, 40, PT_LINETO}, /* 104 */
1080  {-73, 40, PT_BEZIERTO}, /* 105 */
1081  {-80, 45, PT_BEZIERTO}, /* 106 */
1082  {-80, 52, PT_BEZIERTO}, /* 107 */
1083  {-80, 67, PT_LINETO}, /* 108 */
1084  {-80, 74, PT_BEZIERTO}, /* 109 */
1085  {-73, 79, PT_BEZIERTO}, /* 110 */
1086  {-65, 79, PT_BEZIERTO}, /* 111 */
1087  {-56, 79, PT_LINETO}, /* 112 */
1088  {-47, 79, PT_BEZIERTO}, /* 113 */
1089  {-41, 74, PT_BEZIERTO}, /* 114 */
1090  {-41, 67, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 115 */
1091  {-61, 79, PT_MOVETO}, /* 116 */
1092  {-61, 74, PT_BEZIERTO}, /* 117 */
1093  {-64, 70, PT_BEZIERTO}, /* 118 */
1094  {-68, 70, PT_BEZIERTO}, /* 119 */
1095  {-103, 70, PT_LINETO}, /* 120 */
1096  {-107, 70, PT_BEZIERTO}, /* 121 */
1097  {-110, 74, PT_BEZIERTO}, /* 122 */
1098  {-110, 79, PT_BEZIERTO}, /* 123 */
1099  {-110, 90, PT_LINETO}, /* 124 */
1100  {-110, 95, PT_BEZIERTO}, /* 125 */
1101  {-107, 99, PT_BEZIERTO}, /* 126 */
1102  {-103, 99, PT_BEZIERTO}, /* 127 */
1103  {-68, 99, PT_LINETO}, /* 128 */
1104  {-64, 99, PT_BEZIERTO}, /* 129 */
1105  {-61, 95, PT_BEZIERTO}, /* 130 */
1106  {-61, 90, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 131 */
1107  {119, -102, PT_MOVETO}, /* 132 */
1108  {119, -112, PT_BEZIERTO}, /* 133 */
1109  {109, -120, PT_BEZIERTO}, /* 134 */
1110  {97, -120, PT_BEZIERTO}, /* 135 */
1111  {82, -120, PT_LINETO}, /* 136 */
1112  {70, -120, PT_BEZIERTO}, /* 137 */
1113  {60, -112, PT_BEZIERTO}, /* 138 */
1114  {60, -102, PT_BEZIERTO}, /* 139 */
1115  {60, -79, PT_LINETO}, /* 140 */
1116  {60, -69, PT_BEZIERTO}, /* 141 */
1117  {70, -61, PT_BEZIERTO}, /* 142 */
1118  {82, -61, PT_BEZIERTO}, /* 143 */
1119  {97, -61, PT_LINETO}, /* 144 */
1120  {109, -61, PT_BEZIERTO}, /* 145 */
1121  {119, -69, PT_BEZIERTO}, /* 146 */
1122  {119, -79, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 147 */
1123  {164, -144, PT_MOVETO}, /* 148 */
1124  {164, -147, PT_BEZIERTO}, /* 149 */
1125  {162, -150, PT_BEZIERTO}, /* 150 */
1126  {160, -150, PT_BEZIERTO}, /* 151 */
1127  {94, -150, PT_LINETO}, /* 152 */
1128  {92, -150, PT_BEZIERTO}, /* 153 */
1129  {90, -147, PT_BEZIERTO}, /* 154 */
1130  {90, -144, PT_BEZIERTO}, /* 155 */
1131  {90, -112, PT_LINETO}, /* 156 */
1132  {90, -109, PT_BEZIERTO}, /* 157 */
1133  {92, -106, PT_BEZIERTO}, /* 158 */
1134  {94, -106, PT_BEZIERTO}, /* 159 */
1135  {160, -106, PT_LINETO}, /* 160 */
1136  {162, -106, PT_BEZIERTO}, /* 161 */
1137  {164, -109, PT_BEZIERTO}, /* 162 */
1138  {164, -112, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 163 */
1139  {-4, -6, PT_MOVETO}, /* 164 */
1140  {-4, -6, PT_BEZIERTO}, /* 165 */
1141  {-4, -6, PT_BEZIERTO}, /* 166 */
1142  {-4, -6, PT_BEZIERTO}, /* 167 */
1143  {-6, -6, PT_LINETO}, /* 168 */
1144  {-6, -6, PT_BEZIERTO}, /* 169 */
1145  {-6, -6, PT_BEZIERTO}, /* 170 */
1146  {-6, -6, PT_BEZIERTO}, /* 171 */
1147  {-6, -4, PT_LINETO}, /* 172 */
1148  {-6, -4, PT_BEZIERTO}, /* 173 */
1149  {-6, -4, PT_BEZIERTO}, /* 174 */
1150  {-6, -4, PT_BEZIERTO}, /* 175 */
1151  {-4, -4, PT_LINETO}, /* 176 */
1152  {-4, -4, PT_BEZIERTO}, /* 177 */
1153  {-4, -4, PT_BEZIERTO}, /* 178 */
1154  {-4, -4, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 179 */
1155  {40, 25, PT_MOVETO}, /* 180 */
1156  {40, 22, PT_BEZIERTO}, /* 181 */
1157  {38, 20, PT_BEZIERTO}, /* 182 */
1158  {35, 20, PT_BEZIERTO}, /* 183 */
1159  {25, 20, PT_LINETO}, /* 184 */
1160  {22, 20, PT_BEZIERTO}, /* 185 */
1161  {20, 22, PT_BEZIERTO}, /* 186 */
1162  {20, 25, PT_BEZIERTO}, /* 187 */
1163  {20, 35, PT_LINETO}, /* 188 */
1164  {20, 38, PT_BEZIERTO}, /* 189 */
1165  {22, 40, PT_BEZIERTO}, /* 190 */
1166  {25, 40, PT_BEZIERTO}, /* 191 */
1167  {35, 40, PT_LINETO}, /* 192 */
1168  {38, 40, PT_BEZIERTO}, /* 193 */
1169  {40, 38, PT_BEZIERTO}, /* 194 */
1170  {40, 35, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 195 */
1171  {55, 43, PT_MOVETO}, /* 196 */
1172  {55, 38, PT_BEZIERTO}, /* 197 */
1173  {49, 35, PT_BEZIERTO}, /* 198 */
1174  {43, 35, PT_BEZIERTO}, /* 199 */
1175  {43, 35, PT_LINETO}, /* 200 */
1176  {36, 35, PT_BEZIERTO}, /* 201 */
1177  {30, 38, PT_BEZIERTO}, /* 202 */
1178  {30, 43, PT_BEZIERTO}, /* 203 */
1179  {30, 43, PT_LINETO}, /* 204 */
1180  {30, 47, PT_BEZIERTO}, /* 205 */
1181  {36, 50, PT_BEZIERTO}, /* 206 */
1182  {43, 50, PT_BEZIERTO}, /* 207 */
1183  {43, 50, PT_LINETO}, /* 208 */
1184  {49, 50, PT_BEZIERTO}, /* 209 */
1185  {55, 47, PT_BEZIERTO}, /* 210 */
1186  {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 211 */
1187  {60, 46, PT_MOVETO}, /* 212 */
1188  {60, 46, PT_BEZIERTO}, /* 213 */
1189  {59, 45, PT_BEZIERTO}, /* 214 */
1190  {58, 45, PT_BEZIERTO}, /* 215 */
1191  {38, 45, PT_LINETO}, /* 216 */
1192  {36, 45, PT_BEZIERTO}, /* 217 */
1193  {35, 46, PT_BEZIERTO}, /* 218 */
1194  {35, 46, PT_BEZIERTO}, /* 219 */
1195  {35, 59, PT_LINETO}, /* 220 */
1196  {35, 60, PT_BEZIERTO}, /* 221 */
1197  {36, 60, PT_BEZIERTO}, /* 222 */
1198  {38, 60, PT_BEZIERTO}, /* 223 */
1199  {58, 60, PT_LINETO}, /* 224 */
1200  {59, 60, PT_BEZIERTO}, /* 225 */
1201  {60, 60, PT_BEZIERTO}, /* 226 */
1202  {60, 59, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 227 */
1203  {70, 70, PT_MOVETO}, /* 228 */
1204  {70, 70, PT_BEZIERTO}, /* 229 */
1205  {70, 70, PT_BEZIERTO}, /* 230 */
1206  {70, 70, PT_BEZIERTO}, /* 231 */
1207  {50, 70, PT_LINETO}, /* 232 */
1208  {50, 70, PT_BEZIERTO}, /* 233 */
1209  {50, 70, PT_BEZIERTO}, /* 234 */
1210  {50, 70, PT_BEZIERTO}, /* 235 */
1211  {50, 70, PT_LINETO}, /* 236 */
1212  {50, 70, PT_BEZIERTO}, /* 237 */
1213  {50, 70, PT_BEZIERTO}, /* 238 */
1214  {50, 70, PT_BEZIERTO}, /* 239 */
1215  {70, 70, PT_LINETO}, /* 240 */
1216  {70, 70, PT_BEZIERTO}, /* 241 */
1217  {70, 70, PT_BEZIERTO}, /* 242 */
1218  {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 243 */
1219  {75, 75, PT_MOVETO}, /* 244 */
1220  {75, 75, PT_BEZIERTO}, /* 245 */
1221  {75, 75, PT_BEZIERTO}, /* 246 */
1222  {75, 75, PT_BEZIERTO}, /* 247 */
1223  {75, 75, PT_LINETO}, /* 248 */
1224  {75, 75, PT_BEZIERTO}, /* 249 */
1225  {75, 75, PT_BEZIERTO}, /* 250 */
1226  {75, 75, PT_BEZIERTO}, /* 251 */
1227  {75, 85, PT_LINETO}, /* 252 */
1228  {75, 85, PT_BEZIERTO}, /* 253 */
1229  {75, 85, PT_BEZIERTO}, /* 254 */
1230  {75, 85, PT_BEZIERTO}, /* 255 */
1231  {75, 85, PT_LINETO}, /* 256 */
1232  {75, 85, PT_BEZIERTO}, /* 257 */
1233  {75, 85, PT_BEZIERTO}, /* 258 */
1234  {75, 85, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 259 */
1235  {81, 81, PT_MOVETO}, /* 260 */
1236  {81, 80, PT_BEZIERTO}, /* 261 */
1237  {81, 80, PT_BEZIERTO}, /* 262 */
1238  {81, 80, PT_BEZIERTO}, /* 263 */
1239  {81, 80, PT_LINETO}, /* 264 */
1240  {80, 80, PT_BEZIERTO}, /* 265 */
1241  {80, 80, PT_BEZIERTO}, /* 266 */
1242  {80, 81, PT_BEZIERTO}, /* 267 */
1243  {80, 81, PT_LINETO}, /* 268 */
1244  {80, 81, PT_BEZIERTO}, /* 269 */
1245  {80, 81, PT_BEZIERTO}, /* 270 */
1246  {81, 81, PT_BEZIERTO}, /* 271 */
1247  {81, 81, PT_LINETO}, /* 272 */
1248  {81, 81, PT_BEZIERTO}, /* 273 */
1249  {81, 81, PT_BEZIERTO}, /* 274 */
1250  {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 275 */
1251  {95, 85, PT_MOVETO}, /* 276 */
1252  {90, 85, PT_LINETO}, /* 277 */
1253  {90, 90, PT_LINETO}, /* 278 */
1254  {95, 90, PT_LINETO | PT_CLOSEFIGURE}, /* 279 */
1255  {40, 35, PT_MOVETO}, /* 280 */
1256  {40, 38, PT_BEZIERTO}, /* 281 */
1257  {38, 40, PT_BEZIERTO}, /* 282 */
1258  {35, 40, PT_BEZIERTO}, /* 283 */
1259  {25, 40, PT_LINETO}, /* 284 */
1260  {22, 40, PT_BEZIERTO}, /* 285 */
1261  {20, 38, PT_BEZIERTO}, /* 286 */
1262  {20, 35, PT_BEZIERTO}, /* 287 */
1263  {20, 25, PT_LINETO}, /* 288 */
1264  {20, 22, PT_BEZIERTO}, /* 289 */
1265  {22, 20, PT_BEZIERTO}, /* 290 */
1266  {25, 20, PT_BEZIERTO}, /* 291 */
1267  {35, 20, PT_LINETO}, /* 292 */
1268  {38, 20, PT_BEZIERTO}, /* 293 */
1269  {40, 22, PT_BEZIERTO}, /* 294 */
1270  {40, 25, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 295 */
1271  {55, 43, PT_MOVETO}, /* 296 */
1272  {55, 47, PT_BEZIERTO}, /* 297 */
1273  {49, 50, PT_BEZIERTO}, /* 298 */
1274  {43, 50, PT_BEZIERTO}, /* 299 */
1275  {43, 50, PT_LINETO}, /* 300 */
1276  {36, 50, PT_BEZIERTO}, /* 301 */
1277  {30, 47, PT_BEZIERTO}, /* 302 */
1278  {30, 43, PT_BEZIERTO}, /* 303 */
1279  {30, 43, PT_LINETO}, /* 304 */
1280  {30, 38, PT_BEZIERTO}, /* 305 */
1281  {36, 35, PT_BEZIERTO}, /* 306 */
1282  {43, 35, PT_BEZIERTO}, /* 307 */
1283  {43, 35, PT_LINETO}, /* 308 */
1284  {49, 35, PT_BEZIERTO}, /* 309 */
1285  {55, 38, PT_BEZIERTO}, /* 310 */
1286  {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 311 */
1287 };
1288 
1289 static void test_roundrect(void)
1290 {
1291  HDC hdc = GetDC( 0 );
1292 
1293  BeginPath( hdc );
1294  RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1295  RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1296  RoundRect( hdc, 60, 60, 35, 45, 5, 2 );
1297  RoundRect( hdc, 70, 70, 50, 70, 3, 5 );
1298  RoundRect( hdc, 75, 75, 75, 85, 6, 4 );
1299  RoundRect( hdc, 80, 80, 81, 81, 8, 9 );
1300  RoundRect( hdc, 90, 90, 95, 85, 0, 7 );
1302  RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1303  RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1306  SetViewportExtEx( hdc, -2, 2, NULL );
1307  RoundRect( hdc, 20, 20, 40, 40, 15, 12 );
1308  RoundRect( hdc, 30, 50, 55, 35, 7, 9 );
1309  SetViewportExtEx( hdc, 3, -3, NULL );
1310  RoundRect( hdc, 20, 20, 40, 40, 15, 12 );
1311  RoundRect( hdc, 30, 50, 55, 35, 3, 4 );
1312  SetWindowExtEx( hdc, -20, 20, NULL );
1313  RoundRect( hdc, 20, 20, 40, 40, 2, 1 );
1314  RoundRect( hdc, 24, 22, 21, 20, 4, 4 );
1315  SetMapMode( hdc, MM_TEXT );
1317  RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1318  RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1319  RoundRect( hdc, 60, 60, 35, 45, 5, 2 );
1320  RoundRect( hdc, 70, 70, 50, 70, 3, 5 );
1321  RoundRect( hdc, 75, 75, 75, 85, 6, 4 );
1322  RoundRect( hdc, 80, 80, 81, 81, 8, 9 );
1323  RoundRect( hdc, 90, 90, 95, 85, 0, 7 );
1325  RoundRect( hdc, 20, 20, 40, 40, 10, 10 );
1326  RoundRect( hdc, 30, 50, 55, 35, -30, -30 );
1328  EndPath( hdc );
1329  SetMapMode( hdc, MM_TEXT );
1330  ok_path( hdc, "roundrect_path", roundrect_path, sizeof(roundrect_path)/sizeof(path_test_t) );
1331  ReleaseDC( 0, hdc );
1332 }
1333 
1334 static const path_test_t ellipse_path[] =
1335 {
1336  {39, 30, PT_MOVETO}, /* 0 */
1337  {39, 24, PT_BEZIERTO}, /* 1 */
1338  {35, 20, PT_BEZIERTO}, /* 2 */
1339  {30, 20, PT_BEZIERTO}, /* 3 */
1340  {24, 20, PT_BEZIERTO}, /* 4 */
1341  {20, 24, PT_BEZIERTO}, /* 5 */
1342  {20, 30, PT_BEZIERTO}, /* 6 */
1343  {20, 35, PT_BEZIERTO}, /* 7 */
1344  {24, 39, PT_BEZIERTO}, /* 8 */
1345  {30, 39, PT_BEZIERTO}, /* 9 */
1346  {35, 39, PT_BEZIERTO}, /* 10 */
1347  {39, 35, PT_BEZIERTO}, /* 11 */
1348  {39, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 12 */
1349  {54, 42, PT_MOVETO}, /* 13 */
1350  {54, 38, PT_BEZIERTO}, /* 14 */
1351  {49, 35, PT_BEZIERTO}, /* 15 */
1352  {42, 35, PT_BEZIERTO}, /* 16 */
1353  {35, 35, PT_BEZIERTO}, /* 17 */
1354  {30, 38, PT_BEZIERTO}, /* 18 */
1355  {30, 42, PT_BEZIERTO}, /* 19 */
1356  {30, 46, PT_BEZIERTO}, /* 20 */
1357  {35, 49, PT_BEZIERTO}, /* 21 */
1358  {42, 49, PT_BEZIERTO}, /* 22 */
1359  {49, 49, PT_BEZIERTO}, /* 23 */
1360  {54, 46, PT_BEZIERTO}, /* 24 */
1361  {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 25 */
1362  {59, 52, PT_MOVETO}, /* 26 */
1363  {59, 48, PT_BEZIERTO}, /* 27 */
1364  {54, 45, PT_BEZIERTO}, /* 28 */
1365  {47, 45, PT_BEZIERTO}, /* 29 */
1366  {40, 45, PT_BEZIERTO}, /* 30 */
1367  {35, 48, PT_BEZIERTO}, /* 31 */
1368  {35, 52, PT_BEZIERTO}, /* 32 */
1369  {35, 56, PT_BEZIERTO}, /* 33 */
1370  {40, 59, PT_BEZIERTO}, /* 34 */
1371  {47, 59, PT_BEZIERTO}, /* 35 */
1372  {54, 59, PT_BEZIERTO}, /* 36 */
1373  {59, 56, PT_BEZIERTO}, /* 37 */
1374  {59, 52, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 38 */
1375  {80, 80, PT_MOVETO}, /* 39 */
1376  {80, 80, PT_BEZIERTO}, /* 40 */
1377  {80, 80, PT_BEZIERTO}, /* 41 */
1378  {80, 80, PT_BEZIERTO}, /* 42 */
1379  {80, 80, PT_BEZIERTO}, /* 43 */
1380  {80, 80, PT_BEZIERTO}, /* 44 */
1381  {80, 80, PT_BEZIERTO}, /* 45 */
1382  {80, 80, PT_BEZIERTO}, /* 46 */
1383  {80, 80, PT_BEZIERTO}, /* 47 */
1384  {80, 80, PT_BEZIERTO}, /* 48 */
1385  {80, 80, PT_BEZIERTO}, /* 49 */
1386  {80, 80, PT_BEZIERTO}, /* 50 */
1387  {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 51 */
1388  {39, 30, PT_MOVETO}, /* 52 */
1389  {39, 35, PT_BEZIERTO}, /* 53 */
1390  {35, 39, PT_BEZIERTO}, /* 54 */
1391  {30, 39, PT_BEZIERTO}, /* 55 */
1392  {24, 39, PT_BEZIERTO}, /* 56 */
1393  {20, 35, PT_BEZIERTO}, /* 57 */
1394  {20, 30, PT_BEZIERTO}, /* 58 */
1395  {20, 24, PT_BEZIERTO}, /* 59 */
1396  {24, 20, PT_BEZIERTO}, /* 60 */
1397  {30, 20, PT_BEZIERTO}, /* 61 */
1398  {35, 20, PT_BEZIERTO}, /* 62 */
1399  {39, 24, PT_BEZIERTO}, /* 63 */
1400  {39, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 64 */
1401  {54, 42, PT_MOVETO}, /* 65 */
1402  {54, 46, PT_BEZIERTO}, /* 66 */
1403  {49, 49, PT_BEZIERTO}, /* 67 */
1404  {42, 49, PT_BEZIERTO}, /* 68 */
1405  {35, 49, PT_BEZIERTO}, /* 69 */
1406  {30, 46, PT_BEZIERTO}, /* 70 */
1407  {30, 42, PT_BEZIERTO}, /* 71 */
1408  {30, 38, PT_BEZIERTO}, /* 72 */
1409  {35, 35, PT_BEZIERTO}, /* 73 */
1410  {42, 35, PT_BEZIERTO}, /* 74 */
1411  {49, 35, PT_BEZIERTO}, /* 75 */
1412  {54, 38, PT_BEZIERTO}, /* 76 */
1413  {54, 42, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 77 */
1414  {59, 52, PT_MOVETO}, /* 78 */
1415  {59, 56, PT_BEZIERTO}, /* 79 */
1416  {54, 59, PT_BEZIERTO}, /* 80 */
1417  {47, 59, PT_BEZIERTO}, /* 81 */
1418  {40, 59, PT_BEZIERTO}, /* 82 */
1419  {35, 56, PT_BEZIERTO}, /* 83 */
1420  {35, 52, PT_BEZIERTO}, /* 84 */
1421  {35, 48, PT_BEZIERTO}, /* 85 */
1422  {40, 45, PT_BEZIERTO}, /* 86 */
1423  {47, 45, PT_BEZIERTO}, /* 87 */
1424  {54, 45, PT_BEZIERTO}, /* 88 */
1425  {59, 48, PT_BEZIERTO}, /* 89 */
1426  {59, 52, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 90 */
1427  {80, 80, PT_MOVETO}, /* 91 */
1428  {80, 80, PT_BEZIERTO}, /* 92 */
1429  {80, 80, PT_BEZIERTO}, /* 93 */
1430  {80, 80, PT_BEZIERTO}, /* 94 */
1431  {80, 80, PT_BEZIERTO}, /* 95 */
1432  {80, 80, PT_BEZIERTO}, /* 96 */
1433  {80, 80, PT_BEZIERTO}, /* 97 */
1434  {80, 80, PT_BEZIERTO}, /* 98 */
1435  {80, 80, PT_BEZIERTO}, /* 99 */
1436  {80, 80, PT_BEZIERTO}, /* 100 */
1437  {80, 80, PT_BEZIERTO}, /* 101 */
1438  {80, 80, PT_BEZIERTO}, /* 102 */
1439  {80, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 103 */
1440  {-41, 60, PT_MOVETO}, /* 104 */
1441  {-41, 49, PT_BEZIERTO}, /* 105 */
1442  {-50, 40, PT_BEZIERTO}, /* 106 */
1443  {-60, 40, PT_BEZIERTO}, /* 107 */
1444  {-71, 40, PT_BEZIERTO}, /* 108 */
1445  {-80, 49, PT_BEZIERTO}, /* 109 */
1446  {-80, 60, PT_BEZIERTO}, /* 110 */
1447  {-80, 70, PT_BEZIERTO}, /* 111 */
1448  {-71, 79, PT_BEZIERTO}, /* 112 */
1449  {-60, 79, PT_BEZIERTO}, /* 113 */
1450  {-50, 79, PT_BEZIERTO}, /* 114 */
1451  {-41, 70, PT_BEZIERTO}, /* 115 */
1452  {-41, 60, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 116 */
1453  {-61, 85, PT_MOVETO}, /* 117 */
1454  {-61, 77, PT_BEZIERTO}, /* 118 */
1455  {-72, 70, PT_BEZIERTO}, /* 119 */
1456  {-85, 70, PT_BEZIERTO}, /* 120 */
1457  {-99, 70, PT_BEZIERTO}, /* 121 */
1458  {-110, 77, PT_BEZIERTO}, /* 122 */
1459  {-110, 85, PT_BEZIERTO}, /* 123 */
1460  {-110, 93, PT_BEZIERTO}, /* 124 */
1461  {-99, 99, PT_BEZIERTO}, /* 125 */
1462  {-85, 99, PT_BEZIERTO}, /* 126 */
1463  {-72, 99, PT_BEZIERTO}, /* 127 */
1464  {-61, 93, PT_BEZIERTO}, /* 128 */
1465  {-61, 85, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 129 */
1466  {119, -90, PT_MOVETO}, /* 130 */
1467  {119, -107, PT_BEZIERTO}, /* 131 */
1468  {106, -120, PT_BEZIERTO}, /* 132 */
1469  {90, -120, PT_BEZIERTO}, /* 133 */
1470  {73, -120, PT_BEZIERTO}, /* 134 */
1471  {60, -107, PT_BEZIERTO}, /* 135 */
1472  {60, -90, PT_BEZIERTO}, /* 136 */
1473  {60, -74, PT_BEZIERTO}, /* 137 */
1474  {73, -61, PT_BEZIERTO}, /* 138 */
1475  {90, -61, PT_BEZIERTO}, /* 139 */
1476  {106, -61, PT_BEZIERTO}, /* 140 */
1477  {119, -74, PT_BEZIERTO}, /* 141 */
1478  {119, -90, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 142 */
1479  {164, -128, PT_MOVETO}, /* 143 */
1480  {164, -140, PT_BEZIERTO}, /* 144 */
1481  {147, -150, PT_BEZIERTO}, /* 145 */
1482  {127, -150, PT_BEZIERTO}, /* 146 */
1483  {107, -150, PT_BEZIERTO}, /* 147 */
1484  {90, -140, PT_BEZIERTO}, /* 148 */
1485  {90, -128, PT_BEZIERTO}, /* 149 */
1486  {90, -116, PT_BEZIERTO}, /* 150 */
1487  {107, -106, PT_BEZIERTO}, /* 151 */
1488  {127, -106, PT_BEZIERTO}, /* 152 */
1489  {147, -106, PT_BEZIERTO}, /* 153 */
1490  {164, -116, PT_BEZIERTO}, /* 154 */
1491  {164, -128, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 155 */
1492  {-4, -5, PT_MOVETO}, /* 156 */
1493  {-4, -5, PT_BEZIERTO}, /* 157 */
1494  {-4, -6, PT_BEZIERTO}, /* 158 */
1495  {-5, -6, PT_BEZIERTO}, /* 159 */
1496  {-6, -6, PT_BEZIERTO}, /* 160 */
1497  {-6, -5, PT_BEZIERTO}, /* 161 */
1498  {-6, -5, PT_BEZIERTO}, /* 162 */
1499  {-6, -4, PT_BEZIERTO}, /* 163 */
1500  {-6, -4, PT_BEZIERTO}, /* 164 */
1501  {-5, -4, PT_BEZIERTO}, /* 165 */
1502  {-4, -4, PT_BEZIERTO}, /* 166 */
1503  {-4, -4, PT_BEZIERTO}, /* 167 */
1504  {-4, -5, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 168 */
1505  {40, 30, PT_MOVETO}, /* 169 */
1506  {40, 25, PT_BEZIERTO}, /* 170 */
1507  {36, 20, PT_BEZIERTO}, /* 171 */
1508  {30, 20, PT_BEZIERTO}, /* 172 */
1509  {24, 20, PT_BEZIERTO}, /* 173 */
1510  {20, 25, PT_BEZIERTO}, /* 174 */
1511  {20, 30, PT_BEZIERTO}, /* 175 */
1512  {20, 36, PT_BEZIERTO}, /* 176 */
1513  {24, 40, PT_BEZIERTO}, /* 177 */
1514  {30, 40, PT_BEZIERTO}, /* 178 */
1515  {36, 40, PT_BEZIERTO}, /* 179 */
1516  {40, 36, PT_BEZIERTO}, /* 180 */
1517  {40, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 181 */
1518  {55, 43, PT_MOVETO}, /* 182 */
1519  {55, 38, PT_BEZIERTO}, /* 183 */
1520  {49, 35, PT_BEZIERTO}, /* 184 */
1521  {43, 35, PT_BEZIERTO}, /* 185 */
1522  {36, 35, PT_BEZIERTO}, /* 186 */
1523  {30, 38, PT_BEZIERTO}, /* 187 */
1524  {30, 43, PT_BEZIERTO}, /* 188 */
1525  {30, 47, PT_BEZIERTO}, /* 189 */
1526  {36, 50, PT_BEZIERTO}, /* 190 */
1527  {43, 50, PT_BEZIERTO}, /* 191 */
1528  {49, 50, PT_BEZIERTO}, /* 192 */
1529  {55, 47, PT_BEZIERTO}, /* 193 */
1530  {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 194 */
1531  {60, 53, PT_MOVETO}, /* 195 */
1532  {60, 48, PT_BEZIERTO}, /* 196 */
1533  {54, 45, PT_BEZIERTO}, /* 197 */
1534  {48, 45, PT_BEZIERTO}, /* 198 */
1535  {41, 45, PT_BEZIERTO}, /* 199 */
1536  {35, 48, PT_BEZIERTO}, /* 200 */
1537  {35, 53, PT_BEZIERTO}, /* 201 */
1538  {35, 57, PT_BEZIERTO}, /* 202 */
1539  {41, 60, PT_BEZIERTO}, /* 203 */
1540  {48, 60, PT_BEZIERTO}, /* 204 */
1541  {54, 60, PT_BEZIERTO}, /* 205 */
1542  {60, 57, PT_BEZIERTO}, /* 206 */
1543  {60, 53, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 207 */
1544  {70, 70, PT_MOVETO}, /* 208 */
1545  {70, 70, PT_BEZIERTO}, /* 209 */
1546  {66, 70, PT_BEZIERTO}, /* 210 */
1547  {60, 70, PT_BEZIERTO}, /* 211 */
1548  {54, 70, PT_BEZIERTO}, /* 212 */
1549  {50, 70, PT_BEZIERTO}, /* 213 */
1550  {50, 70, PT_BEZIERTO}, /* 214 */
1551  {50, 70, PT_BEZIERTO}, /* 215 */
1552  {54, 70, PT_BEZIERTO}, /* 216 */
1553  {60, 70, PT_BEZIERTO}, /* 217 */
1554  {66, 70, PT_BEZIERTO}, /* 218 */
1555  {70, 70, PT_BEZIERTO}, /* 219 */
1556  {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 220 */
1557  {75, 80, PT_MOVETO}, /* 221 */
1558  {75, 77, PT_BEZIERTO}, /* 222 */
1559  {75, 75, PT_BEZIERTO}, /* 223 */
1560  {75, 75, PT_BEZIERTO}, /* 224 */
1561  {75, 75, PT_BEZIERTO}, /* 225 */
1562  {75, 77, PT_BEZIERTO}, /* 226 */
1563  {75, 80, PT_BEZIERTO}, /* 227 */
1564  {75, 83, PT_BEZIERTO}, /* 228 */
1565  {75, 85, PT_BEZIERTO}, /* 229 */
1566  {75, 85, PT_BEZIERTO}, /* 230 */
1567  {75, 85, PT_BEZIERTO}, /* 231 */
1568  {75, 83, PT_BEZIERTO}, /* 232 */
1569  {75, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 233 */
1570  {81, 81, PT_MOVETO}, /* 234 */
1571  {81, 80, PT_BEZIERTO}, /* 235 */
1572  {81, 80, PT_BEZIERTO}, /* 236 */
1573  {81, 80, PT_BEZIERTO}, /* 237 */
1574  {80, 80, PT_BEZIERTO}, /* 238 */
1575  {80, 80, PT_BEZIERTO}, /* 239 */
1576  {80, 81, PT_BEZIERTO}, /* 240 */
1577  {80, 81, PT_BEZIERTO}, /* 241 */
1578  {80, 81, PT_BEZIERTO}, /* 242 */
1579  {81, 81, PT_BEZIERTO}, /* 243 */
1580  {81, 81, PT_BEZIERTO}, /* 244 */
1581  {81, 81, PT_BEZIERTO}, /* 245 */
1582  {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 246 */
1583  {40, 30, PT_MOVETO}, /* 247 */
1584  {40, 36, PT_BEZIERTO}, /* 248 */
1585  {36, 40, PT_BEZIERTO}, /* 249 */
1586  {30, 40, PT_BEZIERTO}, /* 250 */
1587  {24, 40, PT_BEZIERTO}, /* 251 */
1588  {20, 36, PT_BEZIERTO}, /* 252 */
1589  {20, 30, PT_BEZIERTO}, /* 253 */
1590  {20, 24, PT_BEZIERTO}, /* 254 */
1591  {24, 20, PT_BEZIERTO}, /* 255 */
1592  {30, 20, PT_BEZIERTO}, /* 256 */
1593  {36, 20, PT_BEZIERTO}, /* 257 */
1594  {40, 24, PT_BEZIERTO}, /* 258 */
1595  {40, 30, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 259 */
1596  {55, 43, PT_MOVETO}, /* 260 */
1597  {55, 47, PT_BEZIERTO}, /* 261 */
1598  {49, 50, PT_BEZIERTO}, /* 262 */
1599  {43, 50, PT_BEZIERTO}, /* 263 */
1600  {36, 50, PT_BEZIERTO}, /* 264 */
1601  {30, 47, PT_BEZIERTO}, /* 265 */
1602  {30, 43, PT_BEZIERTO}, /* 266 */
1603  {30, 38, PT_BEZIERTO}, /* 267 */
1604  {36, 35, PT_BEZIERTO}, /* 268 */
1605  {43, 35, PT_BEZIERTO}, /* 269 */
1606  {49, 35, PT_BEZIERTO}, /* 270 */
1607  {55, 38, PT_BEZIERTO}, /* 271 */
1608  {55, 43, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 272 */
1609  {60, 53, PT_MOVETO}, /* 273 */
1610  {60, 57, PT_BEZIERTO}, /* 274 */
1611  {54, 60, PT_BEZIERTO}, /* 275 */
1612  {48, 60, PT_BEZIERTO}, /* 276 */
1613  {41, 60, PT_BEZIERTO}, /* 277 */
1614  {35, 57, PT_BEZIERTO}, /* 278 */
1615  {35, 53, PT_BEZIERTO}, /* 279 */
1616  {35, 48, PT_BEZIERTO}, /* 280 */
1617  {41, 45, PT_BEZIERTO}, /* 281 */
1618  {48, 45, PT_BEZIERTO}, /* 282 */
1619  {54, 45, PT_BEZIERTO}, /* 283 */
1620  {60, 48, PT_BEZIERTO}, /* 284 */
1621  {60, 53, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 285 */
1622  {70, 70, PT_MOVETO}, /* 286 */
1623  {70, 70, PT_BEZIERTO}, /* 287 */
1624  {66, 70, PT_BEZIERTO}, /* 288 */
1625  {60, 70, PT_BEZIERTO}, /* 289 */
1626  {54, 70, PT_BEZIERTO}, /* 290 */
1627  {50, 70, PT_BEZIERTO}, /* 291 */
1628  {50, 70, PT_BEZIERTO}, /* 292 */
1629  {50, 70, PT_BEZIERTO}, /* 293 */
1630  {54, 70, PT_BEZIERTO}, /* 294 */
1631  {60, 70, PT_BEZIERTO}, /* 295 */
1632  {66, 70, PT_BEZIERTO}, /* 296 */
1633  {70, 70, PT_BEZIERTO}, /* 297 */
1634  {70, 70, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 298 */
1635  {75, 80, PT_MOVETO}, /* 299 */
1636  {75, 83, PT_BEZIERTO}, /* 300 */
1637  {75, 85, PT_BEZIERTO}, /* 301 */
1638  {75, 85, PT_BEZIERTO}, /* 302 */
1639  {75, 85, PT_BEZIERTO}, /* 303 */
1640  {75, 83, PT_BEZIERTO}, /* 304 */
1641  {75, 80, PT_BEZIERTO}, /* 305 */
1642  {75, 77, PT_BEZIERTO}, /* 306 */
1643  {75, 75, PT_BEZIERTO}, /* 307 */
1644  {75, 75, PT_BEZIERTO}, /* 308 */
1645  {75, 75, PT_BEZIERTO}, /* 309 */
1646  {75, 77, PT_BEZIERTO}, /* 310 */
1647  {75, 80, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 311 */
1648  {81, 81, PT_MOVETO}, /* 312 */
1649  {81, 81, PT_BEZIERTO}, /* 313 */
1650  {81, 81, PT_BEZIERTO}, /* 314 */
1651  {81, 81, PT_BEZIERTO}, /* 315 */
1652  {80, 81, PT_BEZIERTO}, /* 316 */
1653  {80, 81, PT_BEZIERTO}, /* 317 */
1654  {80, 81, PT_BEZIERTO}, /* 318 */
1655  {80, 80, PT_BEZIERTO}, /* 319 */
1656  {80, 80, PT_BEZIERTO}, /* 320 */
1657  {81, 80, PT_BEZIERTO}, /* 321 */
1658  {81, 80, PT_BEZIERTO}, /* 322 */
1659  {81, 80, PT_BEZIERTO}, /* 323 */
1660  {81, 81, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 324 */
1661 };
1662 
1663 static void test_ellipse(void)
1664 {
1665  HDC hdc = GetDC( 0 );
1666 
1667  BeginPath( hdc );
1668  Ellipse( hdc, 20, 20, 40, 40 );
1669  Ellipse( hdc, 30, 50, 55, 35 );
1670  Ellipse( hdc, 60, 60, 35, 45 );
1671  Ellipse( hdc, 70, 70, 50, 70 );
1672  Ellipse( hdc, 75, 75, 75, 85 );
1673  Ellipse( hdc, 80, 80, 81, 81 );
1675  Ellipse( hdc, 20, 20, 40, 40 );
1676  Ellipse( hdc, 30, 50, 55, 35 );
1677  Ellipse( hdc, 60, 60, 35, 45 );
1678  Ellipse( hdc, 70, 70, 50, 70 );
1679  Ellipse( hdc, 75, 75, 75, 85 );
1680  Ellipse( hdc, 80, 80, 81, 81 );
1683  SetViewportExtEx( hdc, -2, 2, NULL );
1684  Ellipse( hdc, 20, 20, 40, 40 );
1685  Ellipse( hdc, 30, 50, 55, 35 );
1686  SetViewportExtEx( hdc, 3, -3, NULL );
1687  Ellipse( hdc, 20, 20, 40, 40 );
1688  Ellipse( hdc, 30, 50, 55, 35 );
1689  SetWindowExtEx( hdc, -20, 20, NULL );
1690  Ellipse( hdc, 20, 20, 40, 40 );
1691  Ellipse( hdc, 24, 22, 21, 20 );
1692  SetMapMode( hdc, MM_TEXT );
1694  Ellipse( hdc, 20, 20, 40, 40 );
1695  Ellipse( hdc, 30, 50, 55, 35 );
1696  Ellipse( hdc, 60, 60, 35, 45 );
1697  Ellipse( hdc, 70, 70, 50, 70 );
1698  Ellipse( hdc, 75, 75, 75, 85 );
1699  Ellipse( hdc, 80, 80, 81, 81 );
1701  Ellipse( hdc, 20, 20, 40, 40 );
1702  Ellipse( hdc, 30, 50, 55, 35 );
1703  Ellipse( hdc, 60, 60, 35, 45 );
1704  Ellipse( hdc, 70, 70, 50, 70 );
1705  Ellipse( hdc, 75, 75, 75, 85 );
1706  Ellipse( hdc, 80, 80, 81, 81 );
1708  EndPath( hdc );
1709  SetMapMode( hdc, MM_TEXT );
1710  ok_path( hdc, "ellipse_path", ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t) );
1711 }
1712 
1713 static const path_test_t all_funcs_path[] =
1714 {
1715  {0, 0, PT_MOVETO}, /* 0 */
1716  {50, 150, PT_LINETO}, /* 1 */
1717  {50, 50, PT_MOVETO}, /* 2 */
1718  {150, 150, PT_LINETO}, /* 3 */
1719  {150, 50, PT_LINETO}, /* 4 */
1720  {50, 50, PT_LINETO}, /* 5 */
1721  {37, 13, PT_LINETO}, /* 6 */
1722  {24, 13, PT_BEZIERTO}, /* 7 */
1723  {14, 23, PT_BEZIERTO}, /* 8 */
1724  {14, 36, PT_BEZIERTO}, /* 9 */
1725  {14, 49, PT_BEZIERTO}, /* 10 */
1726  {24, 59, PT_BEZIERTO}, /* 11 */
1727  {37, 59, PT_BEZIERTO}, /* 12 */
1728  {37, 59, PT_BEZIERTO}, /* 13 */
1729  {37, 59, PT_BEZIERTO}, /* 14 */
1730  {37, 59, PT_BEZIERTO}, /* 15 */
1731  {10, 10, PT_MOVETO}, /* 16 */
1732  {20, 10, PT_LINETO}, /* 17 */
1733  {10, 20, PT_LINETO}, /* 18 */
1734  {20, 20, PT_LINETO}, /* 19 */
1735  {36, 27, PT_MOVETO}, /* 20 */
1736  {37, 26, PT_BEZIERTO}, /* 21 */
1737  {38, 25, PT_BEZIERTO}, /* 22 */
1738  {38, 25, PT_BEZIERTO}, /* 23 */
1739  {38, 23, PT_BEZIERTO}, /* 24 */
1740  {34, 21, PT_BEZIERTO}, /* 25 */
1741  {30, 21, PT_BEZIERTO}, /* 26 */
1742  {27, 21, PT_BEZIERTO}, /* 27 */
1743  {25, 21, PT_BEZIERTO}, /* 28 */
1744  {24, 22, PT_BEZIERTO}, /* 29 */
1745  {37, 59, PT_MOVETO}, /* 30 */
1746  {10, 10, PT_LINETO}, /* 31 */
1747  {20, 10, PT_LINETO}, /* 32 */
1748  {10, 20, PT_LINETO}, /* 33 */
1749  {20, 20, PT_LINETO}, /* 34 */
1750  {34, 26, PT_LINETO}, /* 35 */
1751  {35, 25, PT_BEZIERTO}, /* 36 */
1752  {36, 25, PT_BEZIERTO}, /* 37 */
1753  {36, 25, PT_BEZIERTO}, /* 38 */
1754  {36, 24, PT_BEZIERTO}, /* 39 */
1755  {33, 23, PT_BEZIERTO}, /* 40 */
1756  {30, 23, PT_BEZIERTO}, /* 41 */
1757  {28, 23, PT_BEZIERTO}, /* 42 */
1758  {26, 23, PT_BEZIERTO}, /* 43 */
1759  {25, 23, PT_BEZIERTO}, /* 44 */
1760  {10, 10, PT_MOVETO}, /* 45 */
1761  {20, 10, PT_LINETO}, /* 46 */
1762  {10, 20, PT_LINETO}, /* 47 */
1763  {20, 20, PT_LINETO}, /* 48 */
1764  {30, 30, PT_MOVETO}, /* 49 */
1765  {40, 20, PT_LINETO}, /* 50 */
1766  {20, 30, PT_LINETO}, /* 51 */
1767  {30, 40, PT_LINETO}, /* 52 */
1768  {10, 50, PT_LINETO}, /* 53 */
1769  {45, 45, PT_MOVETO}, /* 54 */
1770  {45, 45, PT_BEZIERTO}, /* 55 */
1771  {44, 46, PT_BEZIERTO}, /* 56 */
1772  {43, 47, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 57 */
1773  {10, 10, PT_MOVETO}, /* 58 */
1774  {20, 10, PT_LINETO}, /* 59 */
1775  {10, 20, PT_BEZIERTO}, /* 60 */
1776  {20, 20, PT_BEZIERTO}, /* 61 */
1777  {30, 30, PT_BEZIERTO}, /* 62 */
1778  {40, 20, PT_LINETO}, /* 63 */
1779  {20, 30, PT_LINETO | PT_CLOSEFIGURE}, /* 64 */
1780  {30, 40, PT_MOVETO}, /* 65 */
1781  {10, 50, PT_LINETO}, /* 66 */
1782  {55, 55, PT_MOVETO}, /* 67 */
1783  {54, 55, PT_BEZIERTO}, /* 68 */
1784  {54, 56, PT_BEZIERTO}, /* 69 */
1785  {54, 56, PT_BEZIERTO}, /* 70 */
1786  {58, 61, PT_LINETO | PT_CLOSEFIGURE}, /* 71 */
1787  {10, 10, PT_MOVETO}, /* 72 */
1788  {20, 10, PT_LINETO}, /* 73 */
1789  {10, 20, PT_LINETO}, /* 74 */
1790  {20, 20, PT_LINETO}, /* 75 */
1791  {30, 30, PT_LINETO}, /* 76 */
1792  {40, 20, PT_LINETO}, /* 77 */
1793  {20, 30, PT_LINETO}, /* 78 */
1794  {30, 40, PT_LINETO}, /* 79 */
1795  {10, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 80 */
1796  {43, 49, PT_MOVETO}, /* 81 */
1797  {43, 40, PT_BEZIERTO}, /* 82 */
1798  {38, 33, PT_BEZIERTO}, /* 83 */
1799  {33, 33, PT_BEZIERTO}, /* 84 */
1800  {27, 33, PT_BEZIERTO}, /* 85 */
1801  {22, 40, PT_BEZIERTO}, /* 86 */
1802  {22, 49, PT_BEZIERTO}, /* 87 */
1803  {22, 58, PT_BEZIERTO}, /* 88 */
1804  {27, 65, PT_BEZIERTO}, /* 89 */
1805  {33, 65, PT_BEZIERTO}, /* 90 */
1806  {38, 65, PT_BEZIERTO}, /* 91 */
1807  {43, 58, PT_BEZIERTO}, /* 92 */
1808  {43, 49, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 93 */
1809  {79, 70, PT_MOVETO}, /* 94 */
1810  {60, 70, PT_LINETO}, /* 95 */
1811  {60, 89, PT_LINETO}, /* 96 */
1812  {79, 89, PT_LINETO | PT_CLOSEFIGURE}, /* 97 */
1813  {199, 122, PT_MOVETO}, /* 98 */
1814  {199, 110, PT_BEZIERTO}, /* 99 */
1815  {191, 100, PT_BEZIERTO}, /* 100 */
1816  {182, 100, PT_BEZIERTO}, /* 101 */
1817  {117, 100, PT_LINETO}, /* 102 */
1818  {108, 100, PT_BEZIERTO}, /* 103 */
1819  {100, 110, PT_BEZIERTO}, /* 104 */
1820  {100, 122, PT_BEZIERTO}, /* 105 */
1821  {100, 177, PT_LINETO}, /* 106 */
1822  {100, 189, PT_BEZIERTO}, /* 107 */
1823  {108, 199, PT_BEZIERTO}, /* 108 */
1824  {117, 199, PT_BEZIERTO}, /* 109 */
1825  {182, 199, PT_LINETO}, /* 110 */
1826  {191, 199, PT_BEZIERTO}, /* 111 */
1827  {199, 189, PT_BEZIERTO}, /* 112 */
1828  {199, 177, PT_BEZIERTO | PT_CLOSEFIGURE}, /* 113 */
1829  {10, 10, PT_MOVETO}, /* 114 */
1830  {20, 10, PT_BEZIERTO}, /* 115 */
1831  {10, 20, PT_BEZIERTO}, /* 116 */
1832  {20, 20, PT_BEZIERTO}, /* 117 */
1833  {30, 30, PT_BEZIERTO}, /* 118 */
1834  {40, 20, PT_BEZIERTO}, /* 119 */
1835  {20, 30, PT_BEZIERTO}, /* 120 */
1836  {10, 10, PT_MOVETO}, /* 121 */
1837  {20, 10, PT_LINETO}, /* 122 */
1838  {10, 20, PT_LINETO}, /* 123 */
1839  {20, 20, PT_LINETO | PT_CLOSEFIGURE}, /* 124 */
1840  {30, 30, PT_MOVETO}, /* 125 */
1841  {40, 20, PT_LINETO}, /* 126 */
1842  {20, 30, PT_LINETO}, /* 127 */
1843  {30, 40, PT_LINETO}, /* 128 */
1844  {10, 50, PT_LINETO | PT_CLOSEFIGURE}, /* 129 */
1845  {10, 50, PT_MOVETO}, /* 130 */
1846  {10, 10, PT_BEZIERTO}, /* 131 */
1847  {20, 10, PT_BEZIERTO}, /* 132 */
1848  {10, 20, PT_BEZIERTO}, /* 133 */
1849  {20, 20, PT_BEZIERTO}, /* 134 */
1850  {30, 30, PT_BEZIERTO}, /* 135 */
1851  {40, 20, PT_BEZIERTO}, /* 136 */
1852  {20, 30, PT_BEZIERTO}, /* 137 */
1853  {30, 40, PT_BEZIERTO}, /* 138 */
1854  {10, 50, PT_BEZIERTO}, /* 139 */
1855  {150, 150, PT_LINETO}, /* 140 */
1856 };
1857 
1858 /* run once through all functions that support paths */
1859 static void test_all_functions(void)
1860 {
1861  POINT pts[9] = {{10, 10}, {20, 10}, {10, 20}, {20, 20}, {30, 30}, {40, 20},
1862  {20, 30}, {30, 40}, {10, 50}};
1863  DWORD counts[5] = {4, 5, 0, 1, 2};
1866  HDC hdc = GetDC( 0 );
1867 
1868  BeginPath( hdc );
1869  LineTo( hdc, 50, 150 );
1870  MoveToEx( hdc, 50, 50, NULL );
1871  LineTo( hdc, 150, 150 );
1872  LineTo( hdc, 150, 50 );
1873  LineTo( hdc, 50, 50 );
1874  AngleArc( hdc, 37, 36, 23, 90, 180 );
1875  Polyline( hdc, pts, 4 );
1876  Arc( hdc, 21, 21, 39, 29, 39, 29, 21, 21 );
1877  PolylineTo( hdc, pts, 4 );
1878  ArcTo( hdc, 23, 23, 37, 27, 37, 27, 23, 23 );
1879  PolyPolyline( hdc, pts, counts, 2 );
1880  Chord( hdc, 42, 43, 57, 66, 39, 29, 21, 21 );
1881  PolyDraw( hdc, pts, types, 9 );
1882  Pie( hdc, 52, 54, 65, 68, 39, 29, 21, 21 );
1883  Polygon( hdc, pts, 9 );
1884  Ellipse( hdc, 22, 33, 44, 66 );
1885  Rectangle( hdc, 60, 70, 80, 90 );
1886  RoundRect( hdc, 100, 100, 200, 200, 35, 45 );
1887  PolyBezier( hdc, pts, 7 );
1888  PolyPolygon( hdc, pts, (int *)counts, 2 );
1889  PolyBezierTo( hdc, pts, 9 );
1890  LineTo( hdc, 150, 150 );
1891  /* FIXME: ExtTextOut */
1892  EndPath( hdc );
1893  ok_path( hdc, "all_funcs_path", all_funcs_path, sizeof(all_funcs_path)/sizeof(path_test_t) );
1894  ReleaseDC( 0, hdc );
1895 }
1896 
1898 {
1899  test_path_state();
1900  test_widenpath();
1901  test_arcto();
1902  test_anglearc();
1903  test_polydraw();
1904  test_closefigure();
1905  test_linedda();
1906  test_rectangle();
1907  test_roundrect();
1908  test_ellipse();
1910 }
BOOL WINAPI PolyDraw(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_reads_(cpt) const BYTE *aj, _In_ int cpt)
BOOL WINAPI GetCurrentPositionEx(_In_ HDC, _Out_ LPPOINT)
Definition: coord.c:241
#define TRUE
Definition: types.h:120
BOOL WINAPI SelectClipPath(HDC hdc, int iMode)
Definition: path.c:191
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
static const path_test_t anglearc_path[]
Definition: path.c:503
BOOL WINAPI SetWindowExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
BITMAPINFOHEADER bmiHeader
Definition: wingdi.h:1471
START_TEST(path)
Definition: path.c:1897
long y
Definition: polytest.cpp:48
static void test_polydraw(void)
Definition: path.c:605
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
static const path_test_t all_funcs_path[]
Definition: path.c:1713
long x
Definition: polytest.cpp:48
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI Rectangle(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
static void test_widenpath(void)
Definition: path.c:311
#define pt(x, y)
Definition: drawing.c:79
BOOL WINAPI StrokeAndFillPath(HDC hdc)
Definition: path.c:153
static const path_test_t arcto_path[]
Definition: path.c:455
static void test_ellipse(void)
Definition: path.c:1663
*nSize LPSTR _Inout_ LPDWORD nSize
Definition: winbase.h:2024
static const path_test_t polydraw_path[]
Definition: path.c:548
static HDC
Definition: imagelist.c:92
GLsizei GLenum GLenum * types
Definition: glext.h:7753
BOOL WINAPI CloseFigure(HDC hdc)
Definition: path.c:43
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define assert(x)
Definition: debug.h:53
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
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 LineTo(_In_ HDC, _In_ int, _In_ int)
static const path_test_t ellipse_path[]
Definition: path.c:1334
GLuint buffer
Definition: glext.h:5915
GLint GLint GLint GLint GLint x
Definition: gl.h:1548
static void test_closefigure(void)
Definition: path.c:691
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
BOOL WINAPI PolylineTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:354
static void test_rectangle(void)
Definition: path.c:922
#define expect(expected, got)
Definition: path.c:34
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_linedda(void)
Definition: path.c:747
BYTE type
Definition: path.c:383
GLenum GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * bits
Definition: glext.h:10929
int winetest_debug
int32_t INT
Definition: typedefs.h:56
DWORD ret
Definition: path.c:47
#define AD_COUNTERCLOCKWISE
Definition: wingdi.h:666
BOOL WINAPI BeginPath(HDC hdc)
Definition: path.c:31
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
#define PS_SOLID
Definition: wingdi.h:585
static const path_test_t roundrect_path[]
Definition: path.c:973
static BYTE polydraw_tps[]
Definition: path.c:594
BOOL WINAPI PolyBezierTo(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:281
BOOL WINAPI RoundRect(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
unsigned int BOOL
Definition: ntddk_ex.h:94
int WINAPI SetMapMode(_In_ HDC, _In_ int)
BOOL WINAPI Arc(_In_ HDC hdc, _In_ INT xLeft, _In_ INT yTop, _In_ INT xRight, _In_ INT yBottom, _In_ INT xStartArc, _In_ INT yStartArc, _In_ INT xEndArc, _In_ INT yEndArc)
Definition: arc.c:5
#define ERROR_CAN_NOT_COMPLETE
Definition: winerror.h:582
static UINT WPARAM LPARAM lparam
Definition: combo.c:716
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
DWORD biCompression
Definition: amvideo.idl:35
unsigned int idx
Definition: utils.c:41
static void test_roundrect(void)
Definition: path.c:1289
smooth NULL
Definition: ftsmooth.c:416
#define RGN_OR
Definition: wingdi.h:358
LONG_PTR LPARAM
Definition: windef.h:208
#define AD_CLOCKWISE
Definition: wingdi.h:667
static void test_all_functions(void)
Definition: path.c:1859
int WINAPI SetArcDirection(_In_ HDC, _In_ int)
BOOL WINAPI PolyPolygon(_In_ HDC hdc, _In_ const POINT *apt, _In_reads_(csz) const INT *asz, _In_ int csz)
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: cmds.c:130
BOOL WINAPI Pie(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int, _In_ int)
BOOL WINAPI WidenPath(HDC hdc)
Definition: path.c:179
INT WINAPI GetPath(HDC hdc, LPPOINT pptlBuf, LPBYTE pjTypes, INT cptBuf)
Definition: path.c:95
static char * path_name(DOS_FILE *file)
Definition: check.c:208
HRGN WINAPI PathToRegion(HDC hdc)
Definition: path.c:120
#define RGB(r, g, b)
Definition: wingdi.h:2935
#define WINAPI
Definition: msvc.h:8
BOOL WINAPI FillPath(HDC hdc)
Definition: path.c:69
unsigned long DWORD
Definition: ntddk_ex.h:95
#define SetLastError(x)
Definition: compat.h:409
BOOL WINAPI StrokePath(HDC hdc)
Definition: path.c:166
HDC hdc
Definition: main.c:9
#define MM_ANISOTROPIC
Definition: wingdi.h:866
BOOL WINAPI LineDDA(_In_ int, _In_ int, _In_ int, _In_ int, _In_ LINEDDAPROC, _In_opt_ LPARAM)
unsigned char BYTE
Definition: mem.h:68
BOOL WINAPI PolyPolyline(_In_ HDC hdc, _In_ const POINT *apt, _In_reads_(csz) const DWORD *asz, _In_ DWORD csz)
#define broken(x)
Definition: _sntprintf.h:21
BOOL WINAPI EndPath(HDC hdc)
Definition: path.c:56
static POINT polydraw_pts[]
Definition: path.c:583
static void test_anglearc(void)
Definition: path.c:528
BOOL WINAPI DeleteDC(_In_ HDC)
BOOL WINAPI Ellipse(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int)
HBITMAP WINAPI CreateDIBSection(HDC hDC, CONST BITMAPINFO *BitmapInfo, UINT Usage, VOID **Bits, HANDLE hSection, DWORD dwOffset)
Definition: bitmap.c:197
#define ok(value,...)
Definition: atltest.h:57
Definition: services.c:325
#define min(a, b)
Definition: monoChain.cc:55
int WINAPI SaveDC(_In_ HDC)
static const BYTE dib[]
Definition: ole2.c:201
static void test_arcto(void)
Definition: path.c:480
GLint GLint GLint GLint GLint GLint y
Definition: gl.h:1548
BOOL WINAPI PolyBezier(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ DWORD cpt)
Definition: painting.c:263
static void WINAPI linedda_callback(INT x, INT y, LPARAM lparam)
Definition: path.c:737
BOOL WINAPI FlattenPath(HDC hdc)
Definition: path.c:82
#define MM_TEXT
Definition: wingdi.h:872
#define PT_CLOSEFIGURE
Definition: wingdi.h:886
#define PT_LINETO
Definition: wingdi.h:884
BOOL WINAPI Polyline(_In_ HDC hdc, _In_reads_(cpt) const POINT *apt, _In_ int cpt)
#define PT_MOVETO
Definition: wingdi.h:883
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static HBITMAP
Definition: button.c:44
BOOL WINAPI SetViewportExtEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPSIZE)
Definition: coord.c:465
#define PT_BEZIERTO
Definition: wingdi.h:885
static void test_path_state(void)
Definition: path.c:36
#define DIB_RGB_COLORS
Definition: wingdi.h:366
int y
Definition: path.c:382
#define memset(x, y, z)
Definition: compat.h:39
int WINAPI SetGraphicsMode(_In_ HDC, _In_ int)
Definition: dc.c:1202
BOOL WINAPI RestoreDC(_In_ HDC, _In_ int)
#define win_skip
Definition: test.h:141
#define BI_RGB
Definition: precomp.h:34
#define HeapFree(x, y, z)
Definition: compat.h:394
static const path_test_t rectangle_path[]
Definition: path.c:818
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 AbortPath(HDC hdc)
Definition: path.c:18
BOOL expected
Definition: store.c:2063
#define printf
Definition: config.h:203
struct tagBITMAPINFO BITMAPINFO
#define GM_ADVANCED
Definition: wingdi.h:864
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