Pillow/Tests/test_file_pdf.py

59 lines
808 B
Python
Raw Normal View History

2014-05-11 10:01:09 +04:00
from tester import *
import os.path
2014-05-11 18:16:13 +04:00
def helper_save_as_pdf(mode):
2014-05-11 10:01:09 +04:00
# Arrange
2014-05-11 18:16:13 +04:00
im = lena(mode)
outfile = tempfile("temp_" + mode + ".pdf")
2014-05-11 10:01:09 +04:00
# Act
im.save(outfile)
# Assert
assert_true(os.path.isfile(outfile))
assert_greater(os.path.getsize(outfile), 0)
2014-05-11 18:16:13 +04:00
def test_monochrome():
# Arrange
mode = "1"
# Act / Assert
helper_save_as_pdf(mode)
2014-05-11 18:35:49 +04:00
2014-05-11 18:16:13 +04:00
def test_greyscale():
# Arrange
mode = "L"
# Act / Assert
helper_save_as_pdf(mode)
def test_rgb():
# Arrange
mode = "RGB"
# Act / Assert
helper_save_as_pdf(mode)
2014-05-12 15:45:54 +04:00
def test_p_mode():
# Arrange
mode = "P"
# Act / Assert
helper_save_as_pdf(mode)
2014-05-11 18:16:13 +04:00
def test_cmyk_mode():
# Arrange
2014-05-11 18:23:10 +04:00
mode = "CMYK"
2014-05-11 18:16:13 +04:00
# Act / Assert
helper_save_as_pdf(mode)
2014-05-11 10:01:09 +04:00
# End of file