mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-13 01:05:48 +03:00
Merge pull request #8766 from radarhere/ftex_test
Improved FtexImagePlugin test coverage
This commit is contained in:
commit
952d6e9a61
|
@ -1,5 +1,8 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import struct
|
||||
|
||||
import pytest
|
||||
|
||||
from PIL import FtexImagePlugin, Image
|
||||
|
@ -23,3 +26,15 @@ def test_invalid_file() -> None:
|
|||
|
||||
with pytest.raises(SyntaxError):
|
||||
FtexImagePlugin.FtexImageFile(invalid_file)
|
||||
|
||||
|
||||
def test_invalid_texture() -> None:
|
||||
with open("Tests/images/ftex_dxt1.ftc", "rb") as fp:
|
||||
data = fp.read()
|
||||
|
||||
# Change texture compression format
|
||||
data = data[:24] + struct.pack("<i", 2) + data[28:]
|
||||
|
||||
with pytest.raises(ValueError, match="Invalid texture compression format: 2"):
|
||||
with Image.open(io.BytesIO(data)):
|
||||
pass
|
||||
|
|
Loading…
Reference in New Issue
Block a user