summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-04-13 15:30:10 +0200
committerLaurenz <laurmaedje@gmail.com>2022-04-13 16:01:24 +0200
commitb274155c6d36dfe956899e3606b535cc94c8aca9 (patch)
tree67a439c1a5ecefc1de24099df6e9c2ebb58c1128 /tests
parentd025854457b4c2d1c2285bd1c5e795edad79a749 (diff)
Improve language and add region controls
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/text/lang.pngbin0 -> 4274 bytes
-rw-r--r--tests/ref/text/quotes.pngbin59067 -> 65503 bytes
-rw-r--r--tests/typ/text/lang.typ39
-rw-r--r--tests/typ/text/quotes.typ7
4 files changed, 44 insertions, 2 deletions
diff --git a/tests/ref/text/lang.png b/tests/ref/text/lang.png
new file mode 100644
index 00000000..cbb66628
--- /dev/null
+++ b/tests/ref/text/lang.png
Binary files differ
diff --git a/tests/ref/text/quotes.png b/tests/ref/text/quotes.png
index d31ae937..058055ae 100644
--- a/tests/ref/text/quotes.png
+++ b/tests/ref/text/quotes.png
Binary files differ
diff --git a/tests/typ/text/lang.typ b/tests/typ/text/lang.typ
new file mode 100644
index 00000000..7d22fdc6
--- /dev/null
+++ b/tests/typ/text/lang.typ
@@ -0,0 +1,39 @@
+// Test setting the document language.
+
+---
+// 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"],
+)
+
+---
+// Test that the language passed to the shaper has an effect.
+#set text("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")[Бб]
+
+---
+// Error: 17-21 expected string, found none
+#set text(lang: none)
+
+---
+// Error: 17-20 expected two or three letter language code (ISO 639-1/2/3)
+#set text(lang: "ӛ")
+
+---
+// Error: 17-20 expected two or three letter language code (ISO 639-1/2/3)
+#set text(lang: "😃")
+
+---
+// Error: 19-24 expected two letter region code (ISO 3166-1 alpha-2)
+#set text(region: "hey")
diff --git a/tests/typ/text/quotes.typ b/tests/typ/text/quotes.typ
index b447258f..f229fd23 100644
--- a/tests/typ/text/quotes.typ
+++ b/tests/typ/text/quotes.typ
@@ -1,7 +1,7 @@
// Test smart quotes.
---
-#set page(width: 200pt)
+#set page(width: 250pt)
// Test simple quotations in various languages.
#set text(lang: "en")
@@ -10,7 +10,10 @@
#set text(lang: "de")
"Das Pferd frisst keinen Gurkensalat" war der erste jemals am 'Fernsprecher' gesagte Satz.
-#set text(lang: "fr")
+#set text(lang: "de", region: "CH")
+"Das Pferd frisst keinen Gurkensalat" war der erste jemals am 'Fernsprecher' gesagte Satz.
+
+#set text(lang: "fr", region: none)
"Le cheval ne mange pas de salade de concombres" est la première phrase jamais prononcée au 'téléphone'.
#set text(lang: "fi")