summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/code/ops-invalid.typ2
-rw-r--r--tests/typ/code/ops.typ10
-rw-r--r--tests/typ/coma.typ3
-rw-r--r--tests/typ/layout/background.typ2
-rw-r--r--tests/typ/layout/page.typ2
-rw-r--r--tests/typ/layout/pagebreak.typ7
-rw-r--r--tests/typ/text/links.typ7
-rw-r--r--tests/typ/text/par.typ17
8 files changed, 39 insertions, 11 deletions
diff --git a/tests/typ/code/ops-invalid.typ b/tests/typ/code/ops-invalid.typ
index 91dd576f..340e4c9f 100644
--- a/tests/typ/code/ops-invalid.typ
+++ b/tests/typ/code/ops-invalid.typ
@@ -26,7 +26,7 @@
{not ()}
---
-// Error: 2-18 cannot apply '<=' to linear and relative
+// Error: 2-18 cannot apply '<=' to relative length and relative
{30% + 1pt <= 40%}
---
diff --git a/tests/typ/code/ops.typ b/tests/typ/code/ops.typ
index 04a72e72..be2cdb48 100644
--- a/tests/typ/code/ops.typ
+++ b/tests/typ/code/ops.typ
@@ -64,7 +64,7 @@
}
// Linears cannot be divided by themselves.
- if type(v) != "linear" {
+ if type(v) != "relative length" {
test(v / v, 1.0)
test(v / v == 1, true)
}
@@ -130,12 +130,14 @@
#test(test == test, true)
#test((() => {}) == (() => {}), false)
-// Templates also compare by identity.
+// Templates compare by shallow equality.
#let t = [a]
#test(t == t, true)
-#test([] == [], false)
+#test([] == [], true)
+#test([a] == [a], true)
#test([] == [a], false)
-#test([a] == [a], false)
+#test([[a]] == [a], false)
+#test(box[] == box[], false)
---
// Test comparison operators.
diff --git a/tests/typ/coma.typ b/tests/typ/coma.typ
index 45d28f9a..77baec45 100644
--- a/tests/typ/coma.typ
+++ b/tests/typ/coma.typ
@@ -8,7 +8,8 @@ Ola Nordmann, John Doe
#v(6mm)
#align(center)[
- ==== 3. Übungsblatt Computerorientierte Mathematik II #v(4mm)
+ ==== 3. Übungsblatt Computerorientierte Mathematik II
+ #v(4mm)
*Abgabe: 03.05.2019* (bis 10:10 Uhr in MA 001) #v(4mm)
*Alle Antworten sind zu beweisen.*
]
diff --git a/tests/typ/layout/background.typ b/tests/typ/layout/background.typ
index 6303a83b..f55262b2 100644
--- a/tests/typ/layout/background.typ
+++ b/tests/typ/layout/background.typ
@@ -1,7 +1,7 @@
// Test placing a background image on a page.
---
-#page(paper: "a10", flip: true)
+#page(paper: "a10", flipped: true)
#font(fill: white)
#place(
dx: -10pt,
diff --git a/tests/typ/layout/page.typ b/tests/typ/layout/page.typ
index dc6c7c81..3dad26c8 100644
--- a/tests/typ/layout/page.typ
+++ b/tests/typ/layout/page.typ
@@ -24,7 +24,7 @@
[#page(margins: 0pt, left: 20pt) Overriden]
// Flipped predefined paper.
-[#page(paper: "a11", flip: true) Flipped A11]
+[#page(paper: "a11", flipped: true) Flipped A11]
---
#page(width: 80pt, height: 40pt, fill: eastern)
diff --git a/tests/typ/layout/pagebreak.typ b/tests/typ/layout/pagebreak.typ
index f9a935bc..e0ffc92e 100644
--- a/tests/typ/layout/pagebreak.typ
+++ b/tests/typ/layout/pagebreak.typ
@@ -4,6 +4,7 @@
First of two
#pagebreak()
#page(height: 40pt)
+Second of two
---
// Make sure that you can't do page related stuff in a container.
@@ -24,11 +25,11 @@ D
#page(width: 80pt, height: 30pt)
-[#page() First]
-[#page() Second]
+Fi[#page(width: 80pt)rst]
+[#page(width: 70pt) Second]
#pagebreak()
#pagebreak()
Fourth
-[#page(height: 25pt)]
+#page(height: 20pt)[]
Sixth
[#page() Seventh]
diff --git a/tests/typ/text/links.typ b/tests/typ/text/links.typ
index e5f7affc..1a77e34b 100644
--- a/tests/typ/text/links.typ
+++ b/tests/typ/text/links.typ
@@ -20,3 +20,10 @@ You could also make the #link("https://html5zombo.com/")[link look way more typi
#page(height: 60pt)
#let link = link("https://typst.app/")[LINK]
My cool #move(x: 0.7cm, y: 0.7cm, rotate(10deg, scale(200%, link)))
+
+---
+// Link containing a block.
+#link("https://example.com/", 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 7b6bd289..9c14279c 100644
--- a/tests/typ/text/par.typ
+++ b/tests/typ/text/par.typ
@@ -6,6 +6,23 @@
To the right! Where the sunlight peeks behind the mountain.
---
+// Test that explicit paragraph break respects active styles.
+#par(spacing: 7pt)
+[#par(spacing: 100pt) First]
+
+[#par(spacing: 100pt) Second]
+#par(spacing: 20pt)
+
+Third
+
+---
+// Test that paragraph break due to incompatibility respects
+// spacing defined by the two adjacent paragraphs.
+#let a = [#par(spacing: 40pt) Hello]
+#let b = [#par(spacing: 60pt) World]
+{a}{b}
+
+---
// Test weird metrics.
#par(spacing: 100%, leading: 0pt)
But, soft! what light through yonder window breaks?