diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2023-02-26 17:07:14 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-02-27 13:39:22 +0100 |
commit | 8c1a409263996cfb573dd2235468297211fcea67 (patch) | |
tree | 0f450639659c72b4e2eed3243cdc654bc3df998a /Tests/LibGfx/TestImageDecoder.cpp | |
parent | a40c7354c1e2b2303ec964dbf91d3560e29e55a5 (diff) | |
download | serenity-8c1a409263996cfb573dd2235468297211fcea67.zip |
Tests: Add a test for SOF0 images with several scans
This type of image isn't common, and you can probably only find one by
generating it yourself. It can be done using `cjpeg` with the -scan
argument.
This image has been generated with the following scan file:
0: 0 63 0 0;
1: 0 63 0 0;
2: 0 63 0 0;
Diffstat (limited to 'Tests/LibGfx/TestImageDecoder.cpp')
-rw-r--r-- | Tests/LibGfx/TestImageDecoder.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 8021c77105..57d5270ad5 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -101,6 +101,17 @@ TEST_CASE(test_jpeg_sof0_one_scan) EXPECT(frame.duration == 0); } +TEST_CASE(test_jpeg_sof0_several_scans) +{ + auto file = MUST(Core::MappedFile::map(TEST_INPUT("several_scans.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(720, 859)); +} + TEST_CASE(test_pbm) { auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pbm"sv))); |