summaryrefslogtreecommitdiffstats
path: root/qpdf/qtest
diff options
context:
space:
mode:
Diffstat (limited to 'qpdf/qtest')
-rw-r--r--qpdf/qtest/qpdf.test28
-rw-r--r--qpdf/qtest/qpdf/no-contents-check.out6
-rw-r--r--qpdf/qtest/qpdf/no-contents-coalesce-contents.pdf27
-rw-r--r--qpdf/qtest/qpdf/no-contents-none.pdf21
-rw-r--r--qpdf/qtest/qpdf/no-contents-qdf.pdf54
-rw-r--r--qpdf/qtest/qpdf/no-contents.pdf21
6 files changed, 157 insertions, 0 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test
index 877c3f5e..92a9412b 100644
--- a/qpdf/qtest/qpdf.test
+++ b/qpdf/qtest/qpdf.test
@@ -921,6 +921,34 @@ $td->runtest("check output",
show_ntests();
# ----------
+$td->notify("--- Page with no contents ---");
+$n_tests += 7;
+
+$td->runtest("check no contents",
+ {$td->COMMAND => "qpdf --check no-contents.pdf"},
+ {$td->FILE => "no-contents-check.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+
+foreach my $arg ('--qdf', '--coalesce-contents', '')
+{
+ $td->runtest("convert no contents ($arg)",
+ {$td->COMMAND =>
+ "qpdf $arg --static-id no-contents.pdf a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+
+ my $suf = $arg;
+ $suf =~ s/--//;
+ if ($suf eq '')
+ {
+ $suf = "none";
+ }
+ $td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "no-contents-$suf.pdf"});
+}
+
+show_ntests();
+# ----------
$td->notify("--- Token filters ---");
$n_tests += 2;
diff --git a/qpdf/qtest/qpdf/no-contents-check.out b/qpdf/qtest/qpdf/no-contents-check.out
new file mode 100644
index 00000000..ba195b0e
--- /dev/null
+++ b/qpdf/qtest/qpdf/no-contents-check.out
@@ -0,0 +1,6 @@
+checking no-contents.pdf
+PDF Version: 1.3
+File is not encrypted
+File is not linearized
+No syntax or stream encoding errors found; the file may still contain
+errors that qpdf cannot detect
diff --git a/qpdf/qtest/qpdf/no-contents-coalesce-contents.pdf b/qpdf/qtest/qpdf/no-contents-coalesce-contents.pdf
new file mode 100644
index 00000000..c77ad5c9
--- /dev/null
+++ b/qpdf/qtest/qpdf/no-contents-coalesce-contents.pdf
@@ -0,0 +1,27 @@
+%PDF-1.3
+%¿÷¢þ
+1 0 obj
+<< /Pages 2 0 R /Type /Catalog >>
+endobj
+2 0 obj
+<< /Count 1 /Kids [ 3 0 R ] /Type /Pages >>
+endobj
+3 0 obj
+<< /Contents 4 0 R /MediaBox [ 0 0 720 720 ] /Parent 2 0 R /Resources << >> /Type /Page >>
+endobj
+4 0 obj
+<< /Length 0 /Filter /FlateDecode >>
+stream
+endstream
+endobj
+xref
+0 5
+0000000000 65535 f
+0000000015 00000 n
+0000000064 00000 n
+0000000123 00000 n
+0000000229 00000 n
+trailer << /Root 1 0 R /Size 5 /ID [<52bba3c78160d0c6e851b59110e5d076><31415926535897932384626433832795>] >>
+startxref
+298
+%%EOF
diff --git a/qpdf/qtest/qpdf/no-contents-none.pdf b/qpdf/qtest/qpdf/no-contents-none.pdf
new file mode 100644
index 00000000..28f6b3b1
--- /dev/null
+++ b/qpdf/qtest/qpdf/no-contents-none.pdf
@@ -0,0 +1,21 @@
+%PDF-1.3
+%¿÷¢þ
+1 0 obj
+<< /Pages 2 0 R /Type /Catalog >>
+endobj
+2 0 obj
+<< /Count 1 /Kids [ 3 0 R ] /Type /Pages >>
+endobj
+3 0 obj
+<< /MediaBox [ 0 0 720 720 ] /Parent 2 0 R /Resources << >> /Type /Page >>
+endobj
+xref
+0 4
+0000000000 65535 f
+0000000015 00000 n
+0000000064 00000 n
+0000000123 00000 n
+trailer << /Root 1 0 R /Size 4 /ID [<52bba3c78160d0c6e851b59110e5d076><31415926535897932384626433832795>] >>
+startxref
+213
+%%EOF
diff --git a/qpdf/qtest/qpdf/no-contents-qdf.pdf b/qpdf/qtest/qpdf/no-contents-qdf.pdf
new file mode 100644
index 00000000..40511781
--- /dev/null
+++ b/qpdf/qtest/qpdf/no-contents-qdf.pdf
@@ -0,0 +1,54 @@
+%PDF-1.3
+%¿÷¢þ
+%QDF-1.0
+
+%% Original object ID: 1 0
+1 0 obj
+<<
+ /Pages 2 0 R
+ /Type /Catalog
+>>
+endobj
+
+%% Original object ID: 2 0
+2 0 obj
+<<
+ /Count 1
+ /Kids [
+ 3 0 R
+ ]
+ /Type /Pages
+>>
+endobj
+
+%% Page 1
+%% Original object ID: 3 0
+3 0 obj
+<<
+ /MediaBox [
+ 0
+ 0
+ 720
+ 720
+ ]
+ /Parent 2 0 R
+ /Resources <<
+ >>
+ /Type /Page
+>>
+endobj
+
+xref
+0 4
+0000000000 65535 f
+0000000052 00000 n
+0000000133 00000 n
+0000000242 00000 n
+trailer <<
+ /Root 1 0 R
+ /Size 4
+ /ID [<52bba3c78160d0c6e851b59110e5d076><31415926535897932384626433832795>]
+>>
+startxref
+361
+%%EOF
diff --git a/qpdf/qtest/qpdf/no-contents.pdf b/qpdf/qtest/qpdf/no-contents.pdf
new file mode 100644
index 00000000..aa26d580
--- /dev/null
+++ b/qpdf/qtest/qpdf/no-contents.pdf
@@ -0,0 +1,21 @@
+%PDF-1.3
+%¿÷¢þ
+1 0 obj
+<< /Pages 2 0 R /Type /Catalog >>
+endobj
+2 0 obj
+<< /Count 1 /Kids [ 3 0 R ] /Type /Pages >>
+endobj
+3 0 obj
+<< /MediaBox [ 0 0 720 720 ] /Parent 2 0 R /Resources << >> /Type /Page >>
+endobj
+xref
+0 4
+0000000000 65535 f
+0000000015 00000 n
+0000000064 00000 n
+0000000123 00000 n
+trailer << /Root 1 0 R /Size 4 /ID [<52bba3c78160d0c6e851b59110e5d076><52bba3c78160d0c6e851b59110e5d076>] >>
+startxref
+213
+%%EOF