Skip to content

Commit 73646ad

Browse files
authored
Merge pull request #6243 from radarhere/webp
Test invalid WebP background colors
2 parents 7c9fa63 + f64dd53 commit 73646ad

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Tests/test_file_webp.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ def test_file_pointer_could_be_reused(self):
185185
Image.open(blob).load()
186186
Image.open(blob).load()
187187

188+
@pytest.mark.parametrize(
189+
"background",
190+
(0, (0,), (-1, 0, 1, 2), (253, 254, 255, 256)),
191+
)
192+
@skip_unless_feature("webp_anim")
193+
def test_invalid_background(self, background, tmp_path):
194+
temp_file = str(tmp_path / "temp.webp")
195+
im = hopper()
196+
with pytest.raises(OSError):
197+
im.save(temp_file, save_all=True, append_images=[im], background=background)
198+
188199
@skip_unless_feature("webp_anim")
189200
def test_background_from_gif(self, tmp_path):
190201
# Save L mode GIF with background

0 commit comments

Comments
 (0)