@@ -9,7 +9,7 @@ diag "\nChecking $image_name";
99
1010my %prereqs = (
1111 ' Archive::Tar' => ' ' ,
12- ' Archive::Zip' => ' <= 1.65?(cloud6| cloud7|addons)' ,
12+ ' Archive::Zip' => ' <= 1.65?(cloud7|addons)' ,
1313 ' DBI' => ' 1.633' ,
1414 ' GD' => 0,
1515 ' Graphics::Magick' => 0,
@@ -79,6 +79,8 @@ for my $module (sort keys %prereqs) {
7979my ($perl_version ) = ` perl -v` =~ / v(5\.\d +\.\d +)/ ;
8080ok $perl_version , " $image_name : Perl exists ($perl_version )" ;
8181
82+ my @image_files = glob (" ./t/images/*" );
83+
8284my $gd_version = eval { GD::LIBGD_VERSION() } || 0;
8385my $gd_version_str = eval { GD::VERSION_STRING() } || ' unknown' ;
8486note " $image_name : GD version $gd_version ($gd_version_str )" ;
@@ -88,11 +90,23 @@ if ($gd_version >= 2.0101) {
8890 ok eval { GD::supportsFileType(' test.jpg' ) }, " $image_name : GD supports JPEG" ;
8991 ok eval { GD::supportsFileType(' test.bmp' ) }, " $image_name : GD supports BMP" ;
9092 ok eval { GD::supportsFileType(' test.webp' ) }, " $image_name : GD supports WEBP" ;
91- SKIP: {
93+ SKIP: {
9294 local $TODO = ' AVIF may not be supported' ;
9395 ok eval { GD::supportsFileType(' test.avif' ) }, " $image_name : GD supports AVIF" ;
9496 }
9597}
98+ require GD::Image;
99+ for my $file (@image_files ) {
100+ my $gd = GD::Image-> new($file );
101+ if (!$gd ) {
102+ # bmp support is broken on all the known images
103+ local $TODO = ' GD does not support BMP?' if $file =~ / \. bmp$ / or ($file =~ / \. webp$ / && $image_name =~ / ^(?:addons8|amazonlinux|centos|cloud7|fedora3[579]|fedora40|oracle|rockylinux)/ );
104+ fail " $image_name : GD failed to read $file " ;
105+ next ;
106+ }
107+ my ($w , $h ) = $gd -> getBounds();
108+ ok $w && $h , " $image_name : GD can get size of $file " ;
109+ }
96110
97111my $has_imager_webp = eval { require Imager::File::WEBP };
98112my $has_imager_avif = eval { require Imager::File::AVIF };
@@ -109,6 +123,16 @@ SKIP: {
109123 local $TODO = ' AVIF may not be supported' unless $has_imager_avif ;
110124 ok $imager_supports {avif }, " $image_name : Imager supports AVIF" ;
111125}
126+ for my $file (@image_files ) {
127+ next if $file =~ / \. webp$ / and !$has_imager_webp ;
128+ my $imager = Imager-> new;
129+ if (!$imager -> read (file => $file )) {
130+ fail " $image_name : Imager failed to read $file " ;
131+ next ;
132+ }
133+ my ($w , $h ) = ($imager -> getwidth, $imager -> getheight);
134+ ok $w && $h , " $image_name : Imager can get size of $file " ;
135+ }
112136
113137my %imagemagick_supports = map { $_ => 1 } Image::Magick-> QueryFormat;
114138ok $imagemagick_supports {gif }, " $image_name : ImageMagick supports GIF" ;
@@ -126,6 +150,17 @@ SKIP: {
126150my $imagemagick_depth = Image::Magick-> new-> Get(' depth' );
127151is $imagemagick_depth => ' 16' , " $image_name : ImageMagick Quantum Depth: Q$imagemagick_depth " ;
128152
153+ for my $file (@image_files ) {
154+ next if $file =~ / \. webp$ / and $image_name =~ / ^(?:amazonlinux|centos7|oracle)$ / ;
155+ my $magick = Image::Magick-> new;
156+ if (my $error = $magick -> Read($file )) {
157+ fail " $image_name : ImageMagick failed to read $file : $error " ;
158+ next ;
159+ }
160+ my ($w , $h ) = $magick -> Get(' width' , ' height' );
161+ ok $w && $h , " $image_name : ImageMagick can get sizes of $file " ;
162+ }
163+
129164my %graphicsmagick_supports = map { $_ => 1 } Graphics::Magick-> QueryFormat;
130165ok $graphicsmagick_supports {gif }, " $image_name : GraphicsMagick supports GIF" ;
131166ok $graphicsmagick_supports {png }, " $image_name : GraphicsMagick supports PNG" ;
@@ -138,12 +173,23 @@ SKIP: {
138173}
139174my $graphicsmagick_depth = Graphics::Magick-> new-> Get(' depth' );
140175is $graphicsmagick_depth => ' 16' , " $image_name : GraphicsMagick Quantum Depth: Q$graphicsmagick_depth " ;
176+
177+ for my $file (@image_files ) {
178+ my $magick = Graphics::Magick-> new;
179+ if (my $error = $magick -> Read($file )) {
180+ fail " $image_name : GraphicsMagick failed to read $file : $error " ;
181+ next ;
182+ }
183+ my ($w , $h ) = $magick -> Get(' width' , ' height' );
184+ ok $w && $h , " $image_name : GraphicsMagick can get sizes of $file " ;
185+ }
186+
141187my ($has_identify ) = ` which identify` ;
142- ok $has_identify , " has identify" ;
188+ ok $has_identify , " $image_name : has identify" ;
143189my ($has_convert ) = ` which convert` ;
144- ok $has_convert , " has convert" ;
190+ ok $has_convert , " $image_name : has convert" ;
145191my ($has_gm ) = ` which gm` ;
146- ok $has_gm , " has gm" ;
192+ ok $has_gm , " $image_name : has gm" ;
147193
148194my ($php_version ) = ` php --version` =~ / PHP (\d\.\d +\.\d +)/ ;
149195ok $php_version , " $image_name : PHP exists ($php_version )" ;
@@ -160,15 +206,15 @@ if ($image_name eq 'postgresql') {
160206} else {
161207 ok $phpinfo =~ / PDO drivers => .*?mysql/ , " $image_name : PHP has PDO mysql driver" ;
162208}
163- ok $phpinfo =~ / GD Support => enabled/ , " $image_name : PHP has GD" ;
164- ok $phpinfo =~ / DOM.XML => enabled/ , " $image_name : PHP has DOM/XML" ;
209+ ok $phpinfo =~ / GD Support => enabled/ , " $image_name : PHP has GD" ;
210+ ok $phpinfo =~ / DOM.XML => enabled/ , " $image_name : PHP has DOM/XML" ;
165211ok $phpinfo =~ / GIF Read Support => enabled/ , " $image_name : PHP supports GIF read" ;
166212ok $phpinfo =~ / GIF Create Support => enabled/ , " $image_name : PHP supports GIF create" ;
167213ok $phpinfo =~ / JPEG Support => enabled/ , " $image_name : PHP supports JPEG" ;
168214ok $phpinfo =~ / PNG Support => enabled/ , " $image_name : PHP supports PNG" ;
169- ok $phpinfo =~ / WebP Support => enabled/ , " $image_name : PHP supports WebP" ;
215+ ok $phpinfo =~ / WebP Support => enabled/ , " $image_name : PHP supports WebP" ;
170216SKIP: {
171- local $TODO = ' Memcache may not be supported' if $image_name =~ / amazonlinux|oracle|centos8 / ;
217+ local $TODO = ' Memcache may not be supported' if $image_name =~ / amazonlinux|oracle/ ;
172218 ok $phpinfo =~ / memcache support => enabled/ , " $image_name : PHP supports memcache" ;
173219}
174220if ($image_name =~ / oracle/ ) {
@@ -205,7 +251,9 @@ for my $line (@wanted_lines) {
205251SKIP: {
206252 my ($phpunit ) = (` phpunit --version` // ' ' ) =~ / PHPUnit (\d +\.\d +\.\d +)/ ;
207253 ok $phpunit , " $image_name : phpunit exists ($phpunit )" ;
208- if ($php_version_number >= 8.2) {
254+ if ($php_version_number >= 8.3) {
255+ is substr ($phpunit , 0, 2) => 12, " $image_name : phpunit 12 (12.x.x) for php >= 8.3 ($php_version )" ;
256+ } elsif ($php_version_number >= 8.2) {
209257 is substr ($phpunit , 0, 2) => 11, " $image_name : phpunit 11 (11.x.x) for php >= 8.2 ($php_version )" ;
210258 } elsif ($php_version_number >= 8.1) {
211259 is substr ($phpunit , 0, 2) => 10, " $image_name : phpunit 10 (10.x.x) for php >= 8.1 ($php_version )" ;
0 commit comments