From 0217f38ec8c1cefc2dc3eda8a32c0e8559ed5681 Mon Sep 17 00:00:00 2001 From: David Huggins-Daines Date: Sat, 17 Aug 2024 17:20:11 -0400 Subject: [PATCH] test: test flex-dimension column for issue #2222 --- tests/layout/test_flex.py | 62 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/layout/test_flex.py b/tests/layout/test_flex.py index 30577aa99..88a352752 100644 --- a/tests/layout/test_flex.py +++ b/tests/layout/test_flex.py @@ -615,3 +615,65 @@ def test_flex_absolute_content(): assert h1.position_y == 0 assert p.position_x == 0 assert p.position_y == 0 + + +@assert_no_logs +def test_flex_column_height(): + # Regression test for https://github.com/Kozea/WeasyPrint/issues/2222 + page, = render_pages(""" +
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut + enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor + in reprehenderit in voluptate velit esse cillum dolore eu fugiat + nulla pariatur. Excepteur sint occaecat cupidatat non proident, + sunt in culpa qui officia deserunt mollit anim id est laborum. +
+
+
+
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do + eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut + enim ad minim veniam, quis nostrud exercitation ullamco laboris + nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor + in reprehenderit in voluptate velit esse cillum dolore eu fugiat + nulla pariatur. Excepteur sint occaecat cupidatat non proident, + sunt in culpa qui officia deserunt mollit anim id est laborum. +
+
+
+ """) + html, = page.children + body, = html.children + section, = body.children + a1, a2 = section.children + assert a1.height == section.height + assert a2.height == section.height + + +@assert_no_logs +def test_flex_column_height2(): + # Another regression test for + # https://github.com/Kozea/WeasyPrint/issues/2222 + page, = render_pages(""" +
+
+ Question 1? With quite a lot of extra text, + which should not overflow in the PDF, we hope. +
+
+ Answer 1. With quite a lot of extra text, + which should not overflow in the PDF, we hope? +
+
+ """) + html, = page.children + body, = html.children + section, = body.children + a1, a2 = section.children + assert section.height == (a1.height + a2.height + + a1.margin_top + a1.margin_bottom + + a2.margin_top + a2.margin_bottom)