Only test alpha channel values

This commit is contained in:
Andrew Murray 2022-05-28 09:24:42 +10:00
parent 84da70988f
commit b0bc74a297

View File

@ -222,18 +222,18 @@ def test_p_la():
assert_image_similar(alpha, comparable, 5) assert_image_similar(alpha, comparable, 5)
def test_p_pa(): def test_p2pa_alpha():
with Image.open("Tests/images/tiny.png") as im: with Image.open("Tests/images/tiny.png") as im:
assert im.mode == "P" assert im.mode == "P"
im_pa = im.convert("PA") im_pa = im.convert("PA")
assert im_pa.mode == "PA" assert im_pa.mode == "PA"
assert ( im_a = im_pa.getchannel("A")
im_pa.tobytes() == b"\x00\x00\x00\x00\x08\xff\x04\xff\x00\x00\x00\x00" for x in range(4):
b"\x06\xff\x07\xff\x00\x00\x00\x00\x02\xff\x03\xff\x00" alpha = 255 if x > 1 else 0
b"\x00\x00\x00\x01\xff\x05\xff" for y in range(4):
) assert im_a.getpixel((x, y)) == alpha
def test_matrix_illegal_conversion(): def test_matrix_illegal_conversion():