File: version.t

package info (click to toggle)
libpdf-api2-perl 2.047-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 20,228 kB
  • sloc: perl: 42,227; makefile: 11
file content (61 lines) | stat: -rw-r--r-- 1,464 bytes parent folder | download | duplicates (2)
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
51
52
53
54
55
56
57
58
59
60
61
use Test::More;

use strict;
use warnings;

use PDF::API2;

my $pdf = PDF::API2->new(compress => 0);
$pdf->{'pdf'}->header_version('1.3');
$pdf->{'pdf'}->trailer_version('1.5');

is($pdf->version(), '1.5',
   q{version() returns whichever version is largest (1/2)});

$pdf->{'pdf'}->header_version('1.6');

is($pdf->version(), '1.6',
   q{version() returns whichever version is largest (2/2)});

$pdf->version('1.7');

is($pdf->version(), '1.7',
   q{version() is settable});

is($pdf->{'pdf'}->header_version(), '1.7',
   q{version() sets header version});

is($pdf->{'pdf'}->trailer_version(), '1.7',
   q{version() sets trailer version});

my $string = $pdf->to_string();

like($string, qr/%PDF-1.7/,
     q{Expected header version is present});

like($string, qr{/Version /1.7},
     q{Expected trailer version is present});

$pdf = PDF::API2->new(compress => 0);
$pdf->{'pdf'}->header_version('1.3');
$pdf->{'pdf'}->trailer_version('1.4');

my $version = $pdf->{'pdf'}->require_version('1.3');

is($version, '1.4',
   q{require_version returns current version});

$pdf->{'pdf'}->require_version('1.4');

is($pdf->{'pdf'}->header_version(), '1.3',
   q{require_version doesn't increase header version if trailer is sufficient});

$version = $pdf->{'pdf'}->require_version('1.5');

is($pdf->version(), '1.5',
   q{require_version increases version when needed});

is($version, '1.4',
   q{require_version returns the previous version number});

done_testing();