diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2023-05-07 16:35:54 -0400 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-09 07:00:15 +0200 |
commit | 8da9ff24e4e720b1e80a027f09c419ac9503f896 (patch) | |
tree | 12503cfc31dd981e338182f6dcc6f0d9839eca73 /Tests/LibGfx | |
parent | 312c398b5982376e4ea49f8763cd3d8bcebb0930 (diff) | |
download | serenity-8da9ff24e4e720b1e80a027f09c419ac9503f896.zip |
Tests: Add tests for 12 bits JPEGs
In this commit, two tests are added, one with a `SOF1` image, the other
with a `SOF2`.
Diffstat (limited to 'Tests/LibGfx')
-rw-r--r-- | Tests/LibGfx/TestImageDecoder.cpp | 22 | ||||
-rw-r--r-- | Tests/LibGfx/test-inputs/12-bit-progressive.jpg | bin | 0 -> 12439 bytes | |||
-rw-r--r-- | Tests/LibGfx/test-inputs/12-bit.jpg | bin | 0 -> 12968 bytes |
3 files changed, 22 insertions, 0 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 9faaecaa2f..b3b711885b 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -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))); diff --git a/Tests/LibGfx/test-inputs/12-bit-progressive.jpg b/Tests/LibGfx/test-inputs/12-bit-progressive.jpg Binary files differnew file mode 100644 index 0000000000..a463f7b32c --- /dev/null +++ b/Tests/LibGfx/test-inputs/12-bit-progressive.jpg diff --git a/Tests/LibGfx/test-inputs/12-bit.jpg b/Tests/LibGfx/test-inputs/12-bit.jpg Binary files differnew file mode 100644 index 0000000000..d7173d08e1 --- /dev/null +++ b/Tests/LibGfx/test-inputs/12-bit.jpg |