Tests/LibGfx: Add tests for compressed TGA images

This commit is contained in:
Liav A 2023-01-07 17:02:00 +02:00 committed by Jelle Raaijmakers
parent 2f2d808869
commit 71f275b5ad
3 changed files with 32 additions and 0 deletions

View file

@ -176,3 +176,35 @@ TEST_CASE(test_targa_top_left)
auto frame = frame_or_error.release_value();
EXPECT(frame.duration == 0);
}
TEST_CASE(test_targa_bottom_left_compressed)
{
auto file = Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-bottom-left-compressed.tga"sv).release_value();
auto tga = Gfx::TGAImageDecoderPlugin(reinterpret_cast<u8 const*>(file->data()), file->size());
EXPECT_EQ(tga.frame_count(), 1u);
EXPECT(tga.sniff());
EXPECT(!tga.is_animated());
EXPECT(!tga.loop_count());
auto frame_or_error = tga.frame(0);
EXPECT(!frame_or_error.is_error());
auto frame = frame_or_error.release_value();
EXPECT(frame.duration == 0);
}
TEST_CASE(test_targa_top_left_compressed)
{
auto file = Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-top-left-compressed.tga"sv).release_value();
auto tga = Gfx::TGAImageDecoderPlugin(reinterpret_cast<u8 const*>(file->data()), file->size());
EXPECT_EQ(tga.frame_count(), 1u);
EXPECT(tga.sniff());
EXPECT(!tga.is_animated());
EXPECT(!tga.loop_count());
auto frame_or_error = tga.frame(0);
EXPECT(!frame_or_error.is_error());
auto frame = frame_or_error.release_value();
EXPECT(frame.duration == 0);
}