Show
Ignore:
Timestamp:
04/16/08 15:36:30 (20 months ago)
Author:
mpaschal
Message:

Land the new implementation of metadata based on narrow tables
BugzID: 68749

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/release-35/t/09-image.t

    r1100 r1927  
    2525    ); 
    2626    @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                ; 
    2830} 
    2931 
     
    3840 
    3941for 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); 
    4144    ok(-B $img_file, "$img_file looks like a binary file"); 
    4245 
     
    4649SKIP : { 
    4750        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"); 
    4952#        diag( MT::Image->errstr ) if MT::Image->errstr; 
    5053 
    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"); 
    5659 
    5760        ($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"); 
    6168 
    6269        ($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"); 
    6471 
    6572        ($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"); 
    6875 
    6976        (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"); 
    7380 
    7481        open FH, $img_file or die $!; 
     
    8087        isa_ok($img, 'MT::Image::' . $driver); 
    8188#            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"); 
    8491        ($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"); 
    8794} # END SKIP 
    8895    }