Skip to content

Commit

Permalink
Add test for suppression of repeated bookmarks
Browse files Browse the repository at this point in the history
  • Loading branch information
Tontyna committed Jun 19, 2020
1 parent 4c67371 commit 5290cd1
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions weasyprint/tests/test_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,34 @@ def test_bookmarks_10():
assert o2.get_value('Title', '(.*)') == b'(x)'


@assert_no_logs
@requires('cairo', (1, 15, 4))
def test_bookmarks_11():
fileobj = io.BytesIO()
FakeHTML(string='''
<div style="display:inline; white-space:pre;
bookmark-level:1; bookmark-label:'a'">
a
a
a
</div>
<div style="bookmark-level:1; bookmark-label:'b'">
<div>b</div>
<div style="break-before:always">c</div>
</div>
''').write_pdf(target=fileobj)
# a
# b
pdf_file = pdf.PDFFile(fileobj)
outlines = pdf_file.catalog.get_indirect_dict('Outlines', pdf_file)
assert outlines.get_type() == 'Outlines'
assert outlines.get_value('Count', '(.*)') == b'-2'
o1 = outlines.get_indirect_dict('First', pdf_file)
assert o1.get_value('Title', '(.*)') == b'(a)'
o2 = o1.get_indirect_dict('Next', pdf_file)
assert o2.get_value('Title', '(.*)') == b'(b)'


@assert_no_logs
def test_links_none():
fileobj = io.BytesIO()
Expand Down

0 comments on commit 5290cd1

Please sign in to comment.