harden and speed up path op unit tests
PathOps tests internal routines direcctly. Check to make sure that
test points, lines, quads, curves, triangles, and bounds read from
arrays are valid (i.e., don't contain NaN) before calling the
test function.
Repurpose the test flags.
- make 'v' verbose test region output against path output
- make 'z' single threaded (before it made it multithreaded)
The latter change speeds up tests run by the buildbot by 2x to 3x.
BUG=
Review URL: https://codereview.chromium.org/19374003
git-svn-id: http://skia.googlecode.com/svn/trunk@10107 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp
index 93280d7..b85644d 100644
--- a/tests/PathOpsExtendedTest.cpp
+++ b/tests/PathOpsExtendedTest.cpp
@@ -41,7 +41,6 @@
};
static bool gShowPath = false;
-static bool gComparePaths = true;
static bool gComparePathsAssert = true;
static bool gPathStrAssert = true;
@@ -512,7 +511,7 @@
REPORTER_ASSERT(state.fReporter, 0);
return false;
}
- if (!gComparePaths) {
+ if (!state.fReporter->verbose()) {
return true;
}
int result = comparePaths(state.fReporter, path, out, *state.fBitmap);
@@ -563,8 +562,8 @@
}
#endif
-bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
- const SkPathOp shapeOp, const char* testName) {
+static bool innerPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
+ const SkPathOp shapeOp, const char* testName, bool threaded) {
#if DEBUG_SHOW_TEST_NAME
if (testName == NULL) {
SkDebugf("\n");
@@ -581,6 +580,9 @@
REPORTER_ASSERT(reporter, 0);
return false;
}
+ if (threaded && !reporter->verbose()) {
+ return true;
+ }
SkPath pathOut, scaledPathOut;
SkRegion rgnA, rgnB, openClip, rgnOut;
openClip.setRect(-16000, -16000, 16000, 16000);
@@ -614,6 +616,16 @@
return result == 0;
}
+bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
+ const SkPathOp shapeOp, const char* testName) {
+ return innerPathOp(reporter, a, b, shapeOp, testName, false);
+}
+
+bool testThreadedPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b,
+ const SkPathOp shapeOp, const char* testName) {
+ return innerPathOp(reporter, a, b, shapeOp, testName, true);
+}
+
int initializeTests(skiatest::Reporter* reporter, const char* test) {
#ifdef SK_DEBUG
gDebugMaxWindSum = 4;