mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Tests for #510
This commit is contained in:
parent
a190d64165
commit
89c24e971c
|
@ -55,4 +55,45 @@ def test_rgba_p():
|
|||
|
||||
assert_image_similar(im, comparable, 20)
|
||||
|
||||
def test_trns_p():
|
||||
im = lena('P')
|
||||
im.info['transparency']=0
|
||||
|
||||
f = tempfile('temp.png')
|
||||
|
||||
l = im.convert('L')
|
||||
assert_equal(l.info['transparency'], 0) # undone
|
||||
assert_no_exception(lambda: l.save(f))
|
||||
|
||||
|
||||
rgb = im.convert('RGB')
|
||||
assert_equal(rgb.info['transparency'], (0,0,0)) # undone
|
||||
assert_no_exception(lambda: rgb.save(f))
|
||||
|
||||
def test_trns_l():
|
||||
im = lena('L')
|
||||
im.info['transparency'] = 128
|
||||
|
||||
f = tempfile('temp.png')
|
||||
|
||||
rgb = im.convert('RGB')
|
||||
assert_equal(rgb.info['transparency'], (128,128,128)) # undone
|
||||
assert_no_exception(lambda: rgb.save(f))
|
||||
|
||||
p = im.convert('P')
|
||||
assert_true('transparency' in p.info)
|
||||
assert_no_exception(lambda: p.save(f))
|
||||
|
||||
def test_trns_RGB():
|
||||
im = lena('RGB')
|
||||
im.info['transparency'] = im.getpixel((0,0))
|
||||
|
||||
f = tempfile('temp.png')
|
||||
|
||||
l = im.convert('L')
|
||||
assert_equal(l.info['transparency'], l.getpixel((0,0))) # undone
|
||||
assert_no_exception(lambda: l.save(f))
|
||||
|
||||
p = im.convert('P')
|
||||
assert_true('transparency' in p.info)
|
||||
assert_no_exception(lambda: p.save(f))
|
||||
|
|
Loading…
Reference in New Issue
Block a user