summaryrefslogtreecommitdiff
path: root/tests/typ
diff options
context:
space:
mode:
authorBirk Tjelmeland <web-github@birktj.no>2023-04-01 16:04:38 +0200
committerGitHub <noreply@github.com>2023-04-01 16:04:38 +0200
commited79ecbb44a3132f23e3bd4d797009b5c3282fe3 (patch)
tree23a3ed7dbe18b3abb7a73112ba9038bb0264a411 /tests/typ
parentb2ba061fbb62478017c0a2e9ceced48710cdd291 (diff)
Add support for cliping content in `block` and `box` (#431)
Diffstat (limited to 'tests/typ')
-rw-r--r--tests/typ/layout/clip.typ42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/typ/layout/clip.typ b/tests/typ/layout/clip.typ
new file mode 100644
index 00000000..3baa8b80
--- /dev/null
+++ b/tests/typ/layout/clip.typ
@@ -0,0 +1,42 @@
+// Test clipping with the `box` and `block` containers.
+
+---
+// Test box clipping with a rectangle
+Hello #box(width: 1em, height: 1em, clip: false)[#rect(width: 3em, height: 3em, fill: red)]
+world 1
+
+Space
+
+Hello #box(width: 1em, height: 1em, clip: true)[#rect(width: 3em, height: 3em, fill: red)]
+world 2
+
+---
+// Test cliping text
+#block(width: 5em, height: 2em, clip: false, stroke: 1pt + black)[
+ But, soft! what light through
+]
+
+#v(2em)
+
+#block(width: 5em, height: 2em, clip: true, stroke: 1pt + black)[
+ But, soft! what light through yonder window breaks? It is the east, and Juliet
+ is the sun.
+]
+
+---
+// Test cliping svg glyphs
+Emoji: #box(height: 0.5em, stroke: 1pt + black)[🐪, 🌋, 🏞]
+
+Emoji: #box(height: 0.5em, clip: true, stroke: 1pt + black)[🐪, 🌋, 🏞]
+
+---
+// Test block clipping over multiple pages.
+
+#set page(height: 60pt)
+
+First!
+
+#block(height: 4em, clip: true, stroke: 1pt + black)[
+ But, soft! what light through yonder window breaks? It is the east, and Juliet
+ is the sun.
+]