summaryrefslogtreecommitdiff
path: root/tests/typ/elements
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-12-20 14:18:29 +0100
committerLaurenz <laurmaedje@gmail.com>2021-12-21 00:20:24 +0100
commit11565a40b315212474f52eb576a9fd92b11f1132 (patch)
treec6b7afb35103065bc92b407094ca905bb75cfc73 /tests/typ/elements
parent958f74f77707340f34ee36d09492bdb74523aa2a (diff)
Set Rules Episode IX: The Rise of Testing
Diffstat (limited to 'tests/typ/elements')
-rw-r--r--tests/typ/elements/circle.typ51
-rw-r--r--tests/typ/elements/ellipse.typ23
-rw-r--r--tests/typ/elements/fill-stroke.typ26
-rw-r--r--tests/typ/elements/image.typ59
-rw-r--r--tests/typ/elements/rect.typ30
-rw-r--r--tests/typ/elements/square.typ39
6 files changed, 0 insertions, 228 deletions
diff --git a/tests/typ/elements/circle.typ b/tests/typ/elements/circle.typ
deleted file mode 100644
index 8b795830..00000000
--- a/tests/typ/elements/circle.typ
+++ /dev/null
@@ -1,51 +0,0 @@
-// Test the `circle` function.
-
----
-// Default circle.
-#circle()
-#circle[Hey]
-
----
-// Test auto sizing.
-
-Auto-sized circle. \
-#circle(fill: rgb("eb5278"), thickness: 2pt,
- align(center + horizon)[But, soft!]
-)
-
-Center-aligned rect in auto-sized circle.
-#circle(fill: forest, stroke: conifer,
- align(center + horizon,
- rect(fill: conifer, padding: 5pt)[But, soft!]
- )
-)
-
-Rect in auto-sized circle. \
-#circle(fill: forest,
- rect(fill: conifer, stroke: white, padding: 4pt)[
- #set text(8pt)
- But, soft! what light through yonder window breaks?
- ]
-)
-
-Expanded by height.
-#circle(stroke: black, align(center)[A \ B \ C])
-
----
-// Ensure circle directly in rect works.
-#rect(width: 40pt, height: 30pt, fill: forest, circle(fill: conifer))
-
----
-// Test relative sizing.
-#let centered(body) = align(center + horizon, body)
-#set text(fill: white)
-#rect(width: 100pt, height: 50pt, fill: rgb("aaa"), centered[
- #circle(radius: 10pt, fill: eastern, centered[A]) // D=20pt
- #circle(height: 60%, fill: eastern, centered[B]) // D=30pt
- #circle(width: 20% + 20pt, fill: eastern, centered[C]) // D=40pt
-])
-
----
-// Radius wins over width and height.
-// Error: 23-34 unexpected argument
-#circle(radius: 10pt, width: 50pt, height: 100pt, fill: eastern)
diff --git a/tests/typ/elements/ellipse.typ b/tests/typ/elements/ellipse.typ
deleted file mode 100644
index 154144c4..00000000
--- a/tests/typ/elements/ellipse.typ
+++ /dev/null
@@ -1,23 +0,0 @@
-// Test the `ellipse` function.
-
----
-// Default ellipse.
-#ellipse()
-
----
-Rect in ellipse in fixed rect. \
-#rect(width: 3cm, height: 2cm, fill: rgb("2a631a"),
- ellipse(fill: forest, width: 100%, height: 100%,
- rect(fill: conifer, width: 100%, height: 100%,
- align(center + horizon)[
- Stuff inside an ellipse!
- ]
- )
- )
-)
-
-Auto-sized ellipse. \
-#ellipse(fill: conifer, stroke: forest, thickness: 3pt, padding: 3pt)[
- #set text(8pt)
- But, soft! what light through yonder window breaks?
-]
diff --git a/tests/typ/elements/fill-stroke.typ b/tests/typ/elements/fill-stroke.typ
deleted file mode 100644
index 3ae5f987..00000000
--- a/tests/typ/elements/fill-stroke.typ
+++ /dev/null
@@ -1,26 +0,0 @@
-// 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(horizon)[{i + 1}.], rect, [])
-}
-
-#grid(
- columns: (auto, auto, 1fr, auto, auto, 0fr),
- gutter: 5pt,
- ..items,
-)
diff --git a/tests/typ/elements/image.typ b/tests/typ/elements/image.typ
deleted file mode 100644
index 8817713f..00000000
--- a/tests/typ/elements/image.typ
+++ /dev/null
@@ -1,59 +0,0 @@
-// Test the `image` function.
-
----
-// Test loading different image formats.
-
-// Load an RGBA PNG image.
-#image("../../res/rhino.png")
-
-// Load an RGB JPEG image.
-#set page(height: 60pt)
-#image("../../res/tiger.jpg")
-
----
-// Test configuring the size and fitting behaviour of images.
-
-// Set width and height explicitly.
-#image("../../res/rhino.png", width: 30pt)
-#image("../../res/rhino.png", height: 30pt)
-
-// Set width and height explicitly and force stretching.
-#image("../../res/monkey.svg", width: 100%, height: 20pt, fit: "stretch")
-
-// Make sure the bounding-box of the image is correct.
-#align(bottom + right, image("../../res/tiger.jpg", width: 40pt))
-
----
-// Test all three fit modes.
-#set page(height: 50pt, margins: 0pt)
-#grid(
- columns: (1fr, 1fr, 1fr),
- rows: 100%,
- gutter: 3pt,
- image("../../res/tiger.jpg", width: 100%, height: 100%, fit: "contain"),
- image("../../res/tiger.jpg", width: 100%, height: 100%, fit: "cover"),
- image("../../res/monkey.svg", width: 100%, height: 100%, fit: "stretch"),
-)
-
----
-// Does not fit to remaining height of page.
-#set page(height: 60pt)
-Stuff \
-Stuff
-#image("../../res/rhino.png")
-
----
-// Test baseline.
-A #image("../../res/tiger.jpg", height: 1cm, width: 80%) B
-
----
-// Test advanced SVG features.
-#image("../../res/pattern.svg")
-
----
-// Error: 8-29 file not found
-#image("path/does/not/exist")
-
----
-// Error: 8-21 failed to load image (unknown image format)
-#image("./image.typ")
diff --git a/tests/typ/elements/rect.typ b/tests/typ/elements/rect.typ
deleted file mode 100644
index add39b80..00000000
--- a/tests/typ/elements/rect.typ
+++ /dev/null
@@ -1,30 +0,0 @@
-// Test the `rect` function.
-
----
-// Default rectangle.
-#rect()
-
----
-#set page(width: 150pt)
-
-// Fit to text.
-#rect(fill: conifer, padding: 3pt)[Textbox]
-
-// Empty with fixed width and height.
-#block(rect(
- height: 15pt,
- fill: rgb("46b3c2"),
- stroke: rgb("234994"),
- thickness: 2pt,
-))
-
-// Fixed width, text height.
-#rect(width: 2cm, fill: rgb("9650d6"), padding: 5pt)[Fixed and padded]
-
-// Page width, fixed height.
-#rect(height: 1cm, width: 100%, fill: rgb("734ced"))[Topleft]
-
-// These are inline with text.
-\{#rect(width: 0.5in, height: 7pt, fill: rgb("d6cd67"))
- #rect(width: 0.5in, height: 7pt, fill: rgb("edd466"))
- #rect(width: 0.5in, height: 7pt, fill: rgb("e3be62"))\}
diff --git a/tests/typ/elements/square.typ b/tests/typ/elements/square.typ
deleted file mode 100644
index c4ece778..00000000
--- a/tests/typ/elements/square.typ
+++ /dev/null
@@ -1,39 +0,0 @@
-// Test the `square` function.
-
----
-// Default square.
-#square()
-#square[hey!]
-
----
-// Test auto-sized square.
-#square(fill: eastern, padding: 5pt)[
- #set text(fill: white, weight: "bold")
- Typst
-]
-
----
-// Test relative-sized child.
-#square(fill: eastern)[
- #rect(width: 10pt, height: 5pt, fill: conifer) \
- #rect(width: 40%, height: 5pt, stroke: conifer)
-]
-
----
-// Test text overflowing height.
-#set page(width: 75pt, height: 100pt)
-#square(fill: conifer)[
- But, soft! what light through yonder window breaks?
-]
-
----
-// Test that square does not overflow page.
-#set page(width: 100pt, height: 75pt)
-#square(fill: conifer)[
- But, soft! what light through yonder window breaks?
-]
-
----
-// Size wins over width and height.
-// Error: 09-20 unexpected argument
-#square(width: 10cm, height: 20cm, size: 1cm, fill: rgb("eb5278"))