Gallery resolutions are integers. Fixed sorting the resolutions, and fixed the tests to not use bad resolutions. Fixes bug #11787
This commit is contained in:
parent
09ff64334e
commit
eac7fe8a64
6 changed files with 15 additions and 14 deletions
|
|
@ -39,7 +39,7 @@ addToCleanup($versionTag);
|
|||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1024x768",
|
||||
imageResolutions => "1024",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ my ($gallery, $album, $photo);
|
|||
$gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1600x1200\n1024x768\n800x600\n640x480",
|
||||
imageResolutions => "1600\n1024\n800\n640",
|
||||
});
|
||||
$album
|
||||
= $gallery->addChild({
|
||||
|
|
@ -75,7 +75,7 @@ diag( $@ )
|
|||
|
||||
cmp_deeply(
|
||||
$photo->getStorageLocation->getFiles,
|
||||
bag( '1024x768.jpg', '1600x1200.jpg', '640x480.jpg', '800x600.jpg', 'page_title.jpg' ),
|
||||
bag( '1024.jpg', '1600.jpg', '640.jpg', '800.jpg', 'page_title.jpg' ),
|
||||
"makeResolutions makes all the required resolutions with the appropriate names.",
|
||||
);
|
||||
|
||||
|
|
@ -91,7 +91,7 @@ WebGUI::Test->addToCleanup($versionTags[-1]);
|
|||
$gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1600x1200\n1024x768\n800x600\n640x480",
|
||||
imageResolutions => "1600\n1024\n800\n640",
|
||||
});
|
||||
$album
|
||||
= $gallery->addChild({
|
||||
|
|
@ -116,12 +116,12 @@ $photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollater
|
|||
$photo->update({ filename => 'page_title.jpg' });
|
||||
|
||||
ok(
|
||||
!eval{ $photo->makeResolutions('100x100','200x200'); 1 },
|
||||
!eval{ $photo->makeResolutions('100','200'); 1 },
|
||||
"makeResolutions fails when first argument is not array reference",
|
||||
);
|
||||
|
||||
ok(
|
||||
eval{ $photo->makeResolutions(['100x100','200x200']); 1 },
|
||||
eval{ $photo->makeResolutions(['100','200']); 1 },
|
||||
"makeResolutions succeeds when first argument is array reference of resolutions to make",
|
||||
);
|
||||
diag( $@ )
|
||||
|
|
@ -129,7 +129,7 @@ diag( $@ )
|
|||
|
||||
is_deeply(
|
||||
[ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ],
|
||||
['100x100.jpg', '200x200.jpg', 'page_title.jpg'],
|
||||
['100.jpg', '200.jpg', 'page_title.jpg'],
|
||||
"makeResolutions makes all the required resolutions with the appropriate names.",
|
||||
);
|
||||
|
||||
|
|
@ -157,18 +157,18 @@ $photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollater
|
|||
$photo->update({ filename => 'page_title.jpg' });
|
||||
|
||||
ok(
|
||||
!eval{ $photo->makeResolutions('100x100','200x200'); 1 },
|
||||
!eval{ $photo->makeResolutions('100','200'); 1 },
|
||||
"makeResolutions fails when first argument is not array reference",
|
||||
);
|
||||
|
||||
ok(
|
||||
eval{ $photo->makeResolutions(['100x100','200x200']); 1 },
|
||||
eval{ $photo->makeResolutions(['100','200']); 1 },
|
||||
"makeResolutions succeeds when first argument is array reference of resolutions to make",
|
||||
);
|
||||
|
||||
is_deeply(
|
||||
[ sort({ $a cmp $b} @{ $photo->getStorageLocation->getFiles }) ],
|
||||
['100x100.jpg', '200x200.jpg', 'page_title.jpg'],
|
||||
['100.jpg', '200.jpg', 'page_title.jpg'],
|
||||
"makeResolutions makes all the required resolutions with the appropriate names.",
|
||||
);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ addToCleanup($versionTag);
|
|||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1024x768",
|
||||
imageResolutions => "1024",
|
||||
},
|
||||
undef,
|
||||
undef,
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ $versionTag->set({name=>"Photo Test"});
|
|||
my $gallery
|
||||
= $node->addChild({
|
||||
className => "WebGUI::Asset::Wobject::Gallery",
|
||||
imageResolutions => "1024x768",
|
||||
imageResolutions => "1024",
|
||||
});
|
||||
my $album
|
||||
= $gallery->addChild({
|
||||
|
|
@ -62,7 +62,7 @@ $photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
|
|||
my $storage = $photo->getStorageLocation;
|
||||
|
||||
cmp_deeply(
|
||||
$storage->getFiles, bag('page_title.jpg','1024x768.jpg'),
|
||||
$storage->getFiles, bag('page_title.jpg','1024.jpg'),
|
||||
"Storage location contains the resolution file",
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue