Skip to content

Commit

Permalink
TST: Adding outline items after clone_document_from_reader
Browse files Browse the repository at this point in the history
See #1518
  • Loading branch information
MartinThoma committed Dec 26, 2022
1 parent c700617 commit cfed01f
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/test_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,27 @@ def test_writer_clone():
assert len(writer.pages) == 4


@pytest.mark.xfail(reason="Issue 1518")
def test_writer_clone_bookmarks():
# Arrange
src = RESOURCE_ROOT / "crazyones.pdf"
reader = PdfReader(src)
writer = PdfWriter()

# Act
writer.clone_document_from_reader(reader)
writer.add_outline_item("Page 1", 0)
writer.add_outline_item("Page 2", 1)

# Assert
bytes_stream = BytesIO()
writer.write(bytes_stream)
bytes_stream.seek(0)
reader2 = PdfReader(bytes_stream)
assert len(reader2.pages) == 1
assert len(reader2.outline) == 2


def writer_operate(writer):
"""
To test the writer that initialized by each of the four usages.
Expand Down

0 comments on commit cfed01f

Please sign in to comment.