halcanary@google.com | 4428734 | 2013-12-13 18:29:51 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
| 8 | #include "SkBitmap.h" |
| 9 | |
| 10 | #include "Test.h" |
| 11 | #include "TestClassDef.h" |
| 12 | |
| 13 | /** |
| 14 | * This test contains basic sanity checks concerning bitmaps. |
| 15 | */ |
| 16 | DEF_TEST(Bitmap, reporter) { |
| 17 | const SkBitmap::Config conf = SkBitmap::kARGB_8888_Config; |
| 18 | // Zero-sized bitmaps are allowed |
| 19 | for (int width = 0; width < 2; ++width) { |
| 20 | for (int height = 0; height < 2; ++height) { |
| 21 | SkBitmap bm; |
| 22 | bool setConf = bm.setConfig(conf, width, height); |
| 23 | REPORTER_ASSERT(reporter, setConf); |
| 24 | if (setConf) { |
| 25 | REPORTER_ASSERT(reporter, bm.allocPixels(NULL)); |
| 26 | } |
halcanary@google.com | 2af6c12 | 2013-12-13 19:25:21 +0000 | [diff] [blame^] | 27 | REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty()); |
halcanary@google.com | 4428734 | 2013-12-13 18:29:51 +0000 | [diff] [blame] | 28 | } |
| 29 | } |
| 30 | } |