]> git.imager.perl.org - imager.git/blob - t/t101nojpeg.t
add mutex functions to the API
[imager.git] / t / t101nojpeg.t
1 #!perl -w
2 use strict;
3 use Test::More;
4 use Imager qw(:all);
5
6 -d "testout" or mkdir "testout";
7
8 Imager->open_log(log => "testout/t101jpeg.log");
9
10 $Imager::formats{"jpeg"}
11   and plan skip_all => "have jpeg support - this tests the lack of it";
12
13 plan tests => 6;
14
15 my $im = Imager->new;
16 ok(!$im->read(file=>"testimg/base.jpg"), "should fail to read jpeg");
17 cmp_ok($im->errstr, '=~', qr/format 'jpeg' not supported/, "check no jpeg message");
18 $im = Imager->new(xsize=>2, ysize=>2);
19 ok(!$im->write(file=>"testout/nojpeg.jpg"), "should fail to write jpeg");
20 cmp_ok($im->errstr, '=~', qr/format 'jpeg' not supported/, "check no jpeg message");
21 ok(!grep($_ eq 'jpeg', Imager->read_types), "check jpeg not in read types");
22 ok(!grep($_ eq 'jpeg', Imager->write_types), "check jpeg not in write types");
23
24 Imager->close_log;
25
26 unless ($ENV{IMAGER_KEEP_FILES}) {
27   unlink "testout/t101jpeg.log";
28 }