From 3d2e4ba482c0f08690bf997dc354a3ea371585f6 Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Wed, 5 Jul 2023 11:08:35 -0400 Subject: [PATCH] Tests: Add a test for JPEGs with an empty ICC profile No encoder should declare an ICC profile with a size of zero, but some does. This image has one of these dummy declaration. --- Tests/LibGfx/TestImageDecoder.cpp | 10 ++++++++++ .../test-inputs/jpg/gradient_empty_icc.jpg | Bin 0 -> 1141 bytes 2 files changed, 10 insertions(+) create mode 100644 Tests/LibGfx/test-inputs/jpg/gradient_empty_icc.jpg diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index e25259b5d4..4fbf6ae582 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -177,6 +177,16 @@ TEST_CASE(test_jpeg_sof2_12bits) expect_single_frame_of_size(*plugin_decoder, { 320, 240 }); } +TEST_CASE(test_jpeg_empty_icc) +{ + auto file = MUST(Core::MappedFile::map(TEST_INPUT("jpg/gradient_empty_icc.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/gradient_empty_icc.jpg b/Tests/LibGfx/test-inputs/jpg/gradient_empty_icc.jpg new file mode 100644 index 0000000000000000000000000000000000000000..14c155fd4ca71bf9a2d4716517cba3746480d93b GIT binary patch literal 1141 zcmex=` z`2_j6xdp@o1cgOJMMZh|#U;coyGPAI-vaoWpvT};>a`TFi4E`Tt5aeJ8 zUeILM=nDB?^UEdOsY@GvtnFbOaVFfcG) zjuqlE;xYh3BQ60h1FirrW9QAr42u;OGk~GOVupnbOBoi6SQ{H5DK!8q4s_mZtbnR? zF~d?cr65xcxD1^)TcaywR5md;-T*RH$biX!3*rC+A!FxaYmfsNl^K*lG{ZuM#Yjp8 zm;yjrKn_4wx{yH??AFDM%J%<{Fo+5;qWGPGfr0t|Ed~xoMg~S!rcI}HsD(fwEeHx~ z~iQ&-ltx(kKxWQy_K7$`}}!AdX@JDQnAc5@=E601-SFz>KqC4wR5w z2xUMO8G{sZIGaFpa5xG4Kf)j)fbQu8urnAL*zB1+K~4~0L<<*31_7uNMtjBJDNij= z1^J1R2Tl!TL&slEiS2PEi{Z#W5NYtwsB*X?QR-1W&??bV5h+3P`0!Uz>csFOf}Cy<5< zr1PACf^(8HXU?2sY;0_7k(QR04+;lC?BM_kX93Up{|x)z|7ZBmP!A#?%>PFiqy-ol zSy4hqfl<-G&{2Q^9zX(C9da2OE*uNiDD^T(e`0am+0ew%JJE3ylb{rb#*B?jTwEp6 O50gT80tM>--vj^$=NXm& literal 0 HcmV?d00001