mirror of
https://github.com/qpdf/qpdf.git
synced 2024-06-17 09:22:22 +00:00
42 lines
1.3 KiB
Plaintext
42 lines
1.3 KiB
Plaintext
|
#!/usr/bin/env perl
|
||
|
require 5.008;
|
||
|
use warnings;
|
||
|
use strict;
|
||
|
|
||
|
unshift(@INC, '.');
|
||
|
require qpdf_test_helpers;
|
||
|
|
||
|
chdir("qpdf") or die "chdir testdir failed: $!\n";
|
||
|
|
||
|
require TestDriver;
|
||
|
|
||
|
cleanup();
|
||
|
|
||
|
my $td = new TestDriver('preserve_unref');
|
||
|
|
||
|
my $n_tests = 6;
|
||
|
|
||
|
$td->runtest("drop unused objects",
|
||
|
{$td->COMMAND => "qpdf --static-id unreferenced-objects.pdf a.pdf"},
|
||
|
{$td->STRING => "", $td->EXIT_STATUS => 0});
|
||
|
$td->runtest("check output",
|
||
|
{$td->FILE => "a.pdf"},
|
||
|
{$td->FILE => "unreferenced-dropped.pdf"});
|
||
|
$td->runtest("keep unused objects",
|
||
|
{$td->COMMAND => "qpdf --static-id --preserve-unreferenced" .
|
||
|
" unreferenced-objects.pdf a.pdf"},
|
||
|
{$td->STRING => "", $td->EXIT_STATUS => 0});
|
||
|
$td->runtest("check output",
|
||
|
{$td->FILE => "a.pdf"},
|
||
|
{$td->FILE => "unreferenced-preserved.pdf"});
|
||
|
$td->runtest("keep unused objects (C)",
|
||
|
{$td->COMMAND =>
|
||
|
"qpdf-ctest 21 unreferenced-objects.pdf '' a.pdf"},
|
||
|
{$td->STRING => "C test 21 done\n", $td->EXIT_STATUS => 0},
|
||
|
$td->NORMALIZE_NEWLINES);
|
||
|
$td->runtest("check output",
|
||
|
{$td->FILE => "a.pdf"},
|
||
|
{$td->FILE => "unreferenced-preserved.pdf"});
|
||
|
cleanup();
|
||
|
$td->report($n_tests);
|