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

Side by Side Diff: tests/CodexTest.cpp

Issue 1091043003: Ensure that we create a NULL codec for images with zero dimensions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 8 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 | « src/codec/SkCodec_libbmp.cpp ('k') | no next file » | 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 2015 Google Inc. 2 * Copyright 2015 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 "Resources.h" 8 #include "Resources.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkCodec.h" 10 #include "SkCodec.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // Ensure that onGetScaledDimensions returns valid image dimensions to use for d ecodes 189 // Ensure that onGetScaledDimensions returns valid image dimensions to use for d ecodes
190 DEF_TEST(Codec_Dimensions, r) { 190 DEF_TEST(Codec_Dimensions, r) {
191 // JPG 191 // JPG
192 test_dimensions(r, "CMYK.jpg"); 192 test_dimensions(r, "CMYK.jpg");
193 test_dimensions(r, "color_wheel.jpg"); 193 test_dimensions(r, "color_wheel.jpg");
194 test_dimensions(r, "grayscale.jpg"); 194 test_dimensions(r, "grayscale.jpg");
195 test_dimensions(r, "mandrill_512_q075.jpg"); 195 test_dimensions(r, "mandrill_512_q075.jpg");
196 test_dimensions(r, "randPixels.jpg"); 196 test_dimensions(r, "randPixels.jpg");
197 } 197 }
198 198
199 static void test_empty(skiatest::Reporter* r, const char path[]) {
200 SkAutoTDelete<SkStream> stream(resource(path));
201 if (!stream) {
202 SkDebugf("Missing resource '%s'\n", path);
203 return;
204 }
205 SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
206 REPORTER_ASSERT(r, NULL == codec);
207 }
199 208
200 209 DEF_TEST(Codec_Empty, r) {
210 // Test images that should not be able to create a codec
211 test_empty(r, "empty_images/zero-dims.gif");
212 test_empty(r, "empty_images/zero-embedded.ico");
213 test_empty(r, "empty_images/zero-width.bmp");
214 test_empty(r, "empty_images/zero-height.bmp");
215 test_empty(r, "empty_images/zero-width.jpg");
216 test_empty(r, "empty_images/zero-height.jpg");
217 test_empty(r, "empty_images/zero-width.png");
218 test_empty(r, "empty_images/zero-height.png");
219 test_empty(r, "empty_images/zero-width.wbmp");
220 test_empty(r, "empty_images/zero-height.wbmp");
221 }
OLDNEW
« no previous file with comments | « src/codec/SkCodec_libbmp.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698