summaryrefslogtreecommitdiff
path: root/tests/typ/elements
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-03-11 11:58:56 +0100
committerLaurenz <laurmaedje@gmail.com>2022-03-11 11:58:56 +0100
commite6b532391deb1e30dc356c4d20dd48199f748f29 (patch)
tree7b631414931164b9a47c9d154172195fc0e1316c /tests/typ/elements
parentb71113d37a29bab5c7dc4b501c33ee9afbdb8213 (diff)
More restructuring
Diffstat (limited to 'tests/typ/elements')
-rw-r--r--tests/typ/elements/enum.typ60
-rw-r--r--tests/typ/elements/heading.typ50
-rw-r--r--tests/typ/elements/image.typ59
-rw-r--r--tests/typ/elements/list.typ51
-rw-r--r--tests/typ/elements/math.typ12
-rw-r--r--tests/typ/elements/shape-aspect.typ46
-rw-r--r--tests/typ/elements/shape-circle.typ51
-rw-r--r--tests/typ/elements/shape-ellipse.typ23
-rw-r--r--tests/typ/elements/shape-fill-stroke.typ26
-rw-r--r--tests/typ/elements/shape-rect.typ30
-rw-r--r--tests/typ/elements/shape-square.typ39
-rw-r--r--tests/typ/elements/table.typ13
12 files changed, 0 insertions, 460 deletions
diff --git a/tests/typ/elements/enum.typ b/tests/typ/elements/enum.typ
deleted file mode 100644
index 8ba3cea6..00000000
--- a/tests/typ/elements/enum.typ
+++ /dev/null
@@ -1,60 +0,0 @@
-// Test enums.
-
----
-. Embrace
-. Extend
-. Extinguish
-
----
-1. First.
- 2. Second.
-
-1. Back to first.
-
----
-2. Second
-1. First
- . Indented
-
----
-// Test automatic numbering in summed templates.
-#for i in range(5) {
- [. #roman(1 + i)]
-}
-
----
-// Test label pattern.
-#set enum(label: "~ A:")
-. First
-. Second
-
-#set enum(label: "(*)")
-. A
-. B
-. C
-
-#set enum(label: "i)")
-. A
-. B
-
----
-// Test label closure.
-#enum(
- start: 4,
- spacing: -3pt,
- label: n => text(fill: (red, green, blue)(mod(n, 3)), [#upper(letter(n))]),
- [Red], [Green], [Blue],
-)
-
----
-// Error: 18-20 invalid pattern
-#set enum(label: "")
-
----
-// Error: 18-24 invalid pattern
-#set enum(label: "(())")
-
----
-// Error: 18-28 expected template, found boolean
-#set enum(label: n => false)
-. A
diff --git a/tests/typ/elements/heading.typ b/tests/typ/elements/heading.typ
deleted file mode 100644
index 2ae97aa8..00000000
--- a/tests/typ/elements/heading.typ
+++ /dev/null
@@ -1,50 +0,0 @@
-// Test headings.
-
----
-// Different number of hashtags.
-
-// Valid levels.
-= Level 1
-=== Level 2
-====== Level 6
-
-// At some point, it should stop shrinking.
-=========== Level 11
-
----
-// Heading vs. no heading.
-
-// Parsed as headings if at start of the context.
-/**/ = Level 1
-{[== Level 2]}
-#box[=== Level 3]
-
-// Not at the start of the context.
-No = heading
-
-// Escaped.
-\= No heading
-
----
-// While indented at least as much as the start, the heading continues.
-
-= This
- is
- indented.
-
-= This
-is not.
-
-// Code blocks continue heading.
-= A {
- "B"
-}
-
----
-// Test styling.
-= Heading
-
-#set heading(family: "Roboto", fill: eastern)
-
-===== Heading 🌍
-#heading(level: 5)[Heading]
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/list.typ b/tests/typ/elements/list.typ
deleted file mode 100644
index 38fc2c63..00000000
--- a/tests/typ/elements/list.typ
+++ /dev/null
@@ -1,51 +0,0 @@
-// Test lists.
-
----
-_Shopping list_
-- Apples
-- Potatoes
-- Juice
-
----
-Tightly
-- surrounded
-- by two
-paragraphs.
-
----
-- First level.
-
- - Second level.
-
- There are multiple paragraphs.
- - Third level.
- Still the same bullet point.
-
- - Still level 2.
-
-- At the top.
-
----
-- Level 1
- - Level [
-2 through template
-]
-
----
- - Top-level indent
-- is fine.
-
----
- - A
- - B
- - C
-- D
-
----
-// This works because tabs are used consistently.
- - A with 1 tab
- - B with 2 tabs
-
-// This doesn't work because of mixed tabs and spaces.
- - A with 2 spaces
- - B with 2 tabs
diff --git a/tests/typ/elements/math.typ b/tests/typ/elements/math.typ
deleted file mode 100644
index cad01d10..00000000
--- a/tests/typ/elements/math.typ
+++ /dev/null
@@ -1,12 +0,0 @@
-// Test math formulas.
-
----
-The sum of $a$ and $b$ is $a + b$.
-
----
-We will show that:
-$[ a^2 + b^2 = c^2 ]$
-
----
-// Error: 2:1 expected closing bracket and dollar sign
-$[a
diff --git a/tests/typ/elements/shape-aspect.typ b/tests/typ/elements/shape-aspect.typ
deleted file mode 100644
index 2c3e9b0c..00000000
--- a/tests/typ/elements/shape-aspect.typ
+++ /dev/null
@@ -1,46 +0,0 @@
-// Test that squares and circles respect their 1-1 aspect ratio.
-
----
-// Test relative width and height and size that is smaller
-// than default size.
-#set page(width: 120pt, height: 70pt)
-#square(width: 50%, align(bottom)[A])
-#square(height: 50%)
-#box(stack(square(size: 10pt), 5pt, square(size: 10pt, [B])))
-
----
-// Test alignment in automatically sized square and circle.
-#set text(8pt)
-#square(padding: 4pt)[
- Hey there, #align(center + bottom, rotate(180deg, [you!]))
-]
-#circle(align(center + horizon, [Hey.]))
-
----
-// Test that maximum wins if both width and height are given.
-#square(width: 10pt, height: 20pt)
-#circle(width: 20%, height: 10pt)
-
----
-// Test square that is limited by region size.
-#set page(width: 20pt, height: 10pt, margins: 0pt)
-#stack(dir: ltr, square(fill: forest), square(fill: conifer))
-
----
-// Test different ways of sizing.
-#set page(width: 120pt, height: 40pt)
-#circle(radius: 5pt)
-#circle(width: 10%)
-#circle(height: 50%)
-
----
-// Test square that is overflowing due to its aspect ratio.
-#set page(width: 40pt, height: 20pt, margins: 5pt)
-#square(width: 100%)
-#square(width: 100%)[Hello]
-
----
-// Size cannot be relative because we wouldn't know
-// relative to which axis.
-// Error: 15-18 expected length, found relative
-#square(size: 50%)
diff --git a/tests/typ/elements/shape-circle.typ b/tests/typ/elements/shape-circle.typ
deleted file mode 100644
index 4b978e86..00000000
--- a/tests/typ/elements/shape-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"), stroke: black, 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/shape-ellipse.typ b/tests/typ/elements/shape-ellipse.typ
deleted file mode 100644
index 154144c4..00000000
--- a/tests/typ/elements/shape-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/shape-fill-stroke.typ b/tests/typ/elements/shape-fill-stroke.typ
deleted file mode 100644
index 935f3bc7..00000000
--- a/tests/typ/elements/shape-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, stroke: black, 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/shape-rect.typ b/tests/typ/elements/shape-rect.typ
deleted file mode 100644
index add39b80..00000000
--- a/tests/typ/elements/shape-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/shape-square.typ b/tests/typ/elements/shape-square.typ
deleted file mode 100644
index c4ece778..00000000
--- a/tests/typ/elements/shape-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"))
diff --git a/tests/typ/elements/table.typ b/tests/typ/elements/table.typ
deleted file mode 100644
index 0372951c..00000000
--- a/tests/typ/elements/table.typ
+++ /dev/null
@@ -1,13 +0,0 @@
-#set page(height: 70pt)
-#set table(primary: rgb("aaa"), secondary: none)
-
-#table(
- columns: (1fr,) * 3,
- stroke: rgb("333"),
- thickness: 2pt,
- [A], [B], [C], [], [], [D \ E \ F \ \ \ G], [H],
-)
-
----
-// Ref: false
-#table()