aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-02 21:45:03 +0000
committerGravatar tfarina@chromium.org <tfarina@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-01-02 21:45:03 +0000
commit78e7b4e1b928fa69f672be3c743df6d6c3ecbced (patch)
tree5bc67e556d8a790498b4700d0aa37495c89bfcd5 /tests
parentdab032a4ba4a93bff49adae064912e4bb6583784 (diff)
Get rid of DEFINE_TESTCLASS_SHORT() macro.
Instead tests should be written using DEF_TEST() macro, which is much nicer and simplifies the process of setting up an unit test. BUG=None TEST=skpskgr_test, pathops_unittest R=mtklein@google.com Review URL: https://codereview.chromium.org/117863005 git-svn-id: http://skia.googlecode.com/svn/trunk@12870 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r--tests/AndroidPaintTest.cpp9
-rw-r--r--tests/PathOpsAngleTest.cpp16
-rw-r--r--tests/PathOpsBoundsTest.cpp6
-rw-r--r--tests/PathOpsCubicIntersectionTest.cpp18
-rw-r--r--tests/PathOpsCubicLineIntersectionTest.cpp10
-rw-r--r--tests/PathOpsCubicQuadIntersectionTest.cpp6
-rw-r--r--tests/PathOpsCubicReduceOrderTest.cpp7
-rw-r--r--tests/PathOpsCubicToQuadsTest.cpp16
-rw-r--r--tests/PathOpsDCubicTest.cpp6
-rw-r--r--tests/PathOpsDLineTest.cpp6
-rw-r--r--tests/PathOpsDPointTest.cpp6
-rw-r--r--tests/PathOpsDQuadTest.cpp10
-rw-r--r--tests/PathOpsDRectTest.cpp6
-rw-r--r--tests/PathOpsDTriangleTest.cpp10
-rw-r--r--tests/PathOpsDVectorTest.cpp6
-rw-r--r--tests/PathOpsInverseTest.cpp6
-rw-r--r--tests/PathOpsLineIntersectionTest.cpp14
-rw-r--r--tests/PathOpsLineParametetersTest.cpp6
-rw-r--r--tests/PathOpsOpCubicThreadedTest.cpp10
-rw-r--r--tests/PathOpsOpRectThreadedTest.cpp6
-rw-r--r--tests/PathOpsOpTest.cpp6
-rw-r--r--tests/PathOpsQuadIntersectionTest.cpp15
-rw-r--r--tests/PathOpsQuadLineIntersectionTest.cpp10
-rw-r--r--tests/PathOpsQuadLineIntersectionThreadedTest.cpp7
-rw-r--r--tests/PathOpsQuadParameterizationTest.cpp6
-rw-r--r--tests/PathOpsQuadReduceOrderTest.cpp6
-rwxr-xr-xtests/PathOpsSimplifyDegenerateThreadedTest.cpp6
-rw-r--r--tests/PathOpsSimplifyFailTest.cpp14
-rw-r--r--tests/PathOpsSimplifyQuadThreadedTest.cpp7
-rwxr-xr-xtests/PathOpsSimplifyQuadralateralsThreadedTest.cpp6
-rw-r--r--tests/PathOpsSimplifyRectThreadedTest.cpp7
-rw-r--r--tests/PathOpsSimplifyTest.cpp6
-rwxr-xr-xtests/PathOpsSimplifyTrianglesThreadedTest.cpp6
-rwxr-xr-xtests/PathOpsSkpClipTest.cpp14
-rwxr-xr-xtests/PathOpsSkpTest.cpp8
-rwxr-xr-xtests/PathOpsTypesTest.cpp6
-rwxr-xr-xtests/SkpSkGrTest.cpp20
-rw-r--r--tests/TestClassDef.h43
38 files changed, 118 insertions, 255 deletions
diff --git a/tests/AndroidPaintTest.cpp b/tests/AndroidPaintTest.cpp
index 07d6e3f173..a638da9351 100644
--- a/tests/AndroidPaintTest.cpp
+++ b/tests/AndroidPaintTest.cpp
@@ -22,7 +22,7 @@ static size_t Reconstruct(const SkPaint& src, SkPaint* dst) {
return size;
}
-static void android_options_serialization(skiatest::Reporter* reporter) {
+DEF_TEST(AndroidOptionsSerialization, reporter) {
// We want to make sure that Android's paint options survive a flatten/unflatten round trip.
// These are all non-default options.
SkPaintOptionsAndroid options;
@@ -38,9 +38,8 @@ static void android_options_serialization(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, options == reconstructed.getPaintOptionsAndroid());
}
-DEFINE_TESTCLASS_SHORT(android_options_serialization);
-static void android_options_serialization_reverse(skiatest::Reporter* reporter) {
+DEF_TEST(AndroidOptionsSerializationReverse, reporter) {
// Opposite test of above: make sure the serialized default values of a paint overwrite
// non-default values on the paint we're unflattening into.
const SkPaint defaultOptions;
@@ -58,9 +57,8 @@ static void android_options_serialization_reverse(skiatest::Reporter* reporter)
defaultOptions.getPaintOptionsAndroid() ==
nonDefaultOptions.getPaintOptionsAndroid());
}
-DEFINE_TESTCLASS_SHORT(android_options_serialization_reverse);
-static void android_options_size(skiatest::Reporter* reporter) {
+DEF_TEST(AndroidOptionsSize, reporter) {
// A paint with default android options should serialize to something smaller than
// a paint with non-default android options.
@@ -76,6 +74,5 @@ static void android_options_size(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter,
Reconstruct(defaultOptions, &dummy) < Reconstruct(nonDefaultOptions, &dummy));
}
-DEFINE_TESTCLASS_SHORT(android_options_size);
#endif // SK_BUILD_FOR_ANDROID
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp
index e1fb038a24..f326a90cc4 100644
--- a/tests/PathOpsAngleTest.cpp
+++ b/tests/PathOpsAngleTest.cpp
@@ -8,6 +8,7 @@
#include "SkOpSegment.h"
#include "SkTArray.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkPoint cubics[][4] = {
/* 0 */ {{0, 1}, {2, 6}, {4, 2}, {5, 3}},
@@ -391,7 +392,7 @@ static void testOne(skiatest::Reporter* reporter, const SortSetTests& test) {
}
}
-static void PathOpsAngleTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsAngle, reporter) {
for (size_t index = 0; index < SK_ARRAY_COUNT(tests); ++index) {
const SortSetTests& test = tests[index];
testOne(reporter, test);
@@ -399,7 +400,7 @@ static void PathOpsAngleTest(skiatest::Reporter* reporter) {
}
}
-static void PathOpsAngleTestOne(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsAngleTestOne, reporter) {
size_t index = 0;
const SortSetTests& test = tests[index];
testOne(reporter, test);
@@ -451,7 +452,7 @@ static const double slopTests[][4] = {
{-2.1033774145221198, -1.4046019261273715e-008, -0.70062688352066704, -1.2706324683777995e-008},
};
-static void PathOpsAngleFindSlop(skiatest::Reporter* reporter) {
+/*DEF_TEST(PathOpsAngleFindSlop, reporter) {
for (size_t index = 0; index < SK_ARRAY_COUNT(slopTests); ++index) {
const double* slopTest = slopTests[index];
double x = slopTest[0];
@@ -467,12 +468,5 @@ static void PathOpsAngleFindSlop(skiatest::Reporter* reporter) {
angle, rAngle, diff, (int) (diff / FLT_EPSILON));
}
-}
+}*/
#endif
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsAngleTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsAngleTestOne)
-
-// DEFINE_TESTCLASS_SHORT(PathOpsAngleFindSlop)
diff --git a/tests/PathOpsBoundsTest.cpp b/tests/PathOpsBoundsTest.cpp
index 3d6091cb14..0e813d2a8e 100644
--- a/tests/PathOpsBoundsTest.cpp
+++ b/tests/PathOpsBoundsTest.cpp
@@ -7,6 +7,7 @@
#include "PathOpsTestCommon.h"
#include "SkPathOpsBounds.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkRect sectTests[][2] = {
{{2, 0, 4, 1}, {4, 0, 6, 1}},
@@ -46,7 +47,7 @@ static const SkRect notReallyEmpty[] = {
static const size_t notEmptyTestsCount = SK_ARRAY_COUNT(notReallyEmpty);
-static void PathOpsBoundsTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsBounds, reporter) {
for (size_t index = 0; index < sectTestsCount; ++index) {
const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(sectTests[index][0]);
SkASSERT(ValidBounds(bounds1));
@@ -108,6 +109,3 @@ static void PathOpsBoundsTest(skiatest::Reporter* reporter) {
(bounds.*SetCurveBounds[3])(curvePts);
REPORTER_ASSERT(reporter, bounds == expected);
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsBoundsTest)
diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp
index 8eb1756a14..974d426e6a 100644
--- a/tests/PathOpsCubicIntersectionTest.cpp
+++ b/tests/PathOpsCubicIntersectionTest.cpp
@@ -10,6 +10,7 @@
#include "SkPathOpsRect.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
const int firstCubicIntersectionTest = 9;
@@ -618,19 +619,19 @@ static void cubicIntersectionCoinTest(skiatest::Reporter* reporter) {
}
}
-static void PathOpsCubicCoinOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsCubicCoinOneOff, reporter) {
coinOneOff(reporter, 0);
}
-static void PathOpsCubicIntersectionOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsCubicIntersectionOneOff, reporter) {
newOneOff(reporter, 0, 1);
}
-static void PathOpsCubicSelfOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsCubicSelfOneOff, reporter) {
selfOneOff(reporter, 0);
}
-static void PathOpsCubicIntersectionTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsCubicIntersection, reporter) {
oneOffTests(reporter);
cubicIntersectionSelfTest(reporter);
cubicIntersectionCoinTest(reporter);
@@ -638,12 +639,3 @@ static void PathOpsCubicIntersectionTest(skiatest::Reporter* reporter) {
if (false) CubicIntersection_IntersectionFinder();
if (false) CubicIntersection_RandTest(reporter);
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionOneOffTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsCubicSelfOneOffTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsCubicCoinOneOffTest)
diff --git a/tests/PathOpsCubicLineIntersectionTest.cpp b/tests/PathOpsCubicLineIntersectionTest.cpp
index 520ba97e27..a021454cb6 100644
--- a/tests/PathOpsCubicLineIntersectionTest.cpp
+++ b/tests/PathOpsCubicLineIntersectionTest.cpp
@@ -10,6 +10,7 @@
#include "SkPathOpsLine.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
static struct lineCubic {
SkDCubic cubic;
@@ -76,7 +77,7 @@ static void testOne(skiatest::Reporter* reporter, int iIndex) {
}
}
-static void PathOpsCubicLineIntersectionTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsCubicLineIntersection, reporter) {
for (size_t index = 0; index < lineCubicTests_count; ++index) {
int iIndex = static_cast<int>(index);
testOne(reporter, iIndex);
@@ -84,7 +85,7 @@ static void PathOpsCubicLineIntersectionTest(skiatest::Reporter* reporter) {
}
}
-static void PathOpsCubicLineIntersectionOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsCubicLineIntersectionOneOff, reporter) {
int iIndex = 0;
testOne(reporter, iIndex);
const SkDCubic& cubic = lineCubicTests[iIndex].cubic;
@@ -108,8 +109,3 @@ static void PathOpsCubicLineIntersectionOneOffTest(skiatest::Reporter* reporter)
sect.distance(i.pt(0)), cubic[3].distance(prevL));
#endif
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionOneOffTest)
diff --git a/tests/PathOpsCubicQuadIntersectionTest.cpp b/tests/PathOpsCubicQuadIntersectionTest.cpp
index ce54b95ecf..7fca3c3e7e 100644
--- a/tests/PathOpsCubicQuadIntersectionTest.cpp
+++ b/tests/PathOpsCubicQuadIntersectionTest.cpp
@@ -10,6 +10,7 @@
#include "SkPathOpsQuad.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
static struct lineCubic {
SkDCubic cubic;
@@ -50,7 +51,7 @@ static struct lineCubic {
static const size_t quadCubicTests_count = SK_ARRAY_COUNT(quadCubicTests);
-static void PathOpsCubicQuadIntersectionTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsCubicQuadIntersection, reporter) {
for (size_t index = 0; index < quadCubicTests_count; ++index) {
int iIndex = static_cast<int>(index);
const SkDCubic& cubic = quadCubicTests[index].cubic;
@@ -95,6 +96,3 @@ static void PathOpsCubicQuadIntersectionTest(skiatest::Reporter* reporter) {
reporter->bumpTestCount();
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsCubicQuadIntersectionTest)
diff --git a/tests/PathOpsCubicReduceOrderTest.cpp b/tests/PathOpsCubicReduceOrderTest.cpp
index 9b3a4e0601..090e22ef86 100644
--- a/tests/PathOpsCubicReduceOrderTest.cpp
+++ b/tests/PathOpsCubicReduceOrderTest.cpp
@@ -11,6 +11,7 @@
#include "SkPathOpsRect.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
#if 0 // disable test until stroke reduction is supported
static bool controls_inside(const SkDCubic& cubic) {
@@ -58,7 +59,7 @@ static void find_tight_bounds(const SkDCubic& cubic, SkDRect& bounds) {
}
#endif
-static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsReduceOrderCubic, reporter) {
size_t index;
SkReduceOrder reducer;
int order;
@@ -240,7 +241,3 @@ static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) {
}
#endif
}
-
-#include "TestClassDef.h"
-
-DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderCubicTest)
diff --git a/tests/PathOpsCubicToQuadsTest.cpp b/tests/PathOpsCubicToQuadsTest.cpp
index 60def6dbfe..4c0f414ad7 100644
--- a/tests/PathOpsCubicToQuadsTest.cpp
+++ b/tests/PathOpsCubicToQuadsTest.cpp
@@ -12,6 +12,7 @@
#include "SkPathOpsRect.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
static void test(skiatest::Reporter* reporter, const SkDCubic* cubics, const char* name,
int firstTest, size_t testCount) {
@@ -93,7 +94,7 @@ static void testC(skiatest::Reporter* reporter, const SkDCubic(* cubics)[2], con
}
}
-static void CubicToQuads_Test(skiatest::Reporter* reporter) {
+DEF_TEST(CubicToQuads, reporter) {
enum {
RunAll,
RunPointDegenerates,
@@ -187,21 +188,12 @@ static void oneOff(skiatest::Reporter* reporter, size_t x) {
if (false) SkDebugf("%s quads=%d\n", __FUNCTION__, quads.count());
}
-static void CubicsToQuadratics_OneOffTests(skiatest::Reporter* reporter) {
+DEF_TEST(CubicsToQuadratics_OneOff_Loop, reporter) {
for (size_t x = 0; x < localsCount; ++x) {
oneOff(reporter, x);
}
}
-static void CubicsToQuadratics_OneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(CubicsToQuadratics_OneOff_Single, reporter) {
oneOff(reporter, 0);
}
-
-static void PathOpsCubicToQuadsTest(skiatest::Reporter* reporter) {
- CubicToQuads_Test(reporter);
- CubicsToQuadratics_OneOffTest(reporter);
- CubicsToQuadratics_OneOffTests(reporter);
-}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsCubicToQuadsTest)
diff --git a/tests/PathOpsDCubicTest.cpp b/tests/PathOpsDCubicTest.cpp
index d9e40f9e85..279564b7c5 100644
--- a/tests/PathOpsDCubicTest.cpp
+++ b/tests/PathOpsDCubicTest.cpp
@@ -7,6 +7,7 @@
#include "PathOpsTestCommon.h"
#include "SkPathOpsCubic.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDCubic tests[] = {
{{{2, 0}, {3, 1}, {2, 2}, {1, 1}}},
@@ -16,7 +17,7 @@ static const SkDCubic tests[] = {
static const size_t tests_count = SK_ARRAY_COUNT(tests);
-static void PathOpsDCubicTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsDCubic, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
const SkDCubic& cubic = tests[index];
SkASSERT(ValidCubic(cubic));
@@ -27,6 +28,3 @@ static void PathOpsDCubicTest(skiatest::Reporter* reporter) {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsDCubicTest)
diff --git a/tests/PathOpsDLineTest.cpp b/tests/PathOpsDLineTest.cpp
index ea816c5b8f..c7edb29f7d 100644
--- a/tests/PathOpsDLineTest.cpp
+++ b/tests/PathOpsDLineTest.cpp
@@ -7,6 +7,7 @@
#include "PathOpsTestCommon.h"
#include "SkPathOpsLine.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDLine tests[] = {
{{{2, 1}, {2, 1}}},
@@ -28,7 +29,7 @@ static const SkDPoint left[] = {
static const size_t tests_count = SK_ARRAY_COUNT(tests);
-static void PathOpsLineUtilitiesTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsLineUtilities, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
const SkDLine& line = tests[index];
SkASSERT(ValidLine(line));
@@ -52,6 +53,3 @@ static void PathOpsLineUtilitiesTest(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, approximately_equal((line[0].fY + line[1].fY) / 2, mid.fY));
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsLineUtilitiesTest)
diff --git a/tests/PathOpsDPointTest.cpp b/tests/PathOpsDPointTest.cpp
index 8621e66798..507a32029a 100644
--- a/tests/PathOpsDPointTest.cpp
+++ b/tests/PathOpsDPointTest.cpp
@@ -7,6 +7,7 @@
#include "PathOpsTestCommon.h"
#include "SkPathOpsPoint.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDPoint tests[] = {
{0, 0},
@@ -20,7 +21,7 @@ static const SkDPoint tests[] = {
static const size_t tests_count = SK_ARRAY_COUNT(tests);
-static void PathOpsDPointTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsDPoint, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
const SkDPoint& pt = tests[index];
SkASSERT(ValidPoint(pt));
@@ -47,6 +48,3 @@ static void PathOpsDPointTest(skiatest::Reporter* reporter) {
sqrt(pt.fX * pt.fX + pt.fY * pt.fY)));
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsDPointTest)
diff --git a/tests/PathOpsDQuadTest.cpp b/tests/PathOpsDQuadTest.cpp
index e6f1deb72f..80d81e8129 100644
--- a/tests/PathOpsDQuadTest.cpp
+++ b/tests/PathOpsDQuadTest.cpp
@@ -9,6 +9,7 @@
#include "SkPathOpsQuad.h"
#include "SkRRect.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDQuad tests[] = {
{{{1, 1}, {2, 1}, {0, 2}}},
@@ -36,7 +37,7 @@ static const SkDPoint outPoint[]= {
static const size_t tests_count = SK_ARRAY_COUNT(tests);
-static void PathOpsDQuadTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsDQuad, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
const SkDQuad& quad = tests[index];
SkASSERT(ValidQuad(quad));
@@ -53,7 +54,7 @@ static void PathOpsDQuadTest(skiatest::Reporter* reporter) {
}
}
-static void PathOpsRRectTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsRRect, reporter) {
SkPath path;
SkRRect rRect;
SkRect rect = {135, 143, 250, 177};
@@ -61,8 +62,3 @@ static void PathOpsRRectTest(skiatest::Reporter* reporter) {
rRect.setRectRadii(rect, radii);
path.addRRect(rRect);
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsDQuadTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsRRectTest)
diff --git a/tests/PathOpsDRectTest.cpp b/tests/PathOpsDRectTest.cpp
index 7cadf6340e..21c5f2a34c 100644
--- a/tests/PathOpsDRectTest.cpp
+++ b/tests/PathOpsDRectTest.cpp
@@ -10,6 +10,7 @@
#include "SkPathOpsQuad.h"
#include "SkPathOpsRect.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDLine lineTests[] = {
{{{2, 1}, {2, 1}}},
@@ -38,7 +39,7 @@ static const size_t lineTests_count = SK_ARRAY_COUNT(lineTests);
static const size_t quadTests_count = SK_ARRAY_COUNT(quadTests);
static const size_t cubicTests_count = SK_ARRAY_COUNT(cubicTests);
-static void PathOpsDRectTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsDRect, reporter) {
size_t index;
SkDRect rect, rect2;
for (index = 0; index < lineTests_count; ++index) {
@@ -99,6 +100,3 @@ static void PathOpsDRectTest(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, rect.contains(rightBottom));
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsDRectTest)
diff --git a/tests/PathOpsDTriangleTest.cpp b/tests/PathOpsDTriangleTest.cpp
index 6ee05847e5..1a06287c2f 100644
--- a/tests/PathOpsDTriangleTest.cpp
+++ b/tests/PathOpsDTriangleTest.cpp
@@ -7,6 +7,7 @@
#include "PathOpsTestCommon.h"
#include "SkPathOpsTriangle.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDTriangle tests[] = {
{{{2, 0}, {3, 1}, {2, 2}}},
@@ -28,7 +29,7 @@ static const SkDPoint outPoint[] = {
static const size_t tests_count = SK_ARRAY_COUNT(tests);
-static void PathOpsTriangleUtilitiesTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsTriangleUtilities, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
const SkDTriangle& triangle = tests[index];
SkASSERT(ValidTriangle(triangle));
@@ -55,7 +56,7 @@ static const SkDTriangle oneOff[] = {
static const size_t oneOff_count = SK_ARRAY_COUNT(oneOff);
-static void PathOpsTriangleOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsTriangleOneOff, reporter) {
for (size_t index = 0; index < oneOff_count; ++index) {
const SkDTriangle& triangle = oneOff[index];
SkASSERT(ValidTriangle(triangle));
@@ -68,8 +69,3 @@ static void PathOpsTriangleOneOffTest(skiatest::Reporter* reporter) {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsTriangleUtilitiesTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsTriangleOneOffTest)
diff --git a/tests/PathOpsDVectorTest.cpp b/tests/PathOpsDVectorTest.cpp
index 23ca2a8186..4d350373f9 100644
--- a/tests/PathOpsDVectorTest.cpp
+++ b/tests/PathOpsDVectorTest.cpp
@@ -7,6 +7,7 @@
#include "PathOpsTestCommon.h"
#include "SkPathOpsPoint.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDPoint tests[] = {
{0, 0},
@@ -20,7 +21,7 @@ static const SkDPoint tests[] = {
static const size_t tests_count = SK_ARRAY_COUNT(tests);
-static void PathOpsDVectorTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsDVector, reporter) {
for (size_t index = 0; index < tests_count - 1; ++index) {
SkDVector v1 = tests[index + 1] - tests[index];
SkASSERT(ValidVector(v1));
@@ -48,6 +49,3 @@ static void PathOpsDVectorTest(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, v1Cross == 0);
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsDVectorTest)
diff --git a/tests/PathOpsInverseTest.cpp b/tests/PathOpsInverseTest.cpp
index 6d6e0e3ef8..adbb80da98 100644
--- a/tests/PathOpsInverseTest.cpp
+++ b/tests/PathOpsInverseTest.cpp
@@ -5,8 +5,9 @@
* found in the LICENSE file.
*/
#include "PathOpsExtendedTest.h"
+#include "TestClassDef.h"
-static void PathOpsInverseTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsInverse, reporter) {
SkPath one, two;
for (int op = kDifference_PathOp; op <= kReverseDifference_PathOp; ++op) {
for (int oneFill = SkPath::kWinding_FillType; oneFill <= SkPath::kInverseEvenOdd_FillType;
@@ -29,6 +30,3 @@ static void PathOpsInverseTest(skiatest::Reporter* reporter) {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsInverseTest)
diff --git a/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp
index 9934731f7e..3633262115 100644
--- a/tests/PathOpsLineIntersectionTest.cpp
+++ b/tests/PathOpsLineIntersectionTest.cpp
@@ -8,6 +8,7 @@
#include "SkIntersections.h"
#include "SkPathOpsLine.h"
#include "Test.h"
+#include "TestClassDef.h"
// FIXME: add tests for intersecting, non-intersecting, degenerate, coincident
static const SkDLine tests[][2] = {
@@ -178,7 +179,7 @@ static void testOneCoincident(skiatest::Reporter* reporter, const SkDLine& line1
reporter->bumpTestCount();
}
-static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsLineIntersection, reporter) {
size_t index;
for (index = 0; index < coincidentTests_count; ++index) {
const SkDLine& line1 = coincidentTests[index][0];
@@ -201,24 +202,17 @@ static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) {
}
}
-static void PathOpsLineIntersectionOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsLineIntersectionOneOff, reporter) {
int index = 0;
SkASSERT(index < (int) tests_count);
testOne(reporter, tests[index][0], tests[index][1]);
testOne(reporter, tests[1][0], tests[1][1]);
}
-static void PathOpsLineIntersectionOneCoincidentTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsLineIntersectionOneCoincident, reporter) {
int index = 0;
SkASSERT(index < (int) coincidentTests_count);
const SkDLine& line1 = coincidentTests[index][0];
const SkDLine& line2 = coincidentTests[index][1];
testOneCoincident(reporter, line1, line2);
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsLineIntersectionTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsLineIntersectionOneOffTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsLineIntersectionOneCoincidentTest)
diff --git a/tests/PathOpsLineParametetersTest.cpp b/tests/PathOpsLineParametetersTest.cpp
index 52263826c7..e67b0f726e 100644
--- a/tests/PathOpsLineParametetersTest.cpp
+++ b/tests/PathOpsLineParametetersTest.cpp
@@ -7,6 +7,7 @@
#include "PathOpsTestCommon.h"
#include "SkLineParameters.h"
#include "Test.h"
+#include "TestClassDef.h"
// tests to verify that distance calculations are coded correctly
static const SkDCubic tests[] = {
@@ -37,7 +38,7 @@ static const double answers[][2] = {
static const size_t tests_count = SK_ARRAY_COUNT(tests);
-static void PathOpsLineParametersTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsLineParameters, reporter) {
for (size_t index = 0; index < tests_count; ++index) {
SkLineParameters lineParameters;
const SkDCubic& cubic = tests[index];
@@ -77,6 +78,3 @@ static void PathOpsLineParametersTest(skiatest::Reporter* reporter) {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsLineParametersTest)
diff --git a/tests/PathOpsOpCubicThreadedTest.cpp b/tests/PathOpsOpCubicThreadedTest.cpp
index 99e68daae6..cf10bb5ef1 100644
--- a/tests/PathOpsOpCubicThreadedTest.cpp
+++ b/tests/PathOpsOpCubicThreadedTest.cpp
@@ -6,9 +6,9 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+#include "TestClassDef.h"
-static void testOpCubicsMain(PathOpsThreadState* data)
-{
+static void testOpCubicsMain(PathOpsThreadState* data) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
@@ -67,8 +67,7 @@ static void testOpCubicsMain(PathOpsThreadState* data)
}
}
-static void PathOpsOpCubicsThreadedTest(skiatest::Reporter* reporter)
-{
+DEF_TEST(PathOpsOpCubicsThreaded, reporter) {
int threadCount = initializeTests(reporter, "cubicOp");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 6; ++a) { // outermost
@@ -85,6 +84,3 @@ static void PathOpsOpCubicsThreadedTest(skiatest::Reporter* reporter)
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsOpCubicsThreadedTest)
diff --git a/tests/PathOpsOpRectThreadedTest.cpp b/tests/PathOpsOpRectThreadedTest.cpp
index 59a0d54f4d..fee44e51b2 100644
--- a/tests/PathOpsOpRectThreadedTest.cpp
+++ b/tests/PathOpsOpRectThreadedTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+#include "TestClassDef.h"
// four rects, of four sizes
// for 3 smaller sizes, tall, wide
@@ -73,7 +74,7 @@ static void testPathOpsRectsMain(PathOpsThreadState* data)
}
}
-static void PathOpsRectsThreadedTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsRectsThreaded, reporter) {
int threadCount = initializeTests(reporter, "testOp");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 6; ++a) { // outermost
@@ -90,6 +91,3 @@ static void PathOpsRectsThreadedTest(skiatest::Reporter* reporter) {
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsRectsThreadedTest)
diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp
index e083ac57ae..7e30141862 100644
--- a/tests/PathOpsOpTest.cpp
+++ b/tests/PathOpsOpTest.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "PathOpsExtendedTest.h"
+#include "TestClassDef.h"
#define TEST(name) { name, #name }
@@ -3285,7 +3286,7 @@ static bool runSubTestsFirst = false;
static bool runReverse = false;
static void (*stopTest)(skiatest::Reporter* ) = 0;
-static void PathOpsOpTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsOp, reporter) {
#ifdef SK_DEBUG
SkPathOpsDebug::gMaxWindSum = 4;
SkPathOpsDebug::gMaxWindValue = 4;
@@ -3305,6 +3306,3 @@ static void PathOpsOpTest(skiatest::Reporter* reporter) {
SkPathOpsDebug::gMaxWindValue = SK_MaxS32;
#endif
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsOpTest)
diff --git a/tests/PathOpsQuadIntersectionTest.cpp b/tests/PathOpsQuadIntersectionTest.cpp
index 3fdbb5f3c6..fea0426ff5 100644
--- a/tests/PathOpsQuadIntersectionTest.cpp
+++ b/tests/PathOpsQuadIntersectionTest.cpp
@@ -10,6 +10,7 @@
#include "SkPathOpsRect.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
static void standardTestCases(skiatest::Reporter* reporter) {
bool showSkipped = false;
@@ -283,7 +284,7 @@ static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner
}
}
-static void PathOpsQuadIntersectionOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsQuadIntersectionOneOff, reporter) {
oneOffTest1(reporter, 0, 1);
}
@@ -332,7 +333,7 @@ static void coincidentTest(skiatest::Reporter* reporter) {
}
}
-static void PathOpsQuadIntersectionCoincidenceOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsQuadIntersectionCoincidenceOneOff, reporter) {
coincidentTestOne(reporter, 0, 1);
}
@@ -499,18 +500,10 @@ static void QuadraticIntersection_IntersectionFinder() {
intersectionFinder(0, 1);
}
-static void PathOpsQuadIntersectionTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsQuadIntersection, reporter) {
oneOffTests(reporter);
coincidentTest(reporter);
standardTestCases(reporter);
if (false) QuadraticIntersection_IntersectionFinder();
if (false) QuadraticIntersection_PointFinder();
}
-
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionOneOffTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionCoincidenceOneOffTest)
diff --git a/tests/PathOpsQuadLineIntersectionTest.cpp b/tests/PathOpsQuadLineIntersectionTest.cpp
index 775643fa06..e4235d1a40 100644
--- a/tests/PathOpsQuadLineIntersectionTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionTest.cpp
@@ -11,6 +11,7 @@
#include "SkPathOpsQuad.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
static struct lineQuad {
SkDQuad quad;
@@ -97,11 +98,11 @@ static void testOneOffs(skiatest::Reporter* reporter) {
}
}
-static void PathOpsQuadLineIntersectionOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsQuadLineIntersectionOneOff, reporter) {
testOneOffs(reporter);
}
-static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsQuadLineIntersection, reporter) {
for (size_t index = 0; index < lineQuadTests_count; ++index) {
int iIndex = static_cast<int>(index);
const SkDQuad& quad = lineQuadTests[index].quad;
@@ -147,8 +148,3 @@ static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionOneOffTest)
diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
index 7090c1056d..44654617ca 100644
--- a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
+++ b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp
@@ -10,6 +10,7 @@
#include "SkPathOpsLine.h"
#include "SkPathOpsQuad.h"
#include "SkReduceOrder.h"
+#include "TestClassDef.h"
static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, const SkDLine& line,
bool& flipped) {
@@ -111,8 +112,7 @@ static void testQuadLineIntersectMain(PathOpsThreadState* data)
}
}
-static void PathOpsQuadLineIntersectionThreadedTest(skiatest::Reporter* reporter)
-{
+DEF_TEST(PathOpsQuadLineIntersectionThreaded, reporter) {
int threadCount = initializeTests(reporter, "testQuadLineIntersect");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 16; ++a) {
@@ -127,6 +127,3 @@ static void PathOpsQuadLineIntersectionThreadedTest(skiatest::Reporter* reporter
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionThreadedTest)
diff --git a/tests/PathOpsQuadParameterizationTest.cpp b/tests/PathOpsQuadParameterizationTest.cpp
index bb8ec2e636..042730779c 100644
--- a/tests/PathOpsQuadParameterizationTest.cpp
+++ b/tests/PathOpsQuadParameterizationTest.cpp
@@ -7,6 +7,7 @@
#include "SkDQuadImplicit.h"
#include "SkPathOpsQuad.h"
#include "Test.h"
+#include "TestClassDef.h"
static bool point_on_parameterized_curve(const SkDQuad& quad, const SkDPoint& point) {
SkDQuadImplicit q(quad);
@@ -26,7 +27,7 @@ static const SkDQuad quadratics[] = {
static const size_t quadratics_count = SK_ARRAY_COUNT(quadratics);
-static void PathOpsQuadImplicitTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsQuadImplicit, reporter) {
// split large quadratic
// compare original, parts, to see if the are coincident
for (size_t index = 0; index < quadratics_count; ++index) {
@@ -48,6 +49,3 @@ static void PathOpsQuadImplicitTest(skiatest::Reporter* reporter) {
}
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsQuadImplicitTest)
diff --git a/tests/PathOpsQuadReduceOrderTest.cpp b/tests/PathOpsQuadReduceOrderTest.cpp
index 2626847042..4c3432755f 100644
--- a/tests/PathOpsQuadReduceOrderTest.cpp
+++ b/tests/PathOpsQuadReduceOrderTest.cpp
@@ -9,6 +9,7 @@
#include "SkPathOpsRect.h"
#include "SkReduceOrder.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkDQuad testSet[] = {
{{{1, 1}, {2, 2}, {1, 1.000003}}},
@@ -62,10 +63,7 @@ static void standardTestCases(skiatest::Reporter* reporter) {
}
}
-static void PathOpsReduceOrderQuadTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsReduceOrderQuad, reporter) {
oneOffTest(reporter);
standardTestCases(reporter);
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderQuadTest)
diff --git a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
index 9ed1f3a031..5e2ad04771 100755
--- a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
+++ b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+#include "TestClassDef.h"
static void testSimplifyDegeneratesMain(PathOpsThreadState* data) {
SkASSERT(data);
@@ -67,7 +68,7 @@ static void testSimplifyDegeneratesMain(PathOpsThreadState* data) {
}
}
-static void PathOpsSimplifyDegeneratesThreadedTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSimplifyDegeneratesThreaded, reporter) {
int threadCount = initializeTests(reporter, "testDegenerates");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 16; ++a) {
@@ -90,6 +91,3 @@ static void PathOpsSimplifyDegeneratesThreadedTest(skiatest::Reporter* reporter)
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyDegeneratesThreadedTest)
diff --git a/tests/PathOpsSimplifyFailTest.cpp b/tests/PathOpsSimplifyFailTest.cpp
index 8c0f9ba852..d0f98a11a6 100644
--- a/tests/PathOpsSimplifyFailTest.cpp
+++ b/tests/PathOpsSimplifyFailTest.cpp
@@ -8,6 +8,7 @@
#include "SkPath.h"
#include "SkPoint.h"
#include "Test.h"
+#include "TestClassDef.h"
static const SkPoint nonFinitePts[] = {
{ SK_ScalarInfinity, 0 },
@@ -91,7 +92,7 @@ static void dontFailOne(skiatest::Reporter* reporter, int index) {
reporter->bumpTestCount();
}
-static void PathOpsSimplifyFailTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSimplifyFail, reporter) {
for (int index = 0; index < (int) (13 * nonFinitePtsCount * finitePtsCount); ++index) {
failOne(reporter, index);
}
@@ -100,19 +101,12 @@ static void PathOpsSimplifyFailTest(skiatest::Reporter* reporter) {
}
}
-static void PathOpsSimplifyFailOneTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSimplifyFailOne, reporter) {
int index = 0;
failOne(reporter, index);
}
-static void PathOpsSimplifyDontFailOneTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSimplifyDontFailOne, reporter) {
int index = 6;
dontFailOne(reporter, index);
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyFailTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyFailOneTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyDontFailOneTest)
diff --git a/tests/PathOpsSimplifyQuadThreadedTest.cpp b/tests/PathOpsSimplifyQuadThreadedTest.cpp
index d1e0dac4d3..e33333a9e5 100644
--- a/tests/PathOpsSimplifyQuadThreadedTest.cpp
+++ b/tests/PathOpsSimplifyQuadThreadedTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+#include "TestClassDef.h"
static void testSimplifyQuadsMain(PathOpsThreadState* data)
{
@@ -73,8 +74,7 @@ static void testSimplifyQuadsMain(PathOpsThreadState* data)
}
}
-static void PathOpsSimplifyQuadsThreadedTest(skiatest::Reporter* reporter)
-{
+DEF_TEST(PathOpsSimplifyQuadsThreaded, reporter) {
int threadCount = initializeTests(reporter, "testQuads");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
int a = 0;
@@ -92,6 +92,3 @@ static void PathOpsSimplifyQuadsThreadedTest(skiatest::Reporter* reporter)
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadsThreadedTest)
diff --git a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
index 96960b558c..f78a9ed911 100755
--- a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
+++ b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+#include "TestClassDef.h"
static void testSimplifyQuadralateralsMain(PathOpsThreadState* data)
{
@@ -75,7 +76,7 @@ static void testSimplifyQuadralateralsMain(PathOpsThreadState* data)
}
}
-static void PathOpsSimplifyQuadralateralsThreadedTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSimplifyQuadralateralsThreaded, reporter) {
int threadCount = initializeTests(reporter, "testQuadralaterals");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 16; ++a) {
@@ -92,6 +93,3 @@ static void PathOpsSimplifyQuadralateralsThreadedTest(skiatest::Reporter* report
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadralateralsThreadedTest)
diff --git a/tests/PathOpsSimplifyRectThreadedTest.cpp b/tests/PathOpsSimplifyRectThreadedTest.cpp
index 6ed6a7bbd2..35cca7d933 100644
--- a/tests/PathOpsSimplifyRectThreadedTest.cpp
+++ b/tests/PathOpsSimplifyRectThreadedTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+#include "TestClassDef.h"
// four rects, of four sizes
// for 3 smaller sizes, tall, wide
@@ -186,8 +187,7 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data)
}
}
-static void PathOpsSimplifyRectsThreadedTest(skiatest::Reporter* reporter)
-{
+DEF_TEST(PathOpsSimplifyRectsThreaded, reporter) {
int threadCount = initializeTests(reporter, "testLine");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 8; ++a) { // outermost
@@ -204,6 +204,3 @@ static void PathOpsSimplifyRectsThreadedTest(skiatest::Reporter* reporter)
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyRectsThreadedTest)
diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp
index 77bc28c446..fff52ca3c8 100644
--- a/tests/PathOpsSimplifyTest.cpp
+++ b/tests/PathOpsSimplifyTest.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
#include "PathOpsExtendedTest.h"
+#include "TestClassDef.h"
#define TEST(name) { name, #name }
@@ -4337,7 +4338,7 @@ static bool runSubTestsFirst = false;
static bool runReverse = false;
static void (*stopTest)(skiatest::Reporter* ) = 0;
-static void PathOpsSimplifyTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSimplify, reporter) {
#ifdef SK_DEBUG
SkPathOpsDebug::gMaxWindSum = 4;
SkPathOpsDebug::gMaxWindValue = 4;
@@ -4354,6 +4355,3 @@ static void PathOpsSimplifyTest(skiatest::Reporter* reporter) {
SkPathOpsDebug::gMaxWindValue = SK_MaxS32;
#endif
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest)
diff --git a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
index 0b821d6e38..a8feaaf10b 100755
--- a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
+++ b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsExtendedTest.h"
#include "PathOpsThreadedCommon.h"
+#include "TestClassDef.h"
static void testSimplifyTrianglesMain(PathOpsThreadState* data) {
SkASSERT(data);
@@ -72,7 +73,7 @@ static void testSimplifyTrianglesMain(PathOpsThreadState* data) {
}
}
-static void PathOpsSimplifyTrianglesThreadedTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSimplifyTrianglesThreaded, reporter) {
int threadCount = initializeTests(reporter, "testTriangles");
PathOpsThreadedTestRunner testRunner(reporter, threadCount);
for (int a = 0; a < 15; ++a) {
@@ -99,6 +100,3 @@ static void PathOpsSimplifyTrianglesThreadedTest(skiatest::Reporter* reporter) {
finish:
testRunner.render();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTrianglesThreadedTest)
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index 93c9de5718..bd39151a85 100755
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -18,6 +18,7 @@
#include "SkThreadPool.h"
#include "SkTime.h"
#include "Test.h"
+#include "TestClassDef.h"
#ifdef SK_BUILD_FOR_WIN
#define PATH_SLASH "\\"
@@ -612,7 +613,7 @@ static void encodeFound(skiatest::Reporter* reporter, TestState& state) {
}
}
-static void PathOpsSkpClipTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSkpClip, reporter) {
if (!initTest()) {
return;
}
@@ -635,7 +636,7 @@ static void testSkpClipMain(TestState* data) {
(void) doOneDir(data);
}
-static void PathOpsSkpClipThreadedTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSkpClipThreaded, reporter) {
if (!initTest()) {
return;
}
@@ -661,7 +662,7 @@ static void PathOpsSkpClipThreadedTest(skiatest::Reporter* reporter) {
encodeFound(reporter, state);
}
-static void PathOpsSkpClipOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSkpClipOneOff, reporter) {
if (!initTest()) {
return;
}
@@ -677,10 +678,3 @@ static void PathOpsSkpClipOneOffTest(skiatest::Reporter* reporter) {
state.fTestStep = kEncodeFiles;
state.testOne();
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsSkpClipTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsSkpClipOneOffTest)
-
-DEFINE_TESTCLASS_SHORT(PathOpsSkpClipThreadedTest)
diff --git a/tests/PathOpsSkpTest.cpp b/tests/PathOpsSkpTest.cpp
index c92abc0e5c..86fe6058a1 100755
--- a/tests/PathOpsSkpTest.cpp
+++ b/tests/PathOpsSkpTest.cpp
@@ -6,6 +6,8 @@
*/
#include "PathOpsExtendedTest.h"
+#include "TestClassDef.h"
+
#define TEST(name) { name, #name }
static void skpcheeseandburger_com225(skiatest::Reporter* reporter) {
@@ -1657,13 +1659,9 @@ static const size_t testCount = SK_ARRAY_COUNT(tests);
static bool runReverse = false;
static void (*stopTest)(skiatest::Reporter* ) = 0;
-static void PathOpsSkpTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsSkp, reporter) {
#if DEBUG_SHOW_TEST_NAME
strncpy(DEBUG_FILENAME_STRING, "", DEBUG_FILENAME_STRING_LENGTH);
#endif
RunTestSet(reporter, tests, testCount, firstTest, stopTest, runReverse);
}
-
-#include "TestClassDef.h"
-
-DEFINE_TESTCLASS_SHORT(PathOpsSkpTest)
diff --git a/tests/PathOpsTypesTest.cpp b/tests/PathOpsTypesTest.cpp
index 820f69eac4..a43fe030bb 100755
--- a/tests/PathOpsTypesTest.cpp
+++ b/tests/PathOpsTypesTest.cpp
@@ -6,6 +6,7 @@
*/
#include "PathOpsTestCommon.h"
#include "Test.h"
+#include "TestClassDef.h"
static const double roughlyTests[][2] = {
{5.0402503619650929e-005, 4.3178054475078825e-005}
@@ -13,12 +14,9 @@ static const double roughlyTests[][2] = {
static const size_t roughlyTestsCount = SK_ARRAY_COUNT(roughlyTests);
-static void PathOpsRoughlyTest(skiatest::Reporter* reporter) {
+DEF_TEST(PathOpsRoughly, reporter) {
for (size_t index = 0; index < roughlyTestsCount; ++index) {
bool equal = RoughlyEqualUlps(roughlyTests[index][0], roughlyTests[index][1]);
REPORTER_ASSERT(reporter, equal);
}
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(PathOpsRoughlyTest)
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 1f0529e016..a896517c56 100755
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -26,6 +26,7 @@
#include "SkThreadPool.h"
#include "SkTime.h"
#include "Test.h"
+#include "TestClassDef.h"
#ifdef SK_BUILD_FOR_WIN
#define PATH_SLASH "\\"
@@ -36,7 +37,7 @@
#define PATH_SLASH "/"
#define IN_DIR "/usr/local/google/home/caryclark" PATH_SLASH "9-30-13-skp"
#define OUT_DIR "/media/01CD75512A7F9EE0/4" PATH_SLASH
- #define LINE_FEED \n"
+ #define LINE_FEED "\n"
#endif
#define PATH_STR_SIZE 512
@@ -572,7 +573,7 @@ static bool initTest() {
return make_out_dirs();
}
-static void SkpSkGrTest(skiatest::Reporter* reporter) {
+DEF_TEST(SkpSkGr, reporter) {
SkTArray<TestResult, true> errors;
if (!initTest()) {
return;
@@ -628,8 +629,8 @@ static void SkpSkGrTest(skiatest::Reporter* reporter) {
SkDebugf("#%d\n", testCount);
}
}
- skipOver:
- reporter->bumpTestCount();
+ skipOver:
+ reporter->bumpTestCount();
checkEarlyExit:
if (1 && testCount == 20) {
break;
@@ -669,7 +670,7 @@ static void testSkGrMain(SkpSkGrThreadState* data) {
data->fReporter->bumpTestCount();
}
-static void SkpSkGrThreadedTest(skiatest::Reporter* reporter) {
+DEF_TEST(SkpSkGrThreaded, reporter) {
if (!initTest()) {
return;
}
@@ -736,7 +737,7 @@ static void SkpSkGrThreadedTest(skiatest::Reporter* reporter) {
}
}
-static void SkpSkGrOneOffTest(skiatest::Reporter* reporter) {
+DEF_TEST(SkpSkGrOneOff, reporter) {
if (!initTest()) {
return;
}
@@ -750,10 +751,3 @@ static void SkpSkGrOneOffTest(skiatest::Reporter* reporter) {
TestResult::Test(dirIndex, filename.c_str(), kCompareBits, reporter->verbose());
TestResult::Test(dirIndex, filename.c_str(), kEncodeFiles, reporter->verbose());
}
-
-#include "TestClassDef.h"
-DEFINE_TESTCLASS_SHORT(SkpSkGrTest)
-
-DEFINE_TESTCLASS_SHORT(SkpSkGrOneOffTest)
-
-DEFINE_TESTCLASS_SHORT(SkpSkGrThreadedTest)
diff --git a/tests/TestClassDef.h b/tests/TestClassDef.h
index 601603353c..f874acc007 100644
--- a/tests/TestClassDef.h
+++ b/tests/TestClassDef.h
@@ -10,25 +10,26 @@
e.g.
#include "TestClassDef.h"
- DEFINE_TESTCLASS_SHORT(MyTestFunction)
- where MyTestFunction is declared as:
-
- static void MyTestFunction(skiatest::Reporter* reporter) {
+ DEF_TEST(some_test_name, r) {
+ ...
+ REPORTER_ASSERT(r, x == 15);
}
*/
-#define DEFINE_TESTCLASS_SHORT(function) \
- namespace skiatest { \
- class function##Class : public Test { \
- public: \
- static Test* Factory(void*) { return SkNEW(function##Class); } \
- protected: \
- virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#function); } \
- virtual void onRun(Reporter* reporter) SK_OVERRIDE { function(reporter); } \
- }; \
- static TestRegistry gReg_##function##Class(function##Class::Factory); \
- }
+#define DEF_TEST(name, reporter) \
+ static void name(skiatest::Reporter* reporter); \
+ namespace skiatest { \
+ class name##Class : public Test { \
+ public: \
+ static Test* Factory(void*) { return SkNEW(name##Class); } \
+ protected: \
+ virtual void onGetName(SkString* name) SK_OVERRIDE { name->set(#name); } \
+ virtual void onRun(Reporter* reporter) SK_OVERRIDE { name(reporter); } \
+ }; \
+ static TestRegistry gReg_##name##Class(name##Class::Factory); \
+ } \
+ static void name(skiatest::Reporter* reporter)
#define DEFINE_GPUTESTCLASS(uiname, classname, function) \
namespace skiatest { \
@@ -43,15 +44,3 @@
}; \
static TestRegistry gReg_##classname(classname::Factory); \
}
-
-
-// Yet shorter way to define a test. E.g.
-//
-// DEF_TEST(some_test_name, r) {
-// ...
-// REPORTER_ASSERT(r, x == 15);
-// }
-#define DEF_TEST(name, reporter) \
- static void name(skiatest::Reporter* reporter); \
- DEFINE_TESTCLASS_SHORT(name) \
- static void name(skiatest::Reporter* reporter)