diff --git a/Base/res/html/misc/targasuite_files/buggie-bottom-left-uncompressed.tga b/Base/res/html/misc/targasuite_files/buggie-bottom-left-uncompressed.tga new file mode 100644 index 0000000000..5f0a8aaf61 Binary files /dev/null and b/Base/res/html/misc/targasuite_files/buggie-bottom-left-uncompressed.tga differ diff --git a/Base/res/html/misc/targasuite_files/buggie-top-left-uncompressed.tga b/Base/res/html/misc/targasuite_files/buggie-top-left-uncompressed.tga new file mode 100644 index 0000000000..8952ffaf36 Binary files /dev/null and b/Base/res/html/misc/targasuite_files/buggie-top-left-uncompressed.tga differ diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 366f2f0052..f458a6f500 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -143,3 +144,35 @@ TEST_CASE(test_ppm) auto frame = ppm.frame(0).release_value_but_fixme_should_propagate_errors(); EXPECT(frame.duration == 0); } + +TEST_CASE(test_targa_bottom_left) +{ + auto file = Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-bottom-left-uncompressed.tga"sv).release_value(); + auto tga = Gfx::TGAImageDecoderPlugin(reinterpret_cast(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) +{ + auto file = Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-top-left-uncompressed.tga"sv).release_value(); + auto tga = Gfx::TGAImageDecoderPlugin(reinterpret_cast(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); +}