aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/specific_file.test
diff options
context:
space:
mode:
Diffstat (limited to 'qpdf/qtest/specific_file.test')
-rw-r--r--qpdf/qtest/specific_file.test67
1 files changed, 67 insertions, 0 deletions
diff --git a/qpdf/qtest/specific_file.test b/qpdf/qtest/specific_file.test
new file mode 100644
index 00000000..ce170e12
--- /dev/null
+++ b/qpdf/qtest/specific_file.test
@@ -0,0 +1,67 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+unshift(@INC, '.');
+require qpdf_test_helpers;
+
+chdir("qpdf") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+cleanup();
+
+my $td = new TestDriver('specific_file');
+
+my $n_tests = 11;
+
+# Special PDF files that caused problems at some point
+
+$td->runtest("damaged stream",
+ {$td->COMMAND => "qpdf --check damaged-stream.pdf"},
+ {$td->FILE => "damaged-stream.out", $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("damaged stream (C)",
+ {$td->COMMAND => "qpdf-ctest 2 damaged-stream.pdf '' a.pdf"},
+ {$td->FILE => "damaged-stream-c-check.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("compress objstm and xref",
+ {$td->COMMAND =>
+ "qpdf --static-id --stream-data=compress".
+ " --object-streams=generate minimal.pdf a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "compress-objstm-xref.pdf"});
+$td->runtest("qdf + preserved-unreferenced + xref streams",
+ {$td->COMMAND => "qpdf --qdf --preserve-unreferenced" .
+ " --static-id compress-objstm-xref.pdf a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "compress-objstm-xref-qdf.pdf"});
+$td->runtest("check fix-qdf idempotency",
+ {$td->COMMAND => "fix-qdf a.pdf"},
+ {$td->FILE => "a.pdf", $td->EXIT_STATUS => 0});
+$td->runtest("pages points to page",
+ {$td->COMMAND =>
+ "qpdf --static-id --linearize pages-is-page.pdf a.pdf"},
+ {$td->FILE => "pages-is-page.out", $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "pages-is-page-out.pdf"});
+$td->runtest("Acroform /DR with indirect subkey",
+ {$td->COMMAND =>
+ "qpdf --static-id --empty" .
+ " --pages dr-with-indirect-item.pdf -- a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "dr-with-indirect-item-out.pdf"});
+
+cleanup();
+$td->report($n_tests);