| 
      
            Lines 1-12
          
      
      
        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 Test::More tests => 16;  | 
              16 | 
              use Test::More tests => 41;  | 
            
        
          | 10 | 
           | 
          17 | 
           | 
        
        
          | 11 | 
          BEGIN { | 
          18 | 
          BEGIN { | 
        
        
          | 12 | 
                  use_ok('C4::Creators'); | 
          19 | 
                  use_ok('C4::Creators'); | 
        
  
    | 
      
            Lines 50-55
          is($pdf_creator->StrWidth("test", "H", 12), $expected_width, "testing StrWidth()
      
      
        Link Here
      
     | 
  
        
          | 50 | 
          is($result[0], '10', "testing Text() writes from a given x-value");  | 
          57 | 
          is($result[0], '10', "testing Text() writes from a given x-value");  | 
        
        
          | 51 | 
          is($result[1], $expected_offset, "testing Text() writes to the correct x-value");  | 
          58 | 
          is($result[1], $expected_offset, "testing Text() writes to the correct x-value");  | 
        
        
          | 52 | 
           | 
          59 | 
           | 
        
            
               | 
               | 
              60 | 
              my $font_types = C4::Creators::Lib::get_font_types();  | 
            
            
              | 61 | 
              isa_ok( $font_types, 'ARRAY', 'get_font_types' );  | 
            
            
              | 62 | 
               | 
            
            
              | 63 | 
              my $y = 50;  | 
            
            
              | 64 | 
              foreach my $font ( @$font_types ) { | 
            
            
              | 65 | 
              	ok( $pdf_creator->Font( $font->{type} ), 'Font ' . $font->{type} ); | 
            
            
              | 66 | 
              	ok( $pdf_creator->Text(10, $y, "\x{10C}evap\x{10D}i\x{107} " . $font->{name} . ' - ' . $font->{type} ), 'Text ' . $font->{name}); | 
            
            
              | 67 | 
              	$y += $pdf_creator->FontSize() * 1.2;  | 
            
            
              | 68 | 
              }  | 
            
            
              | 69 | 
               | 
            
        
          | 53 | 
          open(my $fh, '>', 'test.pdf');  | 
          70 | 
          open(my $fh, '>', 'test.pdf');  | 
        
        
          | 54 | 
          select $fh;  | 
          71 | 
          select $fh;  | 
        
        
          | 55 | 
           | 
          72 | 
           | 
        
  
    | 
      
            Lines 58-61
          ok($pdf_creator->End(), "testing End() works");
      
      
        Link Here
      
     | 
  
        
          | 58 | 
          close($fh);  | 
          75 | 
          close($fh);  | 
        
        
          | 59 | 
          ok( -s 'test.pdf', 'test.pdf created' );  | 
          76 | 
          ok( -s 'test.pdf', 'test.pdf created' );  | 
        
        
          | 60 | 
           | 
          77 | 
           | 
        
          
            
              | 61 | 
              unlink 'test.pdf';  | 
              78 | 
              unlink 'test.pdf' unless $ENV{KEEP_PDF}; | 
            
            
              | 62 | 
              -   | 
               | 
               |