2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-23 11:28:56 +00:00
qpdf/examples/qtest/create.test
2019-01-07 12:51:34 -05:00

49 lines
874 B
Perl

#!/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";
}