From aff38ae80fb4d3371ada8c9026d8d81bc6325aec Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 5 Jul 2023 11:19:43 -0400 Subject: [PATCH] Tests: Add a test for grayscale JPEGs with an App14 segment See af14ed6b2e3 for more details. This test has been created by artificially adding an App14 segment to an existing grayscale image. --- Tests/LibGfx/TestImageDecoder.cpp | 10 ++++++++++ Tests/LibGfx/test-inputs/jpg/grayscale_app14.jpg | Bin 0 -> 686 bytes 2 files changed, 10 insertions(+) create mode 100644 Tests/LibGfx/test-inputs/jpg/grayscale_app14.jpg diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 4fbf6ae582..915ef3bd00 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -187,6 +187,16 @@ TEST_CASE(test_jpeg_empty_icc) expect_single_frame_of_size(*plugin_decoder, { 80, 80 }); } +TEST_CASE(test_jpeg_grayscale_with_app14) +{ + auto file = MUST(Core::MappedFile::map(TEST_INPUT("jpg/grayscale_app14.jpg"sv))); + EXPECT(Gfx::JPEGImageDecoderPlugin::sniff(file->bytes())); + auto plugin_decoder = MUST(Gfx::JPEGImageDecoderPlugin::create(file->bytes())); + MUST(plugin_decoder->initialize()); + + expect_single_frame_of_size(*plugin_decoder, { 80, 80 }); +} + TEST_CASE(test_pbm) { auto file = MUST(Core::MappedFile::map(TEST_INPUT("pnm/buggie-raw.pbm"sv))); diff --git a/Tests/LibGfx/test-inputs/jpg/grayscale_app14.jpg b/Tests/LibGfx/test-inputs/jpg/grayscale_app14.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a67a7edddca76826f454f11b419f422a0be9a9c3 GIT binary patch literal 686 zcmex=MA%Kxlkm3Ik26+YsMpi~J0NDY;j7-cdtZeKYoLt=hk1%W%U|?co zW@chxW@TkzVPIgaWn^MzU=d^$QZ#gA6AnydS1J@SYMi)`L)mHLLD8U#A5@H!ikdjN z#Ka{erBv0_H8izMOwG(KEUlbfT;1F~JiUTLLc_u%BBPR1Qq$5iGP89XZ3R<7E#dCS&q+js2Tb?ESsqsNY)IC<*QZC|TB-*V5l`%dqCA89W8TIuoLl$h^pX3vADufFDbyy^r<%J%h} z-SfUqF1)w#UDd3UAQ9QuO3(ME-1)wy8_XAnsF+w7X>JRVDPPk)4`lWxJ#DaE-`8(? zSAESFVj#!?2)hdJZOW?#x$Uv!=c_<=h$HOi0`bjlU%y!mcEu*W>TAB|t4^SJ zWj5HleW!LnyaI9^*bQK>gS`Sbqz~j3EQUaBj!%s#Uo*S!>qNN2pn(7ipF802`F|4t D=o>p3 literal 0 HcmV?d00001