Skip to content

Commit 2a19bf7

Browse files
committed
Tests/LibGfx: Add JBIG2 text region compositing tests
The tests are identical to the tests added in #26244 commits 4 (d569dff) and 5 (1f23b65), but with text regions instead of generic refinement regions.
1 parent 1bce159 commit 2a19bf7

File tree

5 files changed

+690
-0
lines changed

5 files changed

+690
-0
lines changed

Tests/LibGfx/TestImageDecoder.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,8 +339,10 @@ TEST_CASE(test_jbig2_decode)
339339
TEST_INPUT("jbig2/bitmap-initially-unknown-size.jbig2"sv),
340340
TEST_INPUT("jbig2/bitmap-composite-and-xnor.jbig2"sv),
341341
TEST_INPUT("jbig2/bitmap-composite-and-xnor-refine.jbig2"sv),
342+
TEST_INPUT("jbig2/bitmap-composite-and-xnor-text.jbig2"sv),
342343
TEST_INPUT("jbig2/bitmap-composite-or-xor-replace.jbig2"sv),
343344
TEST_INPUT("jbig2/bitmap-composite-or-xor-replace-refine.jbig2"sv),
345+
TEST_INPUT("jbig2/bitmap-composite-or-xor-replace-text.jbig2"sv),
344346
TEST_INPUT("jbig2/bitmap-customat.jbig2"sv),
345347
TEST_INPUT("jbig2/bitmap-tpgdon.jbig2"sv),
346348
TEST_INPUT("jbig2/bitmap-customat-tpgdon.jbig2"sv),
529 Bytes
Binary file not shown.
Binary file not shown.
Lines changed: 322 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,322 @@
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+
"default_color": "black",
16+
"direct_region_segments_override_default_combination_operator": true
17+
}
18+
}
19+
},
20+
21+
{
22+
"segment_number": 1,
23+
"type": "symbol_dictionary",
24+
"page_association": 1,
25+
"retained": true,
26+
"data": {
27+
"height_classes": [
28+
{
29+
"symbols": [
30+
{
31+
"image_data": {
32+
"from_file": "bitmap.bmp",
33+
"crop": {
34+
"x": 60,
35+
"y": 265,
36+
"width": 35,
37+
"height": 35
38+
}
39+
}
40+
},
41+
{
42+
"image_data": {
43+
"from_file": "bitmap.bmp",
44+
"crop": {
45+
"x": 50,
46+
"y": 108,
47+
"width": 35,
48+
"height": 35
49+
}
50+
}
51+
}
52+
]
53+
},
54+
{
55+
"symbols": [
56+
{
57+
"image_data": {
58+
"from_file": "bitmap.bmp",
59+
"crop": {
60+
"x": 135,
61+
"y": 100,
62+
"width": 100,
63+
"height": 100
64+
}
65+
}
66+
}
67+
]
68+
},
69+
{
70+
"symbols": [
71+
{
72+
"image_data": {
73+
"from_file": "bitmap.bmp",
74+
"crop": {
75+
"x": 232,
76+
"y": 70,
77+
"width": 120,
78+
"height": 250
79+
}
80+
}
81+
}
82+
]
83+
}
84+
]
85+
}
86+
},
87+
88+
{
89+
"segment_number": 2,
90+
"type": "lossless_text_region",
91+
"page_association": 1,
92+
"referred_to_segments": [
93+
{
94+
"segment_number": 1,
95+
"retained": true
96+
}
97+
],
98+
"data": {
99+
"region_segment_information": {
100+
"x": 0,
101+
"y": 0,
102+
"width": 141,
103+
"height": 400,
104+
"flags": {
105+
"external_combination_operator": "and"
106+
}
107+
},
108+
"flags": {
109+
"strip_size": 2,
110+
"reference_corner": "top_left"
111+
},
112+
"initial_strip_t": -2,
113+
"strips": [
114+
{
115+
"strip_t": 108,
116+
"instances": [
117+
{
118+
"instance_s": 50,
119+
"instance_t": 108,
120+
"symbol_id": 1
121+
}
122+
]
123+
},
124+
{
125+
"strip_t": 264,
126+
"instances": [
127+
{
128+
"instance_s": 60,
129+
"instance_t": 265,
130+
"symbol_id": 0
131+
}
132+
]
133+
}
134+
]
135+
}
136+
},
137+
{
138+
"segment_number": 3,
139+
"type": "lossless_text_region",
140+
"page_association": 1,
141+
"referred_to_segments": [
142+
{
143+
"segment_number": 1,
144+
"retained": true
145+
}
146+
],
147+
"data": {
148+
"region_segment_information": {
149+
"x": 0,
150+
"y": 0,
151+
"width": 141,
152+
"height": 400,
153+
"flags": {
154+
"external_combination_operator": "and"
155+
}
156+
},
157+
"flags": {
158+
"strip_size": 2,
159+
"reference_corner": "top_left"
160+
},
161+
"initial_strip_t": -2,
162+
"strips": [
163+
{
164+
"strip_t": 108,
165+
"instances": [
166+
{
167+
"instance_s": 50,
168+
"instance_t": 108,
169+
"symbol_id": 1
170+
}
171+
]
172+
},
173+
{
174+
"strip_t": 264,
175+
"instances": [
176+
{
177+
"instance_s": 60,
178+
"instance_t": 265,
179+
"symbol_id": 0
180+
}
181+
]
182+
}
183+
]
184+
}
185+
},
186+
187+
{
188+
"segment_number": 4,
189+
"type": "lossless_text_region",
190+
"page_association": 1,
191+
"referred_to_segments": [
192+
{
193+
"segment_number": 1,
194+
"retained": true
195+
}
196+
],
197+
"data": {
198+
"region_segment_information": {
199+
"x": 141,
200+
"y": 0,
201+
"width": 258,
202+
"height": 400,
203+
"flags": {
204+
"external_combination_operator": "xnor"
205+
}
206+
},
207+
"flags": {
208+
"strip_size": 2,
209+
"reference_corner": "top_left"
210+
},
211+
"initial_strip_t": -2,
212+
"strips": [
213+
{
214+
"strip_t": 70,
215+
"instances": [
216+
{
217+
"instance_s": 91,
218+
"instance_t": 70,
219+
"symbol_id": 3
220+
}
221+
]
222+
},
223+
{
224+
"strip_t": 100,
225+
"instances": [
226+
{
227+
"instance_s": -6,
228+
"instance_t": 100,
229+
"symbol_id": 2
230+
}
231+
]
232+
}
233+
]
234+
}
235+
},
236+
237+
{
238+
"segment_number": 5,
239+
"type": "lossless_text_region",
240+
"page_association": 1,
241+
"referred_to_segments": [
242+
{
243+
"segment_number": 1,
244+
"retained": true
245+
}
246+
],
247+
"data": {
248+
"region_segment_information": {
249+
"x": 60,
250+
"y": 190,
251+
"width": 23,
252+
"height": 23,
253+
"flags": {
254+
"external_combination_operator": "xnor"
255+
}
256+
},
257+
"flags": {
258+
"strip_size": 2,
259+
"reference_corner": "top_left"
260+
},
261+
"initial_strip_t": -2,
262+
"strips": [
263+
{
264+
"strip_t": 0,
265+
"instances": [
266+
{
267+
"instance_s": 0,
268+
"instance_t": 0,
269+
"symbol_id": 0
270+
}
271+
]
272+
}
273+
]
274+
}
275+
},
276+
{
277+
"segment_number": 6,
278+
"type": "lossless_text_region",
279+
"page_association": 1,
280+
"referred_to_segments": [
281+
{
282+
"segment_number": 1,
283+
"retained": false
284+
}
285+
],
286+
"data": {
287+
"region_segment_information": {
288+
"x": 60,
289+
"y": 190,
290+
"width": 23,
291+
"height": 23,
292+
"flags": {
293+
"external_combination_operator": "xnor"
294+
}
295+
},
296+
"flags": {
297+
"strip_size": 2,
298+
"reference_corner": "top_left"
299+
},
300+
"initial_strip_t": -2,
301+
"strips": [
302+
{
303+
"strip_t": 0,
304+
"instances": [
305+
{
306+
"instance_s": 0,
307+
"instance_t": 0,
308+
"symbol_id": 0
309+
}
310+
]
311+
}
312+
]
313+
}
314+
},
315+
316+
{
317+
"segment_number": 7,
318+
"type": "end_of_page",
319+
"page_association": 1
320+
}
321+
]
322+
}

0 commit comments

Comments
 (0)