Tests/LibGfx: Add a test for the TIFF decoder

This commit is contained in:
Lucas CHOLLET 2023-10-29 00:12:05 -04:00 committed by Andrew Kaster
parent 75caccafa4
commit 404093a42e
2 changed files with 13 additions and 0 deletions

View file

@ -20,6 +20,7 @@
#include <LibGfx/ImageFormats/PNGLoader.h>
#include <LibGfx/ImageFormats/PPMLoader.h>
#include <LibGfx/ImageFormats/TGALoader.h>
#include <LibGfx/ImageFormats/TIFFLoader.h>
#include <LibGfx/ImageFormats/TinyVGLoader.h>
#include <LibGfx/ImageFormats/WebPLoader.h>
#include <LibTest/TestCase.h>
@ -369,6 +370,18 @@ TEST_CASE(test_targa_top_left_compressed)
expect_single_frame(*plugin_decoder);
}
TEST_CASE(test_tiff_uncompressed)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("uncompressed.tiff"sv)));
EXPECT(Gfx::TIFFImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = MUST(Gfx::TIFFImageDecoderPlugin::create(file->bytes()));
auto frame = expect_single_frame_of_size(*plugin_decoder, { 400, 300 });
EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color::NamedColor::White);
EXPECT_EQ(frame.image->get_pixel(60, 75), Gfx::Color::NamedColor::Red);
}
TEST_CASE(test_webp_simple_lossy)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("webp/simple-vp8.webp"sv)));

Binary file not shown.