aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2018-02-28 09:49:46 +0000
committerSimon McVittie <smcv@debian.org>2018-02-28 09:56:07 +0000
commitf446e7ca5fee39f7fb7db171221d1cdf6d7f4f9e (patch)
treeb7479b6757904716237238a31936ee9e167b0673 /t
parent0e5c8ae806283d31bcfaf63f5af361f97dbe91f0 (diff)
downloadikiwiki-f446e7ca5fee39f7fb7db171221d1cdf6d7f4f9e.tar
ikiwiki-f446e7ca5fee39f7fb7db171221d1cdf6d7f4f9e.tar.gz
img test: Don't rely on using an empty ImageMagick coder name
This used to work, but has been interpreted as a literal part of the filename since ImageMagick 6.9.8-3. In newer versions, there does not seem to be any way to indicate that a filename containing ':' is to be taken literally without first knowing the decoder to use. Signed-off-by: Simon McVittie <smcv@debian.org>
Diffstat (limited to 't')
-rwxr-xr-xt/img.t15
1 files changed, 14 insertions, 1 deletions
diff --git a/t/img.t b/t/img.t
index 6049042c2..e42d85353 100755
--- a/t/img.t
+++ b/t/img.t
@@ -105,8 +105,21 @@ ok(! system(@command, '--set-yaml', 'img_allowed_formats=[JPEG, PNG, svg, pdf]')
sub size($) {
my $filename = shift;
+ my $decoder;
+ if ($filename =~ m/\.png$/i) {
+ $decoder = 'png';
+ }
+ elsif ($filename =~ m/\.jpe?g$/i) {
+ $decoder = 'jpeg';
+ }
+ elsif ($filename =~ m/\.bmp$/i) {
+ $decoder = 'bmp';
+ }
+ else {
+ die "Unexpected extension in '$filename'";
+ }
my $im = Image::Magick->new();
- my $r = $im->Read(":$filename");
+ my $r = $im->Read("$decoder:$filename");
return "no image: $r" if $r;
my $w = $im->Get("width");
my $h = $im->Get("height");