mirror of
https://github.com/qpdf/qpdf.git
synced 2024-11-18 10:25:12 +00:00
cb769c62e5
This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon.
58 lines
1.8 KiB
Perl
58 lines
1.8 KiB
Perl
#!/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 $xshow = $show ? $show : "x";
|
|
my $xstyle = $style ? $style : "x";
|
|
my $out = "test.$xshow.$xstyle.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->REGEXP => "pdf-bookmarks processing file 3.pdf: " .
|
|
".*unable to find trailer.*",
|
|
$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->runtest("non-trivial pdf doc to unicode",
|
|
{$td->COMMAND => "pdf-bookmarks issue-179.pdf"},
|
|
{$td->FILE => "issue-179.out",
|
|
$td->EXIT_STATUS => 0},
|
|
$td->NORMALIZE_NEWLINES);
|
|
|
|
$td->report(11);
|