aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/specialized-filter.test
blob: 284d5195d0d1d39ce9a198b56c44ff138e837cc5 (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
#!/usr/bin/env perl
require 5.008;
use warnings;
use strict;
use Digest::MD5;
use File::Copy;

unshift(@INC, '.');
require qpdf_test_helpers;

chdir("qpdf") or die "chdir testdir failed: $!\n";

require TestDriver;

cleanup();

my $td = new TestDriver('specialized-filter');

my $n_tests = 3;
my $n_compare_pdfs = 1;

# The PDF file was submitted on bug #83 on github. All the PNG filters
# are exercised. The test suite does not exercise PNG predictors with
# LZW because I don't have a way to create such a file, but it's very
# likely that it will work since the handling of the PNG filters is
# separate from the regular decompression.
$td->runtest("decode png-filtering",
             {$td->COMMAND => "qpdf --static-id" .
                  " --compress-streams=n --decode-level=generalized" .
                  " png-filters.pdf a.pdf"},
             {$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("check output",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "png-filters-decoded.pdf"});
compare_pdfs($td, "png-filters.pdf", "a.pdf");

$td->runtest("stream with tiff predictor",
             {$td->COMMAND => "qpdf --check tiff-predictor.pdf"},
             {$td->FILE => "tiff-predictor.out",
              $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);

cleanup();
$td->report(calc_ntests($n_tests, $n_compare_pdfs));