#!/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('unicode-filenames');

my $n_tests = 3;

$td->runtest("create unicode filenames",
             {$td->COMMAND => "test_unicode_filenames"},
             {$td->STRING => "created Unicode filenames\n",
                  $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);

foreach my $d (['auto-ü', 1], ['auto-öπ', 2])
{
    my ($u, $n) = @$d;
    $td->runtest("unicode filename $u",
                 {$td->COMMAND => "qpdf --check $u.pdf"},
                 {$td->FILE => "check-unicode-filename-$n.out",
                      $td->EXIT_STATUS => 0},
                 $td->NORMALIZE_NEWLINES);
}

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