From da48238fbdf4158e45a45f0d8214563e37b24cd3 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Mon, 19 Jun 2023 21:07:17 -0400 Subject: [PATCH] Tests: Add test for webp with color index transform and alpha_used=false This just works at the moment after e19892a099a1, but if we ever do the FIXME in ColorIndexingTransform::transform(), this test will remind us to think of this case there too. catdog-alert-13-alpha-used-false.webp is identical to catdog-alert-13.web but with the byte at offset 0x2a changed from 0x10 to 0x00 -- that is, the bit in the VP8L header that stores `is_alpha_used` is cleared. See the commit message of e19892a099a1 for more information. --- Tests/LibGfx/TestImageDecoder.cpp | 3 +++ .../webp/catdog-alert-13-alpha-used-false.webp | Bin 0 -> 400 bytes 2 files changed, 3 insertions(+) create mode 100644 Tests/LibGfx/test-inputs/webp/catdog-alert-13-alpha-used-false.webp diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 9717a1c48e..385846be49 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -492,11 +492,14 @@ TEST_CASE(test_webp_simple_lossless_color_index_transform_pixel_bundling) // catdog-alert-2 tests the 1-bit-per-pixel case, // catdog-alert-3 tests the 2-bit-per-pixel case, // catdog-alert-8 and catdog-alert-13 both test the 4-bits-per-pixel case. + // catdog-alert-13-alpha-used-false is like catdog-alert-13, but with is_alpha_used set to false in the header + // (which has the effect of ignoring the alpha information in the palette and instead always setting alpha to 0xff). TestCase test_cases[] = { { "webp/catdog-alert-2.webp"sv, Gfx::Color(0x35, 0x12, 0x0a, 0xff), Gfx::Color(0xf3, 0xe6, 0xd8, 0xff) }, { "webp/catdog-alert-3.webp"sv, Gfx::Color(0x35, 0x12, 0x0a, 0xff), Gfx::Color(0, 0, 0, 0) }, { "webp/catdog-alert-8.webp"sv, Gfx::Color(0, 0, 0, 255), Gfx::Color(0, 0, 0, 0) }, { "webp/catdog-alert-13.webp"sv, Gfx::Color(0, 0, 0, 255), Gfx::Color(0, 0, 0, 0) }, + { "webp/catdog-alert-13-alpha-used-false.webp"sv, Gfx::Color(0, 0, 0, 255), Gfx::Color(0, 0, 0, 255) }, }; for (auto test_case : test_cases) { diff --git a/Tests/LibGfx/test-inputs/webp/catdog-alert-13-alpha-used-false.webp b/Tests/LibGfx/test-inputs/webp/catdog-alert-13-alpha-used-false.webp new file mode 100644 index 0000000000000000000000000000000000000000..991a5ffae328ebff0b7720e29d9f7f4c90f8b2b9 GIT binary patch literal 400 zcmWIYbaU%qWMBw)bqWXzu!!JdU|>p6>7YM)g*TMsnF!!_c@k4NTJa{}VG z1Yf$7s}k~!X~)HH`+e`-XS+Y2=Ra5e0>P5+!pq~N1!UMBY-vb-c}^>Kso)WgjMXkO z3XA>=GcXA>WN@!ZwUuznuM{ISBsVevQC`vOkk zhTm)CF21}R>_eSUS$zQt_ z78*MDyzgZe28MuOM^8VXA1$0beVN|^8K8jk0FsPA2&F-CEE-@r9w5nN{{hSf>tS&Q Svv~uOQo|Vq7+8V93