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/PathOpsSimplifyRectThreadedTest.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/PathOpsSimplifyRectThreadedTest.cpp')
-rw-r--r-- | tests/PathOpsSimplifyRectThreadedTest.cpp | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/tests/PathOpsSimplifyRectThreadedTest.cpp b/tests/PathOpsSimplifyRectThreadedTest.cpp index 66b70d3142..6ed6a7bbd2 100644 --- a/tests/PathOpsSimplifyRectThreadedTest.cpp +++ b/tests/PathOpsSimplifyRectThreadedTest.cpp @@ -19,7 +19,10 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data) SkASSERT(data); PathOpsThreadState& state = *data; char pathStr[1024]; // gdb: set print elements 400 - sk_bzero(pathStr, sizeof(pathStr)); + bool progress = state.fReporter->verbose(); // FIXME: break out into its own parameter? + if (progress) { + sk_bzero(pathStr, sizeof(pathStr)); + } int aShape = state.fA & 0x03; SkPath::Direction aCW = state.fA >> 2 ? SkPath::kCCW_Direction : SkPath::kCW_Direction; int bShape = state.fB & 0x03; @@ -63,8 +66,10 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data) } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), aCW); - str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " SkPath::kC%sW_Direction);\n", l, t, r, b, aCW ? "C" : ""); + if (progress) { + str += sprintf(str, " path.addRect(%d, %d, %d, %d," + " SkPath::kC%sW_Direction);\n", l, t, r, b, aCW ? "C" : ""); + } } else { aXAlign = 5; aYAlign = 5; @@ -92,8 +97,10 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data) } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), bCW); - str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " SkPath::kC%sW_Direction);\n", l, t, r, b, bCW ? "C" : ""); + if (progress) { + str += sprintf(str, " path.addRect(%d, %d, %d, %d," + " SkPath::kC%sW_Direction);\n", l, t, r, b, bCW ? "C" : ""); + } } else { bXAlign = 5; bYAlign = 5; @@ -121,8 +128,10 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data) } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), cCW); - str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " SkPath::kC%sW_Direction);\n", l, t, r, b, cCW ? "C" : ""); + if (progress) { + str += sprintf(str, " path.addRect(%d, %d, %d, %d," + " SkPath::kC%sW_Direction);\n", l, t, r, b, cCW ? "C" : ""); + } } else { cXAlign = 5; cYAlign = 5; @@ -150,16 +159,22 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data) } path.addRect(SkIntToScalar(l), SkIntToScalar(t), SkIntToScalar(r), SkIntToScalar(b), dCW); - str += sprintf(str, " path.addRect(%d, %d, %d, %d," - " SkPath::kC%sW_Direction);\n", l, t, r, b, dCW ? "C" : ""); + if (progress) { + str += sprintf(str, " path.addRect(%d, %d, %d, %d," + " SkPath::kC%sW_Direction);\n", l, t, r, b, dCW ? "C" : ""); + } } else { dXAlign = 5; dYAlign = 5; } path.close(); - outputProgress(state.fPathStr, pathStr, SkPath::kWinding_FillType); + if (progress) { + outputProgress(state.fPathStr, pathStr, SkPath::kWinding_FillType); + } testSimplify(path, false, out, state, pathStr); - outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_FillType); + if (progress) { + outputProgress(state.fPathStr, pathStr, SkPath::kEvenOdd_FillType); + } testSimplify(path, true, out, state, pathStr); } } |