aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SurfaceTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-06-28 19:57:21 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-06-29 12:14:53 +0000
commit44d04bd7ed3be8c39cc7ea02e3789cccf083bb55 (patch)
tree9fc3d15501a84bf9636b3ec5619b90c8d7f62a9a /tests/SurfaceTest.cpp
parent7f22511c1cb4e823e17446c54aa308a2f2203899 (diff)
add null-surface
Bug:crbug.com/737726 Change-Id: Iec9094d8d7232943e90fe2d9745fc83bcdf90954 Reviewed-on: https://skia-review.googlesource.com/21190 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'tests/SurfaceTest.cpp')
-rw-r--r--tests/SurfaceTest.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/SurfaceTest.cpp b/tests/SurfaceTest.cpp
index dc051a54b6..5249b3d562 100644
--- a/tests/SurfaceTest.cpp
+++ b/tests/SurfaceTest.cpp
@@ -948,3 +948,15 @@ DEF_GPUTEST_FOR_RENDERING_CONTEXTS(OverdrawSurface_Gpu, r, ctxInfo) {
test_overdraw_surface(r, surface.get());
}
#endif
+
+DEF_TEST(Surface_null, r) {
+ REPORTER_ASSERT(r, SkSurface::MakeNull(0, 0) == nullptr);
+
+ const int w = 37;
+ const int h = 1000;
+ auto surf = SkSurface::MakeNull(w, h);
+ auto canvas = surf->getCanvas();
+
+ canvas->drawPaint(SkPaint()); // should not crash, but don't expect anything to draw
+ REPORTER_ASSERT(r, surf->makeImageSnapshot() == nullptr);
+}