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/PathOpsBoundsTest.cpp b/tests/PathOpsBoundsTest.cpp
index 9d686a5..3d6091c 100644
--- a/tests/PathOpsBoundsTest.cpp
+++ b/tests/PathOpsBoundsTest.cpp
@@ -4,6 +4,7 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+#include "PathOpsTestCommon.h"
#include "SkPathOpsBounds.h"
#include "Test.h"
@@ -48,13 +49,17 @@
static void PathOpsBoundsTest(skiatest::Reporter* reporter) {
for (size_t index = 0; index < sectTestsCount; ++index) {
const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(sectTests[index][0]);
+ SkASSERT(ValidBounds(bounds1));
const SkPathOpsBounds& bounds2 = static_cast<const SkPathOpsBounds&>(sectTests[index][1]);
+ SkASSERT(ValidBounds(bounds2));
bool touches = SkPathOpsBounds::Intersects(bounds1, bounds2);
REPORTER_ASSERT(reporter, touches);
}
for (size_t index = 0; index < noSectTestsCount; ++index) {
const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(noSectTests[index][0]);
+ SkASSERT(ValidBounds(bounds1));
const SkPathOpsBounds& bounds2 = static_cast<const SkPathOpsBounds&>(noSectTests[index][1]);
+ SkASSERT(ValidBounds(bounds2));
bool touches = SkPathOpsBounds::Intersects(bounds1, bounds2);
REPORTER_ASSERT(reporter, !touches);
}
@@ -76,11 +81,13 @@
REPORTER_ASSERT(reporter, bounds == expected);
for (size_t index = 0; index < emptyTestsCount; ++index) {
const SkPathOpsBounds& bounds = static_cast<const SkPathOpsBounds&>(reallyEmpty[index]);
+ // SkASSERT(ValidBounds(bounds)); // don't check because test may contain nan
bool empty = bounds.isReallyEmpty();
REPORTER_ASSERT(reporter, empty);
}
for (size_t index = 0; index < notEmptyTestsCount; ++index) {
const SkPathOpsBounds& bounds = static_cast<const SkPathOpsBounds&>(notReallyEmpty[index]);
+ SkASSERT(ValidBounds(bounds));
bool empty = bounds.isReallyEmpty();
REPORTER_ASSERT(reporter, !empty);
}