path ops -- fix skp bugs
This fixes a series of bugs discovered by running
the small set of Skia skp files through pathops
to flatten the clips.
Review URL: https://codereview.chromium.org/14798004
git-svn-id: http://skia.googlecode.com/svn/trunk@9042 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index c0d13c8..ce2c89b 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -3695,9 +3695,92 @@
testSimplify(reporter, path);
}
+static void testQuad2(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(1, 0);
+ path.quadTo(0, 1, 3, 2);
+ path.lineTo(2, 3);
+ path.close();
+ path.moveTo(0, 0);
+ path.lineTo(1, 0);
+ path.quadTo(0, 1, 1, 1);
+ path.close();
+}
+
+static void testQuad3(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(1, 0);
+ path.quadTo(0, 1, 3, 2);
+ path.lineTo(3, 3);
+ path.close();
+ path.moveTo(0, 0);
+ path.lineTo(1, 0);
+ path.quadTo(0, 1, 1, 1);
+ path.close();
+ testSimplify(reporter, path);
+}
+
+static void testQuad4(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(2, 0);
+ path.quadTo(0, 1, 1, 1);
+ path.lineTo(3, 3);
+ path.close();
+ path.moveTo(0, 0);
+ path.lineTo(2, 0);
+ path.quadTo(0, 1, 2, 2);
+ path.close();
+ testSimplify(reporter, path);
+}
+
+static void testQuad5(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(2, 0);
+ path.quadTo(0, 1, 2, 2);
+ path.lineTo(1, 3);
+ path.close();
+ path.moveTo(0, 0);
+ path.lineTo(2, 0);
+ path.quadTo(0, 1, 1, 1);
+ path.close();
+ testSimplify(reporter, path);
+}
+
+static void testQuad6(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(2, 0);
+ path.quadTo(0, 1, 2, 2);
+ path.lineTo(1, 3);
+ path.close();
+ path.moveTo(1, 0);
+ path.lineTo(2, 0);
+ path.quadTo(0, 1, 1, 1);
+ path.close();
+ testSimplify(reporter, path);
+}
+
+static void testQuad7(skiatest::Reporter* reporter) {
+ SkPath path;
+ path.moveTo(3, 0);
+ path.quadTo(0, 1, 1, 1);
+ path.lineTo(1, 3);
+ path.close();
+ path.moveTo(1, 0);
+ path.lineTo(3, 0);
+ path.quadTo(0, 1, 1, 2);
+ path.close();
+ testSimplify(reporter, path);
+}
+
static void (*firstTest)(skiatest::Reporter* ) = 0;
static TestDesc tests[] = {
+ TEST(testQuad7),
+ TEST(testQuad6),
+ TEST(testQuad5),
+ TEST(testQuad4),
+ TEST(testQuad3),
+ TEST(testQuad2),
TEST(testAddTCoincident2),
TEST(testAddTCoincident1),
TEST(testTriangles2),
@@ -3707,7 +3790,7 @@
TEST(testQuadratic95),
TEST(testQuadratic94),
TEST(testQuadralateral2),
- TEST(testQuad1), // FIXME: fails, need to investigate
+ TEST(testQuad1),
TEST(testCubic2),
TEST(testCubic1),
TEST(testQuadralateral1),