# Change 1..1 below to 1..last_test_to_print .
# (It may become useful if the test is moved to ./t subdirectory.)
use strict;
-use Test::More tests => 55;
+use Test::More tests => 58;
BEGIN { use_ok(Imager => ':all') }
#$Imager::DEBUG=1;
SKIP:
{
if (!(i_has_format("t1")) ) {
- skip("t1lib unavailable or disabled", 49);
+ skip("t1lib unavailable or disabled", 57);
}
elsif (! -f $fontname_pfb) {
- skip("cannot find fontfile for type 1 test $fontname_pfb", 49);
+ skip("cannot find fontfile for type 1 test $fontname_pfb", 57);
}
elsif (! -f $fontname_afm) {
- skip("cannot find fontfile for type 1 test $fontname_afm", 49);
+ skip("cannot find fontfile for type 1 test $fontname_afm", 57);
}
print "# has t1\n";
ok($font, "loaded deffont OO")
or skip("could not load font:".Imager->errstr, 4);
my $im = Imager->new(xsize=>70, ysize=>150);
- my %common =
+ my %common1 =
(
font=>$font,
- text=>'Ay',
+ text=>'A',
size=>40,
color=>'white',
x=>5,
aa=>1,
);
- ok($im->string(%common, 'y'=>40), "no alignment");
- ok($im->string(%common, 'y'=>90, align=>1), "align=1");
- ok($im->string(%common, 'y'=>110, align=>0), "align=0");
+ my %common2 =
+ (
+ font=>$font,
+ text=>'y',
+ size=>40,
+ color=>'white',
+ x=>40,
+ aa=>1,
+ );
$im->line(x1=>0, y1=>40, x2=>69, y2=>40, color=>'blue');
$im->line(x1=>0, y1=>90, x2=>69, y2=>90, color=>'blue');
$im->line(x1=>0, y1=>110, x2=>69, y2=>110, color=>'blue');
+ ok($im->string(%common1, 'y'=>40), "no alignment A");
+ ok($im->string(%common2, 'y'=>40), "no alignment y");
+ ok($im->string(%common1, 'y'=>90, align=>1), "align=1");
+ ok($im->string(%common2, 'y'=>90, align=>1), "align=1");
+ ok($im->string(%common1, 'y'=>110, align=>0), "align=0");
+ ok($im->string(%common2, 'y'=>110, align=>0), "align=0");
ok($im->write(file=>'testout/t30align.ppm'), "save align image");
}
}
#!perl -w
use strict;
use lib 't';
-use Test::More tests => 54;
+use Test::More tests => 57;
BEGIN { use_ok(Imager => ':all') }
require "t/testtools.pl";
SKIP:
{
- skip("freetype 1.x unavailable or disabled", 48)
+ skip("freetype 1.x unavailable or disabled", 56)
unless i_has_format("tt");
print "# has tt\n";
if (!ok(-f $fontname, "check test font file exists")) {
print "# cannot find fontfile for truetype test $fontname\n";
- skip('Cannot load test font', 47);
+ skip('Cannot load test font', 55);
}
i_init_fonts();
undef $hcfont;
my $name_font = "fontfiles/NameTest.ttf";
- $hcfont = Imager::Font->new(file=>$name_font);
+ $hcfont = Imager::Font->new(file=>$name_font, type=>'tt');
SKIP:
{
ok($hcfont, "loading name font")
ok($font, "loaded deffont OO")
or skip("could not load font:".Imager->errstr, 4);
my $im = Imager->new(xsize=>70, ysize=>150);
- my %common =
+ my %common1 =
(
font=>$font,
- text=>'Ay',
+ text=>'A',
size=>40,
color=>'white',
x=>5,
aa=>1,
);
- ok($im->string(%common, 'y'=>40), "no alignment");
- ok($im->string(%common, 'y'=>90, align=>1), "align=1");
- ok($im->string(%common, 'y'=>110, align=>0), "align=0");
+ my %common2 =
+ (
+ font=>$font,
+ text=>'y',
+ size=>40,
+ color=>'white',
+ x=>40,
+ aa=>1,
+ );
$im->line(x1=>0, y1=>40, x2=>69, y2=>40, color=>'blue');
$im->line(x1=>0, y1=>90, x2=>69, y2=>90, color=>'blue');
$im->line(x1=>0, y1=>110, x2=>69, y2=>110, color=>'blue');
+ ok($im->string(%common1, 'y'=>40), "A no alignment");
+ ok($im->string(%common2, 'y'=>40), "y no alignment");
+ ok($im->string(%common1, 'y'=>90, align=>1), "A align=1");
+ ok($im->string(%common2, 'y'=>90, align=>1), "y align=1");
+ ok($im->string(%common1, 'y'=>110, align=>0), "A align=0");
+ ok($im->string(%common2, 'y'=>110, align=>0), "y align=0");
ok($im->write(file=>'testout/t35align.ppm'), "save align image");
}
#!perl -w
use strict;
-use Test::More tests => 149;
+use Test::More tests => 152;
++$|;
# Before `make install' is performed this script should be runnable with
# `make test'. After `make install' it should work as `perl test.pl'
SKIP:
{
- i_has_format("ft2") or skip("no freetype2 library found", 137);
+ i_has_format("ft2") or skip("no freetype2 library found", 151);
print "# has ft2\n";
my $fontname=$ENV{'TTFONTTEST'}||'./fontfiles/dodge.ttf';
- -f $fontname or skip("cannot find fontfile $fontname", 137);
+ -f $fontname or skip("cannot find fontfile $fontname", 151);
my $bgcolor=i_color_new(255,0,0,0);
SKIP:
{ print "# alignment tests\n";
- my $font = Imager::Font->new(file=>'fontfiles/ImUgly.ttf', type=>'tt');
+ my $font = Imager::Font->new(file=>'fontfiles/ImUgly.ttf', type=>'ft2');
ok($font, "loaded deffont OO")
or skip("could not load font:".Imager->errstr, 4);
my $im = Imager->new(xsize=>70, ysize=>150);
- my %common =
+ my %common1 =
(
font=>$font,
- text=>'Ay',
+ text=>'A',
size=>40,
color=>'white',
x=>5,
aa=>1,
);
- ok($im->string(%common, 'y'=>40), "no alignment");
- ok($im->string(%common, 'y'=>90, align=>1), "align=1");
- ok($im->string(%common, 'y'=>110, align=>0), "align=0");
+ my %common2 =
+ (
+ font=>$font,
+ text=>'y',
+ size=>40,
+ color=>'white',
+ x=>40,
+ aa=>1,
+ );
$im->line(x1=>0, y1=>40, x2=>69, y2=>40, color=>'blue');
$im->line(x1=>0, y1=>90, x2=>69, y2=>90, color=>'blue');
$im->line(x1=>0, y1=>110, x2=>69, y2=>110, color=>'blue');
+ ok($im->string(%common1, 'y'=>40), "A no alignment");
+ ok($im->string(%common2, 'y'=>40), "y no alignment");
+ ok($im->string(%common1, 'y'=>90, align=>1), "A align=1");
+ ok($im->string(%common2, 'y'=>90, align=>1), "y align=1");
+ ok($im->string(%common1, 'y'=>110, align=>0), "A align=0");
+ ok($im->string(%common2, 'y'=>110, align=>0), "y align=0");
ok($im->write(file=>'testout/t38align.ppm'), "save align image");
}
}