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("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_svg_img = "";
-if ($SVGS_WORK) {
- $maybe_svg_img = "[[!img bluesquare.svg size=10x]]";
-}
-
my $maybe_pdf_img = "";
if ($PDFS_WORK) {
$maybe_pdf_img = <<EOF;
[[!img hello:world.png size=x8]] expecting 8x8
[[!img a:b:c.png size=x4]]
[[!img a:b:c:d:e:f:g:h:i:j.png size=x6]]
-$maybe_svg_img
+[[!img bluesquare.svg size=42x]] expecting 42x
+[[!img bluesquare.svg size=x43]] expecting x43
+[[!img bluesquare.svg size=42x43]] expecting 42x43 because aspect rario not preserved
$maybe_pdf_img
# bad ideas
is(size("$outpath/10x-redsquare.png"), "10x10");
ok(! -e "$outpath/30x-redsquare.png");
ok($outhtml =~ /width="30" height="30".*expecting 30x30/);
-
-SKIP: {
- skip "SVG support not installed (try libmagickcore-extra)", 1
- unless $SVGS_WORK;
- # if this fails, you need libmagickcore-6.q16-2-extra installed
- is(size("$outpath/10x-bluesquare.png"), "10x10");
-}
+ok($outhtml =~ /width="42".*expecting 42x/);
+ok($outhtml =~ /height="43".*expecting x43/);
+ok($outhtml =~ /width="42" height="43".*expecting 42x43/);
SKIP: {
skip "PDF support not installed (try ghostscript)", 2
like($outhtml, qr{src="(\./)?imgconversions/12x-redsquare\.jpeg" width="12" height="12"});
# We do not misinterpret images
+my $quot = qr/(?:"|")/;
+like($outhtml, qr/${quot}really-svg\.png${quot} does not seem to be a valid png file/);
ok(! -e "$outpath/666x-really-svg.png");
ok(! -e "$outpath/666x-really-svg.bmp");
+like($outhtml, qr/${quot}really-pdf\.jpeg${quot} does not seem to be a valid jpeg file/);
ok(! -e "$outpath/666x-really-pdf.jpeg");
+like($outhtml, qr/${quot}really-pdf\.jpg${quot} does not seem to be a valid jpeg file/);
ok(! -e "$outpath/666x-really-pdf.jpg");
+like($outhtml, qr/${quot}really-pdf\.png${quot} does not seem to be a valid png file/);
ok(! -e "$outpath/666x-really-pdf.png");
# disable support for uncommon formats and try again