Added buttons to the GalleryAlbum edit view so users can rotate photos by 90 deg (RFE 620).

This commit is contained in:
kimd 2010-04-19 22:24:09 +02:00
parent 1df580f13f
commit dd72159db0
10 changed files with 338 additions and 16 deletions

View file

@ -65,7 +65,7 @@ my $extensionTests = [
},
];
plan tests => 49 + scalar @{ $extensionTests }; # increment this value for each test you create
plan tests => 54 + scalar @{ $extensionTests }; # increment this value for each test you create
my $session = WebGUI::Test->session;
@ -277,6 +277,40 @@ foreach my $testImage (@testImages) {
$session->setting->set('maxImageSize', $origMaxImageSize );
####################################################
#
# rotate
#
####################################################
my $rotateTest = WebGUI::Storage->create( $session );
WebGUI::Test->storagesToDelete($rotateTest);
# Add test image to the storage
ok( $rotateTest->addFileFromFilesystem(WebGUI::Test->getTestCollateralPath("rotation_test.png")), "Can add test image to storage" );
# Rotate test image by 90° CW
my $file = $rotateTest->getFiles->[0];
$rotateTest->rotate($file, 90);
# Check dimensions
cmp_bag( [$rotateTest->getSizeInPixels( $file )], [2,3], "Check size of photo after rotating 90° CW" );
# Check pixels
my $image = Image::Magick->new;
$image->Read( $rotateTest->getPath($file) );
is( $image->GetPixel(x=>2, y=>0), 0, "Pixel at location [2,0] should be black" );
# Rotate test image by 90° CCW
my $file = $rotateTest->getFiles->[0];
$rotateTest->rotate($file, -90);
# Check dimensions
cmp_bag( [$rotateTest->getSizeInPixels( $file )], [3,2], "Check size of photo after rotating 90° CCW" );
# Check pixels
$image = Image::Magick->new;
$image->Read( $rotateTest->getPath($file) );
is( $image->GetPixel(x=>0, y=>0), 0, "Pixel at location [0,0] should be black" );
TODO: {
local $TODO = "Methods that need to be tested";
ok(0, 'resize');