summaryrefslogtreecommitdiff
path: root/tests/typ/text
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-29 13:37:25 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-29 14:18:13 +0100
commit0efe669278a5e1c3f2985eba2f3360e91159c54a (patch)
tree502712857c48f0decb5e698257c0a96d358a436e /tests/typ/text
parent836692e73cff0356e409a9ba5b4887b86809d4ca (diff)
Reorganize library and tests
Diffstat (limited to 'tests/typ/text')
-rw-r--r--tests/typ/text/bidi.typ57
-rw-r--r--tests/typ/text/case.typ12
-rw-r--r--tests/typ/text/emphasis.typ (renamed from tests/typ/text/emph-strong.typ)0
-rw-r--r--tests/typ/text/indent.typ37
-rw-r--r--tests/typ/text/justify.typ33
-rw-r--r--tests/typ/text/knuth.typ30
-rw-r--r--tests/typ/text/link.typ46
-rw-r--r--tests/typ/text/par.typ45
-rw-r--r--tests/typ/text/plain.typ20
-rw-r--r--tests/typ/text/raw-highlight.typ (renamed from tests/typ/text/code.typ)0
-rw-r--r--tests/typ/text/repeat.typ39
-rw-r--r--tests/typ/text/shift.typ (renamed from tests/typ/text/shifts.typ)0
-rw-r--r--tests/typ/text/shorthands.typ20
-rw-r--r--tests/typ/text/space.typ (renamed from tests/typ/text/whitespace.typ)0
14 files changed, 12 insertions, 327 deletions
diff --git a/tests/typ/text/bidi.typ b/tests/typ/text/bidi.typ
deleted file mode 100644
index 11c0cafa..00000000
--- a/tests/typ/text/bidi.typ
+++ /dev/null
@@ -1,57 +0,0 @@
-// Test bidirectional text and language configuration.
-
----
-// Test reordering with different top-level paragraph directions.
-#let content = par[Text טֶקסט]
-#set text("IBM Plex Serif")
-#text(lang: "he", content)
-#text(lang: "de", content)
-
----
-// Test that consecutive, embedded LTR runs stay LTR.
-// Here, we have two runs: "A" and italic "B".
-#let content = par[أنت A#emph[B]مطرC]
-#set text("IBM Plex Serif", "Noto Sans Arabic")
-#text(lang: "ar", content)
-#text(lang: "de", content)
-
----
-// Test that consecutive, embedded RTL runs stay RTL.
-// Here, we have three runs: "גֶ", bold "שֶׁ", and "ם".
-#let content = par[Aגֶ#strong[שֶׁ]םB]
-#set text("IBM Plex Serif", "Noto Serif Hebrew")
-#text(lang: "he", content)
-#text(lang: "de", content)
-
----
-// Test embedding up to level 4 with isolates.
-#set text(dir: rtl, "IBM Plex Serif")
-א\u{2066}A\u{2067}Bב\u{2069}?
-
----
-// Test hard line break (leads to two paragraphs in unicode-bidi).
-#set text(lang: "ar", "Noto Sans Arabic", "IBM Plex Serif")
-Life المطر هو الحياة \
-الحياة تمطر is rain.
-
----
-// Test spacing.
-#set text("IBM Plex Serif")
-L #h(1cm) ריווחR \
-Lריווח #h(1cm) R
-
----
-// Test inline object.
-#set text(lang: "he", "IBM Plex Serif")
-קרנפיםRh#image("/res/rhino.png", height: 11pt)inoחיים
-
----
-// Test whether L1 whitespace resetting destroys stuff.
-الغالب #h(70pt) ن{" "}ة
-
----
-// Test setting a vertical direction.
-// Ref: false
-
-// Error: 16-19 must be horizontal
-#set text(dir: ttb)
diff --git a/tests/typ/text/case.typ b/tests/typ/text/case.typ
new file mode 100644
index 00000000..75574f21
--- /dev/null
+++ b/tests/typ/text/case.typ
@@ -0,0 +1,12 @@
+// 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/emph-strong.typ b/tests/typ/text/emphasis.typ
index cd2191cc..cd2191cc 100644
--- a/tests/typ/text/emph-strong.typ
+++ b/tests/typ/text/emphasis.typ
diff --git a/tests/typ/text/indent.typ b/tests/typ/text/indent.typ
deleted file mode 100644
index 8454dda5..00000000
--- a/tests/typ/text/indent.typ
+++ /dev/null
@@ -1,37 +0,0 @@
-// Test paragraph indent.
-
----
-#set par(indent: 12pt, leading: 5pt)
-#set block(spacing: 5pt)
-#show heading: set text(size: 10pt)
-
-The first paragraph has no indent.
-
-But the second one does.
-
-#image("/res/tiger.jpg", height: 6pt)
-starts a paragraph without indent.
-
-#align(center, image("/res/rhino.png", width: 1cm))
-
-= Headings
-- And lists.
-- Have no indent.
-
- Except if you have another paragraph in them.
-
-#set text(8pt, lang: "ar", "Noto Sans Arabic", "IBM Plex Sans")
-#set par(leading: 8pt)
-
-= Arabic
-دع النص يمطر عليك
-
-ثم يصبح النص رطبًا وقابل للطرق ويبدو المستند رائعًا.
-
-
----
-// This is madness.
-#set par(indent: 12pt)
-Why would anybody ever ...
-
-... want spacing and indent?
diff --git a/tests/typ/text/justify.typ b/tests/typ/text/justify.typ
deleted file mode 100644
index e3d61322..00000000
--- a/tests/typ/text/justify.typ
+++ /dev/null
@@ -1,33 +0,0 @@
-
----
-#set page(width: 180pt)
-#set block(spacing: 5pt)
-#set par(justify: true, indent: 14pt, leading: 5pt)
-
-This text is justified, meaning that spaces are stretched so that the text
-forms a "block" with flush edges at both sides.
-
-First line indents and hyphenation play nicely with justified text.
-
----
-// Test that lines with hard breaks aren't justified.
-#set par(justify: true)
-A B C \
-D
-
----
-// Test forced justification with justified break.
-A B C #linebreak(justify: true)
-D E F #linebreak(justify: true)
-
----
-// Test that justificating chinese text is at least a bit sensible.
-#set page(width: 200pt)
-#set par(justify: true)
-中文维基百科使用汉字书写,汉字是汉族或华人的共同文字,是中国大陆、新加坡、马来西亚、台湾、香港、澳门的唯一官方文字或官方文字之一。25.9%,而美国和荷兰则分別占13.7%及8.2%。近年來,中国大陆地区的维基百科编辑者正在迅速增加;
-
----
-// Test that there are no hick-ups with justification enabled and
-// basically empty paragraph.
-#set par(justify: true)
-{""}
diff --git a/tests/typ/text/knuth.typ b/tests/typ/text/knuth.typ
deleted file mode 100644
index 59349738..00000000
--- a/tests/typ/text/knuth.typ
+++ /dev/null
@@ -1,30 +0,0 @@
-#set page(width: auto, height: auto)
-#set par(leading: 4pt, justify: true)
-#set text(family: "Latin Modern Roman")
-
-#let story = [
- In olden times when wishing still helped one, there lived a king whose
- daughters were all beautiful; and the youngest was so beautiful that the sun
- itself, which has seen so much, was astonished whenever it shone in her face.
- Close by the king’s castle lay a great dark forest, and under an old lime-tree
- in the forest was a well, and when the day was very warm, the king’s child
- went out into the forest and sat down by the side of the cool fountain; and
- when she was bored she took a golden ball, and threw it up on high and caught
- it; and this ball was her favorite plaything.
-]
-
-#let column(title, linebreaks, hyphenate) = {
- rect(width: 132pt, fill: rgb("eee"))[
- #set par(linebreaks: linebreaks)
- #set text(hyphenate: hyphenate)
- #strong(title) \ #story
- ]
-}
-
-#grid(
- columns: 3,
- gutter: 10pt,
- column([Simple without hyphens], "simple", false),
- column([Simple with hyphens], "simple", true),
- column([Optimized with hyphens], "optimized", true),
-)
diff --git a/tests/typ/text/link.typ b/tests/typ/text/link.typ
deleted file mode 100644
index 8c3e6ddd..00000000
--- a/tests/typ/text/link.typ
+++ /dev/null
@@ -1,46 +0,0 @@
-// Test hyperlinking.
-
----
-// Link syntax.
-https://example.com/
-
-// Link with body.
-#link("https://typst.org/")[Some text text text]
-
-// With line break.
-This link appears #link("https://google.com/")[in the middle of] a paragraph.
-
-// Certain prefixes are trimmed when using the `link` function.
-Contact #link("mailto:hi@typst.app") or
-call #link("tel:123") for more information.
-
----
-// Test that the period is trimmed.
-#show link: underline
-https://a.b.?q=%10#. \
-Wahttp://link \
-Nohttps:\//link \
-Nohttp\://comment
-
----
-// Styled with underline and color.
-#show link: it => underline(text(fill: rgb("283663"), it))
-You could also make the
-#link("https://html5zombo.com/")[link look way more typical.]
-
----
-// Transformed link.
-#set page(height: 60pt)
-#let mylink = link("https://typst.org/")[LINK]
-My cool #move(dx: 0.7cm, dy: 0.7cm, rotate(10deg, scale(200%, mylink)))
-
----
-// Link containing a block.
-#link("https://example.com/", block[
- My cool rhino
- #move(dx: 10pt, image("/res/rhino.png", width: 1cm))
-])
-
----
-// Link to page one.
-#link((page: 1, x: 10pt, y: 20pt))[Back to the start]
diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ
deleted file mode 100644
index 558059e9..00000000
--- a/tests/typ/text/par.typ
+++ /dev/null
@@ -1,45 +0,0 @@
-// Test configuring paragraph properties.
-
----
-// Test ragged-left.
-#set par(align: right)
-To the right! Where the sunlight peeks behind the mountain.
-
----
-// Test changing leading and spacing.
-#set block(spacing: 1em)
-#set par(leading: 2pt)
-But, soft! what light through yonder window breaks?
-
-It is the east, and Juliet is the sun.
-
----
-// Test that paragraph spacing loses against block spacing.
-// TODO
-#set block(spacing: 100pt)
-#show table: set block(above: 5pt, below: 5pt)
-Hello
-#table(columns: 4, fill: (x, y) => if odd(x + y) { silver })[A][B][C][D]
-
----
-// While we're at it, test the larger block spacing wins.
-#set block(spacing: 0pt)
-#show raw: set block(spacing: 15pt)
-#show math: set block(spacing: 7.5pt)
-#show list: set block(spacing: 2.5pt)
-
-```rust
-fn main() {}
-```
-
-- List
-
-Paragraph
-
----
-// Error: 17-20 must be horizontal
-#set par(align: top)
-
----
-// Error: 17-33 expected alignment, found 2d alignment
-#set par(align: horizon + center)
diff --git a/tests/typ/text/plain.typ b/tests/typ/text/plain.typ
deleted file mode 100644
index 34a2d626..00000000
--- a/tests/typ/text/plain.typ
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test plain text.
-
----
-#set page(width: 250pt, height: 120pt)
-
-But, soft! what light through yonder window breaks? It is the east, and Juliet
-is the sun. Arise, fair sun, and kill the envious moon, Who is already sick and
-pale with grief, That thou her maid art far more fair than she: Be not her maid,
-since she is envious; Her vestal livery is but sick and green And none but fools
-do wear it; cast it off. It is my lady, O, it is my love! O, that she knew she
-were! She speaks yet she says nothing: what of that? Her eye discourses; I will
-answer it.
-
-I am too bold, 'tis not to me she speaks: Two of the fairest stars in all the
-heaven, Having some business, do entreat her eyes To twinkle in their spheres
-till they return. What if her eyes were there, they in her head? The brightness
-of her cheek would shame those stars, As daylight doth a lamp; her eyes in
-heaven Would through the airy region stream so bright That birds would sing and
-think it were not night. See, how she leans her cheek upon her hand! O, that I
-were a glove upon that hand, That I might touch that cheek!
diff --git a/tests/typ/text/code.typ b/tests/typ/text/raw-highlight.typ
index d89f1c05..d89f1c05 100644
--- a/tests/typ/text/code.typ
+++ b/tests/typ/text/raw-highlight.typ
diff --git a/tests/typ/text/repeat.typ b/tests/typ/text/repeat.typ
deleted file mode 100644
index 13e99b51..00000000
--- a/tests/typ/text/repeat.typ
+++ /dev/null
@@ -1,39 +0,0 @@
-// Test the `repeat` function.
-
----
-// Test multiple repeats.
-#let sections = (
- ("Introduction", 1),
- ("Approach", 1),
- ("Evaluation", 3),
- ("Discussion", 15),
- ("Related Work", 16),
- ("Conclusion", 253),
-)
-
-#for section in sections [
- #section(0) #repeat[.] #section(1) \
-]
-
----
-// Test dots with RTL.
-#set text(lang: "ar")
-مقدمة #repeat[.] 15
-
----
-// Test empty repeat.
-A #repeat[] B
-
----
-// Test spaceless repeat.
-A#repeat(rect(width: 2.5em, height: 1em))B
-
----
-// Test single repeat in both directions.
-A#repeat(rect(width: 6em, height: 0.7em))B
-
-#set par(align: center)
-A#repeat(rect(width: 6em, height: 0.7em))B
-
-#set text(dir: rtl)
-ريجين#repeat(rect(width: 4em, height: 0.7em))سون
diff --git a/tests/typ/text/shifts.typ b/tests/typ/text/shift.typ
index 01a83f6e..01a83f6e 100644
--- a/tests/typ/text/shifts.typ
+++ b/tests/typ/text/shift.typ
diff --git a/tests/typ/text/shorthands.typ b/tests/typ/text/shorthands.typ
deleted file mode 100644
index 5c94dab0..00000000
--- a/tests/typ/text/shorthands.typ
+++ /dev/null
@@ -1,20 +0,0 @@
-// Test shorthands for unicode codepoints.
-
----
-The non-breaking~space does work.
-
----
-// Make sure non-breaking and normal space always
-// have the same width. Even if the font decided
-// differently.
-#set text("Latin Modern Roman")
-a b \
-a~b
-
----
-- En dash: --
-- Em dash: ---
-
----
-#set text("Roboto")
-A... vs {"A..."}
diff --git a/tests/typ/text/whitespace.typ b/tests/typ/text/space.typ
index 8dcc59e3..8dcc59e3 100644
--- a/tests/typ/text/whitespace.typ
+++ b/tests/typ/text/space.typ