diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-30 15:29:48 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-30 15:29:48 +0000 |
commit | fa2f2a48f6822b88ab895fece1998af549c16ebe (patch) | |
tree | 0d599b224e79d079c58c811a628da3aa7e1382cb /tests | |
parent | 7950a9eba71f65365d88021680a16f245ad3fa68 (diff) |
Revert "add asserts to point<-->verb helpers"
This reverts commit b4775ac7b55802e87231768f002e4b42f233b0aa.
git-svn-id: http://skia.googlecode.com/svn/trunk@9347 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PathOpsAngleTest.cpp | 110 | ||||
-rw-r--r-- | tests/PathOpsOpTest.cpp | 169 | ||||
-rw-r--r-- | tests/PathOpsSimplifyTest.cpp | 2 | ||||
-rw-r--r-- | tests/PathTest.cpp | 23 |
4 files changed, 11 insertions, 293 deletions
diff --git a/tests/PathOpsAngleTest.cpp b/tests/PathOpsAngleTest.cpp index 003b8c8317..e0331ec60f 100644 --- a/tests/PathOpsAngleTest.cpp +++ b/tests/PathOpsAngleTest.cpp @@ -8,38 +8,16 @@ #include "Test.h" static const SkPoint cubics[][4] = { -/* 0 */ {{0, 1}, {2, 6}, {4, 2}, {5, 3}}, -/* 1 */ {{10, 234}, {10, 229.581726f}, {13.5817204f, 226}, {18, 226}}, -/* 2 */ {{132, 11419}, {130.89543151855469f, 11419}, {130, 11418.1044921875f}, {130, 11417}}, -/* 3 */ {{130.04275512695312f, 11417.4130859375f}, {130.23307800292969f, 11418.3193359375f}, - {131.03709411621094f, 11419}, {132, 11419}}, -/* 4 */ {{0,1}, {0,5}, {4,1}, {6,4}}, -/* 5 */ {{1,5}, {4,6}, {1,0}, {4,0}}, -/* 6 */ {{0,1}, {0,4}, {5,1}, {6,4}}, -/* 7 */ {{0,1}, {1,2}, {1,0}, {6,1}}, -/* 8 */ {{0,3}, {0,1}, {2,0}, {1,0}}, -/* 9 */ {{189,7}, {189,5.3431458473205566f}, {190.3431396484375f,4}, {192,4}}, -/* 10 */ {{0,1}, {1,3}, {1,0}, {6,4}}, -/* 11 */ {{0,1}, {2,3}, {2,1}, {4,3}}, -/* 12 */ {{1,2}, {3,4}, {1,0}, {3,2}}, + {{0, 1}, {2, 6}, {4, 2}, {5, 3}}, + {{10, 234}, {10, 229.581726f}, {13.5817204f, 226}, {18, 226}}, }; static const SkPoint quads[][3] = { -/* 0 */ {{12.3423996f, 228.342407f}, {10, 230.686295f}, {10, 234}}, -/* 1 */ {{304.24319458007812f,591.75677490234375f}, {306,593.51470947265625f}, {306,596}}, + {{12.3423996f, 228.342407f}, {10, 230.686295f}, {10, 234}}, }; static const SkPoint lines[][2] = { -/* 0 */ {{6, 2}, {2, 4}}, -/* 1 */ {{306,617}, {306,590}}, -/* 2 */ {{306,596}, {306,617}}, -/* 3 */ {{6,4}, {0,1}}, -/* 4 */ {{6,1}, {0,1}}, -/* 5 */ {{1,0}, {0,3}}, -/* 6 */ {{246,4}, {189,4}}, -/* 7 */ {{192,4}, {243,4}}, -/* 8 */ {{4,3}, {0,1}}, -/* 9 */ {{3,2}, {1,2}}, + {{6, 2}, {2, 4}}, }; struct SortSet { @@ -68,86 +46,14 @@ static const SortSet set3[] = { {quads[0], 3, 1, 0}, }; -static const SortSet set4[] = { - {cubics[2], 4, 0.812114222, 1}, - {cubics[3], 4, 0.0684734759, 0}, -}; - -static const SortSet set5[] = { - {lines[1], 2, 0.777777778, 1}, - {quads[1], 3, 1, 4.34137342e-06}, - {lines[2], 2, 0, 1}, -}; - -static const SortSet set6[] = { - {lines[3], 2, 0.407407407, 0.554627832}, - {cubics[4], 4, 0.666666667, 0.548022446}, - {lines[3], 2, 0.407407407, 0}, - {cubics[4], 4, 0.666666667, 1}, -}; - -static const SortSet set7[] = { - {cubics[5], 4, 0.545233342, 0.545454545}, - {cubics[6], 4, 0.484938134, 0.484805744}, - {cubics[5], 4, 0.545233342, 0}, - {cubics[6], 4, 0.484938134, 0.545454545}, -}; - -static const SortSet set8[] = { - {cubics[7], 4, 0.5, 0.522986744 }, - {lines[4], 2, 0.75, 1}, - {cubics[7], 4, 0.5, 0}, - {lines[4], 2, 0.75, 0.737654321}, -}; - -static const SortSet set9[] = { - {cubics[8], 4, 0.4, 1}, - {lines[5], 2, 0.36, 0}, - {cubics[8], 4, 0.4, 0.394675838}, - {lines[5], 2, 0.36, 0.363999782}, -}; - -static const SortSet set10[] = { - {lines[6], 2, 0.947368421, 1}, - {cubics[9], 4, 1, 0.500000357}, - {lines[7], 2, 0, 1}, -}; - -static const SortSet set11[] = { - {lines[3], 2, 0.75, 1}, - {cubics[10], 4, 0.5, 0.228744269}, - {lines[3], 2, 0.75, 0.627112191}, - {cubics[10], 4, 0.5, 0.6339746}, -}; - -static const SortSet set12[] = { - {cubics[12], 4, 0.5, 1}, - {lines[8], 2, 0.5, 1}, - {cubics[11], 4, 0.5, 0}, - {lines[9], 2, 0.5, 1}, - {cubics[12], 4, 0.5, 0}, - {lines[8], 2, 0.5, 0}, - {cubics[11], 4, 0.5, 1}, - {lines[9], 2, 0.5, 0}, -}; - struct SortSetTests { const SortSet* set; size_t count; }; static const SortSetTests tests[] = { - { set12, SK_ARRAY_COUNT(set12) }, - { set11, SK_ARRAY_COUNT(set11) }, - { set10, SK_ARRAY_COUNT(set10) }, - { set9, SK_ARRAY_COUNT(set9) }, - { set8, SK_ARRAY_COUNT(set8) }, - { set7, SK_ARRAY_COUNT(set7) }, - { set6, SK_ARRAY_COUNT(set6) }, - { set2, SK_ARRAY_COUNT(set2) }, - { set5, SK_ARRAY_COUNT(set5) }, - { set4, SK_ARRAY_COUNT(set4) }, { set3, SK_ARRAY_COUNT(set3) }, + { set2, SK_ARRAY_COUNT(set2) }, { set1, SK_ARRAY_COUNT(set1) }, }; @@ -216,18 +122,16 @@ static void PathOpsAngleTest(skiatest::Reporter* reporter) { size_t idxG = idxL + 1; setup(set, idxG, &greaterData, &greater, greaterTs); SkOpAngle first, second; - first.set(lesserData, SkPathOpsPointsToVerb(set[idxL].ptCount - 1), &lesser, + first.set(lesserData, (SkPath::Verb) (set[idxL].ptCount - 1), &lesser, lesserTs[0], lesserTs[1], lesser.spans()); - second.set(greaterData, SkPathOpsPointsToVerb(set[idxG].ptCount - 1), &greater, + second.set(greaterData, (SkPath::Verb) (set[idxG].ptCount - 1), &greater, greaterTs[0], greaterTs[1], greater.spans()); bool compare = first < second; if (!compare) { SkDebugf("%s test[%d]: lesser[%d] > greater[%d]\n", __FUNCTION__, index, idxL, idxG); - compare = first < second; } REPORTER_ASSERT(reporter, compare); - reporter->bumpTestCount(); } } } diff --git a/tests/PathOpsOpTest.cpp b/tests/PathOpsOpTest.cpp index 48ed866a90..08dff90c29 100644 --- a/tests/PathOpsOpTest.cpp +++ b/tests/PathOpsOpTest.cpp @@ -1144,7 +1144,6 @@ static void cubicOp69d(skiatest::Reporter* reporter) { testPathOp(reporter, path, pathB, kDifference_PathOp); } - SkPathOp ops[] = { kUnion_PathOp, kXOR_PathOp, @@ -1344,175 +1343,9 @@ static void cubicOp70d(skiatest::Reporter* reporter) { testPathOp(reporter, path, pathB, kDifference_PathOp); } -static void cubicOp71d(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,1); - path.cubicTo(0,5, 4,1, 6,4); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(1,4); - pathB.cubicTo(4,6, 1,0, 5,0); - pathB.close(); - testPathOp(reporter, path, pathB, kDifference_PathOp); -} - -static void cubicOp72i(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,1); - path.cubicTo(0,5, 5,2, 5,4); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(2,5); - pathB.cubicTo(4,5, 1,0, 5,0); - pathB.close(); - testPathOp(reporter, path, pathB, kIntersect_PathOp); -} - -static void cubicOp73d(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,1); - path.cubicTo(3,4, 4,0, 6,4); - path.lineTo(0,1); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(0,4); - pathB.cubicTo(4,6, 1,0, 4,3); - pathB.lineTo(0,4); - pathB.close(); - testPathOp(reporter, path, pathB, kDifference_PathOp); -} - -static void cubicOp75d(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,1); - path.cubicTo(0,4, 5,1, 6,4); - path.lineTo(0,1); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(1,5); - pathB.cubicTo(4,6, 1,0, 4,0); - pathB.lineTo(1,5); - pathB.close(); - testPathOp(reporter, path, pathB, kDifference_PathOp); -} - -static void cubicOp77i(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kEvenOdd_FillType); - path.moveTo(0,1); - path.cubicTo(1,3, 2,0, 3,2); - path.lineTo(0,1); - path.close(); - pathB.setFillType(SkPath::kEvenOdd_FillType); - pathB.moveTo(0,2); - pathB.cubicTo(2,3, 1,0, 3,1); - pathB.lineTo(0,2); - pathB.close(); - testPathOp(reporter, path, pathB, kIntersect_PathOp); -} - -static void cubicOp78u(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kEvenOdd_FillType); - path.moveTo(1,6); - path.cubicTo(1,6, 5,0, 6,1); - path.lineTo(1,6); - path.close(); - pathB.setFillType(SkPath::kEvenOdd_FillType); - pathB.moveTo(0,5); - pathB.cubicTo(1,6, 6,1, 6,1); - pathB.lineTo(0,5); - pathB.close(); - testPathOp(reporter, path, pathB, kUnion_PathOp); -} - -static void cubicOp79d(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,2); - path.cubicTo(0,1, 3,-0.1f, 1,0); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(0,3); - pathB.cubicTo(0,1, 2,0, 1,0); - pathB.close(); - testPathOp(reporter, path, pathB, kDifference_PathOp); -} - -static void cubicOp79u(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,1); - path.cubicTo(1,3, 1,0, 6,4); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(0,1); - pathB.cubicTo(4,6, 1,0, 3,1); - pathB.close(); - testPathOp(reporter, path, pathB, kIntersect_PathOp); -} - -static void cubicOp80i(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,1); - path.cubicTo(2,3, 2,1, 4,3); - path.lineTo(0,1); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(1,2); - pathB.cubicTo(3,4, 1,0, 3,2); - pathB.lineTo(1,2); - pathB.close(); - testPathOp(reporter, path, pathB, kIntersect_PathOp); -} - -static void cubicOp82i(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kEvenOdd_FillType); - path.moveTo(0,1); - path.cubicTo(2,3, 5,2, 3,0); - path.lineTo(0,1); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(2,5); - pathB.cubicTo(0,3, 1,0, 3,2); - pathB.lineTo(2,5); - pathB.close(); - testPathOp(reporter, path, pathB, kIntersect_PathOp); -} - -static void cubicOp81d(skiatest::Reporter* reporter) { - SkPath path, pathB; - path.setFillType(SkPath::kWinding_FillType); - path.moveTo(0,1); - path.cubicTo(4,6, 4,3, 5,4); - path.close(); - pathB.setFillType(SkPath::kWinding_FillType); - pathB.moveTo(3,4); - pathB.cubicTo(4,5, 1,0, 6,4); - pathB.close(); - testPathOp(reporter, path, pathB, kDifference_PathOp); -} - -static void (*firstTest)(skiatest::Reporter* ) = cubicOp81d; +static void (*firstTest)(skiatest::Reporter* ) = 0; static struct TestDesc tests[] = { - TEST(cubicOp82i), - TEST(cubicOp81d), - TEST(cubicOp80i), - TEST(cubicOp79u), - TEST(cubicOp79d), - TEST(cubicOp78u), - TEST(cubicOp77i), - TEST(cubicOp75d), - TEST(cubicOp73d), - TEST(cubicOp72i), - TEST(cubicOp71d), TEST(skp5), TEST(skp4), TEST(skp3), diff --git a/tests/PathOpsSimplifyTest.cpp b/tests/PathOpsSimplifyTest.cpp index f4a332e231..ce2c89bf7a 100644 --- a/tests/PathOpsSimplifyTest.cpp +++ b/tests/PathOpsSimplifyTest.cpp @@ -3772,7 +3772,7 @@ static void testQuad7(skiatest::Reporter* reporter) { testSimplify(reporter, path); } -static void (*firstTest)(skiatest::Reporter* ) = testQuadratic85; +static void (*firstTest)(skiatest::Reporter* ) = 0; static TestDesc tests[] = { TEST(testQuad7), diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index 0f59aebe88..fa95a35efd 100644 --- a/tests/PathTest.cpp +++ b/tests/PathTest.cpp @@ -470,9 +470,6 @@ static void test_poly(skiatest::Reporter* reporter, const SkPath& path, case SkPath::kQuad_Verb: REPORTER_ASSERT(reporter, !"unexpected quad verb"); break; - case SkPath::kConic_Verb: - REPORTER_ASSERT(reporter, !"unexpected conic verb"); - break; case SkPath::kCubic_Verb: REPORTER_ASSERT(reporter, !"unexpected cubic verb"); break; @@ -1972,19 +1969,6 @@ static void test_raw_iter(skiatest::Reporter* reporter) { numPoints += 2; lastWasClose = false; break; - case SkPath::kConic_Verb: - if (!haveMoveTo) { - expectedPts[numPoints++] = lastMoveToPt; - expectedVerbs[numIterVerbs++] = SkPath::kMove_Verb; - haveMoveTo = true; - } - expectedPts[numPoints] = randomPts[(rand.nextU() >> 16) % 25]; - expectedPts[numPoints + 1] = randomPts[(rand.nextU() >> 16) % 25]; - p.conicTo(expectedPts[numPoints], expectedPts[numPoints + 1], - rand.nextUScalar1() * 4); - numPoints += 2; - lastWasClose = false; - break; case SkPath::kCubic_Verb: if (!haveMoveTo) { expectedPts[numPoints++] = lastMoveToPt; @@ -2004,8 +1988,7 @@ static void test_raw_iter(skiatest::Reporter* reporter) { haveMoveTo = false; lastWasClose = true; break; - default: - SkASSERT(!"unexpected verb"); + default:; } expectedVerbs[numIterVerbs++] = nextVerb; } @@ -2036,7 +2019,6 @@ static void test_raw_iter(skiatest::Reporter* reporter) { numIterPts += 1; break; case SkPath::kQuad_Verb: - case SkPath::kConic_Verb: REPORTER_ASSERT(reporter, numIterPts < numPoints + 2); REPORTER_ASSERT(reporter, pts[0] == lastPt); REPORTER_ASSERT(reporter, pts[1] == expectedPts[numIterPts]); @@ -2057,8 +2039,7 @@ static void test_raw_iter(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, pts[0] == lastMoveTo); lastPt = lastMoveTo; break; - default: - SkASSERT(!"unexpected verb"); + default:; } } REPORTER_ASSERT(reporter, numIterPts == numPoints); |