summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorParide Legovini <pl@ninthfloor.org>2018-05-07 17:35:22 +0200
committerParide Legovini <pl@ninthfloor.org>2018-05-07 17:35:22 +0200
commit204e95f543967d9cb347c89d736a5c4ead0610e0 (patch)
tree579d694bfce1576fefa069a4c02dabd7896f8a02
parentc6cf8a4e7f8b41c35da4819bf6529f81283f9c58 (diff)
Add an autopkgtest: roundtrip
-rw-r--r--debian/changelog1
-rw-r--r--debian/tests/control2
-rwxr-xr-xdebian/tests/roundtrip17
3 files changed, 20 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index c83c1e0..6107cda 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,7 @@ farbfeld (4-2) UNRELEASED; urgency=medium
* Change the package short description to match what upstream suggests
* farbfeld 4 is entirely ISC licensed, d/copyright updated accordingly
* Override PREFIX in d/rules instead of patching config.mk
+ * Add an autopkgtest: roundtrip
-- Paride Legovini <pl@ninthfloor.org> Thu, 12 Apr 2018 07:29:02 +0000
diff --git a/debian/tests/control b/debian/tests/control
new file mode 100644
index 0000000..8d804ab
--- /dev/null
+++ b/debian/tests/control
@@ -0,0 +1,2 @@
+Tests: roundtrip
+Depends: @, imagemagick
diff --git a/debian/tests/roundtrip b/debian/tests/roundtrip
new file mode 100755
index 0000000..d108d88
--- /dev/null
+++ b/debian/tests/roundtrip
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+set -e
+
+# https://www.imagemagick.org/Usage/canvas/#random_noise
+convert -size 1920x1200 xc: +noise random reference.png
+
+png2ff < reference.png | ff2png > test.png
+
+# When no fuzz value is specified, compare(1) returns 0 when two images are
+# identical, and 1 when they differ. This is true with any metric (even with
+# the default metric: the normalized cross correlation), but let's use the
+# simplest one, Absolute Error, which counts the number of different pixels.
+#
+# https://www.imagemagick.org/Usage/compare/#compare
+
+compare -metric AE reference.png test.png null: 2>&1