aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qtest/create.test
blob: ca5fbd2338e69cff5e66e0c0e0e40f9bf6a91f45 (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
#!/usr/bin/env perl
require 5.008;
use warnings;
use strict;

chdir("create") or die "chdir testdir failed: $!\n";

require TestDriver;

cleanup();

my $td = new TestDriver('create');

# This test is fragile on Windows for unknown reasons. Sometimes the
# output of the command is truncated even though it works and exits
# normally.

for (my $i = 0; $i < 5; ++$i)
{
    unlink "tmp.out";
    if ((system("pdf-create a.pdf > tmp.out") == 0) &&
        open(F, "<check.tmpout"))
    {
        local $/ = undef;
        my $text = <F>;
        close(F);
        if ($text =~ m/passed/)
        {
            last;
        }
    }
    sleep 1;
}

$td->runtest("create a simple PDF",
	     {$td->FILE => "tmp.out"},
	     {$td->FILE => "create.out"},
             $td->NORMALIZE_NEWLINES);

cleanup();

$td->report(1);

sub cleanup
{
    unlink "a.pdf";
    unlink "tmp.out";
}