119bb3de |
1 | #!perl |
267997be |
2 | use strict; |
3 | |
4 | use Imager::Graph::Line; |
5 | use lib 't/lib'; |
6 | use Imager::Font::Test; |
7 | use Test::More; |
119bb3de |
8 | use Imager::Graph::Test 'cmpimg'; |
267997be |
9 | |
10 | -d 'testout' |
11 | or mkdir "testout", 0700 |
12 | or die "Could not create output directory: $!"; |
13 | |
14 | ++$|; |
15 | |
16 | my @warned; |
17 | local $SIG{__WARN__} = |
18 | sub { |
19 | print STDERR $_[0]; |
20 | push @warned, $_[0] |
21 | }; |
22 | |
23 | |
24 | use Imager qw(:handy); |
25 | |
26 | plan tests => 2; |
27 | |
28 | |
29 | my $font = Imager::Font::Test->new(); |
30 | |
31 | my $graph = Imager::Graph::Line->new(); |
32 | $graph->set_image_width(900); |
33 | $graph->set_image_height(600); |
34 | $graph->set_font($font); |
35 | |
36 | $graph->add_data_series([1, 2]); |
37 | $graph->set_labels(['AWWWWWWWWWWWWWWA', 'AWWWWWWWWWWWWWWWWWWWWWWWWWWWWWA']); |
38 | |
39 | my $img = $graph->draw() || warn $graph->error; |
40 | |
8b7d23b0 |
41 | cmpimg($img, 'testimg/t33_long_labels.png', 200_000); |
267997be |
42 | $img->write(file=>'testout/t33_long_labels.ppm') or die "Can't save img1: ".$img->errstr."\n"; |
267997be |
43 | |
44 | unless (is(@warned, 0, "should be no warnings")) { |
45 | diag($_) for @warned; |
46 | } |