diff options
author | caryclark <caryclark@google.com> | 2015-05-18 12:56:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-18 12:56:58 -0700 |
commit | 4e1a4c9399b8bb0897218f3ec10c254d3bb97463 (patch) | |
tree | 8d7dc01783988b530486faffd2317036eb41cfa6 /tests | |
parent | 4e149c09bcf1f02e3f31cd8e7bbe794a00090948 (diff) |
fix builder winding again
Record the nesting level when finding the edge winding contribution
so that inner edges can be reversed as needed.
R=fmalita@chromium.org
BUG=skia:3838
Review URL: https://codereview.chromium.org/1140383002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PathOpsBuilderTest.cpp | 32 | ||||
-rw-r--r-- | tests/PathOpsExtendedTest.h | 7 | ||||
-rw-r--r-- | tests/PathOpsSimplifyTest.cpp | 16 |
3 files changed, 48 insertions, 7 deletions
diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp index ea4c567e62..d36072f077 100644 --- a/tests/PathOpsBuilderTest.cpp +++ b/tests/PathOpsBuilderTest.cpp @@ -34,8 +34,7 @@ DEF_TEST(PathOpsBuilder, reporter) { REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir)); REPORTER_ASSERT(reporter, closed); REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction); - SkBitmap bitmap; - int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result, bitmap); + int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result); REPORTER_ASSERT(reporter, pixelDiff == 0); rectPath.reset(); @@ -76,7 +75,7 @@ DEF_TEST(PathOpsBuilder, reporter) { builder.add(circle2, kUnion_SkPathOp); builder.add(circle3, kDifference_SkPathOp); REPORTER_ASSERT(reporter, builder.resolve(&result)); - pixelDiff = comparePaths(reporter, __FUNCTION__, opCompare, result, bitmap); + pixelDiff = comparePaths(reporter, __FUNCTION__, opCompare, result); REPORTER_ASSERT(reporter, pixelDiff == 0); } @@ -98,8 +97,7 @@ DEF_TEST(BuilderIssue3838, reporter) { SkOpBuilder builder; builder.add(path, kUnion_SkPathOp); builder.resolve(&path2); - SkBitmap bitmap; - int pixelDiff = comparePaths(reporter, __FUNCTION__, path, path2, bitmap); + int pixelDiff = comparePaths(reporter, __FUNCTION__, path, path2); REPORTER_ASSERT(reporter, pixelDiff == 0); } @@ -112,8 +110,28 @@ DEF_TEST(BuilderIssue3838_2, reporter) { builder.add(path, kUnion_SkPathOp); SkPath result; - SkBitmap bitmap; builder.resolve(&result); - int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result, bitmap); + int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result); + REPORTER_ASSERT(reporter, pixelDiff == 0); +} + +DEF_TEST(BuilderIssue3838_3, reporter) { + SkPath path; + path.moveTo(40, 10); + path.lineTo(60, 10); + path.lineTo(60, 30); + path.lineTo(40, 30); + path.lineTo(40, 10); + path.moveTo(41, 11); + path.lineTo(41, 29); + path.lineTo(59, 29); + path.lineTo(59, 11); + path.lineTo(41, 11); + + SkOpBuilder builder; + builder.add(path, kUnion_SkPathOp); + SkPath result; + builder.resolve(&result); + int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result); REPORTER_ASSERT(reporter, pixelDiff == 0); } diff --git a/tests/PathOpsExtendedTest.h b/tests/PathOpsExtendedTest.h index a604761a7d..c4baa63b51 100644 --- a/tests/PathOpsExtendedTest.h +++ b/tests/PathOpsExtendedTest.h @@ -29,6 +29,13 @@ struct TestDesc { //extern int comparePaths(const SkPath& one, const SkPath& two); extern int comparePaths(skiatest::Reporter* reporter, const char* filename, const SkPath& one, const SkPath& two, SkBitmap& bitmap); + +inline int comparePaths(skiatest::Reporter* reporter, const char* filename, + const SkPath& one, const SkPath& two) { + SkBitmap bitmap; + return comparePaths(reporter, filename, one, two, bitmap); +} + extern bool drawAsciiPaths(const SkPath& one, const SkPath& two, bool drawPaths); extern void showOp(const SkPathOp op); extern bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp index 65a6441afc..40bbeb6baa 100644 --- a/tests/PathOpsSimplifyTest.cpp +++ b/tests/PathOpsSimplifyTest.cpp @@ -4782,11 +4782,27 @@ static void testIssue3838(skiatest::Reporter* reporter,const char* filename) { testSimplify(reporter, path, filename); } +static void testIssue3838_3(skiatest::Reporter* reporter,const char* filename) { + SkPath path; + path.moveTo(40, 10); + path.lineTo(60, 10); + path.lineTo(60, 30); + path.lineTo(40, 30); + path.lineTo(40, 10); + path.moveTo(41, 11); + path.lineTo(41, 29); + path.lineTo(59, 29); + path.lineTo(59, 11); + path.lineTo(41, 11); + 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(testIssue3838_3), TEST(testIssue3838), TEST(testArc), TEST(testTriangle2), |