diff options
author | Nico Weber <thakis@chromium.org> | 2023-01-31 14:00:33 -0500 |
---|---|---|
committer | Tim Flynn <trflynn89@pm.me> | 2023-02-01 08:56:56 -0500 |
commit | bea3f3fc46fed2b43dbf822df9a84c111ad6d17f (patch) | |
tree | 95a1d10608aea8f75ff718be22293ccc6b632320 /Tests | |
parent | b8b5e0f6806f9db596a968f33798c8eac40c1ced (diff) | |
download | serenity-bea3f3fc46fed2b43dbf822df9a84c111ad6d17f.zip |
LibGfx: Move TestImageDecoder over to input file approach in 8cfabbcd933
Rather than reading files out of /res, put them in a subfolder of
Tests/LibGfx/ and pick the path based on AK_OS_SERENITY.
That way, the tests can also pass when run under lagom.
(I just `cp`d all the files that the test previously read from
random places into Tests/LibGfx/test-inputs.)
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/LibGfx/TestImageDecoder.cpp | 32 | ||||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie-bottom-left-compressed.tga | bin | 0 -> 23955 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie-bottom-left-uncompressed.tga | bin | 0 -> 66044 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie-raw.pbm | bin | 0 -> 2917 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie-raw.pgm | bin | 0 -> 22015 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie-raw.ppm | bin | 0 -> 66061 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie-top-left-compressed.tga | bin | 0 -> 23955 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie-top-left-uncompressed.tga | bin | 0 -> 66044 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/buggie.png | bin | 0 -> 9015 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/download-animation.gif | bin | 0 -> 4542 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/rgb24.jpg | bin | 0 -> 2319 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/rgba32-1.bmp | bin | 0 -> 32650 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/serenity.ico | bin | 0 -> 1150 bytes |
13 files changed, 19 insertions, 13 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 633450f526..58dc750e3e 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -21,9 +21,15 @@ #include <stdio.h> #include <string.h> +#ifdef AK_OS_SERENITY +# define TEST_INPUT(x) ("/usr/Tests/LibGfx/test-inputs/" x) +#else +# define TEST_INPUT(x) ("test-inputs/" x) +#endif + TEST_CASE(test_bmp) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/bmpsuite_files/rgba32-1.bmp"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("rgba32-1.bmp"sv))); EXPECT(MUST(Gfx::BMPImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::BMPImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -38,7 +44,7 @@ TEST_CASE(test_bmp) TEST_CASE(test_gif) { - auto file = MUST(Core::MappedFile::map("/res/graphics/download-animation.gif"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("download-animation.gif"sv))); EXPECT(MUST(Gfx::GIFImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::GIFImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -53,7 +59,7 @@ TEST_CASE(test_gif) TEST_CASE(test_not_ico) { - auto file = MUST(Core::MappedFile::map("/res/graphics/buggie.png"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie.png"sv))); EXPECT(!MUST(Gfx::ICOImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::ICOImageDecoderPlugin::create(file->bytes())); EXPECT(!plugin_decoder->initialize()); @@ -67,7 +73,7 @@ TEST_CASE(test_not_ico) TEST_CASE(test_bmp_embedded_in_ico) { - auto file = MUST(Core::MappedFile::map("/res/icons/16x16/serenity.ico"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("serenity.ico"sv))); EXPECT(MUST(Gfx::ICOImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::ICOImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -81,7 +87,7 @@ TEST_CASE(test_bmp_embedded_in_ico) TEST_CASE(test_jpg) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/bmpsuite_files/rgb24.jpg"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("rgb24.jpg"sv))); EXPECT(MUST(Gfx::JPGImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::JPGImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -98,7 +104,7 @@ TEST_CASE(test_jpg) TEST_CASE(test_pbm) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/pbmsuite_files/buggie-raw.pbm"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pbm"sv))); EXPECT(MUST(Gfx::PBMImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::PBMImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -115,7 +121,7 @@ TEST_CASE(test_pbm) TEST_CASE(test_pgm) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/pgmsuite_files/buggie-raw.pgm"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pgm"sv))); EXPECT(MUST(Gfx::PGMImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::PGMImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -132,7 +138,7 @@ TEST_CASE(test_pgm) TEST_CASE(test_png) { - auto file = MUST(Core::MappedFile::map("/res/graphics/buggie.png"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie.png"sv))); EXPECT(MUST(Gfx::PNGImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::PNGImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -149,7 +155,7 @@ TEST_CASE(test_png) TEST_CASE(test_ppm) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/ppmsuite_files/buggie-raw.ppm"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.ppm"sv))); EXPECT(MUST(Gfx::PPMImageDecoderPlugin::sniff(file->bytes()))); auto plugin_decoder = MUST(Gfx::PPMImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -166,7 +172,7 @@ TEST_CASE(test_ppm) TEST_CASE(test_targa_bottom_left) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-bottom-left-uncompressed.tga"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-bottom-left-uncompressed.tga"sv))); EXPECT(MUST(Gfx::TGAImageDecoderPlugin::validate_before_create(file->bytes()))); auto plugin_decoder = MUST(Gfx::TGAImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -185,7 +191,7 @@ TEST_CASE(test_targa_bottom_left) TEST_CASE(test_targa_top_left) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-top-left-uncompressed.tga"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-top-left-uncompressed.tga"sv))); EXPECT(MUST(Gfx::TGAImageDecoderPlugin::validate_before_create(file->bytes()))); auto plugin_decoder = MUST(Gfx::TGAImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -204,7 +210,7 @@ TEST_CASE(test_targa_top_left) TEST_CASE(test_targa_bottom_left_compressed) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-bottom-left-compressed.tga"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-bottom-left-compressed.tga"sv))); EXPECT(MUST(Gfx::TGAImageDecoderPlugin::validate_before_create(file->bytes()))); auto plugin_decoder = MUST(Gfx::TGAImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); @@ -223,7 +229,7 @@ TEST_CASE(test_targa_bottom_left_compressed) TEST_CASE(test_targa_top_left_compressed) { - auto file = MUST(Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-top-left-compressed.tga"sv)); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-top-left-compressed.tga"sv))); EXPECT(MUST(Gfx::TGAImageDecoderPlugin::validate_before_create(file->bytes()))); auto plugin_decoder = MUST(Gfx::TGAImageDecoderPlugin::create(file->bytes())); EXPECT(plugin_decoder->initialize()); diff --git a/Tests/LibGfx/test-inputs/buggie-bottom-left-compressed.tga b/Tests/LibGfx/test-inputs/buggie-bottom-left-compressed.tga Binary files differnew file mode 100644 index 0000000000..187d49bec5 --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie-bottom-left-compressed.tga diff --git a/Tests/LibGfx/test-inputs/buggie-bottom-left-uncompressed.tga b/Tests/LibGfx/test-inputs/buggie-bottom-left-uncompressed.tga Binary files differnew file mode 100644 index 0000000000..5f0a8aaf61 --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie-bottom-left-uncompressed.tga diff --git a/Tests/LibGfx/test-inputs/buggie-raw.pbm b/Tests/LibGfx/test-inputs/buggie-raw.pbm Binary files differnew file mode 100644 index 0000000000..71d0b504e3 --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie-raw.pbm diff --git a/Tests/LibGfx/test-inputs/buggie-raw.pgm b/Tests/LibGfx/test-inputs/buggie-raw.pgm Binary files differnew file mode 100644 index 0000000000..0b7142d396 --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie-raw.pgm diff --git a/Tests/LibGfx/test-inputs/buggie-raw.ppm b/Tests/LibGfx/test-inputs/buggie-raw.ppm Binary files differnew file mode 100644 index 0000000000..84f7c3469a --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie-raw.ppm diff --git a/Tests/LibGfx/test-inputs/buggie-top-left-compressed.tga b/Tests/LibGfx/test-inputs/buggie-top-left-compressed.tga Binary files differnew file mode 100644 index 0000000000..45cbda9521 --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie-top-left-compressed.tga diff --git a/Tests/LibGfx/test-inputs/buggie-top-left-uncompressed.tga b/Tests/LibGfx/test-inputs/buggie-top-left-uncompressed.tga Binary files differnew file mode 100644 index 0000000000..8952ffaf36 --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie-top-left-uncompressed.tga diff --git a/Tests/LibGfx/test-inputs/buggie.png b/Tests/LibGfx/test-inputs/buggie.png Binary files differnew file mode 100644 index 0000000000..94558bd2d3 --- /dev/null +++ b/Tests/LibGfx/test-inputs/buggie.png diff --git a/Tests/LibGfx/test-inputs/download-animation.gif b/Tests/LibGfx/test-inputs/download-animation.gif Binary files differnew file mode 100644 index 0000000000..f5e55e40f5 --- /dev/null +++ b/Tests/LibGfx/test-inputs/download-animation.gif diff --git a/Tests/LibGfx/test-inputs/rgb24.jpg b/Tests/LibGfx/test-inputs/rgb24.jpg Binary files differnew file mode 100644 index 0000000000..c43698c9b1 --- /dev/null +++ b/Tests/LibGfx/test-inputs/rgb24.jpg diff --git a/Tests/LibGfx/test-inputs/rgba32-1.bmp b/Tests/LibGfx/test-inputs/rgba32-1.bmp Binary files differnew file mode 100644 index 0000000000..3c1e2648fc --- /dev/null +++ b/Tests/LibGfx/test-inputs/rgba32-1.bmp diff --git a/Tests/LibGfx/test-inputs/serenity.ico b/Tests/LibGfx/test-inputs/serenity.ico Binary files differnew file mode 100644 index 0000000000..89dd18839b --- /dev/null +++ b/Tests/LibGfx/test-inputs/serenity.ico |