| 1 |
#!perl -w |
| 2 |
use strict; |
| 3 |
use lib '../t'; |
| 4 |
use Test::More tests => 8; |
| 5 |
BEGIN { use_ok(Imager => qw(:default)); } |
| 6 |
use Config; |
| 7 |
use Imager::Test qw(test_image); |
| 8 |
|
| 9 |
#$Imager::DEBUG=1; |
| 10 |
|
| 11 |
-d "testout" or mkdir "testout"; |
| 12 |
|
| 13 |
Imager->open_log(log => 'testout/t60dyntest.log'); |
| 14 |
|
| 15 |
my $img=Imager->new() || die "unable to create image object\n"; |
| 16 |
|
| 17 |
$img->read(file=>'../testimg/penguin-base.ppm',type=>'pnm') |
| 18 |
|| die "failed: ",$img->{ERRSTR},"\n"; |
| 19 |
|
| 20 |
my $plug='./dyntest.'.$Config{'so'}; |
| 21 |
ok(load_plugin($plug), "load plugin") |
| 22 |
|| die "unable to load plugin: $Imager::ERRSTR\n"; |
| 23 |
|
| 24 |
my %hsh=(a=>35,b=>200,type=>'lin_stretch'); |
| 25 |
ok($img->filter(%hsh), "call filter"); |
| 26 |
|
| 27 |
$img->write(type=>'pnm',file=>'testout/linstretch.ppm') |
| 28 |
|| die "error in write()\n"; |
| 29 |
|
| 30 |
ok(unload_plugin($plug), "unload plugin") |
| 31 |
|| die "unable to unload plugin: $Imager::ERRSTR\n"; |
| 32 |
|
| 33 |
{ |
| 34 |
my $flines = "./flines.$Config{so}"; |
| 35 |
ok(load_plugin($flines), "load flines"); |
| 36 |
my $im = test_image(); |
| 37 |
ok($im->filter(type => "flines"), "do the flines test"); |
| 38 |
ok($im->write(file => "testout/flines.ppm"), "save flines result"); |
| 39 |
ok(unload_plugin($flines), "unload flines"); |
| 40 |
} |
| 41 |
|
| 42 |
Imager->close_log; |
| 43 |
|
| 44 |
unless ($ENV{IMAGER_KEEP_FILES}) { |
| 45 |
unlink "testout/linstretch.ppm"; |
| 46 |
unlink "testout/flines.ppm"; |
| 47 |
unlink "testout/t60dyntest.log"; |
| 48 |
rmdir "testout"; |
| 49 |
} |
| 50 |
|