diff options
author | Lucas CHOLLET <lucas.chollet@free.fr> | 2023-03-04 22:05:02 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-03-10 22:22:36 +0100 |
commit | af58f012be3ad64fc4fd0754b4894a8b5278c0ad (patch) | |
tree | 1e5ede85137b11c0b7b6ad80216311df1691e490 | |
parent | a47d775be67b32c58949c3f997a24f6dfcabd8d9 (diff) | |
download | serenity-af58f012be3ad64fc4fd0754b4894a8b5278c0ad.zip |
Tests: Add a test for JPEGs with RGB components
-rw-r--r-- | Tests/LibGfx/TestImageDecoder.cpp | 11 | ||||
-rw-r--r-- | Tests/LibGfx/test-inputs/rgb_components.jpg | bin | 0 -> 32286 bytes |
2 files changed, 11 insertions, 0 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index c7925f9295..f5a1533438 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -112,6 +112,17 @@ TEST_CASE(test_jpeg_sof0_several_scans) EXPECT_EQ(frame.image->size(), Gfx::IntSize(592, 800)); } +TEST_CASE(test_jpeg_rgb_components) +{ + auto file = MUST(Core::MappedFile::map(TEST_INPUT("rgb_components.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(592, 800)); +} + TEST_CASE(test_jpeg_sof2_spectral_selection) { auto file = MUST(Core::MappedFile::map(TEST_INPUT("spectral_selection.jpg"sv))); diff --git a/Tests/LibGfx/test-inputs/rgb_components.jpg b/Tests/LibGfx/test-inputs/rgb_components.jpg Binary files differnew file mode 100644 index 0000000000..e451c5cc29 --- /dev/null +++ b/Tests/LibGfx/test-inputs/rgb_components.jpg |