1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 10:47:35 +00:00

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;
This commit is contained in:
Lucas CHOLLET 2023-03-17 23:39:30 -04:00 committed by Linus Groh
parent f42d850211
commit 62290d57f7
2 changed files with 11 additions and 0 deletions

View file

@ -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)));

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB