2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-06-12 15:12:22 +00:00
qpdf/qpdf/qtest/specialized-filter.test
2022-05-20 09:16:25 -04:00

45 lines
1.3 KiB
Perl

#!/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));