diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 23a633e581..5ab61de362 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -379,6 +379,30 @@ TEST_CASE(test_webp_extended_lossy) EXPECT_EQ(frame.image->get_pixel(341, 75), Gfx::Color(0, 0, 0, 128)); } +TEST_CASE(test_webp_lossy_5) +{ + // This is https://commons.wikimedia.org/wiki/File:Fr%C3%BChling_bl%C3%BChender_Kirschenbaum.jpg, + // under the Creative Commons Attribution-Share Alike 3.0 Unported license. The image was re-encoded + // as webp at https://developers.google.com/speed/webp/gallery1 and the webp version is from there. + // No other changes have been made. + auto file = MUST(Core::MappedFile::map(TEST_INPUT("5.webp"sv))); + EXPECT(Gfx::WebPImageDecoderPlugin::sniff(file->bytes())); + auto plugin_decoder = MUST(Gfx::WebPImageDecoderPlugin::create(file->bytes())); + MUST(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(1024, 752)); + + auto frame = MUST(plugin_decoder->frame(0)); + EXPECT_EQ(frame.image->size(), Gfx::IntSize(1024, 752)); + + // This image tests macroblocks that have `skip_coefficients` set to true, and it test a boolean entropy decoder edge case. + EXPECT_EQ(frame.image->get_pixel(923, 576), Gfx::Color(0xab, 0x40, 0x14, 255)); +} + TEST_CASE(test_webp_extended_lossless) { auto file = MUST(Core::MappedFile::map(TEST_INPUT("extended-lossless.webp"sv))); diff --git a/Tests/LibGfx/test-inputs/5.webp b/Tests/LibGfx/test-inputs/5.webp new file mode 100644 index 0000000000..89e6075fde Binary files /dev/null and b/Tests/LibGfx/test-inputs/5.webp differ