Support (most of) test_image_split without PNG.

If PNG (zlib) support is disabled, use .pcx for test_image_split which
is unconditional. Since it does not support RGBA, skip the RGBA test.
Otherwise, just use PNG and do the full test.
This commit is contained in:
Michał Górny 2013-04-21 10:18:32 +02:00
parent 6cdc8b08db
commit e2221de8f5

View File

@ -30,7 +30,13 @@ def test_split_merge():
assert_image_equal(lena("YCbCr"), split_merge("YCbCr")) assert_image_equal(lena("YCbCr"), split_merge("YCbCr"))
def test_split_open(): def test_split_open():
file = tempfile("temp.png") codecs = dir(Image.core)
if 'zip_encoder' in codecs:
file = tempfile("temp.png")
else:
file = tempfile("temp.pcx")
def split_open(mode): def split_open(mode):
lena(mode).save(file) lena(mode).save(file)
im = Image.open(file) im = Image.open(file)
@ -39,4 +45,5 @@ def test_split_open():
assert_equal(split_open("L"), 1) assert_equal(split_open("L"), 1)
assert_equal(split_open("P"), 1) assert_equal(split_open("P"), 1)
assert_equal(split_open("RGB"), 3) assert_equal(split_open("RGB"), 3)
assert_equal(split_open("RGBA"), 4) if 'zip_encoder' in codecs:
assert_equal(split_open("RGBA"), 4)