mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-03-12 16:55:47 +03:00
Test using _seek to skip frames (#8804)
Co-authored-by: Andrew Murray <radarhere@users.noreply.github.com>
This commit is contained in:
parent
5ba72a9b54
commit
e946c7b14a
|
@ -34,8 +34,11 @@ def test_apng_basic() -> None:
|
||||||
with pytest.raises(EOFError):
|
with pytest.raises(EOFError):
|
||||||
im.seek(2)
|
im.seek(2)
|
||||||
|
|
||||||
# test rewind support
|
|
||||||
im.seek(0)
|
im.seek(0)
|
||||||
|
with pytest.raises(ValueError, match="cannot seek to frame 2"):
|
||||||
|
im._seek(2)
|
||||||
|
|
||||||
|
# test rewind support
|
||||||
assert im.getpixel((0, 0)) == (255, 0, 0, 255)
|
assert im.getpixel((0, 0)) == (255, 0, 0, 255)
|
||||||
assert im.getpixel((64, 32)) == (255, 0, 0, 255)
|
assert im.getpixel((64, 32)) == (255, 0, 0, 255)
|
||||||
im.seek(1)
|
im.seek(1)
|
||||||
|
|
|
@ -160,6 +160,9 @@ def test_seek() -> None:
|
||||||
|
|
||||||
assert_image_equal_tofile(im, "Tests/images/a_fli.png")
|
assert_image_equal_tofile(im, "Tests/images/a_fli.png")
|
||||||
|
|
||||||
|
with pytest.raises(ValueError, match="cannot seek to frame 52"):
|
||||||
|
im._seek(52)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize(
|
@pytest.mark.parametrize(
|
||||||
"test_file",
|
"test_file",
|
||||||
|
|
|
@ -410,6 +410,10 @@ def test_seek() -> None:
|
||||||
except EOFError:
|
except EOFError:
|
||||||
assert frame_count == 5
|
assert frame_count == 5
|
||||||
|
|
||||||
|
img.seek(0)
|
||||||
|
with pytest.raises(ValueError, match="cannot seek to frame 2"):
|
||||||
|
img._seek(2)
|
||||||
|
|
||||||
|
|
||||||
def test_seek_info() -> None:
|
def test_seek_info() -> None:
|
||||||
with Image.open("Tests/images/iss634.gif") as im:
|
with Image.open("Tests/images/iss634.gif") as im:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user