View | Details | Raw Unified | Return to bug 12194
Collapse All | Expand All

(-)a/t/Creators.t (-5 / +21 lines)
Lines 1-13 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
#
2
#
3
# This Koha test module is a stub!
3
# This module will excercise pdf creation routines
4
# Add more tests here!!!
4
#
5
# When run with KEEP_PDF enviroment variable it will keep
6
# test.pdf for manual inspection. This can be used to verify
7
# that ttf font configuration is complete like:
8
#
9
# KEEP_PDF=1 KOHA_CONF=/etc/koha/sites/srvgit/koha-conf.xml prove t/Creators.t
10
#
11
# sample of utf-8 text, font name and type will be on bottom of second page
5
12
6
use strict;
13
use strict;
7
use warnings;
14
use warnings;
8
15
9
use File::Temp qw/ tempfile  /;
16
use File::Temp qw/ tempfile  /;
10
use Test::More tests => 16;
17
use Test::More tests => 41;
11
18
12
BEGIN {
19
BEGIN {
13
        use_ok('C4::Creators');
20
        use_ok('C4::Creators');
Lines 51-56 is($pdf_creator->StrWidth("test", "H", 12), $expected_width, "testing StrWidth() Link Here
51
is($result[0], '10', "testing Text() writes from a given x-value");
58
is($result[0], '10', "testing Text() writes from a given x-value");
52
is($result[1], $expected_offset, "testing Text() writes to the correct x-value");
59
is($result[1], $expected_offset, "testing Text() writes to the correct x-value");
53
60
61
my $font_types = C4::Creators::Lib::get_font_types();
62
isa_ok( $font_types, 'ARRAY', 'get_font_types' );
63
64
my $y = 50;
65
foreach my $font ( @$font_types ) {
66
	ok( $pdf_creator->Font( $font->{type} ), 'Font ' . $font->{type} );
67
	ok( $pdf_creator->Text(10, $y, "\x{10C}evap\x{10D}i\x{107} " . $font->{name} . ' - ' . $font->{type} ), 'Text ' . $font->{name});
68
	$y += $pdf_creator->FontSize() * 1.2;
69
}
70
54
my  ($fh, $filename) = tempfile();
71
my  ($fh, $filename) = tempfile();
55
open(  $fh, '>', $filename );
72
open(  $fh, '>', $filename );
56
select $fh;
73
select $fh;
Lines 59-62 ok($pdf_creator->End(), "testing End() works"); Link Here
59
76
60
close($fh);
77
close($fh);
61
ok( -s $filename , "test file $filename created OK" );
78
ok( -s $filename , "test file $filename created OK" );
62
unlink $filename ;
79
unlink $filename unless $ENV{KEEP_PDF};
63
- 

Return to bug 12194