[tests] Adds tests for rotated pages

This commit is contained in:
Nemo 2021-07-04 02:23:40 +05:30
parent df75e04d1d
commit 7b501684cd
1 changed files with 11 additions and 0 deletions

View File

@ -52,3 +52,14 @@ def test_book(name, pages, metadata, bookmarks):
assert 'pystitcher/1.0.1' == info['/Creator']
for key in metadata:
assert info["/%s" % key] == metadata[key]
def test_rotation():
""" Validates the book-rotate.pdf with pages rotated."""
pdf = PyPDF3.PdfFileReader("tests/book-rotate.pdf")
# Note that inputs to getPage are 0-indexed
assert 90 == pdf.getPage(3)['/Rotate']
assert 90 == pdf.getPage(4)['/Rotate']
assert 90 == pdf.getPage(5)['/Rotate']
assert 180 == pdf.getPage(6)['/Rotate']
assert 180 == pdf.getPage(7)['/Rotate']
assert 180 == pdf.getPage(8)['/Rotate']