aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/qpdf-json.test
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-07-31 21:09:48 +0200
committerJay Berkenbilt <ejb@ql.org>2022-07-31 22:23:17 +0200
commit13cf35ce2f39780b5ce35fd65be4b0ae44ea989d (patch)
tree852a75987e75cf59290fc11de6b762b94eb01c49 /qpdf/qtest/qpdf-json.test
parent5f4224f31a500452a4f97f36ed57351b41ca0114 (diff)
downloadqpdf-13cf35ce2f39780b5ce35fd65be4b0ae44ea989d.tar.zst
Use calledgetallpages and pushedinheritedpageresources
Diffstat (limited to 'qpdf/qtest/qpdf-json.test')
-rw-r--r--qpdf/qtest/qpdf-json.test68
1 files changed, 68 insertions, 0 deletions
diff --git a/qpdf/qtest/qpdf-json.test b/qpdf/qtest/qpdf-json.test
index abd9fa49..481cdca9 100644
--- a/qpdf/qtest/qpdf-json.test
+++ b/qpdf/qtest/qpdf-json.test
@@ -214,5 +214,73 @@ $td->runtest("update-from-json object description",
{$td->FILE => "test-90.out", $td->EXIT_STATUS => 0},
$td->NORMALIZE_NEWLINES);
+# Exercise pushedinheritedpageresources and calledgetallpages
+$n_tests += 12;
+$td->runtest("call getAllPages",
+ {$td->COMMAND =>
+ "qpdf --json-output duplicate-page-inherited.pdf" .
+ " --json-key=pages a.json"},
+ {$td->FILE => "duplicate-page-inherited.out",
+ $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check json (1)",
+ {$td->FILE => "a.json"},
+ {$td->FILE => "duplicate-page-inherited-1.json"},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("update (1)",
+ {$td->COMMAND =>
+ "qpdf" .
+ " --update-from-json=duplicate-page-inherited-update.json" .
+ " --json-output duplicate-page-inherited.pdf" .
+ " a.json"},
+ {$td->FILE => "duplicate-page-inherited.out",
+ $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check json (2)",
+ {$td->FILE => "a.json"},
+ {$td->FILE => "duplicate-page-inherited-1-fixed.json"},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("create PDF (1)",
+ {$td->COMMAND =>
+ "qpdf --qdf --static-id --json-input a.json a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check PDF (1)",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "duplicate-page-inherited-1-fixed.pdf"});
+
+$td->runtest("call pushInheritedAttributesToPage",
+ {$td->COMMAND =>
+ "qpdf --json-output duplicate-page-inherited.pdf" .
+ " --json-key=pages --pages . -- a.json"},
+ {$td->FILE => "duplicate-page-inherited.out",
+ $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check json (2)",
+ {$td->FILE => "a.json"},
+ {$td->FILE => "duplicate-page-inherited-2.json"},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("update (2)",
+ {$td->COMMAND =>
+ "qpdf" .
+ " --update-from-json=duplicate-page-inherited-update2.json" .
+ " --json-output duplicate-page-inherited.pdf" .
+ " a.json"},
+ {$td->FILE => "duplicate-page-inherited.out",
+ $td->EXIT_STATUS => 3},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check json (3)",
+ {$td->FILE => "a.json"},
+ {$td->FILE => "duplicate-page-inherited-2-fixed.json"},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("create PDF (2)",
+ {$td->COMMAND =>
+ "qpdf --qdf --static-id --json-input a.json a.pdf"},
+ {$td->STRING => "", $td->EXIT_STATUS => 0},
+ $td->NORMALIZE_NEWLINES);
+$td->runtest("check PDF (2)",
+ {$td->FILE => "a.pdf"},
+ {$td->FILE => "duplicate-page-inherited-2-fixed.pdf"});
+
cleanup();
$td->report($n_tests);