mirror of
https://github.com/typst/typst
synced 2025-05-14 17:15:28 +08:00
Add regression tests for container sizing with layoutable child (#3955)
This commit is contained in:
parent
ac7dff10b2
commit
2f8b97f9c2
Binary file not shown.
Before Width: | Height: | Size: 257 B |
BIN
tests/ref/container-layoutable-child.png
Normal file
BIN
tests/ref/container-layoutable-child.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 117 B |
@ -18,21 +18,6 @@ Apart
|
|||||||
#block(width: 50%, height: 60%, fill: blue)
|
#block(width: 50%, height: 60%, fill: blue)
|
||||||
]
|
]
|
||||||
|
|
||||||
--- box-layoutable-child ---
|
|
||||||
// Test box sizing with layoutable child.
|
|
||||||
#box(
|
|
||||||
width: 50pt,
|
|
||||||
height: 50pt,
|
|
||||||
fill: yellow,
|
|
||||||
path(
|
|
||||||
fill: purple,
|
|
||||||
(0pt, 0pt),
|
|
||||||
(30pt, 30pt),
|
|
||||||
(0pt, 30pt),
|
|
||||||
(30pt, 0pt),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
--- box-width-fr ---
|
--- box-width-fr ---
|
||||||
// Test fr box.
|
// Test fr box.
|
||||||
Hello #box(width: 1fr, rect(height: 0.7em, width: 100%)) World
|
Hello #box(width: 1fr, rect(height: 0.7em, width: 100%)) World
|
||||||
@ -177,6 +162,17 @@ First!
|
|||||||
image("/assets/images/rhino.png", width: 30pt)
|
image("/assets/images/rhino.png", width: 30pt)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
--- container-layoutable-child ---
|
||||||
|
// Test box/block sizing with directly layoutable child.
|
||||||
|
//
|
||||||
|
// Ensure that the output respects the box size.
|
||||||
|
#let check(f) = f(
|
||||||
|
width: 40pt, height: 25pt, fill: aqua,
|
||||||
|
grid(rect(width: 5pt, height: 5pt, fill: blue)),
|
||||||
|
)
|
||||||
|
|
||||||
|
#stack(dir: ltr, spacing: 1fr, check(box), check(block))
|
||||||
|
|
||||||
--- issue-2128-block-width-box ---
|
--- issue-2128-block-width-box ---
|
||||||
// Test box in 100% width block.
|
// Test box in 100% width block.
|
||||||
#block(width: 100%, fill: red, box("a box"))
|
#block(width: 100%, fill: red, box("a box"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user