aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathTest.cpp
diff options
context:
space:
mode:
authorGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-02-07 19:39:09 +0000
committerGravatar reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-02-07 19:39:09 +0000
commit62047cf1980861234e7367a225928b84ce492c68 (patch)
tree37fe5dba69bb6bdcdd91d61c6fd3f39188c5a55d /tests/PathTest.cpp
parentb715ef71503efc07c8cad3afd0cb9609dc3947a8 (diff)
clear the convex-hint in reset() and rewind(), to match its state in a newly
created path. todo: convexity perhaps should be tristate: yes, no, unknown git-svn-id: http://skia.googlecode.com/svn/trunk@768 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/PathTest.cpp')
-rw-r--r--tests/PathTest.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 9f26d01841..b4b631769b 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -6,7 +6,7 @@ static void check_convex_bounds(skiatest::Reporter* reporter, const SkPath& p,
const SkRect& bounds) {
REPORTER_ASSERT(reporter, p.isConvex());
REPORTER_ASSERT(reporter, p.getBounds() == bounds);
-
+
SkPath p2(p);
REPORTER_ASSERT(reporter, p2.isConvex());
REPORTER_ASSERT(reporter, p2.getBounds() == bounds);
@@ -45,12 +45,12 @@ static void TestPath(skiatest::Reporter* reporter) {
p.setIsConvex(false);
p.addRoundRect(bounds, SK_Scalar1, SK_Scalar1);
check_convex_bounds(reporter, p, bounds);
-
+
p.reset();
p.setIsConvex(false);
p.addOval(bounds);
check_convex_bounds(reporter, p, bounds);
-
+
p.reset();
p.setIsConvex(false);
p.addRect(bounds);
@@ -88,6 +88,18 @@ static void TestPath(skiatest::Reporter* reporter) {
p.moveTo(SK_Scalar1, 0);
p.getLastPt(&pt);
REPORTER_ASSERT(reporter, pt.fX == SK_Scalar1);
+
+ // check that reset and rewind clear the convex hint back to false
+ p.setIsConvex(false);
+ REPORTER_ASSERT(reporter, !p.isConvex());
+ p.setIsConvex(true);
+ REPORTER_ASSERT(reporter, p.isConvex());
+ p.reset();
+ REPORTER_ASSERT(reporter, !p.isConvex());
+ p.setIsConvex(true);
+ REPORTER_ASSERT(reporter, p.isConvex());
+ p.rewind();
+ REPORTER_ASSERT(reporter, !p.isConvex());
}
#include "TestClassDef.h"