aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/xref-streams.test
blob: 10a3276353ac679639276ad9f4236fd7128673e2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/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('xref-streams');

my $n_tests = 3;

# Handle xref stream with more entries than reported (bug 2872265)
$td->runtest("xref with short size",
             {$td->COMMAND => "qpdf --show-xref xref-with-short-size.pdf"},
             {$td->FILE => "xref-with-short-size.out",
              $td->EXIT_STATUS => 3},
             $td->NORMALIZE_NEWLINES);
$td->runtest("recover xref with short size",
             {$td->COMMAND => "qpdf xref-with-short-size.pdf a.pdf"},
             {$td->FILE => "xref-with-short-size-recover.out",
              $td->EXIT_STATUS => 3},
             $td->NORMALIZE_NEWLINES);
$td->runtest("show new xref stream",
             {$td->COMMAND => "qpdf --show-xref a.pdf"},
             {$td->FILE => "xref-with-short-size-new.out",
              $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);

cleanup();
$td->report($n_tests);