diff options
| author | Laurenz <laurmaedje@gmail.com> | 2024-04-13 10:39:45 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-04-13 08:39:45 +0000 |
| commit | 020294fca9a7065d4b9cf4e677f606ebaaa29b00 (patch) | |
| tree | c0027ad22046e2726c22298461327823d6b88d53 /tests/typ/text | |
| parent | 72dd79210602ecc799726fc096b078afbb47f299 (diff) | |
Better test runner (#3922)
Diffstat (limited to 'tests/typ/text')
39 files changed, 0 insertions, 1567 deletions
diff --git a/tests/typ/text/baseline.typ b/tests/typ/text/baseline.typ deleted file mode 100644 index c8fbb19d..00000000 --- a/tests/typ/text/baseline.typ +++ /dev/null @@ -1,12 +0,0 @@ -// Test baseline handling. - ---- -Hi #text(1.5em)[You], #text(0.75em)[how are you?] - -Our cockatoo was one of the -#text(baseline: -0.2em)[#box(circle(radius: 2pt)) first] -#text(baseline: 0.2em)[birds #box(circle(radius: 2pt))] -that ever learned to mimic a human voice. - ---- -Hey #box(baseline: 40%, image("/assets/images/tiger.jpg", width: 1.5cm)) there! diff --git a/tests/typ/text/case.typ b/tests/typ/text/case.typ deleted file mode 100644 index 75574f21..00000000 --- a/tests/typ/text/case.typ +++ /dev/null @@ -1,12 +0,0 @@ -// Test the `upper` and `lower` functions. -// Ref: false - ---- -#let memes = "ArE mEmEs gReAt?"; -#test(lower(memes), "are memes great?") -#test(upper(memes), "ARE MEMES GREAT?") -#test(upper("Ελλάδα"), "ΕΛΛΆΔΑ") - ---- -// Error: 8-9 expected string or content, found integer -#upper(1) diff --git a/tests/typ/text/chinese.typ b/tests/typ/text/chinese.typ deleted file mode 100644 index 258d72fd..00000000 --- a/tests/typ/text/chinese.typ +++ /dev/null @@ -1,9 +0,0 @@ -// Test chinese text from Wikipedia. - ---- -#set text(font: "Noto Serif CJK SC") - -是美国广播公司电视剧《迷失》第3季的第22和23集,也是全剧的第71集和72集 -由执行制作人戴蒙·林道夫和卡尔顿·库斯编剧,导演则是另一名执行制作人杰克·本德 -节目于2007年5月23日在美国和加拿大首播,共计吸引了1400万美国观众收看 -本集加上插播广告一共也持续有两个小时 diff --git a/tests/typ/text/copy-paste.typ b/tests/typ/text/copy-paste.typ deleted file mode 100644 index 5d826482..00000000 --- a/tests/typ/text/copy-paste.typ +++ /dev/null @@ -1,8 +0,0 @@ -// Test copy-paste and search in PDF with ligatures -// and Arabic test. Must be tested manually! - ---- -The after fira 🏳️🌈! - -#set text(lang: "ar", font: "Noto Sans Arabic") -مرحبًا diff --git a/tests/typ/text/deco.typ b/tests/typ/text/deco.typ deleted file mode 100644 index cc9b9b3a..00000000 --- a/tests/typ/text/deco.typ +++ /dev/null @@ -1,85 +0,0 @@ -// Test text decorations. - ---- -#let red = rgb("fc0030") - -// Basic strikethrough. -#strike[Statements dreamt up by the utterly deranged.] - -// Move underline down. -#underline(offset: 5pt)[Further below.] - -// Different color. -#underline(stroke: red, evade: false)[Critical information is conveyed here.] - -// Inherits font color. -#text(fill: red, underline[Change with the wind.]) - -// Both over- and underline. -#overline(underline[Running amongst the wolves.]) - ---- -#let redact = strike.with(stroke: 10pt, extent: 0.05em) -#let highlight-custom = strike.with(stroke: 10pt + rgb("abcdef88"), extent: 0.05em) - -// Abuse thickness and transparency for redacting and highlighting stuff. -Sometimes, we work #redact[in secret]. -There might be #highlight-custom[redacted] things. - ---- -// Test stroke folding. -#set underline(stroke: 2pt, offset: 2pt) -#underline(text(red, [DANGER!])) - ---- -// Test highlight. -This is the built-in #highlight[highlight with default color]. -We can also specify a customized value -#highlight(fill: green.lighten(80%))[to highlight]. - ---- -// Test default highlight bounds. -#highlight[ace], -#highlight[base], -#highlight[super], -#highlight[phone #sym.integral] - ---- -// Test a tighter highlight. -#set highlight(top-edge: "x-height", bottom-edge: "baseline") -#highlight[ace], -#highlight[base], -#highlight[super], -#highlight[phone #sym.integral] - ---- -// Test a bounds highlight. -#set highlight(top-edge: "bounds", bottom-edge: "bounds") -#highlight[abc] -#highlight[abc #sym.integral] - ---- -// Test highlight radius -#highlight(radius: 3pt)[abc], -#highlight(radius: 1em)[#lorem(5)] - ---- -// Test highlight stroke -#highlight(stroke: 2pt + blue)[abc] -#highlight(stroke: (top: blue, left: red, bottom: green, right: orange))[abc] -#highlight(stroke: 1pt, radius: 3pt)[#lorem(5)] - ---- -// Test underline background -#set underline(background: true, stroke: (thickness: 0.5em, paint: red, cap: "round")) -#underline[This is in the background] - ---- -// Test overline background -#set overline(background: true, stroke: (thickness: 0.5em, paint: red, cap: "round")) -#overline[This is in the background] - ---- -// Test strike background -#set strike(background: true, stroke: 5pt + red) -#strike[This is in the background] diff --git a/tests/typ/text/edge.typ b/tests/typ/text/edge.typ deleted file mode 100644 index 053576e8..00000000 --- a/tests/typ/text/edge.typ +++ /dev/null @@ -1,39 +0,0 @@ -// Test top and bottom text edge. - ---- -#set page(width: 160pt) -#set text(size: 8pt) - -#let try(top, bottom) = rect(inset: 0pt, fill: conifer)[ - #set text(font: "IBM Plex Mono", top-edge: top, bottom-edge: bottom) - From #top to #bottom -] - -#let try-bounds(top, bottom) = rect(inset: 0pt, fill: conifer)[ - #set text(font: "IBM Plex Mono", top-edge: top, bottom-edge: bottom) - #top to #bottom: "yay, Typst" -] - -#try("ascender", "descender") -#try("ascender", "baseline") -#try("cap-height", "baseline") -#try("x-height", "baseline") -#try-bounds("cap-height", "baseline") -#try-bounds("bounds", "baseline") -#try-bounds("bounds", "bounds") -#try-bounds("x-height", "bounds") - -#try(4pt, -2pt) -#try(1pt + 0.3em, -0.15em) - ---- -// Error: 21-23 expected "ascender", "cap-height", "x-height", "baseline", "bounds", or length, found array -#set text(top-edge: ()) - ---- -// Error: 24-26 expected "baseline", "descender", "bounds", or length -#set text(bottom-edge: "") - ---- -// Error: 24-36 expected "baseline", "descender", "bounds", or length -#set text(bottom-edge: "cap-height") diff --git a/tests/typ/text/em.typ b/tests/typ/text/em.typ deleted file mode 100644 index bf191c1f..00000000 --- a/tests/typ/text/em.typ +++ /dev/null @@ -1,33 +0,0 @@ -// Test font-relative sizing. - ---- -#set text(size: 5pt) -A // 5pt -#[ - #set text(size: 2em) - B // 10pt - #[ - #set text(size: 1.5em + 1pt) - C // 16pt - #text(size: 2em)[D] // 32pt - E // 16pt - ] - F // 10pt -] -G // 5pt - ---- -// Test using ems in arbitrary places. -#set text(size: 5pt) -#set text(size: 2em) -#set square(fill: red) - -#let size = { - let size = 0.25em + 1pt - for _ in range(3) { - size *= 2 - } - size - 3pt -} - -#stack(dir: ltr, spacing: 1fr, square(size: size), square(size: 25pt)) diff --git a/tests/typ/text/emoji.typ b/tests/typ/text/emoji.typ deleted file mode 100644 index f8e0d5b6..00000000 --- a/tests/typ/text/emoji.typ +++ /dev/null @@ -1,18 +0,0 @@ -// Test emoji shaping. - ---- -// This should form a three-member family. -👩👩👦 - -// This should form a pride flag. -🏳️🌈 - -// Skin tone modifier should be applied. -👍🏿 - -// This should be a 1 in a box. -1️⃣ - ---- -// These two shouldn't be affected by a zero-width joiner. -🏞🌋 diff --git a/tests/typ/text/emphasis.typ b/tests/typ/text/emphasis.typ deleted file mode 100644 index 93913dcf..00000000 --- a/tests/typ/text/emphasis.typ +++ /dev/null @@ -1,50 +0,0 @@ -// Test emph and strong. - ---- -// Basic. -_Emphasized and *strong* words!_ - -// Inside of a word it's a normal underscore or star. -hello_world Nutzer*innen - -// CJK characters will not need spaces. -中文一般使用*粗体*或者_楷体_来表示强调。 - -日本語では、*太字*や_斜体_を使って強調します。 - -中文中混有*Strong*和_Empasis_。 - -// Can contain paragraph in nested content block. -_Still #[ - -] emphasized._ - ---- -// Inside of words can still use the functions. -P#strong[art]ly em#emph[phas]ized. - ---- -// Adjusting the delta that strong applies on the weight. -Normal - -#set strong(delta: 300) -*Bold* - -#set strong(delta: 150) -*Medium* and *#[*Bold*]* - ---- -// Error: 6-7 unclosed delimiter -#box[_Scoped] to body. - ---- -// Ends at paragraph break. -// Error: 1-2 unclosed delimiter -_Hello - -World - ---- -// Error: 11-12 unclosed delimiter -// Error: 3-4 unclosed delimiter -#[_Cannot *be interleaved] diff --git a/tests/typ/text/escape.typ b/tests/typ/text/escape.typ deleted file mode 100644 index 901632ba..00000000 --- a/tests/typ/text/escape.typ +++ /dev/null @@ -1,36 +0,0 @@ -// Test escape sequences. - ---- -// Escapable symbols. -\\ \/ \[ \] \{ \} \# \* \_ \+ \= \~ \ -\` \$ \" \' \< \> \@ \( \) \A - -// No need to escape. -( ) ; - -// Escaped comments. -\// -\/\* \*\/ -\/* \*/ * - -// Unicode escape sequence. -\u{1F3D5} == 🏕 - -// Escaped escape sequence. -\u{41} vs. \\u\{41\} - -// Some code stuff in text. -let f() , ; : | + - /= == 12 "string" - -// Escaped dot. -10\. May - ---- -// Unicode codepoint does not exist. -// Error: 1-11 invalid Unicode codepoint: FFFFFF -\u{FFFFFF} - ---- -// Unterminated. -// Error: 1-6 unclosed Unicode escape sequence -\u{41[*Bold*] diff --git a/tests/typ/text/fallback.typ b/tests/typ/text/fallback.typ deleted file mode 100644 index 1db85945..00000000 --- a/tests/typ/text/fallback.typ +++ /dev/null @@ -1,20 +0,0 @@ -// Test font fallback. - ---- -// Font fallback for emoji. -A😀B - -// Font fallback for entire text. -دع النص يمطر عليك - -// Font fallback in right-to-left text. -ب🐈😀سم - -// Multi-layer font fallback. -Aب😀🏞سمB - -// Font fallback with composed emojis and multiple fonts. -01️⃣2 - -// Tofus are rendered with the first font. -A🐈ዲሞB diff --git a/tests/typ/text/features.typ b/tests/typ/text/features.typ deleted file mode 100644 index 69a7064f..00000000 --- a/tests/typ/text/features.typ +++ /dev/null @@ -1,63 +0,0 @@ -// Test OpenType features. - ---- -// Test turning kerning off. -#text(kerning: true)[Tq] \ -#text(kerning: false)[Tq] - ---- -// Test smallcaps. -#smallcaps[Smallcaps] - ---- -// Test alternates and stylistic sets. -#set text(font: "IBM Plex Serif") -a vs #text(alternates: true)[a] \ -ß vs #text(stylistic-set: 5)[ß] - ---- -// Test ligatures. -fi vs. #text(ligatures: false)[No fi] - ---- -// Test number type. -#set text(number-type: "old-style") -0123456789 \ -#text(number-type: auto)[0123456789] - ---- -// Test number width. -#text(number-width: "proportional")[0123456789] \ -#text(number-width: "tabular")[3456789123] \ -#text(number-width: "tabular")[0123456789] - ---- -// Test extra number stuff. -#set text(font: "IBM Plex Serif") -0 vs. #text(slashed-zero: true)[0] \ -1/2 vs. #text(fractions: true)[1/2] - ---- -// Test raw features. -#text(features: ("smcp",))[Smcp] \ -fi vs. #text(features: (liga: 0))[No fi] - ---- -// Error: 26-31 expected integer or none, found boolean -#set text(stylistic-set: false) - ---- -// Error: 26-28 stylistic set must be between 1 and 20 -#set text(stylistic-set: 25) - ---- -// Error: 24-25 expected "lining", "old-style", or auto, found integer -#set text(number-type: 2) - ---- -// Error: 21-26 expected array or dictionary, found boolean -#set text(features: false) - ---- -// Error: 21-35 expected string, found boolean -#set text(features: ("tag", false)) diff --git a/tests/typ/text/font.typ b/tests/typ/text/font.typ deleted file mode 100644 index 736ded41..00000000 --- a/tests/typ/text/font.typ +++ /dev/null @@ -1,66 +0,0 @@ -// Test configuring font properties. - ---- -// Set same font size in three different ways. -#text(20pt)[A] -#text(2em)[A] -#text(size: 15pt + 0.5em)[A] - -// Do nothing. -#text()[Normal] - -// Set style (is available). -#text(style: "italic")[Italic] - -// Set weight (is available). -#text(weight: "bold")[Bold] - -// Set stretch (not available, matching closest). -#text(stretch: 50%)[Condensed] - -// Set font family. -#text(font: "IBM Plex Serif")[Serif] - -// Emoji. -Emoji: 🐪, 🌋, 🏞 - -// Colors. -#[ - #set text(fill: eastern) - This is #text(rgb("FA644B"))[way more] colorful. -] - -// Transparency. -#block(fill: green)[ - #set text(fill: rgb("FF000080")) - This text is transparent. -] - -// Disable font fallback beyond the user-specified list. -// Without disabling, New Computer Modern Math would come to the rescue. -#set text(font: ("PT Sans", "Twitter Color Emoji"), fallback: false) -2π = 𝛼 + 𝛽. ✅ - ---- -// Test string body. -#text("Text") \ -#text(red, "Text") \ -#text(font: "Ubuntu", blue, "Text") \ -#text([Text], teal, font: "IBM Plex Serif") \ -#text(forest, font: "New Computer Modern", [Text]) \ - ---- -// Error: 11-16 unexpected argument -#set text(false) - ---- -// Error: 18-24 expected "normal", "italic", or "oblique" -#set text(style: "bold", weight: "thin") - ---- -// Error: 23-27 unexpected argument -#set text(size: 10pt, 12pt) - ---- -// Error: 11-31 unexpected argument: something -#set text(something: "invalid") diff --git a/tests/typ/text/hyphenate.typ b/tests/typ/text/hyphenate.typ deleted file mode 100644 index 42946a88..00000000 --- a/tests/typ/text/hyphenate.typ +++ /dev/null @@ -1,51 +0,0 @@ -// Test hyphenation. - ---- -// Test hyphenating english and greek. -#set text(hyphenate: true) -#set page(width: auto) -#grid( - columns: (50pt, 50pt), - [Warm welcomes to Typst.], - text(lang: "el")[διαμερίσματα. \ λατρευτός], -) - ---- -// Test disabling hyphenation for short passages. -#set page(width: 110pt) -#set text(hyphenate: true) - -Welcome to wonderful experiences. \ -Welcome to `wonderful` experiences. \ -Welcome to #text(hyphenate: false)[wonderful] experiences. \ -Welcome to wonde#text(hyphenate: false)[rf]ul experiences. \ - -// Test enabling hyphenation for short passages. -#set text(hyphenate: false) -Welcome to wonderful experiences. \ -Welcome to wo#text(hyphenate: true)[nd]erful experiences. \ - ---- -// Hyphenate between shape runs. -#set page(width: 80pt) -#set text(hyphenate: true) -It's a #emph[Tree]beard. - ---- -// Test shy hyphens. -#set text(lang: "de", hyphenate: true) -#grid( - columns: 2 * (20pt,), - gutter: 20pt, - [Barankauf], - [Bar-?ankauf], -) - ---- -// This sequence would confuse hypher if we passed trailing / leading -// punctuation instead of just the words. So this tests that we don't -// do that. The test passes if there's just one hyphenation between -// "net" and "works". -#set page(width: 60pt) -#set text(hyphenate: true) -#h(6pt) networks, the rest. diff --git a/tests/typ/text/lang-with-region.typ b/tests/typ/text/lang-with-region.typ deleted file mode 100644 index f890a00f..00000000 --- a/tests/typ/text/lang-with-region.typ +++ /dev/null @@ -1,16 +0,0 @@ -// Test if text with region works - ---- -// without any region -#set text(font: "Noto Serif CJK TC", lang: "zh") -#outline() - ---- -// with unknown region configured -#set text(font: "Noto Serif CJK TC", lang: "zh", region: "XX") -#outline() - ---- -// with region configured -#set text(font: "Noto Serif CJK TC", lang: "zh", region: "TW") -#outline() diff --git a/tests/typ/text/lang.typ b/tests/typ/text/lang.typ deleted file mode 100644 index 7f1ae1fc..00000000 --- a/tests/typ/text/lang.typ +++ /dev/null @@ -1,59 +0,0 @@ -// 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(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")[Бб] - ---- -// 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") - [Ş ] -} - ---- -// Error: 19-23 expected string or auto, found none -#set text(script: none) - ---- -// Error: 19-23 expected three or four letter script code (ISO 15924 or 'math') -#set text(script: "ab") - ---- -// 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/linebreak-link.typ b/tests/typ/text/linebreak-link.typ deleted file mode 100644 index 9f6407fa..00000000 --- a/tests/typ/text/linebreak-link.typ +++ /dev/null @@ -1,23 +0,0 @@ -// Test linebreaking of links. - ---- -#link("https://example.com/(ab") \ -#link("https://example.com/(ab)") \ -#link("https://example.com/(paren)") \ -#link("https://example.com/paren)") \ -#link("https://hi.com/%%%%%%%%abcdef") \ - ---- -#set page(width: 240pt) -#set par(justify: true) - -Here's a link https://url.com/data/extern12840%data_urlenc and then there are more -links #link("www.url.com/data/extern12840%data_urlenc") in my text of links -http://mydataurl/hash/12098541029831025981024980124124214/incremental/progress%linkdata_information_setup_my_link_just_never_stops_going/on?query=false - ---- -// Ensure that there's no unconditional break at the end of a link. -#set page(width: 180pt, height: auto, margin: auto) -#set text(11pt) - -For info see #link("https://myhost.tld"). diff --git a/tests/typ/text/linebreak-obj.typ b/tests/typ/text/linebreak-obj.typ deleted file mode 100644 index ebf55f15..00000000 --- a/tests/typ/text/linebreak-obj.typ +++ /dev/null @@ -1,24 +0,0 @@ -// Test linebreaks with after inline elements. - ---- -// Test punctuation after citations. -#set page(width: 162pt) - -They can look for the details in @netwok, -which is the authoritative source. - -#bibliography("/assets/bib/works.bib") - ---- -// Test punctuation after math equations. -#set page(width: 85pt) - -We prove $1 < 2$. \ -We prove $1 < 2$! \ -We prove $1 < 2$? \ -We prove $1 < 2$, \ -We prove $1 < 2$; \ -We prove $1 < 2$: \ -We prove $1 < 2$- \ -We prove $1 < 2$– \ -We prove $1 < 2$— \ diff --git a/tests/typ/text/linebreak.typ b/tests/typ/text/linebreak.typ deleted file mode 100644 index 2ddeb9ed..00000000 --- a/tests/typ/text/linebreak.typ +++ /dev/null @@ -1,60 +0,0 @@ -// Test line breaks. - ---- -// Test overlong word that is not directly after a hard break. -This is a spaceexceedinglylongy. - ---- -// Test two overlong words in a row. -Supercalifragilisticexpialidocious Expialigoricmetrioxidation. - ---- -// Test for non-breaking space and hyphen. -There are non\u{2011}breaking~characters. - ---- -// Test for narrow non-breaking space. -#show "_": sym.space.nobreak.narrow -0.1_g, 1_g, 10_g, 100_g, 1_000_g, 10_000_g, 100_000_g, 1_000_000_g - ---- -// Test that there are no unwanted line break opportunities on run change. -This is partly emp#emph[has]ized. - ---- -Hard #linebreak() break. - ---- -// Test hard break directly after normal break. -Hard break directly after \ normal break. - ---- -// Test consecutive breaks. -Two consecutive \ \ breaks and three \ \ more. - ---- -// Test forcing an empty trailing line. -Trailing break \ \ - ---- -// Test justified breaks. -#set par(justify: true) -With a soft #linebreak(justify: true) -break you can force a break without #linebreak(justify: true) -breaking justification. #linebreak(justify: false) -Nice! - ---- -// Test comments at the end of a line -First part// -Second part - -// Test comments at the end of a line with pre-spacing -First part // -Second part - ---- -// Test linebreak for East Asian languages -ทีวีตรวจทานนอร์ทแฟรีเลคเชอร์โกลด์อัลบัมเชอร์รี่เย้วสโตร์กฤษณ์เคลมเยอบีร่าพ่อค้าบลูเบอร์รี่สหัสวรรษโฮปแคนูโยโย่จูนสตรอว์เบอร์รีซื่อบื้อเยนแบ็กโฮเป็นไงโดนัททอมสเตริโอแคนูวิทย์แดรี่โดนัทวิทย์แอปพริคอทเซอร์ไพรส์ไฮบริดกิฟท์อินเตอร์โซนเซอร์วิสเทียมทานโคโยตี้ม็อบเที่ยงคืนบุญคุณ - - diff --git a/tests/typ/text/lorem.typ b/tests/typ/text/lorem.typ deleted file mode 100644 index 804f804d..00000000 --- a/tests/typ/text/lorem.typ +++ /dev/null @@ -1,32 +0,0 @@ -// Test blind text. - ---- -// Test basic call. -#lorem(19) - ---- -// Test custom paragraphs with user code. -#set text(8pt) - -#{ - let sentences = lorem(59) - .split(".") - .filter(s => s != "") - .map(s => s + ".") - - let used = 0 - for s in sentences { - if used < 2 { - used += 1 - } else { - parbreak() - used = 0 - } - s.trim() - [ ] - } -} - ---- -// Error: 2-9 missing argument: words -#lorem() diff --git a/tests/typ/text/microtype.typ b/tests/typ/text/microtype.typ deleted file mode 100644 index 4c2b4d0b..00000000 --- a/tests/typ/text/microtype.typ +++ /dev/null @@ -1,23 +0,0 @@ -// Test micro-typographical shenanigans. - ---- -// Test hanging punctuation. -#set page(width: 130pt, margin: 15pt) -#set par(justify: true, linebreaks: "simple") -#set text(size: 9pt) -#rect(inset: 0pt, fill: rgb(0, 0, 0, 0), width: 100%)[ - This is a little bit of text that builds up to - hang-ing hyphens and dash---es and then, you know, - some punctuation in the margin. -] - -// Test hanging punctuation with RTL. -#set text(lang: "he", font: ("PT Sans", "Noto Serif Hebrew")) -בנייה נכונה של משפטים ארוכים דורשת ידע בשפה. אז בואו נדבר על מזג האוויר. - ---- -// Test that lone punctuation doesn't overhang into the margin. -#set page(margin: 0pt) -#set align(end) -#set text(dir: rtl) -: diff --git a/tests/typ/text/numbers.typ b/tests/typ/text/numbers.typ deleted file mode 100644 index a35798d1..00000000 --- a/tests/typ/text/numbers.typ +++ /dev/null @@ -1,110 +0,0 @@ -// Test how numbers are displayed. - ---- -// Test numbers in text mode. -12 \ -12.0 \ -3.14 \ -1234567890 \ -0123456789 \ -0 \ -0.0 \ -+0 \ -+0.0 \ --0 \ --0.0 \ --1 \ --3.14 \ --9876543210 \ --0987654321 \ -٣٫١٤ \ --٣٫١٤ \ --¾ \ -#text(fractions: true)[-3/2] \ -2022 - 2023 \ -2022 -- 2023 \ -2022--2023 \ -2022-2023 \ -٢٠٢٢ - ٢٠٢٣ \ -٢٠٢٢ -- ٢٠٢٣ \ -٢٠٢٢--٢٠٢٣ \ -٢٠٢٢-٢٠٢٣ \ --500 -- -400 - ---- -// Test integers. -#12 \ -#1234567890 \ -#0123456789 \ -#0 \ -#(-0) \ -#(-1) \ -#(-9876543210) \ -#(-0987654321) \ -#(4 - 8) - ---- -// Test floats. -#12.0 \ -#3.14 \ -#1234567890.0 \ -#0123456789.0 \ -#0.0 \ -#(-0.0) \ -#(-1.0) \ -#(-9876543210.0) \ -#(-0987654321.0) \ -#(-3.14) \ -#(4.0 - 8.0) - ---- -// Test the `str` function with integers. -#str(12) \ -#str(1234567890) \ -#str(0123456789) \ -#str(0) \ -#str(-0) \ -#str(-1) \ -#str(-9876543210) \ -#str(-0987654321) \ -#str(4 - 8) - ---- -// Test the `str` function with floats. -#str(12.0) \ -#str(3.14) \ -#str(1234567890.0) \ -#str(0123456789.0) \ -#str(0.0) \ -#str(-0.0) \ -#str(-1.0) \ -#str(-9876543210.0) \ -#str(-0987654321.0) \ -#str(-3.14) \ -#str(4.0 - 8.0) - ---- -// Test the `repr` function with integers. -#repr(12) \ -#repr(1234567890) \ -#repr(0123456789) \ -#repr(0) \ -#repr(-0) \ -#repr(-1) \ -#repr(-9876543210) \ -#repr(-0987654321) \ -#repr(4 - 8) - ---- -// Test the `repr` function with floats. -#repr(12.0) \ -#repr(3.14) \ -#repr(1234567890.0) \ -#repr(0123456789.0) \ -#repr(0.0) \ -#repr(-0.0) \ -#repr(-1.0) \ -#repr(-9876543210.0) \ -#repr(-0987654321.0) \ -#repr(-3.14) \ -#repr(4.0 - 8.0) diff --git a/tests/typ/text/quote-nesting.typ b/tests/typ/text/quote-nesting.typ deleted file mode 100644 index 381aaa56..00000000 --- a/tests/typ/text/quote-nesting.typ +++ /dev/null @@ -1,27 +0,0 @@ -// Test quote nesting. - ---- -// Test quote selection. -#set page(width: auto) -#set text(lang: "en") -=== EN -#quote[An apostroph'] \ -#quote[A #quote[nested] quote] \ -#quote[A #quote[very #quote[nested]] quote] - -#set text(lang: "de") -=== DE -#quote[Satz mit Apostroph'] \ -#quote[Satz mit #quote[Zitat]] \ -#quote[A #quote[very #quote[nested]] quote] - -#set smartquote(alternative: true) -=== DE Alternative -#quote[Satz mit Apostroph'] \ -#quote[Satz mit #quote[Zitat]] \ -#quote[A #quote[very #quote[nested]] quote] - ---- -// With custom quotes. -#set smartquote(quotes: (single: ("<", ">"), double: ("(", ")"))) -#quote[A #quote[nested] quote] diff --git a/tests/typ/text/quote.typ b/tests/typ/text/quote.typ deleted file mode 100644 index 1573438c..00000000 --- a/tests/typ/text/quote.typ +++ /dev/null @@ -1,60 +0,0 @@ -// Test the quote element. - ---- -// Text direction affects author positioning -And I quote: #quote(attribution: [René Descartes])[cogito, ergo sum]. - -#set text(lang: "ar") -#quote(attribution: [عالم])[مرحبًا] - ---- -// Text direction affects block alignment -#set quote(block: true) -#quote(attribution: [René Descartes])[cogito, ergo sum] - -#set text(lang: "ar") -#quote(attribution: [عالم])[مرحبًا] - ---- -// Spacing with other blocks -#set quote(block: true) -#set text(8pt) - -#lorem(10) -#quote(lorem(10)) -#lorem(10) - ---- -// Inline citation -#set text(8pt) -#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.] - -#set text(0pt) -#bibliography("/assets/bib/works.bib") - ---- -// Citation-format: label or numeric -#set text(8pt) -#set quote(block: true) -#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.] - -#set text(0pt) -#bibliography("/assets/bib/works.bib", style: "ieee") - ---- -// Citation-format: note -#set text(8pt) -#set quote(block: true) -#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.] - -#set text(0pt) -#bibliography("/assets/bib/works.bib", style: "chicago-notes") - ---- -// Citation-format: author-date or author -#set text(8pt) -#set quote(block: true) -#quote(attribution: <tolkien54>)[In a hole in the ground there lived a hobbit.] - -#set text(0pt) -#bibliography("/assets/bib/works.bib", style: "apa") diff --git a/tests/typ/text/quotes.typ b/tests/typ/text/quotes.typ deleted file mode 100644 index 3b4eb6ba..00000000 --- a/tests/typ/text/quotes.typ +++ /dev/null @@ -1,71 +0,0 @@ -// Test smart quotes. - ---- -#set page(width: 250pt) - -// Test simple quotations in various languages. -#set text(lang: "en") -"The horse eats no cucumber salad" was the first sentence ever uttered on the 'telephone.' - -#set text(lang: "de") -"Das Pferd frisst keinen Gurkensalat" war der erste jemals am 'Fernsprecher' gesagte Satz. - -#set text(lang: "de", region: "CH") -"Das Pferd frisst keinen Gurkensalat" war der erste jemals am 'Fernsprecher' gesagte Satz. - -#set text(lang: "es", region: none) -"El caballo no come ensalada de pepino" fue la primera frase pronunciada por 'teléfono'. - -#set text(lang: "es", region: "MX") -"El caballo no come ensalada de pepino" fue la primera frase pronunciada por 'teléfono'. - -#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") -"Hevonen ei syö kurkkusalaattia" oli ensimmäinen koskaan 'puhelimessa' lausuttu lause. - -#set text(lang: "gr") -"Το άλογο δεν τρώει αγγουροσαλάτα" ήταν η πρώτη πρόταση που ειπώθηκε στο 'τηλέφωνο'. - -#set text(lang: "he") -"הסוס לא אוכל סלט מלפפונים" היה המשפט ההראשון שנאמר ב 'טלפון'. - -#set text(lang: "ro") -"Calul nu mănâncă salată de castraveți" a fost prima propoziție rostită vreodată la 'telefon'. - -#set text(lang: "ru") -"Лошадь не ест салат из огурцов" - это была первая фраза, сказанная по 'телефону'. - ---- -// Test single pair of quotes. -"" - ---- -// Test sentences with numbers and apostrophes. -The 5'11" 'quick' brown fox jumps over the "lazy" dog's ear. - -He said "I'm a big fella." - ---- -// Test escape sequences. -The 5\'11\" 'quick\' brown fox jumps over the \"lazy" dog\'s ear. - ---- -// Test turning smart quotes off. -He's told some books contain questionable "example text". - -#set smartquote(enabled: false) -He's told some books contain questionable "example text". - ---- -// Test changing properties within text. -"She suddenly started speaking french: #text(lang: "fr")['Je suis une banane.']" Roman told me. - -Some people's thought on this would be #[#set smartquote(enabled: false); "strange."] - ---- -// Test nested double and single quotes. -"'test statement'" \ -"'test' statement" \ -"statement 'test'" diff --git a/tests/typ/text/raw-align.typ b/tests/typ/text/raw-align.typ deleted file mode 100644 index 1dbaad16..00000000 --- a/tests/typ/text/raw-align.typ +++ /dev/null @@ -1,37 +0,0 @@ -// Test the alignment of text inside of raw blocks. - ---- -// Text inside raw block should be unaffected by outer alignment by default. -#set align(center) -#set page(width: 180pt) -#set text(6pt) - -#lorem(20) - -```py -def something(x): - return x - -a = 342395823859823958329 -b = 324923 -``` - -#lorem(20) - ---- -// Text inside raw block should follow the specified alignment. -#set page(width: 180pt) -#set text(6pt) - -#lorem(20) -#align(center, raw( - lang: "typ", - block: true, - align: right, - "#let f(x) = x\n#align(center, line(length: 1em))", -)) -#lorem(20) - ---- -// Error: 17-20 expected `start`, `left`, `center`, `right`, or `end`, found top -#set raw(align: top) diff --git a/tests/typ/text/raw-code.typ b/tests/typ/text/raw-code.typ deleted file mode 100644 index 3ac72a05..00000000 --- a/tests/typ/text/raw-code.typ +++ /dev/null @@ -1,86 +0,0 @@ -// Test code highlighting. - ---- -#set page(width: 180pt) -#set text(6pt) -#show raw: it => rect( - width: 100%, - inset: (x: 4pt, y: 5pt), - radius: 4pt, - fill: rgb(239, 241, 243), - place(right, text(luma(110), it.lang)) + it, -) - -```typ -= Chapter 1 -#lorem(100) - -#let hi = "Hello World" -#show heading: emph -``` - -```rust -/// A carefully designed state machine. -#[derive(Debug)] -enum State<'a> { A(u8), B(&'a str) } - -fn advance(state: State<'_>) -> State<'_> { - unimplemented!("state machine") -} -``` - -```py -import this - -def hi(): - print("Hi!") -``` - -```cpp -#include <iostream> - -int main() { - std::cout << "Hello, world!"; -} -``` - -```julia -# Add two numbers -function add(x, y) - return x * y -end -``` - - // Try with some indent. - ```html - <!DOCTYPE html> - <html> - <head> - <meta charset="utf-8"> - </head> - <body> - <h1>Topic</h1> - <p>The Hypertext Markup Language.</p> - <script> - function foo(a, b) { - return a + b + "string"; - } - </script> - </body> - </html> - ``` - ---- -#set page(width: 180pt) -#set text(6pt) -#set raw(lang:"python") - -Inline raws, multiline e.g. `for i in range(10): - # Only this line is a comment. - print(i)` or otherwise e.g. `print(j)`, are colored properly. - -Inline raws, multiline e.g. ` -# Appears blocky due to linebreaks at the boundary. -for i in range(10): - print(i) -` or otherwise e.g. `print(j)`, are colored properly. diff --git a/tests/typ/text/raw-line.typ b/tests/typ/text/raw-line.typ deleted file mode 100644 index 19e64fac..00000000 --- a/tests/typ/text/raw-line.typ +++ /dev/null @@ -1,109 +0,0 @@ -// Test line in raw code. - ---- -#set page(width: 200pt) - -```rs -fn main() { - println!("Hello, world!"); -} -``` - -#show raw.line: it => { - box(stack( - dir: ltr, - box(width: 15pt)[#it.number], - it.body, - )) - linebreak() -} - -```rs -fn main() { - println!("Hello, world!"); -} -``` - ---- -#set page(width: 200pt) -#show raw: it => stack(dir: ttb, ..it.lines) -#show raw.line: it => { - box( - width: 100%, - height: 1.75em, - inset: 0.25em, - fill: if calc.rem(it.number, 2) == 0 { - luma(90%) - } else { - white - }, - align(horizon, stack( - dir: ltr, - box(width: 15pt)[#it.number], - it.body, - )) - ) -} - -```typ -#show raw.line: block.with( - fill: luma(60%) -); - -Hello, world! - -= A heading for good measure -``` - ---- -#set page(width: 200pt) -#show raw.line: set text(fill: red) - -```py -import numpy as np - -def f(x): - return x**2 - -x = np.linspace(0, 10, 100) -y = f(x) - -print(x) -print(y) -``` - ---- -// Ref: false - -// Test line extraction works. - -#show raw: code => { - for i in code.lines { - test(i.count, 10) - } - - test(code.lines.at(0).text, "import numpy as np") - test(code.lines.at(1).text, "") - test(code.lines.at(2).text, "def f(x):") - test(code.lines.at(3).text, " return x**2") - test(code.lines.at(4).text, "") - test(code.lines.at(5).text, "x = np.linspace(0, 10, 100)") - test(code.lines.at(6).text, "y = f(x)") - test(code.lines.at(7).text, "") - test(code.lines.at(8).text, "print(x)") - test(code.lines.at(9).text, "print(y)") - test(code.lines.at(10, default: none), none) -} - -```py -import numpy as np - -def f(x): - return x**2 - -x = np.linspace(0, 10, 100) -y = f(x) - -print(x) -print(y) -``` diff --git a/tests/typ/text/raw-syntaxes.typ b/tests/typ/text/raw-syntaxes.typ deleted file mode 100644 index e6c46924..00000000 --- a/tests/typ/text/raw-syntaxes.typ +++ /dev/null @@ -1,14 +0,0 @@ -// Test code highlighting with custom syntaxes. - ---- -#set page(width: 180pt) -#set text(6pt) -#set raw(syntaxes: "/assets/syntaxes/SExpressions.sublime-syntax") - -```sexp -(defun factorial (x) - (if (zerop x) - ; with a comment - 1 - (* x (factorial (- x 1))))) -``` diff --git a/tests/typ/text/raw-tabs.typ b/tests/typ/text/raw-tabs.typ deleted file mode 100644 index d31326c0..00000000 --- a/tests/typ/text/raw-tabs.typ +++ /dev/null @@ -1,11 +0,0 @@ -// Test tabs in raw code. - ---- -#set raw(tab-size: 8) - -```tsv -Year Month Day -2000 2 3 -2001 2 1 -2002 3 10 -``` diff --git a/tests/typ/text/raw-theme.typ b/tests/typ/text/raw-theme.typ deleted file mode 100644 index d6cda221..00000000 --- a/tests/typ/text/raw-theme.typ +++ /dev/null @@ -1,24 +0,0 @@ -// Test code highlighting with custom theme. - ---- -#set page(width: 180pt) -#set text(6pt) -#set raw(theme: "/assets/themes/halcyon.tmTheme") -#show raw: it => { - set text(fill: rgb("a2aabc")) - rect( - width: 100%, - inset: (x: 4pt, y: 5pt), - radius: 4pt, - fill: rgb("1d2433"), - place(right, text(luma(240), it.lang)) + it, - ) -} - -```typ -= Chapter 1 -#lorem(100) - -#let hi = "Hello World" -#show heading: emph -``` diff --git a/tests/typ/text/raw.typ b/tests/typ/text/raw.typ deleted file mode 100644 index 525988ec..00000000 --- a/tests/typ/text/raw.typ +++ /dev/null @@ -1,79 +0,0 @@ -// Test raw blocks. - ---- -// No extra space. -`A``B` - ---- -// Empty raw block. -Empty raw block:``. - ---- -// Typst syntax inside. -```typ #let x = 1``` \ -```typ #f(1)``` - ---- -// Multiline block splits paragraphs. - -Text -```rust -fn code() {} -``` -Text - ---- -// Lots of backticks inside. -```` -```backticks``` -```` - ---- -// Trimming. - -// Space between "rust" and "let" is trimmed. -The keyword ```rust let```. - -// Trimming depends on number backticks. -(``) \ -(` untrimmed `) \ -(``` trimmed` ```) \ -(``` trimmed ```) \ -(``` trimmed```) \ - ---- -// Single ticks should not have a language. -`rust let` - ---- -// First line is not dedented and leading space is still possible. - ``` A - B - C - ``` - ---- -// Do not take empty lines into account when computing dedent. -``` - A - - B -``` - ---- -// Take last line into account when computing dedent. -``` - A - - B - ``` - ---- -// Text show rule -#show raw: set text(font: "Roboto") -`Roboto` - ---- -// Unterminated. -// Error: 1-2:1 unclosed raw text -`endless diff --git a/tests/typ/text/shaping.typ b/tests/typ/text/shaping.typ deleted file mode 100644 index 4a2b4f1e..00000000 --- a/tests/typ/text/shaping.typ +++ /dev/null @@ -1,29 +0,0 @@ -// Test shaping quirks. - ---- -// Test separation by script. -#set text(font: ("Linux Libertine", "IBM Plex Sans Devanagari")) -ABCअपार्टमेंट - -// This is how it should look like. -अपार्टमेंट - -// This (without the spaces) is how it would look -// if we didn't separate by script. -अ पा र् ट में ट - ---- -// A forced `latn` script inhibits Devanagari font features. -#set text(font: ("Linux Libertine", "IBM Plex Sans Devanagari"), script: "latn") -ABCअपार्टमेंट - ---- -// A forced `deva` script enables Devanagari font features. -#set text(font: ("Linux Libertine", "IBM Plex Sans Devanagari"), script: "deva") -ABCअपार्टमेंट - ---- -// Test that RTL safe-to-break doesn't panic even though newline -// doesn't exist in shaping output. -#set text(dir: rtl, font: "Noto Serif Hebrew") -\ ט diff --git a/tests/typ/text/shift.typ b/tests/typ/text/shift.typ deleted file mode 100644 index 2b1b8984..00000000 --- a/tests/typ/text/shift.typ +++ /dev/null @@ -1,19 +0,0 @@ -// Test sub- and superscipt shifts. - ---- -#table( - columns: 3, - [Typo.], [Fallb.], [Synth], - [x#super[1]], [x#super[5n]], [x#super[2 #box(square(size: 6pt))]], - [x#sub[1]], [x#sub[5n]], [x#sub[2 #box(square(size: 6pt))]], -) - ---- -#set super(typographic: false, baseline: -0.25em, size: 0.7em) -n#super[1], n#sub[2], ... n#super[N] - ---- -#set underline(stroke: 0.5pt, offset: 0.15em) -#underline[The claim#super[\[4\]]] has been disputed. \ -The claim#super[#underline[\[4\]]] has been disputed. \ -It really has been#super(box(text(baseline: 0pt, underline[\[4\]]))) \ diff --git a/tests/typ/text/smartquotes.typ b/tests/typ/text/smartquotes.typ deleted file mode 100644 index da31866e..00000000 --- a/tests/typ/text/smartquotes.typ +++ /dev/null @@ -1,29 +0,0 @@ -// Test setting custom smartquotes - ---- -// Use language quotes for missing keys, allow partial reset -#set smartquote(quotes: "«»") -"Double and 'Single' Quotes" - -#set smartquote(quotes: (double: auto, single: "«»")) -"Double and 'Single' Quotes" - ---- -// Allow 2 graphemes -#set smartquote(quotes: "a\u{0301}a\u{0301}") -"Double and 'Single' Quotes" - -#set smartquote(quotes: (single: "a\u{0301}a\u{0301}")) -"Double and 'Single' Quotes" - ---- -// Error: 25-28 expected 2 characters, found 1 character -#set smartquote(quotes: "'") - ---- -// Error: 25-35 expected 2 quotes, found 4 quotes -#set smartquote(quotes: ("'",) * 4) - ---- -// Error: 25-45 expected 2 quotes, found 4 quotes -#set smartquote(quotes: (single: ("'",) * 4)) diff --git a/tests/typ/text/space.typ b/tests/typ/text/space.typ deleted file mode 100644 index 9d29f347..00000000 --- a/tests/typ/text/space.typ +++ /dev/null @@ -1,53 +0,0 @@ -// Test whitespace handling. - ---- -// Spacing around code constructs. -A#let x = 1;B #test(x, 1) \ -C #let x = 2;D #test(x, 2) \ -E#if true [F]G \ -H #if true{"I"} J \ -K #if true [L] else []M \ -#let c = true; N#while c [#(c = false)O] P \ -#let c = true; Q #while c { c = false; "R" } S \ -T#for _ in (none,) {"U"}V -#let foo = "A" ; \ -#foo;B \ -#foo; B \ -#foo ;B - ---- -// Test spacing with comments. -A/**/B/**/C \ -A /**/ B/**/C \ -A /**/B/**/ C - ---- -// Test that a run consisting only of whitespace isn't trimmed. -A#text(font: "IBM Plex Serif")[ ]B - ---- -// Test font change after space. -Left #text(font: "IBM Plex Serif")[Right]. - ---- -// Test that linebreak consumed surrounding spaces. -#align(center)[A \ B \ C] - ---- -// Test that space at start of non-backslash-linebreak line isn't trimmed. -A#"\n" B - ---- -// Test that trailing space does not force a line break. -LLLLLLLLLLLLLLLLLL R _L_ - ---- -// Test that ideographic spaces are preserved. -#set text(lang: "ja", font: "Noto Serif CJK JP") - -だろうか? 何のために! 私は、 - ---- -// Test that thin spaces are preserved. -| | U+0020 regular space \ -| | U+2009 thin space diff --git a/tests/typ/text/stroke.typ b/tests/typ/text/stroke.typ deleted file mode 100644 index 713bbe2f..00000000 --- a/tests/typ/text/stroke.typ +++ /dev/null @@ -1,21 +0,0 @@ -#set text(size: 20pt) -#set page(width: auto) -测试字体 #lorem(5) - -#text(stroke: 0.3pt + red)[测试字体#lorem(5)] - -#text(stroke: 0.5pt + red)[测试字体#lorem(5)] - -#text(stroke: 0.7pt + red)[测试字体#lorem(5)] - -#text(stroke: 1pt + red)[测试字体#lorem(5)] - -#text(stroke: 2pt + red)[测试字体#lorem(5)] - -#text(stroke: 5pt + red)[测试字体#lorem(5)] - -#text(stroke: 7pt + red)[测试字体#lorem(5)] - -#text(stroke: (paint: blue, thickness: 1pt, dash: "dashed"))[测试字体#lorem(5)] - -#text(stroke: 1pt + gradient.linear(..color.map.rainbow))[测试字体#lorem(5)] // gradient doesn't work now diff --git a/tests/typ/text/symbol.typ b/tests/typ/text/symbol.typ deleted file mode 100644 index f7179449..00000000 --- a/tests/typ/text/symbol.typ +++ /dev/null @@ -1,18 +0,0 @@ -// Test symbols. - ---- -#emoji.face -#emoji.woman.old -#emoji.turtle - -#set text(font: "New Computer Modern Math") -#sym.arrow -#sym.arrow.l -#sym.arrow.r.squiggly -#sym.arrow.tr.hook - -#sym.arrow.r;this and this#sym.arrow.l; - ---- -// Error: 13-20 unknown symbol modifier -#emoji.face.garbage diff --git a/tests/typ/text/tracking-spacing.typ b/tests/typ/text/tracking-spacing.typ deleted file mode 100644 index a89b991f..00000000 --- a/tests/typ/text/tracking-spacing.typ +++ /dev/null @@ -1,31 +0,0 @@ -// Test tracking characters apart or together. - ---- -// Test tracking. -#set text(tracking: -0.01em) -I saw Zoe yӛsterday, on the tram. - ---- -// Test tracking for only part of paragraph. -I'm in#text(tracking: 0.15em + 1.5pt)[ spaace]! - ---- -// Test that tracking doesn't disrupt mark placement. -#set text(font: ("PT Sans", "Noto Serif Hebrew")) -#set text(tracking: 0.3em) -טֶקסט - ---- -// Test tracking in arabic text (makes no sense whatsoever) -#set text(tracking: 0.3em) -النص - ---- -// Test word spacing. -#set text(spacing: 1em) -My text has spaces. - ---- -// Test word spacing relative to the font's space width. -#set text(spacing: 50% + 1pt) -This is tight. |
