diff options
Diffstat (limited to 'tests/typ/visualize/shape-aspect.typ')
| -rw-r--r-- | tests/typ/visualize/shape-aspect.typ | 55 |
1 files changed, 34 insertions, 21 deletions
diff --git a/tests/typ/visualize/shape-aspect.typ b/tests/typ/visualize/shape-aspect.typ index d2dc1140..d3606808 100644 --- a/tests/typ/visualize/shape-aspect.typ +++ b/tests/typ/visualize/shape-aspect.typ @@ -4,26 +4,35 @@ // Test relative width and height and size that is smaller // than default size. #set page(width: 120pt, height: 70pt) -#set align(center + horizon) -#square(width: 50%, [A]) -#square(height: 50%) -#box(stack( - square(size: 10pt), - square(size: 20pt, [B]) -)) +#set align(bottom) +#let centered = align.with(center + horizon) +#stack( + dir: ltr, + spacing: 1fr, + square(width: 50%, centered[A]), + square(height: 50%), + stack( + square(size: 10pt), + square(size: 20pt, centered[B]) + ), +) --- // Test alignment in automatically sized square and circle. #set text(8pt) -#square(inset: 4pt)[ +#box(square(inset: 4pt)[ Hey there, #align(center + bottom, rotate(180deg, [you!])) -] -#circle(align(center + horizon, [Hey.])) +]) +#box(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 that minimum wins if both width and height are given. +#stack( + dir: ltr, + spacing: 2pt, + square(width: 20pt, height: 40pt), + circle(width: 20%, height: 100pt), +) --- // Test square that is limited by region size. @@ -33,18 +42,22 @@ --- // Test different ways of sizing. #set page(width: 120pt, height: 40pt) -#circle(radius: 5pt) -#circle(width: 10%) -#circle(height: 50%) +#stack( + dir: ltr, + spacing: 2pt, + 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%)[Hey] +// Test that square doesn't overflow due to its aspect ratio. +#set page(width: 40pt, height: 25pt, margin: 5pt) +#square(width: 100%) +#square(width: 100%)[Hello there] --- // Size cannot be relative because we wouldn't know // relative to which axis. -// Error: 15-18 expected length, found ratio +// Error: 15-18 expected length or auto, found ratio #square(size: 50%) |
