1 |
#!/usr/bin/perl -w |
2 |
|
3 |
use strict; |
4 |
use blib; |
5 |
|
6 |
use Test::More; |
7 |
|
8 |
BEGIN { |
9 |
|
10 |
eval "use CAM::PDF"; |
11 |
|
12 |
if ( $@ ) { |
13 |
plan skip_all => "CAM::PDF required for WebPAC::Input::PDF"; |
14 |
} else { |
15 |
plan tests => 11; |
16 |
} |
17 |
|
18 |
use_ok( 'WebPAC::Test' ); |
19 |
use_ok( 'WebPAC::Input' ); |
20 |
} |
21 |
|
22 |
my $module = 'WebPAC::Input::PDF'; |
23 |
diag "testing with $module"; |
24 |
|
25 |
ok(my $input = new WebPAC::Input( |
26 |
module => $module, |
27 |
no_progress_bar => 1, |
28 |
%LOG |
29 |
), "new"); |
30 |
|
31 |
ok(my $db = $input->open( |
32 |
path => "$abs_path/data/UFOReport1998.pdf" |
33 |
), "open"); |
34 |
ok(my $size = $input->size, "size"); |
35 |
|
36 |
$size = 3; |
37 |
|
38 |
foreach my $mfn ( 1 ... $size ) { |
39 |
my $rec = $input->fetch; |
40 |
if ($mfn <= 10 || $mfn == 20) { |
41 |
ok($rec, "fetch $mfn"); |
42 |
} else { |
43 |
ok(! $rec, "empty $mfn"); |
44 |
} |
45 |
|
46 |
cmp_ok($input->pos, '==', $mfn, "pos $mfn"); |
47 |
|
48 |
diag "rec: ", dump($rec), "\n" if $debug; |
49 |
} |
50 |
|