summaryrefslogtreecommitdiff
path: root/tests/suite/text/edge.typ
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2024-04-13 10:39:45 +0200
committerLaurenz <laurmaedje@gmail.com>2024-05-17 14:27:59 +0200
commite039552f9d7bb49da8dafe7a83b87a08202eb30f (patch)
tree264b461722f758d85217da804550620cd74b4f9e /tests/suite/text/edge.typ
parent8e025c9cdfbb0a5dae536aafc27b5e19eeac1810 (diff)
Better test runner (#3922)
Diffstat (limited to 'tests/suite/text/edge.typ')
-rw-r--r--tests/suite/text/edge.typ39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/suite/text/edge.typ b/tests/suite/text/edge.typ
new file mode 100644
index 00000000..57732156
--- /dev/null
+++ b/tests/suite/text/edge.typ
@@ -0,0 +1,39 @@
+// Test top and bottom text edge.
+
+--- 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)
+
+--- text-edge-bad-type ---
+// Error: 21-23 expected "ascender", "cap-height", "x-height", "baseline", "bounds", or length, found array
+#set text(top-edge: ())
+
+--- text-edge-bad-value ---
+// Error: 24-26 expected "baseline", "descender", "bounds", or length
+#set text(bottom-edge: "")
+
+--- text-edge-wrong-edge ---
+// Error: 24-36 expected "baseline", "descender", "bounds", or length
+#set text(bottom-edge: "cap-height")