summaryrefslogtreecommitdiff
path: root/Tests/LibGfx
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/LibGfx')
-rw-r--r--Tests/LibGfx/TestImageDecoder.cpp22
-rw-r--r--Tests/LibGfx/test-inputs/12-bit-progressive.jpgbin0 -> 12439 bytes
-rw-r--r--Tests/LibGfx/test-inputs/12-bit.jpgbin0 -> 12968 bytes
3 files changed, 22 insertions, 0 deletions
diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp
index 9faaecaa2f..b3b711885b 100644
--- a/Tests/LibGfx/TestImageDecoder.cpp
+++ b/Tests/LibGfx/TestImageDecoder.cpp
@@ -156,6 +156,28 @@ TEST_CASE(test_jpeg_sof2_successive_aproximation)
EXPECT_EQ(frame.image->size(), Gfx::IntSize(600, 800));
}
+TEST_CASE(test_jpeg_sof1_12bits)
+{
+ auto file = MUST(Core::MappedFile::map(TEST_INPUT("12-bit.jpg"sv)));
+ EXPECT(Gfx::JPEGImageDecoderPlugin::sniff(file->bytes()));
+ auto plugin_decoder = MUST(Gfx::JPEGImageDecoderPlugin::create(file->bytes()));
+ EXPECT(plugin_decoder->initialize());
+
+ auto frame = MUST(plugin_decoder->frame(0));
+ EXPECT_EQ(frame.image->size(), Gfx::IntSize(320, 240));
+}
+
+TEST_CASE(test_jpeg_sof2_12bits)
+{
+ auto file = MUST(Core::MappedFile::map(TEST_INPUT("12-bit-progressive.jpg"sv)));
+ EXPECT(Gfx::JPEGImageDecoderPlugin::sniff(file->bytes()));
+ auto plugin_decoder = MUST(Gfx::JPEGImageDecoderPlugin::create(file->bytes()));
+ EXPECT(plugin_decoder->initialize());
+
+ auto frame = MUST(plugin_decoder->frame(0));
+ EXPECT_EQ(frame.image->size(), Gfx::IntSize(320, 240));
+}
+
TEST_CASE(test_pbm)
{
auto file = MUST(Core::MappedFile::map(TEST_INPUT("buggie-raw.pbm"sv)));
diff --git a/Tests/LibGfx/test-inputs/12-bit-progressive.jpg b/Tests/LibGfx/test-inputs/12-bit-progressive.jpg
new file mode 100644
index 0000000000..a463f7b32c
--- /dev/null
+++ b/Tests/LibGfx/test-inputs/12-bit-progressive.jpg
Binary files differ
diff --git a/Tests/LibGfx/test-inputs/12-bit.jpg b/Tests/LibGfx/test-inputs/12-bit.jpg
new file mode 100644
index 0000000000..d7173d08e1
--- /dev/null
+++ b/Tests/LibGfx/test-inputs/12-bit.jpg
Binary files differ