0.12 release
[imager-graph.git] / t / t33_long_labels.t
CommitLineData
119bb3de 1#!perl
267997be 2use strict;
3
4use Imager::Graph::Line;
5use lib 't/lib';
6use Imager::Font::Test;
7use Test::More;
119bb3de 8use 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
16my @warned;
17local $SIG{__WARN__} =
18 sub {
19 print STDERR $_[0];
20 push @warned, $_[0]
21 };
22
23
24use Imager qw(:handy);
25
26plan tests => 2;
27
28
29my $font = Imager::Font::Test->new();
30
31my $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
39my $img = $graph->draw() || warn $graph->error;
40
8b7d23b0 41cmpimg($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
44unless (is(@warned, 0, "should be no warnings")) {
45 diag($_) for @warned;
46}