Skip to content

Commit

Permalink
test fix of #2556
Browse files Browse the repository at this point in the history
Ensure  #2556 is fixed properly.
  • Loading branch information
JorjMcKie committed Jul 28, 2023
1 parent 63d8309 commit df830db
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/test_drawings.py
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,17 @@ def test_2462():
doc = fitz.open(f"{scriptdir}/resources/test-2462.pdf")
page = doc[0]
vg = page.get_drawings(extended=True)


def test_2556():
"""Ensure that incomplete clip paths will be properly ignored."""
doc = fitz.open() # new empty PDF
page = doc.new_page() # new page
# following contains an incomplete clip
c = b"q 50 697.6 400 100.0 re W n q 0 0 m W n Q "
xref = doc.get_new_xref() # prepare /Contents object for page
doc.update_object(xref,"<<>>") # new xref now is a dictionary
doc.update_stream(xref, c) # store drawing commands
page.set_contents(xref) # give the page this xref as /Contents
# following will bring down interpreter if fix not installed
assert page.get_drawings(extended=True)

0 comments on commit df830db

Please sign in to comment.