Commit c67634afa045b9b1e54c85942c14982ac68678e7
1 parent
49621ef5
Fix tests when running comparison tool is adequate
Fix all tests where the only required fix is to run qpdf-test-compare instead of doing a simple file comparison.
Showing
31 changed files
with
116 additions
and
114 deletions
examples/CMakeLists.txt
| @@ -45,6 +45,7 @@ add_test( | @@ -45,6 +45,7 @@ add_test( | ||
| 45 | --top ${qpdf_SOURCE_DIR} | 45 | --top ${qpdf_SOURCE_DIR} |
| 46 | --bin $<TARGET_FILE_DIR:pdf-create> | 46 | --bin $<TARGET_FILE_DIR:pdf-create> |
| 47 | --bin $<TARGET_FILE_DIR:qpdf> | 47 | --bin $<TARGET_FILE_DIR:qpdf> |
| 48 | + --bin $<TARGET_FILE_DIR:qpdf-test-compare> | ||
| 48 | --bin $<TARGET_FILE_DIR:libqpdf> # for Windows to find DLL | 49 | --bin $<TARGET_FILE_DIR:libqpdf> # for Windows to find DLL |
| 49 | --code ${qpdf_SOURCE_DIR}/examples | 50 | --code ${qpdf_SOURCE_DIR}/examples |
| 50 | --color ${QTEST_COLOR} | 51 | --color ${QTEST_COLOR} |
examples/qtest/c-objects.test
| @@ -17,8 +17,8 @@ foreach my $i (qw(1 2)) | @@ -17,8 +17,8 @@ foreach my $i (qw(1 2)) | ||
| 17 | {$td->COMMAND => "pdf-c-objects $i.pdf '' a.pdf"}, | 17 | {$td->COMMAND => "pdf-c-objects $i.pdf '' a.pdf"}, |
| 18 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 18 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 19 | $td->runtest("check output", | 19 | $td->runtest("check output", |
| 20 | - {$td->FILE => "a.pdf"}, | ||
| 21 | - {$td->FILE => "$i-out.pdf"}); | 20 | + {$td->COMMAND => "qpdf-test-compare a.pdf $i-out.pdf"}, |
| 21 | + {$td->FILE => "$i-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | cleanup(); | 24 | cleanup(); |
examples/qtest/custom-filter.test
| @@ -24,8 +24,8 @@ $td->runtest("custom filter, decode generalized", | @@ -24,8 +24,8 @@ $td->runtest("custom filter, decode generalized", | ||
| 24 | $td->EXIT_STATUS => 0}, | 24 | $td->EXIT_STATUS => 0}, |
| 25 | $td->NORMALIZE_NEWLINES); | 25 | $td->NORMALIZE_NEWLINES); |
| 26 | $td->runtest("check output", | 26 | $td->runtest("check output", |
| 27 | - {$td->FILE => "a.pdf"}, | ||
| 28 | - {$td->FILE => "generalized.pdf"}); | 27 | + {$td->COMMAND => "qpdf-test-compare a.pdf generalized.pdf"}, |
| 28 | + {$td->FILE => "generalized.pdf", $td->EXIT_STATUS => 0}); | ||
| 29 | 29 | ||
| 30 | $td->runtest("custom filter, decode specialized", | 30 | $td->runtest("custom filter, decode specialized", |
| 31 | {$td->COMMAND => | 31 | {$td->COMMAND => |
| @@ -34,8 +34,8 @@ $td->runtest("custom filter, decode specialized", | @@ -34,8 +34,8 @@ $td->runtest("custom filter, decode specialized", | ||
| 34 | $td->EXIT_STATUS => 0}, | 34 | $td->EXIT_STATUS => 0}, |
| 35 | $td->NORMALIZE_NEWLINES); | 35 | $td->NORMALIZE_NEWLINES); |
| 36 | $td->runtest("check output", | 36 | $td->runtest("check output", |
| 37 | - {$td->FILE => "a.pdf"}, | ||
| 38 | - {$td->FILE => "specialized.pdf"}); | 37 | + {$td->COMMAND => "qpdf-test-compare a.pdf specialized.pdf"}, |
| 38 | + {$td->FILE => "specialized.pdf", $td->EXIT_STATUS => 0}); | ||
| 39 | 39 | ||
| 40 | cleanup(); | 40 | cleanup(); |
| 41 | 41 |
examples/qtest/invert-images.test
| @@ -20,8 +20,8 @@ $td->runtest("invert images", | @@ -20,8 +20,8 @@ $td->runtest("invert images", | ||
| 20 | $td->NORMALIZE_NEWLINES); | 20 | $td->NORMALIZE_NEWLINES); |
| 21 | 21 | ||
| 22 | $td->runtest("check output", | 22 | $td->runtest("check output", |
| 23 | - {$td->FILE => "a.pdf"}, | ||
| 24 | - {$td->FILE => "out.pdf"}); | 23 | + {$td->COMMAND => "qpdf-test-compare a.pdf out.pdf"}, |
| 24 | + {$td->FILE => "out.pdf", $td->EXIT_STATUS => 0}); | ||
| 25 | 25 | ||
| 26 | cleanup(); | 26 | cleanup(); |
| 27 | 27 |
examples/qtest/overlay-page.test
| @@ -15,15 +15,15 @@ $td->runtest("overlay-page", | @@ -15,15 +15,15 @@ $td->runtest("overlay-page", | ||
| 15 | {$td->COMMAND => "pdf-overlay-page in.pdf stamp.pdf a.pdf"}, | 15 | {$td->COMMAND => "pdf-overlay-page in.pdf stamp.pdf a.pdf"}, |
| 16 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 16 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 17 | $td->runtest("compare files", | 17 | $td->runtest("compare files", |
| 18 | - {$td->FILE => "a.pdf"}, | ||
| 19 | - {$td->FILE => "out.pdf"}); | 18 | + {$td->COMMAND => "qpdf-test-compare a.pdf out.pdf"}, |
| 19 | + {$td->FILE => "out.pdf", $td->EXIT_STATUS => 0}); | ||
| 20 | 20 | ||
| 21 | $td->runtest("overlay-page with fields/ annotations", | 21 | $td->runtest("overlay-page with fields/ annotations", |
| 22 | {$td->COMMAND => "pdf-overlay-page in.pdf annotations.pdf a.pdf"}, | 22 | {$td->COMMAND => "pdf-overlay-page in.pdf annotations.pdf a.pdf"}, |
| 23 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 23 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 24 | $td->runtest("compare files", | 24 | $td->runtest("compare files", |
| 25 | - {$td->FILE => "a.pdf"}, | ||
| 26 | - {$td->FILE => "annotations-out.pdf"}); | 25 | + {$td->COMMAND => "qpdf-test-compare a.pdf annotations-out.pdf"}, |
| 26 | + {$td->FILE => "annotations-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 27 | 27 | ||
| 28 | cleanup(); | 28 | cleanup(); |
| 29 | 29 |
examples/qtest/qpdfjob-remove-annotations.test
| @@ -15,8 +15,8 @@ $td->runtest("remove-annotations", | @@ -15,8 +15,8 @@ $td->runtest("remove-annotations", | ||
| 15 | {$td->COMMAND => "qpdfjob-remove-annotations --static-id annotations.pdf out.pdf"}, | 15 | {$td->COMMAND => "qpdfjob-remove-annotations --static-id annotations.pdf out.pdf"}, |
| 16 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 16 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 17 | $td->runtest("compare files", | 17 | $td->runtest("compare files", |
| 18 | - {$td->FILE => "out.pdf"}, | ||
| 19 | - {$td->FILE => "annotations-out.pdf"}); | 18 | + {$td->COMMAND => "qpdf-test-compare out.pdf annotations-out.pdf"}, |
| 19 | + {$td->FILE => "annotations-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 20 | 20 | ||
| 21 | cleanup(); | 21 | cleanup(); |
| 22 | 22 |
examples/qtest/set-form-values.test
| @@ -15,8 +15,8 @@ $td->runtest("set form values", | @@ -15,8 +15,8 @@ $td->runtest("set form values", | ||
| 15 | {$td->COMMAND => "pdf-set-form-values form-in.pdf a.pdf soup"}, | 15 | {$td->COMMAND => "pdf-set-form-values form-in.pdf a.pdf soup"}, |
| 16 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 16 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 17 | $td->runtest("compare files", | 17 | $td->runtest("compare files", |
| 18 | - {$td->FILE => "a.pdf"}, | ||
| 19 | - {$td->FILE => "form-out.pdf"}); | 18 | + {$td->COMMAND => "qpdf-test-compare a.pdf form-out.pdf"}, |
| 19 | + {$td->FILE => "form-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 20 | 20 | ||
| 21 | cleanup(); | 21 | cleanup(); |
| 22 | 22 |
qpdf/CMakeLists.txt
| @@ -55,6 +55,7 @@ add_test( | @@ -55,6 +55,7 @@ add_test( | ||
| 55 | --top ${qpdf_SOURCE_DIR} | 55 | --top ${qpdf_SOURCE_DIR} |
| 56 | --bin $<TARGET_FILE_DIR:qpdf> | 56 | --bin $<TARGET_FILE_DIR:qpdf> |
| 57 | --bin $<TARGET_FILE_DIR:libqpdf> # for Windows to find DLL | 57 | --bin $<TARGET_FILE_DIR:libqpdf> # for Windows to find DLL |
| 58 | + --bin $<TARGET_FILE_DIR:qpdf-test-compare> | ||
| 58 | --code ${qpdf_SOURCE_DIR}/qpdf | 59 | --code ${qpdf_SOURCE_DIR}/qpdf |
| 59 | --color ${QTEST_COLOR} | 60 | --color ${QTEST_COLOR} |
| 60 | --show-on-failure ${SHOW_FAILED_TEST_OUTPUT} | 61 | --show-on-failure ${SHOW_FAILED_TEST_OUTPUT} |
qpdf/qtest/attachments.test
| @@ -207,8 +207,8 @@ $td->runtest("remove multiple attachments", | @@ -207,8 +207,8 @@ $td->runtest("remove multiple attachments", | ||
| 207 | $td->EXIT_STATUS => 0}, | 207 | $td->EXIT_STATUS => 0}, |
| 208 | $td->NORMALIZE_NEWLINES); | 208 | $td->NORMALIZE_NEWLINES); |
| 209 | $td->runtest("check output", | 209 | $td->runtest("check output", |
| 210 | - {$td->FILE => "a.pdf"}, | ||
| 211 | - {$td->FILE => "remove-multiple-attachments.pdf"}); | 210 | + {$td->COMMAND => "qpdf-test-compare a.pdf remove-multiple-attachments.pdf"}, |
| 211 | + {$td->FILE => "remove-multiple-attachments.pdf", $td->EXIT_STATUS => 0}); | ||
| 212 | $td->runtest("remove multiple attachments (json)", | 212 | $td->runtest("remove multiple attachments (json)", |
| 213 | {$td->COMMAND => | 213 | {$td->COMMAND => |
| 214 | "qpdf --job-json-file=remove-multiple-attachments.json"}, | 214 | "qpdf --job-json-file=remove-multiple-attachments.json"}, |
| @@ -216,8 +216,8 @@ $td->runtest("remove multiple attachments (json)", | @@ -216,8 +216,8 @@ $td->runtest("remove multiple attachments (json)", | ||
| 216 | $td->EXIT_STATUS => 0}, | 216 | $td->EXIT_STATUS => 0}, |
| 217 | $td->NORMALIZE_NEWLINES); | 217 | $td->NORMALIZE_NEWLINES); |
| 218 | $td->runtest("check output", | 218 | $td->runtest("check output", |
| 219 | - {$td->FILE => "b.pdf"}, | ||
| 220 | - {$td->FILE => "remove-multiple-attachments.pdf"}); | 219 | + {$td->COMMAND => "qpdf-test-compare b.pdf remove-multiple-attachments.pdf"}, |
| 220 | + {$td->FILE => "remove-multiple-attachments.pdf", $td->EXIT_STATUS => 0}); | ||
| 221 | 221 | ||
| 222 | cleanup(); | 222 | cleanup(); |
| 223 | $td->report($n_tests); | 223 | $td->report($n_tests); |
qpdf/qtest/c-api.test
| @@ -36,8 +36,8 @@ foreach my $d (@capi) | @@ -36,8 +36,8 @@ foreach my $d (@capi) | ||
| 36 | {$td->STRING => "C test $n done\n", $td->EXIT_STATUS => 0}, | 36 | {$td->STRING => "C test $n done\n", $td->EXIT_STATUS => 0}, |
| 37 | $td->NORMALIZE_NEWLINES); | 37 | $td->NORMALIZE_NEWLINES); |
| 38 | $td->runtest("check $description", | 38 | $td->runtest("check $description", |
| 39 | - {$td->FILE => "a.pdf"}, | ||
| 40 | - {$td->FILE => $outfile}); | 39 | + {$td->COMMAND => "qpdf-test-compare a.pdf $outfile"}, |
| 40 | + {$td->FILE => $outfile, $td->EXIT_STATUS => 0}); | ||
| 41 | } | 41 | } |
| 42 | $td->runtest("write to bad file name", | 42 | $td->runtest("write to bad file name", |
| 43 | {$td->COMMAND => "qpdf-ctest 2 hybrid-xref.pdf '' /:a:/:b:"}, | 43 | {$td->COMMAND => "qpdf-ctest 2 hybrid-xref.pdf '' /:a:/:b:"}, |
qpdf/qtest/coalesce-contents.test
| @@ -46,8 +46,8 @@ $td->runtest("coalesce contents without qdf", | @@ -46,8 +46,8 @@ $td->runtest("coalesce contents without qdf", | ||
| 46 | " --coalesce-contents coalesce.pdf a.pdf"}, | 46 | " --coalesce-contents coalesce.pdf a.pdf"}, |
| 47 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 47 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 48 | $td->runtest("check output", | 48 | $td->runtest("check output", |
| 49 | - {$td->FILE => "a.pdf"}, | ||
| 50 | - {$td->FILE => "coalesce-out.pdf"}); | 49 | + {$td->COMMAND => "qpdf-test-compare a.pdf coalesce-out.pdf"}, |
| 50 | + {$td->FILE => "coalesce-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 51 | 51 | ||
| 52 | cleanup(); | 52 | cleanup(); |
| 53 | $td->report($n_tests); | 53 | $td->report($n_tests); |
qpdf/qtest/copy-annotations.test
| @@ -110,8 +110,8 @@ $td->runtest("keeping some fields", | @@ -110,8 +110,8 @@ $td->runtest("keeping some fields", | ||
| 110 | {$td->STRING => "", $td->EXIT_STATUS => 0}, | 110 | {$td->STRING => "", $td->EXIT_STATUS => 0}, |
| 111 | $td->NORMALIZE_NEWLINES); | 111 | $td->NORMALIZE_NEWLINES); |
| 112 | $td->runtest("check output", | 112 | $td->runtest("check output", |
| 113 | - {$td->FILE => "a.pdf"}, | ||
| 114 | - {$td->FILE => "kept-some-fields.pdf"}); | 113 | + {$td->COMMAND => "qpdf-test-compare a.pdf kept-some-fields.pdf"}, |
| 114 | + {$td->FILE => "kept-some-fields.pdf", $td->EXIT_STATUS => 0}); | ||
| 115 | $td->runtest("not keeping any fields", | 115 | $td->runtest("not keeping any fields", |
| 116 | {$td->COMMAND => | 116 | {$td->COMMAND => |
| 117 | "qpdf --static-id kept-some-fields.pdf" . | 117 | "qpdf --static-id kept-some-fields.pdf" . |
qpdf/qtest/custom-pipeline.test
| @@ -21,8 +21,8 @@ $td->runtest("output to custom pipeline", | @@ -21,8 +21,8 @@ $td->runtest("output to custom pipeline", | ||
| 21 | {$td->STRING => "test 33 done\n", $td->EXIT_STATUS => 0}, | 21 | {$td->STRING => "test 33 done\n", $td->EXIT_STATUS => 0}, |
| 22 | $td->NORMALIZE_NEWLINES); | 22 | $td->NORMALIZE_NEWLINES); |
| 23 | $td->runtest("check output", | 23 | $td->runtest("check output", |
| 24 | - {$td->FILE => "a.pdf"}, | ||
| 25 | - {$td->FILE => "custom-pipeline.pdf"}); | 24 | + {$td->COMMAND => "qpdf-test-compare a.pdf custom-pipeline.pdf"}, |
| 25 | + {$td->FILE => "custom-pipeline.pdf", $td->EXIT_STATUS => 0}); | ||
| 26 | 26 | ||
| 27 | cleanup(); | 27 | cleanup(); |
| 28 | $td->report($n_tests); | 28 | $td->report($n_tests); |
qpdf/qtest/dangling-refs.test
| @@ -24,8 +24,8 @@ foreach my $f (@dangling) | @@ -24,8 +24,8 @@ foreach my $f (@dangling) | ||
| 24 | {$td->FILE => "$f-dangling.out", $td->EXIT_STATUS => 0}, | 24 | {$td->FILE => "$f-dangling.out", $td->EXIT_STATUS => 0}, |
| 25 | $td->NORMALIZE_NEWLINES); | 25 | $td->NORMALIZE_NEWLINES); |
| 26 | $td->runtest("check output", | 26 | $td->runtest("check output", |
| 27 | - {$td->FILE => "a.pdf"}, | ||
| 28 | - {$td->FILE => "$f-dangling-out.pdf"}); | 27 | + {$td->COMMAND => "qpdf-test-compare a.pdf $f-dangling-out.pdf"}, |
| 28 | + {$td->FILE => "$f-dangling-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 29 | } | 29 | } |
| 30 | cleanup(); | 30 | cleanup(); |
| 31 | $td->report($n_tests); | 31 | $td->report($n_tests); |
qpdf/qtest/decode-parameters.test
| @@ -34,8 +34,8 @@ $td->runtest("stream with indirect decode parms", | @@ -34,8 +34,8 @@ $td->runtest("stream with indirect decode parms", | ||
| 34 | "qpdf --static-id indirect-decode-parms.pdf a.pdf"}, | 34 | "qpdf --static-id indirect-decode-parms.pdf a.pdf"}, |
| 35 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 35 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 36 | $td->runtest("check file", | 36 | $td->runtest("check file", |
| 37 | - {$td->FILE => "a.pdf"}, | ||
| 38 | - {$td->FILE => "indirect-decode-parms-out.pdf"}); | 37 | + {$td->COMMAND => "qpdf-test-compare a.pdf indirect-decode-parms-out.pdf"}, |
| 38 | + {$td->FILE => "indirect-decode-parms-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 39 | 39 | ||
| 40 | $td->runtest("decode parameters empty list", | 40 | $td->runtest("decode parameters empty list", |
| 41 | {$td->COMMAND => "qpdf --static-id empty-decode-parms.pdf a.pdf"}, | 41 | {$td->COMMAND => "qpdf --static-id empty-decode-parms.pdf a.pdf"}, |
qpdf/qtest/encryption.test
| @@ -404,8 +404,8 @@ foreach my $d (@cenc) | @@ -404,8 +404,8 @@ foreach my $d (@cenc) | ||
| 404 | if (-f $pdf_outfile) | 404 | if (-f $pdf_outfile) |
| 405 | { | 405 | { |
| 406 | $td->runtest("check $description content", | 406 | $td->runtest("check $description content", |
| 407 | - {$td->FILE => "a.pdf"}, | ||
| 408 | - {$td->FILE => $pdf_outfile}); | 407 | + {$td->COMMAND => "qpdf-test-compare a.pdf $pdf_outfile"}, |
| 408 | + {$td->FILE => $pdf_outfile, $td->EXIT_STATUS => 0}); | ||
| 409 | } | 409 | } |
| 410 | else | 410 | else |
| 411 | { | 411 | { |
| @@ -491,8 +491,8 @@ $td->runtest("convert encrypted to qdf", | @@ -491,8 +491,8 @@ $td->runtest("convert encrypted to qdf", | ||
| 491 | " --qdf a.pdf b.qdf"}, | 491 | " --qdf a.pdf b.qdf"}, |
| 492 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 492 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 493 | $td->runtest("compare files", | 493 | $td->runtest("compare files", |
| 494 | - {$td->FILE => 'a.qdf'}, | ||
| 495 | - {$td->FILE => 'b.qdf'}); | 494 | + {$td->COMMAND => "qpdf-test-compare a.qdf b.qdf"}, |
| 495 | + {$td->FILE => 'b.qdf', $td->EXIT_STATUS => 0}); | ||
| 496 | $td->runtest("linearize with AES and object streams", | 496 | $td->runtest("linearize with AES and object streams", |
| 497 | {$td->COMMAND => "qpdf --encrypt '' o 128 --use-aes=y --" . | 497 | {$td->COMMAND => "qpdf --encrypt '' o 128 --use-aes=y --" . |
| 498 | " --linearize --object-streams=generate enc-base.pdf a.pdf"}, | 498 | " --linearize --object-streams=generate enc-base.pdf a.pdf"}, |
| @@ -564,8 +564,8 @@ foreach my $d (['--force-V4', 'V4'], | @@ -564,8 +564,8 @@ foreach my $d (['--force-V4', 'V4'], | ||
| 564 | " enc-base.pdf a.pdf"}, | 564 | " enc-base.pdf a.pdf"}, |
| 565 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 565 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 566 | $td->runtest("check output", | 566 | $td->runtest("check output", |
| 567 | - {$td->FILE => "a.pdf"}, | ||
| 568 | - {$td->FILE => "$out.pdf"}); | 567 | + {$td->COMMAND => "qpdf-test-compare a.pdf $out.pdf"}, |
| 568 | + {$td->FILE => "$out.pdf", $td->EXIT_STATUS => 0}); | ||
| 569 | $td->runtest("show encryption", | 569 | $td->runtest("show encryption", |
| 570 | {$td->COMMAND => "qpdf --show-encryption a.pdf"}, | 570 | {$td->COMMAND => "qpdf --show-encryption a.pdf"}, |
| 571 | {$td->FILE => "$out-encryption.out", $td->EXIT_STATUS => 0}, | 571 | {$td->FILE => "$out-encryption.out", $td->EXIT_STATUS => 0}, |
qpdf/qtest/extensions-dictionary.test
| @@ -46,16 +46,16 @@ foreach my $input (@ext_inputs) | @@ -46,16 +46,16 @@ foreach my $input (@ext_inputs) | ||
| 46 | # Look at the actual file for a few cases to make sure | 46 | # Look at the actual file for a few cases to make sure |
| 47 | # qdf and non-qdf output are okay | 47 | # qdf and non-qdf output are okay |
| 48 | $td->runtest("check file", | 48 | $td->runtest("check file", |
| 49 | - {$td->FILE => "a.pdf"}, | ||
| 50 | - {$td->FILE => "$base-$op-$version.pdf"}); | 49 | + {$td->COMMAND => "qpdf-test-compare a.pdf $base-$op-$version.pdf"}, |
| 50 | + {$td->FILE => "$base-$op-$version.pdf", $td->EXIT_STATUS => 0}); | ||
| 51 | $td->runtest("$input: $op version to $version", | 51 | $td->runtest("$input: $op version to $version", |
| 52 | {$td->COMMAND => | 52 | {$td->COMMAND => |
| 53 | "qpdf --qdf --static-id" . | 53 | "qpdf --qdf --static-id" . |
| 54 | " --$op-version=$version $input a.qdf"}, | 54 | " --$op-version=$version $input a.qdf"}, |
| 55 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 55 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 56 | $td->runtest("check file", | 56 | $td->runtest("check file", |
| 57 | - {$td->FILE => "a.qdf"}, | ||
| 58 | - {$td->FILE => "$base-$op-$version.qdf"}); | 57 | + {$td->COMMAND => "qpdf-test-compare a.qdf $base-$op-$version.qdf"}, |
| 58 | + {$td->FILE => "$base-$op-$version.qdf", $td->EXIT_STATUS => 0}); | ||
| 59 | } | 59 | } |
| 60 | } | 60 | } |
| 61 | } | 61 | } |
qpdf/qtest/filter-abbreviations.test
| @@ -23,8 +23,8 @@ $td->runtest("stream filter abbreviations", | @@ -23,8 +23,8 @@ $td->runtest("stream filter abbreviations", | ||
| 23 | $td->EXIT_STATUS => 0}, | 23 | $td->EXIT_STATUS => 0}, |
| 24 | $td->NORMALIZE_NEWLINES); | 24 | $td->NORMALIZE_NEWLINES); |
| 25 | $td->runtest("check output", | 25 | $td->runtest("check output", |
| 26 | - {$td->FILE => "a.pdf"}, | ||
| 27 | - {$td->FILE => "filter-abbreviation.out"}); | 26 | + {$td->COMMAND => "qpdf-test-compare a.pdf filter-abbreviation.out"}, |
| 27 | + {$td->FILE => "filter-abbreviation.out", $td->EXIT_STATUS => 0}); | ||
| 28 | 28 | ||
| 29 | cleanup(); | 29 | cleanup(); |
| 30 | $td->report($n_tests); | 30 | $td->report($n_tests); |
qpdf/qtest/inline-images.test
| @@ -68,8 +68,8 @@ $td->runtest("named colorspace", | @@ -68,8 +68,8 @@ $td->runtest("named colorspace", | ||
| 68 | {$td->STRING => "", $td->EXIT_STATUS => 0}, | 68 | {$td->STRING => "", $td->EXIT_STATUS => 0}, |
| 69 | $td->NORMALIZE_NEWLINES); | 69 | $td->NORMALIZE_NEWLINES); |
| 70 | $td->runtest("check output", | 70 | $td->runtest("check output", |
| 71 | - {$td->FILE => "a.pdf"}, | ||
| 72 | - {$td->FILE => "inline-image-colorspace-lookup-out.pdf"}); | 71 | + {$td->COMMAND => "qpdf-test-compare a.pdf inline-image-colorspace-lookup-out.pdf"}, |
| 72 | + {$td->FILE => "inline-image-colorspace-lookup-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 73 | 73 | ||
| 74 | 74 | ||
| 75 | my @eii_tests = ( | 75 | my @eii_tests = ( |
qpdf/qtest/merge-and-split.test
| @@ -39,8 +39,8 @@ $td->runtest("merge three files", | @@ -39,8 +39,8 @@ $td->runtest("merge three files", | ||
| 39 | # as well as 20-pages have text on page n (from 1) that shows its page | 39 | # as well as 20-pages have text on page n (from 1) that shows its page |
| 40 | # position from 0, so page 1 says it's page 0. | 40 | # position from 0, so page 1 says it's page 0. |
| 41 | $td->runtest("check output", | 41 | $td->runtest("check output", |
| 42 | - {$td->FILE => "a.pdf"}, | ||
| 43 | - {$td->FILE => "merge-three-files-1.pdf"}); | 42 | + {$td->COMMAND => "qpdf-test-compare a.pdf merge-three-files-1.pdf"}, |
| 43 | + {$td->FILE => "merge-three-files-1.pdf", $td->EXIT_STATUS => 0}); | ||
| 44 | # Select the same pages but add them to an empty file | 44 | # Select the same pages but add them to an empty file |
| 45 | $td->runtest("merge three files", | 45 | $td->runtest("merge three files", |
| 46 | {$td->COMMAND => "qpdf --empty a.pdf" . | 46 | {$td->COMMAND => "qpdf --empty a.pdf" . |
| @@ -49,8 +49,8 @@ $td->runtest("merge three files", | @@ -49,8 +49,8 @@ $td->runtest("merge three files", | ||
| 49 | # Manually verified about this file: it has the same pages but does | 49 | # Manually verified about this file: it has the same pages but does |
| 50 | # not contain outlines or other things from the original file. | 50 | # not contain outlines or other things from the original file. |
| 51 | $td->runtest("check output", | 51 | $td->runtest("check output", |
| 52 | - {$td->FILE => "a.pdf"}, | ||
| 53 | - {$td->FILE => "merge-three-files-2.pdf"}); | 52 | + {$td->COMMAND => "qpdf-test-compare a.pdf merge-three-files-2.pdf"}, |
| 53 | + {$td->FILE => "merge-three-files-2.pdf", $td->EXIT_STATUS => 0}); | ||
| 54 | $td->runtest("avoid respecification of password", | 54 | $td->runtest("avoid respecification of password", |
| 55 | {$td->COMMAND => | 55 | {$td->COMMAND => |
| 56 | "qpdf --empty a.pdf --copy-encryption=20-pages.pdf" . | 56 | "qpdf --empty a.pdf --copy-encryption=20-pages.pdf" . |
| @@ -69,16 +69,16 @@ $td->runtest("merge with implicit ranges", | @@ -69,16 +69,16 @@ $td->runtest("merge with implicit ranges", | ||
| 69 | " --static-id"}, | 69 | " --static-id"}, |
| 70 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 70 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 71 | $td->runtest("check output", | 71 | $td->runtest("check output", |
| 72 | - {$td->FILE => "a.pdf"}, | ||
| 73 | - {$td->FILE => "merge-implicit-ranges.pdf"}); | 72 | + {$td->COMMAND => "qpdf-test-compare a.pdf merge-implicit-ranges.pdf"}, |
| 73 | + {$td->FILE => "merge-implicit-ranges.pdf", $td->EXIT_STATUS => 0}); | ||
| 74 | $td->runtest("merge with . and implicit ranges", | 74 | $td->runtest("merge with . and implicit ranges", |
| 75 | {$td->COMMAND => | 75 | {$td->COMMAND => |
| 76 | "qpdf minimal.pdf a.pdf --pages minimal.pdf . 1 --" . | 76 | "qpdf minimal.pdf a.pdf --pages minimal.pdf . 1 --" . |
| 77 | " --static-id"}, | 77 | " --static-id"}, |
| 78 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 78 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 79 | $td->runtest("check output", | 79 | $td->runtest("check output", |
| 80 | - {$td->FILE => "a.pdf"}, | ||
| 81 | - {$td->FILE => "merge-dot-implicit-ranges.pdf"}); | 80 | + {$td->COMMAND => "qpdf-test-compare a.pdf merge-dot-implicit-ranges.pdf"}, |
| 81 | + {$td->FILE => "merge-dot-implicit-ranges.pdf", $td->EXIT_STATUS => 0}); | ||
| 82 | $td->runtest("merge with multiple labels", | 82 | $td->runtest("merge with multiple labels", |
| 83 | {$td->COMMAND => | 83 | {$td->COMMAND => |
| 84 | "qpdf --empty a.pdf" . | 84 | "qpdf --empty a.pdf" . |
| @@ -88,8 +88,8 @@ $td->runtest("merge with multiple labels", | @@ -88,8 +88,8 @@ $td->runtest("merge with multiple labels", | ||
| 88 | " --static-id"}, | 88 | " --static-id"}, |
| 89 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 89 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 90 | $td->runtest("check output", | 90 | $td->runtest("check output", |
| 91 | - {$td->FILE => "a.pdf"}, | ||
| 92 | - {$td->FILE => "merge-multiple-labels.pdf"}); | 91 | + {$td->COMMAND => "qpdf-test-compare a.pdf merge-multiple-labels.pdf"}, |
| 92 | + {$td->FILE => "merge-multiple-labels.pdf", $td->EXIT_STATUS => 0}); | ||
| 93 | $td->runtest("remove labels", | 93 | $td->runtest("remove labels", |
| 94 | {$td->COMMAND => | 94 | {$td->COMMAND => |
| 95 | "qpdf --empty a.pdf" . | 95 | "qpdf --empty a.pdf" . |
| @@ -100,8 +100,8 @@ $td->runtest("remove labels", | @@ -100,8 +100,8 @@ $td->runtest("remove labels", | ||
| 100 | " --static-id"}, | 100 | " --static-id"}, |
| 101 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 101 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 102 | $td->runtest("check output", | 102 | $td->runtest("check output", |
| 103 | - {$td->FILE => "a.pdf"}, | ||
| 104 | - {$td->FILE => "remove-labels.pdf"}); | 103 | + {$td->COMMAND => "qpdf-test-compare a.pdf remove-labels.pdf"}, |
| 104 | + {$td->FILE => "remove-labels.pdf", $td->EXIT_STATUS => 0}); | ||
| 105 | 105 | ||
| 106 | $td->runtest("split with shared resources", | 106 | $td->runtest("split with shared resources", |
| 107 | {$td->COMMAND => | 107 | {$td->COMMAND => |
| @@ -178,8 +178,8 @@ $td->runtest("force full page duplication", | @@ -178,8 +178,8 @@ $td->runtest("force full page duplication", | ||
| 178 | {$td->STRING => "", $td->EXIT_STATUS => 0}, | 178 | {$td->STRING => "", $td->EXIT_STATUS => 0}, |
| 179 | $td->NORMALIZE_NEWLINES); | 179 | $td->NORMALIZE_NEWLINES); |
| 180 | $td->runtest("check output", | 180 | $td->runtest("check output", |
| 181 | - {$td->FILE => "a.pdf"}, | ||
| 182 | - {$td->FILE => "deep-duplicate-pages.pdf"}); | 181 | + {$td->COMMAND => "qpdf-test-compare a.pdf deep-duplicate-pages.pdf"}, |
| 182 | + {$td->FILE => "deep-duplicate-pages.pdf", $td->EXIT_STATUS => 0}); | ||
| 183 | 183 | ||
| 184 | 184 | ||
| 185 | cleanup(); | 185 | cleanup(); |
qpdf/qtest/newline-before-endstream.test
| @@ -36,8 +36,8 @@ foreach my $d ( | @@ -36,8 +36,8 @@ foreach my $d ( | ||
| 36 | {$td->STRING => "", $td->EXIT_STATUS => 0}, | 36 | {$td->STRING => "", $td->EXIT_STATUS => 0}, |
| 37 | $td->NORMALIZE_NEWLINES); | 37 | $td->NORMALIZE_NEWLINES); |
| 38 | $td->runtest("check output ($description)", | 38 | $td->runtest("check output ($description)", |
| 39 | - {$td->FILE => "a.pdf"}, | ||
| 40 | - {$td->FILE => "newline-before-endstream-$suffix.pdf"}); | 39 | + {$td->COMMAND => "qpdf-test-compare a.pdf newline-before-endstream-$suffix.pdf"}, |
| 40 | + {$td->FILE => "newline-before-endstream-$suffix.pdf", $td->EXIT_STATUS => 0}); | ||
| 41 | if ($flags =~ /qdf/) | 41 | if ($flags =~ /qdf/) |
| 42 | { | 42 | { |
| 43 | $td->runtest("fix-qdf", | 43 | $td->runtest("fix-qdf", |
| @@ -52,8 +52,8 @@ $td->runtest("newline before endstream (C)", | @@ -52,8 +52,8 @@ $td->runtest("newline before endstream (C)", | ||
| 52 | {$td->STRING => "C test 22 done\n", $td->EXIT_STATUS => 0}, | 52 | {$td->STRING => "C test 22 done\n", $td->EXIT_STATUS => 0}, |
| 53 | $td->NORMALIZE_NEWLINES); | 53 | $td->NORMALIZE_NEWLINES); |
| 54 | $td->runtest("check output", | 54 | $td->runtest("check output", |
| 55 | - {$td->FILE => "a.pdf"}, | ||
| 56 | - {$td->FILE => "newline-before-endstream-nl.pdf"}); | 55 | + {$td->COMMAND => "qpdf-test-compare a.pdf newline-before-endstream-nl.pdf"}, |
| 56 | + {$td->FILE => "newline-before-endstream-nl.pdf", $td->EXIT_STATUS => 0}); | ||
| 57 | 57 | ||
| 58 | cleanup(); | 58 | cleanup(); |
| 59 | $td->report($n_tests); | 59 | $td->report($n_tests); |
qpdf/qtest/page-errors.test
| @@ -32,8 +32,8 @@ $td->runtest("handle page with inherited MediaBox", | @@ -32,8 +32,8 @@ $td->runtest("handle page with inherited MediaBox", | ||
| 32 | {$td->STRING => "", $td->EXIT_STATUS => 0}, | 32 | {$td->STRING => "", $td->EXIT_STATUS => 0}, |
| 33 | $td->NORMALIZE_NEWLINES); | 33 | $td->NORMALIZE_NEWLINES); |
| 34 | $td->runtest("check output", | 34 | $td->runtest("check output", |
| 35 | - {$td->FILE => "a.pdf"}, | ||
| 36 | - {$td->FILE => "page-inherit-mediabox-out.pdf"}); | 35 | + {$td->COMMAND => "qpdf-test-compare a.pdf page-inherit-mediabox-out.pdf"}, |
| 36 | + {$td->FILE => "page-inherit-mediabox-out.pdf", $td->EXIT_STATUS => 0}); | ||
| 37 | $td->runtest("check no type key for page nodes", | 37 | $td->runtest("check no type key for page nodes", |
| 38 | {$td->COMMAND => "qpdf --check no-pages-types.pdf"}, | 38 | {$td->COMMAND => "qpdf --check no-pages-types.pdf"}, |
| 39 | {$td->FILE => "no-pages-types.out", $td->EXIT_STATUS => 3}, | 39 | {$td->FILE => "no-pages-types.out", $td->EXIT_STATUS => 3}, |
| @@ -43,8 +43,8 @@ $td->runtest("no type key for page nodes", | @@ -43,8 +43,8 @@ $td->runtest("no type key for page nodes", | ||
| 43 | {$td->FILE => "no-pages-types-fix.out", $td->EXIT_STATUS => 3}, | 43 | {$td->FILE => "no-pages-types-fix.out", $td->EXIT_STATUS => 3}, |
| 44 | $td->NORMALIZE_NEWLINES); | 44 | $td->NORMALIZE_NEWLINES); |
| 45 | $td->runtest("check output", | 45 | $td->runtest("check output", |
| 46 | - {$td->FILE => "a-split-out-1.pdf"}, | ||
| 47 | - {$td->FILE => "no-pages-types-fixed.pdf"}); | 46 | + {$td->COMMAND => "qpdf-test-compare a-split-out-1.pdf no-pages-types-fixed.pdf"}, |
| 47 | + {$td->FILE => "no-pages-types-fixed.pdf", $td->EXIT_STATUS => 0}); | ||
| 48 | $td->runtest("detect loops in pages structure", | 48 | $td->runtest("detect loops in pages structure", |
| 49 | {$td->COMMAND => "qpdf --check pages-loop.pdf"}, | 49 | {$td->COMMAND => "qpdf --check pages-loop.pdf"}, |
| 50 | {$td->FILE => "pages-loop.out", $td->EXIT_STATUS => 2}, | 50 | {$td->FILE => "pages-loop.out", $td->EXIT_STATUS => 2}, |
qpdf/qtest/pages-tree.test
| @@ -24,8 +24,8 @@ $td->runtest("linearize duplicated pages", | @@ -24,8 +24,8 @@ $td->runtest("linearize duplicated pages", | ||
| 24 | $td->EXIT_STATUS => 3}, | 24 | $td->EXIT_STATUS => 3}, |
| 25 | $td->NORMALIZE_NEWLINES); | 25 | $td->NORMALIZE_NEWLINES); |
| 26 | $td->runtest("compare files", | 26 | $td->runtest("compare files", |
| 27 | - {$td->FILE => "a.pdf"}, | ||
| 28 | - {$td->FILE => "linearize-duplicate-page.pdf"}); | 27 | + {$td->COMMAND => "qpdf-test-compare a.pdf"}, |
| 28 | + {$td->FILE => "linearize-duplicate-page.pdf", $td->EXIT_STATUS => 0}); | ||
| 29 | $td->runtest("extract duplicated pages", | 29 | $td->runtest("extract duplicated pages", |
| 30 | {$td->COMMAND => | 30 | {$td->COMMAND => |
| 31 | "qpdf --static-id page_api_2.pdf" . | 31 | "qpdf --static-id page_api_2.pdf" . |
| @@ -34,16 +34,16 @@ $td->runtest("extract duplicated pages", | @@ -34,16 +34,16 @@ $td->runtest("extract duplicated pages", | ||
| 34 | $td->EXIT_STATUS => 3}, | 34 | $td->EXIT_STATUS => 3}, |
| 35 | $td->NORMALIZE_NEWLINES); | 35 | $td->NORMALIZE_NEWLINES); |
| 36 | $td->runtest("compare files", | 36 | $td->runtest("compare files", |
| 37 | - {$td->FILE => "a.pdf"}, | ||
| 38 | - {$td->FILE => "extract-duplicate-page.pdf"}); | 37 | + {$td->COMMAND => "qpdf-test-compare a.pdf extract-duplicate-page.pdf"}, |
| 38 | + {$td->FILE => "extract-duplicate-page.pdf", $td->EXIT_STATUS => 0}); | ||
| 39 | $td->runtest("direct pages", | 39 | $td->runtest("direct pages", |
| 40 | {$td->COMMAND => | 40 | {$td->COMMAND => |
| 41 | "qpdf --static-id direct-pages.pdf --pages . -- a.pdf"}, | 41 | "qpdf --static-id direct-pages.pdf --pages . -- a.pdf"}, |
| 42 | {$td->FILE => "direct-page-warning.out", $td->EXIT_STATUS => 3}, | 42 | {$td->FILE => "direct-page-warning.out", $td->EXIT_STATUS => 3}, |
| 43 | $td->NORMALIZE_NEWLINES); | 43 | $td->NORMALIZE_NEWLINES); |
| 44 | $td->runtest("check output", | 44 | $td->runtest("check output", |
| 45 | - {$td->FILE => "a.pdf"}, | ||
| 46 | - {$td->FILE => "direct-pages-fixed.pdf"}); | 45 | + {$td->COMMAND => "qpdf-test-compare a.pdf direct-pages-fixed.pdf"}, |
| 46 | + {$td->FILE => "direct-pages-fixed.pdf", $td->EXIT_STATUS => 0}); | ||
| 47 | $td->runtest("show direct pages", | 47 | $td->runtest("show direct pages", |
| 48 | {$td->COMMAND => | 48 | {$td->COMMAND => |
| 49 | "qpdf --show-pages direct-pages.pdf"}, | 49 | "qpdf --show-pages direct-pages.pdf"}, |
qpdf/qtest/parsing.test
| @@ -33,14 +33,14 @@ $td->runtest("extra header text", | @@ -33,14 +33,14 @@ $td->runtest("extra header text", | ||
| 33 | {$td->FILE => "test-32.out", $td->EXIT_STATUS => 0}, | 33 | {$td->FILE => "test-32.out", $td->EXIT_STATUS => 0}, |
| 34 | $td->NORMALIZE_NEWLINES); | 34 | $td->NORMALIZE_NEWLINES); |
| 35 | $td->runtest("check output", | 35 | $td->runtest("check output", |
| 36 | - {$td->FILE => "a.pdf"}, | ||
| 37 | - {$td->FILE => "extra-header-no-newline.pdf"}); | 36 | + {$td->COMMAND => "qpdf-test-compare a.pdf extra-header-no-newline.pdf"}, |
| 37 | + {$td->FILE => "extra-header-no-newline.pdf", $td->EXIT_STATUS => 0}); | ||
| 38 | $td->runtest("check output", | 38 | $td->runtest("check output", |
| 39 | {$td->FILE => "b.pdf"}, | 39 | {$td->FILE => "b.pdf"}, |
| 40 | {$td->FILE => "extra-header-lin-no-newline.pdf"}); | 40 | {$td->FILE => "extra-header-lin-no-newline.pdf"}); |
| 41 | $td->runtest("check output", | 41 | $td->runtest("check output", |
| 42 | - {$td->FILE => "c.pdf"}, | ||
| 43 | - {$td->FILE => "extra-header-newline.pdf"}); | 42 | + {$td->COMMAND => "qpdf-test-compare c.pdf extra-header-newline.pdf"}, |
| 43 | + {$td->FILE => "extra-header-newline.pdf", $td->EXIT_STATUS => 0}); | ||
| 44 | $td->runtest("check output", | 44 | $td->runtest("check output", |
| 45 | {$td->FILE => "d.pdf"}, | 45 | {$td->FILE => "d.pdf"}, |
| 46 | {$td->FILE => "extra-header-lin-newline.pdf"}); | 46 | {$td->FILE => "extra-header-lin-newline.pdf"}); |
qpdf/qtest/preserve-unref.test
| @@ -20,22 +20,22 @@ $td->runtest("drop unused objects", | @@ -20,22 +20,22 @@ $td->runtest("drop unused objects", | ||
| 20 | {$td->COMMAND => "qpdf --static-id unreferenced-objects.pdf a.pdf"}, | 20 | {$td->COMMAND => "qpdf --static-id unreferenced-objects.pdf a.pdf"}, |
| 21 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 21 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 22 | $td->runtest("check output", | 22 | $td->runtest("check output", |
| 23 | - {$td->FILE => "a.pdf"}, | ||
| 24 | - {$td->FILE => "unreferenced-dropped.pdf"}); | 23 | + {$td->COMMAND => "qpdf-test-compare a.pdf unreferenced-dropped.pdf"}, |
| 24 | + {$td->FILE => "unreferenced-dropped.pdf", $td->EXIT_STATUS => 0}); | ||
| 25 | $td->runtest("keep unused objects", | 25 | $td->runtest("keep unused objects", |
| 26 | {$td->COMMAND => "qpdf --static-id --preserve-unreferenced" . | 26 | {$td->COMMAND => "qpdf --static-id --preserve-unreferenced" . |
| 27 | " unreferenced-objects.pdf a.pdf"}, | 27 | " unreferenced-objects.pdf a.pdf"}, |
| 28 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 28 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 29 | $td->runtest("check output", | 29 | $td->runtest("check output", |
| 30 | - {$td->FILE => "a.pdf"}, | ||
| 31 | - {$td->FILE => "unreferenced-preserved.pdf"}); | 30 | + {$td->COMMAND => "qpdf-test-compare a.pdf unreferenced-preserved.pdf"}, |
| 31 | + {$td->FILE => "unreferenced-preserved.pdf", $td->EXIT_STATUS => 0}); | ||
| 32 | $td->runtest("keep unused objects (C)", | 32 | $td->runtest("keep unused objects (C)", |
| 33 | {$td->COMMAND => | 33 | {$td->COMMAND => |
| 34 | "qpdf-ctest 21 unreferenced-objects.pdf '' a.pdf"}, | 34 | "qpdf-ctest 21 unreferenced-objects.pdf '' a.pdf"}, |
| 35 | {$td->STRING => "C test 21 done\n", $td->EXIT_STATUS => 0}, | 35 | {$td->STRING => "C test 21 done\n", $td->EXIT_STATUS => 0}, |
| 36 | $td->NORMALIZE_NEWLINES); | 36 | $td->NORMALIZE_NEWLINES); |
| 37 | $td->runtest("check output", | 37 | $td->runtest("check output", |
| 38 | - {$td->FILE => "a.pdf"}, | ||
| 39 | - {$td->FILE => "unreferenced-preserved.pdf"}); | 38 | + {$td->COMMAND => "qpdf-test-compare a.pdf unreferenced-preserved.pdf"}, |
| 39 | + {$td->FILE => "unreferenced-preserved.pdf", $td->EXIT_STATUS => 0}); | ||
| 40 | cleanup(); | 40 | cleanup(); |
| 41 | $td->report($n_tests); | 41 | $td->report($n_tests); |
qpdf/qtest/qpdf-json.test
| @@ -294,31 +294,31 @@ $td->runtest("C API create from json file", | @@ -294,31 +294,31 @@ $td->runtest("C API create from json file", | ||
| 294 | {$td->STRING => "C test 42 done\n", $td->EXIT_STATUS => 0}, | 294 | {$td->STRING => "C test 42 done\n", $td->EXIT_STATUS => 0}, |
| 295 | $td->NORMALIZE_NEWLINES); | 295 | $td->NORMALIZE_NEWLINES); |
| 296 | $td->runtest("check C API create from file", | 296 | $td->runtest("check C API create from file", |
| 297 | - {$td->FILE => "a.pdf"}, | ||
| 298 | - {$td->FILE => "qpdf-ctest-42-43.pdf"}); | 297 | + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-42-43.pdf"}, |
| 298 | + {$td->FILE => "qpdf-ctest-42-43.pdf", $td->EXIT_STATUS => 0}); | ||
| 299 | $td->runtest("C API create from json buffer", | 299 | $td->runtest("C API create from json buffer", |
| 300 | {$td->COMMAND => "qpdf-ctest 43 minimal.json '' a.pdf"}, | 300 | {$td->COMMAND => "qpdf-ctest 43 minimal.json '' a.pdf"}, |
| 301 | {$td->STRING => "C test 43 done\n", $td->EXIT_STATUS => 0}, | 301 | {$td->STRING => "C test 43 done\n", $td->EXIT_STATUS => 0}, |
| 302 | $td->NORMALIZE_NEWLINES); | 302 | $td->NORMALIZE_NEWLINES); |
| 303 | $td->runtest("check C API create from buffer", | 303 | $td->runtest("check C API create from buffer", |
| 304 | - {$td->FILE => "a.pdf"}, | ||
| 305 | - {$td->FILE => "qpdf-ctest-42-43.pdf"}); | 304 | + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-42-43.pdf"}, |
| 305 | + {$td->FILE => "qpdf-ctest-42-43.pdf", $td->EXIT_STATUS => 0}); | ||
| 306 | $td->runtest("C API update from json file", | 306 | $td->runtest("C API update from json file", |
| 307 | {$td->COMMAND => | 307 | {$td->COMMAND => |
| 308 | "qpdf-ctest 44 minimal.pdf '' a.pdf minimal-update.json"}, | 308 | "qpdf-ctest 44 minimal.pdf '' a.pdf minimal-update.json"}, |
| 309 | {$td->STRING => "C test 44 done\n", $td->EXIT_STATUS => 0}, | 309 | {$td->STRING => "C test 44 done\n", $td->EXIT_STATUS => 0}, |
| 310 | $td->NORMALIZE_NEWLINES); | 310 | $td->NORMALIZE_NEWLINES); |
| 311 | $td->runtest("check C API update from file", | 311 | $td->runtest("check C API update from file", |
| 312 | - {$td->FILE => "a.pdf"}, | ||
| 313 | - {$td->FILE => "qpdf-ctest-44-45.pdf"}); | 312 | + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-44-45.pdf"}, |
| 313 | + {$td->FILE => "qpdf-ctest-44-45.pdf", $td->EXIT_STATUS => 0}); | ||
| 314 | $td->runtest("C API update from json buffer", | 314 | $td->runtest("C API update from json buffer", |
| 315 | {$td->COMMAND => | 315 | {$td->COMMAND => |
| 316 | "qpdf-ctest 45 minimal.pdf '' a.pdf minimal-update.json"}, | 316 | "qpdf-ctest 45 minimal.pdf '' a.pdf minimal-update.json"}, |
| 317 | {$td->STRING => "C test 45 done\n", $td->EXIT_STATUS => 0}, | 317 | {$td->STRING => "C test 45 done\n", $td->EXIT_STATUS => 0}, |
| 318 | $td->NORMALIZE_NEWLINES); | 318 | $td->NORMALIZE_NEWLINES); |
| 319 | $td->runtest("check C API update from buffer", | 319 | $td->runtest("check C API update from buffer", |
| 320 | - {$td->FILE => "a.pdf"}, | ||
| 321 | - {$td->FILE => "qpdf-ctest-44-45.pdf"}); | 320 | + {$td->COMMAND => "qpdf-test-compare a.pdf qpdf-ctest-44-45.pdf"}, |
| 321 | + {$td->FILE => "qpdf-ctest-44-45.pdf", $td->EXIT_STATUS => 0}); | ||
| 322 | $td->runtest("C API write to JSON 1", | 322 | $td->runtest("C API write to JSON 1", |
| 323 | {$td->COMMAND => | 323 | {$td->COMMAND => |
| 324 | "qpdf-ctest 46 minimal.pdf '' a.json"}, | 324 | "qpdf-ctest 46 minimal.pdf '' a.json"}, |
qpdf/qtest/qpdf_test_helpers.pm
| @@ -46,8 +46,8 @@ sub check_pdf | @@ -46,8 +46,8 @@ sub check_pdf | ||
| 46 | {$td->STRING => "", | 46 | {$td->STRING => "", |
| 47 | $td->EXIT_STATUS => $status}); | 47 | $td->EXIT_STATUS => $status}); |
| 48 | $td->runtest("check output", | 48 | $td->runtest("check output", |
| 49 | - {$td->FILE => "a.pdf"}, | ||
| 50 | - {$td->FILE => $output}); | 49 | + {$td->COMMAND => "qpdf-test-compare a.pdf $output"}, |
| 50 | + {$td->FILE => $output, $td->EXIT_STATUS => 0}); | ||
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | sub flush_tiff_cache | 53 | sub flush_tiff_cache |
qpdf/qtest/qpdfjob.test
| @@ -76,8 +76,8 @@ foreach my $i (@good_json) | @@ -76,8 +76,8 @@ foreach my $i (@good_json) | ||
| 76 | else | 76 | else |
| 77 | { | 77 | { |
| 78 | $td->runtest("check good json $i output", | 78 | $td->runtest("check good json $i output", |
| 79 | - {$td->FILE => "a.pdf"}, | ||
| 80 | - {$td->FILE => "job-json-$i.pdf"}); | 79 | + {$td->COMMAND => "qpdf-test-compare a.pdf job-json-$i.pdf"}, |
| 80 | + {$td->FILE => "job-json-$i.pdf", $td->EXIT_STATUS => 0}); | ||
| 81 | } | 81 | } |
| 82 | } | 82 | } |
| 83 | 83 | ||
| @@ -107,8 +107,8 @@ $td->runtest("C job API", | @@ -107,8 +107,8 @@ $td->runtest("C job API", | ||
| 107 | foreach my $i (['a.pdf', 1], ['b.pdf', 2], ['c.pdf', 3], ['d.pdf', 4]) | 107 | foreach my $i (['a.pdf', 1], ['b.pdf', 2], ['c.pdf', 3], ['d.pdf', 4]) |
| 108 | { | 108 | { |
| 109 | $td->runtest("check output", | 109 | $td->runtest("check output", |
| 110 | - {$td->FILE => $i->[0]}, | ||
| 111 | - {$td->FILE => "qpdfjob-ctest$i->[1].pdf"}); | 110 | + {$td->COMMAND => "qpdf-test-compare $i->[0] qpdfjob-ctest$i->[1].pdf"}, |
| 111 | + {$td->FILE => "qpdfjob-ctest$i->[1].pdf", $td->EXIT_STATUS => 0}); | ||
| 112 | } | 112 | } |
| 113 | my $wide_out = `qpdfjob-ctest wide`; | 113 | my $wide_out = `qpdfjob-ctest wide`; |
| 114 | $td->runtest("qpdfjob-ctest wide", | 114 | $td->runtest("qpdfjob-ctest wide", |
| @@ -124,8 +124,8 @@ if ($wide_out =~ m/skipped/) | @@ -124,8 +124,8 @@ if ($wide_out =~ m/skipped/) | ||
| 124 | else | 124 | else |
| 125 | { | 125 | { |
| 126 | $td->runtest("check output", | 126 | $td->runtest("check output", |
| 127 | - {$td->FILE => "a.pdf"}, | ||
| 128 | - {$td->FILE => "qpdfjob-ctest-wide.pdf"}); | 127 | + {$td->COMMAND => "qpdf-test-compare a.pdf qpdfjob-ctest-wide.pdf"}, |
| 128 | + {$td->FILE => "qpdfjob-ctest-wide.pdf", $td->EXIT_STATUS => 0}); | ||
| 129 | } | 129 | } |
| 130 | 130 | ||
| 131 | cleanup(); | 131 | cleanup(); |
qpdf/qtest/rotate-pages.test
| @@ -29,24 +29,24 @@ $td->runtest("page rotation", | @@ -29,24 +29,24 @@ $td->runtest("page rotation", | ||
| 29 | " --rotate=-90:3,15,17,18"}, | 29 | " --rotate=-90:3,15,17,18"}, |
| 30 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 30 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 31 | $td->runtest("check output", | 31 | $td->runtest("check output", |
| 32 | - {$td->FILE => "a.pdf"}, | ||
| 33 | - {$td->FILE => "rotated.pdf"}); | 32 | + {$td->COMMAND => "qpdf-test-compare a.pdf rotated.pdf"}, |
| 33 | + {$td->FILE => "rotated.pdf", $td->EXIT_STATUS => 0}); | ||
| 34 | 34 | ||
| 35 | $td->runtest("remove rotation", | 35 | $td->runtest("remove rotation", |
| 36 | {$td->COMMAND => "qpdf --static-id rotated.pdf a.pdf" . | 36 | {$td->COMMAND => "qpdf --static-id rotated.pdf a.pdf" . |
| 37 | " --qdf --no-original-object-ids --rotate=0"}, | 37 | " --qdf --no-original-object-ids --rotate=0"}, |
| 38 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 38 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 39 | $td->runtest("check output", | 39 | $td->runtest("check output", |
| 40 | - {$td->FILE => "a.pdf"}, | ||
| 41 | - {$td->FILE => "unrotated.pdf"}); | 40 | + {$td->COMMAND => "qpdf-test-compare a.pdf unrotated.pdf"}, |
| 41 | + {$td->FILE => "unrotated.pdf", $td->EXIT_STATUS => 0}); | ||
| 42 | 42 | ||
| 43 | $td->runtest("rotate all pages", | 43 | $td->runtest("rotate all pages", |
| 44 | {$td->COMMAND => | 44 | {$td->COMMAND => |
| 45 | "qpdf --static-id --rotate=180 minimal.pdf a.pdf"}, | 45 | "qpdf --static-id --rotate=180 minimal.pdf a.pdf"}, |
| 46 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 46 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 47 | $td->runtest("check output", | 47 | $td->runtest("check output", |
| 48 | - {$td->FILE => "a.pdf"}, | ||
| 49 | - {$td->FILE => "minimal-rotated.pdf"}); | 48 | + {$td->COMMAND => "qpdf-test-compare a.pdf minimal-rotated.pdf"}, |
| 49 | + {$td->FILE => "minimal-rotated.pdf", $td->EXIT_STATUS => 0}); | ||
| 50 | 50 | ||
| 51 | $td->runtest("flatten with inherited rotate", | 51 | $td->runtest("flatten with inherited rotate", |
| 52 | {$td->COMMAND => | 52 | {$td->COMMAND => |
| @@ -54,8 +54,8 @@ $td->runtest("flatten with inherited rotate", | @@ -54,8 +54,8 @@ $td->runtest("flatten with inherited rotate", | ||
| 54 | " inherited-rotate.pdf a.pdf"}, | 54 | " inherited-rotate.pdf a.pdf"}, |
| 55 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 55 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 56 | $td->runtest("check output", | 56 | $td->runtest("check output", |
| 57 | - {$td->FILE => "a.pdf"}, | ||
| 58 | - {$td->FILE => "inherited-flattened.pdf"}); | 57 | + {$td->COMMAND => "qpdf-test-compare a.pdf inherited-flattened.pdf"}, |
| 58 | + {$td->FILE => "inherited-flattened.pdf", $td->EXIT_STATUS => 0}); | ||
| 59 | 59 | ||
| 60 | foreach my $angle (qw(90 180 270)) | 60 | foreach my $angle (qw(90 180 270)) |
| 61 | { | 61 | { |
qpdf/qtest/specific-file.test
| @@ -33,15 +33,15 @@ $td->runtest("compress objstm and xref", | @@ -33,15 +33,15 @@ $td->runtest("compress objstm and xref", | ||
| 33 | {$td->STRING => "", $td->EXIT_STATUS => 0}, | 33 | {$td->STRING => "", $td->EXIT_STATUS => 0}, |
| 34 | $td->NORMALIZE_NEWLINES); | 34 | $td->NORMALIZE_NEWLINES); |
| 35 | $td->runtest("check output", | 35 | $td->runtest("check output", |
| 36 | - {$td->FILE => "a.pdf"}, | ||
| 37 | - {$td->FILE => "compress-objstm-xref.pdf"}); | 36 | + {$td->COMMAND => "qpdf-test-compare a.pdf compress-objstm-xref.pdf"}, |
| 37 | + {$td->FILE => "compress-objstm-xref.pdf", $td->EXIT_STATUS => 0}); | ||
| 38 | $td->runtest("qdf + preserved-unreferenced + xref streams", | 38 | $td->runtest("qdf + preserved-unreferenced + xref streams", |
| 39 | {$td->COMMAND => "qpdf --qdf --preserve-unreferenced" . | 39 | {$td->COMMAND => "qpdf --qdf --preserve-unreferenced" . |
| 40 | " --static-id compress-objstm-xref.pdf a.pdf"}, | 40 | " --static-id compress-objstm-xref.pdf a.pdf"}, |
| 41 | {$td->STRING => "", $td->EXIT_STATUS => 0}); | 41 | {$td->STRING => "", $td->EXIT_STATUS => 0}); |
| 42 | $td->runtest("check output", | 42 | $td->runtest("check output", |
| 43 | - {$td->FILE => "a.pdf"}, | ||
| 44 | - {$td->FILE => "compress-objstm-xref-qdf.pdf"}); | 43 | + {$td->COMMAND => "qpdf-test-compare a.pdf compress-objstm-xref-qdf.pdf"}, |
| 44 | + {$td->FILE => "compress-objstm-xref-qdf.pdf", $td->EXIT_STATUS => 0}); | ||
| 45 | $td->runtest("check fix-qdf idempotency", | 45 | $td->runtest("check fix-qdf idempotency", |
| 46 | {$td->COMMAND => "fix-qdf a.pdf"}, | 46 | {$td->COMMAND => "fix-qdf a.pdf"}, |
| 47 | {$td->FILE => "a.pdf", $td->EXIT_STATUS => 0}); | 47 | {$td->FILE => "a.pdf", $td->EXIT_STATUS => 0}); |
qpdf/qtest/stream-replacements.test
| @@ -21,8 +21,8 @@ $td->runtest("replace stream data", | @@ -21,8 +21,8 @@ $td->runtest("replace stream data", | ||
| 21 | {$td->STRING => "test 7 done\n", $td->EXIT_STATUS => 0}, | 21 | {$td->STRING => "test 7 done\n", $td->EXIT_STATUS => 0}, |
| 22 | $td->NORMALIZE_NEWLINES); | 22 | $td->NORMALIZE_NEWLINES); |
| 23 | $td->runtest("check output", | 23 | $td->runtest("check output", |
| 24 | - {$td->FILE => "a.pdf"}, | ||
| 25 | - {$td->FILE => "replaced-stream-data.pdf"}); | 24 | + {$td->COMMAND => "qpdf-test-compare a.pdf replaced-stream-data.pdf"}, |
| 25 | + {$td->FILE => "replaced-stream-data.pdf", $td->EXIT_STATUS => 0}); | ||
| 26 | $td->runtest("replace stream data compressed", | 26 | $td->runtest("replace stream data compressed", |
| 27 | {$td->COMMAND => "test_driver 8 qstream.pdf"}, | 27 | {$td->COMMAND => "test_driver 8 qstream.pdf"}, |
| 28 | {$td->FILE => "test8.out", $td->EXIT_STATUS => 0}, | 28 | {$td->FILE => "test8.out", $td->EXIT_STATUS => 0}, |