aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/page-without-contents.test
blob: 51f4eb7964d2f7d02205de67f411529679be707b (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
#!/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('page-without-contents');

my $n_tests = 7;

$td->runtest("check no contents",
             {$td->COMMAND => "qpdf --check no-contents.pdf"},
             {$td->FILE => "no-contents-check.out", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);

foreach my $arg ('--qdf', '--coalesce-contents', '')
{
    $td->runtest("convert no contents ($arg)",
                 {$td->COMMAND =>
                      "qpdf $arg --static-id no-contents.pdf a.pdf"},
                 {$td->STRING => "", $td->EXIT_STATUS => 0});

    my $suf = $arg;
    $suf =~ s/--//;
    if ($suf eq '')
    {
        $suf = "none";
    }
    $td->runtest("check output",
                 {$td->FILE => "a.pdf"},
                 {$td->FILE => "no-contents-$suf.pdf"});
}

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