From ed0916d55c08dca3de37ba7f8c597cd19f3a0e23 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Wed, 8 Dec 2021 15:16:45 +0100 Subject: [PATCH] Fix more tests for footnotes --- tests/layout/test_footnotes.py | 2 -- weasyprint/layout/block.py | 1 - weasyprint/layout/page.py | 8 +++++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/layout/test_footnotes.py b/tests/layout/test_footnotes.py index 25c706fd..56169043 100644 --- a/tests/layout/test_footnotes.py +++ b/tests/layout/test_footnotes.py @@ -195,7 +195,6 @@ def test_several_footnote(): assert footnote_textbox2.text == 'mn' -@pytest.mark.xfail @assert_no_logs def test_reported_footnote_1(): page1, page2, = render_pages(''' @@ -330,7 +329,6 @@ def test_footnote_display_inline(): assert footnote_textbox2.text == 'i' -@pytest.mark.xfail @assert_no_logs def test_footnote_longer_than_space_left(): page1, page2 = render_pages(''' diff --git a/weasyprint/layout/block.py b/weasyprint/layout/block.py index 041955c3..15d39e9e 100644 --- a/weasyprint/layout/block.py +++ b/weasyprint/layout/block.py @@ -332,7 +332,6 @@ def _linebox_layout(context, box, index, child, new_children, page_is_empty, context.layout_footnote(descendant.footnote) if new_position_y > context.page_bottom - bottom_space: context.report_footnote(descendant.footnote) - stop = True new_children.append(line) position_y = new_position_y diff --git a/weasyprint/layout/page.py b/weasyprint/layout/page.py index c9beff34..c3afa2d9 100644 --- a/weasyprint/layout/page.py +++ b/weasyprint/layout/page.py @@ -746,8 +746,10 @@ def remake_page(index, context, root_box, html): next_page_side = 'right' if direction_ltr ^ break_verso else 'left' else: next_page_side = None - blank = ((next_page_side == 'left' and right_page) or - (next_page_side == 'right' and not right_page)) + blank = bool( + (next_page_side == 'left' and right_page) or + (next_page_side == 'right' and not right_page) or + (context.reported_footnotes and initial_resume_at is None)) if blank: next_page_name = '' side = 'right' if right_page else 'left' @@ -832,7 +834,7 @@ def make_all_pages(context, root_box, html, pages): yield pages[i] i += 1 - if resume_at is None: + if resume_at is None and not context.reported_footnotes: # Throw away obsolete pages context.page_maker = context.page_maker[:i + 1] return