X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/cdfb4ab1a3c60bf699b8d77618ec9bdf526cdb35..5c9d9b3213e1cd84a6e6b944e68944313f29111f:/t/img.t diff --git a/t/img.t b/t/img.t index e02e54fc2..228f09a0e 100755 --- a/t/img.t +++ b/t/img.t @@ -13,9 +13,10 @@ package IkiWiki; use warnings; use strict; +use Cwd qw(getcwd); use Test::More; plan(skip_all => "Image::Magick not available") - unless eval q{use Image::Magick}; + unless eval q{use Image::Magick; 1}; use IkiWiki; @@ -27,54 +28,80 @@ if ($installed) { } else { ok(! system("make -s ikiwiki.out")); - @command = qw(perl -I. ./ikiwiki.out + @command = ("perl", "-I".getcwd, qw(./ikiwiki.out --underlaydir=underlays/basewiki --set underlaydirbase=underlays - --templatedir=templates); + --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"); + +$magick->Read("t/img/twopages.pdf"); +my $PDFS_WORK = defined $magick->Get("width"); ok(! system("rm -rf t/tmp; mkdir -p t/tmp/in")); ok(! system("cp t/img/redsquare.png t/tmp/in/redsquare.png")); +ok(! system("cp t/img/redsquare.jpg t/tmp/in/redsquare.jpg")); +ok(! system("cp t/img/redsquare.jpg t/tmp/in/redsquare.jpeg")); +ok(! system("cp t/img/redsquare.jpg t/tmp/in/SHOUTY.JPG")); # colons in filenames are a corner case for img ok(! system("cp t/img/redsquare.png t/tmp/in/hello:world.png")); ok(! system("cp t/img/redsquare.png t/tmp/in/a:b:c.png")); ok(! system("cp t/img/redsquare.png t/tmp/in/a:b:c:d.png")); ok(! system("cp t/img/redsquare.png t/tmp/in/a:b:c:d:e:f:g:h:i:j.png")); -if ($SVGS_WORK) { - writefile("emptysquare.svg", "t/tmp/in", - ''); -} +writefile("bluesquare.svg", "t/tmp/in", + ''); +ok(! system("cp t/tmp/in/bluesquare.svg t/tmp/in/really-svg.png")); +ok(! system("cp t/tmp/in/bluesquare.svg t/tmp/in/really-svg.bmp")); +ok(! system("cp t/tmp/in/bluesquare.svg t/tmp/in/really-svg.pdf")); # using different image sizes for different pages, so the pagenumber selection can be tested easily ok(! system("cp t/img/twopages.pdf t/tmp/in/twopages.pdf")); - -my $maybe_svg_img = ""; -if ($SVGS_WORK) { - $maybe_svg_img = "[[!img emptysquare.svg size=10x]]"; +ok(! system("cp t/img/twopages.pdf t/tmp/in/really-pdf.JPEG")); +ok(! system("cp t/img/twopages.pdf t/tmp/in/really-pdf.jpg")); +ok(! system("cp t/img/twopages.pdf t/tmp/in/really-pdf.png")); +ok(! system("cp t/img/twopages.pdf t/tmp/in/really-pdf.svg")); + +my $maybe_pdf_img = ""; +if ($PDFS_WORK) { + $maybe_pdf_img = <