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

Side by Side Diff: tests/BitmapTest.cpp

Issue 510423005: make allocPixels throw on failure (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 3 months 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 unified diff | Download patch
« no previous file with comments | « tests/BitmapHasherTest.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkBitmap.h" 8 #include "SkBitmap.h"
9 9
10 #include "Test.h" 10 #include "Test.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 * This test contains basic sanity checks concerning bitmaps. 68 * This test contains basic sanity checks concerning bitmaps.
69 */ 69 */
70 DEF_TEST(Bitmap, reporter) { 70 DEF_TEST(Bitmap, reporter) {
71 // Zero-sized bitmaps are allowed 71 // Zero-sized bitmaps are allowed
72 for (int width = 0; width < 2; ++width) { 72 for (int width = 0; width < 2; ++width) {
73 for (int height = 0; height < 2; ++height) { 73 for (int height = 0; height < 2; ++height) {
74 SkBitmap bm; 74 SkBitmap bm;
75 bool setConf = bm.setInfo(SkImageInfo::MakeN32Premul(width, height)) ; 75 bool setConf = bm.setInfo(SkImageInfo::MakeN32Premul(width, height)) ;
76 REPORTER_ASSERT(reporter, setConf); 76 REPORTER_ASSERT(reporter, setConf);
77 if (setConf) { 77 if (setConf) {
78 REPORTER_ASSERT(reporter, bm.allocPixels(NULL)); 78 bm.allocPixels();
79 } 79 }
80 REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty()); 80 REPORTER_ASSERT(reporter, SkToBool(width & height) != bm.empty());
81 } 81 }
82 } 82 }
83 83
84 test_bigwidth(reporter); 84 test_bigwidth(reporter);
85 test_allocpixels(reporter); 85 test_allocpixels(reporter);
86 } 86 }
OLDNEW
« no previous file with comments | « tests/BitmapHasherTest.cpp ('k') | tests/CachedDecodingPixelRefTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698