From 4bd25423acabd6bdf65676c6d33c069a39ab5004 Mon Sep 17 00:00:00 2001 From: chrysn Date: Fri, 4 Jul 2014 15:04:22 +0200 Subject: [PATCH] add unittests for img this focuses on the features introduced in http://ikiwiki.info/bugs/svg_and_pdf_conversion_fails/ --- t/img.t | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100755 t/img.t diff --git a/t/img.t b/t/img.t new file mode 100755 index 000000000..b42db26cf --- /dev/null +++ b/t/img.t @@ -0,0 +1,60 @@ +#!/usr/bin/perl +# +# unit test that creates test images (png, svg, multi-page pdf), runs ikiwiki +# on them, checks the resulting images for plausibility based on their image +# sizes, and checks if they vanish when not required in the build process any +# more +# +package IkiWiki; + +use warnings; +use strict; +use Test::More; + +BEGIN { use_ok("IkiWiki"); } + +ok(! system("rm -rf t/tmp; mkdir -p t/tmp/in")); + +ok(! system("convert canvas:red -scale 20x20 t/tmp/in/simple.png")); +ok(! system("convert t/tmp/in/simple.png -extent 20x10 t/tmp/in/long.png")); +ok(! system("convert t/tmp/in/simple.png t/tmp/in/simple-svg.svg")); +# using different image sizes for different pages, so the pagenumber selection can be tested easily +ok(! system("convert t/tmp/in/simple.png t/tmp/in/long.png t/tmp/in/simple-pdf.pdf")); + +writefile("imgconversions.mdwn", "t/tmp/in", <