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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/codec/SkCodec_libbmp.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/CodexTest.cpp
diff --git a/tests/CodexTest.cpp b/tests/CodexTest.cpp
index d7142518a33892515865232a9183689659679990..b33e0bebea150ce15bec60f498c565a6e7990c3b 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -196,5 +196,26 @@ DEF_TEST(Codec_Dimensions, r) {
test_dimensions(r, "randPixels.jpg");
}
+static void test_empty(skiatest::Reporter* r, const char path[]) {
+ SkAutoTDelete<SkStream> stream(resource(path));
+ if (!stream) {
+ SkDebugf("Missing resource '%s'\n", path);
+ return;
+ }
+ SkAutoTDelete<SkCodec> codec(SkCodec::NewFromStream(stream.detach()));
+ REPORTER_ASSERT(r, NULL == codec);
+}
-
+DEF_TEST(Codec_Empty, r) {
+ // Test images that should not be able to create a codec
+ test_empty(r, "empty_images/zero-dims.gif");
+ test_empty(r, "empty_images/zero-embedded.ico");
+ test_empty(r, "empty_images/zero-width.bmp");
+ test_empty(r, "empty_images/zero-height.bmp");
+ test_empty(r, "empty_images/zero-width.jpg");
+ test_empty(r, "empty_images/zero-height.jpg");
+ test_empty(r, "empty_images/zero-width.png");
+ test_empty(r, "empty_images/zero-height.png");
+ test_empty(r, "empty_images/zero-width.wbmp");
+ test_empty(r, "empty_images/zero-height.wbmp");
+}
« 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