diff options
author | caryclark <caryclark@google.com> | 2015-07-23 12:40:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-23 12:40:22 -0700 |
commit | d4349723fac9c0fd4dcf8c275fb7c756bdfdff7b (patch) | |
tree | 20a850a4c02da163ac18a888494813fccc6f1862 /tests | |
parent | a0170f10aadca337fc412953f3409eb368c6964b (diff) |
fix path ops fuzz buster
Mark collapsed segments as done and remove collapsed
segment references from the coincidence array.
Also add test names to global debugging.
R=fmalita@chromium.org
BUG=512592
Review URL: https://codereview.chromium.org/1250293002
Diffstat (limited to 'tests')
-rwxr-xr-x | tests/PathOpsAngleIdeas.cpp | 2 | ||||
-rw-r--r-- | tests/PathOpsAngleTest.cpp | 4 | ||||
-rw-r--r-- | tests/PathOpsBuilderTest.cpp | 121 | ||||
-rw-r--r-- | tests/PathOpsExtendedTest.cpp | 5 | ||||
-rw-r--r-- | tests/PathOpsSimplifyTest.cpp | 65 |
5 files changed, 192 insertions, 5 deletions
diff --git a/tests/PathOpsAngleIdeas.cpp b/tests/PathOpsAngleIdeas.cpp index 79e09b9865..88b469e21a 100755 --- a/tests/PathOpsAngleIdeas.cpp +++ b/tests/PathOpsAngleIdeas.cpp @@ -419,7 +419,7 @@ static void testQuadAngles(skiatest::Reporter* reporter, const SkDQuad& quad1, c SkPoint shortQuads[2][3]; SkOpContourHead contour; - SkOpGlobalState state(NULL, &contour); + SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL)); contour.init(&state, false, false); makeSegment(&contour, quad1, shortQuads[0], allocator); makeSegment(&contour, quad1, shortQuads[1], allocator); diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp index 9c707743cf..9f9c321a42 100644 --- a/tests/PathOpsAngleTest.cpp +++ b/tests/PathOpsAngleTest.cpp @@ -235,7 +235,7 @@ static const int circleDataSetSize = (int) SK_ARRAY_COUNT(circleDataSet); DEF_TEST(PathOpsAngleCircle, reporter) { SkChunkAlloc allocator(4096); SkOpContourHead contour; - SkOpGlobalState state(NULL, &contour); + SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL)); contour.init(&state, false, false); for (int index = 0; index < circleDataSetSize; ++index) { CircleData& data = circleDataSet[index]; @@ -427,7 +427,7 @@ struct FourPoints { DEF_TEST(PathOpsAngleAfter, reporter) { SkChunkAlloc allocator(4096); SkOpContourHead contour; - SkOpGlobalState state(NULL, &contour); + SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL)); contour.init(&state, false, false); for (int index = intersectDataSetsSize - 1; index >= 0; --index) { IntersectData* dataArray = intersectDataSets[index]; diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp index df77100b01..08fc632732 100644 --- a/tests/PathOpsBuilderTest.cpp +++ b/tests/PathOpsBuilderTest.cpp @@ -150,3 +150,124 @@ DEF_TEST(BuilderIssue502792_2, reporter) { SkPath result; builder.resolve(&result); } + +DEF_TEST(Fuzz846, reporter) { +/* +<clipPath id="clip-circle"> + <circle id="circle" cx="60" cy="60" r="50" /> +</clipPath> +<clipPath id="clip-rect"> + <clipPath id="clip-rect"> + <clipPath id="clip-rect"> + <clipPath id="clip-rect"> + <rect x="10" y="30" width="0" height="60" /> + <rect x="10" y="30" width="0" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="32668" /> + <rect x="10" y="30" width="100" height="18446744073709551615" /> + <rect x="10" y="255" width="100" height="60" /> + <rect width="100" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="100" height="4294967236" /> + <rect x="10" y="30" width="100" height="60" /> + </clipPath> + <rect x="10" y="30" width="0" height="60" /> + <rect x="10" y="30" width="0" height="0.18093252719929986369568203" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="32668" height="60" /> + <rect x="10" y="30" width="100" height="18446744073709551615" /> + <rect x="10" y="255" width="100" height="60" /> + <rect x="2147483649" y="30" width="100" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + </clipPath> + <rect x="10" y="30" width="0" height="60" /> + <rect x="10" y="30" width="0" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="32668" height="60" /> + <rect x="10" y="30" width="100" height="18446744073709551615" /> + <rect x="10" y="255" width="100" height="60" /> + <rect x="2147483649" y="30" width="100" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="2879753595" width="100" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + </clipPath> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="0" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="32668" height="60" /> + <rect x="10" y="30" width="100" height="18446744073709551615" /> + <rect x="10" y="255" width="100" height="60" /> + <rect x="2147483649" y="30" width="100" height="60" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="10" y="30" width="100" height="4294967236" /> + <rect x="10" y="30" width="100" height="4294967236" /> + <rect x="10" y="30" width="100" height="4294967236" /> + <rect x="10" y="30" width="100" height="4294967236" /> + <rect x="10" y="30" width="100" height="60" /> + <rect x="757798030" y="30" width="100" height="60" /> +*/ + SkPath clipCircle, clipRect; + SkPath inner; + clipCircle.addCircle(60, 60, 50); // <circle id="circle" cx="60" cy="60" r="50" /> + + inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> + inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+32668, 30+0); // <rect x="10" y="30" width="32668" /> + inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> + inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> + inner.addRect(0, 0, 0+100, 0+60); // <rect width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + clipRect.addPath(inner); + inner.reset(); + inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> + inner.addRect(10, 30, 10+0, 30+0.18093252719929986369568203f); // <rect x="10" y="30" width="0" height="0.18093252719929986369568203" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> + inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> + inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> + inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + clipRect.addPath(inner); + inner.reset(); + inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> + inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> + inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> + inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> + inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 2879753595.f, 10+100, 30+2879753595.f); // <rect x="10" y="2879753595" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + clipRect.addPath(inner); + inner.reset(); + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+0, 30+60); // <rect x="10" y="30" width="0" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+32668, 30+60); // <rect x="10" y="30" width="32668" height="60" /> + inner.addRect(10, 30, 10+100, 30+18446744073709551615.f); // <rect x="10" y="30" width="100" height="18446744073709551615" /> + inner.addRect(10, 255, 10+100, 255+60); // <rect x="10" y="255" width="100" height="60" /> + inner.addRect(2147483649.f, 30, 2147483649.f+100, 30+60); // <rect x="2147483649" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> + inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> + inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> + inner.addRect(10, 30, 10+100, 30+4294967236.f); // <rect x="10" y="30" width="100" height="4294967236" /> + inner.addRect(10, 30, 10+100, 30+60); // <rect x="10" y="30" width="100" height="60" /> + inner.addRect(757798030.f, 30, 757798030.f+100, 30+60); // <rect x="757798030" y="30" width="100" height="60" /> + clipRect.addPath(inner); + + SkOpBuilder builder; + builder.add(clipCircle, kUnion_SkPathOp); + builder.add(clipRect, kDifference_SkPathOp); + SkPath result; + builder.resolve(&result); +} + diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp index 69a2d617b0..d458c41e97 100644 --- a/tests/PathOpsExtendedTest.cpp +++ b/tests/PathOpsExtendedTest.cpp @@ -488,7 +488,8 @@ static void showName(const SkPath& a, const SkPath& b, const SkPathOp shapeOp) { } #endif -bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result, bool expectSuccess); +bool OpDebug(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result, + bool expectSuccess SkDEBUGPARAMS(const char* testName)); static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const char* testName, bool expectSuccess) { @@ -496,7 +497,7 @@ static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP showName(a, b, shapeOp); #endif SkPath out; - if (!OpDebug(a, b, shapeOp, &out, expectSuccess)) { + if (!OpDebug(a, b, shapeOp, &out, expectSuccess SkDEBUGPARAMS(testName))) { SkDebugf("%s did not expect failure\n", __FUNCTION__); REPORTER_ASSERT(reporter, 0); return false; diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp index 5b763dee83..165ee8d11d 100644 --- a/tests/PathOpsSimplifyTest.cpp +++ b/tests/PathOpsSimplifyTest.cpp @@ -4810,11 +4810,76 @@ static void testQuads65(skiatest::Reporter* reporter,const char* filename) { testSimplify(reporter, path, filename); } +static void fuzz864a(skiatest::Reporter* reporter,const char* filename) { + SkPath path; + path.moveTo(10, 90); + path.lineTo(10, 90); + path.lineTo(10, 30); + path.lineTo(10, 30); + path.lineTo(10, 90); + path.close(); + path.moveTo(10, 90); + path.lineTo(10, 90); + path.lineTo(10, 30); + path.lineTo(10, 30); + path.lineTo(10, 90); + path.close(); + path.moveTo(10, 90); + path.lineTo(110, 90); + path.lineTo(110, 30); + path.lineTo(10, 30); + path.lineTo(10, 90); + path.close(); + path.moveTo(10, 30); + path.lineTo(32678, 30); + path.lineTo(32678, 30); + path.lineTo(10, 30); + path.close(); + path.moveTo(10, 3.35545e+07f); + path.lineTo(110, 3.35545e+07f); + path.lineTo(110, 30); + path.lineTo(10, 30); + path.lineTo(10, 3.35545e+07f); + path.close(); + path.moveTo(10, 315); + path.lineTo(110, 315); + path.lineTo(110, 255); + path.lineTo(10, 255); + path.lineTo(10, 315); + path.close(); + path.moveTo(0, 60); + path.lineTo(100, 60); + path.lineTo(100, 0); + path.lineTo(0, 0); + path.lineTo(0, 60); + path.close(); + path.moveTo(10, 90); + path.lineTo(110, 90); + path.lineTo(110, 30); + path.lineTo(10, 30); + path.lineTo(10, 90); + path.close(); + path.moveTo(10, 3.35545e+07f); + path.lineTo(110, 3.35545e+07f); + path.lineTo(110, 30); + path.lineTo(10, 30); + path.lineTo(10, 3.35545e+07f); + path.close(); + path.moveTo(10, 90); + path.lineTo(110, 90); + path.lineTo(110, 30); + path.lineTo(10, 30); + path.lineTo(10, 90); + path.close(); + testSimplify(reporter, path, filename); +} + static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0; static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0; static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0; static TestDesc tests[] = { + TEST(fuzz864a), TEST(testQuads65), TEST(testIssue3838_3), TEST(testIssue3838), |