From 67875ecb6fdfe082adf5130794d7c34cf747ce77 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 2 Apr 2024 14:13:26 -0700 Subject: [PATCH] Tests/JBIG2: Add tests for non-topleft text segment reference corners This already worked fine. Now it's tested. I did have to teach `jbig2` to correctly generate test files for this. See the PR adding these tests for local changes. I used the script from #23659 to create these images, but I replaced these lines: ``` -txt -Param -numInst 4 -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232 -txt -Param -RefCorner 2 ``` For `bottomleft`, I replaced them with: ``` -txt -Param -numInst 4 -ID 2 137 50 -ID 3 294 60 -ID 1 199 135 -ID 0 319 232 -txt -Param -RefCorner 0 ``` For `bottomright`, I replaced them with: ``` -txt -Param -numInst 4 -ID 2 108 50 -ID 3 265 60 -ID 1 100 135 -ID 0 70 232 -txt -Param -RefCorner 2 ``` For `topright`, I replaced them with: ``` -txt -Param -numInst 4 -ID 2 108 79 -ID 3 265 89 -ID 1 100 234 -ID 0 70 351 -txt -Param -RefCorner 3 ``` All three new files display fine in Chrome. The bottomleft one displays fine in Firefox, while the other two look compressed in X. I think this is a bug in pdf.js that I'll report upstream. (Reportedly they look fine in Acrobat on Android.) --- Tests/LibGfx/TestImageDecoder.cpp | 3 +++ .../jbig2/bitmap-symbol-textbottomleft.jbig2 | Bin 0 -> 409 bytes .../jbig2/bitmap-symbol-textbottomright.jbig2 | Bin 0 -> 409 bytes .../jbig2/bitmap-symbol-texttopright.jbig2 | Bin 0 -> 409 bytes 4 files changed, 3 insertions(+) create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-symbol-textbottomleft.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-symbol-textbottomright.jbig2 create mode 100644 Tests/LibGfx/test-inputs/jbig2/bitmap-symbol-texttopright.jbig2 diff --git a/Tests/LibGfx/TestImageDecoder.cpp b/Tests/LibGfx/TestImageDecoder.cpp index 8a88381bfbc..fafb443a55d 100644 --- a/Tests/LibGfx/TestImageDecoder.cpp +++ b/Tests/LibGfx/TestImageDecoder.cpp @@ -366,6 +366,9 @@ TEST_CASE(test_jbig2_decode) TEST_INPUT("jbig2/bitmap-symbol.jbig2"sv), TEST_INPUT("jbig2/bitmap-symbol-textrefine.jbig2"sv), TEST_INPUT("jbig2/bitmap-symbol-symbolrefine.jbig2"sv), + TEST_INPUT("jbig2/bitmap-symbol-textbottomleft.jbig2"sv), + TEST_INPUT("jbig2/bitmap-symbol-textbottomright.jbig2"sv), + TEST_INPUT("jbig2/bitmap-symbol-texttopright.jbig2"sv), TEST_INPUT("jbig2/bitmap-symbol-texttranspose.jbig2"sv), }; diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-symbol-textbottomleft.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-symbol-textbottomleft.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..d3542d7dbffd177a5f86eab508eb6f03f917cdad GIT binary patch literal 409 zcmbR4y(#y7P*qK^NmAg_;ioR>q5SBP2TO8!)||e%}nl_U(#9K zW6z}S=eB!LWoJ;hNM3&RG2SoF@91W2d+c!RNyq=XS5vJI*(mPn|1!u``-yeGTp-XUXh~@OCqBzF< zNr79u>(+iy)7-G~Ovbl+0<0mb_vE%(e?8Fkto)?mrU(3IFU?Ty(#y7P*qK^NmAg_;ioR>q5SBP2TO8!)||e%}nl_U(#9K zW6z}S=eB!LWoJ;hNM3&RG2SoF@91W2d+c!RNyq=XS5vJI*(mPn|1!u``-yeGTp-XUXh~@OCqBzF< zNr79u>(+iy)7-G~Ovbl+0<0mb_vE%(e?8Fkto)?mrU(3IFU?TR literal 0 HcmV?d00001 diff --git a/Tests/LibGfx/test-inputs/jbig2/bitmap-symbol-texttopright.jbig2 b/Tests/LibGfx/test-inputs/jbig2/bitmap-symbol-texttopright.jbig2 new file mode 100644 index 0000000000000000000000000000000000000000..a21f3365802ac7741e1927595d003c932bce9d46 GIT binary patch literal 409 zcmbR4y(#y7P*qK^NmAg_;ioR>q5SBP2TO8!)||e%}nl_U(#9K zW6z}S=eB!LWoJ;hNM3&RG2SoF@91W2d+c!RNyq=XS5vJI*(mPn|1!u``-yeGTp-XUXh~@OCqBzF< zNr79u>(+iy)7-G~Ovbl+0<0mb_vE%(e?8Fkto)?mrU(3IFU?T