mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-05 08:02:11 +00:00
42 lines
1.3 KiB
Perl
42 lines
1.3 KiB
Perl
#!/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);
|