Skip to content

Commit

Permalink
Tests/JPEG2000: Add a simple JPEG2000 test
Browse files Browse the repository at this point in the history
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.)
  • Loading branch information
nico committed Mar 23, 2024
1 parent aa1a8fc commit 7501fa8
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Tests/LibGfx/TestImageDecoder.cpp
Expand Up @@ -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>
Expand Down Expand Up @@ -550,6 +551,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)));
Expand Down

0 comments on commit 7501fa8

Please sign in to comment.