aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PixelRefTest.cpp
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2015-05-30 06:32:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-05-30 06:32:55 -0700
commitdf91b73a34e3a306c93a5e320704736255c3d9f0 (patch)
treea528c33fdf0dda98f4e414f953dd7349a548e69f /tests/PixelRefTest.cpp
parent19663e54c017499406036746e7689193aa6417e6 (diff)
Revert[4] of add asserts around results from requestLock
Diffstat (limited to 'tests/PixelRefTest.cpp')
-rw-r--r--tests/PixelRefTest.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/PixelRefTest.cpp b/tests/PixelRefTest.cpp
index e13d0e07e5..ed9ea87092 100644
--- a/tests/PixelRefTest.cpp
+++ b/tests/PixelRefTest.cpp
@@ -1,8 +1,29 @@
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
#include "Test.h"
#include "SkMallocPixelRef.h"
#include "SkPixelRef.h"
+static void test_install(skiatest::Reporter* reporter) {
+ bool success;
+ SkImageInfo info = SkImageInfo::MakeN32Premul(0, 0);
+ SkBitmap bm;
+ // make sure we don't assert on an empty install
+ success = bm.installPixels(info, NULL, 0);
+ REPORTER_ASSERT(reporter, success);
+
+ // no pixels should be the same as setInfo()
+ info = SkImageInfo::MakeN32Premul(10, 10);
+ success = bm.installPixels(info, NULL, 0);
+ REPORTER_ASSERT(reporter, success);
+}
+
class TestListener : public SkPixelRef::GenIDChangeListener {
public:
explicit TestListener(int* ptr) : fPtr(ptr) {}
@@ -43,4 +64,6 @@ DEF_TEST(PixelRef_GenIDChange, r) {
REPORTER_ASSERT(r, 0 != pixelRef->getGenerationID());
pixelRef->addGenIDChangeListener(NULL);
pixelRef->notifyPixelsChanged();
+
+ test_install(r);
}