Changeset 1795
- Timestamp:
- 04/07/08 23:24:43 (8 months ago)
- Files:
-
- branches/feature-narrow-tables/t/09-image.t (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/feature-narrow-tables/t/09-image.t
r1100 r1795 25 25 ); 26 26 @drivers = qw( ImageMagick NetPBM ); 27 plan tests => scalar @Img + scalar @Img * scalar @drivers * 17; 27 plan tests => scalar @Img # file exists 28 + (scalar @Img * scalar @drivers * 18) # 18 tests each for every image and driver 29 ; 28 30 } 29 31 … … 38 40 39 41 for my $rec (@Img) { 40 my $img_file = File::Spec->catfile($BASE, 't', 'images', $rec->[0]); 42 my ($img_filename, $img_width, $img_height) = @$rec; 43 my $img_file = File::Spec->catfile($BASE, 't', 'images', $img_filename); 41 44 ok(-B $img_file, "$img_file looks like a binary file"); 42 45 … … 46 49 SKIP : { 47 50 skip("no $driver image", 17) unless $img; 48 isa_ok($img, 'MT::Image::' . $driver );51 isa_ok($img, 'MT::Image::' . $driver, "driver $driver with image $img_file is an MT::Image::$driver"); 49 52 # diag( MT::Image->errstr ) if MT::Image->errstr; 50 53 51 is($img->{width}, $rec->[1], "width is $rec->[1]");52 is($img->{height}, $ rec->[2], "height is $rec->[2]");53 my($w, $h) = $img->get_dimensions ;54 is($w, $ rec->[1], "width is $rec->[1]");55 is($h, $ rec->[2], "height is $rec->[2]");54 is($img->{width}, $img_width, "$driver says $img_filename is $img_width px wide"); 55 is($img->{height}, $img_height, "$driver says $img_filename is $img_height px high"); 56 my($w, $h) = $img->get_dimensions(); 57 is($w, $img_width, "${driver}'s get_dimensions says $img_filename is $img_width px wide"); 58 is($h, $img_height, "${driver}'s get_dimensions says $img_filename is $img_height px high"); 56 59 57 60 ($w, $h) = $img->get_dimensions(Scale => 50); 58 my($x, $y) = (int($img->{width} / 2), int($img->{height} / 2)); 59 is($w, $x, "width is $x"); 60 is($h, $y, "height is $y"); 61 my($x, $y) = (int($img_width / 2), int($img_height / 2)); 62 is($w, $x, "$driver says $img_filename at 50\% scale is $x px wide"); 63 is($h, $y, "$driver says $img_filename at 50\% scale is $y px high"); 64 65 ($w, $h) = $img->get_dimensions(); 66 is($w, $img_width, "${driver}'s get_dimensions says $img_filename is still $img_width px wide after theoretical scaling"); 67 is($h, $img_height, "${driver}'s get_dimensions says $img_filename is still $img_height px high after theoretical scaling"); 61 68 62 69 ($w, $h) = $img->get_dimensions(Width => 50); 63 is($w, 50, 'width is 50');70 is($w, 50, "$driver says $img_filename scaled to 50 px wide is 50 px wide"); 64 71 65 72 ($w, $h) = $img->get_dimensions(Width => 50, Height => 100); 66 is($w, 50, 'width is 50');67 is($h, 100, 'height is 100');73 is($w, 50, "$driver says $img_filename scaled to 50x100 is 50 px wide"); 74 is($h, 100, "$driver says $img_filename scaled to 50x100 is 100 px high"); 68 75 69 76 (my($blob), $w, $h) = $img->scale(Scale => 50); 70 ($x, $y) = (int($img ->{width} / 2), int($img->{height}/ 2));71 is($w, $x, " width is $x");72 is($h, $y, " height is $y");77 ($x, $y) = (int($img_width / 2), int($img_height / 2)); 78 is($w, $x, "result of scaling $img_filename to 50\% with $driver is $x px wide"); 79 is($h, $y, "result of scaling $img_filename to 50\% with $driver is $y px high"); 73 80 74 81 open FH, $img_file or die $!; … … 80 87 isa_ok($img, 'MT::Image::' . $driver); 81 88 # diag( MT::Image->errstr ) if MT::Image->errstr; 82 is($img->{width}, $rec->[1], "width is $rec->[1]");83 is($img->{height}, $ rec->[2], "height is $rec->[2]");89 is($img->{width}, $img_width, "$driver says $img_filename from blob is $img_width px wide"); 90 is($img->{height}, $img_height, "$driver says $img_filename from blob is $img_height px high"); 84 91 ($w, $h) = $img->get_dimensions; 85 is($w, $ rec->[1], "width is $rec->[1]");86 is($h, $ rec->[2], "height is $rec->[2]");92 is($w, $img_width, "${driver}'s get_dimensions says $img_filename from blob is $img_width px wide"); 93 is($h, $img_height, "${driver}'s get_dimensions says $img_filename from blob is $img_height px high"); 87 94 } # END SKIP 88 95 }
