aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMike Reed <reed@google.com>2018-01-22 16:49:49 -0500
committerSkia Commit-Bot <skia-commit-bot@chromium.org>2018-01-22 22:33:11 +0000
commit1fe0bcc4f92bfe104bda57aa2ae5d0cb5b4f8c09 (patch)
tree24ffec2976a352ea65128c2583c4b13e7608d272 /tests
parentca02c0a464efb6ef1d856d5658b9312fde580cc0 (diff)
downloadskqp-1fe0bcc4f92bfe104bda57aa2ae5d0cb5b4f8c09.tar.gz
check for huge paths
Bug:802976 Change-Id: Ibb5930442f75ca8483afc8dfa5869cac98573904 Reviewed-on: https://skia-review.googlesource.com/98440 Reviewed-by: Cary Clark <caryclark@google.com> Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/PathTest.cpp35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 4bb8c88ae1..037bda781d 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -4949,3 +4949,38 @@ DEF_TEST(AndroidArc, reporter) {
}
}
#endif
+
+/*
+ * Try a range of crazy values, just to ensure that we don't assert/crash.
+ */
+DEF_TEST(HugeGeometry, reporter) {
+ auto surf = SkSurface::MakeRasterN32Premul(100, 100);
+ auto canvas = surf->getCanvas();
+
+ const bool aas[] = { false, true };
+ const SkPaint::Style styles[] = {
+ SkPaint::kFill_Style, SkPaint::kStroke_Style, SkPaint::kStrokeAndFill_Style
+ };
+ const SkScalar values[] = {
+ 0, 1, 1000, 1000 * 1000, 1000.f * 1000 * 10000, SK_ScalarMax / 2, SK_ScalarMax,
+ SK_ScalarInfinity
+ };
+
+ SkPaint paint;
+ for (auto x : values) {
+ SkRect r = { -x, -x, x, x };
+ for (auto width : values) {
+ paint.setStrokeWidth(width);
+ for (auto aa : aas) {
+ paint.setAntiAlias(aa);
+ for (auto style : styles) {
+ paint.setStyle(style);
+ canvas->drawRect(r, paint);
+ canvas->drawOval(r, paint);
+ }
+ }
+ }
+ }
+
+}
+