Skip to content

Commit

Permalink
TST: Page transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinThoma committed May 8, 2022
1 parent b5b646c commit 3d4b1ba
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/test_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@ def test_page_operations(pdf_path, password):
reader.decrypt(password)

page: PageObject = reader.pages[0]
page.mergeRotatedScaledPage(page, 90, 1, expand=True)
page.mergeScaledTranslatedPage(page, 1, 1, 1)
page.mergeRotatedScaledTranslatedPage(page, 90, scale=1, tx=1, ty=1, expand=True)
page.addTransformation([1, 0, 0, 0, 0, 0])
page.scale(2, 2)
Expand All @@ -76,6 +74,21 @@ def test_page_operations(pdf_path, password):
page.extractText()


def test_page_transformations():
pdf_path = os.path.join(RESOURCE_ROOT, "crazyones.pdf")
reader = PdfFileReader(pdf_path)

page: PageObject = reader.pages[0]
page.mergeRotatedPage(page, 90, expand=True)
page.mergeRotatedScaledPage(page, 90, 1, expand=True)
page.mergeRotatedScaledTranslatedPage(page, 90, scale=1, tx=1, ty=1, expand=True)
page.mergeRotatedTranslatedPage(page, 90, 100, 100, expand=False)
page.mergeScaledPage(page, 2, expand=False)
page.mergeScaledTranslatedPage(page, 1, 1, 1)
page.mergeTranslatedPage(page, 100, 100, expand=False)
page.addTransformation([1, 0, 0, 0, 0, 0])


@pytest.mark.parametrize(
("pdf_path", "password"),
[
Expand Down

0 comments on commit 3d4b1ba

Please sign in to comment.