aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-09-02 16:23:38 +0200
committerJay Berkenbilt <ejb@ql.org>2022-09-02 17:51:38 +0200
commita5ae042e2bf3f47cc25c43ab92ff9d93564de062 (patch)
tree13040ba14562a337576376865030bf8c122f2b90
parent31396f61c98ff955118f192f75bf02320c7a2abc (diff)
downloadqpdf-a5ae042e2bf3f47cc25c43ab92ff9d93564de062.tar.zst
Add workaround for bug in ghostscript 9.56 (fixes #732)
-rw-r--r--qpdf/qtest/qpdf_test_helpers.pm23
1 files changed, 21 insertions, 2 deletions
diff --git a/qpdf/qtest/qpdf_test_helpers.pm b/qpdf/qtest/qpdf_test_helpers.pm
index 9f6b7353..eca6b712 100644
--- a/qpdf/qtest/qpdf_test_helpers.pm
+++ b/qpdf/qtest/qpdf_test_helpers.pm
@@ -9,6 +9,23 @@ if ((exists $ENV{'QPDF_TEST_COMPARE_IMAGES'}) &&
$compare_images = 1;
}
+chomp(my $gs_version = `gs --version`);
+my $x_gs_args = "";
+if ($gs_version =~ m/^(\d+).(\d+)/)
+{
+ my $major = $1;
+ my $minor = $2;
+ if (($major == 9) && ($minor >= 56))
+ {
+ # There are some PDF files in the test suite that ghostscript
+ # 9.56, the first version to have the "new" PDF interpreter,
+ # can't handle. The bug is fixed for 10.0.0. Fall back to the
+ # old interpreter in the meantime. See
+ # https://bugs.ghostscript.com/show_bug.cgi?id=705842
+ $x_gs_args = "-dNEWPDF=false";
+ }
+}
+
sub calc_ntests
{
my ($n_tests, $n_compare_pdfs) = @_;
@@ -78,7 +95,8 @@ sub compare_pdfs
$td->runtest("convert original file to image",
{$td->COMMAND =>
"(cd tif1;" .
- " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" .
+ " gs 2>$devNull $x_gs_args" .
+ " -q -dNOPAUSE -sDEVICE=tiff24nc" .
" -sOutputFile=a.tif - < ../$f1)"},
{$td->STRING => "",
$td->EXIT_STATUS => 0});
@@ -97,7 +115,8 @@ sub compare_pdfs
$td->runtest("convert new file to image",
{$td->COMMAND =>
"(cd tif2;" .
- " gs 2>$devNull -q -dNOPAUSE -sDEVICE=tiff24nc" .
+ " gs 2>$devNull $x_gs_args" .
+ " -q -dNOPAUSE -sDEVICE=tiff24nc" .
" -sOutputFile=a.tif - < ../$f2)"},
{$td->STRING => "",
$td->EXIT_STATUS => 0});