mirror of
https://github.com/SerenityOS/serenity
synced 2024-07-22 10:36:24 +00:00
Tests: Add a pam test file
Hand-written in a text editor. I verified that `convert` converts it to a png that looks like the test expectations.
This commit is contained in:
parent
556addc5cb
commit
ba8f4e73bf
|
@ -15,6 +15,7 @@
|
|||
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
||||
#include <LibGfx/ImageFormats/JPEGLoader.h>
|
||||
#include <LibGfx/ImageFormats/JPEGXLLoader.h>
|
||||
#include <LibGfx/ImageFormats/PAMLoader.h>
|
||||
#include <LibGfx/ImageFormats/PBMLoader.h>
|
||||
#include <LibGfx/ImageFormats/PGMLoader.h>
|
||||
#include <LibGfx/ImageFormats/PNGLoader.h>
|
||||
|
@ -444,6 +445,18 @@ TEST_CASE(test_jpeg_malformed_frame)
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_pam_rgb)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("pnm/2x1.pam"sv)));
|
||||
EXPECT(Gfx::PAMImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::PAMImageDecoderPlugin::create(file->bytes()));
|
||||
|
||||
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('0', 'z', '0'));
|
||||
EXPECT_EQ(frame.image->get_pixel(1, 0), Gfx::Color('0', '0', 'z'));
|
||||
}
|
||||
|
||||
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.pam
Normal file
8
Tests/LibGfx/test-inputs/pnm/2x1.pam
Normal file
|
@ -0,0 +1,8 @@
|
|||
P7
|
||||
WIDTH 2
|
||||
HEIGHT 1
|
||||
DEPTH 3
|
||||
MAXVAL 255
|
||||
TUPLTYPE RGB
|
||||
ENDHDR
|
||||
0z000z
|
Loading…
Reference in a new issue