Skip to content

Commit 95e1462

Browse files
committed
Tests/LibGfx: Add JBIG2 tests for refinement regions refining the page
The decode ok in Preview.app, Acrobat Reader, poppler, and HEAD PDFium.
1 parent e8d6b9c commit 95e1462

File tree

5 files changed

+112
-1
lines changed

5 files changed

+112
-1
lines changed

Tests/LibGfx/TestImageDecoder.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,8 @@ TEST_CASE(test_jbig2_decode)
366366
TEST_INPUT("jbig2/bitmap-trailing-7fff-stripped-harder.jbig2"sv),
367367
TEST_INPUT("jbig2/bitmap-trailing-7fff-stripped-harder-refine.jbig2"sv),
368368
TEST_INPUT("jbig2/bitmap-refine.jbig2"sv),
369+
TEST_INPUT("jbig2/bitmap-refine-page.jbig2"sv),
370+
TEST_INPUT("jbig2/bitmap-refine-page-subrect.jbig2"sv),
369371
TEST_INPUT("jbig2/bitmap-refine-customat.jbig2"sv),
370372
TEST_INPUT("jbig2/bitmap-refine-lossless.jbig2"sv),
371373
TEST_INPUT("jbig2/bitmap-refine-refine.jbig2"sv),
@@ -420,7 +422,6 @@ TEST_CASE(test_jbig2_decode)
420422
// - intermediate direct regions (code support added in #26197)
421423
// - symbol refinement referring to symbol in same segment
422424
// Missing tests for things that aren't implemented yet:
423-
// - immediate refinement regions not referring to a direct region (i.e. refining the page)
424425
// - exttemplate
425426
// - colors
426427
};
397 Bytes
Binary file not shown.
414 Bytes
Binary file not shown.
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"global_header": {
3+
"organization": "sequential",
4+
"number_of_pages": 1
5+
},
6+
"segments": [
7+
{
8+
"segment_number": 0,
9+
"type": "page_information",
10+
"page_association": 1,
11+
"data": {
12+
"page_width": 399,
13+
"page_height": 400,
14+
"flags": {
15+
"direct_region_segments_override_default_combination_operator": true
16+
}
17+
}
18+
},
19+
{
20+
"segment_number": 1,
21+
"type": "generic_region",
22+
"page_association": 1,
23+
"data": {
24+
"image_data": {
25+
"from_file": "bitmap-blemish.bmp"
26+
}
27+
}
28+
},
29+
{
30+
"segment_number": 2,
31+
"type": "generic_refinement_region",
32+
"page_association": 1,
33+
"data": {
34+
"region_segment_information": {
35+
"x": 10,
36+
"y": 20,
37+
"width": 110,
38+
"height": 380,
39+
"flags": {
40+
"external_combination_operator": "replace"
41+
}
42+
},
43+
"image_data": {
44+
"from_file": "bitmap.bmp",
45+
"crop": {
46+
"x": 10,
47+
"y": 20,
48+
"width": 110,
49+
"height": 380
50+
}
51+
}
52+
}
53+
},
54+
{
55+
"segment_number": 3,
56+
"type": "end_of_page",
57+
"page_association": 1
58+
}
59+
]
60+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
{
2+
"global_header": {
3+
"organization": "sequential",
4+
"number_of_pages": 1
5+
},
6+
"segments": [
7+
{
8+
"segment_number": 0,
9+
"type": "page_information",
10+
"page_association": 1,
11+
"data": {
12+
"page_width": 399,
13+
"page_height": 400,
14+
"flags": {
15+
"direct_region_segments_override_default_combination_operator": true
16+
}
17+
}
18+
},
19+
{
20+
"segment_number": 1,
21+
"type": "generic_region",
22+
"page_association": 1,
23+
"data": {
24+
"image_data": {
25+
"from_file": "bitmap-blemish.bmp"
26+
}
27+
}
28+
},
29+
{
30+
"segment_number": 2,
31+
"type": "generic_refinement_region",
32+
"page_association": 1,
33+
"data": {
34+
"region_segment_information": {
35+
"flags": {
36+
"external_combination_operator": "replace"
37+
}
38+
},
39+
"image_data": {
40+
"from_file": "bitmap.bmp"
41+
}
42+
}
43+
},
44+
{
45+
"segment_number": 3,
46+
"type": "end_of_page",
47+
"page_association": 1
48+
}
49+
]
50+
}

0 commit comments

Comments
 (0)