mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
Tests: Check that color indexing reduces file size
This commit is contained in:
parent
8a21992030
commit
d8103247d9
Notes:
sideshowbarker
2024-07-17 11:30:54 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/d8103247d9 Pull-request: https://github.com/SerenityOS/serenity/pull/24483 Reviewed-by: https://github.com/gmta ✅
@ -203,7 +203,16 @@ TEST_CASE(test_webp_color_indexing_transform)
|
||||
for (int x = 0; x < bitmap->width(); ++x)
|
||||
bitmap->set_pixel(x, y, colors[(x * bitmap->width() + y) % number_of_colors]);
|
||||
|
||||
TRY_OR_FAIL((test_roundtrip<Gfx::WebPWriter, Gfx::WebPImageDecoderPlugin>(bitmap)));
|
||||
auto encoded_data = TRY_OR_FAIL(encode_bitmap<Gfx::WebPWriter>(bitmap));
|
||||
auto decoded_bitmap = TRY_OR_FAIL(expect_single_frame_of_size(*TRY_OR_FAIL(Gfx::WebPImageDecoderPlugin::create(encoded_data)), bitmap->size()));
|
||||
expect_bitmaps_equal(*decoded_bitmap, *bitmap);
|
||||
|
||||
Gfx::WebPEncoderOptions options;
|
||||
options.vp8l_options.allowed_transforms = 0;
|
||||
auto encoded_data_without_color_indexing = TRY_OR_FAIL(encode_bitmap<Gfx::WebPWriter>(bitmap, options));
|
||||
EXPECT(encoded_data.size() < encoded_data_without_color_indexing.size());
|
||||
auto decoded_bitmap_without_color_indexing = TRY_OR_FAIL(expect_single_frame_of_size(*TRY_OR_FAIL(Gfx::WebPImageDecoderPlugin::create(encoded_data)), bitmap->size()));
|
||||
expect_bitmaps_equal(*decoded_bitmap_without_color_indexing, *decoded_bitmap);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user