]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
t/img.t: test determinism of PNG resizing.
authorintrigeri <intrigeri@boum.org>
Fri, 1 Sep 2017 19:16:27 +0000 (19:16 +0000)
committerintrigeri <intrigeri@boum.org>
Fri, 1 Sep 2017 19:25:44 +0000 (19:25 +0000)
t/img.t

diff --git a/t/img.t b/t/img.t
index 20c960500f8de136a9d8565eaa825d926d017af8..6049042c2311b8055e10c87c104ac7d797bad40f 100755 (executable)
--- a/t/img.t
+++ b/t/img.t
@@ -155,6 +155,19 @@ 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");
 
+# resize is deterministic when deterministic=1
+ok(utime(333333333, 333333333, "t/tmp/in/redsquare.png"));
+ok(! system("rm $outpath/10x-redsquare.png"));
+ok(! system(@command, '--set-yaml', 'img_allowed_formats=[JPEG, PNG, svg, pdf]', '--set', 'deterministic=1', "--rebuild"));
+ok(! system("cp $outpath/10x-redsquare.png $outpath/10x-redsquare.png.orig"));
+ok(utime(444444444, 444444444, "t/tmp/in/redsquare.png"));
+ok(! system("rm $outpath/10x-redsquare.png"));
+ok(! system(@command, '--set-yaml', 'img_allowed_formats=[JPEG, PNG, svg, pdf]', '--set', 'deterministic=1', "--rebuild"));
+ok(
+       ! system("cmp $outpath/10x-redsquare.png $outpath/10x-redsquare.png.orig"),
+       "resize is deterministic when configured with deterministic=1"
+);
+
 # disable support for uncommon formats and try again
 ok(! system(@command, "--rebuild"));
 ok(! -e "$outpath/10x-bluesquare.png");