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

Side by Side Diff: tests/PathOpsCubicIntersectionTest.cpp

Issue 1394503003: fix some pathops bugs found in 1M skps (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: init to avoid warning Created 5 years, 2 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
« no previous file with comments | « tests/PathOpsCubicConicIntersectionTest.cpp ('k') | tests/PathOpsDebug.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 "PathOpsCubicIntersectionTestData.h" 7 #include "PathOpsCubicIntersectionTestData.h"
8 #include "PathOpsTestCommon.h" 8 #include "PathOpsTestCommon.h"
9 #include "SkGeometry.h" 9 #include "SkGeometry.h"
10 #include "SkIntersections.h" 10 #include "SkIntersections.h"
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 const SkDCubic& cubic2 = testSet[inner]; 430 const SkDCubic& cubic2 = testSet[inner];
431 oneOff(reporter, cubic1, cubic2, false); 431 oneOff(reporter, cubic1, cubic2, false);
432 } 432 }
433 433
434 static void newOneOff(skiatest::Reporter* reporter, int outer, int inner) { 434 static void newOneOff(skiatest::Reporter* reporter, int outer, int inner) {
435 const SkDCubic& cubic1 = newTestSet[outer]; 435 const SkDCubic& cubic1 = newTestSet[outer];
436 const SkDCubic& cubic2 = newTestSet[inner]; 436 const SkDCubic& cubic2 = newTestSet[inner];
437 oneOff(reporter, cubic1, cubic2, false); 437 oneOff(reporter, cubic1, cubic2, false);
438 } 438 }
439 439
440 static void testsOneOff(skiatest::Reporter* reporter, int index) {
441 const SkDCubic& cubic1 = tests[index][0];
442 const SkDCubic& cubic2 = tests[index][1];
443 oneOff(reporter, cubic1, cubic2, false);
444 }
445
440 static void oneOffTests(skiatest::Reporter* reporter) { 446 static void oneOffTests(skiatest::Reporter* reporter) {
441 for (int outer = 0; outer < testSetCount - 1; ++outer) { 447 for (int outer = 0; outer < testSetCount - 1; ++outer) {
442 for (int inner = outer + 1; inner < testSetCount; ++inner) { 448 for (int inner = outer + 1; inner < testSetCount; ++inner) {
443 oneOff(reporter, outer, inner); 449 oneOff(reporter, outer, inner);
444 } 450 }
445 } 451 }
446 for (int outer = 0; outer < newTestSetCount - 1; ++outer) { 452 for (int outer = 0; outer < newTestSetCount - 1; ++outer) {
447 for (int inner = outer + 1; inner < newTestSetCount; ++inner) { 453 for (int inner = outer + 1; inner < newTestSetCount; ++inner) {
448 newOneOff(reporter, outer, inner); 454 newOneOff(reporter, outer, inner);
449 } 455 }
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 } 653 }
648 654
649 static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) { 655 static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) {
650 int firstFail = 0; 656 int firstFail = 0;
651 for (int index = firstFail; index < selfSetCount; ++index) { 657 for (int index = firstFail; index < selfSetCount; ++index) {
652 selfOneOff(reporter, index); 658 selfOneOff(reporter, index);
653 } 659 }
654 } 660 }
655 661
656 static const SkDCubic coinSet[] = { 662 static const SkDCubic coinSet[] = {
663 {{{72.350448608398438, 27.966041564941406}, {72.58441162109375, 27.861515045 166016},
664 {72.818222045898437, 27.756658554077148}, {73.394996643066406, 27.497999 19128418}}},
665 {{{73.394996643066406, 27.49799919128418}, {72.818222045898437, 27.756658554 077148},
666 {72.58441162109375, 27.861515045166016}, {72.350448608398438, 27.9660415 64941406}}},
667
657 {{{297.04998779296875, 43.928997039794922}, {297.04998779296875, 43.92899703 9794922}, 668 {{{297.04998779296875, 43.928997039794922}, {297.04998779296875, 43.92899703 9794922},
658 {300.69699096679688, 45.391998291015625}, {306.92498779296875, 43.085998 53515625}}}, 669 {300.69699096679688, 45.391998291015625}, {306.92498779296875, 43.085998 53515625}}},
659 {{{297.04998779296875, 43.928997039794922}, {297.04998779296875, 43.92899703 9794922}, 670 {{{297.04998779296875, 43.928997039794922}, {297.04998779296875, 43.92899703 9794922},
660 {300.69699096679688, 45.391998291015625}, {306.92498779296875, 43.085998 53515625}}}, 671 {300.69699096679688, 45.391998291015625}, {306.92498779296875, 43.085998 53515625}}},
661 672
662 {{{2, 3}, {0, 4}, {3, 2}, {5, 3}}}, 673 {{{2, 3}, {0, 4}, {3, 2}, {5, 3}}},
663 {{{2, 3}, {0, 4}, {3, 2}, {5, 3}}}, 674 {{{2, 3}, {0, 4}, {3, 2}, {5, 3}}},
664 675
665 {{{317, 711}, {322.52285766601562, 711}, {327, 715.4771728515625}, {327, 721 }}}, 676 {{{317, 711}, {322.52285766601562, 711}, {327, 715.4771728515625}, {327, 721 }}},
666 {{{324.07107543945312, 713.928955078125}, {324.4051513671875, 714.2630004882 8125}, 677 {{{324.07107543945312, 713.928955078125}, {324.4051513671875, 714.2630004882 8125},
(...skipping 13 matching lines...) Expand all
680 for (int index = firstFail; index < coinSetCount; index += 2) { 691 for (int index = firstFail; index < coinSetCount; index += 2) {
681 coinOneOff(reporter, index); 692 coinOneOff(reporter, index);
682 } 693 }
683 } 694 }
684 695
685 DEF_TEST(PathOpsCubicCoinOneOff, reporter) { 696 DEF_TEST(PathOpsCubicCoinOneOff, reporter) {
686 coinOneOff(reporter, 0); 697 coinOneOff(reporter, 0);
687 } 698 }
688 699
689 DEF_TEST(PathOpsCubicIntersectionOneOff, reporter) { 700 DEF_TEST(PathOpsCubicIntersectionOneOff, reporter) {
690 newOneOff(reporter, 0, 1); 701 newOneOff(reporter, 66, 70);
702 }
703
704 DEF_TEST(PathOpsCubicIntersectionTestsOneOff, reporter) {
705 testsOneOff(reporter, 10);
691 } 706 }
692 707
693 DEF_TEST(PathOpsCubicSelfOneOff, reporter) { 708 DEF_TEST(PathOpsCubicSelfOneOff, reporter) {
694 selfOneOff(reporter, 0); 709 selfOneOff(reporter, 0);
695 } 710 }
696 711
697 DEF_TEST(PathOpsCubicIntersection, reporter) { 712 DEF_TEST(PathOpsCubicIntersection, reporter) {
698 oneOffTests(reporter); 713 oneOffTests(reporter);
699 cubicIntersectionSelfTest(reporter); 714 cubicIntersectionSelfTest(reporter);
700 cubicIntersectionCoinTest(reporter); 715 cubicIntersectionCoinTest(reporter);
701 standardTestCases(reporter); 716 standardTestCases(reporter);
702 if (false) CubicIntersection_IntersectionFinder(); 717 if (false) CubicIntersection_IntersectionFinder();
703 if (false) CubicIntersection_RandTest(reporter); 718 if (false) CubicIntersection_RandTest(reporter);
704 } 719 }
OLDNEW
« no previous file with comments | « tests/PathOpsCubicConicIntersectionTest.cpp ('k') | tests/PathOpsDebug.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698