mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:17:34 +00:00
WebP/Lossy: Add an additional test case
This image covers two things that aren't covered by the existing tests, and I found it useful for testing locally. The image's license allows redistributing it, so add it as a test case.
This commit is contained in:
parent
f3beff0930
commit
a22cbc9a28
2 changed files with 24 additions and 0 deletions
|
@ -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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue