v6.1.4 fix test suite regression with Ghostscript 9.23

This commit is contained in:
James R. Barlow
2018-04-12 15:16:54 -07:00
parent 1f7837e7b1
commit 10aa59f674
3 changed files with 19 additions and 4 deletions
+2
View File
@@ -16,6 +16,8 @@ v6.1.4
- The test cache was updated to reflect the change above.
- Change test suite to accommodate Ghostscript 9.23's new ability to insert JPEGs into PDFs without transcoding. An apparent `regression in Ghostscript 9.23 <https://bugs.ghostscript.com/show_bug.cgi?id=699216>`_ will cause some ocrmypdf output files to become invalid in rare cases; the workaround for the moment is to set ``--force-ocr``.
- XMP metadata in PDFs is now examined using ``defusedxml`` for safety.
- If an external process exits with a signal when asked to report its version, we now print the system error message instead of suppressing it. This occurred when the required executable was found but was missing a shared library.
+1 -1
View File
@@ -137,7 +137,7 @@ def generate_pdfa(pdf_pages, output_file, compression, log,
"-dNumRenderingThreads=" + str(threads),
"-sDEVICE=pdfwrite",
"-dAutoRotatePages=/None",
"-sColorConversionStrategy=/RGB",
"-sColorConversionStrategy=RGB",
"-sProcessColorModel=DeviceRGB"
] + compression_args + [
"-dJPEGQ=95",
+16 -3
View File
@@ -607,7 +607,14 @@ def test_closed_streams(spoof_tesseract_noop, ocrmypdf_exec, resources, outpdf):
def test_masks(spoof_tesseract_noop, resources, outpdf):
check_ocrmypdf(resources / 'masks.pdf', outpdf, env=spoof_tesseract_noop)
p, out, err = run_ocrmypdf(
resources / 'masks.pdf', outpdf, env=spoof_tesseract_noop)
if ghostscript.version() == '9.23' and \
p.returncode == ExitCode.invalid_output_pdf:
pytest.xfail('https://bugs.ghostscript.com/show_bug.cgi?id=699216')
assert p.returncode == ExitCode.ok
def test_linearized_pdf_and_indirect_object(spoof_tesseract_noop,
@@ -898,8 +905,14 @@ def test_compression_changed(spoof_tesseract_noop, ocrmypdf_exec,
if compression == "jpeg":
assert pdfimage.enc == Encoding.jpeg
elif compression == 'lossless':
assert pdfimage.enc not in (Encoding.jpeg, Encoding.jpeg2000)
else:
if ghostscript.version() >= '9.23':
# Ghostscript 9.23 adds JPEG passthrough, which allows a JPEG to be
# copied without transcoding - so report
if image.endswith('jpg'):
assert pdfimage.enc == Encoding.jpeg
else:
assert pdfimage.enc not in (Encoding.jpeg, Encoding.jpeg2000)
if im.mode.startswith('RGB') or im.mode.startswith('BGR'):
assert pdfimage.color == Colorspace.rgb, \