mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-26 09:30:24 +00:00
Tests: Add a pam cmyk test file
Hand-written in a text editor. I verified that `convert` converts it to a png that looks like the rgb test expectations.
This commit is contained in:
parent
c431cf4907
commit
c694d4326b
Notes:
sideshowbarker
2024-07-17 02:56:25 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/c694d4326b Pull-request: https://github.com/SerenityOS/serenity/pull/22935 Reviewed-by: https://github.com/LucasChollet ✅
2 changed files with 26 additions and 0 deletions
|
@ -457,6 +457,24 @@ TEST_CASE(test_pam_rgb)
|
|||
EXPECT_EQ(frame.image->get_pixel(1, 0), Gfx::Color('0', '0', 'z'));
|
||||
}
|
||||
|
||||
TEST_CASE(test_pam_cmyk)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("pnm/2x1-cmyk.pam"sv)));
|
||||
EXPECT(Gfx::PAMImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::PAMImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
EXPECT_EQ(plugin_decoder->natural_frame_format(), Gfx::NaturalFrameFormat::CMYK);
|
||||
auto cmyk_frame = TRY_OR_FAIL(plugin_decoder->cmyk_frame());
|
||||
EXPECT_EQ(cmyk_frame->size(), Gfx::IntSize(2, 1));
|
||||
EXPECT_EQ(cmyk_frame->begin()[0], (Gfx::CMYK { '0', 'z', '0', 'y' }));
|
||||
EXPECT_EQ(cmyk_frame->begin()[1], (Gfx::CMYK { '0', '0', 'z', 'y' }));
|
||||
|
||||
auto frame = TRY_OR_FAIL(expect_single_frame(*plugin_decoder));
|
||||
EXPECT_EQ(frame.image->size(), Gfx::IntSize(2, 1));
|
||||
EXPECT_EQ(frame.image->get_pixel(0, 0), Gfx::Color('l', 'E', 'l'));
|
||||
EXPECT_EQ(frame.image->get_pixel(1, 0), Gfx::Color('l', 'l', 'E'));
|
||||
}
|
||||
|
||||
TEST_CASE(test_pbm)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("pnm/buggie-raw.pbm"sv)));
|
||||
|
|
8
Tests/LibGfx/test-inputs/pnm/2x1-cmyk.pam
Normal file
8
Tests/LibGfx/test-inputs/pnm/2x1-cmyk.pam
Normal file
|
@ -0,0 +1,8 @@
|
|||
P7
|
||||
WIDTH 2
|
||||
HEIGHT 1
|
||||
DEPTH 4
|
||||
MAXVAL 255
|
||||
TUPLTYPE CMYK
|
||||
ENDHDR
|
||||
0z0y00zy
|
Loading…
Reference in a new issue