Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1180)

Unified Diff: tests/BitmapTest.cpp

Issue 111953004: Allow 0-width SkBitmap in setConfig. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: rebase Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapTest.cpp
diff --git a/tests/BitmapTest.cpp b/tests/BitmapTest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..a6859fabf004c276f91fb22a14735ebe59972a14
--- /dev/null
+++ b/tests/BitmapTest.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBitmap.h"
+
+#include "Test.h"
+#include "TestClassDef.h"
+
+/**
+ * This test contains basic sanity checks concerning bitmaps.
+ */
+DEF_TEST(Bitmap, reporter) {
+ const SkBitmap::Config conf = SkBitmap::kARGB_8888_Config;
+ // Zero-sized bitmaps are allowed
+ for (int width = 0; width < 2; ++width) {
+ for (int height = 0; height < 2; ++height) {
+ SkBitmap bm;
+ bool setConf = bm.setConfig(conf, width, height);
+ REPORTER_ASSERT(reporter, setConf);
+ if (setConf) {
+ REPORTER_ASSERT(reporter, bm.allocPixels(NULL));
+ }
+ REPORTER_ASSERT(reporter, (width & height) != bm.empty());
+ }
+ }
+}
« no previous file with comments | « src/core/SkBitmap.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698