diff options
author | Nico Weber <thakis@chromium.org> | 2023-04-03 14:54:05 -0400 |
---|---|---|
committer | Jelle Raaijmakers <jelle@gmta.nl> | 2023-04-05 13:24:00 +0200 |
commit | 09dd9c4fad23b5f1ebe3c0e232983de1a0fd1bb7 (patch) | |
tree | 36bbe9d3d94ce23defbc69d3b5b410b54c25cf14 | |
parent | c84968dafd76fcb99b105325a4e0fb095548318c (diff) | |
download | serenity-09dd9c4fad23b5f1ebe3c0e232983de1a0fd1bb7.zip |
Tests: Add test for webp lossless decoding
-rw-r--r-- | Tests/LibGfx/TestImageDecoder.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 564d0be3a0..74c5c40418 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -330,6 +330,22 @@ TEST_CASE(test_webp_extended_lossless) EXPECT(!plugin_decoder->loop_count()); EXPECT_EQ(plugin_decoder->size(), Gfx::IntSize(417, 223)); + + auto frame = MUST(plugin_decoder->frame(0)); + EXPECT_EQ(frame.image->size(), Gfx::IntSize(417, 223)); + + // Check some basic pixels. + EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color(0, 0, 0, 0)); + EXPECT_EQ(frame.image->get_pixel(43, 75), Gfx::Color(255, 0, 0, 255)); + EXPECT_EQ(frame.image->get_pixel(141, 75), Gfx::Color(0, 255, 0, 255)); + EXPECT_EQ(frame.image->get_pixel(235, 75), Gfx::Color(0, 0, 255, 255)); + EXPECT_EQ(frame.image->get_pixel(341, 75), Gfx::Color(0, 0, 0, 128)); + + // Check pixels using the color cache. + EXPECT_EQ(frame.image->get_pixel(94, 73), Gfx::Color(255, 0, 0, 255)); + EXPECT_EQ(frame.image->get_pixel(176, 115), Gfx::Color(0, 255, 0, 255)); + EXPECT_EQ(frame.image->get_pixel(290, 89), Gfx::Color(0, 0, 255, 255)); + EXPECT_EQ(frame.image->get_pixel(359, 73), Gfx::Color(0, 0, 0, 128)); } TEST_CASE(test_webp_extended_lossless_animated) |