#!/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('progress-reporting');

my $n_tests = 3;

$td->runtest("progress report on small file",
             {$td->COMMAND =>
                  "qpdf --progress --deterministic-id minimal.pdf a.pdf",
                  $td->FILTER => "perl filter-progress.pl"},
             {$td->FILE => "small-progress.out", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("progress report to stdout",
             {$td->COMMAND =>
                  "qpdf --progress --deterministic-id minimal.pdf - > b.pdf",
                  $td->FILTER => "perl filter-progress.pl"},
             {$td->FILE => "small-stdout-progress.out", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("compare",
             {$td->FILE => "a.pdf"},
             {$td->FILE => "b.pdf"});

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