Files
serenity/Tests
Nico Weber cadb38af40 Tests/LibGfx: Add JBIG2 tests for text refinement with custom tables
There can be up to four custom huffman tables for refinement in
text regions. Text regions also must refer to at least one symbol
dictionary, so customizing all refinement tables means that a text
region refers to five other segments.

That causes issues, especially in other decoders, see #26393.

Also, Acrobat Reader apparently can't handle if the table that stores
refinement data sizes is customized.

So instead of adding a single test that customizes all four tables,
add a bunch of tests, with the goal of most of them decoding in
several other JBIG2 decoders.

1. Add a file with custom tables for refinement position.
   Decodes fine in PDFium, Acrobat Reader.
   Decodes mostly fine in Preview.app.

2. Add a file with custom tables for refinement dimensions.
   Decodes fine in PDFium, Acrobat Reader.
   Decodes mostly fine in Preview.app.

3. Add a file with custom tables for refinement data size.
   Decodes fine in PDFium.
   Decodes mostly fine in Preview.app.

4. Add a file with custom tables for refinement position and
   dimensions. This has 5 referred-to segments.
   Decodes fine in Acrobat Reader (and HEAD PDFium).
   Decodes mostly fine in Preview.app.

5. Finally, add one with all customized.
   PDFium can decode this as of a few hours ago, but nothing else can.
   (Preview.app comes fairly close.) Given that it's just a combination
   of tests 1-4 and those all decode fine somewhere, there's some hope
   to believe that the test itself is correct.

For the contents of the custom huffman tables, I used the same
contents as in the default huffman tables (B.14 for the first four,
B.1 for the last), but changed them a bit. For B.14, I put the 1-length
symbol in each of the four slots that it isn't in the normal B.14 table,
and for B.1 I swapped the first two entries.
2025-11-13 18:20:54 -05:00
..
2024-04-24 16:50:01 -04:00
2024-04-24 16:50:01 -04:00