summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-02-08 16:39:37 +0100
committerLaurenz <laurmaedje@gmail.com>2022-02-09 12:34:19 +0100
commite089b6ea40015e012302dc55ac5d6cb42ca4876e (patch)
treedbb66237cb996bc880560dfd94ac9b682e1ac985 /tests
parent68503b9a07b00bce3f4d377bcfe945452de815ea (diff)
Set rules for everything
Diffstat (limited to 'tests')
-rw-r--r--tests/ref/style/construct.pngbin2029 -> 4651 bytes
-rw-r--r--tests/ref/text/links.pngbin34979 -> 35262 bytes
-rw-r--r--tests/ref/text/par.pngbin12918 -> 11934 bytes
-rw-r--r--tests/typ/style/construct.typ16
-rw-r--r--tests/typ/text/links.typ18
-rw-r--r--tests/typ/text/par.typ12
6 files changed, 28 insertions, 18 deletions
diff --git a/tests/ref/style/construct.png b/tests/ref/style/construct.png
index 3e37eb5a..97786177 100644
--- a/tests/ref/style/construct.png
+++ b/tests/ref/style/construct.png
Binary files differ
diff --git a/tests/ref/text/links.png b/tests/ref/text/links.png
index 8be159ef..75ea19e8 100644
--- a/tests/ref/text/links.png
+++ b/tests/ref/text/links.png
Binary files differ
diff --git a/tests/ref/text/par.png b/tests/ref/text/par.png
index c080178e..c0b3d73f 100644
--- a/tests/ref/text/par.png
+++ b/tests/ref/text/par.png
Binary files differ
diff --git a/tests/typ/style/construct.typ b/tests/typ/style/construct.typ
index 65dcaf85..78a74881 100644
--- a/tests/typ/style/construct.typ
+++ b/tests/typ/style/construct.typ
@@ -2,6 +2,7 @@
---
// Ensure that constructor styles aren't passed down the tree.
+// The inner list should have no extra indent.
#set par(leading: 2pt)
#list(
body-indent: 20pt,
@@ -11,7 +12,22 @@
---
// Ensure that constructor styles win, but not over outer styles.
+// The outer paragraph should be right-aligned,
+// but the B should be center-aligned.
#set par(align: center)
#par(align: right)[
A #rect(width: 2cm, fill: conifer, padding: 4pt)[B]
]
+
+---
+// The inner rectangle should also be yellow here.
+// (and therefore invisible)
+[#set rect(fill: yellow);#text(100%, rect(padding: 5pt, rect()))]
+
+---
+// The inner rectangle should not be yellow here.
+A #rect(fill: yellow, padding: 5pt, rect()) B
+
+---
+// The inner list should not be indented extra.
+[#set text(100%);#list(label-indent: 20pt, list[A])]
diff --git a/tests/typ/text/links.typ b/tests/typ/text/links.typ
index f2da8b9c..99037ee3 100644
--- a/tests/typ/text/links.typ
+++ b/tests/typ/text/links.typ
@@ -1,3 +1,6 @@
+// Test hyperlinking.
+
+---
// Link without body.
#link("https://example.com/")
@@ -8,22 +11,25 @@
This link appears #link("https://google.com/")[in the middle of] a paragraph.
// Prefix is trimmed.
-Contact #link("mailto:hi@typst.app") or call #link("tel:123") for more information.
+Contact #link("mailto:hi@typst.app") or
+call #link("tel:123") for more information.
---
// Styled with underline and color.
-#let link(url, body) = link(url, text(fill: rgb("283663"), underline(body)))
-You could also make the #link("https://html5zombo.com/")[link look way more typical.]
+#set link(fill: rgb("283663"))
+You could also make the
+#link("https://html5zombo.com/")[link look way more typical.]
---
// Transformed link.
#set page(height: 60pt)
-#let link = link("https://typst.app/")[LINK]
-My cool #move(x: 0.7cm, y: 0.7cm, rotate(10deg, scale(200%, link)))
+#set link(underline: false)
+#let mylink = link("https://typst.app/")[LINK]
+My cool #move(x: 0.7cm, y: 0.7cm, rotate(10deg, scale(200%, mylink)))
---
// Link containing a block.
-#link("https://example.com/", block[
+#link("https://example.com/", underline: false, block[
My cool rhino
#move(x: 10pt, image("../../res/rhino.png", width: 1cm))
])
diff --git a/tests/typ/text/par.typ b/tests/typ/text/par.typ
index b0e60955..2bff4a47 100644
--- a/tests/typ/text/par.typ
+++ b/tests/typ/text/par.typ
@@ -30,18 +30,6 @@ You
A #set par(spacing: 0pt, leading: 0pt); B #parbreak() C
---
-// Test that paragraph breaks due to block nodes have the correct spacing.
-#set par(spacing: 10pt)
-- A
-
-#set par(leading: 0pt)
-- B
-- C
-#set par(leading: 5pt)
-- D
-- E
-
----
// Test weird metrics.
#set par(spacing: 100%, leading: 0pt)
But, soft! what light through yonder window breaks?