summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorLiav A <liavalb@gmail.com>2023-01-07 17:02:00 +0200
committerJelle Raaijmakers <jelle@gmta.nl>2023-01-15 12:43:03 +0100
commit71f275b5ad5991fd51ea975c7546ffb11a9fbd56 (patch)
treea47ee1617e474930efc7a2c92e16a1f4b74aa70e /Tests
parent2f2d808869df1a7cdccdd4d86bf44c42a5bdd0f3 (diff)
downloadserenity-71f275b5ad5991fd51ea975c7546ffb11a9fbd56.zip
Tests/LibGfx: Add tests for compressed TGA images
Diffstat (limited to 'Tests')
-rw-r--r--Tests/LibGfx/TestImageDecoder.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp
index f458a6f500..7c6ceb836a 100644
--- a/Tests/LibGfx/TestImageDecoder.cpp
+++ b/Tests/LibGfx/TestImageDecoder.cpp
@@ -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);
+}