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
|
use Test::More tests => 5;
use strict;
use warnings;
no warnings 'deprecated';
use PDF::API2;
use PDF::API2::Resource::XObject::Image::JPEG;
my $pdf = PDF::API2->new();
my $image = PDF::API2::Resource::XObject::Image::JPEG->new_api($pdf, 't/resources/1x1.jpg');
ok($image, q{new_api still works});
##
## PDF::API2
##
$pdf = PDF::API2->new();
$pdf->page->gfx->fillcolor('blue');
my $pdf_string = $pdf->to_string();
# openScalar
$pdf = PDF::API2->openScalar($pdf_string);
is(ref($pdf), 'PDF::API2',
q{openScalar still works});
# importpage
my $pdf2 = PDF::API2->new();
my $page = $pdf2->importpage($pdf, 1);
is(ref($page), 'PDF::API2::Page',
q{importpage still works});
# openpage
$pdf2 = PDF::API2->from_string($pdf_string);
$page = $pdf->openpage(1);
is(ref($page), 'PDF::API2::Page',
q{openpage still works});
# Invalid input to pageLabel (#40)
{
$pdf = PDF::API2->new();
local $SIG{__WARN__} = sub {};
$pdf->pageLabel(0, { -style => 'arabic' });
like($pdf->to_string(), qr{/PageLabels << /Nums \[ 0 << /S /D >> \] >>},
q{pageLabel defaults to decimal if given invalid input});
}
|