From ad69fc565fe01e18bca7d3ad975156d6a2c8a604 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Tue, 15 Mar 2011 18:00:30 +0100 Subject: Only place lightbox html links when lightbox is enabled --- t/21-app-dthumb.files.t | 33 ++++++++++++++++++++++++++++++++- t/cmp/index.lightbox | 1 + t/cmp/index.names | 5 +++-- t/cmp/index.no-lightbox | 25 +++++++++++++++++++++++++ t/cmp/index.no-names | 5 +++-- 5 files changed, 64 insertions(+), 5 deletions(-) create mode 120000 t/cmp/index.lightbox create mode 100644 t/cmp/index.no-lightbox (limited to 't') diff --git a/t/21-app-dthumb.files.t b/t/21-app-dthumb.files.t index da2cbbe..83879e9 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 => 12; +plan tests => 14; use_ok('App::Dthumb'); @@ -50,6 +50,37 @@ unlink('t/out/index'); +$conf{names} = 1; +$conf{lightbox} = 1; +$dthumb = App::Dthumb->new(%conf); + +for my $file (qw(one.png two.png)) { + $dthumb->create_thumbnail_html($file); +} +$dthumb->write_out_html(); + +is(read_file('t/out/index'), read_file('t/cmp/index.lightbox'), + 'create_Thumbnail_html / write_out_html with lightbox = 1'); + +unlink('t/out/index'); + + + +$conf{lightbox} = 0; +$dthumb = App::Dthumb->new(%conf); + +for my $file (qw(one.png two.png)) { + $dthumb->create_thumbnail_html($file); +} +$dthumb->write_out_html(); + +is(read_file('t/out/index'), read_file('t/cmp/index.no-lightbox'), + 'create_Thumbnail_html / write_out_html with lightbox = 0'); + +unlink('t/out/index'); + + + $dthumb = App::Dthumb->new(dir_images => 't/out'); $dthumb->create_files(); diff --git a/t/cmp/index.lightbox b/t/cmp/index.lightbox new file mode 120000 index 0000000..122ada1 --- /dev/null +++ b/t/cmp/index.lightbox @@ -0,0 +1 @@ +index.names \ No newline at end of file diff --git a/t/cmp/index.names b/t/cmp/index.names index c682ae1..72e0e94 100644 --- a/t/cmp/index.names +++ b/t/cmp/index.names @@ -5,8 +5,9 @@ dthumb - - + + +
diff --git a/t/cmp/index.no-lightbox b/t/cmp/index.no-lightbox new file mode 100644 index 0000000..93869ca --- /dev/null +++ b/t/cmp/index.no-lightbox @@ -0,0 +1,25 @@ + + + + dthumb + + + + +
+
+ + one.png +
+ one.png +
+
+ + two.png +
+ two.png +
+
+ + diff --git a/t/cmp/index.no-names b/t/cmp/index.no-names index 5022b19..cdc6311 100644 --- a/t/cmp/index.no-names +++ b/t/cmp/index.no-names @@ -5,8 +5,9 @@ dthumb - - + + +
-- cgit v1.2.3