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