From 16e9e1571b48414940fb3c9de7da5b07a44a1a7c Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 14 May 2024 18:37:06 -0400 Subject: [PATCH] Tests/TestImageWriter: Remove is_gif parameter again This removes the somewhat awkward is_gif that got added in 2513a1b83f68ceecb5 again. --- Tests/LibGfx/TestImageWriter.cpp | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Tests/LibGfx/TestImageWriter.cpp b/Tests/LibGfx/TestImageWriter.cpp index 573a8d6cbd8663..60d811482d82bd 100644 --- a/Tests/LibGfx/TestImageWriter.cpp +++ b/Tests/LibGfx/TestImageWriter.cpp @@ -24,22 +24,21 @@ #include #include -static ErrorOr> expect_single_frame(Gfx::ImageDecoderPlugin& plugin_decoder, bool is_gif) +static ErrorOr> expect_single_frame(Gfx::ImageDecoderPlugin& plugin_decoder) { EXPECT_EQ(plugin_decoder.frame_count(), 1u); EXPECT(!plugin_decoder.is_animated()); - EXPECT_EQ(plugin_decoder.loop_count(), is_gif ? 1u : 0u); + EXPECT(!plugin_decoder.loop_count()); auto frame_descriptor = TRY(plugin_decoder.frame(0)); - if (!is_gif) - EXPECT_EQ(frame_descriptor.duration, 0); + EXPECT_EQ(frame_descriptor.duration, 0); return *frame_descriptor.image; } -static ErrorOr> expect_single_frame_of_size(Gfx::ImageDecoderPlugin& plugin_decoder, Gfx::IntSize size, bool is_gif = false) +static ErrorOr> expect_single_frame_of_size(Gfx::ImageDecoderPlugin& plugin_decoder, Gfx::IntSize size) { EXPECT_EQ(plugin_decoder.size(), size); - auto frame = TRY(expect_single_frame(plugin_decoder, is_gif)); + auto frame = TRY(expect_single_frame(plugin_decoder)); EXPECT_EQ(frame->size(), size); return frame; } @@ -57,10 +56,10 @@ static ErrorOr encode_bitmap(Gfx::Bitmap const& bitmap, ExtraArgs... } template -static ErrorOr> get_roundtrip_bitmap(Gfx::Bitmap const& bitmap, bool is_gif = false) +static ErrorOr> get_roundtrip_bitmap(Gfx::Bitmap const& bitmap) { auto encoded_data = TRY(encode_bitmap(bitmap)); - return expect_single_frame_of_size(*TRY(Loader::create(encoded_data)), bitmap.size(), is_gif); + return expect_single_frame_of_size(*TRY(Loader::create(encoded_data)), bitmap.size()); } static void expect_bitmaps_equal(Gfx::Bitmap const& a, Gfx::Bitmap const& b) @@ -72,9 +71,9 @@ static void expect_bitmaps_equal(Gfx::Bitmap const& a, Gfx::Bitmap const& b) } template -static ErrorOr test_roundtrip(Gfx::Bitmap const& bitmap, bool is_gif = false) +static ErrorOr test_roundtrip(Gfx::Bitmap const& bitmap) { - auto decoded = TRY((get_roundtrip_bitmap(bitmap, is_gif))); + auto decoded = TRY((get_roundtrip_bitmap(bitmap))); expect_bitmaps_equal(*decoded, bitmap); return {}; }