]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - t/img.t
d/control: Standards-Version: 3.9.6, no changes required
[git.ikiwiki.info.git] / t / img.t
diff --git a/t/img.t b/t/img.t
index 7598dd9f02459fc91825979703fdfcb7f846765c..1f2e7d044407d17d691bb3a29c64cef615ef230c 100755 (executable)
--- a/t/img.t
+++ b/t/img.t
@@ -14,9 +14,26 @@ package IkiWiki;
 use warnings;
 use strict;
 use Test::More;
+plan(skip_all => "Image::Magick not available")
+       unless eval q{use Image::Magick; 1};
 
-BEGIN { use_ok("IkiWiki"); }
-BEGIN { use_ok("Image::Magick"); }
+use IkiWiki;
+
+my $installed = $ENV{INSTALLED_TESTS};
+
+my @command;
+if ($installed) {
+       @command = qw(ikiwiki);
+}
+else {
+       ok(! system("make -s ikiwiki.out"));
+       @command = qw(perl -I. ./ikiwiki.out
+               --underlaydir=underlays/basewiki
+               --set underlaydirbase=underlays
+               --templatedir=templates);
+}
+
+push @command, qw(--set usedirs=0 --plugin img t/tmp/in t/tmp/out --verbose);
 
 my $magick = new Image::Magick;
 my $SVGS_WORK = defined $magick->QueryFormat("svg");
@@ -57,11 +74,7 @@ EOF
 );
 ok(utime(333333333, 333333333, "t/tmp/in/imgconversions.mdwn"));
 
-ok(! system("make -s ikiwiki.out"));
-
-my $command = "perl -I. ./ikiwiki.out --set usedirs=0 --templatedir=templates --plugin img t/tmp/in t/tmp/out --verbose";
-
-ok(! system($command));
+ok(! system(@command));
 
 sub size($) {
        my $filename = shift;
@@ -97,7 +110,7 @@ is(size("$outpath/x6-a:b:c:d:e:f:g:h:i:j.png"), "6x6");
 if (1) { # for easier testing
        writefile("imgconversions.mdwn", "t/tmp/in", "nothing to see here");
 
-       ok(! system("$command --refresh"));
+       ok(! system(@command, "--refresh"));
 
        ok(! -e "$outpath/10x-simple.png");
        ok(! -e "$outpath/10x-simple-svg.png");