aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qtest/attach-file.test
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2021-02-18 02:14:04 +0100
committerJay Berkenbilt <ejb@ql.org>2021-02-18 15:59:03 +0100
commitf21e4f264ab285817bfad1698dbb8b8b300c9ece (patch)
tree42d4c7e4bd7198535b1317cdc100f82dae0d3241 /examples/qtest/attach-file.test
parent8873466a5d86decc3600af2df45552f2ee26ec80 (diff)
downloadqpdf-f21e4f264ab285817bfad1698dbb8b8b300c9ece.tar.zst
Add file attachment example
Diffstat (limited to 'examples/qtest/attach-file.test')
-rw-r--r--examples/qtest/attach-file.test35
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/qtest/attach-file.test b/examples/qtest/attach-file.test
new file mode 100644
index 00000000..9d8e7504
--- /dev/null
+++ b/examples/qtest/attach-file.test
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+require 5.008;
+use warnings;
+use strict;
+
+chdir("attach-file") or die "chdir testdir failed: $!\n";
+
+require TestDriver;
+
+cleanup();
+
+my $td = new TestDriver('attach-file');
+
+$td->runtest("attach file",
+ {$td->COMMAND =>
+ "pdf-attach-file --infile input.pdf" .
+ " --attachment ./potato.png" .
+ " --outfile a.pdf" .
+ " --mimetype image/png"},
+ {$td->STRING =>
+ "pdf-attach-file: attaching ./potato.png as potato.png\n",
+ $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check output",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "output.pdf"});
+
+cleanup();
+
+$td->report(2);
+
+sub cleanup
+{
+ unlink "a.pdf";
+}