Tests: Add tests for 12 bits JPEGs

In this commit, two tests are added, one with a `SOF1` image, the other
with a `SOF2`.
This commit is contained in:
Lucas CHOLLET 2023-05-07 16:35:54 -04:00 committed by Andreas Kling
parent 312c398b59
commit 8da9ff24e4
Notes: sideshowbarker 2024-07-17 05:00:08 +09:00
3 changed files with 22 additions and 0 deletions

View file

@ -156,6 +156,28 @@ TEST_CASE(test_jpeg_sof2_successive_aproximation)
EXPECT_EQ(frame.image->size(), Gfx::IntSize(600, 800));
}
TEST_CASE(test_jpeg_sof1_12bits)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("12-bit.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(320, 240));
}
TEST_CASE(test_jpeg_sof2_12bits)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("12-bit-progressive.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(320, 240));
}
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

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB