Commit a5ae042e2bf3f47cc25c43ab92ff9d93564de062
1 parent
31396f61
Add workaround for bug in ghostscript 9.56 (fixes #732)
Showing
1 changed file
with
21 additions
and
2 deletions
qpdf/qtest/qpdf_test_helpers.pm
| @@ -9,6 +9,23 @@ if ((exists $ENV{'QPDF_TEST_COMPARE_IMAGES'}) && | @@ -9,6 +9,23 @@ if ((exists $ENV{'QPDF_TEST_COMPARE_IMAGES'}) && | ||
| 9 | $compare_images = 1; | 9 | $compare_images = 1; |
| 10 | } | 10 | } |
| 11 | 11 | ||
| 12 | +chomp(my $gs_version = `gs --version`); | ||
| 13 | +my $x_gs_args = ""; | ||
| 14 | +if ($gs_version =~ m/^(\d+).(\d+)/) | ||
| 15 | +{ | ||
| 16 | + my $major = $1; | ||
| 17 | + my $minor = $2; | ||
| 18 | + if (($major == 9) && ($minor >= 56)) | ||
| 19 | + { | ||
| 20 | + # There are some PDF files in the test suite that ghostscript | ||
| 21 | + # 9.56, the first version to have the "new" PDF interpreter, | ||
| 22 | + # can't handle. The bug is fixed for 10.0.0. Fall back to the | ||
| 23 | + # old interpreter in the meantime. See | ||
| 24 | + # https://bugs.ghostscript.com/show_bug.cgi?id=705842 | ||
| 25 | + $x_gs_args = "-dNEWPDF=false"; | ||
| 26 | + } | ||
| 27 | +} | ||
| 28 | + | ||
| 12 | sub calc_ntests | 29 | sub calc_ntests |
| 13 | { | 30 | { |
| 14 | my ($n_tests, $n_compare_pdfs) = @_; | 31 | my ($n_tests, $n_compare_pdfs) = @_; |
| @@ -78,7 +95,8 @@ sub compare_pdfs | @@ -78,7 +95,8 @@ sub compare_pdfs | ||
| 78 | $td->runtest("convert original file to image", | 95 | $td->runtest("convert original file to image", |
| 79 | {$td->COMMAND => | 96 | {$td->COMMAND => |
| 80 | "(cd tif1;" . | 97 | "(cd tif1;" . |
| 81 | - " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" . | 98 | + " gs 2>$devNull $x_gs_args" . |
| 99 | + " -q -dNOPAUSE -sDEVICE=tiff24nc" . | ||
| 82 | " -sOutputFile=a.tif - < ../$f1)"}, | 100 | " -sOutputFile=a.tif - < ../$f1)"}, |
| 83 | {$td->STRING => "", | 101 | {$td->STRING => "", |
| 84 | $td->EXIT_STATUS => 0}); | 102 | $td->EXIT_STATUS => 0}); |
| @@ -97,7 +115,8 @@ sub compare_pdfs | @@ -97,7 +115,8 @@ sub compare_pdfs | ||
| 97 | $td->runtest("convert new file to image", | 115 | $td->runtest("convert new file to image", |
| 98 | {$td->COMMAND => | 116 | {$td->COMMAND => |
| 99 | "(cd tif2;" . | 117 | "(cd tif2;" . |
| 100 | - " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" . | 118 | + " gs 2>$devNull $x_gs_args" . |
| 119 | + " -q -dNOPAUSE -sDEVICE=tiff24nc" . | ||
| 101 | " -sOutputFile=a.tif - < ../$f2)"}, | 120 | " -sOutputFile=a.tif - < ../$f2)"}, |
| 102 | {$td->STRING => "", | 121 | {$td->STRING => "", |
| 103 | $td->EXIT_STATUS => 0}); | 122 | $td->EXIT_STATUS => 0}); |