1#!perl -w
2use strict;
3use lib '../t';
4use Test::More tests => 8;
5BEGIN { use_ok(Imager => qw(:default)); }
6use Config;
7use Imager::Test qw(test_image);
8
9#$Imager::DEBUG=1;
10
11-d "testout" or mkdir "testout";
12
13Imager->open_log(log => 'testout/t60dyntest.log');
14
15my $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
20my $plug='./dyntest.'.$Config{'so'};
21ok(load_plugin($plug), "load plugin")
22  || die "unable to load plugin: $Imager::ERRSTR\n";
23
24my %hsh=(a=>35,b=>200,type=>'lin_stretch');
25ok($img->filter(%hsh), "call filter");
26
27$img->write(type=>'pnm',file=>'testout/linstretch.ppm')
28  || die "error in write()\n";
29
30ok(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
42Imager->close_log;
43
44unless ($ENV{IMAGER_KEEP_FILES}) {
45  unlink "testout/linstretch.ppm";
46  unlink "testout/flines.ppm";
47  unlink "testout/t60dyntest.log";
48  rmdir "testout";
49}
50
51