diff options
| author | Laurenz <laurmaedje@gmail.com> | 2021-06-10 16:46:01 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-06-10 16:46:01 +0200 |
| commit | 5611c26577c4cf6d52b9b66b7b1a32253aa23ec1 (patch) | |
| tree | b06a64845ef691700aed7fd0ed1e22dd064cc742 /tests/typ/text | |
| parent | bce553a991f19b2b5bb9efef6b74bd12e15a10c6 (diff) | |
Restructure tests
Diffstat (limited to 'tests/typ/text')
| -rw-r--r-- | tests/typ/text/bidi.typ | 17 | ||||
| -rw-r--r-- | tests/typ/text/font.typ | 74 | ||||
| -rw-r--r-- | tests/typ/text/par.typ | 12 |
3 files changed, 98 insertions, 5 deletions
diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ index 0d589930..078cb1f9 100644 --- a/tests/typ/text/bidi.typ +++ b/tests/typ/text/bidi.typ @@ -1,27 +1,27 @@ -// Test bidirectional text. +// Test bidirectional text and language configuration. --- // Test reordering with different top-level paragraph directions. #let text = [Text טֶקסט] #font("EB Garamond", "Noto Serif Hebrew") -#lang("de") {text} #lang("he") {text} +#lang("de") {text} --- -// Test that consecutiv, embedded LTR runs stay LTR. +// Test that consecutive, embedded LTR runs stay LTR. // Here, we have two runs: "A" and italic "B". #let text = [أنت A_B_مطرC] #font("EB Garamond", "Noto Sans Arabic") -#lang("de") {text} #lang("ar") {text} +#lang("de") {text} --- // Test that consecutive, embedded RTL runs stay RTL. // Here, we have three runs: "גֶ", bold "שֶׁ", and "ם". #let text = [Aגֶ*שֶׁ*םB] #font("EB Garamond", "Noto Serif Hebrew") -#lang("de") {text} #lang("he") {text} +#lang("de") {text} --- // Test embedding up to level 4 with isolates. @@ -47,3 +47,10 @@ Lריווח #h(1cm) R #font("Noto Serif Hebrew", "EB Garamond") #lang("he") קרנפיםRh#image("../../res/rhino.png", height: 11pt)inoחיים + +--- +// Test the `lang` function. +// Ref: false + +// Error: 12-15 must be horizontal +#lang(dir: ttb) diff --git a/tests/typ/text/font.typ b/tests/typ/text/font.typ new file mode 100644 index 00000000..317037e2 --- /dev/null +++ b/tests/typ/text/font.typ @@ -0,0 +1,74 @@ +// Test configuring font properties. + +--- +// Set same font size in three different ways. +#font(22pt)[A] +#font(200%)[A] +#font(16.5pt + 50%)[A] + +// Do nothing. +#font[Normal] + +// Set style (is available). +#font(style: italic)[Italic] + +// Set weight (is available). +#font(weight: bold)[Bold] + +// Set stretch (not available, matching closest). +#font(stretch: 50%)[Condensed] + +// Set family. +#font("PT Sans")[Sans serif] + +// Emoji. +Emoji: 🐪, 🌋, 🏞 + +// Math. +#font("Latin Modern Math")[ + ∫ 𝛼 + 3𝛽 d𝑡 +] + +// Colors. +#font(color: eastern)[This is #font(color: #FA644B)[way more] colorful.] + +--- +// Test top and bottom edge. + +#page(width: 170pt) +#let try(top, bottom) = rect(fill: conifer)[ + #font(top-edge: top, bottom-edge: bottom) + `From `#top` to `#bottom +] + +#try(ascender, descender) +#try(ascender, baseline) +#try(cap-height, baseline) +#try(x-height, baseline) + +--- +// Test class definitions. +#font(sans-serif: "PT Sans") +#font(sans-serif)[Sans-serif.] \ +#font(monospace)[Monospace.] \ +#font(monospace, monospace: ("Nope", "Latin Modern Math"))[Math.] + +--- +// Ref: false + +// Error: 7-12 unexpected argument +#font(false) + +// Error: 3:14-3:18 expected font style, found font weight +// Error: 2:28-2:34 expected font weight, found string +// Error: 1:43-1:44 expected string or array of strings, found integer +#font(style: bold, weight: "thin", serif: 0) + +// Warning: 15-19 should be between 100 and 900 +#font(weight: 2700) + +// Warning: 16-21 should be between 50% and 200% +#font(stretch: 1000%) + +// Error: 7-27 unexpected argument +#font(something: "invalid") diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ new file mode 100644 index 00000000..4ce2f6f1 --- /dev/null +++ b/tests/typ/text/par.typ @@ -0,0 +1,12 @@ +// Test configuring paragraph properties. + +--- +// FIXME: Word spacing doesn't work due to new shaping process. +#par(spacing: 10pt, leading: 25%, word-spacing: 1pt) + +But, soft! what light through yonder window breaks? It is the east, and Juliet +is the sun. + +--- +// Test that it finishes an existing paragraph. +Hello #par(word-spacing: 0pt) t h e r e ! |
