summaryrefslogtreecommitdiff
path: root/tests/typ/graphics
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2022-11-29 13:37:25 +0100
committerLaurenz <laurmaedje@gmail.com>2022-11-29 14:18:13 +0100
commit0efe669278a5e1c3f2985eba2f3360e91159c54a (patch)
tree502712857c48f0decb5e698257c0a96d358a436e /tests/typ/graphics
parent836692e73cff0356e409a9ba5b4887b86809d4ca (diff)
Reorganize library and tests
Diffstat (limited to 'tests/typ/graphics')
-rw-r--r--tests/typ/graphics/hide.typ5
-rw-r--r--tests/typ/graphics/image.typ63
-rw-r--r--tests/typ/graphics/line.typ52
-rw-r--r--tests/typ/graphics/shape-aspect.typ46
-rw-r--r--tests/typ/graphics/shape-circle.typ51
-rw-r--r--tests/typ/graphics/shape-ellipse.typ26
-rw-r--r--tests/typ/graphics/shape-fill-stroke.typ50
-rw-r--r--tests/typ/graphics/shape-rect.typ69
-rw-r--r--tests/typ/graphics/shape-square.typ39
-rw-r--r--tests/typ/graphics/transform.typ49
10 files changed, 0 insertions, 450 deletions
diff --git a/tests/typ/graphics/hide.typ b/tests/typ/graphics/hide.typ
deleted file mode 100644
index a979b24f..00000000
--- a/tests/typ/graphics/hide.typ
+++ /dev/null
@@ -1,5 +0,0 @@
-// Test the `hide` function.
-
----
-AB #h(1fr) CD \
-#hide[A]B #h(1fr) C#hide[D]
diff --git a/tests/typ/graphics/image.typ b/tests/typ/graphics/image.typ
deleted file mode 100644
index e97365cd..00000000
--- a/tests/typ/graphics/image.typ
+++ /dev/null
@@ -1,63 +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, margin: 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 #parbreak()
-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 (searched at typ/graphics/path/does/not/exist)
-#image("path/does/not/exist")
-
----
-// Error: 8-21 unknown image format
-#image("./image.typ")
-
----
-// Error: 8-22 failed to parse svg: found closing tag 'g' instead of 'style' in line 4
-#image("/res/bad.svg")
diff --git a/tests/typ/graphics/line.typ b/tests/typ/graphics/line.typ
deleted file mode 100644
index 2cb2fc9c..00000000
--- a/tests/typ/graphics/line.typ
+++ /dev/null
@@ -1,52 +0,0 @@
-// Test lines
-
----
-// Default line.
-#line()
-
----
-// Test the to argument.
-{
- line(to: (10pt, 0pt))
- line(origin: (0pt, 10pt), to: (0pt, 0pt))
- line(to: (15pt, 15pt))
-}
-#v(.5cm)
-
----
-// Test the angle argument and positioning.
-
-#set page(fill: rgb("0B1026"))
-#set line(stroke: white)
-
-#let star(width, ..args) = box(width: width, height: width)[
- #set text(spacing: 0%)
- #set line(..args)
- #set par(align: left)
- #line(length: +30%, origin: (09.0%, 02%))
- #line(length: +30%, origin: (38.7%, 02%), angle: -72deg)
- #line(length: +30%, origin: (57.5%, 02%), angle: 252deg)
- #line(length: +30%, origin: (57.3%, 02%))
- #line(length: -30%, origin: (88.0%, 02%), angle: -36deg)
- #line(length: +30%, origin: (73.3%, 48%), angle: 252deg)
- #line(length: -30%, origin: (73.5%, 48%), angle: 36deg)
- #line(length: +30%, origin: (25.4%, 48%), angle: -36deg)
- #line(length: +30%, origin: (25.6%, 48%), angle: -72deg)
- #line(length: +32%, origin: (8.50%, 02%), angle: 34deg)
-]
-
-#align(center, grid(
- columns: 3,
- column-gutter: 10pt,
- ..((star(20pt, stroke: 0.5pt),) * 9)
-))
-
----
-// Test errors.
-
-// Error: 11-18 point array must contain exactly two entries
-#line(to: (50pt,))
-
----
-// Error: 15-27 expected relative length, found angle
-#line(origin: (3deg, 10pt), length: 5cm)
diff --git a/tests/typ/graphics/shape-aspect.typ b/tests/typ/graphics/shape-aspect.typ
deleted file mode 100644
index f2dd9b51..00000000
--- a/tests/typ/graphics/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(inset: 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, margin: 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, margin: 5pt)
-#square(width: 100%) #parbreak()
-#square(width: 100%)[Hello]
-
----
-// Size cannot be relative because we wouldn't know
-// relative to which axis.
-// Error: 15-18 expected length, found ratio
-#square(size: 50%)
diff --git a/tests/typ/graphics/shape-circle.typ b/tests/typ/graphics/shape-circle.typ
deleted file mode 100644
index 13ff67de..00000000
--- a/tests/typ/graphics/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: 2pt + black,
- align(center + horizon)[But, soft!]
-)
-
-Center-aligned rect in auto-sized circle.
-#circle(fill: forest, stroke: conifer,
- align(center + horizon,
- rect(fill: conifer, inset: 5pt)[But, soft!]
- )
-)
-
-Rect in auto-sized circle. \
-#circle(fill: forest,
- rect(fill: conifer, stroke: white, inset: 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/graphics/shape-ellipse.typ b/tests/typ/graphics/shape-ellipse.typ
deleted file mode 100644
index ba4d0d0a..00000000
--- a/tests/typ/graphics/shape-ellipse.typ
+++ /dev/null
@@ -1,26 +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: 3pt + forest, inset: 3pt)[
- #set text(8pt)
- But, soft! what light through yonder window breaks?
-]
-
-
-An inline #ellipse(width: 8pt, height: 6pt, outset: (top: 3pt, rest: 5.5pt)) ellipse. \ No newline at end of file
diff --git a/tests/typ/graphics/shape-fill-stroke.typ b/tests/typ/graphics/shape-fill-stroke.typ
deleted file mode 100644
index d14d0981..00000000
--- a/tests/typ/graphics/shape-fill-stroke.typ
+++ /dev/null
@@ -1,50 +0,0 @@
-// Test shape fill & stroke.
-
----
-#let variant = rect.with(width: 20pt, height: 10pt)
-#let items = for i, item in (
- variant(stroke: none),
- variant(),
- variant(fill: none),
- variant(stroke: 2pt),
- variant(stroke: eastern),
- variant(stroke: eastern + 2pt),
- variant(fill: eastern),
- variant(fill: eastern, stroke: none),
- variant(fill: forest, stroke: none),
- variant(fill: forest, stroke: conifer),
- variant(fill: forest, stroke: black + 2pt),
- variant(fill: forest, stroke: conifer + 2pt),
-) {
- (align(horizon)[{i + 1}.], item, [])
-}
-
-#grid(
- columns: (auto, auto, 1fr, auto, auto, 0fr),
- gutter: 5pt,
- ..items,
-)
-
----
-// Test stroke folding.
-#let sq = square.with(size: 10pt)
-
-#set square(stroke: none)
-#sq()
-#set square(stroke: auto)
-#sq()
-#sq(fill: teal)
-#sq(stroke: 2pt)
-#sq(stroke: blue)
-#sq(fill: teal, stroke: blue)
-#sq(fill: teal, stroke: 2pt + blue)
-
----
-// Test stroke composition.
-#set square(stroke: 4pt)
-#set text("Roboto")
-#square(
- stroke: (left: red, top: yellow, right: green, bottom: blue),
- radius: 100%, align(center+horizon)[*G*],
- inset: 8pt
-)
diff --git a/tests/typ/graphics/shape-rect.typ b/tests/typ/graphics/shape-rect.typ
deleted file mode 100644
index 94686da2..00000000
--- a/tests/typ/graphics/shape-rect.typ
+++ /dev/null
@@ -1,69 +0,0 @@
-// Test the `rect` function.
-
----
-// Default rectangle.
-#rect()
-
----
-#set page(width: 150pt)
-
-// Fit to text.
-#rect(fill: conifer, inset: 3pt)[Textbox]
-
-// Empty with fixed width and height.
-#block(rect(
- height: 15pt,
- fill: rgb("46b3c2"),
- stroke: 2pt + rgb("234994"),
-))
-
-// Fixed width, text height.
-#rect(width: 2cm, fill: rgb("9650d6"), inset: 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"))\}
-
-// Rounded corners.
-#rect(width: 2cm, radius: 60%)
-#rect(width: 1cm, radius: (left: 10pt, right: 5pt))
-#rect(width: 1.25cm, radius: (
- top-left: 2pt,
- top-right: 5pt,
- bottom-right: 8pt,
- bottom-left: 11pt
-))
-
-// Different strokes.
-[
- #set rect(stroke: (right: red))
- #rect(width: 100%, fill: lime, stroke: (x: 5pt, y: 1pt))
-]
-
----
-// Outset padding.
-#set raw(lang: "rust")
-#show raw: it => [
- #set text(8pt)
- #h(5.6pt, weak: true)
- #rect(radius: 3pt, outset: (y: 3pt, x: 2.5pt), fill: rgb(239, 241, 243), it)
- #h(5.6pt, weak: true)
-]
-
-Use the `*const T` pointer or the `&mut T` reference.
-
----
-// Error: 15-38 unexpected key "cake"
-#rect(radius: (left: 10pt, cake: 5pt))
-
----
-// Error: 15-21 expected stroke or none or dictionary with any of `left`, `top`, `right`, `bottom`, `x`, `y`, or `rest` as keys or auto, found array
-#rect(stroke: (1, 2))
-
----
-// Error: 15-19 expected relative length or none or dictionary with any of `top-left`, `top-right`, `bottom-right`, `bottom-left`, `left`, `top`, `right`, `bottom`, or `rest` as keys, found color
-#rect(radius: blue)
diff --git a/tests/typ/graphics/shape-square.typ b/tests/typ/graphics/shape-square.typ
deleted file mode 100644
index 622fa9c8..00000000
--- a/tests/typ/graphics/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, inset: 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/graphics/transform.typ b/tests/typ/graphics/transform.typ
deleted file mode 100644
index 2dde626b..00000000
--- a/tests/typ/graphics/transform.typ
+++ /dev/null
@@ -1,49 +0,0 @@
-// Test transformations.
-
----
-// Test creating the TeX and XeTeX logos.
-#let size = 11pt
-#let tex = [{
- [T]
- h(-0.14 * size)
- move(dy: 0.22 * size)[E]
- h(-0.12 * size)
- [X]
-}]
-
-#let xetex = {
- [X]
- h(-0.14 * size)
- scale(x: -100%, move(dy: 0.26 * size)[E])
- h(-0.14 * size)
- [T]
- h(-0.14 * size)
- move(dy: 0.26 * size)[E]
- h(-0.12 * size)
- [X]
-}
-
-#set text("Latin Modern Roman", size)
-Neither #tex, \
-nor #xetex!
-
----
-// Test combination of scaling and rotation.
-#set page(height: 80pt)
-#align(center + horizon,
- rotate(20deg, scale(70%, image("/res/tiger.jpg")))
-)
-
----
-// Test setting rotation origin.
-#rotate(10deg, origin: top + left,
- image("/res/tiger.jpg", width: 50%)
-)
-
----
-// Test setting scaling origin.
-#let r = rect(width: 100pt, height: 10pt, fill: forest)
-#set page(height: 65pt)
-#scale(r, x: 50%, y: 200%, origin: left + top)
-#scale(r, x: 50%, origin: center)
-#scale(r, x: 50%, y: 200%, origin: right + bottom)