File: 02_open.t

package info (click to toggle)
libpdf-api2-simple-perl 1.1.4u-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 172 kB
  • sloc: perl: 823; makefile: 2
file content (26 lines) | stat: -rw-r--r-- 604 bytes parent folder | download | duplicates (4)
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
use Test::More tests => 8;

use_ok(PDF::API2::Simple);

eval{ PDF::API2::Simple->open(); };

ok( $@, 'Caught missing open_file.');

like( $@, qr/Must provide an open_file param for open/, 'Correct error message.');
my $pdf = PDF::API2::Simple->open(
    open_file => 't/files/test.pdf',
    open_page => 2,
    file => 't/files/outfile.pdf',
);

ok( $pdf, 'Got a pdf object back.' );

ok( $pdf->add_font('Arial'), 'Added a font.');

ok( $pdf->text('some text'), 'Added some text.');

$pdf->save();

ok( (-e 't/files/outfile.pdf'), 'File created.');

ok( (unlink 't/files/outfile.pdf'), 'File removed.');