aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/SurfaceTest.cpp
diff options
context:
space:
mode:
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);
+}