From: Simon McVittie Date: Mon, 18 Jan 2016 09:19:42 +0000 (+0000) Subject: img test: skip testing PDFs if unsupported X-Git-Tag: 3.20160121~13 X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/5dceeb28d8743e71333bf346a26fe296d2e0fb5c?hp=317d19842c40b5056989ad0ce22b632df9153444 img test: skip testing PDFs if unsupported --- diff --git a/debian/changelog b/debian/changelog index 90d6aa626..dc2fe2f06 100644 --- a/debian/changelog +++ b/debian/changelog @@ -36,6 +36,7 @@ ikiwiki (3.20150615) UNRELEASED; urgency=medium * d/control: Standards-Version: 3.9.6, no changes required * Silence "used only once: possible typo" warnings for variables that are part of modules' APIs + * img test: skip testing PDFs if unsupported -- Simon McVittie Mon, 15 Jun 2015 18:13:23 +0100 diff --git a/doc/bugs/img_test_failure_on_nix.mdwn b/doc/bugs/img_test_failure_on_nix.mdwn index 3b9e076d0..911cc66a1 100644 --- a/doc/bugs/img_test_failure_on_nix.mdwn +++ b/doc/bugs/img_test_failure_on_nix.mdwn @@ -27,3 +27,7 @@ Peter Simons wrote: >> >> If the result is `$VAR1 = [ undef ]`, then we can easily make the test skip that bit if PDFs don't work. >> --[[smcv]] + +>>> That configuration test doesn't actually work because of the way +>>> ImageMagick processes PDFs via ghostscript, but loading a sample +>>> PDF and probing its width does seem to work. [[done]] --[[smcv]] diff --git a/t/img.t b/t/img.t index 1f2e7d044..0fceebeb8 100755 --- a/t/img.t +++ b/t/img.t @@ -38,6 +38,9 @@ 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")); @@ -60,6 +63,14 @@ if ($SVGS_WORK) { $maybe_svg_img = "[[!img emptysquare.svg size=10x]]"; } +my $maybe_pdf_img = ""; +if ($PDFS_WORK) { + $maybe_pdf_img = <