aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/RoundRectTest.cpp
diff options
context:
space:
mode:
authorGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-23 23:11:21 +0000
committerGravatar mike@reedtribe.org <mike@reedtribe.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-12-23 23:11:21 +0000
commitbcbef579d02e255b9a29b5db2d6804f4bfc76d1c (patch)
treeffad137edc5dda0c6a6a18d59bd387530a8b8f68 /tests/RoundRectTest.cpp
parent15ed90f6ee939055ce6e2e1ace0292e7c3d9cbfc (diff)
add SkRRect::inset(), which mimics stroking
git-svn-id: http://skia.googlecode.com/svn/trunk@6935 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/RoundRectTest.cpp')
-rw-r--r--tests/RoundRectTest.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp
index e88ed8ad8b..7a2c66e4cf 100644
--- a/tests/RoundRectTest.cpp
+++ b/tests/RoundRectTest.cpp
@@ -11,6 +11,27 @@
static const SkScalar kWidth = 100.0f;
static const SkScalar kHeight = 100.0f;
+static void test_inset(skiatest::Reporter* reporter) {
+ SkRRect rr, rr2;
+ SkRect r = { 0, 0, 100, 100 };
+
+ rr.setRect(r);
+ rr.inset(-20, -20, &rr2);
+ REPORTER_ASSERT(reporter, rr2.isRect());
+
+ rr.inset(20, 20, &rr2);
+ REPORTER_ASSERT(reporter, rr2.isRect());
+
+ rr.inset(r.width()/2, r.height()/2, &rr2);
+ REPORTER_ASSERT(reporter, rr2.isEmpty());
+
+ rr.setRectXY(r, 20, 20);
+ rr.inset(19, 19, &rr2);
+ REPORTER_ASSERT(reporter, rr2.isSimple());
+ rr.inset(20, 20, &rr2);
+ REPORTER_ASSERT(reporter, rr2.isRect());
+}
+
// Test out the basic API entry points
static void test_round_rect_basic(skiatest::Reporter* reporter) {
// Test out initialization methods
@@ -302,6 +323,7 @@ static void TestRoundRect(skiatest::Reporter* reporter) {
test_round_rect_ovals(reporter);
test_round_rect_general(reporter);
test_round_rect_iffy_parameters(reporter);
+ test_inset(reporter);
}
#include "TestClassDef.h"