bmp test reorganization

This commit is contained in:
wiredfool 2014-01-22 20:40:02 -08:00
parent e1489d7c76
commit 15d6cc9f57

View File

@ -2,26 +2,24 @@ from tester import *
from PIL import Image
def roundtrip(im):
outfile = tempfile("temp.bmp")
im.save(outfile, 'BMP')
reloaded = Image.open(outfile)
reloaded.load()
assert_equal(im.mode, reloaded.mode)
assert_equal(im.size, reloaded.size)
assert_equal(reloaded.format, "BMP")
def test_sanity():
roundtrip(lena())
roundtrip(lena("1"))
roundtrip(lena("L"))
roundtrip(lena("P"))
roundtrip(lena("RGB"))
file = tempfile("temp.bmp")
lena().save(file)
im = Image.open(file)
im.load()
assert_equal(im.mode, "RGB")
assert_equal(im.size, (128, 128))
assert_equal(im.format, "BMP")
lena("1").save(file)
im = Image.open(file)
lena("L").save(file)
im = Image.open(file)
lena("P").save(file)
im = Image.open(file)
lena("RGB").save(file)
im = Image.open(file)