hoist all the copies of cmpimg into a common module
[imager-graph.git] / t / t34horizontal_many_points.t
CommitLineData
43c5d51b 1#!perl -w
2use strict;
3use Imager::Graph::Bar;
4use lib 't/lib';
5use Imager::Font::Test;
6use Test::More;
119bb3de 7use Imager::Graph::Test 'cmpimg';
43c5d51b 8
9-d 'testout'
10 or mkdir "testout", 0700
11 or die "Could not create output directory: $!";
12
13++$|;
14
15my @warned;
16local $SIG{__WARN__} =
17 sub {
18 print STDERR $_[0];
19 push @warned, $_[0]
20 };
21
22
23use Imager qw(:handy);
24
25plan tests => 4;
26
27#my $fontfile = 'ImUgly.ttf';
28#my $font = Imager::Font->new(file=>$fontfile, type => 'ft2', aa=>1)
29# or plan skip_all => "Cannot create font object: ",Imager->errstr,"\n";
30my $font = Imager::Font::Test->new();
31
32my @data = (1 .. 1000);
33
34my $bar = Imager::Graph::Bar->new();
35ok($bar, "creating bar chart object");
36
37$bar->add_data_series(\@data);
38
39my $img1 = $bar->draw();
40ok($img1, "drawing bar chart");
41
42$img1->write(file=>'testout/t34_points.ppm') or die "Can't save img1: ".$img1->errstr."\n";
5a50139d 43cmpimg($img1, 'testimg/t34_points.ppm', 80_000);
43c5d51b 44
45unless (is(@warned, 0, "should be no warnings")) {
46 diag($_) for @warned;
47}