aboutsummaryrefslogtreecommitdiff
path: root/tests/PathTest.cpp
diff options
context:
space:
mode:
authorbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-21 15:13:34 +0000
committerbungeman@google.com <bungeman@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-06-21 15:13:34 +0000
commita5809a3e4cb356387c5201ab9c0a10edf11a01be (patch)
tree198fd57f3f62730ae2b4719bc6ccaa59da6e0457 /tests/PathTest.cpp
parent8ea69838a4f00281c744e8c8e7fc95375c0aa1e5 (diff)
SkPath::rewind needs to have same reset as SkPath::reset.
R=caryclark@google.com, reed@google.com Review URL: https://codereview.chromium.org/17432003 git-svn-id: http://skia.googlecode.com/svn/trunk@9718 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathTest.cpp')
-rw-r--r--tests/PathTest.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 0f59aebe88..6c8f83e540 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -2327,11 +2327,8 @@ static void test_oval(skiatest::Reporter* reporter) {
REPORTER_ASSERT(reporter, path.isOval(NULL));
}
-static void TestPath(skiatest::Reporter* reporter) {
- SkTSize<SkScalar>::Make(3,4);
-
- SkPath p, p2;
- SkRect bounds, bounds2;
+static void test_empty(skiatest::Reporter* reporter, const SkPath& p) {
+ SkPath empty;
REPORTER_ASSERT(reporter, p.isEmpty());
REPORTER_ASSERT(reporter, 0 == p.countPoints());
@@ -2340,8 +2337,16 @@ static void TestPath(skiatest::Reporter* reporter) {
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());
@@ -2354,22 +2359,23 @@ static void TestPath(skiatest::Reporter* reporter) {
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);