]> git.imager.perl.org - imager.git/blob - t/t68map.t
use $Config{path_sep} instead of working it out on our own
[imager.git] / t / t68map.t
1 Imager::init("log"=>'testout/t68map.log');
2
3 use Imager qw(:all :handy);
4
5 print "1..5\n";
6
7 my $imbase = Imager::ImgRaw::new(200,300,3);
8
9
10 @map1 = map { int($_/2) } 0..255;
11 @map2 = map { 255-int($_/2) } 0..255;
12 @map3 = 0..255;
13 @maps = 0..24;
14 @mapl = 0..400;
15
16 $tst = 1;
17
18 i_map($imbase, [ [],     [],     \@map1 ]);
19 print "ok ".$tst++."\n";
20 i_map($imbase, [ \@map1, \@map1, \@map1 ]);
21
22 print "ok ".$tst++."\n";
23 i_map($imbase, [ \@map1, \@map2, \@map3 ]);
24
25 print "ok ".$tst++."\n";
26 i_map($imbase, [ \@maps, \@mapl, \@map3 ]);
27
28 # test the highlevel interface
29 # currently this requires visual inspection of the output files
30
31
32 my $im = Imager->new;
33 if ($im->read(file=>'testimg/scale.ppm')) {
34   print( ( $im->map(red=>\@map1, green=>\@map2, blue=>\@map3) ? "ok " : "not ok ").$tst++."\n" );
35   print( ( $im->map(maps=>[\@map1, [], \@map2]) ? "ok " : "not ok "). $tst++."\n");
36 }
37 else {
38   die "could not load testout/scale.ppm\n";
39 }