summaryrefslogtreecommitdiff
path: root/tests/suite
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-09-16 16:41:18 +0200
committerGitHub <noreply@github.com>2024-09-16 14:41:18 +0000
commit16e67f8bea7e6891e954420e2e005976fb48a528 (patch)
treeb1de8e17f184d10894447a602da1722a71dd23a9 /tests/suite
parentdb71a178bef7f1525d732a190ac75a1a6d56f24b (diff)
Shrink tests (#4967)
Diffstat (limited to 'tests/suite')
-rw-r--r--tests/suite/foundations/dict.typ8
-rw-r--r--tests/suite/foundations/repr.typ121
-rw-r--r--tests/suite/introspection/counter.typ6
-rw-r--r--tests/suite/introspection/query.typ76
-rw-r--r--tests/suite/introspection/state.typ2
-rw-r--r--tests/suite/layout/container.typ6
-rw-r--r--tests/suite/layout/flow/flow.typ15
-rw-r--r--tests/suite/layout/flow/orphan.typ19
-rw-r--r--tests/suite/layout/flow/place-float.typ83
-rw-r--r--tests/suite/layout/flow/place-flush.typ29
-rw-r--r--tests/suite/layout/flow/place.typ100
-rw-r--r--tests/suite/layout/grid/grid.typ4
-rw-r--r--tests/suite/layout/grid/headers.typ6
-rw-r--r--tests/suite/layout/grid/rowspan.typ2
-rw-r--r--tests/suite/layout/inline/hyphenate.typ4
-rw-r--r--tests/suite/layout/page.typ12
-rw-r--r--tests/suite/layout/place.typ253
-rw-r--r--tests/suite/model/bibliography.typ5
-rw-r--r--tests/suite/model/cite.typ10
-rw-r--r--tests/suite/model/footnote.typ31
-rw-r--r--tests/suite/model/numbering.typ166
-rw-r--r--tests/suite/model/outline.typ60
-rw-r--r--tests/suite/model/quote.typ6
-rw-r--r--tests/suite/model/terms.typ14
-rw-r--r--tests/suite/scripting/import.typ2
-rw-r--r--tests/suite/scripting/include.typ2
-rw-r--r--tests/suite/scripting/modules/chap1.typ5
-rw-r--r--tests/suite/scripting/modules/chap2.typ9
-rw-r--r--tests/suite/styling/show.typ4
-rw-r--r--tests/suite/text/raw.typ153
-rw-r--r--tests/suite/text/smartquote.typ19
-rw-r--r--tests/suite/visualize/color.typ17
-rw-r--r--tests/suite/visualize/gradient.typ9
-rw-r--r--tests/suite/visualize/image.typ5
-rw-r--r--tests/suite/visualize/stroke.typ20
35 files changed, 546 insertions, 737 deletions
diff --git a/tests/suite/foundations/dict.typ b/tests/suite/foundations/dict.typ
index d75b9162..c1cf3f21 100644
--- a/tests/suite/foundations/dict.typ
+++ b/tests/suite/foundations/dict.typ
@@ -176,10 +176,10 @@
#let c = "value"
#let d = "conflict"
-#assert.eq(((a): b), ("hello": "world"))
-#assert.eq(((a): 1, (a): 2), ("hello": 2))
-#assert.eq((hello: 1, (a): 2), ("hello": 2))
-#assert.eq((a + b: c, (a + b): d, (a): "value2", a: "value3"), ("helloworld": "conflict", "hello": "value2", "a": "value3"))
+#test(((a): b), ("hello": "world"))
+#test(((a): 1, (a): 2), ("hello": 2))
+#test((hello: 1, (a): 2), ("hello": 2))
+#test((a + b: c, (a + b): d, (a): "value2", a: "value3"), ("helloworld": "conflict", "hello": "value2", "a": "value3"))
--- issue-1338-dictionary-underscore ---
#let foo = "foo"
diff --git a/tests/suite/foundations/repr.typ b/tests/suite/foundations/repr.typ
index 7f03209b..36823e98 100644
--- a/tests/suite/foundations/repr.typ
+++ b/tests/suite/foundations/repr.typ
@@ -1,57 +1,90 @@
--- repr ---
-#test(repr(ltr), "ltr")
-#test(repr((1, 2, false, )), "(1, 2, false)")
+#let t(a, b) = test(repr(a), b.text)
---- repr-literals ---
// Literal values.
-#auto \
-#none (empty) \
-#true \
-#false
+#t(auto, `auto`)
+#t(true, `true`)
+#t(false, `false`)
---- repr-numerical ---
// Numerical values.
-#1 \
-#1.0e-4 \
-#3.15 \
-#1e-10 \
-#50.368% \
-#0.0000012345pt \
-#4.5cm \
-#12e1pt \
-#2.5rad \
-#45deg \
-#1.7em \
-#(1cm + 0em) \
-#(2em + 10pt) \
-#(100% + (2em + 2pt)) \
-#(100% + 0pt) \
-#(100% - 2em + 2pt) \
-#(100% - 2pt) \
-#2.3fr
-
---- repr-misc ---
-// Colors and strokes.
-#set text(0.8em)
-#rgb("f7a205") \
-#(2pt + rgb("f7a205"))
+#t(12.0, `12.0`)
+#t(3.14, `3.14`)
+#t(1234567890.0, `1234567890.0`)
+#t(0123456789.0, `123456789.0`)
+#t(0.0, `0.0`)
+#t(-0.0, `-0.0`)
+#t(-1.0, `-1.0`)
+#t(-9876543210.0, `-9876543210.0`)
+#t(-0987654321.0, `-987654321.0`)
+#t(-3.14, `-3.14`)
+#t(4.0 - 8.0, `-4.0`)
+#t(float.inf, `float.inf`)
+#t(-float.inf, `-float.inf`)
+#t(float.nan, `float.nan`)
// Strings and escaping.
-#raw(repr("hi"), lang: "typc")
-#repr("a\n[]\"\u{1F680}string")
+#t("hi", `"hi"`)
+#t("a\n[]\"\u{1F680}string", `"a\n[]\"🚀string"`)
-// Content.
-#raw(lang: "typc", repr[*Hey*]) \
-#raw(lang: "typc", repr[A _sequence_]) \
-#raw(lang: "typc", repr[A _longer_ *sequence*!])
+// Array and dictionary.
+#t((1, 2, false, ), `(1, 2, false)`)
+#t((a: 1, b: "2"), `(a: 1, b: "2")`)
// Functions.
#let f(x) = x
-#f \
-#rect \
-#(() => none)
+#t(f, `f`)
+#t(rect , `rect`)
+#t(() => none, `(..) => ..`)
// Types.
-#int \
-#type("hi") \
-#type((a: 1))
+#t(int, `integer`)
+#t(type("hi"), `string`)
+#t(type((a: 1)), `dictionary`)
+
+// Constants.
+#t(ltr, `ltr`)
+#t(left, `left`)
+
+// Content.
+#t([*Hey*], `strong(body: [Hey])`)
+#t([A _sequence_], `sequence([A], [ ], emph(body: [sequence]))`)
+#t([A _longer_ *sequence*!], ```
+sequence(
+ [A],
+ [ ],
+ emph(body: [longer]),
+ [ ],
+ strong(body: [sequence]),
+ [!],
+)
+```)
+
+// Colors and strokes.
+#t(rgb("f7a205"), `rgb("#f7a205")`)
+#t(2pt + rgb("f7a205"), `2pt + rgb("#f7a205")`)
+#t(blue, `rgb("#0074d9")`)
+#t(color.linear-rgb(blue), `color.linear-rgb(0%, 17.46%, 69.39%)`)
+#t(oklab(blue), `oklab(56.22%, -0.05, -0.17)`)
+#t(oklch(blue), `oklch(56.22%, 0.177, 253.71deg)`)
+#t(cmyk(blue), `cmyk(100%, 46.54%, 0%, 14.9%)`)
+#t(color.hsl(blue), `color.hsl(207.93deg, 100%, 42.55%)`)
+#t(color.hsv(blue), `color.hsv(207.93deg, 100%, 85.1%)`)
+#t(luma(blue), `luma(45.53%)`)
+
+// Gradients.
+#t(
+ gradient.linear(blue, red),
+ `gradient.linear((rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
+)
+#t(
+ gradient.linear(blue, red, dir: ttb),
+ `gradient.linear(dir: rtl, (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
+)
+#t(
+ gradient.linear(blue, red, relative: "self", angle: 45deg),
+ `gradient.linear(angle: 45deg, relative: "self", (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
+)
+#t(
+ gradient.linear(blue, red, space: rgb, angle: 45deg),
+ `gradient.linear(angle: 45deg, space: rgb, (rgb("#0074d9"), 0%), (rgb("#ff4136"), 100%))`,
+)
diff --git a/tests/suite/introspection/counter.typ b/tests/suite/introspection/counter.typ
index 8cae32a4..e97f05dd 100644
--- a/tests/suite/introspection/counter.typ
+++ b/tests/suite/introspection/counter.typ
@@ -54,13 +54,13 @@ At Beta, it was #context {
--- counter-page ---
#set page(height: 50pt, margin: (bottom: 20pt, rest: 10pt))
-#lorem(12)
+#lines(4)
#set page(numbering: "(i)")
-#lorem(6)
+#lines(2)
#pagebreak()
#set page(numbering: "1 / 1")
#counter(page).update(1)
-#lorem(20)
+#lines(7)
--- counter-page-footer-before-set-page ---
#set page(numbering: "1", margin: (bottom: 20pt))
diff --git a/tests/suite/introspection/query.typ b/tests/suite/introspection/query.typ
index 3d71529e..b078863e 100644
--- a/tests/suite/introspection/query.typ
+++ b/tests/suite/introspection/query.typ
@@ -72,80 +72,11 @@
caption: [Tetrahedron],
)
---- query-before-after ---
-// LARGE
-#set page(
- paper: "a7",
- numbering: "1 / 1",
- margin: (bottom: 1cm, rest: 0.5cm),
-)
-
-#show heading.where(level: 1, outlined: true): it => [
- #it
-
- #set text(size: 12pt, weight: "regular")
- #outline(
- title: none,
- indent: true,
- target: heading
- .where(level: 1)
- .or(heading.where(level: 2))
- .after(it.location(), inclusive: true)
- .before(
- heading
- .where(level: 1, outlined: true)
- .after(it.location(), inclusive: false),
- inclusive: false,
- )
- )
-]
-
-#set heading(outlined: true, numbering: "1.")
-
-= Section 1
-== Subsection 1
-== Subsection 2
-=== Subsubsection 1
-=== Subsubsection 2
-== Subsection 3
-
-= Section 2
-== Subsection 1
-== Subsection 2
-
-= Section 3
-== Subsection 1
-== Subsection 2
-=== Subsubsection 1
-=== Subsubsection 2
-=== Subsubsection 3
-== Subsection 3
-
---- query-and-or ---
-#set page(
- paper: "a7",
- numbering: "1 / 1",
- margin: (bottom: 1cm, rest: 0.5cm),
-)
-
-#set heading(outlined: true, numbering: "1.")
-
-#context [
- Non-outlined elements:
- #(query(selector(heading).and(heading.where(outlined: false)))
- .map(it => it.body).join(", "))
-]
-
-#heading("A", outlined: false)
-#heading("B", outlined: true)
-#heading("C", outlined: true)
-#heading("D", outlined: false)
-
--- query-complex ---
= A
== B
#figure([Cat], kind: "cat", supplement: [Other])
-=== D
+#heading(level: 3, outlined: false)[D]
= E <first>
#figure([Frog], kind: "frog", supplement: none)
#figure([Giraffe], kind: "giraffe", supplement: none) <second>
@@ -165,6 +96,11 @@
)
#test-selector(
+ selector(heading).and(heading.where(outlined: false)),
+ ([D],)
+)
+
+#test-selector(
heading.where(level: 1).or(
heading.where(level: 3),
figure.where(kind: "frog"),
diff --git a/tests/suite/introspection/state.typ b/tests/suite/introspection/state.typ
index 208a4ea2..bb5f1a41 100644
--- a/tests/suite/introspection/state.typ
+++ b/tests/suite/introspection/state.typ
@@ -28,7 +28,7 @@ Was: #context {
#set page(width: 200pt)
#set text(8pt)
-#let ls = state("lorem", lorem(1000).split("."))
+#let ls = state("lorem", lorem(30).split(" "))
#let loremum(count) = {
context ls.get().slice(0, count).join(".").trim() + "."
ls.update(list => list.slice(count))
diff --git a/tests/suite/layout/container.typ b/tests/suite/layout/container.typ
index 2c68099a..9ce3dc7d 100644
--- a/tests/suite/layout/container.typ
+++ b/tests/suite/layout/container.typ
@@ -98,15 +98,15 @@ Paragraph
#set page(height: 100pt)
#set align(center)
-#lorem(10)
+#lines(3)
#block(width: 80%, height: 60pt, fill: aqua)
-#lorem(6)
+#lines(2)
#block(
breakable: false,
width: 100%,
inset: 4pt,
fill: aqua,
- lorem(8) + colbreak(),
+ lines(3) + colbreak(),
)
--- block-consistent-width ---
diff --git a/tests/suite/layout/flow/flow.typ b/tests/suite/layout/flow/flow.typ
index 7c8ade14..88075c5b 100644
--- a/tests/suite/layout/flow/flow.typ
+++ b/tests/suite/layout/flow/flow.typ
@@ -11,11 +11,8 @@
// the rest moved down. The reason was that the second block resulted in
// overlarge frames because the region wasn't finished properly.
#set page(height: 70pt)
-#block[This file tests a bug where an almost empty page occurs.]
-#block[
- The text in this second block was torn apart and split up for
- some reason beyond my knowledge.
-]
+#block(lines(3))
+#block(lines(5))
--- issue-flow-trailing-leading ---
// In this bug, the first part of the paragraph moved down to the second page
@@ -48,13 +45,13 @@
// This bug caused an index-out-of-bounds panic when layouting paragraphs needed
// multiple reorderings.
#set page(height: 200pt)
-#lorem(30)
+#lines(10)
#figure(placement: auto, block(height: 100%))
-#lorem(10)
+#lines(3)
-#lorem(10)
+#lines(3)
--- issue-3641-float-loop ---
// Flow layout should terminate!
@@ -64,7 +61,7 @@
#set page(height: 40pt)
= Heading
-#lorem(6)
+#lines(2)
--- issue-3355-metadata-weak-spacing ---
#set page(height: 50pt)
diff --git a/tests/suite/layout/flow/orphan.typ b/tests/suite/layout/flow/orphan.typ
index bd938d96..7674b107 100644
--- a/tests/suite/layout/flow/orphan.typ
+++ b/tests/suite/layout/flow/orphan.typ
@@ -2,38 +2,37 @@
--- flow-heading-no-orphan ---
#set page(height: 100pt)
-#lorem(12)
+#lines(4)
= Introduction
-This is the start and it goes on.
+A
--- flow-par-no-orphan-and-widow-lines ---
-// LARGE
-#set page("a8", height: 140pt)
+#set page(width: 60pt, height: 140pt)
#set text(weight: 700)
// Fits fully onto the first page.
#set text(blue)
-#lorem(27)
+#lines(8)
// The first line would fit, but is moved to the second page.
-#lorem(20)
+#lines(6, "1")
// The second-to-last line is moved to the third page so that the last is isn't
// as lonely.
#set text(maroon)
-#lorem(11)
+#lines(4)
-#lorem(13)
+#lines(4, "1")
// All three lines go to the next page.
#set text(olive)
-#lorem(10)
+#lines(3)
--- flow-widow-forced ---
// Ensure that a widow is allowed when the three lines don't all fit.
#set page(height: 50pt)
-#lorem(10)
+#lines(3)
--- issue-1445-widow-orphan-unnecessary-skip ---
// Ensure that widow/orphan prevention doesn't unnecessarily move things
diff --git a/tests/suite/layout/flow/place-float.typ b/tests/suite/layout/flow/place-float.typ
new file mode 100644
index 00000000..50a8a112
--- /dev/null
+++ b/tests/suite/layout/flow/place-float.typ
@@ -0,0 +1,83 @@
+--- place-float-flow-around ---
+#set page(height: 80pt)
+#set place(float: true)
+#place(bottom + center, rect(height: 20pt))
+#lines(4)
+
+--- place-float-queued ---
+#set page(height: 180pt)
+#set figure(placement: auto)
+
+#figure(rect(height: 60pt), caption: [I])
+#figure(rect(height: 40pt), caption: [II])
+#figure(rect(), caption: [III])
+#figure(rect(), caption: [IV])
+A
+
+--- place-float-align-auto ---
+#set page(height: 140pt)
+#set place(clearance: 5pt)
+#set place(auto, float: true)
+
+#place(rect[A])
+#place(rect[B])
+1 \ 2
+#place(rect[C])
+#place(rect[D])
+
+--- place-float-in-column-align-auto ---
+#set page(height: 150pt, columns: 2)
+#set place(auto, float: true, clearance: 10pt)
+#set rect(width: 75%)
+
+#place(rect[I])
+#place(rect[II])
+#place(rect[III])
+#place(rect[IV])
+
+#lines(6)
+
+#place(rect[V])
+
+--- place-float-in-column-queued ---
+#set page(height: 100pt, columns: 2)
+#set place(float: true, clearance: 10pt)
+#set rect(width: 75%)
+#set text(costs: (widow: 0%, orphan: 0%))
+
+#lines(3)
+
+#place(top, rect[I])
+#place(top, rect[II])
+#place(bottom, rect[III])
+
+#lines(3)
+
+--- place-float-missing ---
+// Error: 2-20 automatic positioning is only available for floating placement
+// Hint: 2-20 you can enable floating placement with `place(float: true, ..)`
+#place(auto)[Hello]
+
+--- place-float-center-horizon ---
+// Error: 2-45 floating placement must be `auto`, `top`, or `bottom`
+#place(center + horizon, float: true)[Hello]
+
+--- place-float-horizon ---
+// Error: 2-36 floating placement must be `auto`, `top`, or `bottom`
+#place(horizon, float: true)[Hello]
+
+--- place-float-default ---
+// Error: 2-27 floating placement must be `auto`, `top`, or `bottom`
+#place(float: true)[Hello]
+
+--- place-float-right ---
+// Error: 2-34 floating placement must be `auto`, `top`, or `bottom`
+#place(right, float: true)[Hello]
+
+--- issue-2595-float-overlap ---
+#set page(height: 80pt)
+
+1
+#place(auto, float: true, block(height: 100%, width: 100%, fill: aqua))
+#place(auto, float: true, block(height: 100%, width: 100%, fill: red))
+#lines(7)
diff --git a/tests/suite/layout/flow/place-flush.typ b/tests/suite/layout/flow/place-flush.typ
new file mode 100644
index 00000000..8f55a6fd
--- /dev/null
+++ b/tests/suite/layout/flow/place-flush.typ
@@ -0,0 +1,29 @@
+--- place-flush ---
+#set page(height: 120pt)
+#let floater(align, height) = place(
+ align,
+ float: true,
+ rect(width: 100%, height: height),
+)
+
+#floater(top, 30pt)
+A
+
+#floater(bottom, 50pt)
+#place.flush()
+B // Should be on the second page.
+
+--- place-flush-figure ---
+#set page(height: 120pt)
+#let floater(align, height, caption) = figure(
+ placement: align,
+ caption: caption,
+ rect(width: 100%, height: height),
+)
+
+#floater(top, 30pt)[I]
+A
+
+#floater(bottom, 50pt)[II]
+#place.flush()
+B // Should be on the second page.
diff --git a/tests/suite/layout/flow/place.typ b/tests/suite/layout/flow/place.typ
new file mode 100644
index 00000000..f3231735
--- /dev/null
+++ b/tests/suite/layout/flow/place.typ
@@ -0,0 +1,100 @@
+// Test the `place` function.
+
+--- place-basic ---
+#set page("a8")
+#place(bottom + center)[E]
+
+= A
+#place(right, rect(width: 1.8cm))
+#lines(5)
+
+#stack(
+ rect(fill: eastern, height: 10pt, width: 100%),
+ place(right, dy: 1.5pt)[ABC],
+ rect(fill: conifer, height: 10pt, width: 80%),
+ rect(fill: forest, height: 10pt, width: 100%),
+ 10pt,
+ block[
+ #place(center, dx: -7pt, dy: -5pt)[A]
+ #place(center, dx: 7pt, dy: 5pt)[B]
+ C #h(1fr) D
+ ]
+)
+
+--- place-block-spacing ---
+// Test how the placed element interacts with paragraph spacing around it.
+#set page("a8", height: 60pt)
+
+First
+
+#place(bottom + right)[Placed]
+
+Second
+
+--- place-bottom-in-box ---
+#box(
+ fill: aqua,
+ width: 30pt,
+ height: 30pt,
+ place(bottom,
+ place(line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 3pt))
+ )
+)
+
+--- place-horizon-in-boxes ---
+#box(
+ fill: aqua,
+ width: 30pt,
+ height: 30pt,
+ {
+ box(fill: yellow, {
+ [Hello]
+ place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 2pt))
+ })
+ place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: green + 3pt))
+ }
+)
+
+--- place-bottom-right-in-box ---
+#box(fill: aqua)[
+ #place(bottom + right)[Hi]
+ Hello World \
+ How are \
+ you?
+]
+
+--- place-top-left-in-box ---
+#box(fill: aqua)[
+ #place(top + left, dx: 50%, dy: 50%)[Hi]
+ #v(30pt)
+ #line(length: 50pt)
+]
+
+--- issue-place-base ---
+// Test that placement is relative to container and not itself.
+#set page(height: 80pt, margin: 0pt)
+#place(right, dx: -70%, dy: 20%, [First])
+#place(left, dx: 20%, dy: 60%, [Second])
+#place(center + horizon, dx: 25%, dy: 25%, [Third])
+
+--- issue-1368-place-pagebreak ---
+// Test placing on an already full page.
+// It shouldn't result in a page break.
+#set page(height: 40pt)
+#block(height: 100%)
+#place(bottom + right)[Hello world]
+
+--- issue-2199-place-spacing-bottom ---
+// Test that placed elements don't add extra block spacing.
+#show figure: set block(spacing: 4em)
+
+Paragraph before float.
+#figure(rect(), placement: bottom)
+Paragraph after float.
+
+--- issue-2199-place-spacing-default ---
+#show place: set block(spacing: 4em)
+
+Paragraph before place.
+#place(rect())
+Paragraph after place.
diff --git a/tests/suite/layout/grid/grid.typ b/tests/suite/layout/grid/grid.typ
index d35adca5..e56299e7 100644
--- a/tests/suite/layout/grid/grid.typ
+++ b/tests/suite/layout/grid/grid.typ
@@ -247,8 +247,8 @@
--- issue-grid-skip-list ---
#set page(height: 60pt)
-#lorem(5)
-- #lorem(5)
+#lines(2)
+- #lines(2)
--- issue-grid-double-skip ---
// Ensure that the list does not jump to the third page.
diff --git a/tests/suite/layout/grid/headers.typ b/tests/suite/layout/grid/headers.typ
index c3b92997..cb263376 100644
--- a/tests/suite/layout/grid/headers.typ
+++ b/tests/suite/layout/grid/headers.typ
@@ -186,7 +186,7 @@
[*Hello*],
[*World*]
),
- table.cell(rowspan: 3, lorem(40))
+ table.cell(rowspan: 3, lines(15))
)
--- grid-header-and-rowspan-non-contiguous-2 ---
@@ -201,7 +201,7 @@
[*Hello*],
[*World*]
),
- table.cell(rowspan: 3, lorem(40))
+ table.cell(rowspan: 3, lines(15))
)
--- grid-header-and-rowspan-non-contiguous-3 ---
@@ -215,7 +215,7 @@
[*Hello*],
[*World*]
),
- table.cell(rowspan: 3, lorem(40))
+ table.cell(rowspan: 3, lines(15))
)
--- grid-header-lack-of-space ---
diff --git a/tests/suite/layout/grid/rowspan.typ b/tests/suite/layout/grid/rowspan.typ
index e5c8bbc8..88aa34c6 100644
--- a/tests/suite/layout/grid/rowspan.typ
+++ b/tests/suite/layout/grid/rowspan.typ
@@ -194,7 +194,7 @@
--- grid-rowspan-unbreakable-2 ---
// Test cell breakability
#show grid.cell: it => {
- assert.eq(it.breakable, (it.x, it.y) != (0, 6) and (it.y in (2, 5, 6) or (it.x, it.y) in ((0, 1), (2, 3), (1, 7))))
+ test(it.breakable, (it.x, it.y) != (0, 6) and (it.y in (2, 5, 6) or (it.x, it.y) in ((0, 1), (2, 3), (1, 7))))
it.breakable
}
#grid(
diff --git a/tests/suite/layout/inline/hyphenate.typ b/tests/suite/layout/inline/hyphenate.typ
index debce1da..2324ba64 100644
--- a/tests/suite/layout/inline/hyphenate.typ
+++ b/tests/suite/layout/inline/hyphenate.typ
@@ -164,6 +164,4 @@ el objetivo de protegerle de las patrullas de milicianos.
--- costs-access ---
#set text(costs: (hyphenation: 1%, runt: 2%))
#set text(costs: (widow: 3%))
-#context {
- assert.eq(text.costs, (hyphenation: 1%, runt: 2%, widow: 3%, orphan: 100%))
-}
+#context test(text.costs, (hyphenation: 1%, runt: 2%, widow: 3%, orphan: 100%))
diff --git a/tests/suite/layout/page.typ b/tests/suite/layout/page.typ
index a4abaec7..b9f41269 100644
--- a/tests/suite/layout/page.typ
+++ b/tests/suite/layout/page.typ
@@ -152,16 +152,10 @@
}
)
-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.
+#align(center, lines(20))
#set page(header: none, height: auto, margin: (top: 15pt, bottom: 25pt))
-The END.
+Z
--- page-number-align-top-right ---
#set page(
@@ -189,7 +183,7 @@ The END.
--- page-numbering-pdf-label ---
#set page(margin: (bottom: 20pt, rest: 10pt))
-#let filler = lorem(20)
+#let filler = lines(7)
// (i) - (ii). No style opt. because of suffix.
#set page(numbering: "(i)")
diff --git a/tests/suite/layout/place.typ b/tests/suite/layout/place.typ
deleted file mode 100644
index c29d2ddd..00000000
--- a/tests/suite/layout/place.typ
+++ /dev/null
@@ -1,253 +0,0 @@
-// Test the `place` function.
-
---- place-basic ---
-#set page("a8")
-#place(bottom + center)[© Typst]
-
-= Placement
-#place(right, image("/assets/images/tiger.jpg", width: 1.8cm))
-Hi there. This is \
-a placed element. \
-Unfortunately, \
-the line breaks still had to be inserted manually.
-
-#stack(
- rect(fill: eastern, height: 10pt, width: 100%),
- place(right, dy: 1.5pt)[ABC],
- rect(fill: conifer, height: 10pt, width: 80%),
- rect(fill: forest, height: 10pt, width: 100%),
- 10pt,
- block[
- #place(center, dx: -7pt, dy: -5pt)[Hello]
- #place(center, dx: 7pt, dy: 5pt)[Hello]
- Hello #h(1fr) Hello
- ]
-)
-
---- place-block-spacing ---
-// Test how the placed element interacts with paragraph spacing around it.
-#set page("a8", height: 60pt)
-
-First
-
-#place(bottom + right)[Placed]
-
-Second
-
---- place-background ---
-#set page(paper: "a10", flipped: true)
-#set text(fill: white)
-#place(
- dx: -10pt,
- dy: -10pt,
- image(
- "/assets/images/tiger.jpg",
- fit: "cover",
- width: 100% + 20pt,
- height: 100% + 20pt,
- )
-)
-#align(bottom + right)[
- _Welcome to_ #underline[*Tigerland*]
-]
-
---- place-float ---
-#set page(height: 140pt)
-#set place(clearance: 5pt)
-#place(auto, float: true, rect[A])
-#place(auto, float: true, rect[B])
-#lorem(6)
-#place(auto, float: true, rect[C])
-#place(auto, float: true, rect[D])
-
---- place-float-missing ---
-// Error: 2-20 automatic positioning is only available for floating placement
-// Hint: 2-20 you can enable floating placement with `place(float: true, ..)`
-#place(auto)[Hello]
-
---- place-float-center-horizon ---
-// Error: 2-45 floating placement must be `auto`, `top`, or `bottom`
-#place(center + horizon, float: true)[Hello]
-
---- place-float-horizon ---
-// Error: 2-36 floating placement must be `auto`, `top`, or `bottom`
-#place(horizon, float: true)[Hello]
-
---- place-float-default ---
-// Error: 2-27 floating placement must be `auto`, `top`, or `bottom`
-#place(float: true)[Hello]
-
---- place-float-right ---
-// Error: 2-34 floating placement must be `auto`, `top`, or `bottom`
-#place(right, float: true)[Hello]
-
---- place-float-columns ---
-// LARGE
-#set page(height: 200pt, width: 300pt)
-#show: columns.with(2)
-
-= Introduction
-#figure(
- placement: bottom,
- caption: [A glacier],
- image("/assets/images/glacier.jpg", width: 50%),
-)
-#lorem(45)
-#figure(
- placement: top,
- caption: [A rectangle],
- rect[Hello!],
-)
-#lorem(20)
-
---- place-float-figure ---
-// LARGE
-#set page(height: 250pt, width: 150pt)
-
-= Introduction
-#lorem(10) #footnote[Lots of Latin]
-
-#figure(
- placement: bottom,
- caption: [A glacier #footnote[Lots of Ice]],
- image("/assets/images/glacier.jpg", width: 80%),
-)
-
-#lorem(40)
-
-#figure(
- placement: top,
- caption: [An important],
- image("/assets/images/diagram.svg", width: 80%),
-)
-
---- place-float-flush ---
-#set page(height: 150pt, width: 150pt)
-
-#let floater = place(auto, float: true, rect(width: 100%, height: 90pt, text(size: 24pt)[I float!]))
-
-Some introductory text.
-
-#floater #floater #floater #floater
-
-Some additional text.
-
-#place.flush()
-
-Some conclusive text. // Should appear after all the floating figures
-
---- place-figure-flush ---
-
-#set page(height: 165pt, width: 150pt)
-
-Some introductory text: #lorem(15)
-
-#figure(placement: auto, caption: [A self-describing figure], rect(width: 100%, height: 64pt, [I float with a caption!]))
-
-#place.flush()
-
-Some conclusive text that must occur after the figure.
-
---- place-bottom-in-box ---
-#box(
- fill: aqua,
- width: 30pt,
- height: 30pt,
- place(bottom,
- place(line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 3pt))
- )
-)
-
---- place-horizon-in-boxes ---
-#box(
- fill: aqua,
- width: 30pt,
- height: 30pt,
- {
- box(fill: yellow, {
- [Hello]
- place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: red + 2pt))
- })
- place(horizon, line(start: (0pt, 0pt), end: (20pt, 0pt), stroke: green + 3pt))
- }
-)
-
---- place-bottom-right-in-box ---
-#box(fill: aqua)[
- #place(bottom + right)[Hi]
- Hello World \
- How are \
- you?
-]
-
---- place-top-left-in-box ---
-#box(fill: aqua)[
- #place(top + left, dx: 50%, dy: 50%)[Hi]
- #v(30pt)
- #line(length: 50pt)
-]
-
---- issue-place-base ---
-// Test that placement is relative to container and not itself.
-#set page(height: 80pt, margin: 0pt)
-#place(right, dx: -70%, dy: 20%, [First])
-#place(left, dx: 20%, dy: 60%, [Second])
-#place(center + horizon, dx: 25%, dy: 25%, [Third])
-
---- issue-1368-place-pagebreak ---
-// Test placing on an already full page.
-// It shouldn't result in a page break.
-#set page(height: 40pt)
-#block(height: 100%)
-#place(bottom + right)[Hello world]
-
---- issue-2199-place-spacing-bottom ---
-// Test that placed elements don't add extra block spacing.
-#show figure: set block(spacing: 4em)
-
-Paragraph before float.
-#figure(rect(), placement: bottom)
-Paragraph after float.
-
---- issue-2199-place-spacing-default ---
-#show place: set block(spacing: 4em)
-
-Paragraph before place.
-#place(rect())
-Paragraph after place.
-
---- issue-2595-float-overlap ---
-#set page(height: 80pt)
-
-Start.
-
-#place(auto, float: true, [
- #block(height: 100%, width: 100%, fill: aqua)
-])
-
-#place(auto, float: true, [
- #block(height: 100%, width: 100%, fill: red)
-])
-
-#lorem(20)
-
---- issue-2715-float-order ---
-#set page(height: 180pt)
-#set figure(placement: auto)
-
-#figure(
- rect(height: 60pt),
- caption: [Rectangle I],
-)
-
-#figure(
- rect(height: 50pt),
- caption: [Rectangle II],
-)
-
-#figure(
- circle(),
- caption: [Circle],
-)
-
-#lorem(20)
diff --git a/tests/suite/model/bibliography.typ b/tests/suite/model/bibliography.typ
index 18c62620..20eb8acd 100644
--- a/tests/suite/model/bibliography.typ
+++ b/tests/suite/model/bibliography.typ
@@ -44,9 +44,8 @@ Now we have multiple bibliographies containing @glacier-melt @keshav2007read
#bibliography("/assets/bib/works.bib")
--- bibliography-full ---
-// LARGE
-#set page(paper: "a6", height: 170mm)
-#bibliography("/assets/bib/works.bib", full: true)
+#set page(paper: "a6", height: auto)
+#bibliography("/assets/bib/works_too.bib", full: true)
--- bibliography-math ---
#set page(width: 200pt)
diff --git a/tests/suite/model/cite.typ b/tests/suite/model/cite.typ
index 750db38b..ffbd3b52 100644
--- a/tests/suite/model/cite.typ
+++ b/tests/suite/model/cite.typ
@@ -52,10 +52,10 @@ A @netwok @arrgh @quark, B.
--- issue-785-cite-locate ---
// Test citation in other introspection.
#set page(width: 180pt)
-#set heading(numbering: "1")
+#set heading(numbering: "1.")
#outline(
- title: [List of Figures],
+ title: [Figures],
target: figure.where(kind: image),
)
@@ -63,20 +63,20 @@ A @netwok @arrgh @quark, B.
= Introduction <intro>
#figure(
- rect[-- PIRATE --],
+ rect(height: 10pt),
caption: [A pirate @arrgh in @intro],
)
#context [Citation @distress on page #here().page()]
-#pagebreak()
+#show bibliography: none
#bibliography("/assets/bib/works.bib", style: "chicago-notes")
--- issue-1597-cite-footnote ---
// Tests that when a citation footnote is pushed to next page, things still
// work as expected.
#set page(height: 60pt)
-#lorem(4)
+A
#footnote[@netwok]
#show bibliography: none
diff --git a/tests/suite/model/footnote.typ b/tests/suite/model/footnote.typ
index 99372551..41091228 100644
--- a/tests/suite/model/footnote.typ
+++ b/tests/suite/model/footnote.typ
@@ -34,28 +34,31 @@ Fourth
Beautiful footnotes. #footnote[Wonderful, aren't they?]
--- footnote-break-across-pages ---
-// LARGE
#set page(height: 200pt)
-#lorem(5)
+#lines(2)
#footnote[ // 1
- A simple footnote.
- #footnote[Well, not that simple ...] // 2
+ I
+ #footnote[II ...] // 2
]
-#lorem(15)
-#footnote[Another footnote: #lorem(30)] // 3
-#lorem(15)
-#footnote[My fourth footnote: #lorem(50)] // 4
-#lorem(15)
-#footnote[And a final footnote.] // 5
+#lines(6)
+#footnote[III: #lines(8, "1")] // 3
+#lines(6)
+#footnote[IV: #lines(15, "1")] // 4
+#lines(6)
+#footnote[V] // 5
--- footnote-in-columns ---
// Test footnotes in columns, even those that are not enabled via `set page`.
#set page(height: 120pt)
#align(center, strong[Title])
+
#show: columns.with(2)
-#lorem(3) #footnote(lorem(6))
-Hello there #footnote(lorem(2))
+#lines(3)
+#footnote(lines(4, "1"))
+
+#lines(2)
+#footnote(lines(2, "1"))
--- footnote-in-caption ---
// Test footnote in caption.
@@ -93,9 +96,9 @@ More #footnote[just for ...] footnotes #footnote[... testing. :)]
// always end up on the same page.
#set page(height: 120pt)
-#lorem(13)
+#lines(5)
-There #footnote(lorem(20))
+A #footnote(lines(6, "1"))
--- footnote-ref ---
// Test references to footnotes.
diff --git a/tests/suite/model/numbering.typ b/tests/suite/model/numbering.typ
index 55c24f65..93c9e1b3 100644
--- a/tests/suite/model/numbering.typ
+++ b/tests/suite/model/numbering.typ
@@ -1,120 +1,58 @@
// Test integrated numbering patterns.
---- numbering-symbol-and-roman ---
-#for i in range(0, 9) {
- numbering("*", i)
- [ and ]
- numbering("I.a", i, i)
- [ for #i \ ]
-}
-
---- numbering-latin ---
-#for i in range(0, 4) {
- numbering("A", i)
- [ for #i \ ]
-}
-... \
-#for i in range(26, 30) {
- numbering("A", i)
- [ for #i \ ]
-}
-... \
-#for i in range(702, 706) {
- numbering("A", i)
- [ for #i \ ]
-}
-
---- numbering-hebrew ---
-#set text(lang: "he")
-#for i in range(9, 21, step: 2) {
- numbering("א.", i)
- [ עבור #i \ ]
-}
-
---- numbering-chinese ---
-#set text(lang: "zh", font: ("Linux Libertine", "Noto Serif CJK SC"))
-#for i in range(9, 21, step: 2){
- numbering("一", i)
- [ and ]
- numbering("壹", i)
- [ for #i \ ]
-}
-
---- numbering-japanese-iroha ---
-#set text(lang: "ja", font: ("Linux Libertine", "Noto Serif CJK JP"))
-#for i in range(0, 4) {
- numbering("イ", i)
- [ (or ]
- numbering("い", i)
- [) for #i \ ]
-}
-... \
-#for i in range(47, 51) {
- numbering("イ", i)
- [ (or ]
- numbering("い", i)
- [) for #i \ ]
-}
-... \
-#for i in range(2256, 2260) {
- numbering("イ", i)
- [ for #i \ ]
-}
-
---- numbering-korean ---
-#set text(lang: "ko", font: ("Linux Libertine", "Noto Serif CJK KR"))
-#for i in range(0, 4) {
- numbering("가", i)
- [ (or ]
- numbering("ㄱ", i)
- [) for #i \ ]
-}
-... \
-#for i in range(47, 51) {
- numbering("가", i)
- [ (or ]
- numbering("ㄱ", i)
- [) for #i \ ]
-}
-... \
-#for i in range(2256, 2260) {
- numbering("ㄱ", i)
- [ for #i \ ]
-}
-
---- numbering-japanese-aiueo ---
-#set text(lang: "jp", font: ("Linux Libertine", "Noto Serif CJK JP"))
-#for i in range(0, 9) {
- numbering("あ", i)
- [ and ]
- numbering("I.あ", i, i)
- [ for #i \ ]
-}
-
-#for i in range(0, 9) {
- numbering("ア", i)
- [ and ]
- numbering("I.ア", i, i)
- [ for #i \ ]
-}
-
---- numbering-arabic-indic ---
-#assert.eq(numbering("\u{0661}", 1475), "١٤٧٥")
-#assert.eq(numbering("\u{06F1}", 1475), "۱۴۷۵")
-
---- numbering-devanagari-number ---
-#assert.eq(numbering("\u{0967}", 1), "१")
-#assert.eq(numbering("\u{0967}", 10), "१०")
-#assert.eq(numbering("\u{0967}", 123456789), "१२३४५६७८९")
+--- numbering ---
+#let t(pat: "1", step: 1, ..vals) = {
+ let num = 0
+ for val in vals.pos() {
+ if type(val) == int {
+ num = val
+ } else {
+ test(numbering(pat, num), val)
+ num += step
+ }
+ }
+}
+
+// Arabic.
+#t(pat: "1", "0", "1", "2", "3", "4", "5", "6", 107, "107", "108")
+
+// Symbols.
+#t(pat: "*", "-", "*", "†", "‡", "§", "¶", "‖", "**")
+
+// Hebrew.
+#t(pat: "א", step: 2, 9, "ט׳", "י״א", "י״ג")
+
+// Chinese.
+#t(pat: "一", step: 2, 9, "九", "十一", "十三", "十五", "十七", "十九")
+#t(pat: "壹", step: 2, 9, "玖", "拾壹", "拾叁", "拾伍", "拾柒", "拾玖")
+
+// Japanese.
+#t(pat: "イ", "-", "イ", "ロ", "ハ", 47, "ス", "イイ", "イロ", "イハ", 2256, "スス", "イイイ")
+#t(pat: "い", "-", "い", "ろ", "は", 47, "す", "いい", "いろ", "いは")
+#t(pat: "あ", "-", "あ", "い", "う", "え", "お", "か", "き", "く")
+#t(pat: "ア", "-", "ア", "イ", "ウ", "エ", "オ", "カ", "キ", "ク")
+
+// Korean.
+#t(pat: "가", "-", "가", "나", "다", 47, "다마", "다바", "다사", "다아")
+#t(pat: "ㄱ", "-", "ㄱ", "ㄴ", "ㄷ", 47, "ㄷㅁ")
+
+// Arabic Indic.
+#t(pat: "\u{0661}", 1475, "١٤٧٥")
+#t(pat: "\u{06F1}", 1475, "۱۴۷۵")
+
+// Devanagari.
+#t(pat: "\u{0967}", 1, "१")
+#t(pat: "\u{0967}", 10, "१०")
+#t(pat: "\u{0967}", 123456789, "१२३४५६७८९")
+
+// Circled number.
+#t(pat: "①", 1, "①")
+#t(pat: "①", 50, "㊿")
+
+// Double-circled number.
+#t(pat: "⓵", 1, "⓵")
+#t(pat: "⓵", 10, "⓾")
--- numbering-negative ---
// Error: 17-19 number must be at least zero
#numbering("1", -1)
-
---- numbering-circled-number ---
-#assert.eq(numbering("①", 1), "①")
-#assert.eq(numbering("①", 50), "㊿")
-
---- numbering-double-circled-number ---
-#assert.eq(numbering("⓵", 1), "⓵")
-#assert.eq(numbering("⓵", 10), "⓾")
diff --git a/tests/suite/model/outline.typ b/tests/suite/model/outline.typ
index 2409dbbe..3c134760 100644
--- a/tests/suite/model/outline.typ
+++ b/tests/suite/model/outline.typ
@@ -1,53 +1,41 @@
--- outline ---
-// LARGE
-#set page("a7", margin: 20pt, numbering: "1")
+#set page(height: 200pt, margin: (bottom: 20pt), numbering: "1")
#set heading(numbering: "(1/a)")
#show heading.where(level: 1): set text(12pt)
#show heading.where(level: 2): set text(10pt)
-#set math.equation(numbering: "1")
-#outline()
-#outline(title: [Figures], target: figure)
-#outline(title: [Equations], target: math.equation)
-
-= Introduction
-#lorem(12)
+#outline(fill: none)
-= Analysis
-#lorem(10)
+= A
+= B
+#lines(3)
+// This heading is right at the start of the page, so that we can test
+// whether the tag migrates properly.
#[
#set heading(outlined: false)
- == Methodology
- #lorem(6)
+ == C
]
-== Math
-$x$ is a very useful constant. See it in action:
-$ x = x $
+A
-== Interesting figures
-#figure(rect[CENSORED], kind: image, caption: [A picture showing a programmer at work.])
-#figure(table[1x1], caption: [A very small table.])
+== D
+== F
+==== G
-== Programming
-```rust
-fn main() {
- panic!("in the disco");
-}
-```
+--- outline-styled-text ---
+#outline(title: none)
+
+= #text(blue)[He]llo
-==== Deep Stuff
-Ok ...
+--- outline-bookmark ---
+#outline(title: none, fill: none)
// Ensure 'bookmarked' option doesn't affect the outline
#set heading(numbering: "(I)", bookmarked: false)
-
-= #text(blue)[Sum]mary
-#lorem(10)
+= A
--- outline-indent-numbering ---
-// LARGE
// With heading numbering
#set page(width: 200pt)
#set heading(numbering: "1.a.")
@@ -62,11 +50,11 @@ Ok ...
#outline(indent: 2em)
#outline(indent: n => ([-], [], [==], [====]).at(n))
-= About ACME Corp.
-== History
-== Products
-=== Categories
-==== General
+= A
+== B
+== C
+=== D
+==== E
--- outline-indent-no-numbering ---
// Without heading numbering
diff --git a/tests/suite/model/quote.typ b/tests/suite/model/quote.typ
index d71eeeab..2c93f92c 100644
--- a/tests/suite/model/quote.typ
+++ b/tests/suite/model/quote.typ
@@ -20,9 +20,9 @@ And I quote: #quote(attribution: [René Descartes])[cogito, ergo sum].
#set quote(block: true)
#set text(8pt)
-#lorem(10)
-#quote(lorem(10))
-#lorem(10)
+#lines(3)
+#quote(lines(3))
+#lines(3)
--- quote-inline ---
// Inline citation
diff --git a/tests/suite/model/terms.typ b/tests/suite/model/terms.typ
index 6a08b923..07aa827d 100644
--- a/tests/suite/model/terms.typ
+++ b/tests/suite/model/terms.typ
@@ -60,17 +60,17 @@ Not in list
/ Hello
--- issue-1050-terms-indent ---
-#set page(width: 200pt)
+#set page(width: 110pt)
#set par(first-line-indent: 0.5cm)
-- #lorem(10)
-- #lorem(10)
+- #lorem(5)
+- #lorem(5)
-+ #lorem(10)
-+ #lorem(10)
++ #lorem(5)
++ #lorem(5)
-/ Term 1: #lorem(10)
-/ Term 2: #lorem(10)
+/ S: #lorem(5)
+/ XXXL: #lorem(5)
--- issue-2530-term-item-panic ---
// Term item (pre-emptive)
diff --git a/tests/suite/scripting/import.typ b/tests/suite/scripting/import.typ
index 8e2bc4b5..95214db7 100644
--- a/tests/suite/scripting/import.typ
+++ b/tests/suite/scripting/import.typ
@@ -52,7 +52,7 @@
#import "module.typ": chap2, chap2.name, chap2.chap1, chap2.chap1.name as othername
#test(chap2, orig-chap2)
#test(chap1, orig-chap1)
-#test(name, "Klaus")
+#test(name, "Peter")
#test(othername, "Klaus")
--- import-items-parenthesized ---
diff --git a/tests/suite/scripting/include.typ b/tests/suite/scripting/include.typ
index e4da6d19..f5c4a5ba 100644
--- a/tests/suite/scripting/include.typ
+++ b/tests/suite/scripting/include.typ
@@ -3,8 +3,6 @@
--- include-file ---
#set page(width: 200pt)
-= Document
-
// Include a file
#include "modules/chap1.typ"
diff --git a/tests/suite/scripting/modules/chap1.typ b/tests/suite/scripting/modules/chap1.typ
index 13d0acf8..c5dc1cf6 100644
--- a/tests/suite/scripting/modules/chap1.typ
+++ b/tests/suite/scripting/modules/chap1.typ
@@ -2,7 +2,4 @@
#let name = "Klaus"
== Chapter 1
-#name stood in a field of wheat. There was nothing of particular interest about
-the field #name just casually surveyed for any paths on which the corn would not
-totally ruin his semi-new outdorsy jacket but then again, most of us spend
-considerable time in non-descript environments.
+#name stood in a field of wheat.
diff --git a/tests/suite/scripting/modules/chap2.typ b/tests/suite/scripting/modules/chap2.typ
index f1a886d6..3649cb58 100644
--- a/tests/suite/scripting/modules/chap2.typ
+++ b/tests/suite/scripting/modules/chap2.typ
@@ -1,11 +1,6 @@
// SKIP
#import "chap1.typ"
-#let name = "Klaus"
+#let name = "Peter"
== Chapter 2
-Their motivations, however, were pretty descript, so to speak. #name had not yet
-conceptualized their consequences, but that should change pretty quickly. #name
-approached the center of the field and picked up a 4-foot long disk made from
-what could only be cow manure. The hair on the back of #name' neck bristled as
-he stared at the unusual sight. After studying the object for a while, he
-promptly popped the question, "How much?"
+#name had not yet conceptualized their consequences.
diff --git a/tests/suite/styling/show.typ b/tests/suite/styling/show.typ
index 05f545c6..e8ddf553 100644
--- a/tests/suite/styling/show.typ
+++ b/tests/suite/styling/show.typ
@@ -113,9 +113,7 @@ Hey
]
#show: columns.with(2)
-Great typography is at the essence of great storytelling. It is the medium that
-transports meaning from parchment to reader, the wave that sparks a flame
-in booklovers and the great fulfiller of human need.
+#lines(16)
--- show-bare-content-block ---
// Test bare show in content block.
diff --git a/tests/suite/text/raw.typ b/tests/suite/text/raw.typ
index 0de34962..d6f6978e 100644
--- a/tests/suite/text/raw.typ
+++ b/tests/suite/text/raw.typ
@@ -127,8 +127,6 @@ Year Month Day
#set page(width: 180pt)
#set text(6pt)
-#lorem(20)
-
```py
def something(x):
return x
@@ -137,28 +135,47 @@ a = 342395823859823958329
b = 324923
```
-#lorem(20)
-
--- raw-align-specified ---
// 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)
--- raw-align-invalid ---
// Error: 17-20 expected `start`, `left`, `center`, `right`, or `end`, found top
#set raw(align: top)
+--- raw-inline-multiline ---
+#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.
+
--- raw-highlight-typ ---
-// LARGE
+```typ
+= Chapter 1
+#lorem(100)
+
+#let hi = "Hello World"
+#show heading: emph
+```
+
+--- raw-highlight-typc ---
#set page(width: auto)
```typ
@@ -184,45 +201,35 @@ b = 324923
#{ hello }
#{ hello() }
#{ hello.world() }
-$ hello $
-$ hello() $
-$ box[] $
-$ hello.world $
-$ hello.world() $
-$ hello.my.world() $
-$ f_zeta(x), f_zeta(x)/1 $
-$ emph(hello.my.world()) $
-$ emph(hello.my().world) $
-$ emph(hello.my().world()) $
-$ #hello $
-$ #hello() $
-$ #hello.world $
-$ #hello.world() $
-$ #box[] $
#if foo []
```
---- raw-highlight ---
-#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
+--- raw-highlight-typm ---
+#set page(width: auto)
+```typm
+1 + 2/3
+a^b
+hello
+hello()
+box[]
+hello.world
+hello.world()
+hello.my.world()
+f_zeta(x), f_zeta(x)/1
+emph(hello.my.world())
+emph(hello.my().world)
+emph(hello.my().world())
+#hello
+#hello()
+#hello.world
+#hello.world()
+#box[]
```
+--- raw-highlight-rust ---
+#set page(width: auto)
```rust
-/// A carefully designed state machine.
+/// A state machine.
#[derive(Debug)]
enum State<'a> { A(u8), B(&'a str) }
@@ -231,6 +238,9 @@ fn advance(state: State<'_>) -> State<'_> {
}
```
+--- raw-highlight-py ---
+#set page(width: auto)
+
```py
import this
@@ -238,6 +248,9 @@ def hi():
print("Hi!")
```
+--- raw-highlight-cpp ---
+#set page(width: auto)
+
```cpp
#include <iostream>
@@ -246,46 +259,26 @@ int main() {
}
```
-```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>
- ```
-
---- raw-inline-multiline ---
-#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.
+--- raw-highlight-html ---
+#set page(width: auto)
-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.
+```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>
+```
--- raw-blocky ---
// Test various raw parsing edge cases.
@@ -448,8 +441,8 @@ test
)
#for c in cases {
- assert.eq(c.text, c.input.text, message: "in point " + c.name + ", expect " + repr(c.text) + ", got " + repr(c.input.text) + "")
let block = c.at("block", default: false)
+ assert.eq(c.text, c.input.text, message: "in point " + c.name + ", expect " + repr(c.text) + ", got " + repr(c.input.text) + "")
assert.eq(block, c.input.block, message: "in point " + c.name + ", expect " + repr(block) + ", got " + repr(c.input.block) + "")
}
diff --git a/tests/suite/text/smartquote.typ b/tests/suite/text/smartquote.typ
index 04a82036..f5442ffd 100644
--- a/tests/suite/text/smartquote.typ
+++ b/tests/suite/text/smartquote.typ
@@ -1,48 +1,55 @@
--- smartquote ---
-// LARGE
-#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.'
+--- smartquote-de ---
#set text(lang: "de")
"Das Pferd frisst keinen Gurkensalat" war der erste jemals am 'Fernsprecher' gesagte Satz.
+--- smartquote-de-ch ---
#set text(lang: "de", region: "CH")
"Das Pferd frisst keinen Gurkensalat" war der erste jemals am 'Fernsprecher' gesagte Satz.
+--- smartquote-es ---
#set text(lang: "es", region: none)
"El caballo no come ensalada de pepino" fue la primera frase pronunciada por 'teléfono'.
+--- smartquote-es-mx ---
#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)
+--- smartquote-fr ---
+#set text(lang: "fr")
"Le cheval ne mange pas de salade de concombres" est la première phrase jamais prononcée au 'téléphone'.
+--- smartquote-fi ---
#set text(lang: "fi")
"Hevonen ei syö kurkkusalaattia" oli ensimmäinen koskaan 'puhelimessa' lausuttu lause.
+--- smartquote-gr ---
#set text(lang: "gr")
"Το άλογο δεν τρώει αγγουροσαλάτα" ήταν η πρώτη πρόταση που ειπώθηκε στο 'τηλέφωνο'.
+--- smartquote-he ---
#set text(lang: "he")
"הסוס לא אוכל סלט מלפפונים" היה המשפט ההראשון שנאמר ב'טלפון'.
+--- smartquote-ro ---
#set text(lang: "ro")
"Calul nu mănâncă salată de castraveți" a fost prima propoziție rostită vreodată la 'telefon'.
+--- smartquote-ru ---
#set text(lang: "ru")
"Лошадь не ест салат из огурцов" - это была первая фраза, сказанная по 'телефону'.
+--- smartquote-it ---
#set text(lang: "it")
"Il cavallo non mangia insalata di cetrioli" è stata la prima frase pronunciata al 'telefono'.
+--- smartquote-la ---
#set text(lang: "la")
#set smartquote(alternative: true)
"Equus cucumeris sem non edit" prima sententia in 'telephono' prolata fuit.
-#set smartquote(alternative: false)
--- smartquote-empty ---
// Test single pair of quotes.
diff --git a/tests/suite/visualize/color.typ b/tests/suite/visualize/color.typ
index bc8f8be5..f7eccdf3 100644
--- a/tests/suite/visualize/color.typ
+++ b/tests/suite/visualize/color.typ
@@ -160,12 +160,12 @@
let are-equal((a, b)) = {
let to-float(x) = if type(x) == angle { x.rad() } else { float(x) }
let epsilon = 1e-4 // The maximum error between both numbers
- assert.eq(type(a), type(b))
+ test(type(a), type(b))
calc.abs(to-float(a) - to-float(b)) < epsilon
}
let ref-without-alpha = if has-alpha { ref.slice(0, -1) } else { ref }
- assert.eq(col.components().len(), ref.len())
+ test(col.components().len(), ref.len())
assert(col.components().zip(ref).all(are-equal))
assert(col.components(alpha: false).zip(ref-without-alpha).all(are-equal))
}
@@ -317,19 +317,6 @@
#test-repr(luma(100%, 50%).opacify(-50%), luma(100%, 25%))
#test-repr(luma(100%, 0%).opacify(0%), luma(100%, 0%))
---- repr-color ---
-// Colors
-#set page(width: 400pt)
-#set text(0.8em)
-#blue \
-#color.linear-rgb(blue) \
-#oklab(blue) \
-#oklch(blue) \
-#cmyk(blue) \
-#color.hsl(blue) \
-#color.hsv(blue) \
-#luma(blue)
-
--- issue-color-mix-luma ---
// When mixing luma colors, we accidentally used the wrong component.
#rect(fill: gradient.linear(black, silver, space: luma))
diff --git a/tests/suite/visualize/gradient.typ b/tests/suite/visualize/gradient.typ
index 61f6b6d0..ff1aef3a 100644
--- a/tests/suite/visualize/gradient.typ
+++ b/tests/suite/visualize/gradient.typ
@@ -613,15 +613,6 @@ $ A = mat(
((red, 0%), (green, 25%), (blue, 50%), (green, 75%), (red, 100%))
)
---- gradient-repr ---
-// Gradients
-#set page(width: 400pt)
-#set text(0.8em)
-#gradient.linear(blue, red) \
-#gradient.linear(blue, red, dir: ttb) \
-#gradient.linear(blue, red, angle: 45deg, relative: "self") \
-#gradient.linear(blue, red, angle: 45deg, space: rgb)
-
--- issue-2902-gradient-oklch-panic ---
// Minimal reproduction of #2902
#set page(width: 15cm, height: auto, margin: 1em)
diff --git a/tests/suite/visualize/image.typ b/tests/suite/visualize/image.typ
index 3bda8d0e..846650c6 100644
--- a/tests/suite/visualize/image.typ
+++ b/tests/suite/visualize/image.typ
@@ -1,11 +1,10 @@
// Test the `image` function.
---- image-rgba-png-and-jpeg ---
-// Test loading different image formats.
-
+--- image-png ---
// Load an RGBA PNG image.
#image("/assets/images/rhino.png")
+--- image-jpg ---
// Load an RGB JPEG image.
#set page(height: 60pt)
#image("/assets/images/tiger.jpg")
diff --git a/tests/suite/visualize/stroke.typ b/tests/suite/visualize/stroke.typ
index b03c96c5..387e88cb 100644
--- a/tests/suite/visualize/stroke.typ
+++ b/tests/suite/visualize/stroke.typ
@@ -2,18 +2,18 @@
--- stroke-constructor ---
// Converting to stroke
-#assert.eq(stroke(red).paint, red)
-#assert.eq(stroke(red).thickness, auto)
-#assert.eq(stroke(2pt).paint, auto)
-#assert.eq(stroke((cap: "round", paint: blue)).cap, "round")
-#assert.eq(stroke((cap: auto, paint: blue)).cap, auto)
-#assert.eq(stroke((cap: auto, paint: blue)).thickness, auto)
+#test(stroke(red).paint, red)
+#test(stroke(red).thickness, auto)
+#test(stroke(2pt).paint, auto)
+#test(stroke((cap: "round", paint: blue)).cap, "round")
+#test(stroke((cap: auto, paint: blue)).cap, auto)
+#test(stroke((cap: auto, paint: blue)).thickness, auto)
// Constructing with named arguments
-#assert.eq(stroke(paint: blue, thickness: 8pt), 8pt + blue)
-#assert.eq(stroke(thickness: 2pt), stroke(2pt))
-#assert.eq(stroke(cap: "round").thickness, auto)
-#assert.eq(stroke(cap: "round", thickness: auto).thickness, auto)
+#test(stroke(paint: blue, thickness: 8pt), 8pt + blue)
+#test(stroke(thickness: 2pt), stroke(2pt))
+#test(stroke(cap: "round").thickness, auto)
+#test(stroke(cap: "round", thickness: auto).thickness, auto)
--- stroke-constructor-unknown-key ---
// Error: 9-21 unexpected key "foo", valid keys are "paint", "thickness", "cap", "join", "dash", and "miter-limit"