diff options
author | Hal Canary <halcanary@google.com> | 2017-12-08 10:21:31 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-08 17:16:00 +0000 |
commit | c465d13e6fca5e171bde45d35b2dd43117f4702e (patch) | |
tree | 588b2b31ffba95ed8eecb5327cb4335f35c8c1bd /tests | |
parent | 4bcef3c40ad8d3a16bbca4ab74fa15256fb4b125 (diff) |
resources: orgainize directory.
Should make it easier to ask just for images.
Change-Id: If821743dc924c4bfbc6b2b2d29b14affde7b3afd
Reviewed-on: https://skia-review.googlesource.com/82684
Commit-Queue: Hal Canary <halcanary@google.com>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CodecAnimTest.cpp | 40 | ||||
-rw-r--r-- | tests/CodecExactReadTest.cpp | 14 | ||||
-rw-r--r-- | tests/CodecPartialTest.cpp | 52 | ||||
-rw-r--r-- | tests/CodecTest.cpp | 140 | ||||
-rw-r--r-- | tests/ColorSpaceTest.cpp | 12 | ||||
-rw-r--r-- | tests/EncodeTest.cpp | 8 | ||||
-rw-r--r-- | tests/ExifTest.cpp | 4 | ||||
-rw-r--r-- | tests/GifTest.cpp | 6 | ||||
-rw-r--r-- | tests/ImageIsOpaqueTest.cpp | 4 | ||||
-rw-r--r-- | tests/ImageTest.cpp | 10 | ||||
-rw-r--r-- | tests/PDFDocumentTest.cpp | 2 | ||||
-rw-r--r-- | tests/PDFJpegEmbedTest.cpp | 14 | ||||
-rw-r--r-- | tests/PipeTest.cpp | 4 | ||||
-rw-r--r-- | tests/SerialProcsTest.cpp | 2 | ||||
-rw-r--r-- | tests/StreamTest.cpp | 2 | ||||
-rw-r--r-- | tests/YUVTest.cpp | 22 | ||||
-rw-r--r-- | tests/skbug6389.cpp | 2 |
17 files changed, 169 insertions, 169 deletions
diff --git a/tests/CodecAnimTest.cpp b/tests/CodecAnimTest.cpp index b274ee538a..b09c9251d1 100644 --- a/tests/CodecAnimTest.cpp +++ b/tests/CodecAnimTest.cpp @@ -33,7 +33,7 @@ static void write_bm(const char* name, const SkBitmap& bm) { } DEF_TEST(Codec_trunc, r) { - sk_sp<SkData> data(GetResourceAsData("box.gif")); + sk_sp<SkData> data(GetResourceAsData("images/box.gif")); if (!data) { return; } @@ -44,7 +44,7 @@ DEF_TEST(Codec_trunc, r) { // animated image with a frame that has alpha but then blends onto an opaque // frame making the result opaque. Test that we can decode such a frame. DEF_TEST(Codec_565, r) { - sk_sp<SkData> data(GetResourceAsData("blendBG.webp")); + sk_sp<SkData> data(GetResourceAsData("images/blendBG.webp")); if (!data) { return; } @@ -86,13 +86,13 @@ DEF_TEST(Codec_frames, r) { int fRepetitionCount; std::vector<SkCodecAnimation::DisposalMethod> fDisposalMethods; } gRecs[] = { - { "required.gif", 7, + { "images/required.gif", 7, { 0, 1, 2, 3, 4, 5 }, { kOpaque, kUnpremul, kUnpremul, kUnpremul, kUnpremul, kUnpremul }, { 100, 100, 100, 100, 100, 100, 100 }, 0, { kKeep, kRestoreBG, kKeep, kKeep, kKeep, kRestoreBG, kKeep } }, - { "alphabetAnim.gif", 13, + { "images/alphabetAnim.gif", 13, { SkCodec::kNone, 0, 0, 0, 0, 5, 6, SkCodec::kNone, SkCodec::kNone, 9, 10, 11 }, { kUnpremul, kUnpremul, kUnpremul, kUnpremul, kUnpremul, kUnpremul, @@ -102,7 +102,7 @@ DEF_TEST(Codec_frames, r) { { kKeep, kRestorePrev, kRestorePrev, kRestorePrev, kRestorePrev, kRestoreBG, kKeep, kRestoreBG, kRestoreBG, kKeep, kKeep, kRestoreBG, kKeep } }, - { "randPixelsAnim2.gif", 4, + { "images/randPixelsAnim2.gif", 4, // required frames { 0, 0, 1 }, // alphas @@ -112,7 +112,7 @@ DEF_TEST(Codec_frames, r) { // repetition count 0, { kKeep, kKeep, kRestorePrev, kKeep } }, - { "randPixelsAnim.gif", 13, + { "images/randPixelsAnim.gif", 13, // required frames { 0, 1, 2, 3, 4, 3, 6, 7, 7, 7, 9, 9 }, { kUnpremul, kUnpremul, kUnpremul, kUnpremul, kUnpremul, kUnpremul, @@ -124,34 +124,34 @@ DEF_TEST(Codec_frames, r) { { kKeep, kKeep, kKeep, kKeep, kRestoreBG, kRestoreBG, kRestoreBG, kRestoreBG, kRestorePrev, kRestoreBG, kRestorePrev, kRestorePrev, kRestorePrev, } }, - { "box.gif", 1, {}, {}, {}, 0, { kKeep } }, - { "color_wheel.gif", 1, {}, {}, {}, 0, { kKeep } }, - { "test640x479.gif", 4, { 0, 1, 2 }, + { "images/box.gif", 1, {}, {}, {}, 0, { kKeep } }, + { "images/color_wheel.gif", 1, {}, {}, {}, 0, { kKeep } }, + { "images/test640x479.gif", 4, { 0, 1, 2 }, { kOpaque, kOpaque, kOpaque }, { 200, 200, 200, 200 }, SkCodec::kRepetitionCountInfinite, { kKeep, kKeep, kKeep, kKeep } }, - { "colorTables.gif", 2, { 0 }, { kOpaque }, { 1000, 1000 }, 5, + { "images/colorTables.gif", 2, { 0 }, { kOpaque }, { 1000, 1000 }, 5, { kKeep, kKeep } }, - { "arrow.png", 1, {}, {}, {}, 0, {} }, - { "google_chrome.ico", 1, {}, {}, {}, 0, {} }, - { "brickwork-texture.jpg", 1, {}, {}, {}, 0, {} }, + { "images/arrow.png", 1, {}, {}, {}, 0, {} }, + { "images/google_chrome.ico", 1, {}, {}, {}, 0, {} }, + { "images/brickwork-texture.jpg", 1, {}, {}, {}, 0, {} }, #if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32)) - { "dng_with_preview.dng", 1, {}, {}, {}, 0, {} }, + { "images/dng_with_preview.dng", 1, {}, {}, {}, 0, {} }, #endif - { "mandrill.wbmp", 1, {}, {}, {}, 0, {} }, - { "randPixels.bmp", 1, {}, {}, {}, 0, {} }, - { "yellow_rose.webp", 1, {}, {}, {}, 0, {} }, - { "webp-animated.webp", 3, { 0, 1 }, { kOpaque, kOpaque }, + { "images/mandrill.wbmp", 1, {}, {}, {}, 0, {} }, + { "images/randPixels.bmp", 1, {}, {}, {}, 0, {} }, + { "images/yellow_rose.webp", 1, {}, {}, {}, 0, {} }, + { "images/webp-animated.webp", 3, { 0, 1 }, { kOpaque, kOpaque }, { 1000, 500, 1000 }, SkCodec::kRepetitionCountInfinite, { kKeep, kKeep, kKeep } }, - { "blendBG.webp", 7, { 0, SkCodec::kNone, SkCodec::kNone, SkCodec::kNone, + { "images/blendBG.webp", 7, { 0, SkCodec::kNone, SkCodec::kNone, SkCodec::kNone, 4, 4 }, { kOpaque, kOpaque, kUnpremul, kOpaque, kUnpremul, kUnpremul }, { 525, 500, 525, 437, 609, 729, 444 }, 7, { kKeep, kKeep, kKeep, kKeep, kKeep, kKeep, kKeep } }, - { "required.webp", 7, + { "images/required.webp", 7, { 0, 1, 1, SkCodec::kNone, 4, 4 }, { kOpaque, kUnpremul, kUnpremul, kOpaque, kOpaque, kOpaque }, { 100, 100, 100, 100, 100, 100, 100 }, diff --git a/tests/CodecExactReadTest.cpp b/tests/CodecExactReadTest.cpp index d00c0bcf97..6189bdfd53 100644 --- a/tests/CodecExactReadTest.cpp +++ b/tests/CodecExactReadTest.cpp @@ -44,13 +44,13 @@ private: // end of the data. Some other SkCodecs do, but some Android apps rely on not // doing so for PNGs. Test on other formats that work. DEF_TEST(Codec_end, r) { - for (const char* path : { "plane.png", - "yellow_rose.png", - "plane_interlaced.png", - "google_chrome.ico", - "color_wheel.ico", - "mandrill.wbmp", - "randPixels.bmp", + for (const char* path : { "images/plane.png", + "images/yellow_rose.png", + "images/plane_interlaced.png", + "images/google_chrome.ico", + "images/color_wheel.ico", + "images/mandrill.wbmp", + "images/randPixels.bmp", }) { sk_sp<SkData> data = GetResourceAsData(path); if (!data) { diff --git a/tests/CodecPartialTest.cpp b/tests/CodecPartialTest.cpp index 35249ac7d2..561dddd875 100644 --- a/tests/CodecPartialTest.cpp +++ b/tests/CodecPartialTest.cpp @@ -125,26 +125,26 @@ DEF_TEST(Codec_partial, r) { #if 0 // FIXME (scroggo): SkPngCodec needs to use SkStreamBuffer in order to // support incremental decoding. - test_partial(r, "plane.png"); - test_partial(r, "plane_interlaced.png"); - test_partial(r, "yellow_rose.png"); - test_partial(r, "index8.png"); - test_partial(r, "color_wheel.png"); - test_partial(r, "mandrill_256.png"); - test_partial(r, "mandrill_32.png"); - test_partial(r, "arrow.png"); - test_partial(r, "randPixels.png"); - test_partial(r, "baby_tux.png"); + test_partial(r, "images/plane.png"); + test_partial(r, "images/plane_interlaced.png"); + test_partial(r, "images/yellow_rose.png"); + test_partial(r, "images/index8.png"); + test_partial(r, "images/color_wheel.png"); + test_partial(r, "images/mandrill_256.png"); + test_partial(r, "images/mandrill_32.png"); + test_partial(r, "images/arrow.png"); + test_partial(r, "images/randPixels.png"); + test_partial(r, "images/baby_tux.png"); #endif - test_partial(r, "box.gif"); - test_partial(r, "randPixels.gif", 215); - test_partial(r, "color_wheel.gif"); + test_partial(r, "images/box.gif"); + test_partial(r, "images/randPixels.gif", 215); + test_partial(r, "images/color_wheel.gif"); } // Verify that when decoding an animated gif byte by byte we report the correct // fRequiredFrame as soon as getFrameInfo reports the frame. DEF_TEST(Codec_requiredFrame, r) { - auto path = "colorTables.gif"; + auto path = "images/colorTables.gif"; sk_sp<SkData> file = GetResourceAsData(path); if (!file) { return; @@ -189,7 +189,7 @@ DEF_TEST(Codec_requiredFrame, r) { } DEF_TEST(Codec_partialAnim, r) { - auto path = "test640x479.gif"; + auto path = "images/test640x479.gif"; sk_sp<SkData> file = GetResourceAsData(path); if (!file) { return; @@ -323,9 +323,9 @@ static void test_interleaved(skiatest::Reporter* r, const char* name) { } DEF_TEST(Codec_rewind, r) { - test_interleaved(r, "plane.png"); - test_interleaved(r, "plane_interlaced.png"); - test_interleaved(r, "box.gif"); + test_interleaved(r, "images/plane.png"); + test_interleaved(r, "images/plane_interlaced.png"); + test_interleaved(r, "images/box.gif"); } // Modified version of the giflib logo, from @@ -401,7 +401,7 @@ DEF_TEST(Codec_GifPreMap, r) { } DEF_TEST(Codec_emptyIDAT, r) { - const char* name = "baby_tux.png"; + const char* name = "images/baby_tux.png"; sk_sp<SkData> file = GetResourceAsData(name); if (!file) { return; @@ -425,13 +425,13 @@ DEF_TEST(Codec_emptyIDAT, r) { } DEF_TEST(Codec_incomplete, r) { - for (const char* name : { "baby_tux.png", - "baby_tux.webp", - "CMYK.jpg", - "color_wheel.gif", - "google_chrome.ico", - "rle.bmp", - "mandrill.wbmp", + for (const char* name : { "images/baby_tux.png", + "images/baby_tux.webp", + "images/CMYK.jpg", + "images/color_wheel.gif", + "images/google_chrome.ico", + "images/rle.bmp", + "images/mandrill.wbmp", }) { sk_sp<SkData> file = GetResourceAsData(name); if (!name) { diff --git a/tests/CodecTest.cpp b/tests/CodecTest.cpp index 91b07ef49e..ab21e4a2c1 100644 --- a/tests/CodecTest.cpp +++ b/tests/CodecTest.cpp @@ -457,70 +457,70 @@ static void check(skiatest::Reporter* r, } DEF_TEST(Codec_wbmp, r) { - check(r, "mandrill.wbmp", SkISize::Make(512, 512), true, false, true); + check(r, "images/mandrill.wbmp", SkISize::Make(512, 512), true, false, true); } DEF_TEST(Codec_webp, r) { - check(r, "baby_tux.webp", SkISize::Make(386, 395), false, true, true); - check(r, "color_wheel.webp", SkISize::Make(128, 128), false, true, true); - check(r, "yellow_rose.webp", SkISize::Make(400, 301), false, true, true); + check(r, "images/baby_tux.webp", SkISize::Make(386, 395), false, true, true); + check(r, "images/color_wheel.webp", SkISize::Make(128, 128), false, true, true); + check(r, "images/yellow_rose.webp", SkISize::Make(400, 301), false, true, true); } DEF_TEST(Codec_bmp, r) { - check(r, "randPixels.bmp", SkISize::Make(8, 8), true, false, true); - check(r, "rle.bmp", SkISize::Make(320, 240), true, false, true); + check(r, "images/randPixels.bmp", SkISize::Make(8, 8), true, false, true); + check(r, "images/rle.bmp", SkISize::Make(320, 240), true, false, true); } DEF_TEST(Codec_ico, r) { // 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); + check(r, "images/color_wheel.ico", SkISize::Make(128, 128), true, false, false); // Decodes an embedded PNG image - check(r, "google_chrome.ico", SkISize::Make(256, 256), false, false, false, true); + check(r, "images/google_chrome.ico", SkISize::Make(256, 256), false, false, false, true); } DEF_TEST(Codec_gif, r) { - check(r, "box.gif", SkISize::Make(200, 55), false, false, true, true); - check(r, "color_wheel.gif", SkISize::Make(128, 128), false, false, true, true); + check(r, "images/box.gif", SkISize::Make(200, 55), false, false, true, true); + check(r, "images/color_wheel.gif", SkISize::Make(128, 128), false, false, true, true); // randPixels.gif is too small to test incomplete - check(r, "randPixels.gif", SkISize::Make(8, 8), false, false, false, true); + check(r, "images/randPixels.gif", SkISize::Make(8, 8), false, false, false, true); } DEF_TEST(Codec_jpg, r) { - check(r, "CMYK.jpg", SkISize::Make(642, 516), true, false, true); - check(r, "color_wheel.jpg", SkISize::Make(128, 128), true, false, true); + check(r, "images/CMYK.jpg", SkISize::Make(642, 516), true, false, true); + check(r, "images/color_wheel.jpg", SkISize::Make(128, 128), true, false, true); // grayscale.jpg is too small to test incomplete - check(r, "grayscale.jpg", SkISize::Make(128, 128), true, false, false); - check(r, "mandrill_512_q075.jpg", SkISize::Make(512, 512), true, false, true); + check(r, "images/grayscale.jpg", SkISize::Make(128, 128), true, false, false); + check(r, "images/mandrill_512_q075.jpg", SkISize::Make(512, 512), true, false, true); // randPixels.jpg is too small to test incomplete - check(r, "randPixels.jpg", SkISize::Make(8, 8), true, false, false); + check(r, "images/randPixels.jpg", SkISize::Make(8, 8), true, false, false); } DEF_TEST(Codec_png, r) { - check(r, "arrow.png", SkISize::Make(187, 312), false, false, true, true); - check(r, "baby_tux.png", SkISize::Make(240, 246), false, false, true, true); - check(r, "color_wheel.png", SkISize::Make(128, 128), false, false, true, true); + check(r, "images/arrow.png", SkISize::Make(187, 312), false, false, true, true); + check(r, "images/baby_tux.png", SkISize::Make(240, 246), false, false, true, true); + check(r, "images/color_wheel.png", SkISize::Make(128, 128), false, false, true, true); // half-transparent-white-pixel.png is too small to test incomplete - check(r, "half-transparent-white-pixel.png", SkISize::Make(1, 1), false, false, false, true); - check(r, "mandrill_128.png", SkISize::Make(128, 128), false, false, true, true); - check(r, "mandrill_16.png", SkISize::Make(16, 16), false, false, true, true); - check(r, "mandrill_256.png", SkISize::Make(256, 256), false, false, true, true); - check(r, "mandrill_32.png", SkISize::Make(32, 32), false, false, true, true); - check(r, "mandrill_512.png", SkISize::Make(512, 512), false, false, true, true); - check(r, "mandrill_64.png", SkISize::Make(64, 64), false, false, true, true); - check(r, "plane.png", SkISize::Make(250, 126), false, false, true, true); - check(r, "plane_interlaced.png", SkISize::Make(250, 126), false, false, true, true); - check(r, "randPixels.png", SkISize::Make(8, 8), false, false, true, true); - check(r, "yellow_rose.png", SkISize::Make(400, 301), false, false, true, true); + check(r, "images/half-transparent-white-pixel.png", SkISize::Make(1, 1), false, false, false, true); + check(r, "images/mandrill_128.png", SkISize::Make(128, 128), false, false, true, true); + check(r, "images/mandrill_16.png", SkISize::Make(16, 16), false, false, true, true); + check(r, "images/mandrill_256.png", SkISize::Make(256, 256), false, false, true, true); + check(r, "images/mandrill_32.png", SkISize::Make(32, 32), false, false, true, true); + check(r, "images/mandrill_512.png", SkISize::Make(512, 512), false, false, true, true); + check(r, "images/mandrill_64.png", SkISize::Make(64, 64), false, false, true, true); + check(r, "images/plane.png", SkISize::Make(250, 126), false, false, true, true); + check(r, "images/plane_interlaced.png", SkISize::Make(250, 126), false, false, true, true); + check(r, "images/randPixels.png", SkISize::Make(8, 8), false, false, true, true); + check(r, "images/yellow_rose.png", SkISize::Make(400, 301), false, false, true, true); } // Disable RAW tests for Win32. #if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32)) DEF_TEST(Codec_raw, r) { - check(r, "sample_1mp.dng", SkISize::Make(600, 338), false, false, false); - check(r, "sample_1mp_rotated.dng", SkISize::Make(600, 338), false, false, false); - check(r, "dng_with_preview.dng", SkISize::Make(600, 338), true, false, false); + check(r, "images/sample_1mp.dng", SkISize::Make(600, 338), false, false, false); + check(r, "images/sample_1mp_rotated.dng", SkISize::Make(600, 338), false, false, false); + check(r, "images/dng_with_preview.dng", SkISize::Make(600, 338), true, false, false); } #endif @@ -598,32 +598,32 @@ 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 - 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"); + test_dimensions(r, "images/CMYK.jpg"); + test_dimensions(r, "images/color_wheel.jpg"); + test_dimensions(r, "images/grayscale.jpg"); + test_dimensions(r, "images/mandrill_512_q075.jpg"); + test_dimensions(r, "images/randPixels.jpg"); // 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. - test_dimensions(r, "1x1.png"); - test_dimensions(r, "2x2.png"); - test_dimensions(r, "3x3.png"); - test_dimensions(r, "3x1.png"); - test_dimensions(r, "1x1.png"); - test_dimensions(r, "16x1.png"); - test_dimensions(r, "1x16.png"); - test_dimensions(r, "mandrill_16.png"); + test_dimensions(r, "images/1x1.png"); + test_dimensions(r, "images/2x2.png"); + test_dimensions(r, "images/3x3.png"); + test_dimensions(r, "images/3x1.png"); + test_dimensions(r, "images/1x1.png"); + test_dimensions(r, "images/16x1.png"); + test_dimensions(r, "images/1x16.png"); + test_dimensions(r, "images/mandrill_16.png"); // RAW // Disable RAW tests for Win32. #if defined(SK_CODEC_DECODES_RAW) && (!defined(_WIN32)) - test_dimensions(r, "sample_1mp.dng"); - test_dimensions(r, "sample_1mp_rotated.dng"); - test_dimensions(r, "dng_with_preview.dng"); + test_dimensions(r, "images/sample_1mp.dng"); + test_dimensions(r, "images/sample_1mp_rotated.dng"); + test_dimensions(r, "images/dng_with_preview.dng"); #endif } @@ -846,7 +846,7 @@ private: // Test that the RawCodec works also for not asset stream. This will test the code path using // SkRawBufferedStream instead of SkRawAssetStream. DEF_TEST(Codec_raw_notseekable, r) { - const char* path = "dng_with_preview.dng"; + const char* path = "images/dng_with_preview.dng"; SkString fullPath(GetResourcePath(path)); sk_sp<SkData> data(SkData::MakeFromFileName(fullPath.c_str())); if (!data) { @@ -865,7 +865,7 @@ DEF_TEST(Codec_raw_notseekable, r) { // 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) { - const char* path = "baby_tux.webp"; + const char* path = "images/baby_tux.webp"; SkString fullPath(GetResourcePath(path)); auto data = SkData::MakeFromFileName(fullPath.c_str()); if (!data) { @@ -892,7 +892,7 @@ DEF_TEST(Codec_webp_peek, r) { // a couple of bits to be 1 (so long as they do not overlap with 0x9F). // Test that SkCodec now supports an image with these bits set. DEF_TEST(Codec_wbmp_restrictive, r) { - const char* path = "mandrill.wbmp"; + const char* path = "images/mandrill.wbmp"; std::unique_ptr<SkStream> stream(GetResourceAsStream(path)); if (!stream) { return; @@ -942,7 +942,7 @@ DEF_TEST(Codec_wbmp_max_size, r) { } DEF_TEST(Codec_jpeg_rewind, r) { - const char* path = "mandrill_512_q075.jpg"; + const char* path = "images/mandrill_512_q075.jpg"; sk_sp<SkData> data(GetResourceAsData(path)); if (!data) { return; @@ -1017,8 +1017,8 @@ static void check_color_xform(skiatest::Reporter* r, const char* path) { } DEF_TEST(Codec_ColorXform, r) { - check_color_xform(r, "mandrill_512_q075.jpg"); - check_color_xform(r, "mandrill_512.png"); + check_color_xform(r, "images/mandrill_512_q075.jpg"); + check_color_xform(r, "images/mandrill_512.png"); } static bool color_type_match(SkColorType origColorType, SkColorType codecColorType) { @@ -1069,7 +1069,7 @@ static void check_round_trip(skiatest::Reporter* r, SkCodec* origCodec, const Sk } DEF_TEST(Codec_PngRoundTrip, r) { - auto codec = SkCodec::MakeFromStream(GetResourceAsStream("mandrill_512_q075.jpg")); + auto codec = SkCodec::MakeFromStream(GetResourceAsStream("images/mandrill_512_q075.jpg")); SkColorType colorTypesOpaque[] = { kRGB_565_SkColorType, kRGBA_8888_SkColorType, kBGRA_8888_SkColorType @@ -1079,10 +1079,10 @@ DEF_TEST(Codec_PngRoundTrip, r) { check_round_trip(r, codec.get(), newInfo); } - codec = SkCodec::MakeFromStream(GetResourceAsStream("grayscale.jpg")); + codec = SkCodec::MakeFromStream(GetResourceAsStream("images/grayscale.jpg")); check_round_trip(r, codec.get(), codec->getInfo()); - codec = SkCodec::MakeFromStream(GetResourceAsStream("yellow_rose.png")); + codec = SkCodec::MakeFromStream(GetResourceAsStream("images/yellow_rose.png")); SkColorType colorTypesWithAlpha[] = { kRGBA_8888_SkColorType, kBGRA_8888_SkColorType @@ -1100,7 +1100,7 @@ DEF_TEST(Codec_PngRoundTrip, r) { } } - codec = SkCodec::MakeFromStream(GetResourceAsStream("index8.png")); + codec = SkCodec::MakeFromStream(GetResourceAsStream("images/index8.png")); for (SkAlphaType alphaType : alphaTypes) { SkImageInfo newInfo = codec->getInfo().makeAlphaType(alphaType) @@ -1167,9 +1167,9 @@ static void test_conversion_possible(skiatest::Reporter* r, const char* path, } DEF_TEST(Codec_F16ConversionPossible, r) { - test_conversion_possible(r, "color_wheel.webp", false, false); - test_conversion_possible(r, "mandrill_512_q075.jpg", true, false); - test_conversion_possible(r, "yellow_rose.png", false, true); + test_conversion_possible(r, "images/color_wheel.webp", false, false); + test_conversion_possible(r, "images/mandrill_512_q075.jpg", true, false); + test_conversion_possible(r, "images/yellow_rose.png", false, true); } static void decode_frame(skiatest::Reporter* r, SkCodec* codec, size_t frame) { @@ -1186,7 +1186,7 @@ static void decode_frame(skiatest::Reporter* r, SkCodec* codec, size_t frame) { // For an animated GIF, we should only read enough to decode frame 0 if the // client never calls getFrameInfo and only decodes frame 0. DEF_TEST(Codec_skipFullParse, r) { - auto path = "test640x479.gif"; + auto path = "images/test640x479.gif"; auto streamObj = GetResourceAsStream(path); if (!streamObj) { return; @@ -1269,10 +1269,10 @@ DEF_TEST(Codec_fallBack, r) { // Formats that currently do not support incremental decoding auto files = { - "CMYK.jpg", - "color_wheel.ico", - "mandrill.wbmp", - "randPixels.bmp", + "images/CMYK.jpg", + "images/color_wheel.ico", + "images/mandrill.wbmp", + "images/randPixels.bmp", }; for (auto file : files) { auto stream = LimitedRewindingStream::Make(file, SkCodec::MinBufferedBytesNeeded()); @@ -1308,7 +1308,7 @@ DEF_TEST(Codec_fallBack, r) { // This test verifies that we fixed an assert statement that fired when reusing a png codec // after scaling. DEF_TEST(Codec_reusePng, r) { - std::unique_ptr<SkStream> stream(GetResourceAsStream("plane.png")); + std::unique_ptr<SkStream> stream(GetResourceAsStream("images/plane.png")); if (!stream) { return; } @@ -1336,7 +1336,7 @@ DEF_TEST(Codec_reusePng, r) { } DEF_TEST(Codec_rowsDecoded, r) { - auto file = "plane_interlaced.png"; + auto file = "images/plane_interlaced.png"; std::unique_ptr<SkStream> stream(GetResourceAsStream(file)); if (!stream) { return; @@ -1511,7 +1511,7 @@ DEF_TEST(Codec_EncodeICC, r) { } DEF_TEST(Codec_webp_rowsDecoded, r) { - const char* path = "baby_tux.webp"; + const char* path = "images/baby_tux.webp"; sk_sp<SkData> data(GetResourceAsData(path)); if (!data) { return; diff --git a/tests/ColorSpaceTest.cpp b/tests/ColorSpaceTest.cpp index efbfe8a29c..19e1044162 100644 --- a/tests/ColorSpaceTest.cpp +++ b/tests/ColorSpaceTest.cpp @@ -82,22 +82,22 @@ DEF_TEST(ColorSpace_sRGB, r) { DEF_TEST(ColorSpaceParseICCProfiles, r) { #if (PNG_LIBPNG_VER_MAJOR > 1) || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 6) - test_path(r, "color_wheel_with_profile.png", g_sRGB_R, g_sRGB_G, g_sRGB_B, + test_path(r, "images/color_wheel_with_profile.png", g_sRGB_R, g_sRGB_G, g_sRGB_B, kSRGB_SkGammaNamed); #endif const float red[] = { 0.385117f, 0.716904f, 0.0970612f }; const float green[] = { 0.143051f, 0.0606079f, 0.713913f }; const float blue[] = { 0.436035f, 0.222488f, 0.013916f }; - test_path(r, "icc-v2-gbr.jpg", red, green, blue, k2Dot2Curve_SkGammaNamed); + test_path(r, "images/icc-v2-gbr.jpg", red, green, blue, k2Dot2Curve_SkGammaNamed); - test_path(r, "webp-color-profile-crash.webp", + test_path(r, "images/webp-color-profile-crash.webp", red, green, blue, kNonStandard_SkGammaNamed); - test_path(r, "webp-color-profile-lossless.webp", + test_path(r, "images/webp-color-profile-lossless.webp", red, green, blue, kNonStandard_SkGammaNamed); - test_path(r, "webp-color-profile-lossy.webp", + test_path(r, "images/webp-color-profile-lossy.webp", red, green, blue, kNonStandard_SkGammaNamed); - test_path(r, "webp-color-profile-lossy-alpha.webp", + test_path(r, "images/webp-color-profile-lossy-alpha.webp", red, green, blue, kNonStandard_SkGammaNamed); } diff --git a/tests/EncodeTest.cpp b/tests/EncodeTest.cpp index 6638c1e72b..40e99565cb 100644 --- a/tests/EncodeTest.cpp +++ b/tests/EncodeTest.cpp @@ -47,7 +47,7 @@ static std::unique_ptr<SkEncoder> make(SkEncodedImageFormat format, SkWStream* d static void test_encode(skiatest::Reporter* r, SkEncodedImageFormat format) { SkBitmap bitmap; - bool success = GetResourceAsBitmap("mandrill_128.png", &bitmap); + bool success = GetResourceAsBitmap("images/mandrill_128.png", &bitmap); if (!success) { return; } @@ -132,7 +132,7 @@ static inline bool almost_equals(const SkBitmap& a, const SkBitmap& b, int toler DEF_TEST(Encode_JpegDownsample, r) { SkBitmap bitmap; - bool success = GetResourceAsBitmap("mandrill_128.png", &bitmap); + bool success = GetResourceAsBitmap("images/mandrill_128.png", &bitmap); if (!success) { return; } @@ -244,7 +244,7 @@ static void testPngComments(const SkPixmap& src, SkPngEncoder::Options& options, DEF_TEST(Encode_PngOptions, r) { SkBitmap bitmap; - bool success = GetResourceAsBitmap("mandrill_128.png", &bitmap); + bool success = GetResourceAsBitmap("images/mandrill_128.png", &bitmap); if (!success) { return; } @@ -287,7 +287,7 @@ DEF_TEST(Encode_PngOptions, r) { DEF_TEST(Encode_WebpOptions, r) { SkBitmap bitmap; - bool success = GetResourceAsBitmap("google_chrome.ico", &bitmap); + bool success = GetResourceAsBitmap("images/google_chrome.ico", &bitmap); if (!success) { return; } diff --git a/tests/ExifTest.cpp b/tests/ExifTest.cpp index 4704d20caa..16f62bb778 100644 --- a/tests/ExifTest.cpp +++ b/tests/ExifTest.cpp @@ -10,7 +10,7 @@ #include "Test.h" DEF_TEST(ExifOrientation, r) { - std::unique_ptr<SkStream> stream(GetResourceAsStream("exif-orientation-2-ur.jpg")); + std::unique_ptr<SkStream> stream(GetResourceAsStream("images/exif-orientation-2-ur.jpg")); REPORTER_ASSERT(r, nullptr != stream); if (!stream) { return; @@ -21,7 +21,7 @@ DEF_TEST(ExifOrientation, r) { SkEncodedOrigin origin = codec->getOrigin(); REPORTER_ASSERT(r, kTopRight_SkEncodedOrigin == origin); - codec = SkCodec::MakeFromStream(GetResourceAsStream("mandrill_512_q075.jpg")); + codec = SkCodec::MakeFromStream(GetResourceAsStream("images/mandrill_512_q075.jpg")); REPORTER_ASSERT(r, nullptr != codec); origin = codec->getOrigin(); REPORTER_ASSERT(r, kTopLeft_SkEncodedOrigin == origin); diff --git a/tests/GifTest.cpp b/tests/GifTest.cpp index 29150baeb1..5219825f1b 100644 --- a/tests/GifTest.cpp +++ b/tests/GifTest.cpp @@ -225,7 +225,7 @@ DEF_TEST(Gif, reporter) { // Regression test for decoding a gif image with sampleSize of 4, which was // previously crashing. DEF_TEST(Gif_Sampled, r) { - auto stream = SkFILEStream::Make(GetResourcePath("test640x479.gif").c_str()); + auto stream = SkFILEStream::Make(GetResourcePath("images/test640x479.gif").c_str()); REPORTER_ASSERT(r, stream); if (!stream) { return; @@ -250,7 +250,7 @@ DEF_TEST(Gif_Sampled, r) { // If a GIF file is truncated before the header for the first image is defined, // we should not create an SkCodec. DEF_TEST(Codec_GifTruncated, r) { - sk_sp<SkData> data(GetResourceAsData("test640x479.gif")); + sk_sp<SkData> data(GetResourceAsData("images/test640x479.gif")); if (!data) { return; } @@ -262,7 +262,7 @@ DEF_TEST(Codec_GifTruncated, r) { } DEF_TEST(Codec_GifTruncated2, r) { - sk_sp<SkData> data(GetResourceAsData("box.gif")); + sk_sp<SkData> data(GetResourceAsData("images/box.gif")); if (!data) { return; } diff --git a/tests/ImageIsOpaqueTest.cpp b/tests/ImageIsOpaqueTest.cpp index bf3dea6334..9b4837a76f 100644 --- a/tests/ImageIsOpaqueTest.cpp +++ b/tests/ImageIsOpaqueTest.cpp @@ -124,8 +124,8 @@ DEF_TEST(Image_isAlphaOnly, reporter) { }; for (auto& image : { SkImage::MakeRasterCopy(pmap), - GetResourceAsImage("mandrill_128.png"), - GetResourceAsImage("color_wheel.jpg"), + GetResourceAsImage("images/mandrill_128.png"), + GetResourceAsImage("images/color_wheel.jpg"), SkImage::MakeFromPicture(make_picture(), { 10, 10 }, nullptr, nullptr, SkImage::BitDepth::kU8, SkColorSpace::MakeSRGB()), diff --git a/tests/ImageTest.cpp b/tests/ImageTest.cpp index d9140cf0f9..1ba3f1d0b4 100644 --- a/tests/ImageTest.cpp +++ b/tests/ImageTest.cpp @@ -957,7 +957,7 @@ static void test_cross_context_image(skiatest::Reporter* reporter, const GrConte } DEF_GPUTEST(SkImage_MakeCrossContextFromEncodedRelease, reporter, options) { - sk_sp<SkData> data = GetResourceAsData("mandrill_128.png"); + sk_sp<SkData> data = GetResourceAsData("images/mandrill_128.png"); SkASSERT(data.get()); test_cross_context_image(reporter, options, [&data](GrContext* ctx) { @@ -968,7 +968,7 @@ DEF_GPUTEST(SkImage_MakeCrossContextFromEncodedRelease, reporter, options) { DEF_GPUTEST(SkImage_MakeCrossContextFromPixmapRelease, reporter, options) { SkBitmap bitmap; SkPixmap pixmap; - SkAssertResult(GetResourceAsBitmap("mandrill_128.png", &bitmap) && bitmap.peekPixels(&pixmap)); + SkAssertResult(GetResourceAsBitmap("images/mandrill_128.png", &bitmap) && bitmap.peekPixels(&pixmap)); test_cross_context_image(reporter, options, [&pixmap](GrContext* ctx) { return SkImage::MakeCrossContextFromPixmap(ctx, pixmap, false, nullptr); @@ -1079,10 +1079,10 @@ static inline bool almost_equal(int a, int b) { DEF_TEST(Image_ColorSpace, r) { sk_sp<SkColorSpace> srgb = SkColorSpace::MakeSRGB(); - sk_sp<SkImage> image = GetResourceAsImage("mandrill_512_q075.jpg"); + sk_sp<SkImage> image = GetResourceAsImage("images/mandrill_512_q075.jpg"); REPORTER_ASSERT(r, srgb.get() == image->colorSpace()); - image = GetResourceAsImage("webp-color-profile-lossy.webp"); + image = GetResourceAsImage("images/webp-color-profile-lossy.webp"); SkColorSpaceTransferFn fn; bool success = image->colorSpace()->isNumericalTransferFn(&fn); REPORTER_ASSERT(r, success); @@ -1138,7 +1138,7 @@ DEF_TEST(Image_makeColorSpace, r) { REPORTER_ASSERT(r, almost_equal(0x31, SkGetPackedG32(*adobeBitmap.getAddr32(0, 0)))); REPORTER_ASSERT(r, almost_equal(0x4C, SkGetPackedB32(*adobeBitmap.getAddr32(0, 0)))); - srgbImage = GetResourceAsImage("1x1.png"); + srgbImage = GetResourceAsImage("images/1x1.png"); p3Image = srgbImage->makeColorSpace(p3, SkTransferFunctionBehavior::kIgnore); success = p3Image->asLegacyBitmap(&p3Bitmap, SkImage::kRO_LegacyBitmapMode); REPORTER_ASSERT(r, success); diff --git a/tests/PDFDocumentTest.cpp b/tests/PDFDocumentTest.cpp index f01d0f97f3..9a79ec8c01 100644 --- a/tests/PDFDocumentTest.cpp +++ b/tests/PDFDocumentTest.cpp @@ -146,7 +146,7 @@ size_t count_bytes(const SkBitmap& bm, bool useDCT) { DEF_TEST(SkPDF_document_dct_encoder, r) { REQUIRE_PDF_DOCUMENT(SkPDF_document_dct_encoder, r); SkBitmap bm; - if (GetResourceAsBitmap("mandrill_64.png", &bm)) { + if (GetResourceAsBitmap("images/mandrill_64.png", &bm)) { // Lossy encoding works better on photographs. REPORTER_ASSERT(r, count_bytes(bm, true) < count_bytes(bm, false)); } diff --git a/tests/PDFJpegEmbedTest.cpp b/tests/PDFJpegEmbedTest.cpp index 100c9b3f11..b62b166fc1 100644 --- a/tests/PDFJpegEmbedTest.cpp +++ b/tests/PDFJpegEmbedTest.cpp @@ -49,8 +49,8 @@ static sk_sp<SkData> load_resource( DEF_TEST(SkPDF_JpegEmbedTest, r) { REQUIRE_PDF_DOCUMENT(SkPDF_JpegEmbedTest, r); const char test[] = "SkPDF_JpegEmbedTest"; - sk_sp<SkData> mandrillData(load_resource(r, test, "mandrill_512_q075.jpg")); - sk_sp<SkData> cmykData(load_resource(r, test, "CMYK.jpg")); + sk_sp<SkData> mandrillData(load_resource(r, test, "images/mandrill_512_q075.jpg")); + sk_sp<SkData> cmykData(load_resource(r, test, "images/CMYK.jpg")); if (!mandrillData || !cmykData) { return; } @@ -88,11 +88,11 @@ DEF_TEST(SkPDF_JpegIdentification, r) { const char* path; bool isJfif; SkJFIFInfo::Type type; - } kTests[] = {{"CMYK.jpg", false, SkJFIFInfo::kGrayscale}, - {"color_wheel.jpg", true, SkJFIFInfo::kYCbCr}, - {"grayscale.jpg", true, SkJFIFInfo::kGrayscale}, - {"mandrill_512_q075.jpg", true, SkJFIFInfo::kYCbCr}, - {"randPixels.jpg", true, SkJFIFInfo::kYCbCr}}; + } kTests[] = {{"images/CMYK.jpg", false, SkJFIFInfo::kGrayscale}, + {"images/color_wheel.jpg", true, SkJFIFInfo::kYCbCr}, + {"images/grayscale.jpg", true, SkJFIFInfo::kGrayscale}, + {"images/mandrill_512_q075.jpg", true, SkJFIFInfo::kYCbCr}, + {"images/randPixels.jpg", true, SkJFIFInfo::kYCbCr}}; for (size_t i = 0; i < SK_ARRAY_COUNT(kTests); ++i) { sk_sp<SkData> data(load_resource(r, "JpegIdentification", kTests[i].path)); if (!data) { diff --git a/tests/PipeTest.cpp b/tests/PipeTest.cpp index e5d2f09a99..42b1a4c300 100644 --- a/tests/PipeTest.cpp +++ b/tests/PipeTest.cpp @@ -46,7 +46,7 @@ static bool deep_equal(SkImage* a, SkImage* b) { } DEF_TEST(Pipe_image_draw_first, reporter) { - sk_sp<SkImage> img = GetResourceAsImage("mandrill_128.png"); + sk_sp<SkImage> img = GetResourceAsImage("images/mandrill_128.png"); SkASSERT(img.get()); SkPipeSerializer serializer; @@ -84,7 +84,7 @@ DEF_TEST(Pipe_image_draw_first, reporter) { } DEF_TEST(Pipe_image_draw_second, reporter) { - sk_sp<SkImage> img = GetResourceAsImage("mandrill_128.png"); + sk_sp<SkImage> img = GetResourceAsImage("images/mandrill_128.png"); SkASSERT(img.get()); SkPipeSerializer serializer; diff --git a/tests/SerialProcsTest.cpp b/tests/SerialProcsTest.cpp index 6361309b98..d975abb5db 100644 --- a/tests/SerialProcsTest.cpp +++ b/tests/SerialProcsTest.cpp @@ -27,7 +27,7 @@ struct State { }; DEF_TEST(serial_procs_image, reporter) { - auto src_img = GetResourceAsImage("mandrill_128.png"); + auto src_img = GetResourceAsImage("images/mandrill_128.png"); const char magic_str[] = "magic signature"; const SkSerialImageProc sprocs[] = { diff --git a/tests/StreamTest.cpp b/tests/StreamTest.cpp index 26fea37f9e..5112312678 100644 --- a/tests/StreamTest.cpp +++ b/tests/StreamTest.cpp @@ -287,7 +287,7 @@ DEF_TEST(StreamPeek, reporter) { test_fully_peekable_stream(reporter, &memStream, memStream.getLength()); // Test an arbitrary file stream. file streams do not support peeking. - SkFILEStream fileStream(GetResourcePath("baby_tux.webp").c_str()); + SkFILEStream fileStream(GetResourcePath("images/baby_tux.webp").c_str()); REPORTER_ASSERT(reporter, fileStream.isValid()); if (!fileStream.isValid()) { return; diff --git a/tests/YUVTest.cpp b/tests/YUVTest.cpp index 825e2d1628..3862952742 100644 --- a/tests/YUVTest.cpp +++ b/tests/YUVTest.cpp @@ -81,46 +81,46 @@ DEF_TEST(Jpeg_YUV_Codec, r) { sizes[0].set(128, 128); sizes[1].set(64, 64); sizes[2].set(64, 64); - codec_yuv(r, "color_wheel.jpg", sizes); + codec_yuv(r, "images/color_wheel.jpg", sizes); // H2V2 sizes[0].set(512, 512); sizes[1].set(256, 256); sizes[2].set(256, 256); - codec_yuv(r, "mandrill_512_q075.jpg", sizes); + codec_yuv(r, "images/mandrill_512_q075.jpg", sizes); // H1V1 sizes[1].set(512, 512); sizes[2].set(512, 512); - codec_yuv(r, "mandrill_h1v1.jpg", sizes); + codec_yuv(r, "images/mandrill_h1v1.jpg", sizes); // H2V1 sizes[1].set(256, 512); sizes[2].set(256, 512); - codec_yuv(r, "mandrill_h2v1.jpg", sizes); + codec_yuv(r, "images/mandrill_h2v1.jpg", sizes); // Non-power of two dimensions sizes[0].set(439, 154); sizes[1].set(220, 77); sizes[2].set(220, 77); - codec_yuv(r, "cropped_mandrill.jpg", sizes); + codec_yuv(r, "images/cropped_mandrill.jpg", sizes); sizes[0].set(8, 8); sizes[1].set(4, 4); sizes[2].set(4, 4); - codec_yuv(r, "randPixels.jpg", sizes); + codec_yuv(r, "images/randPixels.jpg", sizes); // Progressive images sizes[0].set(512, 512); sizes[1].set(512, 512); sizes[2].set(512, 512); - codec_yuv(r, "brickwork-texture.jpg", sizes); - codec_yuv(r, "brickwork_normal-map.jpg", sizes); + codec_yuv(r, "images/brickwork-texture.jpg", sizes); + codec_yuv(r, "images/brickwork_normal-map.jpg", sizes); // A CMYK encoded image should fail. - codec_yuv(r, "CMYK.jpg", nullptr); + codec_yuv(r, "images/CMYK.jpg", nullptr); // A grayscale encoded image should fail. - codec_yuv(r, "grayscale.jpg", nullptr); + codec_yuv(r, "images/grayscale.jpg", nullptr); // A PNG should fail. - codec_yuv(r, "arrow.png", nullptr); + codec_yuv(r, "images/arrow.png", nullptr); } diff --git a/tests/skbug6389.cpp b/tests/skbug6389.cpp index f52515813a..42112a7a0f 100644 --- a/tests/skbug6389.cpp +++ b/tests/skbug6389.cpp @@ -17,7 +17,7 @@ DEF_TEST(skbug_6389, r) { SkPaint p; p.setMaskFilter(SkBlurMaskFilter::Make(SkBlurStyle::kNormal_SkBlurStyle, 5, SkBlurMaskFilter::kHighQuality_BlurFlag)); - p.setImageFilter(SkImageSource::Make(GetResourceAsImage("mandrill_512.png"), {0, 0, 0, 0}, + p.setImageFilter(SkImageSource::Make(GetResourceAsImage("images/mandrill_512.png"), {0, 0, 0, 0}, {0, 0, 0, 0}, (SkFilterQuality)0)); s->getCanvas()->drawPaint(p); } |