mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-09-24 04:56:57 +03:00
Test transparency
This commit is contained in:
parent
eef4848a0a
commit
b90fe802ce
|
@ -1,5 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
from io import BytesIO
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import GdImageFile, UnidentifiedImageError
|
||||
|
@ -16,6 +18,14 @@ def test_sanity() -> None:
|
|||
assert_image_similar_tofile(im.convert("RGB"), "Tests/images/hopper.jpg", 14)
|
||||
|
||||
|
||||
def test_transparency() -> None:
|
||||
with open(TEST_GD_FILE, "rb") as fp:
|
||||
data = bytearray(fp.read())
|
||||
data[7:11] = b"\x00\x00\x00\x05"
|
||||
with GdImageFile.open(BytesIO(data)) as im:
|
||||
assert im.info["transparency"] == 5
|
||||
|
||||
|
||||
def test_bad_mode() -> None:
|
||||
with pytest.raises(ValueError):
|
||||
GdImageFile.open(TEST_GD_FILE, "bad mode")
|
||||
|
|
Loading…
Reference in New Issue
Block a user