diff options
| author | +merlan #flirora <uruwi@protonmail.com> | 2024-12-09 04:33:30 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-12-09 09:33:30 +0000 |
| commit | 73dd5a085e1d877da6768b3fe67a4238863ba00b (patch) | |
| tree | 8ee71727f7878cf786748c93cdb44002f842234a /tests | |
| parent | 4729d3d3bdf52268d143b9fe0ba6b097eae32bf8 (diff) | |
Fix sizing of quadratic shapes (square/circle) (#5451)
Co-authored-by: Laurenz <laurmaedje@gmail.com>
Co-authored-by: PgBiel <9021226+PgBiel@users.noreply.github.com>
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/ref/circle-beyond-page-width-overflows.png | bin | 0 -> 620 bytes | |||
| -rw-r--r-- | tests/ref/circle-size-beyond-default.png | bin | 0 -> 1158 bytes | |||
| -rw-r--r-- | tests/ref/rect-size-beyond-default.png | bin | 0 -> 185 bytes | |||
| -rw-r--r-- | tests/ref/square-no-overflow.png (renamed from tests/ref/square-overflow.png) | bin | 290 -> 290 bytes | |||
| -rw-r--r-- | tests/ref/square-overflow-forced-height.png | bin | 0 -> 468 bytes | |||
| -rw-r--r-- | tests/ref/square-overflow-forced-width.png | bin | 0 -> 457 bytes | |||
| -rw-r--r-- | tests/ref/square-size-beyond-default.png | bin | 0 -> 198 bytes | |||
| -rw-r--r-- | tests/suite/visualize/circle.typ | 12 | ||||
| -rw-r--r-- | tests/suite/visualize/rect.typ | 6 | ||||
| -rw-r--r-- | tests/suite/visualize/square.typ | 27 |
10 files changed, 42 insertions, 3 deletions
diff --git a/tests/ref/circle-beyond-page-width-overflows.png b/tests/ref/circle-beyond-page-width-overflows.png Binary files differnew file mode 100644 index 00000000..941cb009 --- /dev/null +++ b/tests/ref/circle-beyond-page-width-overflows.png diff --git a/tests/ref/circle-size-beyond-default.png b/tests/ref/circle-size-beyond-default.png Binary files differnew file mode 100644 index 00000000..f25aad07 --- /dev/null +++ b/tests/ref/circle-size-beyond-default.png diff --git a/tests/ref/rect-size-beyond-default.png b/tests/ref/rect-size-beyond-default.png Binary files differnew file mode 100644 index 00000000..1f4d80fe --- /dev/null +++ b/tests/ref/rect-size-beyond-default.png diff --git a/tests/ref/square-overflow.png b/tests/ref/square-no-overflow.png Binary files differindex 81024ee6..81024ee6 100644 --- a/tests/ref/square-overflow.png +++ b/tests/ref/square-no-overflow.png diff --git a/tests/ref/square-overflow-forced-height.png b/tests/ref/square-overflow-forced-height.png Binary files differnew file mode 100644 index 00000000..f7cb0ee3 --- /dev/null +++ b/tests/ref/square-overflow-forced-height.png diff --git a/tests/ref/square-overflow-forced-width.png b/tests/ref/square-overflow-forced-width.png Binary files differnew file mode 100644 index 00000000..46671816 --- /dev/null +++ b/tests/ref/square-overflow-forced-width.png diff --git a/tests/ref/square-size-beyond-default.png b/tests/ref/square-size-beyond-default.png Binary files differnew file mode 100644 index 00000000..a513a7db --- /dev/null +++ b/tests/ref/square-size-beyond-default.png diff --git a/tests/suite/visualize/circle.typ b/tests/suite/visualize/circle.typ index 43459eb5..0687e068 100644 --- a/tests/suite/visualize/circle.typ +++ b/tests/suite/visualize/circle.typ @@ -67,3 +67,15 @@ Expanded by height. circle(width: 10%), circle(height: 50%), ) + +--- circle-size-beyond-default --- +// Test that setting a circle's height beyond its default sizes it correctly. +#circle() +#circle(height: 60pt) +#circle(width: 60pt) +#circle(radius: 30pt) + +--- circle-beyond-page-width-overflows --- +// Test that sizing a circle beyond the page width correctly overflows the page. +#set page(height: 100pt) +#circle(width: 150%) diff --git a/tests/suite/visualize/rect.typ b/tests/suite/visualize/rect.typ index f84fafcb..5dfe29f3 100644 --- a/tests/suite/visualize/rect.typ +++ b/tests/suite/visualize/rect.typ @@ -105,3 +105,9 @@ #align(right, rect(width: -1cm, fill: gradient.linear(red, blue))[Reverse right]) #align(right, rect(width: 1cm, fill: gradient.linear(red, blue))[Right]) + +--- rect-size-beyond-default --- +// Test that setting a rectangle's height beyond its default sizes it correctly. +#rect() +#rect(height: 60pt) +#rect(width: 60pt) diff --git a/tests/suite/visualize/square.typ b/tests/suite/visualize/square.typ index b346561d..bb7bbd9d 100644 --- a/tests/suite/visualize/square.typ +++ b/tests/suite/visualize/square.typ @@ -77,11 +77,25 @@ #set page(width: 20pt, height: 10pt, margin: 0pt) #stack(dir: ltr, square(fill: forest), square(fill: conifer)) ---- square-overflow --- +--- square-no-overflow --- // 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] +#square() +#square[Hello there] + +--- square-overflow-forced-width --- +// Test that a width-overflowing square is laid out regardless of the +// presence of inner content. +#set page(width: 60pt, height: 100pt) +#square(width: 150%) +#square(width: 150%)[Hello there] + +--- square-overflow-forced-height --- +// Test that a height-overflowing square is laid out regardless of the +// presence of inner content. +#set page(width: 120pt, height: 60pt) +#square(height: 150%) +#square(height: 150%)[Hello there] --- square-size-relative-invalid --- // Size cannot be relative because we wouldn't know @@ -144,3 +158,10 @@ // Test that square sets correct base for its content. #set page(height: 80pt) #square(width: 40%, rect(width: 60%, height: 80%)) + +--- square-size-beyond-default --- +// Test that setting a square's height beyond its default sizes it correctly. +#square() +#square(height: 60pt) +#square(width: 60pt) +#square(size: 60pt) |
