diff --git a/tests/resources/README.rst b/tests/resources/README.rst index c495ebdf..49ef8917 100644 --- a/tests/resources/README.rst +++ b/tests/resources/README.rst @@ -61,6 +61,9 @@ under the terms of the license in LICENSE.rst. * - cmyk.pdf - @jbarlow83 - a CMYK image created in Photoshop + * - crom.png + - @jbarlow83 + - test for non-dictionary words * - enormous.pdf - @jbarlow83 - very large PDF page @@ -69,7 +72,7 @@ under the terms of the license in LICENSE.rst. - a linearized PDF containing some unusual indirect objects, created by an Epson printer; printout of a Wikipedia article (CC BY-SA) * - formxobject.pdf - @jbarlow83 - - hand-crafted exotic PDF containing an image inside a Form XObject + - hand-crafted PDF containing an image inside a Form XObject * - francais.pdf - @jbarlow83 - a page containing French accents (diacritics) @@ -88,12 +91,12 @@ under the terms of the license in LICENSE.rst. * - overlay.pdf - @maxandersen - PDF file generated by PDFPen pro that triggered content stream parse errors + * - negzero.pdf + - @jbarlow83 + - copy of formxobject.pdf with token that qpdf doesn't like * - no_contents.pdf - @jbarlow83 - synthetic PDF with a blank page that has no /Contents entry - * - crom.png - - @jbarlow83 - - test for non-dictionary words Assemblies diff --git a/tests/resources/negzero.pdf b/tests/resources/negzero.pdf new file mode 100644 index 00000000..b45a360b Binary files /dev/null and b/tests/resources/negzero.pdf differ diff --git a/tests/test_main.py b/tests/test_main.py index fbdff777..b0612bc3 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -10,7 +10,7 @@ import PyPDF2 as pypdf from ocrmypdf.exceptions import ExitCode from ocrmypdf import leptonica from ocrmypdf.pdfa import file_claims_pdfa -from ocrmypdf.exec import ghostscript, tesseract +from ocrmypdf.exec import ghostscript, tesseract, qpdf import logging from math import isclose @@ -1016,4 +1016,12 @@ def test_bad_locale(): ) assert out == '', "stdout not clean" assert p.returncode != 0 - assert 'configured to use ASCII as encoding' in err, "should whine" \ No newline at end of file + assert 'configured to use ASCII as encoding' in err, "should whine" + + +def test_qpdf_negative_zero(resources, outpdf): + negzero = resources / 'negzero.pdf' + hugemono = resources / 'hugemono.pdf' + qpdf.merge([str(negzero), str(hugemono)], outpdf) # raises exception on err + + \ No newline at end of file