chiark / gitweb /
Add a superficial autopkgtest for X fonts
authorBen Harris <bjh21@bjh21.me.uk>
Fri, 29 Nov 2024 21:08:43 +0000 (21:08 +0000)
committerBen Harris <bjh21@bjh21.me.uk>
Tue, 3 Dec 2024 16:17:15 +0000 (16:17 +0000)
debian/tests/control
debian/tests/xlsfonts [new file with mode: 0644]

index a5d9f5f6980886ab0747f1376bbeb0daede20b94..42aebef18ab79cf4f58dee1ec9b20f4798bac707 100644 (file)
@@ -4,3 +4,7 @@ Restrictions: superficial
 
 Tests: rom
 Depends: @, ghostscript
+
+Tests: xlsfonts
+Depends: @, x11-utils
+Restrictions: superficial
diff --git a/debian/tests/xlsfonts b/debian/tests/xlsfonts
new file mode 100644 (file)
index 0000000..605500c
--- /dev/null
@@ -0,0 +1,41 @@
+#! /bin/bash
+
+# Check that the X server can find all of the Bedstead fonts that
+# should be installed.  This doesn't check the precise output of
+# xlsfonts just in case there are extra fonts that match.
+
+set -euo pipefail
+
+cd -- "${AUTOPKGTEST_TMP}"
+
+sort >expected <<EOF
+-bjh21-bedstead-bold-r-normal--0-0-75-75-c-0-iso10646-1
+-bjh21-bedstead-bold-r-normal--193-20-75-75-c-120-iso10646-1
+-bjh21-bedstead-medium-r-normal--0-0-75-75-c-0-iso10646-1
+-bjh21-bedstead-medium-r-normal--193-20-75-75-c-120-iso10646-1
+-bjh21-bedstead-medium-r-normal--96-10-75-75-c-60-iso10646-1
+EOF
+
+xvfb-run -a xlsfonts -fn '-bjh21-bedstead-*' | sort >actual
+
+echo "xlsfonts output:"
+cat actual
+
+comm -13 actual expected >missing
+
+if [ -s missing ]; then
+    echo "Missing from xlsfonts output:"
+    cat missing
+    exit 1
+fi
+
+# Check that each alias maps to precisely one font.
+for a in bedstead-10 bedstead-20 bedstead-bold-20; do
+    count="$(xlsfonts "$a" | wc -l)"
+    if [ "$count" -eq 1 ]; then
+        echo "xlsfonts $a correctly returned one result"
+    else
+        echo "xlsfonts $a returned $count results, not 1" >&2
+        exit 1
+    fi
+done