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

Unified Diff: tests/PathTest.cpp

Issue 1126993003: experimental path-builder Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « src/core/SkPathIter.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 cd9e8847a1fde0f357da1ef3c1d83ec5d104b00e..7b579fa5e512ae2bf4f378c26e44ba45434c1c92 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -21,6 +21,37 @@
#include "SkWriter32.h"
#include "Test.h"
+#include "SkPathIter.h"
+
+static void test_2_iters(const SkPath& path) {
+ SkPath::RawIter iter0(path);
+ SkPathIter iter1(path);
+
+ SkPoint pts[4];
+ SkPath::Verb verb;
+ while ((verb = iter0.next(pts)) != SkPath::kDone_Verb) {
+ SkASSERT(iter1.next());
+ SkASSERT(!iter1.done());
+ SkASSERT(iter1.currVerb() == (SkPathVerb)verb);
+ int n = 0;
+ switch (verb) {
+ case SkPath::kMove_Verb: n = 1; break;
+ case SkPath::kLine_Verb: n = 2; break;
+ case SkPath::kQuad_Verb: n = 3; break;
+ case SkPath::kConic_Verb: n = 3; break;
+ case SkPath::kCubic_Verb: n = 4; break;
+ case SkPath::kClose_Verb: n = 0; break;
+ default:
+ SkASSERT(!"unexpected");
+ }
+ for (int i = 0; i < n; ++i) {
+ SkASSERT(pts[i] == iter1.currPts()[i]);
+ }
+ }
+ SkASSERT(iter1.done());
+ SkDebugf("test_2_iters\n");
+}
+
static void set_radii(SkVector radii[4], int index, float rad) {
sk_bzero(radii, sizeof(SkVector) * 4);
radii[index].set(rad, rad);
@@ -825,6 +856,7 @@ static void test_isfinite(skiatest::Reporter* reporter) {
//
static void test_poly(skiatest::Reporter* reporter, const SkPath& path,
const SkPoint srcPts[], bool expectClose) {
+ test_2_iters(path);
SkPath::RawIter iter(path);
SkPoint pts[4];
@@ -910,6 +942,7 @@ const SkPathPriv::FirstDirection kDontCheckDir = static_cast<SkPathPriv::FirstDi
static void check_direction(skiatest::Reporter* reporter, const SkPath& path,
SkPathPriv::FirstDirection expected) {
+ test_2_iters(path);
if (expected == kDontCheckDir) {
return;
}
« no previous file with comments | « src/core/SkPathIter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698