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

Unified Diff: tests/PathOpsOpTest.cpp

Issue 1037953004: add conics to path ops (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix linux build Created 5 years, 8 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
Index: tests/PathOpsOpTest.cpp
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 265e353e6483838664d19f151708c7032f54a064..6abe37c242bde6ca1092559946760e68d8103788 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -3795,11 +3795,119 @@ static void cubicOp128(skiatest::Reporter* reporter, const char* filename) {
testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
}
+static void cubicOp129(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.moveTo(5,6);
+ path.cubicTo(3,4, 2,0, 2,1);
+ path.close();
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.moveTo(0,2);
+ pathB.cubicTo(1,2, 6,5, 4,3);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
+}
+
+static void cubicOp130(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.moveTo(5,6);
+ path.cubicTo(4,6, 3,0, 2,1);
+ path.close();
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.moveTo(0,3);
+ pathB.cubicTo(1,2, 6,5, 6,4);
+ pathB.close();
+ testPathOpCheck(reporter, path, pathB, kDifference_SkPathOp, filename, FLAGS_runFail);
+}
+
+static void cubicOp131(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.moveTo(0,1);
+ path.cubicTo(3,4, 3,0, 6,2);
+ path.close();
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.moveTo(0,3);
+ pathB.cubicTo(2,6, 1,0, 4,3);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
+}
+
+static void circlesOp1(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.addCircle(0, 1, 2, SkPath::kCCW_Direction);
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.addCircle(0, 1, 1, SkPath::kCW_Direction);
+ testPathOp(reporter, path, pathB, kDifference_SkPathOp, filename);
+}
+
+static void circlesOp2(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.addCircle(0, 1, 4, SkPath::kCCW_Direction);
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.addCircle(0, 4, 3, SkPath::kCW_Direction);
+ testPathOp(reporter, path, pathB, kIntersect_SkPathOp, filename);
+}
+
+static void rRect1x(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kEvenOdd_FillType);
+ path.moveTo(20.65f, 5.65f);
+ path.conicTo(20.65f, 1.13612f, 25.1404f, 0.65f, 0.888488f);
+ path.lineTo(25.65f, 0.65f);
+ path.lineTo(26.1596f, 0.67604f);
+ path.conicTo(30.65f, 1.13612f, 30.65f, 5.65f, 0.888488f);
+ path.lineTo(30.65f, 25.65f);
+ path.conicTo(30.65f, 20.65f, 25.65f, 20.65f, 0.707107f);
+ path.lineTo(20.65f, 20.65f);
+ path.lineTo(20.65f, 5.65f);
+ path.close();
+ path.moveTo(20.65f, 20.65f);
+ path.lineTo(5.65f, 20.65f);
+ path.conicTo(0.65f, 20.65f, 0.65f, 25.65f, 0.707107f);
+ path.lineTo(0.65f, 45.65f);
+ path.conicTo(0.65f, 50.65f, 5.65f, 50.65f, 0.707107f);
+ path.lineTo(25.65f, 50.65f);
+ path.conicTo(30.65f, 50.65f, 30.65f, 45.65f, 0.707107f);
+ path.lineTo(30.65f, 25.65f);
+ path.conicTo(30.65f, 30.65f, 25.65f, 30.65f, 0.707107f);
+ path.conicTo(20.65f, 30.65f, 20.65f, 25.65f, 0.707107f);
+ path.lineTo(20.65f, 20.65f);
+ path.close();
+ SkPath path1(path);
+
+ path.reset();
+ path.setFillType(SkPath::kWinding_FillType);
+ path.moveTo(20.65f, 45.65f);
+ path.lineTo(20.65f, 25.65f);
+ path.conicTo(20.65f, 20.65f, 25.65f, 20.65f, 0.707107f);
+ path.lineTo(45.65f, 20.65f);
+ path.conicTo(50.65f, 20.65f, 50.65f, 25.65f, 0.707107f);
+ path.lineTo(50.65f, 45.65f);
+ path.conicTo(50.65f, 50.65f, 45.65f, 50.65f, 0.707107f);
+ path.lineTo(25.65f, 50.65f);
+ path.conicTo(20.65f, 50.65f, 20.65f, 45.65f, 0.707107f);
+ path.close();
+ SkPath path2(path);
+
+ testPathOp(reporter, path1, path2, kDifference_SkPathOp, filename);
+}
+
+
static void (*skipTest)(skiatest::Reporter* , const char* filename) = 0;
-static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
+static void (*firstTest)(skiatest::Reporter* , const char* filename) = circlesOp1;
static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
static struct TestDesc tests[] = {
+ TEST(rRect1x),
+ TEST(circlesOp2),
+ TEST(circlesOp1),
+ TEST(cubicOp131),
+ TEST(cubicOp130),
+ TEST(cubicOp129),
TEST(cubicOp128),
TEST(cubicOp127),
TEST(cubicOp126),
@@ -4229,7 +4337,7 @@ path.lineTo(SkBits2Float(0x43200000), SkBits2Float(0x42700000));
path.close();
SkPath path2(path);
- testPathFailOp(reporter, path1, path2, (SkPathOp) 2, filename);
+ testPathOpCheck(reporter, path1, path2, (SkPathOp) 2, filename, FLAGS_runFail);
}
static void fuzz1(skiatest::Reporter* reporter, const char* filename) {

Powered by Google App Engine
This is Rietveld 408576698