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

Unified Diff: tests/PathOpsCubicIntersectionTest.cpp

Issue 1036633002: Revert of remove obsolete tests (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsCubicIntersectionTest.cpp
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 45a96509aa2603b9fe0a17662a1147c221c2504f..a424c50c5567b19273a6e0b10bf244862cb4ab78 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -683,3 +683,72 @@
if (false) CubicIntersection_IntersectionFinder();
if (false) CubicIntersection_RandTest(reporter);
}
+
+static void binaryTest(const SkDCubic& cubic1, const SkDCubic& cubic2,
+ skiatest::Reporter* reporter) {
+ SkASSERT(ValidCubic(cubic1));
+ SkASSERT(ValidCubic(cubic2));
+ SkIntersections intersections;
+ SkReduceOrder reduce1, reduce2;
+ int order1 = reduce1.reduce(cubic1, SkReduceOrder::kNo_Quadratics);
+ int order2 = reduce2.reduce(cubic2, SkReduceOrder::kNo_Quadratics);
+ if (order1 == 4 && order2 == 4) {
+ intersections.intersect(cubic1, cubic2);
+ } else {
+ intersections.reset();
+ }
+ SkIntersections intersections2;
+ (void) intersections2.intersect(cubic1, cubic2);
+ REPORTER_ASSERT(reporter, intersections.used() <= intersections2.used()
+ || intersections[0][0] + 0.01 > intersections[0][1]);
+ for (int index = 0; index < intersections2.used(); ++index) {
+// SkASSERT(intersections.pt(index).approximatelyEqual(intersections2.pt(index)));
+ double tt1 = intersections2[0][index];
+ SkDPoint xy1 = cubic1.ptAtT(tt1);
+ double tt2 = intersections2[1][index];
+ SkDPoint xy2 = cubic2.ptAtT(tt2);
+ REPORTER_ASSERT(reporter, xy1.approximatelyEqual(xy2));
+ }
+}
+
+DEF_TEST(PathOpsCubicBinaryTest, reporter) {
+ int outer = 0;
+ int inner = outer + 1;
+ do {
+ const SkDCubic& cubic1 = testSet[outer];
+ const SkDCubic& cubic2 = testSet[inner];
+ binaryTest(cubic1, cubic2, reporter);
+ inner += 2;
+ outer += 2;
+ } while (outer < (int) testSetCount);
+}
+
+DEF_TEST(PathOpsCubicBinaryNew, reporter) {
+ int outer = 62;
+ int inner = outer + 1;
+ do {
+ const SkDCubic& cubic1 = newTestSet[outer];
+ const SkDCubic& cubic2 = newTestSet[inner];
+ binaryTest(cubic1, cubic2, reporter);
+ inner += 2;
+ outer += 2;
+ } while (outer < (int) newTestSetCount);
+}
+
+DEF_TEST(PathOpsCubicBinaryStd, reporter) {
+ const int firstTest = 0;
+ for (size_t index = firstTest; index < tests_count; ++index) {
+ const SkDCubic& cubic1 = tests[index][0];
+ const SkDCubic& cubic2 = tests[index][1];
+ binaryTest(cubic1, cubic2, reporter);
+ }
+}
+
+DEF_TEST(PathOpsCubicBinaryCoin, reporter) {
+ int firstFail = 0;
+ for (int index = firstFail; index < coinSetCount; index += 2) {
+ const SkDCubic& cubic1 = coinSet[index];
+ const SkDCubic& cubic2 = coinSet[index + 1];
+ binaryTest(cubic1, cubic2, reporter);
+ }
+}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698