diff options
author | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-15 19:13:59 +0000 |
---|---|---|
committer | caryclark@google.com <caryclark@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-04-15 19:13:59 +0000 |
commit | ad65a3e5fb1f94699f183551b828efbcc6a133ce (patch) | |
tree | 5908b619b257c5bfc45ddb40be1b9099c37d67ee /tests | |
parent | 9becf0090f9c1c14f42d161b9a1fb3af142f9420 (diff) |
path ops work in progress
standardize tests
use SK_ARRAY_COUNT everywhere
debug why x87 differs from SIMD 64
various platform specific fixes
git-svn-id: http://skia.googlecode.com/svn/trunk@8689 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
33 files changed, 275 insertions, 113 deletions
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp new file mode 100644 index 0000000000..e594bb65bf --- /dev/null +++ b/tests/PathOpsAngleTest.cpp @@ -0,0 +1,116 @@ +/* + * Copyright 2013 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ +#include "SkOpSegment.h" +#include "Test.h" + +static const SkPoint cubics[][4] = { + {{0, 1}, {2, 6}, {4, 2}, {5, 3}} +}; + +static const SkPoint lines[][2] = { + {{6, 2}, {2, 4}} +}; + +struct SortSet { + const SkPoint* ptData; + int ptCount; + double tStart; + double tEnd; +}; + +static const SortSet set1[] = { + {lines[0], 2, 0.54070336, 0.388888889}, + {cubics[0], 4, 0.666669871, 0.405037112}, + {lines[0], 2, 0.54070336, 0.9140625}, + {cubics[0], 4, 0.666669871, 0.875}, +}; + +static const SortSet set2[] = { + {lines[0], 2, 0.574074074, 0.388888889}, + {cubics[0], 4, 0.666666667, 0.405037112}, + {lines[0], 2, 0.574074074, 0.9140625}, + {cubics[0], 4, 0.666666667, 0.875}, +}; + +struct SortSetTests { + const SortSet* set; + size_t count; +}; + +static const SortSetTests tests[] = { + { set1, SK_ARRAY_COUNT(set1) }, + { set2, SK_ARRAY_COUNT(set2) } +}; + +static void setup(const SortSet* set, const size_t idx, SkPoint const ** data, + SkPoint* reverse, SkOpSegment* seg) { + SkPoint start, end; + if (set[idx].ptCount == 2) { + if (set[idx].tStart < set[idx].tEnd) { + *data = set[idx].ptData; + } else { + reverse[0] = set[idx].ptData[1]; + reverse[1] = set[idx].ptData[0]; + *data = reverse; + } + seg->addLine(*data, false, false); + SkDLine dLine; + dLine.set(set[idx].ptData); + start = dLine.xyAtT(set[idx].tStart).asSkPoint(); + end = dLine.xyAtT(set[idx].tEnd).asSkPoint(); + } else if (set[idx].ptCount == 4) { + if (set[idx].tStart < set[idx].tEnd) { + *data = set[idx].ptData; + } else { + reverse[0] = set[idx].ptData[3]; + reverse[1] = set[idx].ptData[2]; + reverse[2] = set[idx].ptData[1]; + reverse[3] = set[idx].ptData[0]; + *data = reverse; + } + seg->addCubic(*data, false, false); + SkDCubic dCubic; + dCubic.set(set[idx].ptData); + start = dCubic.xyAtT(set[idx].tStart).asSkPoint(); + end = dCubic.xyAtT(set[idx].tEnd).asSkPoint(); + } + seg->addT(NULL, start, set[idx].tStart); + seg->addT(NULL, end, set[idx].tEnd); + seg->addT(NULL, set[idx].ptData[0], 0); + seg->addT(NULL, set[idx].ptData[set[idx].ptCount - 1], 1); +} + +static void PathOpsAngleTest(skiatest::Reporter* reporter) { + for (size_t index = 0; index < SK_ARRAY_COUNT(tests); ++index) { + const SortSetTests& test = tests[index]; + for (size_t idxL = 0; idxL < test.count - 1; ++idxL) { + SkOpSegment lesser, greater; + SkPoint lesserReverse[4], greaterReverse[4]; + const SkPoint* lesserData, * greaterData; + const SortSet* set = test.set; + setup(set, idxL, &lesserData, lesserReverse, &lesser); + size_t idxG = idxL + 1; + setup(set, idxG, &greaterData, greaterReverse, &greater); + SkOpAngle first, second; + first.set(lesserData, (SkPath::Verb) (set[idxL].ptCount - 1), &lesser, + 0, 1, lesser.spans()); + first.setSpans(); + second.set(greaterData, (SkPath::Verb) (set[idxG].ptCount - 1), &greater, + 0, 1, greater.spans()); + second.setSpans(); + bool compare = first < second; + if (!compare) { + SkDebugf("%s test[%d]: lesser[%d] > greater[%d]\n", __FUNCTION__, + index, idxL, idxG); + } + REPORTER_ASSERT(reporter, compare); + } + } +} + +#include "TestClassDef.h" +DEFINE_TESTCLASS_SHORT(PathOpsAngleTest) diff --git a/tests/PathOpsBoundsTest.cpp b/tests/PathOpsBoundsTest.cpp index 0ed19540ed..9d686a5de4 100644 --- a/tests/PathOpsBoundsTest.cpp +++ b/tests/PathOpsBoundsTest.cpp @@ -18,14 +18,14 @@ static const SkRect sectTests[][2] = { {{2, 0, 4, 1}, {4, 1, 5, 2}}, // touching just on a corner is OK }; -static const size_t sectTestsCount = sizeof(sectTests) / sizeof(sectTests[0]); +static const size_t sectTestsCount = SK_ARRAY_COUNT(sectTests); static const SkRect noSectTests[][2] = { {{2, 0, 4, 1}, {5, 0, 6, 1}}, {{2, 0, 4, 1}, {3, 2, 5, 2}}, }; -static const size_t noSectTestsCount = sizeof(noSectTests) / sizeof(noSectTests[0]); +static const size_t noSectTestsCount = SK_ARRAY_COUNT(noSectTests); static const SkRect reallyEmpty[] = { {0, 0, 0, 0}, @@ -35,7 +35,7 @@ static const SkRect reallyEmpty[] = { {1, 2, 3, SK_ScalarNaN}, }; -static const size_t emptyTestsCount = sizeof(reallyEmpty) / sizeof(reallyEmpty[0]); +static const size_t emptyTestsCount = SK_ARRAY_COUNT(reallyEmpty); static const SkRect notReallyEmpty[] = { {0, 0, 1, 0}, @@ -43,9 +43,9 @@ static const SkRect notReallyEmpty[] = { {0, 0, 1, 1}, }; -static const size_t notEmptyTestsCount = sizeof(notReallyEmpty) / sizeof(notReallyEmpty[0]); +static const size_t notEmptyTestsCount = SK_ARRAY_COUNT(notReallyEmpty); -static void OpBoundsTest(skiatest::Reporter* reporter) { +static void PathOpsBoundsTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < sectTestsCount; ++index) { const SkPathOpsBounds& bounds1 = static_cast<const SkPathOpsBounds&>(sectTests[index][0]); const SkPathOpsBounds& bounds2 = static_cast<const SkPathOpsBounds&>(sectTests[index][1]); @@ -103,4 +103,4 @@ static void OpBoundsTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsBounds", PathOpsBoundsClass, OpBoundsTest) +DEFINE_TESTCLASS_SHORT(PathOpsBoundsTest) diff --git a/tests/PathOpsCubicIntersectionTest.cpp b/tests/PathOpsCubicIntersectionTest.cpp index be9781dde6..f3db3c0909 100644 --- a/tests/PathOpsCubicIntersectionTest.cpp +++ b/tests/PathOpsCubicIntersectionTest.cpp @@ -160,7 +160,7 @@ static const SkDCubic testSet[] = { {56.4860195, 60.529264}}}, }; -const size_t testSetCount = sizeof(testSet) / sizeof(testSet[0]); +const size_t testSetCount = SK_ARRAY_COUNT(testSet); static const SkDCubic newTestSet[] = { {{{0, 1}, {1, 5}, {1, 0}, {1, 0}}}, @@ -220,7 +220,7 @@ static const SkDCubic newTestSet[] = { {{{0, 3}, {0, 1}, {2, 0}, {1, 0}}}, }; -const size_t newTestSetCount = sizeof(newTestSet) / sizeof(newTestSet[0]); +const size_t newTestSetCount = SK_ARRAY_COUNT(newTestSet); static void oneOff(skiatest::Reporter* reporter, const SkDCubic& cubic1, const SkDCubic& cubic2) { #if ONE_OFF_DEBUG @@ -463,7 +463,7 @@ static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) { {{{6.71, 3.14}, {7.99, 2.75}, {8.27, 1.96}, {6.35, 3.57}}}, {{{12.81, 7.27}, {7.22, 6.98}, {12.49, 8.97}, {11.42, 6.18}}}, }; - size_t selfSetCount = sizeof(selfSet) / sizeof(selfSet[0]); + size_t selfSetCount = SK_ARRAY_COUNT(selfSet); size_t firstFail = 1; for (size_t index = firstFail; index < selfSetCount; ++index) { const SkDCubic& cubic = selfSet[index]; @@ -500,7 +500,7 @@ static void cubicIntersectionSelfTest(skiatest::Reporter* reporter) { } } -static void TestCubicIntersection(skiatest::Reporter* reporter) { +static void PathOpsCubicIntersectionTest(skiatest::Reporter* reporter) { oneOffTest(reporter); oneOffTests(reporter); cubicIntersectionSelfTest(reporter); @@ -510,4 +510,4 @@ static void TestCubicIntersection(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsCubicIntersectionTest", CubicIntersectionTestClass, TestCubicIntersection) +DEFINE_TESTCLASS_SHORT(PathOpsCubicIntersectionTest) diff --git a/tests/PathOpsCubicIntersectionTestData.cpp b/tests/PathOpsCubicIntersectionTestData.cpp index f4c0b4a3ed..1b1168be7f 100644 --- a/tests/PathOpsCubicIntersectionTestData.cpp +++ b/tests/PathOpsCubicIntersectionTestData.cpp @@ -41,7 +41,7 @@ const SkDCubic pointDegenerates[] = { {{{1, 1}, {2, 2}, {2, 2+N}, {1, 1}}}, }; -const size_t pointDegenerates_count = sizeof(pointDegenerates) / sizeof(pointDegenerates[0]); +const size_t pointDegenerates_count = SK_ARRAY_COUNT(pointDegenerates); const SkDCubic notPointDegenerates[] = { {{{1 + FLT_EPSILON * 2, 1}, {1, FLT_EPSILON * 2}, {1, 1}, {1, 1}}}, @@ -49,7 +49,7 @@ const SkDCubic notPointDegenerates[] = { }; const size_t notPointDegenerates_count = - sizeof(notPointDegenerates) / sizeof(notPointDegenerates[0]); + SK_ARRAY_COUNT(notPointDegenerates); // from http://www.truetex.com/bezint.htm const SkDCubic tests[][2] = { @@ -105,7 +105,7 @@ const SkDCubic tests[][2] = { } }; -const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +const size_t tests_count = SK_ARRAY_COUNT(tests); const SkDCubic lines[] = { {{{0, 0}, {0, 0}, {0, 0}, {1, 0}}}, // 0: horizontal @@ -140,7 +140,7 @@ const SkDCubic lines[] = { {{{2, 2}, {4, 4}, {3, 3}, {1, 1}}}, }; -const size_t lines_count = sizeof(lines) / sizeof(lines[0]); +const size_t lines_count = SK_ARRAY_COUNT(lines); // 'not a line' tries to fool the line detection code const SkDCubic notLines[] = { @@ -152,7 +152,7 @@ const SkDCubic notLines[] = { {{{0, 1}, {1, 0}, {0, 0}, {0, 0}}}, }; -const size_t notLines_count = sizeof(notLines) / sizeof(notLines[0]); +const size_t notLines_count = SK_ARRAY_COUNT(notLines); static const double E = FLT_EPSILON * 2; static const double F = FLT_EPSILON * 3; @@ -198,7 +198,7 @@ const SkDCubic modEpsilonLines[] = { {{{2, 2}, {4, 4}, {3, 3}, {1, 1+E}}}, }; -const size_t modEpsilonLines_count = sizeof(modEpsilonLines) / sizeof(modEpsilonLines[0]); +const size_t modEpsilonLines_count = SK_ARRAY_COUNT(modEpsilonLines); const SkDCubic lessEpsilonLines[] = { {{{0, D}, {0, 0}, {0, 0}, {1, 0}}}, // horizontal @@ -234,7 +234,7 @@ const SkDCubic lessEpsilonLines[] = { {{{2, 2}, {4, 4}, {3, 3}, {1, 1+D}}}, }; -const size_t lessEpsilonLines_count = sizeof(lessEpsilonLines) / sizeof(lessEpsilonLines[0]); +const size_t lessEpsilonLines_count = SK_ARRAY_COUNT(lessEpsilonLines); const SkDCubic negEpsilonLines[] = { {{{0, N}, {0, 0}, {0, 0}, {1, 0}}}, // horizontal @@ -270,4 +270,4 @@ const SkDCubic negEpsilonLines[] = { {{{2, 2}, {4, 4}, {3, 3}, {1, 1+N}}}, }; -const size_t negEpsilonLines_count = sizeof(negEpsilonLines) / sizeof(negEpsilonLines[0]); +const size_t negEpsilonLines_count = SK_ARRAY_COUNT(negEpsilonLines); diff --git a/tests/PathOpsCubicLineIntersectionTest.cpp b/tests/PathOpsCubicLineIntersectionTest.cpp index 874fff079d..7af7b26e45 100644 --- a/tests/PathOpsCubicLineIntersectionTest.cpp +++ b/tests/PathOpsCubicLineIntersectionTest.cpp @@ -18,9 +18,9 @@ static struct lineCubic { {{{{0, 0}, {0, 1}, {0, 1}, {1, 1}}}, {{{0, 1}, {1, 0}}}}, }; -static const size_t lineCubicTests_count = sizeof(lineCubicTests) / sizeof(lineCubicTests[0]); +static const size_t lineCubicTests_count = SK_ARRAY_COUNT(lineCubicTests); -static void CubicLineIntersectionTest(skiatest::Reporter* reporter) { +static void PathOpsCubicLineIntersectionTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < lineCubicTests_count; ++index) { int iIndex = static_cast<int>(index); const SkDCubic& cubic = lineCubicTests[index].cubic; @@ -57,5 +57,4 @@ static void CubicLineIntersectionTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsCubicLineIntersection", CubicLineIntersectionTestClass, \ - CubicLineIntersectionTest) +DEFINE_TESTCLASS_SHORT(PathOpsCubicLineIntersectionTest) diff --git a/tests/PathOpsCubicReduceOrderTest.cpp b/tests/PathOpsCubicReduceOrderTest.cpp index 25f6b2a475..d7518ab303 100644 --- a/tests/PathOpsCubicReduceOrderTest.cpp +++ b/tests/PathOpsCubicReduceOrderTest.cpp @@ -55,7 +55,7 @@ static void find_tight_bounds(const SkDCubic& cubic, SkDRect& bounds) { } } -static void CubicReduceOrderTest(skiatest::Reporter* reporter) { +static void PathOpsReduceOrderCubicTest(skiatest::Reporter* reporter) { size_t index; SkReduceOrder reducer; int order; @@ -223,4 +223,4 @@ static void CubicReduceOrderTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsReduceOrderCubic", ReduceOrderCubicTestClass, CubicReduceOrderTest) +DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderCubicTest) diff --git a/tests/PathOpsCubicToQuadsTest.cpp b/tests/PathOpsCubicToQuadsTest.cpp index 4d332fe42c..f18784fb54 100644 --- a/tests/PathOpsCubicToQuadsTest.cpp +++ b/tests/PathOpsCubicToQuadsTest.cpp @@ -160,7 +160,7 @@ static SkDCubic locals[] = { {1.4974754310666936, 68.069569937917208}, {45.261946574441133, 17.536076632112298}}}, }; -static size_t localsCount = sizeof(locals) / sizeof(locals[0]); +static size_t localsCount = SK_ARRAY_COUNT(locals); #define DEBUG_CRASH 0 #define TEST_AVERAGE_END_POINTS 0 // must take const off to test @@ -192,11 +192,11 @@ static void CubicsToQuadratics_OneOffTest(skiatest::Reporter* reporter) { oneOff(reporter, 0); } -static void TestCubicToQuads(skiatest::Reporter* reporter) { +static void PathOpsCubicToQuadsTest(skiatest::Reporter* reporter) { CubicToQuads_Test(reporter); CubicsToQuadratics_OneOffTest(reporter); CubicsToQuadratics_OneOffTests(reporter); } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsCubicToQuads", PathOpsCubicToQuads, TestCubicToQuads) +DEFINE_TESTCLASS_SHORT(PathOpsCubicToQuadsTest) diff --git a/tests/PathOpsDCubicTest.cpp b/tests/PathOpsDCubicTest.cpp index 60b92dfa84..04850de8f6 100644 --- a/tests/PathOpsDCubicTest.cpp +++ b/tests/PathOpsDCubicTest.cpp @@ -13,9 +13,9 @@ static const SkDCubic tests[] = { {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}}, }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); -static void DCubicTest(skiatest::Reporter* reporter) { +static void PathOpsDCubicTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count; ++index) { const SkDCubic& cubic = tests[index]; bool result = cubic.clockwise(); @@ -27,4 +27,4 @@ static void DCubicTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsDCubic", PathOpsDCubic, DCubicTest) +DEFINE_TESTCLASS_SHORT(PathOpsDCubicTest) diff --git a/tests/PathOpsDLineTest.cpp b/tests/PathOpsDLineTest.cpp index 4108f70afd..c237494162 100644 --- a/tests/PathOpsDLineTest.cpp +++ b/tests/PathOpsDLineTest.cpp @@ -25,9 +25,9 @@ static const SkDPoint left[] = { {2, 1} }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); -static void DLineTest(skiatest::Reporter* reporter) { +static void PathOpsLineUtilitiesTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count; ++index) { const SkDLine& line = tests[index]; SkDLine line2; @@ -51,4 +51,4 @@ static void DLineTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsLineUtilities", PathOpsLineUtilitiesClass, DLineTest) +DEFINE_TESTCLASS_SHORT(PathOpsLineUtilitiesTest) diff --git a/tests/PathOpsDPointTest.cpp b/tests/PathOpsDPointTest.cpp index 551609be33..688d01b890 100644 --- a/tests/PathOpsDPointTest.cpp +++ b/tests/PathOpsDPointTest.cpp @@ -17,9 +17,9 @@ static const SkDPoint tests[] = { {2, 2} }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); -static void DPointTest(skiatest::Reporter* reporter) { +static void PathOpsDPointTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count; ++index) { const SkDPoint& pt = tests[index]; SkDPoint p = pt; @@ -47,4 +47,4 @@ static void DPointTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsDPoint", PathOpsDPointClass, DPointTest) +DEFINE_TESTCLASS_SHORT(PathOpsDPointTest) diff --git a/tests/PathOpsDQuadTest.cpp b/tests/PathOpsDQuadTest.cpp index f78e2aa3e2..89da659266 100644 --- a/tests/PathOpsDQuadTest.cpp +++ b/tests/PathOpsDQuadTest.cpp @@ -31,9 +31,9 @@ static const SkDPoint outPoint[]= { {1.1, 0.5}, }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); -static void DQuadTest(skiatest::Reporter* reporter) { +static void PathOpsDQuadTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count; ++index) { const SkDQuad& quad = tests[index]; bool result = quad.pointInHull(inPoint[index]); @@ -50,4 +50,4 @@ static void DQuadTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsDQuad", PathOpsDQuadClass, DQuadTest) +DEFINE_TESTCLASS_SHORT(PathOpsDQuadTest) diff --git a/tests/PathOpsDRectTest.cpp b/tests/PathOpsDRectTest.cpp index 881ee0b86b..a053ac7f5c 100644 --- a/tests/PathOpsDRectTest.cpp +++ b/tests/PathOpsDRectTest.cpp @@ -33,11 +33,11 @@ static const SkDCubic cubicTests[] = { {{{3, 0}, {2, 1}, {3, 2}, {1, 1}}}, }; -static const size_t lineTests_count = sizeof(lineTests) / sizeof(lineTests[0]); -static const size_t quadTests_count = sizeof(quadTests) / sizeof(quadTests[0]); -static const size_t cubicTests_count = sizeof(cubicTests) / sizeof(cubicTests[0]); +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 DRectTest(skiatest::Reporter* reporter) { +static void PathOpsDRectTest(skiatest::Reporter* reporter) { size_t index; SkDRect rect, rect2; for (index = 0; index < lineTests_count; ++index) { @@ -97,4 +97,4 @@ static void DRectTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsDRect", PathOpsDRectClass, DRectTest) +DEFINE_TESTCLASS_SHORT(PathOpsDRectTest) diff --git a/tests/PathOpsDTriangleTest.cpp b/tests/PathOpsDTriangleTest.cpp index 3ca797df38..d64197df9d 100644 --- a/tests/PathOpsDTriangleTest.cpp +++ b/tests/PathOpsDTriangleTest.cpp @@ -25,9 +25,9 @@ static const SkDPoint outPoint[] = { {2.5, 2}, }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); -static void TriangleUtilitiesTest(skiatest::Reporter* reporter) { +static void PathOpsTriangleUtilitiesTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count; ++index) { const SkDTriangle& triangle = tests[index]; bool result = triangle.contains(inPoint[index]); @@ -44,4 +44,4 @@ static void TriangleUtilitiesTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsTriangleUtilities", PathOpsTriangleUtilitiesClass, TriangleUtilitiesTest) +DEFINE_TESTCLASS_SHORT(PathOpsTriangleUtilitiesTest) diff --git a/tests/PathOpsDVectorTest.cpp b/tests/PathOpsDVectorTest.cpp index 48df753a06..6d752c5388 100644 --- a/tests/PathOpsDVectorTest.cpp +++ b/tests/PathOpsDVectorTest.cpp @@ -17,9 +17,9 @@ static const SkDPoint tests[] = { {2, 2} }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); -static void DVectorTest(skiatest::Reporter* reporter) { +static void PathOpsDVectorTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count - 1; ++index) { SkDVector v1 = tests[index + 1] - tests[index]; SkDVector v2 = tests[index] - tests[index + 1]; @@ -47,4 +47,4 @@ static void DVectorTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsDVector", PathOpsDVectorClass, DVectorTest) +DEFINE_TESTCLASS_SHORT(PathOpsDVectorTest) diff --git a/tests/PathOpsExtendedTest.cpp b/tests/PathOpsExtendedTest.cpp index 5aa1ac098c..ec8afb02a2 100644 --- a/tests/PathOpsExtendedTest.cpp +++ b/tests/PathOpsExtendedTest.cpp @@ -316,7 +316,7 @@ static int comparePaths(skiatest::Reporter* reporter, const SkPath& one, const S static void showPathOpPath(const SkPath& one, const SkPath& two, const SkPath& a, const SkPath& b, const SkPath& scaledOne, const SkPath& scaledTwo, const SkPathOp shapeOp, const SkMatrix& scale) { - SkASSERT((unsigned) shapeOp < sizeof(opStrs) / sizeof(opStrs[0])); + SkASSERT((unsigned) shapeOp < SK_ARRAY_COUNT(opStrs)); showPath(a, "minuend:"); SkDebugf("op: %s\n", opStrs[shapeOp]); showPath(b, "subtrahend:"); @@ -540,7 +540,7 @@ void outputProgress(char* ramStr, const char* pathStr, SkPath::FillType pathFill void outputProgress(char* ramStr, const char* pathStr, SkPathOp op) { const char testFunction[] = "testOp(path);"; - SkASSERT(op < sizeof(opSuffixes) / sizeof(opSuffixes[0])); + SkASSERT((size_t) op < SK_ARRAY_COUNT(opSuffixes)); const char* nameSuffix = opSuffixes[op]; SkMemoryWStream rRamStream(ramStr, PATH_STR_SIZE); outputToStream(pathStr, NULL, nameSuffix, testFunction, true, rRamStream); diff --git a/tests/PathOpsLineIntersectionTest.cpp b/tests/PathOpsLineIntersectionTest.cpp index 5ab336e55f..d0b5731fbd 100644 --- a/tests/PathOpsLineIntersectionTest.cpp +++ b/tests/PathOpsLineIntersectionTest.cpp @@ -19,7 +19,7 @@ static const SkDLine tests[][2] = { {{{166.86960700313026, 112.6965477747386}, {166.86925794355412, 112.69656471103423}}}} }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); static const SkDLine noIntersect[][2] = { {{{{0, 0}, {1, 0}}}, {{{3, 0}, {2, 0}}}}, @@ -29,9 +29,9 @@ static const SkDLine noIntersect[][2] = { {{{{1, 1}, {2, 2}}}, {{{4, 4}, {3, 3}}}}, }; -static const size_t noIntersect_count = sizeof(noIntersect) / sizeof(noIntersect[0]); +static const size_t noIntersect_count = SK_ARRAY_COUNT(noIntersect); -static void TestLineIntersection(skiatest::Reporter* reporter) { +static void PathOpsLineIntersectionTest(skiatest::Reporter* reporter) { size_t index; for (index = 0; index < tests_count; ++index) { const SkDLine& line1 = tests[index][0]; @@ -58,4 +58,4 @@ static void TestLineIntersection(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsLineIntersection", LineIntersectionTestClass, TestLineIntersection) +DEFINE_TESTCLASS_SHORT(PathOpsLineIntersectionTest) diff --git a/tests/PathOpsLineParametetersTest.cpp b/tests/PathOpsLineParametetersTest.cpp index 2dad1b2e2c..0361e1aea6 100644 --- a/tests/PathOpsLineParametetersTest.cpp +++ b/tests/PathOpsLineParametetersTest.cpp @@ -34,9 +34,9 @@ static const double answers[][2] = { {1.5894571940104115e-07, 7.9472859700520577e-08}, }; -static const size_t tests_count = sizeof(tests) / sizeof(tests[0]); +static const size_t tests_count = SK_ARRAY_COUNT(tests); -static void LineParameterTest(skiatest::Reporter* reporter) { +static void PathOpsLineParametersTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < tests_count; ++index) { SkLineParameters lineParameters; const SkDCubic& cubic = tests[index]; @@ -77,4 +77,4 @@ static void LineParameterTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsLineParameters", PathOpsLineParametersClass, LineParameterTest) +DEFINE_TESTCLASS_SHORT(PathOpsLineParametersTest) diff --git a/tests/PathOpsOpCubicThreadedTest.cpp b/tests/PathOpsOpCubicThreadedTest.cpp index 31e8065470..4197d76624 100644 --- a/tests/PathOpsOpCubicThreadedTest.cpp +++ b/tests/PathOpsOpCubicThreadedTest.cpp @@ -57,7 +57,7 @@ static void testOpCubicsMain(PathOpsThreadState* data) } } -static void TestOpCubicsThreaded(skiatest::Reporter* reporter) +static void PathOpsOpCubicsThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("cubicOp"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); @@ -77,5 +77,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsOpCubicsThreaded", OpCubicsThreadedTestClass, \ - TestOpCubicsThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsOpCubicsThreadedTest) diff --git a/tests/PathOpsOpRectThreadedTest.cpp b/tests/PathOpsOpRectThreadedTest.cpp index 6ac04cd4eb..e7aec8a432 100644 --- a/tests/PathOpsOpRectThreadedTest.cpp +++ b/tests/PathOpsOpRectThreadedTest.cpp @@ -66,7 +66,7 @@ static void testPathOpsRectsMain(PathOpsThreadState* data) } } -static void TestPathOpsRectsThreaded(skiatest::Reporter* reporter) { +static void PathOpsRectsThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("testOp"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); for (int a = 0; a < 6; ++a) { // outermost @@ -85,5 +85,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsRectsThreaded", OpRectsThreadedTestClass, \ - TestPathOpsRectsThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsRectsThreadedTest) diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp index 97cd9e43fa..4d7c621c3e 100644 --- a/tests/PathOpsOpTest.cpp +++ b/tests/PathOpsOpTest.cpp @@ -1190,7 +1190,7 @@ static struct TestDesc tests[] = { TEST(cubicOp1d), }; -static const size_t testCount = sizeof(tests) / sizeof(tests[0]); +static const size_t testCount = SK_ARRAY_COUNT(tests); static struct TestDesc subTests[] = { TEST(cubicOp43d), @@ -1210,7 +1210,7 @@ static struct TestDesc subTests[] = { TEST(cubicOp40d), }; -static const size_t subTestCount = sizeof(subTests) / sizeof(subTests[0]); +static const size_t subTestCount = SK_ARRAY_COUNT(subTests); static void (*firstSubTest)(skiatest::Reporter* ) = 0; @@ -1218,7 +1218,7 @@ static bool runSubTestsFirst = false; static bool runReverse = false; static void (*stopTest)(skiatest::Reporter* ) = 0; -static void OpTest(skiatest::Reporter* reporter) { +static void PathOpsOpTest(skiatest::Reporter* reporter) { #ifdef SK_DEBUG gDebugMaxWindSum = 4; gDebugMaxWindValue = 4; @@ -1237,4 +1237,4 @@ static void OpTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsOpTest", PathOpsOpClass, OpTest) +DEFINE_TESTCLASS_SHORT(PathOpsOpTest) diff --git a/tests/PathOpsQuadIntersectionTest.cpp b/tests/PathOpsQuadIntersectionTest.cpp index 2ee70ec735..85555631df 100644 --- a/tests/PathOpsQuadIntersectionTest.cpp +++ b/tests/PathOpsQuadIntersectionTest.cpp @@ -226,7 +226,7 @@ static const SkDQuad testSet[] = { {{{8, 8}, {9, 9}, {10, 8}}} }; -const size_t testSetCount = sizeof(testSet) / sizeof(testSet[0]); +const size_t testSetCount = SK_ARRAY_COUNT(testSet); static void oneOffTest1(skiatest::Reporter* reporter, size_t outer, size_t inner) { const SkDQuad& quad1 = testSet[outer]; @@ -271,7 +271,7 @@ static const SkDQuad coincidentTestSet[] = { {{{8, -10}, {10, 10}, {8, 8}}}, }; -const size_t coincidentTestSetCount = sizeof(coincidentTestSet) / sizeof(coincidentTestSet[0]); +const size_t coincidentTestSetCount = SK_ARRAY_COUNT(coincidentTestSet); static void coincidentTest(skiatest::Reporter* reporter) { for (size_t testIndex = 0; testIndex < coincidentTestSetCount - 1; testIndex += 2) { @@ -453,7 +453,7 @@ static void QuadraticIntersection_IntersectionFinder() { intersectionFinder(0, 1); } -static void TestQuadIntersection(skiatest::Reporter* reporter) { +static void PathOpsQuadIntersectionTest(skiatest::Reporter* reporter) { oneOffTests(reporter); coincidentTest(reporter); standardTestCases(reporter); @@ -464,4 +464,4 @@ static void TestQuadIntersection(skiatest::Reporter* reporter) { #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsQuadIntersection", QuadIntersectionTestClass, TestQuadIntersection) +DEFINE_TESTCLASS_SHORT(PathOpsQuadIntersectionTest) diff --git a/tests/PathOpsQuadIntersectionTestData.cpp b/tests/PathOpsQuadIntersectionTestData.cpp index 3c3bcdf468..0b0856117b 100644 --- a/tests/PathOpsQuadIntersectionTestData.cpp +++ b/tests/PathOpsQuadIntersectionTestData.cpp @@ -14,7 +14,7 @@ const SkDQuad quadraticPoints[] = { {{{1, 1}, {2, 2}, {1, 1}}}, }; -const size_t quadraticPoints_count = sizeof(quadraticPoints) / sizeof(quadraticPoints[0]); +const size_t quadraticPoints_count = SK_ARRAY_COUNT(quadraticPoints); const SkDQuad quadraticLines[] = { {{{0, 0}, {0, 0}, {1, 0}}}, @@ -42,7 +42,7 @@ const SkDQuad quadraticLines[] = { {{{2, 2}, {4, 4}, {3, 3}}}, }; -const size_t quadraticLines_count = sizeof(quadraticLines) / sizeof(quadraticLines[0]); +const size_t quadraticLines_count = SK_ARRAY_COUNT(quadraticLines); static const double F = FLT_EPSILON * 3; static const double H = FLT_EPSILON * 4; @@ -80,7 +80,7 @@ const SkDQuad quadraticModEpsilonLines[] = { }; const size_t quadraticModEpsilonLines_count = - sizeof(quadraticModEpsilonLines) / sizeof(quadraticModEpsilonLines[0]); + SK_ARRAY_COUNT(quadraticModEpsilonLines); const SkDQuad quadraticTests[][2] = { { // one intersection @@ -101,4 +101,4 @@ const SkDQuad quadraticTests[][2] = { } }; -const size_t quadraticTests_count = sizeof(quadraticTests) / sizeof(quadraticTests[0]); +const size_t quadraticTests_count = SK_ARRAY_COUNT(quadraticTests); diff --git a/tests/PathOpsQuadLineIntersectionTest.cpp b/tests/PathOpsQuadLineIntersectionTest.cpp index 09c28c1cea..37c8ef3268 100644 --- a/tests/PathOpsQuadLineIntersectionTest.cpp +++ b/tests/PathOpsQuadLineIntersectionTest.cpp @@ -25,7 +25,7 @@ static struct lineQuad { {{{{0, 0}, {0, 1}, {1, 1}}}, {{{0, 1}, {1, 0}}}, 1, {{.25, .75}, {0, 0}} }, }; -static size_t lineQuadTests_count = sizeof(lineQuadTests) / sizeof(lineQuadTests[0]); +static size_t lineQuadTests_count = SK_ARRAY_COUNT(lineQuadTests); static int doIntersect(SkIntersections& intersections, const SkDQuad& quad, const SkDLine& line, bool& flipped) { @@ -62,7 +62,7 @@ static struct oneLineQuad { {{{406.207703, 121.298294}, {348.781738, 123.864815}}}} }; -static size_t oneOffs_count = sizeof(oneOffs) / sizeof(oneOffs[0]); +static size_t oneOffs_count = SK_ARRAY_COUNT(oneOffs); static void testOneOffs(skiatest::Reporter* reporter) { SkIntersections intersections; @@ -81,7 +81,7 @@ static void testOneOffs(skiatest::Reporter* reporter) { } } -static void TestQuadLineIntersection(skiatest::Reporter* reporter) { +static void PathOpsQuadLineIntersectionTest(skiatest::Reporter* reporter) { testOneOffs(reporter); for (size_t index = 0; index < lineQuadTests_count; ++index) { int iIndex = static_cast<int>(index); @@ -128,5 +128,4 @@ static void TestQuadLineIntersection(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsQuadLineIntersection", QuadLineIntersectionTestClass, \ - TestQuadLineIntersection) +DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionTest) diff --git a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp index a931221345..23adaf95e1 100644 --- a/tests/PathOpsQuadLineIntersectionThreadedTest.cpp +++ b/tests/PathOpsQuadLineIntersectionThreadedTest.cpp @@ -111,7 +111,7 @@ static void testQuadLineIntersectMain(PathOpsThreadState* data) } } -static void TestQuadLineIntersectionThreaded(skiatest::Reporter* reporter) +static void PathOpsQuadLineIntersectionThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("testQuadLineIntersect"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); @@ -129,5 +129,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsQuadLineIntersectionThreaded", QuadLineIntersectionThreadedTestClass, \ - TestQuadLineIntersectionThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsQuadLineIntersectionThreadedTest) diff --git a/tests/PathOpsQuadParameterizationTest.cpp b/tests/PathOpsQuadParameterizationTest.cpp index 662871bb9e..bb8ec2e636 100644 --- a/tests/PathOpsQuadParameterizationTest.cpp +++ b/tests/PathOpsQuadParameterizationTest.cpp @@ -24,9 +24,9 @@ static const SkDQuad quadratics[] = { {{{0, 0}, {1, 0}, {1, 1}}}, }; -static const size_t quadratics_count = sizeof(quadratics) / sizeof(quadratics[0]); +static const size_t quadratics_count = SK_ARRAY_COUNT(quadratics); -static void TestQuadraticCoincidence(skiatest::Reporter* reporter) { +static void PathOpsQuadImplicitTest(skiatest::Reporter* reporter) { // split large quadratic // compare original, parts, to see if the are coincident for (size_t index = 0; index < quadratics_count; ++index) { @@ -36,7 +36,7 @@ static void TestQuadraticCoincidence(skiatest::Reporter* reporter) { const SkDQuad* quads[] = { &test, &midThird, &split.first(), &split.second() }; - size_t quadsCount = sizeof(quads) / sizeof(quads[0]); + size_t quadsCount = SK_ARRAY_COUNT(quads); for (size_t one = 0; one < quadsCount; ++one) { for (size_t two = 0; two < quadsCount; ++two) { for (size_t inner = 0; inner < 3; inner += 2) { @@ -50,4 +50,4 @@ static void TestQuadraticCoincidence(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsQuadImplicit", QuadImplicitTestClass, TestQuadraticCoincidence) +DEFINE_TESTCLASS_SHORT(PathOpsQuadImplicitTest) diff --git a/tests/PathOpsQuadReduceOrderTest.cpp b/tests/PathOpsQuadReduceOrderTest.cpp index 64f2069e24..27cb5be6b8 100644 --- a/tests/PathOpsQuadReduceOrderTest.cpp +++ b/tests/PathOpsQuadReduceOrderTest.cpp @@ -15,7 +15,7 @@ static const SkDQuad testSet[] = { {{{1, 0}, {2, 6}, {3, 0}}} }; -static const size_t testSetCount = sizeof(testSet) / sizeof(testSet[0]); +static const size_t testSetCount = SK_ARRAY_COUNT(testSet); static void oneOffTest(skiatest::Reporter* reporter) { for (size_t index = 0; index < testSetCount; ++index) { @@ -62,10 +62,10 @@ static void standardTestCases(skiatest::Reporter* reporter) { } } -static void QuadReduceOrderTest(skiatest::Reporter* reporter) { +static void PathOpsReduceOrderQuadTest(skiatest::Reporter* reporter) { oneOffTest(reporter); standardTestCases(reporter); } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsReduceOrderQuad", ReduceOrderQuadTestClass, QuadReduceOrderTest) +DEFINE_TESTCLASS_SHORT(PathOpsReduceOrderQuadTest) diff --git a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp index ea4ed0d268..1c1f9cad62 100755 --- a/tests/PathOpsSimplifyDegenerateThreadedTest.cpp +++ b/tests/PathOpsSimplifyDegenerateThreadedTest.cpp @@ -60,7 +60,7 @@ static void testSimplifyDegeneratesMain(PathOpsThreadState* data) { } } -static void TestSimplifyDegeneratesThreaded(skiatest::Reporter* reporter) { +static void PathOpsSimplifyDegeneratesThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("testDegenerates"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); for (int a = 0; a < 16; ++a) { @@ -85,5 +85,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsSimplifyDegeneratesThreaded", SimplifyDegeneratesThreadedTestClass, \ - TestSimplifyDegeneratesThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsSimplifyDegeneratesThreadedTest) diff --git a/tests/PathOpsSimplifyQuadThreadedTest.cpp b/tests/PathOpsSimplifyQuadThreadedTest.cpp index 9343bc2243..0290602eee 100644 --- a/tests/PathOpsSimplifyQuadThreadedTest.cpp +++ b/tests/PathOpsSimplifyQuadThreadedTest.cpp @@ -66,7 +66,7 @@ static void testSimplifyQuadsMain(PathOpsThreadState* data) } } -static void TestSimplifyQuadsThreaded(skiatest::Reporter* reporter) +static void PathOpsSimplifyQuadsThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("testQuads"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); @@ -87,5 +87,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsSimplifyQuadsThreaded", SimplifyQuadsThreadedTestClass, \ - TestSimplifyQuadsThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadsThreadedTest) diff --git a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp index 93b3fe6f1e..99cd79e556 100755 --- a/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp +++ b/tests/PathOpsSimplifyQuadralateralsThreadedTest.cpp @@ -68,8 +68,7 @@ static void testSimplifyQuadralateralsMain(PathOpsThreadState* data) } } -static void TestSimplifyQuadralateralsThreaded(skiatest::Reporter* reporter) -{ +static void PathOpsSimplifyQuadralateralsThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("testQuadralaterals"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); for (int a = 0; a < 16; ++a) { @@ -88,5 +87,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("SimplifyQuadralateralsThreaded", SimplifyQuadralateralsThreadedTestClass, \ - TestSimplifyQuadralateralsThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsSimplifyQuadralateralsThreadedTest) diff --git a/tests/PathOpsSimplifyRectThreadedTest.cpp b/tests/PathOpsSimplifyRectThreadedTest.cpp index bd8023cd82..33863cfe57 100644 --- a/tests/PathOpsSimplifyRectThreadedTest.cpp +++ b/tests/PathOpsSimplifyRectThreadedTest.cpp @@ -171,7 +171,7 @@ static void testSimplify4x4RectsMain(PathOpsThreadState* data) } } -static void TestSimplifyRectsThreaded(skiatest::Reporter* reporter) +static void PathOpsSimplifyRectsThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("testLine"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); @@ -191,5 +191,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsSimplifyRectsThreaded",SimplifyRectsThreadedTestClass, \ - TestSimplifyRectsThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsSimplifyRectsThreadedTest) diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp index 0da8da267f..e9133ef8ea 100644 --- a/tests/PathOpsSimplifyTest.cpp +++ b/tests/PathOpsSimplifyTest.cpp @@ -3586,9 +3586,53 @@ static void testQuadralateral2(skiatest::Reporter* reporter) { testSimplify(reporter, path); } +static void testQuadratic94(skiatest::Reporter* reporter) { + SkPath path; + path.moveTo(0, 0); + path.lineTo(8, 8); + path.quadTo(8, 4, 4, 4); + path.quadTo(4, 0, 0, 0); + path.close(); + testSimplify(reporter, path); +} + +static void testQuadratic95(skiatest::Reporter* reporter) { + SkPath path; + path.moveTo(8, 8); + path.lineTo(0, 0); + path.quadTo(4, 0, 4, 4); + path.quadTo(8, 4, 8, 8); + path.close(); + testSimplify(reporter, path); +} + +static void testQuadratic96(skiatest::Reporter* reporter) { + SkPath path; + path.moveTo(8, 0); + path.lineTo(0, 8); + path.quadTo(0, 4, 4, 4); + path.quadTo(4, 0, 8, 0); + path.close(); + testSimplify(reporter, path); +} + +static void testQuadratic97(skiatest::Reporter* reporter) { + SkPath path; + path.moveTo(0, 8); + path.lineTo(8, 0); + path.quadTo(4, 0, 4, 4); + path.quadTo(0, 4, 0, 8); + path.close(); + testSimplify(reporter, path); +} + static void (*firstTest)(skiatest::Reporter* ) = 0; static TestDesc tests[] = { + TEST(testQuadratic97), + TEST(testQuadratic96), + TEST(testQuadratic95), + TEST(testQuadratic94), TEST(testQuadralateral2), TEST(testQuad1), // FIXME: fails, need to investigate TEST(testCubic2), @@ -3921,7 +3965,7 @@ static TestDesc tests[] = { TEST(testLine1), }; -static const size_t testCount = sizeof(tests) / sizeof(tests[0]); +static const size_t testCount = SK_ARRAY_COUNT(tests); static TestDesc subTests[] = { TEST(testLine3), @@ -3929,7 +3973,7 @@ static TestDesc subTests[] = { TEST(testLine1), }; -static const size_t subTestCount = sizeof(subTests) / sizeof(subTests[0]); +static const size_t subTestCount = SK_ARRAY_COUNT(subTests); static void (*firstSubTest)(skiatest::Reporter* ) = 0; @@ -3937,7 +3981,7 @@ static bool runSubTestsFirst = false; static bool runReverse = false; static void (*stopTest)(skiatest::Reporter* ) = 0; -static void SimplifyTest(skiatest::Reporter* reporter) { +static void PathOpsSimplifyTest(skiatest::Reporter* reporter) { #ifdef SK_DEBUG gDebugMaxWindSum = 4; gDebugMaxWindValue = 4; @@ -3956,4 +4000,4 @@ static void SimplifyTest(skiatest::Reporter* reporter) { } #include "TestClassDef.h" -DEFINE_TESTCLASS("PathOpsSimplifyTest", PathOpsSimplifyClass, SimplifyTest) +DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTest) diff --git a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp index ae72a723e6..4030a67a7b 100755 --- a/tests/PathOpsSimplifyTrianglesThreadedTest.cpp +++ b/tests/PathOpsSimplifyTrianglesThreadedTest.cpp @@ -62,7 +62,7 @@ static void testSimplifyTrianglesMain(PathOpsThreadState* data) { } } -static void TestSimplifyTrianglesThreaded(skiatest::Reporter* reporter) { +static void PathOpsSimplifyTrianglesThreadedTest(skiatest::Reporter* reporter) { int threadCount = initializeTests("testTriangles"); PathOpsThreadedTestRunner testRunner(reporter, threadCount); for (int a = 0; a < 15; ++a) { @@ -91,5 +91,4 @@ finish: } #include "TestClassDef.h" -DEFINE_TESTCLASS("SimplifyTrianglesThreaded", SimplifyTrianglesThreadedTestClass, \ - TestSimplifyTrianglesThreaded) +DEFINE_TESTCLASS_SHORT(PathOpsSimplifyTrianglesThreadedTest) diff --git a/tests/TestClassDef.h b/tests/TestClassDef.h index 4a7db4a337..70d6039c16 100644 --- a/tests/TestClassDef.h +++ b/tests/TestClassDef.h @@ -17,6 +17,19 @@ void MyTestFunction(skiatest::Reporter*) */ +// FIXME: replace all three param callers with the short one param version +#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 DEFINE_TESTCLASS(uiname, classname, function) \ namespace skiatest { \ class classname : public Test { \ |