Tests/TestImageWriter: Make test_gif() not use test_roundtrip()
This allows using more detailed assertions that match the gif loader.
This commit is contained in:
parent
c8e4499b08
commit
d70802f658
Notes:
sideshowbarker
2024-07-17 05:19:06 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/d70802f658 Pull-request: https://github.com/SerenityOS/serenity/pull/24331 Reviewed-by: https://github.com/LucasChollet
1 changed files with 9 additions and 3 deletions
|
@ -113,14 +113,20 @@ TEST_CASE(test_bmp)
|
|||
|
||||
TEST_CASE(test_gif)
|
||||
{
|
||||
// We only support grayscale and non-animated images yet
|
||||
auto bitmap = TRY_OR_FAIL(create_test_rgb_bitmap());
|
||||
|
||||
// Convert bitmap to grayscale
|
||||
// We only support grayscale and non-animated images at the moment - convert bitmap to grayscale.
|
||||
for (auto& argb : *bitmap)
|
||||
argb = Color::from_argb(argb).to_grayscale().value();
|
||||
|
||||
TRY_OR_FAIL((test_roundtrip<Gfx::GIFWriter, Gfx::GIFImageDecoderPlugin>(bitmap, true)));
|
||||
auto encoded_bitmap = TRY_OR_FAIL((encode_bitmap<Gfx::GIFWriter>(bitmap)));
|
||||
auto decoder = TRY_OR_FAIL(Gfx::GIFImageDecoderPlugin::create(encoded_bitmap));
|
||||
|
||||
EXPECT_EQ(decoder->size(), bitmap->size());
|
||||
EXPECT_EQ(decoder->frame_count(), 1u);
|
||||
EXPECT(!decoder->is_animated());
|
||||
|
||||
expect_bitmaps_equal(*TRY_OR_FAIL(decoder->frame(0)).image, bitmap);
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg)
|
||||
|
|
Loading…
Add table
Reference in a new issue