Bug 7143 about.tt indentation fixes
[koha.git] / t / Creators.t
blob720aa2cf723c5bcef48932022e1e02b046ef8b39
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use strict;
7 use warnings;
9 use Test::More tests => 15;
11 BEGIN {
12 use_ok('C4::Creators');
13 use_ok('C4::Creators::PDF');
16 my $pdf_creator = C4::Creators::PDF->new('test.pdf' => '', InitVars => 0);
17 ok($pdf_creator, "testing new() works");
18 if (-e 'test.pdf') {
19 pass('testing pdf file created');
21 else {
22 fail('testing pdf file created');
25 ok($pdf_creator->Add(""), "testing Add() works");
26 ok($pdf_creator->Bookmark({}), "testing Bookmark() works");
27 ok($pdf_creator->Compress(1), "testing Compress() works");
29 is($pdf_creator->Font("H"), "Ft1", "testing Font() works");
30 is($pdf_creator->FontSize(), '12', "testing FontSize() is set to 12 by default");
31 my @result = $pdf_creator->FontSize(14);
32 is($result[0], '14', "testing FontSize() can be set to a different value");
33 $pdf_creator->FontSize(); # Reset font size before testing text width etc below
35 ok($pdf_creator->Page(), "testing Page() works");
37 is($pdf_creator->StrWidth("test", "H", 12), '19.344', "testing StrWidth() returns correct point width");
39 @result = $pdf_creator->Text(10, 10, "test");
40 is($result[0], '10', "testing Text() writes from a given x-value");
41 is($result[1], '29.344', "testing Text() writes to the correct x-value");
43 ok($pdf_creator->End(), "testing End() works");
45 unlink 'test.pdf';