diff options
Diffstat (limited to 'qpdf/qpdf-ctest.c')
-rw-r--r-- | qpdf/qpdf-ctest.c | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/qpdf/qpdf-ctest.c b/qpdf/qpdf-ctest.c index 23947b6b..d491b2a5 100644 --- a/qpdf/qpdf-ctest.c +++ b/qpdf/qpdf-ctest.c @@ -33,6 +33,105 @@ static void test01(char const* infile, report_errors(); } +static void test02(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_set_suppress_warnings(qpdf, QPDF_TRUE); + qpdf_read(qpdf, infile, password); + if (qpdf_init_write(qpdf, outfile) == QPDF_SUCCESS) + { + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_write(qpdf); + } + report_errors(); +} + +static void test03(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_read(qpdf, infile, password); + qpdf_init_write(qpdf, outfile); + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_set_content_normalization(qpdf, QPDF_TRUE); + qpdf_write(qpdf); + report_errors(); +} + +static void test04(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_set_ignore_xref_streams(qpdf, QPDF_TRUE); + qpdf_read(qpdf, infile, password); + qpdf_init_write(qpdf, outfile); + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_write(qpdf); + report_errors(); +} + +static void test05(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_read(qpdf, infile, password); + qpdf_init_write(qpdf, outfile); + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_set_linearization(qpdf, QPDF_TRUE); + qpdf_write(qpdf); + report_errors(); +} + +static void test06(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_read(qpdf, infile, password); + qpdf_init_write(qpdf, outfile); + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_set_object_stream_mode(qpdf, QPDF_OBJECT_STREAM_GENERATE); + qpdf_write(qpdf); + report_errors(); +} + +static void test07(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_read(qpdf, infile, password); + qpdf_init_write(qpdf, outfile); + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_set_qdf_mode(qpdf, QPDF_TRUE); + qpdf_write(qpdf); + report_errors(); +} + +static void test08(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_read(qpdf, infile, password); + qpdf_init_write(qpdf, outfile); + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_set_qdf_mode(qpdf, QPDF_TRUE); + qpdf_set_suppress_original_object_IDs(qpdf, QPDF_TRUE); + qpdf_write(qpdf); + report_errors(); +} + +static void test09(char const* infile, + char const* password, + char const* outfile) +{ + qpdf_read(qpdf, infile, password); + qpdf_init_write(qpdf, outfile); + qpdf_set_static_ID(qpdf, QPDF_TRUE); + qpdf_set_stream_data_mode(qpdf, QPDF_STREAM_DATA_UNCOMPRESS); + qpdf_write(qpdf); + report_errors(); +} + int main(int argc, char* argv[]) { char* whoami = 0; @@ -67,6 +166,14 @@ int main(int argc, char* argv[]) outfile = argv[4]; fn = ((n == 1) ? test01 : + (n == 2) ? test02 : + (n == 3) ? test03 : + (n == 4) ? test04 : + (n == 5) ? test05 : + (n == 6) ? test06 : + (n == 7) ? test07 : + (n == 8) ? test08 : + (n == 9) ? test09 : 0); if (fn == 0) |