diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-07-16 16:11:16 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-07-16 16:11:16 +0000 |
commit | 8d0a524a4847bc7e1cc63a93b78922739466c201 (patch) | |
tree | af95f937257448db5658c8b658c53775debbbd5b /tests/PathOpsExtendedTest.cpp | |
parent | 92fe073efbd9287cdb4d01a1b9c0664fc5d4fdd0 (diff) |
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
Diffstat (limited to 'tests/PathOpsExtendedTest.cpp')
-rw-r--r-- | tests/PathOpsExtendedTest.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp index 93280d746d..b85644dca5 100644 --- a/tests/PathOpsExtendedTest.cpp +++ b/tests/PathOpsExtendedTest.cpp @@ -41,7 +41,6 @@ static const char* opSuffixes[] = { }; static bool gShowPath = false; -static bool gComparePaths = true; static bool gComparePathsAssert = true; static bool gPathStrAssert = true; @@ -512,7 +511,7 @@ bool testSimplify(SkPath& path, bool useXor, SkPath& out, PathOpsThreadState& st 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 @@ void DebugShowPath(const SkPath& a, const SkPath& b, SkPathOp shapeOp, const cha } #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 @@ bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, 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 @@ bool testPathOp(skiatest::Reporter* reporter, const SkPath& a, const SkPath& b, 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; |