aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathOpsExtendedTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/PathOpsExtendedTest.cpp')
-rw-r--r--tests/PathOpsExtendedTest.cpp52
1 files changed, 22 insertions, 30 deletions
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 06fee80f5d..d70deb30fc 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -320,26 +320,21 @@ int comparePaths(skiatest::Reporter* reporter, const char* filename, const SkPat
static SkTDArray<SkPathOp> gTestOp;
-static void dumpPathOpFunction(const char* testName, const SkPath& a, const SkPath& b,
- const SkPathOp shapeOp) {
+static void showPathOpPath(const char* testName, const SkPath& one, const SkPath& two,
+ const SkPath& a, const SkPath& b, const SkPath& scaledOne, const SkPath& scaledTwo,
+ const SkPathOp shapeOp, const SkMatrix& scale) {
+ SkASSERT((unsigned) shapeOp < SK_ARRAY_COUNT(opStrs));
if (!testName) {
testName = "xOp";
}
SkDebugf("static void %s_%s(skiatest::Reporter* reporter, const char* filename) {\n",
testName, opSuffixes[shapeOp]);
+ *gTestOp.append() = shapeOp;
SkDebugf(" SkPath path, pathB;\n");
SkPathOpsDebug::ShowOnePath(a, "path", false);
SkPathOpsDebug::ShowOnePath(b, "pathB", false);
SkDebugf(" testPathOp(reporter, path, pathB, %s, filename);\n", opStrs[shapeOp]);
SkDebugf("}\n");
-}
-
-static void showPathOpPath(const char* testName, const SkPath& one, const SkPath& two,
- const SkPath& a, const SkPath& b, const SkPath& scaledOne, const SkPath& scaledTwo,
- const SkPathOp shapeOp, const SkMatrix& scale) {
- SkASSERT((unsigned) shapeOp < SK_ARRAY_COUNT(opStrs));
- *gTestOp.append() = shapeOp;
- dumpPathOpFunction(testName, a, b, shapeOp);
drawAsciiPaths(scaledOne, scaledTwo, true);
}
@@ -349,15 +344,11 @@ static int comparePaths(skiatest::Reporter* reporter, const char* testName, cons
const SkPath& scaledOne, const SkPath& two, const SkPath& scaledTwo, SkBitmap& bitmap,
const SkPath& a, const SkPath& b, const SkPathOp shapeOp, const SkMatrix& scale,
ExpectMatch expectMatch) {
- if (ExpectMatch::kFlaky == expectMatch) {
- return 0; // fuzz data may cause asserts in region generating code, so don't try
- }
int errors2x2;
const int MAX_ERRORS = 8;
(void) pathsDrawTheSame(bitmap, scaledOne, scaledTwo, errors2x2);
if (ExpectMatch::kNo == expectMatch) {
if (errors2x2 < MAX_ERRORS) {
- SkDebugf("%s failing test %s now succeeds\n", __FUNCTION__, testName);
REPORTER_ASSERT(reporter, 0);
}
return 0;
@@ -514,11 +505,6 @@ bool testSimplifyCheck(skiatest::Reporter* reporter, const SkPath& path, const c
ExpectSuccess::kYes : ExpectSuccess::kNo, SkipAssert::kNo, ExpectMatch::kNo);
}
-bool testSimplifyTry(skiatest::Reporter* reporter, const SkPath& path, const char* filename) {
- return inner_simplify(reporter, path, filename, ExpectSuccess::kYes, SkipAssert::kNo,
- ExpectMatch::kNo);
-}
-
#if DEBUG_SHOW_TEST_NAME
static void showName(const SkPath& a, const SkPath& b, const SkPathOp shapeOp) {
SkDebugf("\n");
@@ -539,23 +525,18 @@ static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkP
SkDEBUGPARAMS(testName))) {
if (ExpectSuccess::kYes == expectSuccess) {
SkDebugf("%s %s did not expect failure\n", __FUNCTION__, testName);
- dumpPathOpFunction(testName, a, b, shapeOp);
REPORTER_ASSERT(reporter, 0);
}
return false;
} else {
if (ExpectSuccess::kNo == expectSuccess) {
SkDebugf("%s %s unexpected success\n", __FUNCTION__, testName);
- dumpPathOpFunction(testName, a, b, shapeOp);
REPORTER_ASSERT(reporter, 0);
}
}
if (!reporter->verbose()) {
return true;
}
- if (ExpectMatch::kFlaky == expectMatch) {
- return true; // fuzzy data may assert in region construction: see bug.skia.org/6129
- }
SkPath pathOut, scaledPathOut;
SkRegion rgnA, rgnB, openClip, rgnOut;
openClip.setRect(-16000, -16000, 16000, 16000);
@@ -598,18 +579,29 @@ bool testPathOpCheck(skiatest::Reporter* reporter, const SkPath& a, const SkPath
ExpectSuccess::kYes : ExpectSuccess::kNo, SkipAssert::kNo, ExpectMatch::kNo);
}
-bool testPathOpTry(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
- const SkPathOp shapeOp, const char* testName) {
- return innerPathOp(reporter, a, b, shapeOp, testName,
- ExpectSuccess::kYes, SkipAssert::kNo, ExpectMatch::kNo);
-}
-
bool testPathOpFuzz(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
const SkPathOp shapeOp, const char* testName) {
return innerPathOp(reporter, a, b, shapeOp, testName, ExpectSuccess::kFlaky, SkipAssert::kYes,
ExpectMatch::kFlaky);
}
+bool testPathOpFail(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
+ const SkPathOp shapeOp, const char* testName) {
+#if DEBUG_SHOW_TEST_NAME
+ showName(a, b, shapeOp);
+#endif
+ SkPath orig;
+ orig.lineTo(54, 43);
+ SkPath out = orig;
+ if (Op(a, b, shapeOp, &out) ) {
+ SkDebugf("%s test is expected to fail\n", __FUNCTION__);
+ REPORTER_ASSERT(reporter, 0);
+ return false;
+ }
+ SkASSERT(out == orig);
+ return true;
+}
+
SK_DECLARE_STATIC_MUTEX(gMutex);
void initializeTests(skiatest::Reporter* reporter, const char* test) {