diff --git a/lib/WebGUI/Asset/File.pm b/lib/WebGUI/Asset/File.pm index 0c86f5edb..afbb7cc25 100644 --- a/lib/WebGUI/Asset/File.pm +++ b/lib/WebGUI/Asset/File.pm @@ -382,6 +382,7 @@ sub update { edit => $self->get("groupIdEdit"), storageId => $self->get('storageId'), ); + $self->SUPER::update(@_); ##update may have entered a new storageId. Reset the cached one just in case. if ($self->get("storageId") ne $before{storageId}) { $self->setStorageLocation; @@ -389,7 +390,6 @@ sub update { if ($self->get("ownerUserId") ne $before{owner} || $self->get("groupIdEdit") ne $before{edit} || $self->get("groupIdView") ne $before{view}) { $self->getStorageLocation->setPrivileges($self->get("ownerUserId"),$self->get("groupIdView"),$self->get("groupIdEdit")); } - $self->SUPER::update(@_); } #------------------------------------------------------------------- diff --git a/t/Macro/Thumbnail.t b/t/Macro/Thumbnail.t index 4f712a2ff..c869d019b 100644 --- a/t/Macro/Thumbnail.t +++ b/t/Macro/Thumbnail.t @@ -65,11 +65,12 @@ $asset->update({ storageId => $storage->getId, filename => 'square.png', }); -$versionTag->commit; - $asset->generateThumbnail(); +$versionTag->commit; + + ##Call the Thumbnail Macro with that Asset's URL and see if it returns ##the correct URL. @@ -77,19 +78,24 @@ my $output = WebGUI::Macro::Thumbnail::process($session, $asset->getUrl()); my $macroUrl = $storage->getPath('thumb-square.png'); is($output, $asset->getThumbnailUrl, 'Macro returns correct filename'); -my $thumbUrl = $asset->getThumbnailUrl; +my $thumbUrl = $output; substr($thumbUrl, 0, length($session->config->get("uploadsURL"))) = ''; my $thumbFile = $session->config->get('uploadsPath') . $thumbUrl; -ok((-e $thumbFile), 'file actually exists'); +my $fileExists = ok((-e $thumbFile), "file actually exists $thumbFile"); -##Load the image into some parser and check a few pixels to see if they're blue-ish. -##->Get('pixel[x,y]') hopefully returns color in hex triplets -my $thumbImg = Image::Magick->new(); -$thumbImg->Read(filename => $thumbFile); +SKIP: { + skip "File does not exist", 3 unless $fileExists; -cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>25, y=>25, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #1'); -cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>75, y=>75, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #2'); -cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>50, y=>50, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #3'); + ##Load the image into some parser and check a few pixels to see if they're blue-ish. + ##->Get('pixel[x,y]') hopefully returns color in hex triplets + my $thumbImg = Image::Magick->new(); + $thumbImg->Read(filename => $thumbFile); + + cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>25, y=>25, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #1'); + cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>75, y=>75, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #2'); + cmp_bag([$thumbImg->GetPixels(width=>1, height=>1, x=>50, y=>50, map=>'RGB', normalize=>'true')], [0,0,1], 'blue pixel #3'); + +} END { if (defined $versionTag and ref $versionTag eq 'WebGUI::VersionTag') {