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

Unified Diff: tests/CodexTest.cpp

Issue 1702533004: Individually enable and disable SkCodecs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 10 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
« public.bzl ('K') | « src/codec/SkCodec.cpp ('k') | tests/YUVTest.cpp » ('j') | 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 0bd58935daedbd75b31c7de874935f04a53fa180..0286f0c1d3f4b19b34a4a195984d0d11dd41ffee 100644
--- a/tests/CodexTest.cpp
+++ b/tests/CodexTest.cpp
@@ -333,33 +333,44 @@ static void check(skiatest::Reporter* r,
DEF_TEST(Codec, r) {
// WBMP
+#if defined(SK_CODEC_DECODES_WBMP)
check(r, "mandrill.wbmp", SkISize::Make(512, 512), true, false);
+#endif
// WEBP
+#if defined(SK_CODEC_DECODES_WEBP)
check(r, "baby_tux.webp", SkISize::Make(386, 395), false, true);
check(r, "color_wheel.webp", SkISize::Make(128, 128), false, true);
check(r, "yellow_rose.webp", SkISize::Make(400, 301), false, true);
+#endif
// BMP
+#if defined(SK_CODEC_DECODES_BMP)
check(r, "randPixels.bmp", SkISize::Make(8, 8), true, false);
check(r, "rle.bmp", SkISize::Make(320, 240), true, false);
+#endif
// ICO
+#if defined(SK_CODEC_DECODES_ICO)
// FIXME: We are not ready to test incomplete ICOs
// These two tests examine interestingly different behavior:
// Decodes an embedded BMP image
check(r, "color_wheel.ico", SkISize::Make(128, 128), true, false, false);
// Decodes an embedded PNG image
check(r, "google_chrome.ico", SkISize::Make(256, 256), true, false, false);
+#endif
// GIF
+#if defined(SK_CODEC_DECODES_GIF)
// FIXME: We are not ready to test incomplete GIFs
check(r, "box.gif", SkISize::Make(200, 55), true, false, false);
check(r, "color_wheel.gif", SkISize::Make(128, 128), true, false, false);
// randPixels.gif is too small to test incomplete
check(r, "randPixels.gif", SkISize::Make(8, 8), true, false, false);
+#endif
// JPG
+#if defined(SK_CODEC_DECODES_JPEG)
check(r, "CMYK.jpg", SkISize::Make(642, 516), true, false);
check(r, "color_wheel.jpg", SkISize::Make(128, 128), true, false);
// grayscale.jpg is too small to test incomplete
@@ -367,8 +378,10 @@ DEF_TEST(Codec, r) {
check(r, "mandrill_512_q075.jpg", SkISize::Make(512, 512), true, false);
// randPixels.jpg is too small to test incomplete
check(r, "randPixels.jpg", SkISize::Make(8, 8), true, false, false);
+#endif
// PNG
+#if defined(SK_CODEC_DECODES_PNG)
check(r, "arrow.png", SkISize::Make(187, 312), true, false, false);
check(r, "baby_tux.png", SkISize::Make(240, 246), true, false, false);
check(r, "color_wheel.png", SkISize::Make(128, 128), true, false, false);
@@ -384,6 +397,7 @@ DEF_TEST(Codec, r) {
check(r, "plane_interlaced.png", SkISize::Make(250, 126), true, false, false);
check(r, "randPixels.png", SkISize::Make(8, 8), true, false, false);
check(r, "yellow_rose.png", SkISize::Make(400, 301), true, false, false);
+#endif
// RAW
#if defined(SK_CODEC_DECODES_RAW)
@@ -563,17 +577,20 @@ static void test_dimensions(skiatest::Reporter* r, const char path[]) {
// Ensure that onGetScaledDimensions returns valid image dimensions to use for decodes
DEF_TEST(Codec_Dimensions, r) {
// JPG
+#if defined(SK_CODEC_DECODES_JPEG)
test_dimensions(r, "CMYK.jpg");
test_dimensions(r, "color_wheel.jpg");
test_dimensions(r, "grayscale.jpg");
test_dimensions(r, "mandrill_512_q075.jpg");
test_dimensions(r, "randPixels.jpg");
+#endif
// Decoding small images with very large scaling factors is a potential
// source of bugs and crashes. We disable these tests in Gold because
// tiny images are not very useful to look at.
// Here we make sure that we do not crash or access illegal memory when
// performing scaled decodes on small images.
+#if defined(SK_CODEC_DECODES_PNG)
test_dimensions(r, "1x1.png");
test_dimensions(r, "2x2.png");
test_dimensions(r, "3x3.png");
@@ -582,6 +599,7 @@ DEF_TEST(Codec_Dimensions, r) {
test_dimensions(r, "16x1.png");
test_dimensions(r, "1x16.png");
test_dimensions(r, "mandrill_16.png");
+#endif
// RAW
#if defined(SK_CODEC_DECODES_RAW)
@@ -646,8 +664,12 @@ static void test_invalid_parameters(skiatest::Reporter* r, const char path[]) {
}
DEF_TEST(Codec_Params, r) {
+#if defined(SK_CODEC_DECODES_PNG)
test_invalid_parameters(r, "index8.png");
+#endif
+#if defined(SK_CODEC_DECODES_WBMP)
test_invalid_parameters(r, "mandrill.wbmp");
+#endif
}
static void codex_test_write_fn(png_structp png_ptr, png_bytep data, png_size_t len) {
@@ -657,7 +679,7 @@ static void codex_test_write_fn(png_structp png_ptr, png_bytep data, png_size_t
}
}
-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+#if defined(SK_CODEC_DECODES_PNG) && defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
DEF_TEST(Codec_pngChunkReader, r) {
// Create a dummy bitmap. Use unpremul RGBA for libpng.
SkBitmap bm;
@@ -804,7 +826,7 @@ DEF_TEST(Codec_pngChunkReader, r) {
REPORTER_ASSERT(r, SkCodec::kSuccess == result);
REPORTER_ASSERT(r, chunkReader.allHaveBeenSeen());
}
-#endif // PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
+#endif // SK_CODEC_DECODES_PNG && PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
// Stream that can only peek up to a limit
class LimitedPeekingMemStream : public SkStream {
@@ -878,6 +900,7 @@ DEF_TEST(Codec_raw_notseekable, r) {
}
#endif
+#if defined(SK_CODEC_DECODES_WEBP)
// Test that even if webp_parse_header fails to peek enough, it will fall back to read()
// + rewind() and succeed.
DEF_TEST(Codec_webp_peek, r) {
@@ -901,7 +924,9 @@ DEF_TEST(Codec_webp_peek, r) {
test_info(r, codec.get(), codec->getInfo(), SkCodec::kSuccess, nullptr);
}
+#endif
+#if defined(SK_CODEC_DECODES_WBMP)
// SkCodec's wbmp decoder was initially more restrictive than SkImageDecoder.
// It required the second byte to be zero. But SkImageDecoder allowed a couple
// of bits to be 1 (so long as they do not overlap with 0x9F). Test that
@@ -960,3 +985,4 @@ DEF_TEST(Codec_wbmp_max_size, r) {
REPORTER_ASSERT(r, !codec);
}
+#endif
« public.bzl ('K') | « src/codec/SkCodec.cpp ('k') | tests/YUVTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698