Skip to content

Commit

Permalink
test get_matrix()
Browse files Browse the repository at this point in the history
  • Loading branch information
mara004 committed Oct 3, 2022
1 parent 0a94fb2 commit f3f1b2a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tests/helpers/test_nup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,15 @@ def test_pageobj_placement():
assert xobject.pdf is dest_pdf

pageobj_a = xobject.as_pageobject()
assert pageobj_a.get_matrix() == pdfium.PdfMatrix()
assert isinstance(pageobj_a, pdfium.PdfPageObject)
assert isinstance(pageobj_a.raw, pdfium.FPDF_PAGEOBJECT)
assert pageobj_a.pdf is dest_pdf
assert pageobj_a.page is None
assert pageobj_a.type == pdfium.FPDF_PAGEOBJ_FORM
matrix_a = pdfium.PdfMatrix(0.5, 0, 0, 0.5, 0, height/2)
pageobj_a.set_matrix(matrix_a) # in this case: same effect as transform()
assert pageobj_a.get_matrix() == matrix_a
dest_page.insert_object(pageobj_a)
assert pageobj_a.pdf is dest_pdf
assert pageobj_a.page is dest_page
Expand All @@ -37,13 +39,15 @@ def test_pageobj_placement():
dest_page.insert_object(pageobj_b)

pageobj_c = xobject.as_pageobject()
assert pageobj_c.get_matrix() == pdfium.PdfMatrix()
matrix_c = pdfium.PdfMatrix(0.5, 0, 0, -0.5, 0, height/2)
pageobj_c.transform(matrix_c) # in this case: same effect as set_matrix()
assert pageobj_c.get_matrix() == matrix_c
dest_page.insert_object(pageobj_c)

pageobj_d = xobject.as_pageobject()
matrix_d = pdfium.PdfMatrix(-0.5, 0, 0, -0.5, width, height/2)
pageobj_d.transform(matrix_d) # in this case: same effect as set_matrix()
pageobj_d.transform(matrix_d) # in this case: same effect as set_matrix()
dest_page.insert_object(pageobj_d)

dest_page.generate_content()
Expand Down

0 comments on commit f3f1b2a

Please sign in to comment.