From 8f5bee1d51740071ce532cfa8764b61d62261e88 Mon Sep 17 00:00:00 2001 From: Lucie Anglade Date: Wed, 13 Jul 2022 22:10:12 +0200 Subject: [PATCH] Some tests for max-height on footnote area. Related to #1674. --- tests/draw/test_footnotes.py | 199 +++++++++++++++++++++++++++++++++ tests/layout/test_footnotes.py | 54 +++++++++ 2 files changed, 253 insertions(+) diff --git a/tests/draw/test_footnotes.py b/tests/draw/test_footnotes.py index 0bea2aa7c..dae14dfac 100644 --- a/tests/draw/test_footnotes.py +++ b/tests/draw/test_footnotes.py @@ -157,3 +157,202 @@ def test_footnote_with_absolute(assert_pixels): }
ad
''') + + +@assert_no_logs +def test_footnote_max_height_1(assert_pixels): + assert_pixels(''' + RRRRRRRR_ + RRRRRRRR_ + RRRR_____ + RRRR_____ + _BBBBBB__ + _BBBBBB__ + _________ + _________ + _________ + _________ + _BBBBBB__ + _BBBBBB__ + ''', ''' + +
ab
c
d
+
ef
''') + + +@assert_no_logs +def test_footnote_max_height_2(assert_pixels): + assert_pixels(''' + RRRRRRRR_ + RRRRRRRR_ + _________ + _________ + _BBBBBB__ + _BBBBBB__ + _________ + _________ + _________ + _________ + _BBBBBB__ + _BBBBBB__ + ''', ''' + +
ab
c
d
''') + + +@assert_no_logs +def test_footnote_max_height_3(assert_pixels): + assert_pixels(''' + RRRRRRRR_ + RRRRRRRR_ + _________ + _________ + _________ + _________ + ''', ''' + +
ab
c
d
''') + + +@assert_no_logs +def test_footnote_max_height_4(assert_pixels): + assert_pixels(''' + RRRRRRRR_ + RRRRRRRR_ + RRRR_____ + RRRR_____ + _BBBBBB__ + _BBBBBB__ + RRRR_____ + RRRR_____ + _________ + _________ + _BBBBBB__ + _BBBBBB__ + ''', ''' + +
ab
c
d
+
ef
+
gh
''') + + +@assert_no_logs +def test_footnote_max_height_5(assert_pixels): + assert_pixels(''' + RRRRRRRRRR + RRRRRRRRRR + _BBBBBB___ + _BBBBBB___ + _BBBBBB___ + _BBBBBB___ + RRRR______ + RRRR______ + __________ + __________ + _BBBBBB___ + _BBBBBB___ + ''', ''' + +
ab
c
d
+
e
+
fg
''') diff --git a/tests/layout/test_footnotes.py b/tests/layout/test_footnotes.py index 8a32ea7a3..0eabf0509 100644 --- a/tests/layout/test_footnotes.py +++ b/tests/layout/test_footnotes.py @@ -643,3 +643,57 @@ def test_footnote_repagination(): assert footnote_marker.children[0].text == '1.' assert footnote_textbox.text == 'de' assert footnote_area.position_y == 5 + + +@assert_no_logs +def test_footnote_max_height(): + page1, page2 = render_pages(''' + +
ab
c
d
+
e
+
fg
''') + html1, footnote_area1= page1.children + body1, = html1.children + div, = body1.children + div_textbox, footnote_call1, footnote_call2, footnote_call3 = div.children[0].children + assert div_textbox.text == 'ab' + assert footnote_call1.children[0].text == '1' + assert footnote_call2.children[0].text == '2' + assert footnote_call3.children[0].text == '3' + footnote_line1, footnote_line2 = footnote_area1.children[0].children + footnote_marker1, footnote_content1 = footnote_line1[0].children + assert footnote_marker1.children[0].text == '1.' + assert footnote_content1.text == 'c' + footnote_marker2, footnote_content2 = footnote_line2[0].children + assert footnote_marker2.children[0].text == '2.' + assert footnote_content2.text == 'd' + + html2, footnote_area2 = page2.children + body2, = html2.children + div2, = body2.children + div_textbox2 = div2.children[0].children + assert div_textbox2.text == 'fg' + footnote_line3 = footnote_area2.children[0].children + footnote_marker3, footnote_content3 = footnote_line3[0].children + assert footnote_marker2.children[0].text == '3.' + assert footnote_content2.text == 'e'