Skip to content

Commit

Permalink
Tests: Add a test for SOF2 JPEGs with successive approximations
Browse files Browse the repository at this point in the history
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;
  • Loading branch information
LucasChollet authored and linusg committed Apr 3, 2023
1 parent f42d850 commit 62290d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Tests/LibGfx/TestImageDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 62290d5

Please sign in to comment.