| 1 |
#!perl -w |
| 2 |
use strict; |
| 3 |
use Imager; |
| 4 |
use Test::More; |
| 5 |
|
| 6 |
# test handling of unknown file formats |
| 7 |
|
| 8 |
my $log_file = "testout/file-200-nosuch.log"; |
| 9 |
|
| 10 |
Imager->open_log(log => $log_file); |
| 11 |
|
| 12 |
my $im = Imager->new; |
| 13 |
ok(!$im->read(file => "testimg/base.jpg", type=> "unknown"), |
| 14 |
"check we can't read 'unknown' format files"); |
| 15 |
like($im->errstr, qr/format 'unknown' not supported/, |
| 16 |
"check no unknown message"); |
| 17 |
$im = Imager->new(xsize => 2, ysize => 2); |
| 18 |
ok(!$im->write(file => "testout/nosuch.unknown", type => "unknown"), |
| 19 |
"check we can't write 'unknown' format files"); |
| 20 |
like($im->errstr, qr/format 'unknown' not supported/, |
| 21 |
"check no 'unknown' message"); |
| 22 |
|
| 23 |
ok(!grep($_ eq "unknown", Imager->read_types), |
| 24 |
"check unknown not in read types"); |
| 25 |
ok(!grep($_ eq "unknown", Imager->write_types), |
| 26 |
"check unknown not in write types"); |
| 27 |
|
| 28 |
done_testing(); |
| 29 |
|
| 30 |
Imager->close_log; |
| 31 |
|
| 32 |
unless ($ENV{IMAGER_KEEP_FILES}) { |
| 33 |
unlink $log_file; |
| 34 |
} |