From 5b5d47863efb7a553767885d7c0ce861541ffcb0 Mon Sep 17 00:00:00 2001 From: linnil1 Date: Tue, 31 Jan 2017 15:22:54 +0800 Subject: [PATCH] Add dispose test --- Tests/test_file_gif.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index 2ca234173..9e6db85f6 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -259,6 +259,28 @@ class TestFileGif(PillowTestCase): except EOFError: pass + def test_save_dispose(self): + out = self.tempfile('temp.gif') + im_list = [ + Image.new('L', (100, 100), '#000'), + Image.new('L', (100, 100), '#111'), + Image.new('L', (100, 100), '#222'), + ] + for method in range(0,4): + im_list[0].save( + out, + save_all=True, + append_images=im_list[1:], + disposal=method + ) + img = Image.open(out) + try: + while True: + img.seek(img.tell() + 1) + self.assertEqual(img.disposal_method, method) + except EOFError: + pass + def test_iss634(self): img = Image.open("Tests/images/iss634.gif") # seek to the second frame