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;
This commit is contained in:
Lucas CHOLLET 2023-02-26 17:07:14 -05:00 committed by Andreas Kling
parent a40c7354c1
commit 8c1a409263
Notes: sideshowbarker 2024-07-17 01:46:00 +09:00
2 changed files with 11 additions and 0 deletions

View file

@ -101,6 +101,17 @@ TEST_CASE(test_jpeg_sof0_one_scan)
EXPECT(frame.duration == 0); 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) TEST_CASE(test_pbm)
{ {
auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pbm"sv))); auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pbm"sv)));

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB