aboutsummaryrefslogtreecommitdiffstats
path: root/qpdf/qtest/c-api-stream.test
blob: 1ea2c95fb01223d757b26dc6b9ce6a7e0037c073 (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('c-api-stream');

my $n_tests = 5;

$td->runtest("C read streams",
             {$td->COMMAND =>
                  "qpdf-ctest 38 11-pages.pdf '' ''"},
             {$td->FILE => "c-get-stream.out", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);

$td->runtest("C foreign object",
             {$td->COMMAND =>
                  "qpdf-ctest 39 11-pages.pdf '' a.pdf minimal.pdf"},
             {$td->STRING => "C test 39 done\n", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check output",
             {$td->FILE => 'a.pdf'},
             {$td->FILE => 'c-foreign.pdf'});

$td->runtest("C new stream",
             {$td->COMMAND =>
                  "qpdf-ctest 40 minimal.pdf '' a.pdf"},
             {$td->STRING => "C test 40 done\n", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check output",
             {$td->FILE => 'a.pdf'},
             {$td->FILE => 'c-new-stream.pdf'});
cleanup();
$td->report($n_tests);