mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-25 14:44:45 +03:00
Show error for negative PDF res.
This commit is contained in:
parent
eacdb3d843
commit
aba3e62968
|
@ -67,6 +67,7 @@ class TestFilePdf(PillowTestCase):
|
||||||
def test_resolution(self):
|
def test_resolution(self):
|
||||||
self.helper_save_as_pdf("RGB", resolution=300.5)
|
self.helper_save_as_pdf("RGB", resolution=300.5)
|
||||||
self.helper_save_as_pdf("RGB", resolution=(300, 150))
|
self.helper_save_as_pdf("RGB", resolution=(300, 150))
|
||||||
|
self.assertRaises(ValueError, self.helper_save_as_pdf, "RGB", resolution=-100)
|
||||||
|
|
||||||
def test_unsupported_mode(self):
|
def test_unsupported_mode(self):
|
||||||
im = hopper("LA")
|
im = hopper("LA")
|
||||||
|
|
|
@ -63,6 +63,8 @@ def _save(im, fp, filename, save_all=False):
|
||||||
else:
|
else:
|
||||||
pdf_width_res = resolution[0]
|
pdf_width_res = resolution[0]
|
||||||
pdf_height_res = resolution[1]
|
pdf_height_res = resolution[1]
|
||||||
|
if pdf_width_res <= 0 or pdf_height_res <= 0:
|
||||||
|
raise ValueError("Resolution must be > 0")
|
||||||
|
|
||||||
info = {
|
info = {
|
||||||
"title": None if is_appending else os.path.splitext(
|
"title": None if is_appending else os.path.splitext(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user