aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/RoundRectTest.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2017-12-15 11:31:05 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-12-19 21:10:36 +0000
commit0a241ce808511ceb1c72d6f2473b01b455ac5101 (patch)
treec137018f24c515dde2d85d4eb6d3f0b7ed0081a7 /tests/RoundRectTest.cpp
parentab10c8258d7588bb9c353a8ecc1944747a4fac62 (diff)
Don't canonicalize empty SkRRects. They stroke differently.
Make insetting greater than width or height collapse to a point/line. SkPath::addRRect() doesn't ignore an empty SkRRect. Change-Id: I933a3419a6d75be534f1d8328faa715772045f67 Reviewed-on: https://skia-review.googlesource.com/85680 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'tests/RoundRectTest.cpp')
-rw-r--r--tests/RoundRectTest.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp
index 43a51430ab..a32e347b6f 100644
--- a/tests/RoundRectTest.cpp
+++ b/tests/RoundRectTest.cpp
@@ -71,36 +71,51 @@ static void test_empty(skiatest::Reporter* reporter) {
for (size_t i = 0; i < SK_ARRAY_COUNT(oooRects); ++i) {
r.setRect(oooRects[i]);
REPORTER_ASSERT(reporter, !r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == oooRects[i].makeSorted());
r.setOval(oooRects[i]);
REPORTER_ASSERT(reporter, !r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == oooRects[i].makeSorted());
r.setRectXY(oooRects[i], 1, 2);
REPORTER_ASSERT(reporter, !r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == oooRects[i].makeSorted());
r.setNinePatch(oooRects[i], 0, 1, 2, 3);
REPORTER_ASSERT(reporter, !r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == oooRects[i].makeSorted());
r.setRectRadii(oooRects[i], radii);
REPORTER_ASSERT(reporter, !r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == oooRects[i].makeSorted());
}
for (size_t i = 0; i < SK_ARRAY_COUNT(emptyRects); ++i) {
r.setRect(emptyRects[i]);
REPORTER_ASSERT(reporter, r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == emptyRects[i]);
r.setOval(emptyRects[i]);
REPORTER_ASSERT(reporter, r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == emptyRects[i]);
r.setRectXY(emptyRects[i], 1, 2);
REPORTER_ASSERT(reporter, r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == emptyRects[i]);
r.setNinePatch(emptyRects[i], 0, 1, 2, 3);
REPORTER_ASSERT(reporter, r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == emptyRects[i]);
r.setRectRadii(emptyRects[i], radii);
REPORTER_ASSERT(reporter, r.isEmpty());
+ REPORTER_ASSERT(reporter, r.rect() == emptyRects[i]);
}
+
+ r.setRect({SK_ScalarNaN, 10, 10, 20});
+ REPORTER_ASSERT(reporter, r == SkRRect::MakeEmpty());
+ r.setRect({0, 10, 10, SK_ScalarInfinity});
+ REPORTER_ASSERT(reporter, r == SkRRect::MakeEmpty());
}
static const SkScalar kWidth = 100.0f;