summaryrefslogtreecommitdiff
path: root/tests/suite/text/lang.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-04-13 10:39:45 +0200
committerGitHub <noreply@github.com>2024-04-13 08:39:45 +0000
commit020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch)
treec0027ad22046e2726c22298461327823d6b88d53 /tests/suite/text/lang.typ
parent72dd79210602ecc799726fc096b078afbb47f299 (diff)
Better test runner (#3922)
Diffstat (limited to 'tests/suite/text/lang.typ')
-rw-r--r--tests/suite/text/lang.typ74
1 files changed, 74 insertions, 0 deletions
diff --git a/tests/suite/text/lang.typ b/tests/suite/text/lang.typ
new file mode 100644
index 00000000..74f70140
--- /dev/null
+++ b/tests/suite/text/lang.typ
@@ -0,0 +1,74 @@
+// Test setting the document language.
+
+--- text-lang ---
+// without any region
+#set text(font: "Noto Serif CJK TC", lang: "zh")
+#outline()
+
+--- text-lang-unknown-region ---
+// with unknown region configured
+#set text(font: "Noto Serif CJK TC", lang: "zh", region: "XX")
+#outline()
+
+--- text-lang-region ---
+// with region configured
+#set text(font: "Noto Serif CJK TC", lang: "zh", region: "TW")
+#outline()
+
+--- text-lang-hyphenate ---
+// Ensure that setting the language does have effects.
+#set text(hyphenate: true)
+#grid(
+ columns: 2 * (20pt,),
+ gutter: 1fr,
+ text(lang: "en")["Eingabeaufforderung"],
+ text(lang: "de")["Eingabeaufforderung"],
+)
+
+--- text-lang-shaping ---
+// Test that the language passed to the shaper has an effect.
+#set text(font: "Ubuntu")
+
+// Some lowercase letters are different in Serbian Cyrillic compared to other
+// Cyrillic languages. Since there is only one set of Unicode codepoints for
+// Cyrillic, these can only be seen when setting the language to Serbian and
+// selecting one of the few fonts that support these letterforms.
+Бб
+#text(lang: "uk")[Бб]
+#text(lang: "sr")[Бб]
+
+--- text-lang-script-shaping ---
+// Verify that writing script/language combination has an effect
+#{
+ set text(size:20pt)
+ set text(script: "latn", lang: "en")
+ [Ş ]
+ set text(script: "latn", lang: "ro")
+ [Ş ]
+ set text(script: "grek", lang: "ro")
+ [Ş ]
+}
+
+--- text-script-bad-type ---
+// Error: 19-23 expected string or auto, found none
+#set text(script: none)
+
+--- text-script-bad-value ---
+// Error: 19-23 expected three or four letter script code (ISO 15924 or 'math')
+#set text(script: "ab")
+
+--- text-lang-bad-type ---
+// Error: 17-21 expected string, found none
+#set text(lang: none)
+
+--- text-lang-bad-value ---
+// Error: 17-20 expected two or three letter language code (ISO 639-1/2/3)
+#set text(lang: "ӛ")
+
+--- text-lang-bad-value-emoji ---
+// Error: 17-20 expected two or three letter language code (ISO 639-1/2/3)
+#set text(lang: "😃")
+
+--- text-region-bad-value ---
+// Error: 19-24 expected two letter region code (ISO 3166-1 alpha-2)
+#set text(region: "hey")