mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-13 02:36:17 +03:00
Do not update frame position until local image is found
This commit is contained in:
parent
c456aecb12
commit
c8118438ae
BIN
Tests/images/comment_after_last_frame.gif
Normal file
BIN
Tests/images/comment_after_last_frame.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
|
@ -341,16 +341,23 @@ def test_seek_rewind():
|
||||||
assert_image_equal(im, expected)
|
assert_image_equal(im, expected)
|
||||||
|
|
||||||
|
|
||||||
def test_n_frames():
|
@pytest.mark.parametrize(
|
||||||
for path, n_frames in [[TEST_GIF, 1], ["Tests/images/iss634.gif", 42]]:
|
"path, n_frames",
|
||||||
# Test is_animated before n_frames
|
(
|
||||||
with Image.open(path) as im:
|
(TEST_GIF, 1),
|
||||||
assert im.is_animated == (n_frames != 1)
|
("Tests/images/comment_after_last_frame.gif", 2),
|
||||||
|
("Tests/images/iss634.gif", 42),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
def test_n_frames(path, n_frames):
|
||||||
|
# Test is_animated before n_frames
|
||||||
|
with Image.open(path) as im:
|
||||||
|
assert im.is_animated == (n_frames != 1)
|
||||||
|
|
||||||
# Test is_animated after n_frames
|
# Test is_animated after n_frames
|
||||||
with Image.open(path) as im:
|
with Image.open(path) as im:
|
||||||
assert im.n_frames == n_frames
|
assert im.n_frames == n_frames
|
||||||
assert im.is_animated == (n_frames != 1)
|
assert im.is_animated == (n_frames != 1)
|
||||||
|
|
||||||
|
|
||||||
def test_no_change():
|
def test_no_change():
|
||||||
|
|
|
@ -183,8 +183,6 @@ class GifImageFile(ImageFile.ImageFile):
|
||||||
if not s or s == b";":
|
if not s or s == b";":
|
||||||
raise EOFError
|
raise EOFError
|
||||||
|
|
||||||
self.__frame = frame
|
|
||||||
|
|
||||||
self.tile = []
|
self.tile = []
|
||||||
|
|
||||||
palette = None
|
palette = None
|
||||||
|
@ -283,6 +281,8 @@ class GifImageFile(ImageFile.ImageFile):
|
||||||
if interlace is None:
|
if interlace is None:
|
||||||
# self.__fp = None
|
# self.__fp = None
|
||||||
raise EOFError
|
raise EOFError
|
||||||
|
|
||||||
|
self.__frame = frame
|
||||||
if not update_image:
|
if not update_image:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user