| 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 "PathOpsCubicIntersectionTestData.h" | 7 #include "PathOpsCubicIntersectionTestData.h" |
| 8 #include "PathOpsTestCommon.h" | 8 #include "PathOpsTestCommon.h" |
| 9 #include "SkIntersections.h" | 9 #include "SkIntersections.h" |
| 10 #include "SkPathOpsRect.h" | 10 #include "SkPathOpsRect.h" |
| 11 #include "SkReduceOrder.h" | 11 #include "SkReduceOrder.h" |
| 12 #include "Test.h" | 12 #include "Test.h" |
| 13 #include "TestClassDef.h" |
| 13 | 14 |
| 14 const int firstCubicIntersectionTest = 9; | 15 const int firstCubicIntersectionTest = 9; |
| 15 | 16 |
| 16 static void standardTestCases(skiatest::Reporter* reporter) { | 17 static void standardTestCases(skiatest::Reporter* reporter) { |
| 17 for (size_t index = firstCubicIntersectionTest; index < tests_count; ++index
) { | 18 for (size_t index = firstCubicIntersectionTest; index < tests_count; ++index
) { |
| 18 int iIndex = static_cast<int>(index); | 19 int iIndex = static_cast<int>(index); |
| 19 const SkDCubic& cubic1 = tests[index][0]; | 20 const SkDCubic& cubic1 = tests[index][0]; |
| 20 const SkDCubic& cubic2 = tests[index][1]; | 21 const SkDCubic& cubic2 = tests[index][1]; |
| 21 SkReduceOrder reduce1, reduce2; | 22 SkReduceOrder reduce1, reduce2; |
| 22 int order1 = reduce1.reduce(cubic1, SkReduceOrder::kNo_Quadratics); | 23 int order1 = reduce1.reduce(cubic1, SkReduceOrder::kNo_Quadratics); |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 611 oneOff(reporter, cubic1, cubic2, true); | 612 oneOff(reporter, cubic1, cubic2, true); |
| 612 } | 613 } |
| 613 | 614 |
| 614 static void cubicIntersectionCoinTest(skiatest::Reporter* reporter) { | 615 static void cubicIntersectionCoinTest(skiatest::Reporter* reporter) { |
| 615 size_t firstFail = 0; | 616 size_t firstFail = 0; |
| 616 for (size_t index = firstFail; index < coinSetCount; index += 2) { | 617 for (size_t index = firstFail; index < coinSetCount; index += 2) { |
| 617 coinOneOff(reporter, index); | 618 coinOneOff(reporter, index); |
| 618 } | 619 } |
| 619 } | 620 } |
| 620 | 621 |
| 621 static void PathOpsCubicCoinOneOffTest(skiatest::Reporter* reporter) { | 622 DEF_TEST(PathOpsCubicCoinOneOff, reporter) { |
| 622 coinOneOff(reporter, 0); | 623 coinOneOff(reporter, 0); |
| 623 } | 624 } |
| 624 | 625 |
| 625 static void PathOpsCubicIntersectionOneOffTest(skiatest::Reporter* reporter) { | 626 DEF_TEST(PathOpsCubicIntersectionOneOff, reporter) { |
| 626 newOneOff(reporter, 0, 1); | 627 newOneOff(reporter, 0, 1); |
| 627 } | 628 } |
| 628 | 629 |
| 629 static void PathOpsCubicSelfOneOffTest(skiatest::Reporter* reporter) { | 630 DEF_TEST(PathOpsCubicSelfOneOff, reporter) { |
| 630 selfOneOff(reporter, 0); | 631 selfOneOff(reporter, 0); |
| 631 } | 632 } |
| 632 | 633 |
| 633 static void PathOpsCubicIntersectionTest(skiatest::Reporter* reporter) { | 634 DEF_TEST(PathOpsCubicIntersection, reporter) { |
| 634 oneOffTests(reporter); | 635 oneOffTests(reporter); |
| 635 cubicIntersectionSelfTest(reporter); | 636 cubicIntersectionSelfTest(reporter); |
| 636 cubicIntersectionCoinTest(reporter); | 637 cubicIntersectionCoinTest(reporter); |
| 637 standardTestCases(reporter); | 638 standardTestCases(reporter); |
| 638 if (false) CubicIntersection_IntersectionFinder(); | 639 if (false) CubicIntersection_IntersectionFinder(); |
| 639 if (false) CubicIntersection_RandTest(reporter); | 640 if (false) CubicIntersection_RandTest(reporter); |
| 640 } | 641 } |
| 641 | |
| 642 #include "TestClassDef.h" | |
| 643 DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionTest) | |
| 644 | |
| 645 DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionOneOffTest) | |
| 646 | |
| 647 DEFINE_TESTCLASS_SHORT(PathOpsCubicSelfOneOffTest) | |
| 648 | |
| 649 DEFINE_TESTCLASS_SHORT(PathOpsCubicCoinOneOffTest) | |
| OLD | NEW |