mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 10:57:34 +00:00
Tests/LibGfx: Add tests for top-left and bottom-left TGA images
This commit is contained in:
parent
a46df41265
commit
6bf2460231
3 changed files with 33 additions and 0 deletions
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
Binary file not shown.
After Width: | Height: | Size: 64 KiB |
|
@ -16,6 +16,7 @@
|
||||||
#include <LibGfx/PGMLoader.h>
|
#include <LibGfx/PGMLoader.h>
|
||||||
#include <LibGfx/PNGLoader.h>
|
#include <LibGfx/PNGLoader.h>
|
||||||
#include <LibGfx/PPMLoader.h>
|
#include <LibGfx/PPMLoader.h>
|
||||||
|
#include <LibGfx/TGALoader.h>
|
||||||
#include <LibTest/TestCase.h>
|
#include <LibTest/TestCase.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -143,3 +144,35 @@ TEST_CASE(test_ppm)
|
||||||
auto frame = ppm.frame(0).release_value_but_fixme_should_propagate_errors();
|
auto frame = ppm.frame(0).release_value_but_fixme_should_propagate_errors();
|
||||||
EXPECT(frame.duration == 0);
|
EXPECT(frame.duration == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE(test_targa_bottom_left)
|
||||||
|
{
|
||||||
|
auto file = Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-bottom-left-uncompressed.tga"sv).release_value();
|
||||||
|
auto tga = Gfx::TGAImageDecoderPlugin(reinterpret_cast<u8 const*>(file->data()), file->size());
|
||||||
|
EXPECT_EQ(tga.frame_count(), 1u);
|
||||||
|
|
||||||
|
EXPECT(tga.sniff());
|
||||||
|
EXPECT(!tga.is_animated());
|
||||||
|
EXPECT(!tga.loop_count());
|
||||||
|
|
||||||
|
auto frame_or_error = tga.frame(0);
|
||||||
|
EXPECT(!frame_or_error.is_error());
|
||||||
|
auto frame = frame_or_error.release_value();
|
||||||
|
EXPECT(frame.duration == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE(test_targa_top_left)
|
||||||
|
{
|
||||||
|
auto file = Core::MappedFile::map("/res/html/misc/targasuite_files/buggie-top-left-uncompressed.tga"sv).release_value();
|
||||||
|
auto tga = Gfx::TGAImageDecoderPlugin(reinterpret_cast<u8 const*>(file->data()), file->size());
|
||||||
|
EXPECT_EQ(tga.frame_count(), 1u);
|
||||||
|
|
||||||
|
EXPECT(tga.sniff());
|
||||||
|
EXPECT(!tga.is_animated());
|
||||||
|
EXPECT(!tga.loop_count());
|
||||||
|
|
||||||
|
auto frame_or_error = tga.frame(0);
|
||||||
|
EXPECT(!frame_or_error.is_error());
|
||||||
|
auto frame = frame_or_error.release_value();
|
||||||
|
EXPECT(frame.duration == 0);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue