aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qtest/bookmarks.test
blob: ba8be25fad6c2aaf6eeaae2f0819748dbcefe0fa (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
49
#!/usr/bin/env perl
require 5.008;
BEGIN { $^W = 1; }
use strict;

chdir("bookmarks");

require TestDriver;

my $td = new TestDriver('pdf-bookmarks');

foreach my $show ("", " -show-open")
{
    foreach my $style ("", " -lines", " -numbers")
    {
	my $out = "test.$show.$style.out";
	$out =~ s/ //g;
	$td->runtest("show:$show, style:$style",
		     {$td->COMMAND => "pdf-bookmarks $show $style 1.pdf"},
		     {$td->FILE => $out, $td->EXIT_STATUS => 0},
		     $td->NORMALIZE_NEWLINES);
    }
}
$td->runtest("no bookmarks",
	     {$td->COMMAND => "pdf-bookmarks 2.pdf"},
	     {$td->STRING => "2.pdf has no bookmarks\n",
	      $td->EXIT_STATUS => 0},
	     $td->NORMALIZE_NEWLINES);

$td->runtest("bad",
	     {$td->COMMAND => "pdf-bookmarks 3.pdf"},
	     {$td->STRING => "pdf-bookmarks processing file 3.pdf: " .
		  "3.pdf: not a PDF file\n",
		  $td->EXIT_STATUS => 2},
	     $td->NORMALIZE_NEWLINES);

$td->runtest("encrypted, targets",
	     {$td->COMMAND => "pdf-bookmarks -show-targets 4.pdf user"},
	     {$td->FILE => "encrypted.out",
	      $td->EXIT_STATUS => 0},
	     $td->NORMALIZE_NEWLINES);

$td->runtest("bookmarks deleted",
	     {$td->COMMAND => "pdf-bookmarks 5.pdf user"},
	     {$td->STRING => "5.pdf has no bookmarks\n",
	      $td->EXIT_STATUS => 0},
	     $td->NORMALIZE_NEWLINES);

$td->report(10);