From 89e243151711bdc078c1eef52afe2a1b83b0795a Mon Sep 17 00:00:00 2001 From: Lucas CHOLLET Date: Fri, 21 Jul 2023 23:04:29 -0400 Subject: [PATCH] Tests/LibGfx: Add a first test for JPEG XL images This image uses the modular encoding with a very simple prediction tree. It also makes use of two features: upsampling (x2 factor) and a non-standard bit depth (10 bits). The file has been generated on https://jxl-art.surma.technology/ , with the following input: Width 64 Height 64 Upsample 2 Bitdepth 10 if N > 300 - NE -6 - W 6 --- Tests/LibGfx/TestImageDecoder.cpp | 11 +++++++++++ .../jxl/modular_simple_tree_upsample2_10bits.jxl | Bin 0 -> 26 bytes 2 files changed, 11 insertions(+) create mode 100644 Tests/LibGfx/test-inputs/jxl/modular_simple_tree_upsample2_10bits.jxl diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 6fad158f03..a668175280 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -561,3 +562,13 @@ TEST_CASE(test_everything_tvg) expect_single_frame_of_size(*plugin_decoder, { 400, 768 }); } } + +TEST_CASE(test_jxl_modular_simple_tree_upsample2_10bits) +{ + + auto file = MUST(Core::MappedFile::map(TEST_INPUT("jxl/modular_simple_tree_upsample2_10bits.jxl"sv))); + EXPECT(Gfx::JPEGXLImageDecoderPlugin::sniff(file->bytes())); + auto plugin_decoder = MUST(Gfx::JPEGXLImageDecoderPlugin::create(file->bytes())); + + expect_single_frame_of_size(*plugin_decoder, { 128, 128 }); +} diff --git a/Tests/LibGfx/test-inputs/jxl/modular_simple_tree_upsample2_10bits.jxl b/Tests/LibGfx/test-inputs/jxl/modular_simple_tree_upsample2_10bits.jxl new file mode 100644 index 0000000000000000000000000000000000000000..291b1385fe63332d10fc1cbd71e506abbfa6a983 GIT binary patch literal 26 hcmey*6(69|!N$m7!{BX^)RWEs?)ako6CEmv3;=T52`&Ht literal 0 HcmV?d00001