Index: tests/PathOpsQuadIntersectionTest.cpp |
diff --git a/tests/PathOpsQuadIntersectionTest.cpp b/tests/PathOpsQuadIntersectionTest.cpp |
index 565098af81c0ce57da6d6138abfcd553b5ab32ec..0455802e3b8da69480af6e5511ec0ed3de5d737f 100644 |
--- a/tests/PathOpsQuadIntersectionTest.cpp |
+++ b/tests/PathOpsQuadIntersectionTest.cpp |
@@ -53,6 +53,36 @@ static void standardTestCases(skiatest::Reporter* reporter) { |
} |
static const SkDQuad testSet[] = { |
+{{{4981.9990234375, 1590}, {4981.9990234375, 1617.7523193359375}, {4962.375, 1637.3760986328125}}}, |
+{{{4962.3759765625, 1637.3760986328125}, {4982, 1617.7523193359375}, {4982, 1590}}}, |
+ |
+{{{48.7416f, 7.74160004f}, {96.4831848f, -40}, {164, -40}}}, |
+{{{56.9671326f, 0}, {52.7835083f, 3.69968891f}, {48.7416f, 7.74160004f}}}, |
+ |
+{{{138, 80}, {147.15692138671875, 80}, {155.12803649902344, 82.86279296875}}}, |
+{{{155.12803649902344, 82.86279296875}, {153.14971923828125, 82.152290344238281}, {151.09841918945312, 81.618133544921875}}}, |
+ |
+{{{88, 130}, {88, 131.54483032226562}, {88.081489562988281, 133.0560302734375}}}, |
+{{{88.081489562988281, 133.0560302734375}, {88, 131.54483032226562}, {88, 130}}}, |
+ |
+{{{0.59987992,2.14448452}, {0.775417507,1.95606446}, {1.00564098,1.79310346}}}, |
+{{{1.00564098,1.79310346}, {1.25936198,1.615623}, {1.35901463,1.46834028}}}, |
+ |
+{{{3,0}, {0,1}, {3,2}}}, |
+{{{2,0}, {1,1}, {2,2}}}, |
+ |
+{{{38.656852722167969, 38.656852722167969}, {38.651023864746094, 38.662681579589844}, {38.644744873046875, 38.668937683105469}}}, |
+{{{38.656852722167969, 38.656852722167969}, {36.313709259033203, 41}, {33, 41}}}, |
+ |
+{{{4914.9990234375, 1523}, {4942.75146484375, 1523}, {4962.375, 1542.6239013671875}}}, |
+{{{4962.3759765625, 1542.6239013671875}, {4942.75244140625, 1523}, {4915, 1523}}}, |
+ |
+{{{4867.623046875, 1637.3760986328125}, {4847.9990234375, 1617.7523193359375}, {4847.9990234375, 1590}}}, |
+{{{4848, 1590}, {4848, 1617.7523193359375}, {4867.6240234375, 1637.3760986328125}}}, |
+ |
+{{{102.64466094970703, 165.3553466796875}, {110.79246520996094, 173.50314331054687}, {120.81797790527344, 177.11778259277344}}}, |
+{{{113.232177734375, 173.57899475097656}, {116.88026428222656, 175.69805908203125}, {120.81797790527344, 177.11778259277344}}}, |
+ |
{{{-37.3484879,10.0192947}, {-36.4966316,13.2140198}, {-38.1506348,16.0788383}}}, |
{{{-38.1462746,16.08918}, {-36.4904327,13.2193804}, {-37.3484879,10.0192947}}}, |
@@ -320,6 +350,8 @@ static void oneOffTests(skiatest::Reporter* reporter) { |
} |
static const SkDQuad coincidentTestSet[] = { |
+ {{{4914.9990234375, 1523}, {4942.75146484375, 1523}, {4962.375, 1542.6239013671875}}}, |
+ {{{4962.3759765625, 1542.6239013671875}, {4942.75244140625, 1523}, {4915, 1523}}}, |
#if 0 |
{{{97.9337615966796875,100}, {88,112.94264984130859375}, {88,130}}}, |
{{{88,130}, {88,124.80951690673828125}, {88.91983795166015625,120}}}, |
@@ -339,9 +371,9 @@ static void coincidentTestOne(skiatest::Reporter* reporter, int test1, int test2 |
SkASSERT(ValidQuad(quad2)); |
SkIntersections intersections2; |
intersections2.intersect(quad1, quad2); |
- REPORTER_ASSERT(reporter, intersections2.coincidentUsed() == 2); |
- REPORTER_ASSERT(reporter, intersections2.used() == 2); |
- for (int pt = 0; pt < intersections2.coincidentUsed(); ++pt) { |
+ REPORTER_ASSERT(reporter, intersections2.coincidentUsed() >= 2); |
+ REPORTER_ASSERT(reporter, intersections2.used() >= 2); |
+ for (int pt = 0; pt < intersections2.coincidentUsed(); pt += 2) { |
double tt1 = intersections2[0][pt]; |
double tt2 = intersections2[1][pt]; |
SkDPoint pt1 = quad1.ptAtT(tt1); |
@@ -390,9 +422,8 @@ static void pointFinder(const SkDQuad& q1, const SkDQuad& q2) { |
left[1] = ((const SkDLine&) q1[1]).isLeft(q2[index]); |
SkDLine diag = {{q1[0], q1[2]}}; |
left[2] = diag.isLeft(q2[index]); |
- SkDebugf("%s left=(%d, %d, %d) inHull=%s\n", __FUNCTION__, floatSign(left[0]), |
- floatSign(left[1]), floatSign(left[2]), |
- q1.pointInHull(q2[index]) ? "true" : "false"); |
+ SkDebugf("%s left=(%d, %d, %d)\n", __FUNCTION__, floatSign(left[0]), |
+ floatSign(left[1]), floatSign(left[2])); |
} |
SkDebugf("\n"); |
} |
@@ -519,6 +550,14 @@ static void QuadraticIntersection_IntersectionFinder() { |
intersectionFinder(0, 1); |
} |
+DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) { |
+ oneOffTest1(reporter, 10, 11); |
+} |
+ |
+DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) { |
+ coincidentTestOne(reporter, 0, 1); |
+} |
+ |
DEF_TEST(PathOpsQuadIntersection, reporter) { |
oneOffTests(reporter); |
coincidentTest(reporter); |
@@ -527,10 +566,31 @@ DEF_TEST(PathOpsQuadIntersection, reporter) { |
if (false) QuadraticIntersection_PointFinder(); |
} |
-DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) { |
- coincidentTestOne(reporter, 0, 1); |
-} |
+#include "SkCommonFlags.h" |
-DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) { |
- oneOffTest1(reporter, 0, 1); |
+DEF_TEST(PathOpsQuadBinaryProfile, reporter) { |
+ if (!FLAGS_veryVerbose) { |
+ return; |
+ } |
+ SkIntersections intersections; |
+ for (int x = 0; x < 100; ++x) { |
+ int outer = 0; |
+ int inner = outer + 1; |
+ do { |
+ const SkDQuad& quad1 = testSet[outer]; |
+ const SkDQuad& quad2 = testSet[inner]; |
+ (void) intersections.intersect(quad1, quad2); |
+ REPORTER_ASSERT(reporter, intersections.used() >= 0); // make sure code isn't tossed |
+ inner += 2; |
+ outer += 2; |
+ } while (outer < (int) testSetCount); |
+ } |
+ for (int x = 0; x < 100; ++x) { |
+ for (size_t test = 0; test < quadraticTests_count; ++test) { |
+ const SkDQuad& quad1 = quadraticTests[test][0]; |
+ const SkDQuad& quad2 = quadraticTests[test][1]; |
+ (void) intersections.intersect(quad1, quad2); |
+ REPORTER_ASSERT(reporter, intersections.used() >= 0); // make sure code isn't tossed |
+ } |
+ } |
} |