Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: tests/PathOpsOpTest.cpp

Issue 16195004: add asserts to point<-->verb helpers (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/PathOpsAngleTest.cpp ('k') | tests/PathOpsSimplifyTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2012 Google Inc. 2 * Copyright 2012 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 #include "PathOpsExtendedTest.h" 7 #include "PathOpsExtendedTest.h"
8 8
9 #define TEST(name) { name, #name } 9 #define TEST(name) { name, #name }
10 10
(...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after
1137 SkPath path, pathB; 1137 SkPath path, pathB;
1138 path.moveTo(1,3); 1138 path.moveTo(1,3);
1139 path.cubicTo(0,1, 3,1, 2,0); 1139 path.cubicTo(0,1, 3,1, 2,0);
1140 path.close(); 1140 path.close();
1141 pathB.moveTo(1,3); 1141 pathB.moveTo(1,3);
1142 pathB.cubicTo(0,2, 3,1, 1,0); 1142 pathB.cubicTo(0,2, 3,1, 1,0);
1143 pathB.close(); 1143 pathB.close();
1144 testPathOp(reporter, path, pathB, kDifference_PathOp); 1144 testPathOp(reporter, path, pathB, kDifference_PathOp);
1145 } 1145 }
1146 1146
1147
1147 SkPathOp ops[] = { 1148 SkPathOp ops[] = {
1148 kUnion_PathOp, 1149 kUnion_PathOp,
1149 kXOR_PathOp, 1150 kXOR_PathOp,
1150 kReverseDifference_PathOp, 1151 kReverseDifference_PathOp,
1151 kXOR_PathOp, 1152 kXOR_PathOp,
1152 kReverseDifference_PathOp, 1153 kReverseDifference_PathOp,
1153 }; 1154 };
1154 1155
1155 static void rRect1(skiatest::Reporter* reporter) { 1156 static void rRect1(skiatest::Reporter* reporter) {
1156 SkScalar xA = SkFloatToScalar(0.65f); 1157 SkScalar xA = SkFloatToScalar(0.65f);
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 path.moveTo(0,1); 1337 path.moveTo(0,1);
1337 path.cubicTo(0,5, 4,0, 5,0); 1338 path.cubicTo(0,5, 4,0, 5,0);
1338 path.close(); 1339 path.close();
1339 pathB.setFillType(SkPath::kWinding_FillType); 1340 pathB.setFillType(SkPath::kWinding_FillType);
1340 pathB.moveTo(0,4); 1341 pathB.moveTo(0,4);
1341 pathB.cubicTo(0,5, 1,0, 5,0); 1342 pathB.cubicTo(0,5, 1,0, 5,0);
1342 pathB.close(); 1343 pathB.close();
1343 testPathOp(reporter, path, pathB, kDifference_PathOp); 1344 testPathOp(reporter, path, pathB, kDifference_PathOp);
1344 } 1345 }
1345 1346
1346 static void (*firstTest)(skiatest::Reporter* ) = 0; 1347 static void cubicOp71d(skiatest::Reporter* reporter) {
1348 SkPath path, pathB;
1349 path.setFillType(SkPath::kWinding_FillType);
1350 path.moveTo(0,1);
1351 path.cubicTo(0,5, 4,1, 6,4);
1352 path.close();
1353 pathB.setFillType(SkPath::kWinding_FillType);
1354 pathB.moveTo(1,4);
1355 pathB.cubicTo(4,6, 1,0, 5,0);
1356 pathB.close();
1357 testPathOp(reporter, path, pathB, kDifference_PathOp);
1358 }
1359
1360 static void cubicOp72i(skiatest::Reporter* reporter) {
1361 SkPath path, pathB;
1362 path.setFillType(SkPath::kWinding_FillType);
1363 path.moveTo(0,1);
1364 path.cubicTo(0,5, 5,2, 5,4);
1365 path.close();
1366 pathB.setFillType(SkPath::kWinding_FillType);
1367 pathB.moveTo(2,5);
1368 pathB.cubicTo(4,5, 1,0, 5,0);
1369 pathB.close();
1370 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1371 }
1372
1373 static void cubicOp73d(skiatest::Reporter* reporter) {
1374 SkPath path, pathB;
1375 path.setFillType(SkPath::kWinding_FillType);
1376 path.moveTo(0,1);
1377 path.cubicTo(3,4, 4,0, 6,4);
1378 path.lineTo(0,1);
1379 path.close();
1380 pathB.setFillType(SkPath::kWinding_FillType);
1381 pathB.moveTo(0,4);
1382 pathB.cubicTo(4,6, 1,0, 4,3);
1383 pathB.lineTo(0,4);
1384 pathB.close();
1385 testPathOp(reporter, path, pathB, kDifference_PathOp);
1386 }
1387
1388 static void cubicOp75d(skiatest::Reporter* reporter) {
1389 SkPath path, pathB;
1390 path.setFillType(SkPath::kWinding_FillType);
1391 path.moveTo(0,1);
1392 path.cubicTo(0,4, 5,1, 6,4);
1393 path.lineTo(0,1);
1394 path.close();
1395 pathB.setFillType(SkPath::kWinding_FillType);
1396 pathB.moveTo(1,5);
1397 pathB.cubicTo(4,6, 1,0, 4,0);
1398 pathB.lineTo(1,5);
1399 pathB.close();
1400 testPathOp(reporter, path, pathB, kDifference_PathOp);
1401 }
1402
1403 static void cubicOp77i(skiatest::Reporter* reporter) {
1404 SkPath path, pathB;
1405 path.setFillType(SkPath::kEvenOdd_FillType);
1406 path.moveTo(0,1);
1407 path.cubicTo(1,3, 2,0, 3,2);
1408 path.lineTo(0,1);
1409 path.close();
1410 pathB.setFillType(SkPath::kEvenOdd_FillType);
1411 pathB.moveTo(0,2);
1412 pathB.cubicTo(2,3, 1,0, 3,1);
1413 pathB.lineTo(0,2);
1414 pathB.close();
1415 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1416 }
1417
1418 static void cubicOp78u(skiatest::Reporter* reporter) {
1419 SkPath path, pathB;
1420 path.setFillType(SkPath::kEvenOdd_FillType);
1421 path.moveTo(1,6);
1422 path.cubicTo(1,6, 5,0, 6,1);
1423 path.lineTo(1,6);
1424 path.close();
1425 pathB.setFillType(SkPath::kEvenOdd_FillType);
1426 pathB.moveTo(0,5);
1427 pathB.cubicTo(1,6, 6,1, 6,1);
1428 pathB.lineTo(0,5);
1429 pathB.close();
1430 testPathOp(reporter, path, pathB, kUnion_PathOp);
1431 }
1432
1433 static void cubicOp79d(skiatest::Reporter* reporter) {
1434 SkPath path, pathB;
1435 path.setFillType(SkPath::kWinding_FillType);
1436 path.moveTo(0,2);
1437 path.cubicTo(0,1, 3,-0.1f, 1,0);
1438 path.close();
1439 pathB.setFillType(SkPath::kWinding_FillType);
1440 pathB.moveTo(0,3);
1441 pathB.cubicTo(0,1, 2,0, 1,0);
1442 pathB.close();
1443 testPathOp(reporter, path, pathB, kDifference_PathOp);
1444 }
1445
1446 static void cubicOp79u(skiatest::Reporter* reporter) {
1447 SkPath path, pathB;
1448 path.setFillType(SkPath::kWinding_FillType);
1449 path.moveTo(0,1);
1450 path.cubicTo(1,3, 1,0, 6,4);
1451 path.close();
1452 pathB.setFillType(SkPath::kWinding_FillType);
1453 pathB.moveTo(0,1);
1454 pathB.cubicTo(4,6, 1,0, 3,1);
1455 pathB.close();
1456 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1457 }
1458
1459 static void cubicOp80i(skiatest::Reporter* reporter) {
1460 SkPath path, pathB;
1461 path.setFillType(SkPath::kWinding_FillType);
1462 path.moveTo(0,1);
1463 path.cubicTo(2,3, 2,1, 4,3);
1464 path.lineTo(0,1);
1465 path.close();
1466 pathB.setFillType(SkPath::kWinding_FillType);
1467 pathB.moveTo(1,2);
1468 pathB.cubicTo(3,4, 1,0, 3,2);
1469 pathB.lineTo(1,2);
1470 pathB.close();
1471 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1472 }
1473
1474 static void cubicOp82i(skiatest::Reporter* reporter) {
1475 SkPath path, pathB;
1476 path.setFillType(SkPath::kEvenOdd_FillType);
1477 path.moveTo(0,1);
1478 path.cubicTo(2,3, 5,2, 3,0);
1479 path.lineTo(0,1);
1480 path.close();
1481 pathB.setFillType(SkPath::kWinding_FillType);
1482 pathB.moveTo(2,5);
1483 pathB.cubicTo(0,3, 1,0, 3,2);
1484 pathB.lineTo(2,5);
1485 pathB.close();
1486 testPathOp(reporter, path, pathB, kIntersect_PathOp);
1487 }
1488
1489 static void cubicOp81d(skiatest::Reporter* reporter) {
1490 SkPath path, pathB;
1491 path.setFillType(SkPath::kWinding_FillType);
1492 path.moveTo(0,1);
1493 path.cubicTo(4,6, 4,3, 5,4);
1494 path.close();
1495 pathB.setFillType(SkPath::kWinding_FillType);
1496 pathB.moveTo(3,4);
1497 pathB.cubicTo(4,5, 1,0, 6,4);
1498 pathB.close();
1499 testPathOp(reporter, path, pathB, kDifference_PathOp);
1500 }
1501
1502 static void (*firstTest)(skiatest::Reporter* ) = cubicOp81d;
1347 1503
1348 static struct TestDesc tests[] = { 1504 static struct TestDesc tests[] = {
1505 TEST(cubicOp82i),
1506 TEST(cubicOp81d),
1507 TEST(cubicOp80i),
1508 TEST(cubicOp79u),
1509 TEST(cubicOp79d),
1510 TEST(cubicOp78u),
1511 TEST(cubicOp77i),
1512 TEST(cubicOp75d),
1513 TEST(cubicOp73d),
1514 TEST(cubicOp72i),
1515 TEST(cubicOp71d),
1349 TEST(skp5), 1516 TEST(skp5),
1350 TEST(skp4), 1517 TEST(skp4),
1351 TEST(skp3), 1518 TEST(skp3),
1352 TEST(skp2), 1519 TEST(skp2),
1353 TEST(skp1), 1520 TEST(skp1),
1354 TEST(rRect1), 1521 TEST(rRect1),
1355 TEST(cubicOp70d), 1522 TEST(cubicOp70d),
1356 TEST(cubicOp69d), 1523 TEST(cubicOp69d),
1357 TEST(cubicOp68u), 1524 TEST(cubicOp68u),
1358 TEST(cubicOp67u), 1525 TEST(cubicOp67u),
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1479 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse); 1646 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run Reverse);
1480 } 1647 }
1481 #ifdef SK_DEBUG 1648 #ifdef SK_DEBUG
1482 gDebugMaxWindSum = SK_MaxS32; 1649 gDebugMaxWindSum = SK_MaxS32;
1483 gDebugMaxWindValue = SK_MaxS32; 1650 gDebugMaxWindValue = SK_MaxS32;
1484 #endif 1651 #endif
1485 } 1652 }
1486 1653
1487 #include "TestClassDef.h" 1654 #include "TestClassDef.h"
1488 DEFINE_TESTCLASS_SHORT(PathOpsOpTest) 1655 DEFINE_TESTCLASS_SHORT(PathOpsOpTest)
OLDNEW
« no previous file with comments | « tests/PathOpsAngleTest.cpp ('k') | tests/PathOpsSimplifyTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698