1
1
mirror of https://github.com/Kozea/WeasyPrint.git synced 2024-10-05 00:21:15 +03:00

Add test for suppression of repeated bookmarks

This commit is contained in:
Tontyna 2020-06-19 14:40:05 +02:00
parent 4c67371f32
commit 5290cd1783

View File

@ -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()