summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-11-22 14:30:43 +0100
committerLaurenz <laurmaedje@gmail.com>2021-11-29 16:47:35 +0100
commited50661378f356e02c6ec943bc4840091d33cfbd (patch)
tree7ed51339ea1a4b7ccc4308c902b36e86f9c07e26 /tests/typ
parentcef46e6c40fed0089a20e44ff2f251c06878891c (diff)
Castable optional and smart values
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/elements/fill-stroke.typ26
-rw-r--r--tests/typ/layout/page.typ20
-rw-r--r--tests/typ/layout/pagebreak.typ14
-rw-r--r--tests/typ/text/features.typ8
4 files changed, 52 insertions, 16 deletions
diff --git a/tests/typ/elements/fill-stroke.typ b/tests/typ/elements/fill-stroke.typ
new file mode 100644
index 00000000..b8f2b4bc
--- /dev/null
+++ b/tests/typ/elements/fill-stroke.typ
@@ -0,0 +1,26 @@
+// Test shape fill & stroke.
+
+---
+#let rect with (width: 20pt, height: 10pt)
+#let items = for i, rect in (
+ rect(stroke: none),
+ rect(),
+ rect(fill: none),
+ rect(thickness: 2pt),
+ rect(stroke: eastern),
+ rect(stroke: eastern, thickness: 2pt),
+ rect(fill: eastern),
+ rect(fill: eastern, stroke: none),
+ rect(fill: forest, stroke: none, thickness: 2pt),
+ rect(fill: forest, stroke: conifer),
+ rect(fill: forest, thickness: 2pt),
+ rect(fill: forest, stroke: conifer, thickness: 2pt),
+) {
+ (align(vertical: center)[{i + 1}.], rect, [])
+}
+
+#grid(
+ columns: (auto, auto, 1fr, auto, auto, 0fr),
+ gutter: 5pt,
+ ..items,
+)
diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ
index 9bb3097d..1f707327 100644
--- a/tests/typ/layout/page.typ
+++ b/tests/typ/layout/page.typ
@@ -27,20 +27,8 @@
[#page(paper: "a11", flip: true) Flipped A11]
---
-// Test a combination of pages with bodies and normal content.
-
-#page(width: 80pt, height: 30pt)
-
-[#page() First]
-[#page() Second]
-#pagebreak()
-#pagebreak()
-Fourth
-[#page(height: 25pt)]
-Sixth
-[#page() Seventh]
-
----
#page(width: 80pt, height: 40pt, fill: eastern)
-#font(15pt, "Roboto", fill: white, smallcaps: true)
-Typst
+#font(15pt, "Roboto", fill: white, smallcaps: true)[Typst]
+
+#page(width: 40pt, fill: none, margins: auto, top: 10pt)
+Hi
diff --git a/tests/typ/layout/pagebreak.typ b/tests/typ/layout/pagebreak.typ
index ab591c87..f9a935bc 100644
--- a/tests/typ/layout/pagebreak.typ
+++ b/tests/typ/layout/pagebreak.typ
@@ -18,3 +18,17 @@ C
// No consequences from the page("A4") call here.
#pagebreak()
D
+
+---
+// Test a combination of pages with bodies and normal content.
+
+#page(width: 80pt, height: 30pt)
+
+[#page() First]
+[#page() Second]
+#pagebreak()
+#pagebreak()
+Fourth
+[#page(height: 25pt)]
+Sixth
+[#page() Seventh]
diff --git a/tests/typ/text/features.typ b/tests/typ/text/features.typ
index fc84514b..d60583d8 100644
--- a/tests/typ/text/features.typ
+++ b/tests/typ/text/features.typ
@@ -53,10 +53,18 @@ fi vs. #font(ligatures: false)[No fi] \
fi vs. #font(features: (liga: 0))[No fi]
---
+// Error: 22-27 expected integer or none, found boolean
+#font(stylistic-set: false)
+
+---
// Error: 22-24 must be between 1 and 20
#font(stylistic-set: 25)
---
+// Error: 20-21 expected string or auto, found integer
+#font(number-type: 2)
+
+---
// Error: 20-31 expected "lining" or "old-style"
#font(number-type: "different")