aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/decode-parameters.test
blob: 10ac64c10f865c8add99b70658a805a76807cfd0 (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
#!/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('decode-parameters');

my $n_tests = 6;

# Make sure we ignore decode parameters that we don't understand
$td->runtest("unknown decode parameters",
             {$td->COMMAND => "qpdf --check fax-decode-parms.pdf"},
             {$td->FILE => "fax-decode-parms.out",
              $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);

$td->runtest("ignore broken decode parms with no filters",
             {$td->COMMAND => "qpdf --check broken-decode-parms-no-filter.pdf"},
             {$td->FILE => "broken-decode-parms-no-filter.out",
              $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);

$td->runtest("stream with indirect decode parms",
             {$td->COMMAND =>
                  "qpdf --static-id indirect-decode-parms.pdf a.pdf"},
             {$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("check file",
             {$td->COMMAND => "qpdf-test-compare a.pdf indirect-decode-parms-out.pdf"},
             {$td->FILE => "indirect-decode-parms-out.pdf", $td->EXIT_STATUS => 0});

$td->runtest("decode parameters empty list",
             {$td->COMMAND => "qpdf --static-id empty-decode-parms.pdf a.pdf"},
             {$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("check file",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "empty-decode-parms-out.pdf"});

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