3 use Test::More tests => 14;
4 use Imager::Test qw(is_image);
7 # SGI files are limited to 0xFFFF x 0xFFFF pixels
9 my $im = Imager->new(xsize => 0x10000, ysize => 1);
11 ok(!$im->write(data => \$data, type => "sgi"),
12 "fail to write too wide an image");
13 is($im->errstr, "image too large for SGI",
14 "check error message");
18 my $im = Imager->new(xsize => 0xFFFF, ysize => 1);
19 $im->box(fill => { hatch => "check4x4" });
21 ok($im->write(data => \$data, type => "sgi"),
22 "write image at width limit");
23 my $im2 = Imager->new(data => $data, ftype => "sgi");
24 ok($im2, "read it ok")
25 or skip("cannot load the wide image", 1);
26 is_image($im, $im2, "check we read what we wrote");
27 is($im->getwidth, 0xffff, "check width");
28 is($im->getheight, 1, "check height");
31 my $im = Imager->new(xsize => 1, ysize => 0x10000);
33 ok(!$im->write(data => \$data, type => "sgi"),
34 "fail to write too tall an image");
35 is($im->errstr, "image too large for SGI",
36 "check error message");
40 my $im = Imager->new(xsize => 1, ysize => 0xFFFF);
41 $im->box(fill => { hatch => "check2x2" });
43 ok($im->write(data => \$data, type => "sgi"),
44 "write image at width limit");
45 my $im2 = Imager->new(data => $data, ftype => "sgi");
46 ok($im2, "read it ok")
47 or skip("cannot load the wide image", 1);
48 is_image($im, $im2, "check we read what we wrote");
49 is($im->getwidth, 1, "check width");
50 is($im->getheight, 0xffff, "check height");