summaryrefslogtreecommitdiff
path: root/tests/typ/compiler
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ/compiler')
-rw-r--r--tests/typ/compiler/methods.typ17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/typ/compiler/methods.typ b/tests/typ/compiler/methods.typ
index f3ec4434..262f1497 100644
--- a/tests/typ/compiler/methods.typ
+++ b/tests/typ/compiler/methods.typ
@@ -82,6 +82,23 @@
#test((5em + 6in).abs.inches(), 6.0)
---
+// Test length `to-absolute` method.
+
+#set text(size: 12pt)
+#style(styles => {
+ test((6pt).to-absolute(styles), 6pt)
+ test((6pt + 10em).to-absolute(styles), 126pt)
+ test((10em).to-absolute(styles), 120pt)
+})
+
+#set text(size: 64pt)
+#style(styles => {
+ test((6pt).to-absolute(styles), 6pt)
+ test((6pt + 10em).to-absolute(styles), 646pt)
+ test((10em).to-absolute(styles), 640pt)
+})
+
+---
// Error: 2-21 cannot convert a length with non-zero em units (`-6pt + 10.5em`) to pt
// Hint: 2-21 use `length.abs.pt()` instead to ignore its em component
#(10.5em - 6pt).pt()