aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/extensions-dictionary.test
blob: d96b29f4710ba249397b4fa459e6b264e6d39cc3 (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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/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('extensions-dictionary');

my @ext_inputs = ('minimal.pdf', 'extensions-adbe.pdf',
                  'extensions-other.pdf', 'extensions-adbe-other.pdf');
my @new_versions = ('1.3', '1.6', '1.7.1', '1.7.2', '1.7.3',
                    '1.8', '1.8.0', '1.8.2', '1.8.5');
my $n_tests = (4 * @new_versions + 3) * @ext_inputs;
foreach my $input (@ext_inputs)
{
    my $base = $input;
    $base =~ s/\.pdf$//;
    if ($base eq 'minimal')
    {
        $base = 'extensions-none';
    }
    foreach my $version (@new_versions)
    {
        foreach my $op (qw(min force))
        {
            $td->runtest("$input: $op version to $version",
                         {$td->COMMAND =>
                              "qpdf --static-id" .
                              " --$op-version=$version $input a.pdf"},
                         {$td->STRING => "", $td->EXIT_STATUS => 0});
            $td->runtest("check version information ($op $version)",
                         {$td->COMMAND => "test_driver 34 a.pdf"},
                         {$td->FILE => "$base-$op-$version.out",
                          $td->EXIT_STATUS => 0},
                         $td->NORMALIZE_NEWLINES);
            if (($op eq 'force') && ($version eq '1.8.5'))
            {
                # Look at the actual file for a few cases to make sure
                # qdf and non-qdf output are okay
                $td->runtest("check file",
                             {$td->COMMAND => "qpdf-test-compare a.pdf $base-$op-$version.pdf"},
                             {$td->FILE => "$base-$op-$version.pdf", $td->EXIT_STATUS => 0});
                $td->runtest("$input: $op version to $version",
                             {$td->COMMAND =>
                                  "qpdf --qdf --static-id" .
                                  " --$op-version=$version $input a.qdf"},
                             {$td->STRING => "", $td->EXIT_STATUS => 0});
                $td->runtest("check file",
                             {$td->COMMAND => "qpdf-test-compare a.qdf $base-$op-$version.qdf"},
                             {$td->FILE => "$base-$op-$version.qdf", $td->EXIT_STATUS => 0});
            }
        }
    }
}
cleanup();
$td->report($n_tests);