]>
iEval git - app-gallery.git/blob - t/App-Gallery.t
5 use File
::Temp qw
/tempdir/;
7 use File
::Spec
::Functions
;
10 use Test
::More tests
=> 11;
11 BEGIN { use_ok
('App::Gallery') };
14 my ($width, $height, $file) = @_;
15 my $image = Image
::Magick
->new;
17 my ($actual_width, $actual_height) = $image->Get(qw
/width height/);
18 is
$width, $actual_width, 'image width';
19 is
$height, $actual_height, 'image height';
23 my $dir = tempdir
('app-gallery.XXXX', TMPDIR
=> 1, CLEANUP
=> 1);
24 my $dir1 = catdir
$dir, 'test1';
25 my $dir2 = catdir
$dir, 'test2';
27 App
::Gallery
->run({out
=> $dir1, title
=> 'Some title', width
=> 200, height
=> 200}, @imgs);
29 my $html = read_file catfile
$dir1, 'index.html';
30 is
$html, <<'EOF', 'index.html as expected';
32 <title>Some title</title>
33 <meta charset="utf-8">
36 display: inline-block;
38 vertical-align: center;
42 <link rel="stylesheet" href="style.css">
46 <div class=imgwrap><a href='full/100x400.png'><img src='thumb/100x400.png'></a></div>
47 <div class=imgwrap><a href='full/800x200.png'><img src='thumb/800x200.png'></a></div>
51 test_img_size
(50, 200, catfile
$dir1, 'thumb', '100x400.png');
52 test_img_size
(200, 50, catfile
$dir1, 'thumb', '800x200.png');
54 App
::Gallery
->run({out
=> $dir2, tmpl
=> catfile
't', 'example-tmpl'}, @imgs);
56 $html = read_file catfile
$dir2, 'index.html';
57 is
$html, <<'EOF', 'index.html as expected';
59 <title>Gallery</title>
60 <meta charset="utf-8">
61 <link rel="stylesheet" href="style.css">
64 <div><a href='full/100x400.png'><img src='thumb/100x400.png'></a></div>
65 <div><a href='full/800x200.png'><img src='thumb/800x200.png'></a></div>
69 test_img_size
(100, 400, catfile
$dir2, 'thumb', '100x400.png');
70 test_img_size
(600, 150, catfile
$dir2, 'thumb', '800x200.png');
This page took 0.055921 seconds and 5 git commands to generate.