mirror of
https://github.com/qpdf/qpdf.git
synced 2024-09-21 09:39:09 +00:00
57 lines
2.1 KiB
Perl
57 lines
2.1 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 = 5;
|
|
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);
|
|
# TC:SF_FlateLzwDecode PNG filter
|
|
# PDF:Table 8:Columns
|
|
# The test file is invalid as it does not actually use one column (as is implied by the missing
|
|
# key). However png-filters-1-column.pdf is the same file with /Columns explicitely set to 1,
|
|
# and displays the same as png-filters-no-columns.pdf and png-filters-no-columns-decoded.pdf.
|
|
$td->runtest("decode flate no /Columns",
|
|
{$td->COMMAND => "qpdf --static-id --compress-streams=n --decode-level=all" .
|
|
" png-filters-no-columns.pdf a.pdf"},
|
|
{$td->STRING => "", $td->EXIT_STATUS => 0},
|
|
$td->NORMALIZE_NEWLINES);
|
|
$td->runtest("check output",
|
|
{$td->FILE => "a.pdf"},
|
|
{$td->FILE => "png-filters-no-columns-decoded.pdf"});
|
|
cleanup();
|
|
$td->report(calc_ntests($n_tests, $n_compare_pdfs));
|