A bunch of fixed Photo tests.

This commit is contained in:
Colin Kuskie 2010-05-13 15:43:16 -07:00
parent 4fef8cb486
commit 420cc3e843
4 changed files with 28 additions and 29 deletions

View file

@ -62,6 +62,7 @@ $photo
skipAutoCommitWorkflows => 1,
});
$versionTags[-1]->commit;
WebGUI::Test->addToCleanup($versionTags[-1]);
$photo->getStorageLocation->addFileFromFilesystem( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
$photo->update({ filename => 'page_title.jpg' });
@ -86,6 +87,7 @@ TODO: {
# Array of resolutions passed to makeResolutions overrides defaults from
# parent asset
push @versionTags, WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTags[-1]);
$gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
@ -139,8 +141,9 @@ TODO: {
# makeResolutions allows API to specify resolutions to make as array reference
# argument
push @versionTags, WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTags[-1]);
$photo
= $node->addChild({
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
},
undef,
@ -176,8 +179,9 @@ TODO: {
#----------------------------------------------------------------------------
# makeResolutions throws a warning on an invalid resolution but keeps going
push @versionTags, WebGUI::VersionTag->getWorking($session);
WebGUI::Test->addToCleanup($versionTags[-1]);
$photo
= $node->addChild({
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
},
undef,
@ -220,13 +224,3 @@ $photo->update({ filename => 'page_title.jpg' });
"makeResolutions still makes valid resolutions when invalid resolutions given",
);
}
#----------------------------------------------------------------------------
# Cleanup
END {
foreach my $versionTag (@versionTags) {
$versionTag->rollback;
}
}

View file

@ -20,7 +20,6 @@ use WebGUI::Test;
use WebGUI::Session;
use Test::More;
use Test::Deep;
use WebGUI::Test::Maker::HTML;
use WebGUI::Asset::File::GalleryFile::Photo;
#----------------------------------------------------------------------------
@ -29,13 +28,28 @@ my $session = WebGUI::Test->session;
my $node = WebGUI::Asset->getImportNode($session);
my $versionTag = WebGUI::VersionTag->getWorking($session);
$versionTag->set({name=>"Photo Test"});
my $maker = WebGUI::Test::Maker::HTML->new;
WebGUI::Test->addToCleanup($versionTag);
my $otherParent
= $node->addChild({
className => "WebGUI::Asset::Wobject::Layout",
});
my $photo
my $gallery
= $node->addChild({
className => "WebGUI::Asset::Wobject::Gallery",
imageResolutions => "1600x1200\n1024x768\n800x600\n640x480",
});
my $album
= $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum",
},
undef,
undef,
{
skipAutoCommitWorkflows => 1,
});
my $photo
= $album->addChild({
className => "WebGUI::Asset::File::GalleryFile::Photo",
userDefined1 => "ORIGINAL",
},
@ -118,11 +132,3 @@ cmp_deeply(
#----------------------------------------------------------------------------
# www_makeShortcut
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}

View file

@ -72,6 +72,7 @@ my $photo
{
skipAutoCommitWorkflows => 1,
});
$versionTag->commit;
my $photo2 = $photo->cloneFromDb;
my $album2 = $album->cloneFromDb;

View file

@ -73,6 +73,10 @@ my $nextPhoto
skipAutoCommitWorkflows => 1,
});
$versionTag->commit;
foreach my $asset ($gallery, $album) {
$asset = $asset->cloneFromDb;
}
WebGUI::Test->addToCleanup($versionTag);
$photo->setFile( WebGUI::Test->getTestCollateralPath('page_title.jpg') );
#----------------------------------------------------------------------------
@ -148,9 +152,3 @@ cmp_deeply(
$testTemplateVars,
"getTemplateVars is correct and complete",
);
#----------------------------------------------------------------------------
# Cleanup
END {
$versionTag->rollback();
}