aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsOpTest.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-25 12:59:11 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-04-25 12:59:11 +0000
commit8cb1daaa1e4343eb60a7c4f21c12e33de30dad64 (patch)
treeca77a12bcf71775ea19e031b4659452d356c73ac /tests/PathOpsOpTest.cpp
parente1ba93ee01aa7df27197189ab4d82a7d5387dc8a (diff)
fix minor skp-found bugs
remove globals from pathops_unittest BUG=skia:2460 TBR=mtklein Author: caryclark@google.com Review URL: https://codereview.chromium.org/239563004 git-svn-id: http://skia.googlecode.com/svn/trunk@14378 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathOpsOpTest.cpp')
-rw-r--r--tests/PathOpsOpTest.cpp81
1 files changed, 64 insertions, 17 deletions
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index 5ba54f3e3f..7a1cbab5e3 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -3257,10 +3257,70 @@ static void findFirst1(skiatest::Reporter* reporter, const char* filename) {
testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
}
+// triggers addSimpleAngle with non-zero argument
+static void cubicOp112(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.moveTo(2,4);
+ path.cubicTo(2,3, 6,4, 1,0);
+ path.close();
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.moveTo(4,6);
+ pathB.cubicTo(0,1, 4,2, 3,2);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
+}
+
+// triggers untested calcLoopSpanCount code path
+#if 0
+static void cubicOp113(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.moveTo(2,4);
+ path.cubicTo(3,5, 2.33333325f,4.33333349f, 3.83333325f,3.83333349f);
+ path.close();
+ pathB.moveTo(3,5);
+ pathB.cubicTo(2.33333325f,4.33333349f, 3.83333325f,3.83333349f, 2,4);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kDifference_PathOp, filename);
+}
+#endif
+
+static void cubicOp114(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.setFillType(SkPath::kWinding_FillType);
+ path.moveTo(0, 1);
+ path.cubicTo(1, 3, -1, 2, 3.5f, 1.33333337f);
+ path.close();
+ pathB.setFillType(SkPath::kWinding_FillType);
+ pathB.moveTo(1, 3);
+ pathB.cubicTo(-1, 2, 3.5f, 1.33333337f, 0, 1);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
+}
+
+static void quadOp10i(skiatest::Reporter* reporter, const char* filename) {
+ SkPath path, pathB;
+ path.moveTo(0, 0);
+ path.quadTo(1, 8, 3, 5);
+ path.lineTo(8, 1);
+ path.close();
+ pathB.moveTo(0, 0);
+ pathB.quadTo(8, 1, 4, 8);
+ pathB.close();
+ testPathOp(reporter, path, pathB, kIntersect_PathOp, filename);
+}
+
static void (*firstTest)(skiatest::Reporter* , const char* filename) = 0;
static void (*stopTest)(skiatest::Reporter* , const char* filename) = 0;
static struct TestDesc tests[] = {
+ TEST(quadOp10i),
+#if 0 // FIXME: serpentine curve is ordered the wrong way
+ TEST(cubicOp114),
+#endif
+#if 0 // FIXME: currently failing
+ TEST(cubicOp113),
+#endif
#if SKPS_WORKING
// fails because a cubic/quadratic intersection is missed
// the internal quad/quad is far enough away from the real cubic/quad that it is rejected
@@ -3269,6 +3329,7 @@ static struct TestDesc tests[] = {
#if ISSUE_1417_WORKING_ON_LINUX_32
TEST(issue1417),
#endif
+ TEST(cubicOp112),
TEST(skpadspert_net23),
TEST(skpadspert_de11),
TEST(findFirst1),
@@ -3467,11 +3528,9 @@ static struct TestDesc tests[] = {
static const size_t testCount = SK_ARRAY_COUNT(tests);
static struct TestDesc subTests[] = {
- TEST(cubicOp6d),
- TEST(cubicOp8d),
- TEST(cubicOp70d),
- TEST(cubicOp16d),
- TEST(skp5),
+ TEST(cubicOp114),
+ TEST(cubicOp58d),
+ TEST(cubicOp53d),
};
static const size_t subTestCount = SK_ARRAY_COUNT(subTests);
@@ -3483,10 +3542,6 @@ static bool runSubTestsFirst = false;
static bool runReverse = false;
DEF_TEST(PathOpsOp, reporter) {
-#ifdef SK_DEBUG
- SkPathOpsDebug::gMaxWindSum = 4;
- SkPathOpsDebug::gMaxWindValue = 4;
-#endif
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
@@ -3497,10 +3552,6 @@ DEF_TEST(PathOpsOp, reporter) {
if (runSubTests && !runSubTestsFirst) {
RunTestSet(reporter, subTests, subTestCount, firstSubTest, stopTest, runReverse);
}
-#ifdef SK_DEBUG
- SkPathOpsDebug::gMaxWindSum = SK_MaxS32;
- SkPathOpsDebug::gMaxWindValue = SK_MaxS32;
-#endif
}
static void bufferOverflow(skiatest::Reporter* reporter, const char* filename) {
@@ -3518,10 +3569,6 @@ static struct TestDesc failTests[] = {
static const size_t failTestCount = SK_ARRAY_COUNT(failTests);
DEF_TEST(PathOpsFailOp, reporter) {
-#ifdef SK_DEBUG
- SkPathOpsDebug::gMaxWindSum = 4;
- SkPathOpsDebug::gMaxWindValue = 4;
-#endif
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif