Tests/JPEG2000: Add a simple JPEG2000 test

We can't decode any actual image data yet, but it shows that we can
read the basics of the container format. (...as long as there's an
Annex I container around the data, not just an Annex A codestream.
All files I've found so far have the container.)

I drew the thes input in Acorn.app and used "Save as..." to save it as
JPEG2000.  It's an RGBA image.
This commit is contained in:
Nico Weber 2024-03-22 18:55:53 -04:00 committed by Tim Schumacher
parent a92d887ee3
commit 9ec5a1591d
Notes: sideshowbarker 2024-07-17 00:23:42 +09:00
2 changed files with 10 additions and 0 deletions

View file

@ -14,6 +14,7 @@
#include <LibGfx/ImageFormats/ILBMLoader.h>
#include <LibGfx/ImageFormats/ImageDecoder.h>
#include <LibGfx/ImageFormats/JBIG2Loader.h>
#include <LibGfx/ImageFormats/JPEG2000Loader.h>
#include <LibGfx/ImageFormats/JPEGLoader.h>
#include <LibGfx/ImageFormats/JPEGXLLoader.h>
#include <LibGfx/ImageFormats/PAMLoader.h>
@ -569,6 +570,15 @@ TEST_CASE(test_jpeg_malformed_frame)
}
}
TEST_CASE(test_jpeg2000_simple)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("jpeg2000/simple.jp2"sv)));
EXPECT(Gfx::JPEG2000ImageDecoderPlugin::sniff(file->bytes()));
auto plugin_decoder = TRY_OR_FAIL(Gfx::JPEG2000ImageDecoderPlugin::create(file->bytes()));
EXPECT_EQ(plugin_decoder->size(), Gfx::IntSize(119, 101));
}
TEST_CASE(test_pam_rgb)
{
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("pnm/2x1.pam"sv)));

Binary file not shown.