aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2014-08-12 05:49:37 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-12 05:49:37 -0700
commit80a83adaf2f8db849bfae288e31b7c789dafabf5 (patch)
treebcd309242d9c40a924e081367b5cac669f881d4b /tests
parentc019ec412ba2704bc6e2cdfd321ea06787ba415d (diff)
relax quadratic binary search test
Extreme implicit quartic equations solve to roots that are different enough that they appear to have failed. In this case, fall back on binary searching to find an intersection. Relax the condition when this happens; don't give up just because the computed implicit root points aren't remotely the same. TBR=reed BUG=skia:2808 Author: caryclark@google.com Review URL: https://codereview.chromium.org/456383003
Diffstat (limited to 'tests')
-rw-r--r--tests/PathOpsOpTest.cpp29
-rw-r--r--tests/PathOpsQuadIntersectionTest.cpp3
2 files changed, 32 insertions, 0 deletions
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index b7babd3af6..2c67449950 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -3484,6 +3484,34 @@ static void issue2753(skiatest::Reporter* reporter, const char* filename) {
}
#endif
+static void issue2808(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path1, path2;
+
+ path1.moveTo(509.20300293f, 385.601989746f);
+ path1.quadTo(509.20300293f, 415.68838501f, 487.928710938f, 436.96270752f);
+ path1.quadTo(466.654388428f, 458.236999512f, 436.567993164f, 458.236999512f);
+ path1.quadTo(406.4815979f, 458.236999512f, 385.207275391f, 436.96270752f);
+ path1.quadTo(363.932983398f, 415.68838501f, 363.932983398f, 385.601989746f);
+ path1.quadTo(363.932983398f, 355.515594482f, 385.207275391f, 334.241271973f);
+ path1.quadTo(406.4815979f, 312.96697998f, 436.567993164f, 312.96697998f);
+ path1.quadTo(466.654388428f, 312.96697998f, 487.928710938f, 334.241271973f);
+ path1.quadTo(509.20300293f, 355.515594482f, 509.20300293f, 385.601989746f);
+ path1.close();
+
+ path2.moveTo(449.033996582f, 290.87298584f);
+ path2.quadTo(449.033996582f, 301.028259277f, 441.853149414f, 308.209106445f);
+ path2.quadTo(434.672271729f, 315.389984131f, 424.516998291f, 315.389984131f);
+ path2.quadTo(414.361724854f, 315.389984131f, 407.180847168f, 308.209106445f);
+ path2.quadTo(400, 301.028259277f, 400, 290.87298584f);
+ path2.quadTo(400, 280.717712402f, 407.180847168f, 273.536865234f);
+ path2.quadTo(414.361724854f, 266.355987549f, 424.516998291f, 266.355987549f);
+ path2.quadTo(434.672271729f, 266.355987549f, 441.853149414f, 273.536865234f);
+ path2.quadTo(449.033996582f, 280.717712402f, 449.033996582f, 290.87298584f);
+ path2.close();
+
+ testPathOp(reporter, path1, path2, kUnion_PathOp, filename);
+}
+
static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
@@ -3494,6 +3522,7 @@ static struct TestDesc tests[] = {
#if CUBIC_OP_114 // FIXME: curve with inflection is ordered the wrong way
TEST(cubicOp114),
#endif
+ TEST(issue2808),
TEST(cubicOp114asQuad),
TEST(rects4),
TEST(rects3),
diff --git a/tests/PathOpsQuadIntersectionTest.cpp b/tests/PathOpsQuadIntersectionTest.cpp
index ffa00edee1..1ddbbcc51e 100644
--- a/tests/PathOpsQuadIntersectionTest.cpp
+++ b/tests/PathOpsQuadIntersectionTest.cpp
@@ -53,6 +53,9 @@ static void standardTestCases(skiatest::Reporter* reporter) {
}
static const SkDQuad testSet[] = {
+{{{441.853149, 308.209106}, {434.672272, 315.389984}, {424.516998, 315.389984}}},
+{{{385.207275, 334.241272}, {406.481598, 312.96698}, {436.567993, 312.96698}}},
+
{{{-708.00779269310044, -154.36998607290101}, {-707.90560262312511, -154.36998607290101}, {-707.8333433370193, -154.44224536635932}}},
{{{-708.00779269310044, -154.61669472244046}, {-701.04513225634582, -128.85970734043804}, {505.58447265625, -504.9130859375}}},