aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/qpdf-json.test
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-05-20 17:10:12 +0200
committerJay Berkenbilt <ejb@ql.org>2022-05-20 17:10:12 +0200
commitd06509808957305ed01497568ddd81a2590362f8 (patch)
tree7431d6a0a03ed81e8f52ff563b42b1ebba78b30a /qpdf/qtest/qpdf-json.test
parentef955b04b5cfd1042dc1751bb4c82d79aff89f46 (diff)
downloadqpdf-d06509808957305ed01497568ddd81a2590362f8.tar.zst
Test --update-from-json
Diffstat (limited to 'qpdf/qtest/qpdf-json.test')
-rw-r--r--qpdf/qtest/qpdf-json.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/qpdf/qtest/qpdf-json.test b/qpdf/qtest/qpdf-json.test
index 9e92e27d..dda056a1 100644
--- a/qpdf/qtest/qpdf-json.test
+++ b/qpdf/qtest/qpdf-json.test
@@ -171,5 +171,35 @@ $td->runtest("check PDF",
{$td->FILE => "a.pdf"},
{$td->FILE => "b.pdf"});
+# Replace mode tests
+
+$n_tests += 1;
+$td->runtest("create PDF for replace",
+ {$td->COMMAND => "qpdf good13.pdf a.pdf" .
+ " --update-from-json=qpdf-json-update-errors.json"},
+ {$td->FILE => "update-from-json-errors.out",
+ $td->EXIT_STATUS => 2},
+ $td->NORMALIZE_NEWLINES);
+
+my @update_files = (
+ "update-stream-dict-only",
+ "update-stream-data",
+ "replace-with-stream",
+ "various-updates",
+ );
+$n_tests += 2 * scalar(@update_files);
+
+foreach my $f (@update_files) {
+ $td->runtest("update: $f",
+ {$td->COMMAND =>
+ "qpdf good13.pdf a.pdf --qdf --static-id" .
+ " --update-from-json=$f.json"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0});
+ $td->runtest("$f: check updated",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "$f-updated.pdf"});
+}
+
+
cleanup();
$td->report($n_tests);