aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/coalesce-contents.test
blob: bd02a97ec7995c0ea0b7c6fa8a11ea32ed98b8a2 (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
49
50
51
52
53
#!/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('coalesce-contents');

my $n_tests = 8;

$td->runtest("qdf with normalize warnings",
             {$td->COMMAND =>
                  "qpdf --qdf --static-id split-tokens.pdf a.pdf"},
             {$td->FILE => "normalize-warnings.out", $td->EXIT_STATUS => 3},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check output",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "split-tokens.qdf"});
$td->runtest("coalesce to qdf",
             {$td->COMMAND =>
                  "qpdf --qdf --static-id coalesce.pdf a.pdf"},
             {$td->STRING => "", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check output",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "coalesce.qdf"});
$td->runtest("coalesce contents with qdf",
             {$td->COMMAND =>
                  "qpdf --qdf --static-id" .
                  " --coalesce-contents coalesce.pdf a.pdf"},
             {$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("check output",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "coalesce-out.qdf"});
$td->runtest("coalesce contents without qdf",
             {$td->COMMAND =>
                  "qpdf --static-id" .
                  " --coalesce-contents coalesce.pdf a.pdf"},
             {$td->STRING => "", $td->EXIT_STATUS => 0});
$td->runtest("check output",
             {$td->COMMAND => "qpdf-test-compare a.pdf coalesce-out.pdf"},
             {$td->FILE => "coalesce-out.pdf", $td->EXIT_STATUS => 0});

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