diff options
Diffstat (limited to 'qpdf')
-rw-r--r-- | qpdf/qtest/qpdf.test | 14 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/linearized-and-warnings-1.out | 52 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/linearized-and-warnings-2.out | 54 | ||||
-rw-r--r-- | qpdf/qtest/qpdf/linearized-and-warnings.pdf | bin | 0 -> 1310 bytes | |||
-rw-r--r-- | qpdf/test_driver.cc | 17 |
5 files changed, 136 insertions, 1 deletions
diff --git a/qpdf/qtest/qpdf.test b/qpdf/qtest/qpdf.test index fd787364..8257633d 100644 --- a/qpdf/qtest/qpdf.test +++ b/qpdf/qtest/qpdf.test @@ -111,7 +111,7 @@ $td->runtest("new stream", show_ntests(); # ---------- $td->notify("--- Miscellaneous Tests ---"); -$n_tests += 26; +$n_tests += 28; $td->runtest("qpdf version", {$td->COMMAND => "qpdf --version"}, @@ -245,6 +245,18 @@ $td->runtest("empty object", $td->EXIT_STATUS => 3}, $td->NORMALIZE_NEWLINES); +$td->runtest("error/output redirection to null", + {$td->COMMAND => "test_driver 12 linearized-and-warnings.pdf"}, + {$td->FILE => "linearized-and-warnings-1.out", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); + +$td->runtest("error/output redirection to strings", + {$td->COMMAND => "test_driver 13 linearized-and-warnings.pdf"}, + {$td->FILE => "linearized-and-warnings-2.out", + $td->EXIT_STATUS => 0}, + $td->NORMALIZE_NEWLINES); + show_ntests(); # ---------- $td->notify("--- Error Condition Tests ---"); diff --git a/qpdf/qtest/qpdf/linearized-and-warnings-1.out b/qpdf/qtest/qpdf/linearized-and-warnings-1.out new file mode 100644 index 00000000..954181f6 --- /dev/null +++ b/qpdf/qtest/qpdf/linearized-and-warnings-1.out @@ -0,0 +1,52 @@ +WARNING: linearized-and-warnings.pdf (object 2 0, file position 1117): empty object treated as null +linearized-and-warnings.pdf: linearization data: + +file_size: 1310 +first_page_object: 6 +first_page_end: 1044 +npages: 1 +xref_zero_offset: 1132 +first_page: 0 +H_offset: 528 +H_length: 118 + +Page Offsets Hint Table + +min_nobjects: 4 +first_page_offset: 646 +nbits_delta_nobjects: 0 +min_page_length: 398 +nbits_delta_page_length: 0 +min_content_offset: 0 +nbits_delta_content_offset: 0 +min_content_length: 398 +nbits_delta_content_length: 0 +nbits_nshared_objects: 0 +nbits_shared_identifier: 3 +nbits_shared_numerator: 0 +shared_denominator: 4 +Page 0: + nobjects: 4 + length: 398 + content_offset: 0 + content_length: 398 + nshared_objects: 0 + +Shared Objects Hint Table + +first_shared_obj: 0 +first_shared_offset: 0 +nshared_first_page: 4 +nshared_total: 4 +nbits_nobjects: 0 +min_group_length: 30 +nbits_delta_group_length: 7 +Shared Object 0: + group length: 143 +Shared Object 1: + group length: 118 +Shared Object 2: + group length: 30 +Shared Object 3: + group length: 107 +test 12 done diff --git a/qpdf/qtest/qpdf/linearized-and-warnings-2.out b/qpdf/qtest/qpdf/linearized-and-warnings-2.out new file mode 100644 index 00000000..d8d17b7c --- /dev/null +++ b/qpdf/qtest/qpdf/linearized-and-warnings-2.out @@ -0,0 +1,54 @@ +---output--- +linearized-and-warnings.pdf: linearization data: + +file_size: 1310 +first_page_object: 6 +first_page_end: 1044 +npages: 1 +xref_zero_offset: 1132 +first_page: 0 +H_offset: 528 +H_length: 118 + +Page Offsets Hint Table + +min_nobjects: 4 +first_page_offset: 646 +nbits_delta_nobjects: 0 +min_page_length: 398 +nbits_delta_page_length: 0 +min_content_offset: 0 +nbits_delta_content_offset: 0 +min_content_length: 398 +nbits_delta_content_length: 0 +nbits_nshared_objects: 0 +nbits_shared_identifier: 3 +nbits_shared_numerator: 0 +shared_denominator: 4 +Page 0: + nobjects: 4 + length: 398 + content_offset: 0 + content_length: 398 + nshared_objects: 0 + +Shared Objects Hint Table + +first_shared_obj: 0 +first_shared_offset: 0 +nshared_first_page: 4 +nshared_total: 4 +nbits_nobjects: 0 +min_group_length: 30 +nbits_delta_group_length: 7 +Shared Object 0: + group length: 143 +Shared Object 1: + group length: 118 +Shared Object 2: + group length: 30 +Shared Object 3: + group length: 107 +---error--- +WARNING: linearized-and-warnings.pdf (object 2 0, file position 1117): empty object treated as null +test 13 done diff --git a/qpdf/qtest/qpdf/linearized-and-warnings.pdf b/qpdf/qtest/qpdf/linearized-and-warnings.pdf Binary files differnew file mode 100644 index 00000000..44037566 --- /dev/null +++ b/qpdf/qtest/qpdf/linearized-and-warnings.pdf diff --git a/qpdf/test_driver.cc b/qpdf/test_driver.cc index 3127503a..c7b6a6b4 100644 --- a/qpdf/test_driver.cc +++ b/qpdf/test_driver.cc @@ -10,6 +10,7 @@ #include <qpdf/Pl_Flate.hh> #include <qpdf/QPDFWriter.hh> #include <iostream> +#include <sstream> #include <stdio.h> #include <string.h> #include <stdlib.h> @@ -502,6 +503,22 @@ void runtest(int n, char const* filename) std::cout << "raw stream data okay" << std::endl; } } + else if (n == 12) + { + pdf.setOutputStreams(0, 0); + pdf.showLinearizationData(); + } + else if (n == 13) + { + std::ostringstream out; + std::ostringstream err; + pdf.setOutputStreams(&out, &err); + pdf.showLinearizationData(); + std::cout << "---output---" << std::endl + << out.str() + << "---error---" << std::endl + << err.str(); + } else { throw std::runtime_error(std::string("invalid test ") + |