mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-04 13:40:54 +03:00
Added test
This commit is contained in:
parent
b06669f670
commit
bc8cd5fabf
|
@ -285,7 +285,7 @@ class TestFileGif(PillowTestCase):
|
||||||
im_list = [
|
im_list = [
|
||||||
Image.new('L', (100, 100), '#000'),
|
Image.new('L', (100, 100), '#000'),
|
||||||
Image.new('L', (100, 100), '#111'),
|
Image.new('L', (100, 100), '#111'),
|
||||||
Image.new('L', (100, 100), '#222'),
|
Image.new('L', (100, 100), '#222')
|
||||||
]
|
]
|
||||||
|
|
||||||
#duration as list
|
#duration as list
|
||||||
|
@ -320,7 +320,31 @@ class TestFileGif(PillowTestCase):
|
||||||
except EOFError:
|
except EOFError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def test_identical_frames(self):
|
||||||
|
duration_list = [1000, 1500, 2000, 4000]
|
||||||
|
|
||||||
|
out = self.tempfile('temp.gif')
|
||||||
|
im_list = [
|
||||||
|
Image.new('L', (100, 100), '#000'),
|
||||||
|
Image.new('L', (100, 100), '#000'),
|
||||||
|
Image.new('L', (100, 100), '#000'),
|
||||||
|
Image.new('L', (100, 100), '#111')
|
||||||
|
]
|
||||||
|
|
||||||
|
#duration as list
|
||||||
|
im_list[0].save(
|
||||||
|
out,
|
||||||
|
save_all=True,
|
||||||
|
append_images=im_list[1:],
|
||||||
|
duration=duration_list
|
||||||
|
)
|
||||||
|
reread = Image.open(out)
|
||||||
|
|
||||||
|
# Assert that the first three frames were combined
|
||||||
|
self.assertEqual(reread.n_frames, 2)
|
||||||
|
|
||||||
|
# Assert that the new duration is the total of the identical frames
|
||||||
|
self.assertEqual(reread.info['duration'], 4500)
|
||||||
|
|
||||||
def test_number_of_loops(self):
|
def test_number_of_loops(self):
|
||||||
number_of_loops = 2
|
number_of_loops = 2
|
||||||
|
|
Loading…
Reference in New Issue
Block a user