public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Akira TAGOH <akira@tagoh.org>
To: git-commits@fedoraproject.org
Subject: [tests/fonts] rhel9: Initial commit
Date: Thu, 13 Aug 2026 10:29:04 GMT	[thread overview]
Message-ID: <178661694487.1.3758575113067592696.tests-fonts-9d56d105cc3c@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : tests/fonts
Branch : rhel9
Commit : 9d56d105cc3c6226896431d328f28dea0e4e71bb
Author : Akira TAGOH <akira@tagoh.org>
Date   : 2024-06-19T17:28:47+09:00
Stats  : +124/-3 in 8 file(s)
URL    : https://src.fedoraproject.org/tests/fonts/c/9d56d105cc3c6226896431d328f28dea0e4e71bb?branch=rhel9

Log:
Initial commit

---
diff --git a/.fmf/version b/.fmf/version
new file mode 100644
index 0000000..d00491f
--- /dev/null
+++ b/.fmf/version
@@ -0,0 +1 @@
+1

diff --git a/README.md b/README.md
deleted file mode 100644
index 4614479..0000000
--- a/README.md
+++ /dev/null
@@ -1,3 +0,0 @@
-# fonts
-
-The font tests
\ No newline at end of file

diff --git a/README.rst b/README.rst
new file mode 100644
index 0000000..6ac1a82
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,7 @@
+Fonts Tests
+===========
+
+Common test repository for Fedora fonts packages.
+Use `tmt` to run tests easily:
+
+        tmt run

diff --git a/tests/generic_alias/main.fmf b/tests/generic_alias/main.fmf
new file mode 100644
index 0000000..6cf796f
--- /dev/null
+++ b/tests/generic_alias/main.fmf
@@ -0,0 +1,7 @@
+summary: Generic Alias assignment test
+description: >
+    This aims to check if the generic alias rule in a config file
+    properly take effect.
+require+:
+    - fontconfig-devel
+    - pkg-config

diff --git a/tests/generic_alias/test.sh b/tests/generic_alias/test.sh
new file mode 100755
index 0000000..38a6dd7
--- /dev/null
+++ b/tests/generic_alias/test.sh
@@ -0,0 +1,45 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+FONT_ALIAS=${FONT_ALIAS:-"sans-serif"}
+FONT_FAMILY=${FONT_FAMILY:-"family name"}
+FONT_LANG=${FONT_LANG:-"en"}
+FONT_WIDTH=${FONT_WIDTH:-"normal"}
+PACKAGE=${PACKAGE:-"blahblah-fonts"}
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+        rlRun "pushd $tmp"
+        rlRun "set -o pipefail"
+	rlRun "cachedir=\$(pkg-config --variable cachedir fontconfig)" 0 "Set cachedir"
+	rlRun "tmpconfd=\$(mktemp -d)" 0 "Create tmp conf.d directory"
+	rlRun "conffiles=\$(rpm -ql $PACKAGE | grep conf.d)"
+	rlRun "conf=\$(for i in $conffiles; do
+  echo \"<include>\$i</include>\"
+done)"
+	rlRun "cat <<_E_> $tmpconfd/fonts.conf
+<fontconfig>
+  <dir>/usr/share/fonts</dir>
+  $conf
+  <cachedir>$cachedir</cachedir>
+</fontconfig>
+_E_" 0 "Create fonts.conf"
+    rlPhaseEnd
+
+    rlPhaseStartTest
+        rlRun "rpm -q $PACKAGE" 0 "Package installation test"
+    rlPhaseEnd
+
+    rlPhaseStartTest
+        rlRun "cat $tmpconfd/fonts.conf"
+	rlRun "FONTCONFIG=$tmpconfd/fonts.conf fc-match -f \"%{family[0]}\" \":family=$FONT_FAMILY:lang=$FONT_LANG:width=$FONT_WIDTH\" | tee output" 0 "Matching a font"
+        rlAssertGrep "$FONT_FAMILY" "output"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "popd"
+        rlRun "rm -r $tmp" 0 "Remove tmp directory"
+    rlPhaseEnd
+rlJournalEnd

diff --git a/tests/lang_coverage/main.fmf b/tests/lang_coverage/main.fmf
new file mode 100644
index 0000000..4555592
--- /dev/null
+++ b/tests/lang_coverage/main.fmf
@@ -0,0 +1,6 @@
+summary: Language Coverage test
+description: >
+    This aims to check if a font has expected language coverage
+require+:
+    - fontconfig-devel
+    - pkg-config

diff --git a/tests/lang_coverage/test.sh b/tests/lang_coverage/test.sh
new file mode 100755
index 0000000..9f80084
--- /dev/null
+++ b/tests/lang_coverage/test.sh
@@ -0,0 +1,55 @@
+#!/bin/bash
+# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k
+. /usr/share/beakerlib/beakerlib.sh || exit 1
+
+function get_font_path() {
+    fontlist=$(rpm -ql $PACKAGE|grep /usr/share/fonts)
+    ret=$(for f in $fontlist; do
+              dirname $f
+          done|sort|uniq|grep /usr/share/fonts/)
+    echo -n $ret
+}
+
+function check_lang_coverage() {
+    ret=0
+    for p in $(get_font_path); do
+        for f in $(find $p -regex '.*/*\.\(t1\)?\(ttf\)?\(otf\)?\(ttc\)?\(otc\)?\(pcf.*\)?\(pfa\)?'); do
+            set -f
+            if test -f $f; then
+                IFS=, read -ra langlist <<< "$FONT_LANG"
+                for l in "${langlist[@]}"; do
+                    res=$(fc-validate -l $l $f || :)
+                    if echo $res | grep -q Missing; then
+                        ret=1
+                        echo $res
+                    else
+                        echo $res
+                    fi
+                done
+            fi
+            set +f
+        done
+    done
+    return $ret
+}
+
+rlJournalStart
+    rlPhaseStartSetup
+        rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
+        rlRun "pushd $tmp"
+        rlRun "set -o pipefail"
+    rlPhaseEnd
+
+    rlPhaseStartTest
+        rlRun "rpm -q $PACKAGE" 0 "Package installation test"
+    rlPhaseEnd
+
+    rlPhaseStartTest
+        rlRun "check_lang_coverage" 0 "Check Language Coverage"
+    rlPhaseEnd
+
+    rlPhaseStartCleanup
+        rlRun "popd"
+        rlRun "rm -r $tmp" 0 "Remove tmp directory"
+    rlPhaseEnd
+rlJournalEnd

diff --git a/tests/main.fmf b/tests/main.fmf
new file mode 100644
index 0000000..ecf4ab3
--- /dev/null
+++ b/tests/main.fmf
@@ -0,0 +1,3 @@
+test: ./test.sh
+framework: beakerlib
+

                 reply	other threads:[~2026-08-13 10:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178661694487.1.3758575113067592696.tests-fonts-9d56d105cc3c@fedoraproject.org \
    --to=akira@tagoh.org \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox