Skip to content

Commit

Permalink
Added test for #2238.
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-smith-artifex-com committed Mar 14, 2023
1 parent 26c80ce commit cdc2358
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Binary file added tests/resources/test2238.pdf
Binary file not shown.
21 changes: 21 additions & 0 deletions tests/test_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,3 +265,24 @@ def test_2108():
else:
print('Asserting text!=text_expected')
assert text != text_expected


def test_2238():
filepath = f'{scriptdir}/resources/test2238.pdf'
doc = fitz.open(filepath)

first_page = doc.load_page(0).get_text('text', fitz.INFINITE_RECT())
last_page = doc.load_page(-1).get_text('text', fitz.INFINITE_RECT())

print(f'{first_page=}')
print(f'{last_page=}')
assert first_page == 'Hello World\n'
assert last_page == 'Hello World\n'

first_page = doc.load_page(0).get_text('text')
last_page = doc.load_page(-1).get_text('text')

print(f'{first_page=}')
print(f'{last_page=}')
assert first_page == 'Hello World\n'
assert last_page == 'Hello World\n'

0 comments on commit cdc2358

Please sign in to comment.