From 9c54c13744d39b6ce3f6a534c2a7a12372ba9fb3 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Sat, 6 Jan 2024 19:40:53 -0500 Subject: [PATCH] Tests/LibGfx: Move the ICO test file to the ico directory And add more tests on the image than just "we are able to decode it". --- Tests/LibGfx/TestImageDecoder.cpp | 6 ++++-- Tests/LibGfx/test-inputs/{ => ico}/serenity.ico | Bin 2 files changed, 4 insertions(+), 2 deletions(-) rename Tests/LibGfx/test-inputs/{ => ico}/serenity.ico (100%) diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 0192d94c3a..55de6c1292 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -168,11 +168,13 @@ TEST_CASE(test_not_ico) TEST_CASE(test_bmp_embedded_in_ico) { - auto file = MUST(Core::MappedFile::map(TEST_INPUT("serenity.ico"sv))); + auto file = MUST(Core::MappedFile::map(TEST_INPUT("ico/serenity.ico"sv))); EXPECT(Gfx::ICOImageDecoderPlugin::sniff(file->bytes())); auto plugin_decoder = TRY_OR_FAIL(Gfx::ICOImageDecoderPlugin::create(file->bytes())); - TRY_OR_FAIL(expect_single_frame(*plugin_decoder)); + auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 16, 16 })); + EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color::NamedColor::Transparent); + EXPECT_EQ(frame.image->get_pixel(7, 4), Gfx::Color(161, 0, 0)); } TEST_CASE(test_ilbm) diff --git a/Tests/LibGfx/test-inputs/serenity.ico b/Tests/LibGfx/test-inputs/ico/serenity.ico similarity index 100% rename from Tests/LibGfx/test-inputs/serenity.ico rename to Tests/LibGfx/test-inputs/ico/serenity.ico