2eac77fc |
1 | #!perl -w |
2 | use strict; |
3 | use Imager::Graph::Line; |
4 | use lib 't/lib'; |
5 | use Imager::Font::Test; |
6 | use Test::More; |
7 | |
8 | -d 'testout' |
9 | or mkdir "testout", 0700 |
10 | or die "Could not create output directory: $!"; |
11 | |
12 | ++$|; |
13 | |
28acfd43 |
14 | my @warned; |
15 | local $SIG{__WARN__} = |
16 | sub { |
17 | print STDERR $_[0]; |
18 | push @warned, $_[0] |
19 | }; |
20 | |
21 | |
2eac77fc |
22 | use Imager qw(:handy); |
23 | |
28acfd43 |
24 | plan tests => 3; |
2eac77fc |
25 | |
26 | #my $fontfile = 'ImUgly.ttf'; |
27 | #my $font = Imager::Font->new(file=>$fontfile, type => 'ft2', aa=>1) |
28 | # or plan skip_all => "Cannot create font object: ",Imager->errstr,"\n"; |
29 | my $font = Imager::Font::Test->new(); |
30 | |
31 | my @data = ( 100, 180, 80, 20, 2, 1, 0.5 ); |
32 | my @labels = qw(alpha beta gamma delta epsilon phi gi); |
33 | |
34 | my $line = Imager::Graph::Line->new(); |
35 | ok($line, "creating line chart object"); |
36 | |
37 | $line->add_data_series(\@data); |
38 | $line->set_labels(\@labels); |
39 | |
40 | my $img1 = $line->draw(); |
41 | ok($img1, "drawing line chart"); |
42 | |
43 | $img1->write(file=>'testout/t11_basic.ppm') or die "Can't save img1: ".$img1->errstr."\n"; |
44 | |
28acfd43 |
45 | unless (is(@warned, 0, "should be no warnings")) { |
46 | diag($_) for @warned; |
47 | } |