mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 21:50:54 +03:00
Tests for issue #523
This commit is contained in:
parent
b0f8f49880
commit
a3371ee9fe
|
@ -2,29 +2,30 @@ from tester import *
|
||||||
|
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
|
||||||
|
|
||||||
|
def _roundtrip(im):
|
||||||
|
f = tempfile("temp.pcx")
|
||||||
|
im.save(f)
|
||||||
|
im2 = Image.open(f)
|
||||||
|
|
||||||
|
assert_equal(im2.mode, im.mode)
|
||||||
|
assert_equal(im2.size, im.size)
|
||||||
|
assert_equal(im2.format, "PCX")
|
||||||
|
assert_image_equal(im2, im)
|
||||||
|
|
||||||
def test_sanity():
|
def test_sanity():
|
||||||
|
for mode in ('1', 'L', 'P', 'RGB'):
|
||||||
|
_roundtrip(lena(mode))
|
||||||
|
|
||||||
file = tempfile("temp.pcx")
|
def test_odd():
|
||||||
|
# see issue #523, odd sized images should have a stride that's even.
|
||||||
lena("1").save(file)
|
# not that imagemagick or gimp write pcx that way.
|
||||||
|
# we were not handling properly.
|
||||||
im = Image.open(file)
|
for mode in ('1', 'L', 'P', 'RGB'):
|
||||||
im.load()
|
# larger, odd sized images are better here to ensure that
|
||||||
assert_equal(im.mode, "1")
|
# we handle interrupted scan lines properly.
|
||||||
assert_equal(im.size, (128, 128))
|
_roundtrip(lena(mode).resize((511,511)))
|
||||||
assert_equal(im.format, "PCX")
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
def test_pil184():
|
def test_pil184():
|
||||||
# Check reading of files where xmin/xmax is not zero.
|
# Check reading of files where xmin/xmax is not zero.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user