aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/object-copying.test
blob: 54d41b15cf2cc76bcf06f4a4cb63d75b71f010a5 (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
54
55
#!/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('object-copying');

my $n_tests = 9;

$td->runtest("shallow copy an array",
             {$td->COMMAND => "test_driver 20 shallow_array.pdf"},
             {$td->STRING => "test 20 done\n", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check output",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "shallow_array-out.pdf"});
$td->runtest("shallow copy a stream",
             {$td->COMMAND => "test_driver 21 shallow_array.pdf"},
             {$td->FILE => "shallow_stream.out", $td->EXIT_STATUS => 2},
             $td->NORMALIZE_NEWLINES);
$td->runtest("warn for unknown key in Pages",
             {$td->COMMAND => "test_driver 23 lin-special.pdf"},
             {$td->FILE => "pages-warning.out", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("reserved objects",
             {$td->COMMAND => "test_driver 24 minimal.pdf"},
             {$td->FILE => "reserved-objects.out", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check output",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "reserved-objects.pdf"});
$td->runtest("detect foreign object in write",
             {$td->COMMAND => "test_driver 29" .
                  " copy-foreign-objects-in.pdf minimal.pdf"},
             {$td->FILE => "foreign-in-write.out", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("copy a stream",
             {$td->COMMAND => "test_driver 79 minimal.pdf"},
             {$td->STRING => "test 79 done\n", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check output",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "test79.pdf"});

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