diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 7ff34a1c49..74d395fb0a 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -360,6 +360,26 @@ TEST_CASE(test_webp_extended_lossless) EXPECT_EQ(frame.image->get_pixel(359, 73), Gfx::Color(0, 0, 0, 128)); } +TEST_CASE(test_webp_simple_lossless_color_index_transform) +{ + // In addition to testing the index transform, this file also tests handling of explicity setting max_symbol. + auto file = MUST(Core::MappedFile::map(TEST_INPUT("Qpalette.webp"sv))); + EXPECT(Gfx::WebPImageDecoderPlugin::sniff(file->bytes())); + auto plugin_decoder = MUST(Gfx::WebPImageDecoderPlugin::create(file->bytes())); + EXPECT(plugin_decoder->initialize()); + + EXPECT_EQ(plugin_decoder->frame_count(), 1u); + EXPECT(!plugin_decoder->is_animated()); + EXPECT(!plugin_decoder->loop_count()); + + EXPECT_EQ(plugin_decoder->size(), Gfx::IntSize(256, 256)); + + auto frame = MUST(plugin_decoder->frame(0)); + EXPECT_EQ(frame.image->size(), Gfx::IntSize(256, 256)); + + EXPECT_EQ(frame.image->get_pixel(100, 100), Gfx::Color(0x73, 0x37, 0x23, 0xff)); +} + TEST_CASE(test_webp_extended_lossless_animated) { auto file = MUST(Core::MappedFile::map(TEST_INPUT("extended-lossless-animated.webp"sv))); diff --git a/Tests/LibGfx/test-inputs/Qpalette.webp b/Tests/LibGfx/test-inputs/Qpalette.webp new file mode 100644 index 0000000000..56e05311c4 Binary files /dev/null and b/Tests/LibGfx/test-inputs/Qpalette.webp differ