| OLD | NEW |
| 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 3631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3642 path.lineTo(1, 0); | 3642 path.lineTo(1, 0); |
| 3643 path.lineTo(3, 3); | 3643 path.lineTo(3, 3); |
| 3644 path.close(); | 3644 path.close(); |
| 3645 path.moveTo(1, 1); | 3645 path.moveTo(1, 1); |
| 3646 path.lineTo(2, 3); | 3646 path.lineTo(2, 3); |
| 3647 path.lineTo(1, 2); | 3647 path.lineTo(1, 2); |
| 3648 path.close(); | 3648 path.close(); |
| 3649 testSimplify(reporter, path, filename); | 3649 testSimplify(reporter, path, filename); |
| 3650 } | 3650 } |
| 3651 | 3651 |
| 3652 // A test this for this case: | 3652 // A test for this case: |
| 3653 // contourA has two segments that are coincident | 3653 // contourA has two segments that are coincident |
| 3654 // contourB has two segments that are coincident in the same place | 3654 // contourB has two segments that are coincident in the same place |
| 3655 // each ends up with +2/0 pairs for winding count | 3655 // each ends up with +2/0 pairs for winding count |
| 3656 // since logic in OpSegment::addTCoincident doesn't transfer count (only increme
nts/decrements) | 3656 // since logic in OpSegment::addTCoincident doesn't transfer count (only increme
nts/decrements) |
| 3657 // can this be resolved to +4/0 ? | 3657 // can this be resolved to +4/0 ? |
| 3658 static void testAddTCoincident1(skiatest::Reporter* reporter, const char* filena
me) { | 3658 static void testAddTCoincident1(skiatest::Reporter* reporter, const char* filena
me) { |
| 3659 SkPath path; | 3659 SkPath path; |
| 3660 path.moveTo(2, 0); | 3660 path.moveTo(2, 0); |
| 3661 path.lineTo(2, 2); | 3661 path.lineTo(2, 2); |
| 3662 path.lineTo(1, 1); | 3662 path.lineTo(1, 1); |
| (...skipping 836 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4499 path.quadTo(3, 0, 2, 1); | 4499 path.quadTo(3, 0, 2, 1); |
| 4500 path.lineTo(3, 2); | 4500 path.lineTo(3, 2); |
| 4501 path.close(); | 4501 path.close(); |
| 4502 path.moveTo(3, 0); | 4502 path.moveTo(3, 0); |
| 4503 path.lineTo(2, 2); | 4503 path.lineTo(2, 2); |
| 4504 path.quadTo(0, 3, 0, 3); | 4504 path.quadTo(0, 3, 0, 3); |
| 4505 path.close(); | 4505 path.close(); |
| 4506 testSimplify(reporter, path, filename); | 4506 testSimplify(reporter, path, filename); |
| 4507 } | 4507 } |
| 4508 | 4508 |
| 4509 // this fails because there is a short unorderable segment and the unordered sta
te isn't handled | |
| 4510 // correctly later on. | |
| 4511 static void testQuads46x(skiatest::Reporter* reporter, const char* filename) { | 4509 static void testQuads46x(skiatest::Reporter* reporter, const char* filename) { |
| 4512 SkPath path; | 4510 SkPath path; |
| 4513 path.setFillType(SkPath::kEvenOdd_FillType); | 4511 path.setFillType(SkPath::kEvenOdd_FillType); |
| 4514 path.moveTo(2, 0); | 4512 path.moveTo(2, 0); |
| 4515 path.quadTo(0, 1, 3, 2); | 4513 path.quadTo(0, 1, 3, 2); |
| 4516 path.lineTo(1, 3); | 4514 path.lineTo(1, 3); |
| 4517 path.close(); | 4515 path.close(); |
| 4518 path.moveTo(0, 0); | 4516 path.moveTo(0, 0); |
| 4519 path.lineTo(1, 1); | 4517 path.lineTo(1, 1); |
| 4520 path.quadTo(3, 2, 1, 3); | 4518 path.quadTo(3, 2, 1, 3); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4672 static void testRect3(skiatest::Reporter* reporter, const char* filename) { | 4670 static void testRect3(skiatest::Reporter* reporter, const char* filename) { |
| 4673 SkPath path; | 4671 SkPath path; |
| 4674 path.setFillType(SkPath::kEvenOdd_FillType); | 4672 path.setFillType(SkPath::kEvenOdd_FillType); |
| 4675 path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction); | 4673 path.addRect(0, 0, 60, 60, SkPath::kCCW_Direction); |
| 4676 path.addRect(10, 30, 40, 30, SkPath::kCCW_Direction); | 4674 path.addRect(10, 30, 40, 30, SkPath::kCCW_Direction); |
| 4677 path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction); | 4675 path.addRect(24, 6, 36, 36, SkPath::kCCW_Direction); |
| 4678 path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction); | 4676 path.addRect(32, 6, 36, 41, SkPath::kCCW_Direction); |
| 4679 testSimplify(reporter, path, filename); | 4677 testSimplify(reporter, path, filename); |
| 4680 } | 4678 } |
| 4681 | 4679 |
| 4682 static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; | 4680 static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; |
| 4681 static void (*firstTest)(skiatest::Reporter* , const char* filename) = testCubic
2; |
| 4682 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; |
| 4683 | 4683 |
| 4684 static TestDesc tests[] = { | 4684 static TestDesc tests[] = { |
| 4685 TEST(testRect3), | 4685 TEST(testRect3), |
| 4686 TEST(testQuadralateral10), | 4686 TEST(testQuadralateral10), |
| 4687 TEST(testQuads61), | 4687 TEST(testQuads61), |
| 4688 TEST(testQuads60), | 4688 TEST(testQuads60), |
| 4689 TEST(testQuads59), | 4689 TEST(testQuads59), |
| 4690 TEST(testQuads58), | 4690 TEST(testQuads58), |
| 4691 TEST(testQuads57), | 4691 TEST(testQuads57), |
| 4692 TEST(testQuads56), | 4692 TEST(testQuads56), |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4731 TEST(testQuads35), | 4731 TEST(testQuads35), |
| 4732 TEST(testDegenerates1), | 4732 TEST(testDegenerates1), |
| 4733 TEST(testQuad13), | 4733 TEST(testQuad13), |
| 4734 TEST(testQuad14), | 4734 TEST(testQuad14), |
| 4735 TEST(testQuad15), | 4735 TEST(testQuad15), |
| 4736 TEST(testQuadratic56), | 4736 TEST(testQuadratic56), |
| 4737 TEST(testQuadralateral4), | 4737 TEST(testQuadralateral4), |
| 4738 TEST(testQuadralateral3), | 4738 TEST(testQuadralateral3), |
| 4739 TEST(testDegenerate5), | 4739 TEST(testDegenerate5), |
| 4740 TEST(testQuad12), | 4740 TEST(testQuad12), |
| 4741 TEST(testQuadratic51), // has unorderable angles | 4741 TEST(testQuadratic51), |
| 4742 TEST(testQuad8), | 4742 TEST(testQuad8), |
| 4743 TEST(testQuad11), | 4743 TEST(testQuad11), |
| 4744 TEST(testQuad10), | 4744 TEST(testQuad10), |
| 4745 TEST(testQuad9), | 4745 TEST(testQuad9), |
| 4746 TEST(testTriangles4x), | 4746 TEST(testTriangles4x), |
| 4747 TEST(testTriangles3x), | 4747 TEST(testTriangles3x), |
| 4748 TEST(testRect2), | 4748 TEST(testRect2), |
| 4749 TEST(testRect1), | 4749 TEST(testRect1), |
| 4750 TEST(tooCloseTest), | 4750 TEST(tooCloseTest), |
| 4751 TEST(skphealth_com76), | 4751 TEST(skphealth_com76), |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5104 TEST(testLine1), | 5104 TEST(testLine1), |
| 5105 }; | 5105 }; |
| 5106 | 5106 |
| 5107 static const size_t subTestCount = SK_ARRAY_COUNT(subTests); | 5107 static const size_t subTestCount = SK_ARRAY_COUNT(subTests); |
| 5108 | 5108 |
| 5109 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0; | 5109 static void (*firstSubTest)(skiatest::Reporter* , const char* filename) = 0; |
| 5110 | 5110 |
| 5111 static bool runSubTests = false; | 5111 static bool runSubTests = false; |
| 5112 static bool runSubTestsFirst = false; | 5112 static bool runSubTestsFirst = false; |
| 5113 static bool runReverse = false; | 5113 static bool runReverse = false; |
| 5114 static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; | |
| 5115 | 5114 |
| 5116 DEF_TEST(PathOpsSimplify, reporter) { | 5115 DEF_TEST(PathOpsSimplify, reporter) { |
| 5117 if (runSubTests && runSubTestsFirst) { | 5116 if (runSubTests && runSubTestsFirst) { |
| 5118 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); | 5117 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes
t, runReverse); |
| 5119 } | 5118 } |
| 5120 RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse); | 5119 RunTestSet(reporter, tests, testCount, firstTest, skipTest, stopTest, runRev
erse); |
| 5121 if (runSubTests && !runSubTestsFirst) { | 5120 if (runSubTests && !runSubTestsFirst) { |
| 5122 RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, run
Reverse); | 5121 RunTestSet(reporter, subTests, subTestCount, firstSubTest, NULL, stopTes
t, runReverse); |
| 5123 } | 5122 } |
| 5124 } | 5123 } |
| OLD | NEW |