From 7cc54e7f347c95733452ebfc22f33031f96854ca Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 6 Apr 2012 23:26:54 +0100 Subject: Album plugin v4 --- t/album.t | 153 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100755 t/album.t (limited to 't') diff --git a/t/album.t b/t/album.t new file mode 100755 index 000000000..2807f2247 --- /dev/null +++ b/t/album.t @@ -0,0 +1,153 @@ +#!/usr/bin/perl +use warnings; +use strict; +BEGIN { + foreach my $module (qw(Image::Magick)) { + eval qq{use $module}; + if ($@) { + eval qq{ + use Test::More skip_all => "$module not available" + } + } + } +} +use Test::More 'no_plan'; + +BEGIN { use_ok("IkiWiki"); } + +my $blob; + +ok(! system("rm -rf t/tmp")); +ok(mkdir("t/tmp")); +ok(mkdir("t/tmp/in")); +ok(mkdir("t/tmp/in/myalbum")); + +my $image = Image::Magick->new; +$image->Set(size => '640x480'); +$image->Read('canvas:red'); +$image->Draw(fill => 'yellow', primitive => 'rectangle', + points => '0,0 100,100'); +$image->Write('t/tmp/in/myalbum/r.jpg'); + +$image = Image::Magick->new; +$image->Set(size => '480x640'); +$image->Read('canvas:green'); +$image->Draw(fill => 'yellow', primitive => 'rectangle', + points => '0,0 100,100'); +$image->Write('t/tmp/in/myalbum/g.png'); + +$image = Image::Magick->new; +$image->Set(size => '640x640'); +$image->Read('canvas:blue'); +$image->Draw(fill => 'yellow', primitive => 'rectangle', + points => '0,0 100,100'); +$image->Write('t/tmp/in/myalbum/b.gif'); + +writefile("myalbum.mdwn", "t/tmp/in", <]*>Section:\s+green$ + .*? + + .*? + ]*>Assorted$ + .*? + + .*? + + .*? + + .*? + ]*>Section:\s+green$ + .*? + + .*? + ]*>Assorted$ + .*? + + .*? + + .*? + a blue box}); +like($blob, qr{ +

hello,\s+world!

+ .*? + + .*? +