mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-07 20:31:04 +03:00
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:
parent
a92d887ee3
commit
9ec5a1591d
Notes:
sideshowbarker
2024-07-17 00:23:42 +09:00
Author: https://github.com/nico Commit: https://github.com/SerenityOS/serenity/commit/9ec5a1591d Pull-request: https://github.com/SerenityOS/serenity/pull/23682 Reviewed-by: https://github.com/LucasChollet Reviewed-by: https://github.com/Zaggy1024 Reviewed-by: https://github.com/timschumi ✅
@ -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)));
|
||||
|
BIN
Tests/LibGfx/test-inputs/jpeg2000/simple.jp2
Normal file
BIN
Tests/LibGfx/test-inputs/jpeg2000/simple.jp2
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user