| 1 | Description: with the test files excluded, the tests need to be adapted |
| 2 | Author: Paul Gevers <[email protected]> |
| 3 | Forwarded: not needed |
| 4 | |
| 5 | --- a/t/jpeg.t |
| 6 | +++ b/t/jpeg.t |
| 7 | @@ -11,7 +11,7 @@ use Image::Scale; |
| 8 | my $jpeg_version = Image::Scale->jpeg_version(); |
| 9 | |
| 10 | if ($jpeg_version) { |
| 11 | - plan tests => 117; |
| 12 | + plan tests => 112; |
| 13 | } |
| 14 | else { |
| 15 | plan skip_all => 'Image::Scale not built with libjpeg support'; |
| 16 | @@ -343,49 +343,6 @@ SKIP: |
| 17 | is( _compare( _load($outfile), "rgb_resize_gd_fixed_point_w100.jpg" ), 1, "JPEG resize_gd_fixed_point multiple from scalar ok" ); |
| 18 | } |
| 19 | |
| 20 | -# resize corrupted JPEG in scalar. This caused an infinite loop bug in < 0.14 |
| 21 | -# Note: corrupt.jpeg and truncated.jpg didn't trigger this bug |
| 22 | -{ |
| 23 | - my $dataref = _load( _f("corrupt-sv-infinite-loop.jpg") ); |
| 24 | - |
| 25 | - my $im = Image::Scale->new($dataref); |
| 26 | - $im->resize_gd_fixed_point( { width => 100 } ); |
| 27 | - my $out = $im->as_jpeg; |
| 28 | - |
| 29 | - # We want to always test this, so just check that we got a JPEG back |
| 30 | - is( unpack( 'H*', substr( $out, 0, 4 ) ), 'ffd8ffe0', 'corrupt-sv-infinite-loop.jpg resize in-memory ok'); |
| 31 | -} |
| 32 | - |
| 33 | -# offset image in MP3 ID3v2 tag |
| 34 | -SKIP: |
| 35 | -{ |
| 36 | - my $outfile = _tmp("apic_gd_fixed_point_w50.jpg"); |
| 37 | - my $im = Image::Scale->new( |
| 38 | - _f('v2.4-apic-jpg-351-2103.mp3'), |
| 39 | - { offset => 351, length => 2103 } |
| 40 | - ); |
| 41 | - |
| 42 | - is( $im->width, 192, 'JPEG from offset ID3 tag width ok' ); |
| 43 | - is( $im->height, 256, 'JPEG from offset ID3 tag height ok' ); |
| 44 | - |
| 45 | - $im->resize_gd_fixed_point( { width => 50 } ); |
| 46 | - $im->save_jpeg($outfile); |
| 47 | - |
| 48 | - skip "libjpeg version is $jpeg_version, skipping file comparison tests (they require v62)", 1 |
| 49 | - if $jpeg_version != 62; |
| 50 | - |
| 51 | - # These break when using libjpeg-turbo v62, just skip them instead of adding turbo detection |
| 52 | - skip "Skipping binary comparison tests (TEST_COMPARE=1 to test)", 1 unless $ENV{TEST_COMPARE}; |
| 53 | - |
| 54 | - is( _compare( _load($outfile), "apic_gd_fixed_point_w50.jpg" ), 1, "JPEG resize_gd_fixed_point from offset ID3 tag ok" ); |
| 55 | -} |
| 56 | - |
| 57 | -# Exif tag larger than 4K |
| 58 | -{ |
| 59 | - my $im = Image::Scale->new( _f('large-exif.jpg') ); |
| 60 | - is( $im->width, 200, 'JPEG large Exif ok' ); |
| 61 | -} |
| 62 | - |
| 63 | # XXX fatal errors during compression, will this ever actually happen? |
| 64 | |
| 65 | # XXX progressive JPEG with/without memory_limit |
| 66 | Index: b/t/png.t |
| 67 | =================================================================== |
| 68 | --- a/t/png.t |
| 69 | +++ b/t/png.t |
| 70 | @@ -13,7 +13,7 @@ use Image::Scale; |
| 71 | my $png_version = Image::Scale->png_version(); |
| 72 | |
| 73 | if ($png_version) { |
| 74 | - plan tests => 46; |
| 75 | + plan tests => 4; |
| 76 | } |
| 77 | else { |
| 78 | plan skip_all => 'Image::Scale not built with libpng support'; |
| 79 | @@ -25,46 +25,6 @@ if ( -d $tmpdir ) { |
| 80 | } |
| 81 | mkdir $tmpdir; |
| 82 | |
| 83 | -my @types = qw( |
| 84 | - rgb |
| 85 | - rgba |
| 86 | - rgba_interlaced |
| 87 | - rgba16 |
| 88 | - gray |
| 89 | - gray_alpha |
| 90 | - gray_interlaced |
| 91 | - palette |
| 92 | - palette_alpha |
| 93 | -); |
| 94 | - |
| 95 | -# We don't need to test all resizes, JPEG can do that |
| 96 | -my @resizes = qw( |
| 97 | - resize_gd_fixed_point |
| 98 | -); |
| 99 | - |
| 100 | -# width/height |
| 101 | -for my $type ( @types ) { |
| 102 | - my $im = Image::Scale->new( _f("${type}.png") ); |
| 103 | - |
| 104 | - is( $im->width, 160, "PNG $type width ok" ); |
| 105 | - is( $im->height, 120, "PNG $type height ok" ); |
| 106 | -} |
| 107 | - |
| 108 | -# Normal width resize |
| 109 | -for my $resize ( @resizes ) { |
| 110 | - for my $type ( @types ) { |
| 111 | - my $outfile = _tmp("${type}_${resize}_w100.png"); |
| 112 | - |
| 113 | - my $im = Image::Scale->new( _f("${type}.png") ); |
| 114 | - $im->$resize( { width => 100 } ); |
| 115 | - $im->save_png($outfile); |
| 116 | - my $data = $im->as_png(); |
| 117 | - |
| 118 | - is( _compare( _load($outfile), "${type}_${resize}_w100.png" ), 1, "PNG $type $resize 100 file ok" ); |
| 119 | - is( _compare( \$data, "${type}_${resize}_w100.png" ), 1, "PNG $type $resize 100 scalar ok" ); |
| 120 | - } |
| 121 | -} |
| 122 | - |
| 123 | # XXX palette_bkgd |
| 124 | |
| 125 | # corrupt files from PNG test suite |
| 126 | @@ -95,61 +55,6 @@ for my $resize ( @resizes ) { |
| 127 | |
| 128 | # XXX test for valid header but error during image_png_load() |
| 129 | |
| 130 | -# multiple resize calls on same $im object, should throw away previous resize data |
| 131 | -{ |
| 132 | - for my $resize ( @resizes ) { |
| 133 | - my $outfile = _tmp("rgba_multiple_${resize}.png"); |
| 134 | - my $im = Image::Scale->new( _f("rgba.png") ); |
| 135 | - $im->$resize( { width => 50 } ); |
| 136 | - $im->$resize( { width => 75 } ); |
| 137 | - $im->save_png($outfile); |
| 138 | - |
| 139 | - is( _compare( _load($outfile), "rgba_multiple_${resize}.png" ), 1, "PNG multiple resize $resize ok" ); |
| 140 | - } |
| 141 | -} |
| 142 | - |
| 143 | -# resize from PNG in scalar |
| 144 | -{ |
| 145 | - my $dataref = _load( _f("rgba.png") ); |
| 146 | - |
| 147 | - my $outfile = _tmp("rgba_resize_gd_fixed_point_w100.png"); |
| 148 | - my $im = Image::Scale->new($dataref); |
| 149 | - $im->resize_gd_fixed_point( { width => 100 } ); |
| 150 | - $im->save_png($outfile); |
| 151 | - |
| 152 | - is( _compare( _load($outfile), "rgba_resize_gd_fixed_point_w100.png" ), 1, "PNG resize_gd_fixed_point from scalar ok" ); |
| 153 | -} |
| 154 | - |
| 155 | -# resize multiple from PNG scalar |
| 156 | -{ |
| 157 | - my $dataref = _load( _f("rgba.png") ); |
| 158 | - |
| 159 | - my $outfile = _tmp("rgba_resize_gd_fixed_point_w100.png"); |
| 160 | - my $im = Image::Scale->new($dataref); |
| 161 | - $im->resize_gd_fixed_point( { width => 150 } ); |
| 162 | - $im->resize_gd_fixed_point( { width => 100 } ); |
| 163 | - $im->save_png($outfile); |
| 164 | - |
| 165 | - is( _compare( _load($outfile), "rgba_resize_gd_fixed_point_w100.png" ), 1, "PNG resize_gd_fixed_point multiple from scalar ok" ); |
| 166 | -} |
| 167 | - |
| 168 | -# offset image in MP3 ID3v2 tag |
| 169 | -{ |
| 170 | - my $outfile = _tmp("apic_gd_fixed_point_w50.png"); |
| 171 | - my $im = Image::Scale->new( |
| 172 | - _f('v2.4-apic-png-350-58618.mp3'), |
| 173 | - { offset => 350, length => 58618 } |
| 174 | - ); |
| 175 | - |
| 176 | - is( $im->width, 320, 'PNG from offset ID3 tag width ok' ); |
| 177 | - is( $im->height, 240, 'PNG from offset ID3 tag height ok' ); |
| 178 | - |
| 179 | - $im->resize_gd_fixed_point( { width => 50 } ); |
| 180 | - $im->save_png($outfile); |
| 181 | - |
| 182 | - is( _compare( _load($outfile), "apic_gd_fixed_point_w50.png" ), 1, "PNG resize_gd_fixed_point from offset ID3 tag ok" ); |
| 183 | -} |
| 184 | - |
| 185 | # 1-height image that would previously try to resize to 0-height |
| 186 | { |
| 187 | my $dataref = _load( _f("height1.png") ); |
| 188 | Index: b/t/gif.t |
| 189 | =================================================================== |
| 190 | --- a/t/gif.t |
| 191 | +++ b/t/gif.t |
| 192 | @@ -12,7 +12,7 @@ my $gif_version = Image::Scale->gif_vers |
| 193 | my $png_version = Image::Scale->png_version(); |
| 194 | |
| 195 | if ($gif_version) { |
| 196 | - plan tests => 18; |
| 197 | + plan tests => 3; |
| 198 | } |
| 199 | else { |
| 200 | plan skip_all => 'Image::Scale not built with giflib support'; |
| 201 | @@ -24,42 +24,6 @@ if ( -d $tmpdir ) { |
| 202 | } |
| 203 | mkdir $tmpdir; |
| 204 | |
| 205 | -my @types = qw( |
| 206 | - transparent |
| 207 | - white |
| 208 | - interlaced_256 |
| 209 | -); |
| 210 | - |
| 211 | -my @resizes = qw( |
| 212 | - resize_gd_fixed_point |
| 213 | -); |
| 214 | - |
| 215 | -# width/height |
| 216 | -for my $type ( @types ) { |
| 217 | - my $im = Image::Scale->new( _f("${type}.gif") ); |
| 218 | - |
| 219 | - is( $im->width, 160, "GIF $type width ok" ); |
| 220 | - is( $im->height, 120, "GIF $type height ok" ); |
| 221 | -} |
| 222 | - |
| 223 | -# Normal width resize |
| 224 | -SKIP: |
| 225 | -{ |
| 226 | - skip "PNG support not built, skipping file comparison tests", 3 if !$png_version; |
| 227 | - |
| 228 | - for my $resize ( @resizes ) { |
| 229 | - for my $type ( @types ) { |
| 230 | - my $outfile = _tmp("${type}_${resize}_w100.png"); |
| 231 | - |
| 232 | - my $im = Image::Scale->new( _f("${type}.gif") ); |
| 233 | - $im->$resize( { width => 100 } ); |
| 234 | - $im->save_png($outfile); |
| 235 | - |
| 236 | - is( _compare( _load($outfile), "${type}_${resize}_w100.png" ), 1, "GIF $type $resize 100 file ok" ); |
| 237 | - } |
| 238 | - } |
| 239 | -} |
| 240 | - |
| 241 | # corrupt file |
| 242 | { |
| 243 | no strict 'subs'; |
| 244 | @@ -84,71 +48,6 @@ SKIP: |
| 245 | like( (Test::NoWarnings::warnings())[0]->getMessage, qr/Image::Scale unable to read GIF file/i, 'GIF corrupt error output ok' ); |
| 246 | } |
| 247 | |
| 248 | -# multiple resize calls on same $im object, should throw away previous resize data |
| 249 | -SKIP: |
| 250 | -{ |
| 251 | - skip "PNG support not built, skipping file comparison tests", 1 if !$png_version; |
| 252 | - |
| 253 | - my $outfile = _tmp("transparent_multiple_resize_gd_fixed_point.png"); |
| 254 | - my $im = Image::Scale->new( _f("transparent.gif") ); |
| 255 | - $im->resize_gd_fixed_point( { width => 50 } ); |
| 256 | - $im->resize_gd_fixed_point( { width => 100 } ); |
| 257 | - $im->save_png($outfile); |
| 258 | - |
| 259 | - is( _compare( _load($outfile), "transparent_multiple_resize_gd_fixed_point.png" ), 1, "GIF multiple resize_gd_fixed_point ok" ); |
| 260 | -} |
| 261 | - |
| 262 | -# resize from GIF in scalar |
| 263 | -SKIP: |
| 264 | -{ |
| 265 | - skip "PNG support not built, skipping file comparison tests", 1 if !$png_version; |
| 266 | - |
| 267 | - my $dataref = _load( _f("transparent.gif") ); |
| 268 | - |
| 269 | - my $outfile = _tmp("transparent_resize_gd_fixed_point_w100_scalar.png"); |
| 270 | - my $im = Image::Scale->new($dataref); |
| 271 | - $im->resize_gd_fixed_point( { width => 100 } ); |
| 272 | - $im->save_png($outfile); |
| 273 | - |
| 274 | - is( _compare( _load($outfile), "transparent_resize_gd_fixed_point_w100.png" ), 1, "GIF resize_gd_fixed_point from scalar ok" ); |
| 275 | -} |
| 276 | - |
| 277 | -# resize multiple from GIF scalar |
| 278 | -SKIP: |
| 279 | -{ |
| 280 | - skip "PNG support not built, skipping file comparison tests", 1 if !$png_version; |
| 281 | - |
| 282 | - my $dataref = _load( _f("transparent.gif") ); |
| 283 | - |
| 284 | - my $outfile = _tmp("transparent_multiple_resize_gd_fixed_point_w100_scalar.png"); |
| 285 | - my $im = Image::Scale->new($dataref); |
| 286 | - $im->resize_gd_fixed_point( { width => 150 } ); |
| 287 | - $im->resize_gd_fixed_point( { width => 100 } ); |
| 288 | - $im->save_png($outfile); |
| 289 | - |
| 290 | - is( _compare( _load($outfile), "transparent_resize_gd_fixed_point_w100.png" ), 1, "GIF resize_gd_fixed_point multiple from scalar ok" ); |
| 291 | -} |
| 292 | - |
| 293 | -# offset image in MP3 ID3v2 tag |
| 294 | -SKIP: |
| 295 | -{ |
| 296 | - my $outfile = _tmp("apic_gd_fixed_point_w100.png"); |
| 297 | - my $im = Image::Scale->new( |
| 298 | - _f('v2.4-apic-gif-318-5169.mp3'), |
| 299 | - { offset => 318, length => 5169 } |
| 300 | - ); |
| 301 | - |
| 302 | - is( $im->width, 160, 'GIF from offset ID3 tag width ok' ); |
| 303 | - is( $im->height, 120, 'GIF from offset ID3 tag height ok' ); |
| 304 | - |
| 305 | - $im->resize_gd_fixed_point( { width => 100 } ); |
| 306 | - |
| 307 | - skip "PNG support not built, skipping file comparison tests", 1 if !$png_version; |
| 308 | - |
| 309 | - $im->save_png($outfile); |
| 310 | - |
| 311 | - is( _compare( _load($outfile), "apic_gd_fixed_point_w100.png" ), 1, "GIF resize_gd_fixed_point from offset ID3 tag ok" ); |
| 312 | -} |
| 313 | |
| 314 | # Bug 17573, very thin gif could cause divide by 0 errors |
| 315 | SKIP: |