aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qtest
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qtest')
-rw-r--r--examples/qtest/c-objects.test4
-rw-r--r--examples/qtest/custom-filter.test8
-rw-r--r--examples/qtest/extend-c-api.test30
-rw-r--r--examples/qtest/extend-c-api/bad.out5
-rw-r--r--examples/qtest/extend-c-api/bad.pdf1
-rw-r--r--examples/qtest/extend-c-api/good.out1
-rw-r--r--examples/qtest/extend-c-api/good.pdf64
-rw-r--r--examples/qtest/invert-images.test4
-rw-r--r--examples/qtest/overlay-page.test8
-rw-r--r--examples/qtest/qpdf-job/out.pdfbin1300 -> 1278 bytes
-rw-r--r--examples/qtest/qpdfjob-remove-annotations.test4
-rw-r--r--examples/qtest/set-form-values.test4
12 files changed, 117 insertions, 16 deletions
diff --git a/examples/qtest/c-objects.test b/examples/qtest/c-objects.test
index 9cd496f6..f10f60c7 100644
--- a/examples/qtest/c-objects.test
+++ b/examples/qtest/c-objects.test
@@ -17,8 +17,8 @@ foreach my $i (qw(1 2))
{$td->COMMAND => "pdf-c-objects $i.pdf '' a.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("check output",
- {$td->FILE => "a.pdf"},
- {$td->FILE => "$i-out.pdf"});
+ {$td->COMMAND => "qpdf-test-compare a.pdf $i-out.pdf"},
+ {$td->FILE => "$i-out.pdf", $td->EXIT_STATUS => 0});
}
cleanup();
diff --git a/examples/qtest/custom-filter.test b/examples/qtest/custom-filter.test
index e674ea66..2d8acec6 100644
--- a/examples/qtest/custom-filter.test
+++ b/examples/qtest/custom-filter.test
@@ -24,8 +24,8 @@ $td->runtest("custom filter, decode generalized",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("check output",
- {$td->FILE => "a.pdf"},
- {$td->FILE => "generalized.pdf"});
+ {$td->COMMAND => "qpdf-test-compare a.pdf generalized.pdf"},
+ {$td->FILE => "generalized.pdf", $td->EXIT_STATUS => 0});
$td->runtest("custom filter, decode specialized",
{$td->COMMAND =>
@@ -34,8 +34,8 @@ $td->runtest("custom filter, decode specialized",
$td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
$td->runtest("check output",
- {$td->FILE => "a.pdf"},
- {$td->FILE => "specialized.pdf"});
+ {$td->COMMAND => "qpdf-test-compare a.pdf specialized.pdf"},
+ {$td->FILE => "specialized.pdf", $td->EXIT_STATUS => 0});
cleanup();
diff --git a/examples/qtest/extend-c-api.test b/examples/qtest/extend-c-api.test
new file mode 100644
index 00000000..3dd82193
--- /dev/null
+++ b/examples/qtest/extend-c-api.test
@@ -0,0 +1,30 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+chdir("extend-c-api") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+cleanup();
+
+my $td = new TestDriver('extend-c-api');
+
+$td->runtest("extend C API (good)",
+ {$td->COMMAND => "extend-c-api good.pdf"},
+ {$td->FILE => "good.out", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("extend C API (bad)",
+ {$td->COMMAND => "extend-c-api bad.pdf"},
+ {$td->FILE => "bad.out", $td->EXIT_STATUS => 2},
+ $td->NORMALIZE_NEWLINES);
+
+cleanup();
+
+$td->report(2);
+
+sub cleanup
+{
+ unlink "a.pdf";
+}
diff --git a/examples/qtest/extend-c-api/bad.out b/examples/qtest/extend-c-api/bad.out
new file mode 100644
index 00000000..51f1d56b
--- /dev/null
+++ b/examples/qtest/extend-c-api/bad.out
@@ -0,0 +1,5 @@
+WARNING: bad.pdf: can't find PDF header
+WARNING: bad.pdf: file is damaged
+WARNING: bad.pdf: can't find startxref
+WARNING: bad.pdf: Attempting to reconstruct cross-reference table
+error: bad.pdf: unable to find trailer dictionary while recovering damaged file
diff --git a/examples/qtest/extend-c-api/bad.pdf b/examples/qtest/extend-c-api/bad.pdf
new file mode 100644
index 00000000..a3d2d925
--- /dev/null
+++ b/examples/qtest/extend-c-api/bad.pdf
@@ -0,0 +1 @@
+not even a pdf file
diff --git a/examples/qtest/extend-c-api/good.out b/examples/qtest/extend-c-api/good.out
new file mode 100644
index 00000000..98205fae
--- /dev/null
+++ b/examples/qtest/extend-c-api/good.out
@@ -0,0 +1 @@
+num pages = 1
diff --git a/examples/qtest/extend-c-api/good.pdf b/examples/qtest/extend-c-api/good.pdf
new file mode 100644
index 00000000..42867b96
--- /dev/null
+++ b/examples/qtest/extend-c-api/good.pdf
@@ -0,0 +1,64 @@
+%PDF-2.0
+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 612 792 ]
+ /Parent 2 0 R
+ /Resources <<
+ /Font << /F1 5 0 R >>
+ >>
+ /Type /Page
+>>
+endobj
+4 0 obj
+<<
+ /Length 44
+>>
+stream
+BT
+ /F1 24 Tf
+ 72 720 Td
+ (Potato) Tj
+ET
+endstream
+endobj
+5 0 obj
+<<
+ /BaseFont /Helvetica
+ /Encoding /WinAnsiEncoding
+ /Subtype /Type1
+ /Type /Font
+>>
+endobj
+
+xref
+0 6
+0000000000 65535 f
+0000000009 00000 n
+0000000062 00000 n
+0000000133 00000 n
+0000000277 00000 n
+0000000372 00000 n
+trailer <<
+ /Root 1 0 R
+ /Size 6
+ /ID [<42841c13bbf709d79a200fa1691836f8><b1d8b5838eeafe16125317aa78e666aa>]
+>>
+startxref
+478
+%%EOF
diff --git a/examples/qtest/invert-images.test b/examples/qtest/invert-images.test
index d1e3c939..7986d0fd 100644
--- a/examples/qtest/invert-images.test
+++ b/examples/qtest/invert-images.test
@@ -20,8 +20,8 @@ $td->runtest("invert images",
$td->NORMALIZE_NEWLINES);
$td->runtest("check output",
- {$td->FILE => "a.pdf"},
- {$td->FILE => "out.pdf"});
+ {$td->COMMAND => "qpdf-test-compare a.pdf out.pdf"},
+ {$td->FILE => "out.pdf", $td->EXIT_STATUS => 0});
cleanup();
diff --git a/examples/qtest/overlay-page.test b/examples/qtest/overlay-page.test
index be9bcb10..6440a367 100644
--- a/examples/qtest/overlay-page.test
+++ b/examples/qtest/overlay-page.test
@@ -15,15 +15,15 @@ $td->runtest("overlay-page",
{$td->COMMAND => "pdf-overlay-page in.pdf stamp.pdf a.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("compare files",
- {$td->FILE => "a.pdf"},
- {$td->FILE => "out.pdf"});
+ {$td->COMMAND => "qpdf-test-compare a.pdf out.pdf"},
+ {$td->FILE => "out.pdf", $td->EXIT_STATUS => 0});
$td->runtest("overlay-page with fields/ annotations",
{$td->COMMAND => "pdf-overlay-page in.pdf annotations.pdf a.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("compare files",
- {$td->FILE => "a.pdf"},
- {$td->FILE => "annotations-out.pdf"});
+ {$td->COMMAND => "qpdf-test-compare a.pdf annotations-out.pdf"},
+ {$td->FILE => "annotations-out.pdf", $td->EXIT_STATUS => 0});
cleanup();
diff --git a/examples/qtest/qpdf-job/out.pdf b/examples/qtest/qpdf-job/out.pdf
index c432ac59..d8ac1509 100644
--- a/examples/qtest/qpdf-job/out.pdf
+++ b/examples/qtest/qpdf-job/out.pdf
Binary files differ
diff --git a/examples/qtest/qpdfjob-remove-annotations.test b/examples/qtest/qpdfjob-remove-annotations.test
index 32abf3ef..06f8f07a 100644
--- a/examples/qtest/qpdfjob-remove-annotations.test
+++ b/examples/qtest/qpdfjob-remove-annotations.test
@@ -15,8 +15,8 @@ $td->runtest("remove-annotations",
{$td->COMMAND => "qpdfjob-remove-annotations --static-id annotations.pdf out.pdf"},
{$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("compare files",
- {$td->FILE => "out.pdf"},
- {$td->FILE => "annotations-out.pdf"});
+ {$td->COMMAND => "qpdf-test-compare out.pdf annotations-out.pdf"},
+ {$td->FILE => "annotations-out.pdf", $td->EXIT_STATUS => 0});
cleanup();
diff --git a/examples/qtest/set-form-values.test b/examples/qtest/set-form-values.test
index 8c103379..8d2fd2c8 100644
--- a/examples/qtest/set-form-values.test
+++ b/examples/qtest/set-form-values.test
@@ -15,8 +15,8 @@ $td->runtest("set form values",
{$td->COMMAND => "pdf-set-form-values form-in.pdf a.pdf soup"},
{$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("compare files",
- {$td->FILE => "a.pdf"},
- {$td->FILE => "form-out.pdf"});
+ {$td->COMMAND => "qpdf-test-compare a.pdf form-out.pdf"},
+ {$td->FILE => "form-out.pdf", $td->EXIT_STATUS => 0});
cleanup();