summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2011-03-13 16:10:19 +0100
committerDaniel Friesel <derf@finalrewind.org>2011-03-13 16:10:19 +0100
commit3574da8815b830efc1317221c1348fd741559dd6 (patch)
tree8fbebb098c74fedff51801202766ddf7d3efae39
parent2793ce6bf24549067a9cb5841a47eede21e6d866 (diff)
Test for App::Dthumb->create_files with lightbox=0
-rwxr-xr-xt/21-app-dthumb.files.t43
1 files changed, 30 insertions, 13 deletions
diff --git a/t/21-app-dthumb.files.t b/t/21-app-dthumb.files.t
index 06bea47..da2cbbe 100755
--- a/t/21-app-dthumb.files.t
+++ b/t/21-app-dthumb.files.t
@@ -9,7 +9,7 @@ use Test::More;
eval "use File::Slurp";
plan skip_all => 'File::Slurp required' if $@;
-plan tests => 9;
+plan tests => 12;
use_ok('App::Dthumb');
@@ -17,7 +17,8 @@ my %conf = (
file_index => 't/out/index',
dir_images => 't/imgdir',
);
-my @create_failed;
+my @created_files;
+my @indep_files = ('main.css');
my $dthumb = App::Dthumb->new(%conf);
isa_ok($dthumb, 'App::Dthumb');
@@ -52,26 +53,42 @@ unlink('t/out/index');
$dthumb = App::Dthumb->new(dir_images => 't/out');
$dthumb->create_files();
-ok(-d 't/out/.thumbs', '->create_files creates thumb dir');
-ok(-d 't/out/.dthumb', '->create_files creates data dir');
+ok(-d 't/out/.thumbs', 'create_files: Creates thumb dir');
+ok(-d 't/out/.dthumb', 'create_files: Creates data dir');
for my $file ($dthumb->{data}->list_archived()) {
- if (not -e "t/out/.dthumb/${file}") {
- push(@create_failed, $file);
- }
- else {
+ if (-e "t/out/.dthumb/${file}") {
+ push(@created_files, $file);
unlink("t/out/.dthumb/${file}");
}
}
rmdir('t/out/.thumbs');
rmdir('t/out/.dthumb');
-if (@create_failed) {
- fail("->create_files missed out " . join(' ', @create_failed));
-}
-else {
- pass("->create_files all okay");
+is_deeply([sort $dthumb->{data}->list_archived()], [sort @created_files],
+ 'create_files: All files created');
+@created_files = ();
+
+
+
+$dthumb = App::Dthumb->new(dir_images => 't/out', lightbox => 0);
+$dthumb->create_files();
+
+ok(-d 't/out/.thumbs', 'create_files: Creates thumb dir (lightbox=0)');
+ok(-d 't/out/.dthumb', 'create_files: Creates data dir (lightbox=0)');
+
+for my $file (@indep_files) {
+ if (-e "t/out/.dthumb/${file}") {
+ push(@created_files, $file);
+ unlink("t/out/.dthumb/${file}");
+ }
}
+rmdir('t/out/.thumbs');
+rmdir('t/out/.dthumb');
+
+is_deeply([sort @indep_files], [sort @created_files],
+ 'create_files: All lightbox-independent files created');
+@created_files = ();