File: 01-basic.t

package info (click to toggle)
libpdf-api2-perl 2.019-1%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 20,264 kB
  • sloc: perl: 42,313; sh: 23; makefile: 9
file content (50 lines) | stat: -rw-r--r-- 950 bytes parent folder | download | duplicates (7)
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
50
use Test::More tests => 7;

use warnings;
use strict;

use PDF::API2;

my $pdf = PDF::API2->new();

isa_ok($pdf,
       'PDF::API2',
       q{PDF::API2->new() returns a PDF::API2 object});

my $page = $pdf->page();

isa_ok($page,
       'PDF::API2::Page',
       q{$pdf->page() returns a PDF::API2::Page object});

my $gfx = $page->gfx();

isa_ok($gfx,
       'PDF::API2::Content',
       q{$pdf->gfx() returns a PDF::API2::Content object});

my $text = $page->text();

isa_ok($text,
       'PDF::API2::Content::Text',
       q{$pdf->text() returns a PDF::API2::Content::Text object});


is($pdf->pages(),
   1,
   q{$pdf->pages() returns 1 on a one-page PDF});

# Insert a second page
$page = $pdf->page();

is($pdf->pages(),
   2,
   q{$pdf->pages() returns 2 after a second page is added});

# Open a PDF

$pdf = PDF::API2->open('t/resources/sample.pdf');

isa_ok($pdf,
       'PDF::API2',
       q{PDF::API2->open() returns a PDF::API2 object});