fix: these tests pass now

This commit is contained in:
Doug Bell 2007-12-21 00:26:28 +00:00
parent 52c351b3db
commit ae6fd2c702

View file

@ -19,8 +19,8 @@ use Scalar::Util qw( blessed );
use WebGUI::Test; use WebGUI::Test;
use WebGUI::Session; use WebGUI::Session;
use Test::More; use Test::More;
use JSON; use Test::Deep;
use Image::ExifTool; use Image::ExifTool qw(:Public);
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Init # Init
@ -35,8 +35,20 @@ my $gallery
my $album my $album
= $gallery->addChild({ = $gallery->addChild({
className => "WebGUI::Asset::Wobject::GalleryAlbum", className => "WebGUI::Asset::Wobject::GalleryAlbum",
}); },
my ( $photo ); undef, undef,
{ skipAutoCommitWorkflows => 1 },
);
my $photo
= $album->addChild({
className => "WebGUI::Asset::File::Image::Photo",
},
undef, undef,
{ skipAutoCommitWorkflows => 1 },
);
$versionTag->commit;
my $exif = ImageInfo( WebGUI::Test->getTestCollateralPath("lamp.jpg") );
$photo->setFile( WebGUI::Test->getTestCollateralPath("lamp.jpg") );
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Cleanup # Cleanup
@ -46,30 +58,15 @@ END {
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Tests # Tests
plan no_plan => 1; plan tests => 2;
#----------------------------------------------------------------------------
# Test that exif data gets parsed from the file
$photo
= $album->addChild({
className => "WebGUI::Asset::File::Image::Photo",
});
$photo->setFile( WebGUI::Test->getTestCollateralPath("lamp.jpg") );
my $exifData = $photo->get("exifData");
ok( defined $exifData, "exifData column is defined after setFile" );
my $exif = jsonToObj( $exifData );
ok( ref $exif eq "HASH", "exifData is JSON hash" );
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
# Test getTemplateVars exif data # Test getTemplateVars exif data
my $var = $photo->getTemplateVars; my $var = $photo->getTemplateVars;
is_deeply( cmp_deeply(
[ sort keys %$exif ], [ keys %$var ], superbagof( map { 'exif_' . $_ } keys %$exif ),
[ sort map { s/exif_// } keys %$var ], 'getTemplateVars gets a hash of all exif tags',
"getTemplateVars gets a hash of all exif tags",
); );
is_deeply( is_deeply(