Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions Tests/test_file_ftex.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
from __future__ import annotations

import io
import struct

import pytest

from PIL import FtexImagePlugin, Image
Expand All @@ -23,3 +26,15 @@

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

Check warning on line 40 in Tests/test_file_ftex.py

View check run for this annotation

Codecov / codecov/patch

Tests/test_file_ftex.py#L40

Added line #L40 was not covered by tests
Loading