mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:27:35 +00:00
LibGfx/JBIG2: Scan for the first PageInformation segment and decode it
This allows `file` to correctly print the dimensions of a .jbig2 file, and it allows us to write a test that covers much of all the code written so far.
This commit is contained in:
parent
1eaaa8c3e9
commit
8f4930f2df
2 changed files with 45 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
|||
#include <LibGfx/ImageFormats/ICOLoader.h>
|
||||
#include <LibGfx/ImageFormats/ILBMLoader.h>
|
||||
#include <LibGfx/ImageFormats/ImageDecoder.h>
|
||||
#include <LibGfx/ImageFormats/JBIG2Loader.h>
|
||||
#include <LibGfx/ImageFormats/JPEGLoader.h>
|
||||
#include <LibGfx/ImageFormats/JPEGXLLoader.h>
|
||||
#include <LibGfx/ImageFormats/PAMLoader.h>
|
||||
|
@ -316,6 +317,14 @@ TEST_CASE(test_ilbm_malformed_frame)
|
|||
}
|
||||
}
|
||||
|
||||
TEST_CASE(test_jbig2_size)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("jbig2/bitmap.jbig2"sv)));
|
||||
EXPECT(Gfx::JBIG2ImageDecoderPlugin::sniff(file->bytes()));
|
||||
auto plugin_decoder = TRY_OR_FAIL(Gfx::JBIG2ImageDecoderPlugin::create(file->bytes()));
|
||||
EXPECT_EQ(plugin_decoder->size(), Gfx::IntSize(399, 400));
|
||||
}
|
||||
|
||||
TEST_CASE(test_jpeg_sof0_one_scan)
|
||||
{
|
||||
auto file = TRY_OR_FAIL(Core::MappedFile::map(TEST_INPUT("jpg/rgb24.jpg"sv)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue