aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2014-06-03 13:12:51 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-06-03 13:12:51 -0700
commit65044bfe021e9c0023d78080583e9acb3bdb5ce7 (patch)
tree79345f8bd3f3933cd1944745396558caa7b043a5 /tests
parent99ffe24200d8940ceba20f6fbf8c460f994d3cd1 (diff)
Return NULL when building empty LayerRasterizer.
In SkLayerRasterizer::snapshotRasterizer() and ::detachRasterizer(), if no layers have been added, do not attempt to create an SkLayerRasterizer. Instead, return NULL. This fixes an error when running tests on Android. Update dox to state that NULL may be returned. Add tests. R=reed@google.com Author: scroggo@google.com Review URL: https://codereview.chromium.org/313653006
Diffstat (limited to 'tests')
-rw-r--r--tests/LayerRasterizerTest.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/LayerRasterizerTest.cpp b/tests/LayerRasterizerTest.cpp
index 8e6b64c207..640c5813d4 100644
--- a/tests/LayerRasterizerTest.cpp
+++ b/tests/LayerRasterizerTest.cpp
@@ -81,6 +81,7 @@ static bool equals(const SkLayerRasterizer_Rec& rec1, const SkLayerRasterizer_Re
DEF_TEST(LayerRasterizer_copy, reporter) {
SkLayerRasterizer::Builder builder;
+ REPORTER_ASSERT(reporter, NULL == builder.snapshotRasterizer());
SkPaint paint;
// Create a bunch of paints with different flags.
for (uint32_t flags = 0x01; flags < SkPaint::kAllFlags; flags <<= 1) {
@@ -136,3 +137,8 @@ DEF_TEST(LayerRasterizer_copy, reporter) {
}
}
}
+
+DEF_TEST(LayerRasterizer_detachEmpty, reporter) {
+ SkLayerRasterizer::Builder builder;
+ REPORTER_ASSERT(reporter, NULL == builder.detachRasterizer());
+}