]> git.imager.perl.org - imager.git/blob - t/t55trans.t
the rubthrough() method now supports destination images with an alpha
[imager.git] / t / t55trans.t
1 BEGIN { $| = 1; print "1..5\n"; }
2 END {print "not ok 1\n" unless $loaded;}
3 use Imager;
4
5 $loaded = 1;
6
7 #$Imager::DEBUG=1;
8
9 Imager::init('log'=>'testout/t55trans.log');
10
11 $img=Imager->new() || die "unable to create image object\n";
12
13 print "ok 1\n";
14
15 $img->open(file=>'testimg/scale.ppm',type=>'pnm');
16
17 sub skip { 
18     print "ok 2 # skip $_[0]\n";
19     print "ok 3 # skip $_[0]\n";
20     print "ok 4 # skip $_[0]\n";
21     print "ok 5 # skip $_[0]\n";
22     exit(0);
23 }
24
25
26 $nimg=$img->transform(xexpr=>'x',yexpr=>'y+10*sin((x+y)/10)') || skip ( "\# warning ".$img->{'ERRSTR'} );
27
28 #       xopcodes=>[qw( x y Add)],yopcodes=>[qw( x y Sub)],parm=>[]
29
30 print "ok 2\n";
31 $nimg->write(type=>'pnm',file=>'testout/t55.ppm') || die "error in write()\n";
32
33 print "ok 3\n";
34
35 # the original test didn't produce many parameters - this one
36 # produces more parameters, which revealed a memory allocation bug
37 # (sizeof(double) vs sizeof(int))
38 sub skip2 { 
39     print "ok 4 # skip $_[0]\n";
40     print "ok 5 # skip $_[0]\n";
41     exit(0);
42 }
43 $nimg=$img->transform(xexpr=>'x+0.1*y+5*sin(y/10.0+1.57)',
44         yexpr=>'y+10*sin((x+y-0.785)/10)') 
45         || skip2 ( "\# warning ".$img->{'ERRSTR'} );
46
47 print "ok 4\n";
48 $nimg->write(type=>'pnm',file=>'testout/t55b.ppm') 
49         || die "error in write()\n";
50
51 print "ok 5\n";
52
53