aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/RectTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2018-01-29 15:56:11 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-01-29 21:16:44 +0000
commit926e193e5db4d98f10cda76a2b6a01b5c78753ad (patch)
tree8769861b41f9c77a0992cf2f8283bd3673efb4db /tests/RectTest.cpp
parenteb87d67a8300754b555f1408df67753649beecbc (diff)
check that rect is finite before jamming our bounds
Bug: skia:7507 Change-Id: I45ff36f96951f63795fdc09fdd8e3083865f6eda Reviewed-on: https://skia-review.googlesource.com/101461 Commit-Queue: Mike Reed <reed@google.com> Reviewed-by: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'tests/RectTest.cpp')
-rw-r--r--tests/RectTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/RectTest.cpp b/tests/RectTest.cpp
index 6a588b7b6c..d34214d6d3 100644
--- a/tests/RectTest.cpp
+++ b/tests/RectTest.cpp
@@ -7,6 +7,7 @@
#include "SkBitmap.h"
#include "SkCanvas.h"
+#include "SkPath.h"
#include "SkRect.h"
#include "SkRectPriv.h"
#include "Test.h"
@@ -95,6 +96,14 @@ DEF_TEST(Rect_grow, reporter) {
test_skbug4406(reporter);
}
+DEF_TEST(Rect_path_nan, reporter) {
+ SkRect r = { 0, 0, SK_ScalarNaN, 100 };
+ SkPath p;
+ p.addRect(r);
+ // path normally just jams its bounds to be r, but it must notice that r is non-finite
+ REPORTER_ASSERT(reporter, !p.isFinite());
+}
+
DEF_TEST(Rect_largest, reporter) {
REPORTER_ASSERT(reporter, !SkRectPriv::MakeILarge().isEmpty());
REPORTER_ASSERT(reporter, SkRectPriv::MakeILargestInverted().isEmpty());