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

Unified Diff: tests/PathOpsBuilderTest.cpp

Issue 1129193006: fix winding for path ops builder (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix compile bug Created 5 years, 7 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 | « src/pathops/SkPathOpsWinding.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsBuilderTest.cpp
diff --git a/tests/PathOpsBuilderTest.cpp b/tests/PathOpsBuilderTest.cpp
index 8ab92c31245ef795e138f410951c05281fc386e7..ea4c567e620661edeff8e9006d166ebace11c458 100644
--- a/tests/PathOpsBuilderTest.cpp
+++ b/tests/PathOpsBuilderTest.cpp
@@ -33,8 +33,10 @@ DEF_TEST(PathOpsBuilder, reporter) {
SkPath::Direction dir;
REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
- REPORTER_ASSERT(reporter, dir == SkPath::kCW_Direction);
- REPORTER_ASSERT(reporter, rectPath == result);
+ REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction);
+ SkBitmap bitmap;
+ int pixelDiff = comparePaths(reporter, __FUNCTION__, rectPath, result, bitmap);
+ REPORTER_ASSERT(reporter, pixelDiff == 0);
rectPath.reset();
rectPath.setFillType(SkPath::kEvenOdd_FillType);
@@ -44,7 +46,7 @@ DEF_TEST(PathOpsBuilder, reporter) {
REPORTER_ASSERT(reporter, result.isRect(NULL, &closed, &dir));
REPORTER_ASSERT(reporter, closed);
REPORTER_ASSERT(reporter, dir == SkPath::kCCW_Direction);
- REPORTER_ASSERT(reporter, rectPath == result);
+ REPORTER_ASSERT(reporter, rectPath == result);
builder.add(rectPath, kDifference_SkPathOp);
REPORTER_ASSERT(reporter, builder.resolve(&result));
@@ -74,12 +76,11 @@ DEF_TEST(PathOpsBuilder, reporter) {
builder.add(circle2, kUnion_SkPathOp);
builder.add(circle3, kDifference_SkPathOp);
REPORTER_ASSERT(reporter, builder.resolve(&result));
- SkBitmap bitmap;
- int pixelDiff = comparePaths(reporter, __FUNCTION__, opCompare, result, bitmap);
+ pixelDiff = comparePaths(reporter, __FUNCTION__, opCompare, result, bitmap);
REPORTER_ASSERT(reporter, pixelDiff == 0);
}
-DEF_TEST(Issue3838, reporter) {
+DEF_TEST(BuilderIssue3838, reporter) {
SkPath path;
path.moveTo(200, 170);
path.lineTo(220, 170);
@@ -93,9 +94,6 @@ DEF_TEST(Issue3838, reporter) {
path.lineTo(200, 250);
path.lineTo(200, 170);
path.close();
- testSimplify(reporter, path, __FUNCTION__);
- SkPath path3;
- Simplify(path, &path3);
SkPath path2;
SkOpBuilder builder;
builder.add(path, kUnion_SkPathOp);
@@ -104,3 +102,18 @@ DEF_TEST(Issue3838, reporter) {
int pixelDiff = comparePaths(reporter, __FUNCTION__, path, path2, bitmap);
REPORTER_ASSERT(reporter, pixelDiff == 0);
}
+
+DEF_TEST(BuilderIssue3838_2, reporter) {
+ SkPath path;
+ path.addCircle(100, 100, 50);
+
+ SkOpBuilder builder;
+ builder.add(path, kUnion_SkPathOp);
+ builder.add(path, kUnion_SkPathOp);
+
+ SkPath result;
+ SkBitmap bitmap;
+ builder.resolve(&result);
+ int pixelDiff = comparePaths(reporter, __FUNCTION__, path, result, bitmap);
+ REPORTER_ASSERT(reporter, pixelDiff == 0);
+}
« no previous file with comments | « src/pathops/SkPathOpsWinding.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698