summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJames R. Barlow <jim@purplerock.ca>2019-02-12 14:11:07 -0800
committerJames R. Barlow <jim@purplerock.ca>2019-02-12 14:11:07 -0800
commit4307c4489eb18abd82b080080c9d616c98575601 (patch)
tree292ee26aea20a89d02a33b70082cd42d14684e26 /tests
parent7a060cbb27a0d586db03184d23241eff5005ff57 (diff)
Add Pdf.add_blank_page and Pdf.make_stream
Diffstat (limited to 'tests')
-rw-r--r--tests/test_pdf.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/test_pdf.py b/tests/test_pdf.py
index e4d0e45..9cce2e9 100644
--- a/tests/test_pdf.py
+++ b/tests/test_pdf.py
@@ -182,3 +182,21 @@ def test_min_and_force_version(trivial, outdir):
def test_normalize_linearize(trivial, outdir):
with pytest.raises(ValueError):
trivial.save(outdir / 'no.pdf', linearize=True, normalize_content=True)
+
+
+def test_make_stream(trivial, outdir):
+ pdf = trivial
+ stream = pdf.make_stream(b'q Q')
+ pdf.pages[0].Contents = stream
+ pdf.save(outdir / 's.pdf')
+
+
+def test_add_blank_page(trivial):
+ assert len(trivial.pages) == 1
+
+ invalid = [-1, 0, 2, 15000]
+ for n in invalid:
+ with pytest.raises(ValueError):
+ trivial.add_blank_page(page_size=(n, n))
+ trivial.add_blank_page()
+ assert len(trivial.pages) == 2