mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
Tests/LibGfx: Add a test for bilevel images with only required tags
Bilevel images are not required to have a BitsPerSample or a SamplesPerPixel tag, while this is unusual these images are still valid. The test case has been generated by first making a copy of ccitt3_1d_fill.tiff and then, using `tiffset` to remove both tags: tiffset -u 258 ccitt3_no_tags.tiff tiffset -u 277 ccitt3_no_tags.tiff
This commit is contained in:
parent
cd1eeb3cdd
commit
ed1bdf3851
Notes:
sideshowbarker
2024-07-17 07:20:57 +09:00
Author: https://github.com/LucasChollet Commit: https://github.com/SerenityOS/serenity/commit/ed1bdf3851 Pull-request: https://github.com/SerenityOS/serenity/pull/24251 Reviewed-by: https://github.com/nico ✅
2 changed files with 14 additions and 0 deletions
|
@ -864,6 +864,20 @@ TEST_CASE(test_tiff_ccitt3)
|
|||
EXPECT_EQ(frame.image->get_pixel(60, 75), Gfx::Color::NamedColor::Black);
|
||||
}
|
||||
|
||||
TEST_CASE(test_tiff_ccitt3_no_tags)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("tiff/ccitt3_no_tags.tiff"sv)));
|
||||
EXPECT(Gfx::TIFFImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::TIFFImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
auto frame = TRY_OR_FAIL(expect_single_frame_of_size(*plugin_decoder, { 6, 4 }));
|
||||
|
||||
EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color::NamedColor::White);
|
||||
EXPECT_EQ(frame.image->get_pixel(3, 0), Gfx::Color::NamedColor::Black);
|
||||
EXPECT_EQ(frame.image->get_pixel(2, 2), Gfx::Color::NamedColor::White);
|
||||
EXPECT_EQ(frame.image->get_pixel(5, 3), Gfx::Color::NamedColor::White);
|
||||
}
|
||||
|
||||
TEST_CASE(test_tiff_ccitt3_fill)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("tiff/ccitt3_1d_fill.tiff"sv)));
|
||||
|
|
BIN
Tests/LibGfx/test-inputs/tiff/ccitt3_no_tags.tiff
Normal file
BIN
Tests/LibGfx/test-inputs/tiff/ccitt3_no_tags.tiff
Normal file
Binary file not shown.
Loading…
Reference in a new issue