blob: 250b6da32c2aa748db19d8996a6dfc3d2384ec06 [file] [log] [blame]
halcanary@google.com44287342013-12-13 18:29:51 +00001/*
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 */
16DEF_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.com2af6c122013-12-13 19:25:21 +000027 REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty());
halcanary@google.com44287342013-12-13 18:29:51 +000028 }
29 }
30}