aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/qpdf/QPDFJob.hh1
-rw-r--r--include/qpdf/auto_job_c_main.hh1
-rw-r--r--job.sums14
-rw-r--r--job.yml2
-rw-r--r--libqpdf/QPDFJob.cc1
-rw-r--r--libqpdf/QPDFJob_config.cc7
-rw-r--r--libqpdf/qpdf/auto_job_help.hh7
-rw-r--r--libqpdf/qpdf/auto_job_init.hh1
-rw-r--r--libqpdf/qpdf/auto_job_json_init.hh3
-rw-r--r--libqpdf/qpdf/auto_job_schema.hh1
-rw-r--r--manual/cli.rst10
11 files changed, 41 insertions, 7 deletions
diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh
index de0e585d..2f9d1984 100644
--- a/include/qpdf/QPDFJob.hh
+++ b/include/qpdf/QPDFJob.hh
@@ -633,6 +633,7 @@ class QPDFJob
int json_version;
std::set<std::string> json_keys;
std::set<std::string> json_objects;
+ bool test_json_schema;
bool check;
bool optimize_images;
bool externalize_inline_images;
diff --git a/include/qpdf/auto_job_c_main.hh b/include/qpdf/auto_job_c_main.hh
index 0444ddaa..af400e04 100644
--- a/include/qpdf/auto_job_c_main.hh
+++ b/include/qpdf/auto_job_c_main.hh
@@ -43,6 +43,7 @@ QPDF_DLL Config* staticAesIv();
QPDF_DLL Config* staticId();
QPDF_DLL Config* suppressPasswordRecovery();
QPDF_DLL Config* suppressRecovery();
+QPDF_DLL Config* testJsonSchema();
QPDF_DLL Config* verbose();
QPDF_DLL Config* warningExit0();
QPDF_DLL Config* withImages();
diff --git a/job.sums b/job.sums
index bf2cc5c4..5bbb7688 100644
--- a/job.sums
+++ b/job.sums
@@ -3,15 +3,15 @@ generate_auto_job 0514289f2deb3bf7c1a6e85ef7d99ad120321ef5a6fe49d76c5274c6a658d3
include/qpdf/auto_job_c_att.hh 4c2b171ea00531db54720bf49a43f8b34481586ae7fb6cbf225099ee42bc5bb4
include/qpdf/auto_job_c_copy_att.hh 50609012bff14fd82f0649185940d617d05d530cdc522185c7f3920a561ccb42
include/qpdf/auto_job_c_enc.hh 28446f3c32153a52afa239ea40503e6cc8ac2c026813526a349e0cd4ae17ddd5
-include/qpdf/auto_job_c_main.hh 4ba9bcb8be945f6a3ffa0df3becdb8488b6eaf45dd914d8b714d948e17b5ad5d
+include/qpdf/auto_job_c_main.hh 940aa6f1ead18ed08ba33f11254e9f042348262c85b91de742f0427094412a80
include/qpdf/auto_job_c_pages.hh b3cc0f21029f6d89efa043dcdbfa183cb59325b6506001c18911614fe8e568ec
include/qpdf/auto_job_c_uo.hh ae21b69a1efa9333050f4833d465f6daff87e5b38e5106e49bbef5d4132e4ed1
-job.yml c2937bb06818fc3bffe54c6c069a4a06db7f3c841958c2da1b2f4a33978fd24a
+job.yml 3c130913b3546f272c06b334ece9aa70450449539db10e39673b5ee79d863f48
libqpdf/qpdf/auto_job_decl.hh 74df4d7fdbdf51ecd0d58ce1e9844bb5525b9adac5a45f7c9a787ecdda2868df
-libqpdf/qpdf/auto_job_help.hh a7d7edc3b270f2488778426646bb68dcad036727db4be87d1da9993e2a007634
-libqpdf/qpdf/auto_job_init.hh 6bd71c2ae4ba80e81fe5ae5517ba72abf53a3146f66864f99eeebc7d224998a5
+libqpdf/qpdf/auto_job_help.hh a3d1a326a3f8ff61a7d451176acde3bb6c8ad66c1ea7a0b8c5d789917ad3a9ee
+libqpdf/qpdf/auto_job_init.hh c8477a597f037d7de5fd131b008a75f1fe435bba248261abe422e8bfb24c8755
libqpdf/qpdf/auto_job_json_decl.hh 06caa46eaf71db8a50c046f91866baa8087745a9474319fb7c86d92634cc8297
-libqpdf/qpdf/auto_job_json_init.hh 06d51f11c117011256e175386eee9946441f3c22b49dd91fc591bbc1fa3bbeec
-libqpdf/qpdf/auto_job_schema.hh 43273b9edfc48b1f4cccbff1d2b31916a9057c474ef97d2936b2f1f14170885b
+libqpdf/qpdf/auto_job_json_init.hh e7047a7c83737adfaae49abc295a579bb9b9e0a4644e911d1656a604cb202208
+libqpdf/qpdf/auto_job_schema.hh cbbcae166cfecbdbdeb40c5a30870e03604a019a8b4f7a217d554a82431d2e5f
manual/_ext/qpdf.py 6add6321666031d55ed4aedf7c00e5662bba856dfcd66ccb526563bffefbb580
-manual/cli.rst 70258db13d89b0476248e9703bf5f50ffe28fce2a179dfeca241582dd28b455c
+manual/cli.rst 8a5a12351df6a42f91d6d271b2d065a843d8daa5125d8723d474e4180d7abbf1
diff --git a/job.yml b/job.yml
index 7d830b1a..5e9000b2 100644
--- a/job.yml
+++ b/job.yml
@@ -127,6 +127,7 @@ options:
- static-id
- suppress-password-recovery
- suppress-recovery
+ - test-json-schema
- underlay
- verbose
- warning-exit-0
@@ -352,6 +353,7 @@ json:
keep-files-open-threshold:
no-warn:
verbose:
+ test-json-schema:
ignore-xref-streams:
password-is-hex-key:
password-mode:
diff --git a/libqpdf/QPDFJob.cc b/libqpdf/QPDFJob.cc
index 0b35a289..1e456f24 100644
--- a/libqpdf/QPDFJob.cc
+++ b/libqpdf/QPDFJob.cc
@@ -400,6 +400,7 @@ QPDFJob::Members::Members() :
flatten_rotation(false),
list_attachments(false),
json_version(0),
+ test_json_schema(false),
check(false),
optimize_images(false),
externalize_inline_images(false),
diff --git a/libqpdf/QPDFJob_config.cc b/libqpdf/QPDFJob_config.cc
index 032a6492..621499c1 100644
--- a/libqpdf/QPDFJob_config.cc
+++ b/libqpdf/QPDFJob_config.cc
@@ -261,6 +261,13 @@ QPDFJob::Config::jsonObject(std::string const& parameter)
}
QPDFJob::Config*
+QPDFJob::Config::testJsonSchema()
+{
+ o.m->test_json_schema = true;
+ return this;
+}
+
+QPDFJob::Config*
QPDFJob::Config::keepFilesOpen(std::string const& parameter)
{
o.m->keep_files_open_set = true;
diff --git a/libqpdf/qpdf/auto_job_help.hh b/libqpdf/qpdf/auto_job_help.hh
index 388b861f..55d2cc63 100644
--- a/libqpdf/qpdf/auto_job_help.hh
+++ b/libqpdf/qpdf/auto_job_help.hh
@@ -835,6 +835,12 @@ Write the first pass of linearization to the named file. The
resulting file is not a valid PDF file. This option is useful only
for debugging qpdf.
)");
+ap.addOptionHelp("--test-json-schema", "testing", "test generated json against schema", R"(This is used by qpdf's test suite to check consistency between
+the output of qpdf --json and the output of qpdf --json-help.
+)");
+}
+static void add_help_8(QPDFArgParser& ap)
+{
}
static void add_help(QPDFArgParser& ap)
{
@@ -845,6 +851,7 @@ static void add_help(QPDFArgParser& ap)
add_help_5(ap);
add_help_6(ap);
add_help_7(ap);
+ add_help_8(ap);
ap.addHelpFooter("For detailed help, visit the qpdf manual: https://qpdf.readthedocs.io\n");
}
diff --git a/libqpdf/qpdf/auto_job_init.hh b/libqpdf/qpdf/auto_job_init.hh
index 5483cbb2..74155b80 100644
--- a/libqpdf/qpdf/auto_job_init.hh
+++ b/libqpdf/qpdf/auto_job_init.hh
@@ -77,6 +77,7 @@ this->ap.addBare("static-aes-iv", [this](){c_main->staticAesIv();});
this->ap.addBare("static-id", [this](){c_main->staticId();});
this->ap.addBare("suppress-password-recovery", [this](){c_main->suppressPasswordRecovery();});
this->ap.addBare("suppress-recovery", [this](){c_main->suppressRecovery();});
+this->ap.addBare("test-json-schema", [this](){c_main->testJsonSchema();});
this->ap.addBare("underlay", b(&ArgParser::argUnderlay));
this->ap.addBare("verbose", [this](){c_main->verbose();});
this->ap.addBare("warning-exit-0", [this](){c_main->warningExit0();});
diff --git a/libqpdf/qpdf/auto_job_json_init.hh b/libqpdf/qpdf/auto_job_json_init.hh
index 3c83ec2d..b2516469 100644
--- a/libqpdf/qpdf/auto_job_json_init.hh
+++ b/libqpdf/qpdf/auto_job_json_init.hh
@@ -267,6 +267,9 @@ popHandler(); // key: noWarn
pushKey("verbose");
addBare([this]() { c_main->verbose(); });
popHandler(); // key: verbose
+pushKey("testJsonSchema");
+addBare([this]() { c_main->testJsonSchema(); });
+popHandler(); // key: testJsonSchema
pushKey("ignoreXrefStreams");
addBare([this]() { c_main->ignoreXrefStreams(); });
popHandler(); // key: ignoreXrefStreams
diff --git a/libqpdf/qpdf/auto_job_schema.hh b/libqpdf/qpdf/auto_job_schema.hh
index 557af9ee..267dad23 100644
--- a/libqpdf/qpdf/auto_job_schema.hh
+++ b/libqpdf/qpdf/auto_job_schema.hh
@@ -89,6 +89,7 @@ static constexpr char const* JOB_SCHEMA_DATA = R"({
"keepFilesOpenThreshold": "set threshold for keepFilesOpen",
"noWarn": "suppress printing of warning messages",
"verbose": "print additional information",
+ "testJsonSchema": "test generated json against schema",
"ignoreXrefStreams": "use xref tables rather than streams",
"passwordIsHexKey": "provide hex-encoded encryption key",
"passwordMode": "tweak how qpdf encodes passwords",
diff --git a/manual/cli.rst b/manual/cli.rst
index 2f2b5108..a853afd3 100644
--- a/manual/cli.rst
+++ b/manual/cli.rst
@@ -3327,6 +3327,16 @@ Related Options
inspection of the file before values calculated in pass 1 are
inserted into the file for pass 2.
+.. qpdf:option:: --test-json-schema
+
+ .. help: test generated json against schema
+
+ This is used by qpdf's test suite to check consistency between
+ the output of qpdf --json and the output of qpdf --json-help.
+
+ This is used by qpdf's test suite to check consistency between the
+ output of ``qpdf --json`` and the output of ``qpdf --json-help``.
+
.. _unicode-passwords:
Unicode Passwords