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

Unified Diff: tests/PathTest.cpp

Issue 17432003: SkPath::rewind needs to have same reset as SkPath::reset. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 6 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/pathops/SkPathOpsSimplify.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
===================================================================
--- tests/PathTest.cpp (revision 9702)
+++ tests/PathTest.cpp (working copy)
@@ -2327,12 +2327,9 @@
REPORTER_ASSERT(reporter, path.isOval(NULL));
}
-static void TestPath(skiatest::Reporter* reporter) {
- SkTSize<SkScalar>::Make(3,4);
+static void test_empty(skiatest::Reporter* reporter, const SkPath& p) {
+ SkPath empty;
- SkPath p, p2;
- SkRect bounds, bounds2;
-
REPORTER_ASSERT(reporter, p.isEmpty());
REPORTER_ASSERT(reporter, 0 == p.countPoints());
REPORTER_ASSERT(reporter, 0 == p.countVerbs());
@@ -2340,9 +2337,17 @@
REPORTER_ASSERT(reporter, p.isConvex());
REPORTER_ASSERT(reporter, p.getFillType() == SkPath::kWinding_FillType);
REPORTER_ASSERT(reporter, !p.isInverseFillType());
- REPORTER_ASSERT(reporter, p == p2);
- REPORTER_ASSERT(reporter, !(p != p2));
+ REPORTER_ASSERT(reporter, p == empty);
+ REPORTER_ASSERT(reporter, !(p != empty));
+}
+static void TestPath(skiatest::Reporter* reporter) {
+ SkTSize<SkScalar>::Make(3,4);
+
+ SkPath p, empty;
+ SkRect bounds, bounds2;
+ test_empty(reporter, p);
+
REPORTER_ASSERT(reporter, p.getBounds().isEmpty());
bounds.set(0, 0, SK_Scalar1, SK_Scalar1);
@@ -2354,22 +2359,23 @@
REPORTER_ASSERT(reporter, !p.isEmpty());
p.reset();
- REPORTER_ASSERT(reporter, 0 == p.getSegmentMasks());
- REPORTER_ASSERT(reporter, p.isEmpty());
+ test_empty(reporter, p);
p.addOval(bounds);
check_convex_bounds(reporter, p, bounds);
REPORTER_ASSERT(reporter, !p.isEmpty());
- p.reset();
+ p.rewind();
+ test_empty(reporter, p);
+
p.addRect(bounds);
check_convex_bounds(reporter, p, bounds);
// we have only lines
REPORTER_ASSERT(reporter, SkPath::kLine_SegmentMask == p.getSegmentMasks());
REPORTER_ASSERT(reporter, !p.isEmpty());
- REPORTER_ASSERT(reporter, p != p2);
- REPORTER_ASSERT(reporter, !(p == p2));
+ REPORTER_ASSERT(reporter, p != empty);
+ REPORTER_ASSERT(reporter, !(p == empty));
// do getPoints and getVerbs return the right result
REPORTER_ASSERT(reporter, p.getPoints(NULL, 0) == 4);
« no previous file with comments | « src/pathops/SkPathOpsSimplify.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698