Commit c026b511961318c5453c871e35f08d8430d4d3bc
1 parent
018cf0eb
Add new object stream test case
Exercise stream containing objects with no white-space between them.
Showing
4 changed files
with
25 additions
and
2 deletions
qpdf/qtest/object-stream.test
| ... | ... | @@ -16,7 +16,7 @@ cleanup(); |
| 16 | 16 | |
| 17 | 17 | my $td = new TestDriver('object-stream'); |
| 18 | 18 | |
| 19 | -my $n_tests = 9 + (36 * 4) + (12 * 2); | |
| 19 | +my $n_tests = 10 + (36 * 4) + (12 * 2); | |
| 20 | 20 | my $n_compare_pdfs = 36; |
| 21 | 21 | |
| 22 | 22 | for (my $n = 16; $n <= 19; ++$n) |
| ... | ... | @@ -117,6 +117,14 @@ $td->runtest("check file", |
| 117 | 117 | {$td->FILE => "a.pdf"}, |
| 118 | 118 | {$td->FILE => "object-stream-self-ref.out.pdf"}); |
| 119 | 119 | |
| 120 | +# The file no-space-compressed-object.pdf contains an object stream containing two | |
| 121 | +# integer objects that are not separated by any white space. The test case exercises | |
| 122 | +# that all objects in the stream have the correct value. | |
| 123 | +$td->runtest("adjacent compressed objects", | |
| 124 | + {$td->COMMAND => "test_driver 99 no-space-compressed-object.pdf"}, | |
| 125 | + {$td->FILE => "no-space-compressed-object.out", | |
| 126 | + $td->EXIT_STATUS => 0}, | |
| 127 | + $td->EXPECT_FAILURE); | |
| 120 | 128 | |
| 121 | 129 | cleanup(); |
| 122 | 130 | $td->report(calc_ntests($n_tests, $n_compare_pdfs)); | ... | ... |
qpdf/qtest/qpdf/no-space-compressed-object.out
0 → 100644
qpdf/qtest/qpdf/no-space-compressed-object.pdf
0 → 100644
No preview for this file type
qpdf/test_driver.cc
| ... | ... | @@ -3453,6 +3453,16 @@ test_98(QPDF& pdf, char const* arg2) |
| 3453 | 3453 | "}"); |
| 3454 | 3454 | } |
| 3455 | 3455 | |
| 3456 | +static void | |
| 3457 | +test_99(QPDF& pdf, char const* arg2) | |
| 3458 | +{ | |
| 3459 | + // Designed for no-space-compressed-object.pdf | |
| 3460 | + QPDFObjectHandle qtest = pdf.getRoot().getKey("/QTest"); | |
| 3461 | + for (int i = 0; i < qtest.getArrayNItems(); ++i) { | |
| 3462 | + std::cout << qtest.getArrayItem(i).unparseResolved() << std::endl; | |
| 3463 | + } | |
| 3464 | +} | |
| 3465 | + | |
| 3456 | 3466 | void |
| 3457 | 3467 | runtest(int n, char const* filename1, char const* arg2) |
| 3458 | 3468 | { |
| ... | ... | @@ -3554,7 +3564,7 @@ runtest(int n, char const* filename1, char const* arg2) |
| 3554 | 3564 | {78, test_78}, {79, test_79}, {80, test_80}, {81, test_81}, {82, test_82}, {83, test_83}, |
| 3555 | 3565 | {84, test_84}, {85, test_85}, {86, test_86}, {87, test_87}, {88, test_88}, {89, test_89}, |
| 3556 | 3566 | {90, test_90}, {91, test_91}, {92, test_92}, {93, test_93}, {94, test_94}, {95, test_95}, |
| 3557 | - {96, test_96}, {97, test_97}, {98, test_98}}; | |
| 3567 | + {96, test_96}, {97, test_97}, {98, test_98}, {99, test_99}}; | |
| 3558 | 3568 | |
| 3559 | 3569 | auto fn = test_functions.find(n); |
| 3560 | 3570 | if (fn == test_functions.end()) { | ... | ... |