From 7b501684cd000c456eff50b9b905058300734ece Mon Sep 17 00:00:00 2001 From: Nemo Date: Sun, 4 Jul 2021 02:23:40 +0530 Subject: [PATCH] [tests] Adds tests for rotated pages --- tests/test_integration.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/tests/test_integration.py b/tests/test_integration.py index 13df30b..12bc2d1 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -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']