summaryrefslogtreecommitdiff
path: root/Tests/LibGfx/TestImageDecoder.cpp
diff options
context:
space:
mode:
authorLucas CHOLLET <lucas.chollet@free.fr>2023-03-17 23:39:30 -0400
committerLinus Groh <mail@linusgroh.de>2023-04-03 17:06:21 +0100
commit62290d57f747d3bdb61164aff73ddc55bd9f4957 (patch)
tree8a5bcf41024b90cceeea602d2956628f558c574e /Tests/LibGfx/TestImageDecoder.cpp
parentf42d850211bbdbd24e481a4763933cae37e8b728 (diff)
downloadserenity-62290d57f747d3bdb61164aff73ddc55bd9f4957.zip
Tests: Add a test for SOF2 JPEGs with successive approximations
This image was generated using `cjpeg` with the following scan file: 0 1 2: 0 0 0 2; 0: 1 63 0 1; 1: 1 63 0 1; 2: 1 63 0 1; 0 1 2: 0 0 2 1; 0: 1 63 1 0; 1: 1 63 1 0; 2: 1 63 1 0; 0 1 2: 0 0 1 0;
Diffstat (limited to 'Tests/LibGfx/TestImageDecoder.cpp')
-rw-r--r--Tests/LibGfx/TestImageDecoder.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp
index ce1ae607ca..564d0be3a0 100644
--- a/Tests/LibGfx/TestImageDecoder.cpp
+++ b/Tests/LibGfx/TestImageDecoder.cpp
@@ -145,6 +145,17 @@ TEST_CASE(test_jpeg_sof0_several_scans_odd_number_mcu)
EXPECT_EQ(frame.image->size(), Gfx::IntSize(600, 600));
}
+TEST_CASE(test_jpeg_sof2_successive_aproximation)
+{
+ auto file = MUST(Core::MappedFile::map(TEST_INPUT("successive_approximation.jpg"sv)));
+ EXPECT(Gfx::JPEGImageDecoderPlugin::sniff(file->bytes()));
+ auto plugin_decoder = MUST(Gfx::JPEGImageDecoderPlugin::create(file->bytes()));
+ EXPECT(plugin_decoder->initialize());
+
+ auto frame = MUST(plugin_decoder->frame(0));
+ EXPECT_EQ(frame.image->size(), Gfx::IntSize(600, 800));
+}
+
TEST_CASE(test_pbm)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pbm"sv)));