4 #use lib qw(blib/lib blib/arch);
6 # Before `make install' is performed this script should be runnable with
7 # `make test'. After `make install' it should work as `perl test.pl'
9 ######################### We start with some black magic to print on failure.
11 # Change 1..1 below to 1..last_test_to_print .
12 # (It may become useful if the test is moved to ./t subdirectory.)
14 BEGIN { $| = 1; print "1..7\n"; }
15 END {print "not ok 1\n" unless $::loaded;}
20 init_log("testout/t36oofont.log", 1);
22 my $fontname_tt=$ENV{'TTFONTTEST'}||'./fontfiles/dodge.ttf';
23 my $fontname_pfb=$ENV{'T1FONTTESTPFB'}||'./fontfiles/dcr10.pfb';
26 my $green=Imager::Color->new(92,205,92,128);
27 die $Imager::ERRSTR unless $green;
28 my $red=Imager::Color->new(205, 92, 92, 255);
29 die $Imager::ERRSTR unless $red;
33 if (i_has_format("t1") and -f $fontname_pfb) {
35 my $img=Imager->new(xsize=>300, ysize=>100) or die "$Imager::ERRSTR\n";
37 my $font=Imager::Font->new(file=>$fontname_pfb,size=>25)
38 or die $img->{ERRSTR};
42 $img->string(font=>$font, text=>"XMCLH", 'x'=>100, 'y'=>100)
43 or die $img->{ERRSTR};
47 $img->line(x1=>0, x2=>300, y1=>50, y2=>50, color=>$green);
50 my @bbox=$font->bounding_box(string=>$text, 'x'=>0, 'y'=>50);
52 print @bbox ? '' : 'not ', "ok 4\n";
54 $img->box(box=>\@bbox, color=>$green);
56 $img->write(file=>"testout/t36oofont1.ppm", type=>'pnm')
57 or die "cannot write to testout/t36oofont1.ppm: $img->{ERRSTR}\n";
60 print "ok 2 # skip\n";
61 print "ok 3 # skip\n";
62 print "ok 4 # skip\n";
65 if (i_has_format("tt") and -f $fontname_tt) {
67 my $img=Imager->new(xsize=>300, ysize=>100) or die "$Imager::ERRSTR\n";
69 my $font=Imager::Font->new(file=>$fontname_tt,size=>25)
70 or die $img->{ERRSTR};
74 $img->string(font=>$font, text=>"XMCLH", 'x'=>100, 'y'=>100)
75 or die $img->{ERRSTR};
79 $img->line(x1=>0, x2=>300, y1=>50, y2=>50, color=>$green);
82 my @bbox=$font->bounding_box(string=>$text, 'x'=>0, 'y'=>50);
84 print @bbox ? '' : 'not ', "ok 7\n";
86 $img->box(box=>\@bbox, color=>$green);
88 $img->write(file=>"testout/t36oofont2.ppm", type=>'pnm')
89 or die "cannot write to testout/t36oofont2.ppm: $img->{ERRSTR}\n";
92 print "ok 5 # skip\n";
93 print "ok 6 # skip\n";
94 print "ok 7 # skip\n";