]> git.imager.perl.org - imager.git/blob - t/t55trans.t
ba1c6a0b968ea367428ecf8e25520323cda77afb
[imager.git] / t / t55trans.t
1 #!perl -w
2 use strict;
3 use Test::More;
4 use Imager;
5
6 eval "use Affix::Infix2Postfix; 1;"
7   or plan skip_all => "No Affix::Infix2Postfix";
8
9 plan tests => 6;
10
11 #$Imager::DEBUG=1;
12
13 -d "testout" or mkdir "testout";
14
15 Imager->open_log('log'=>'testout/t55trans.log');
16
17 my $img=Imager->new();
18
19 SKIP:
20 {
21   ok($img, "make image object")
22     or skip("can't make image object", 5);
23
24   ok($img->open(file=>'testimg/scale.ppm',type=>'pnm'),
25      "read sample image")
26     or skip("couldn't load test image", 4);
27
28  SKIP:
29   {
30     my $nimg=$img->transform(xexpr=>'x',yexpr=>'y+10*sin((x+y)/10)');
31     ok($nimg, "do transformation")
32       or skip ( "warning ".$img->errstr, 1 );
33
34     #   xopcodes=>[qw( x y Add)],yopcodes=>[qw( x y Sub)],parm=>[]
35
36     ok($nimg->write(type=>'pnm',file=>'testout/t55.ppm'), "save to file");
37   }
38
39  SKIP:
40   {
41     my $nimg=$img->transform(xexpr=>'x+0.1*y+5*sin(y/10.0+1.57)',
42                              yexpr=>'y+10*sin((x+y-0.785)/10)');
43     ok($nimg, "more complex transform")
44       or skip("couldn't make image", 1);
45
46     ok($nimg->write(type=>'pnm',file=>'testout/t55b.ppm'), "save to file");
47   }
48 }
49
50