Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(85)

Unified Diff: tests/PathTest.cpp

Issue 16195004: add asserts to point<-->verb helpers (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tests/PathOpsSimplifyTest.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathTest.cpp
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index fa95a35efd0b4d8fc080bded94a6dcb6fb3c0487..0f59aebe88a2bd4107d5bd3cb998cac682338cb2 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -470,6 +470,9 @@ 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;
@@ -1969,6 +1972,19 @@ 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;
@@ -1988,7 +2004,8 @@ static void test_raw_iter(skiatest::Reporter* reporter) {
haveMoveTo = false;
lastWasClose = true;
break;
- default:;
+ default:
+ SkASSERT(!"unexpected verb");
}
expectedVerbs[numIterVerbs++] = nextVerb;
}
@@ -2019,6 +2036,7 @@ 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]);
@@ -2039,7 +2057,8 @@ static void test_raw_iter(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, pts[0] == lastMoveTo);
lastPt = lastMoveTo;
break;
- default:;
+ default:
+ SkASSERT(!"unexpected verb");
}
}
REPORTER_ASSERT(reporter, numIterPts == numPoints);
« no previous file with comments | « tests/PathOpsSimplifyTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698