From 6c2d54bbe3df70670afef6d3f61750daeb2adf34 Mon Sep 17 00:00:00 2001 From: PgBiel <9021226+PgBiel@users.noreply.github.com> Date: Fri, 20 Dec 2024 07:03:12 -0300 Subject: Fix crash when block or text have negative sizes (#5610) --- tests/ref/issue-5262-block-negative-height-implicit.png | Bin 0 -> 72 bytes tests/ref/issue-5262-block-negative-height-in-flow.png | Bin 0 -> 236 bytes tests/ref/issue-5262-block-negative-height.png | Bin 0 -> 73 bytes tests/ref/issue-5262-text-negative-size.png | Bin 0 -> 73 bytes tests/suite/layout/container.typ | 14 ++++++++++++++ tests/suite/text/font.typ | 5 +++++ 6 files changed, 19 insertions(+) create mode 100644 tests/ref/issue-5262-block-negative-height-implicit.png create mode 100644 tests/ref/issue-5262-block-negative-height-in-flow.png create mode 100644 tests/ref/issue-5262-block-negative-height.png create mode 100644 tests/ref/issue-5262-text-negative-size.png (limited to 'tests') diff --git a/tests/ref/issue-5262-block-negative-height-implicit.png b/tests/ref/issue-5262-block-negative-height-implicit.png new file mode 100644 index 00000000..3b7b289b Binary files /dev/null and b/tests/ref/issue-5262-block-negative-height-implicit.png differ diff --git a/tests/ref/issue-5262-block-negative-height-in-flow.png b/tests/ref/issue-5262-block-negative-height-in-flow.png new file mode 100644 index 00000000..402c5810 Binary files /dev/null and b/tests/ref/issue-5262-block-negative-height-in-flow.png differ diff --git a/tests/ref/issue-5262-block-negative-height.png b/tests/ref/issue-5262-block-negative-height.png new file mode 100644 index 00000000..1a1146d8 Binary files /dev/null and b/tests/ref/issue-5262-block-negative-height.png differ diff --git a/tests/ref/issue-5262-text-negative-size.png b/tests/ref/issue-5262-text-negative-size.png new file mode 100644 index 00000000..61e6dbae Binary files /dev/null and b/tests/ref/issue-5262-text-negative-size.png differ diff --git a/tests/suite/layout/container.typ b/tests/suite/layout/container.typ index 9948a00e..bb53a041 100644 --- a/tests/suite/layout/container.typ +++ b/tests/suite/layout/container.typ @@ -304,3 +304,17 @@ b #block(sticky: true)[*A*] b + +--- issue-5262-block-negative-height --- +#block(height: -1pt)[] + +--- issue-5262-block-negative-height-implicit --- +#set page(height: 10pt, margin: (top: 9pt)) +#block(height: 100%)[] + +--- issue-5262-block-negative-height-in-flow --- +// The contents after the block should be pushed upwards. +#set page(height: 60pt) +a +#block(height: -25pt)[b] +c diff --git a/tests/suite/text/font.typ b/tests/suite/text/font.typ index 5af8dcb9..9e5c0150 100644 --- a/tests/suite/text/font.typ +++ b/tests/suite/text/font.typ @@ -149,3 +149,8 @@ The number 123. // Error: 17-65 coverage regex may only use dot, letters, and character classes // Hint: 17-65 the regex is applied to each letter individually #set text(font: (name: "Ubuntu", covers: regex("\u{20}-\u{10}"))) + +--- issue-5262-text-negative-size --- +#set text(-1pt) + +a -- cgit v1.2.3