diff options
author | Jay Berkenbilt <ejb@ql.org> | 2023-12-21 23:14:28 +0100 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2023-12-21 23:43:29 +0100 |
commit | 4400ce84eeb204cdcb35950dd8fde094fc249051 (patch) | |
tree | 2a60ae462f22d21b35214a3fdaa4af5d63f8b149 /qpdf/qtest/qpdf-json.test | |
parent | bb12a7ff8df1582a2cb0583bc463a84f5a736219 (diff) | |
download | qpdf-4400ce84eeb204cdcb35950dd8fde094fc249051.tar.zst |
Add "n:/pdf-name" to qpdf JSON for binary names (fixes #1072)
Diffstat (limited to 'qpdf/qtest/qpdf-json.test')
-rw-r--r-- | qpdf/qtest/qpdf-json.test | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/qpdf/qtest/qpdf-json.test b/qpdf/qtest/qpdf-json.test index 961b507a..9691d995 100644 --- a/qpdf/qtest/qpdf-json.test +++ b/qpdf/qtest/qpdf-json.test @@ -61,6 +61,7 @@ my @goodfiles = ( 'form-fields-and-annotations.pdf', 'need-appearances.pdf', 'fxo-blue.pdf', + 'weird-tokens.pdf', ); $n_tests += 6 * scalar(@goodfiles); @@ -341,5 +342,21 @@ $td->runtest("check C API write to JSON stream", {$td->FILE => "auto-4"}, {$td->FILE => "qpdf-ctest-47-4"}); +# Bugs #1072 and #1079 illustrate cases that qpdf-json got wrong. In +# #1072, it was noticed that name tokens containing binary characters +# (using #xx) would generate invalid JSON, even though qpdf's own JSON +# parser would accept it. Also, the JSON spec allows real numbers in +# scientific notation, but the PDF spec does not. +$n_tests += 2; +$td->runtest("handle binary names", + {$td->COMMAND => + "qpdf --json-output weird-tokens.pdf a.json"}, + {$td->STRING => "", $td->EXIT_STATUS => 0}); +# Round-trip is tested above. +$td->runtest("check json", + {$td->FILE => "a.json"}, + {$td->FILE => "weird-tokens.json"}, + $td->NORMALIZE_NEWLINES); + cleanup(); $td->report($n_tests); |