1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-04 07:57:52 +03:00

Fix more tests for footnotes

This commit is contained in:
Guillaume Ayoub 2021-12-08 15:16:45 +01:00
parent a702292a1a
commit ed0916d55c
3 changed files with 5 additions and 6 deletions

View File

@ -195,7 +195,6 @@ def test_several_footnote():
assert footnote_textbox2.text == 'mn' assert footnote_textbox2.text == 'mn'
@pytest.mark.xfail
@assert_no_logs @assert_no_logs
def test_reported_footnote_1(): def test_reported_footnote_1():
page1, page2, = render_pages(''' page1, page2, = render_pages('''
@ -330,7 +329,6 @@ def test_footnote_display_inline():
assert footnote_textbox2.text == 'i' assert footnote_textbox2.text == 'i'
@pytest.mark.xfail
@assert_no_logs @assert_no_logs
def test_footnote_longer_than_space_left(): def test_footnote_longer_than_space_left():
page1, page2 = render_pages(''' page1, page2 = render_pages('''

View File

@ -332,7 +332,6 @@ def _linebox_layout(context, box, index, child, new_children, page_is_empty,
context.layout_footnote(descendant.footnote) context.layout_footnote(descendant.footnote)
if new_position_y > context.page_bottom - bottom_space: if new_position_y > context.page_bottom - bottom_space:
context.report_footnote(descendant.footnote) context.report_footnote(descendant.footnote)
stop = True
new_children.append(line) new_children.append(line)
position_y = new_position_y position_y = new_position_y

View File

@ -746,8 +746,10 @@ def remake_page(index, context, root_box, html):
next_page_side = 'right' if direction_ltr ^ break_verso else 'left' next_page_side = 'right' if direction_ltr ^ break_verso else 'left'
else: else:
next_page_side = None next_page_side = None
blank = ((next_page_side == 'left' and right_page) or blank = bool(
(next_page_side == 'right' and not right_page)) (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: if blank:
next_page_name = '' next_page_name = ''
side = 'right' if right_page else 'left' side = 'right' if right_page else 'left'
@ -832,7 +834,7 @@ def make_all_pages(context, root_box, html, pages):
yield pages[i] yield pages[i]
i += 1 i += 1
if resume_at is None: if resume_at is None and not context.reported_footnotes:
# Throw away obsolete pages # Throw away obsolete pages
context.page_maker = context.page_maker[:i + 1] context.page_maker = context.page_maker[:i + 1]
return return