diff --git a/Tests/images/dispose_bgnd.gif b/Tests/images/dispose_bgnd.gif new file mode 100644 index 000000000..d68504010 Binary files /dev/null and b/Tests/images/dispose_bgnd.gif differ diff --git a/Tests/images/dispose_none.gif b/Tests/images/dispose_none.gif new file mode 100644 index 000000000..beeb13fd9 Binary files /dev/null and b/Tests/images/dispose_none.gif differ diff --git a/Tests/images/dispose_prev.gif b/Tests/images/dispose_prev.gif new file mode 100644 index 000000000..0de7760e9 Binary files /dev/null and b/Tests/images/dispose_prev.gif differ diff --git a/Tests/images/iss634.gif b/Tests/images/iss634.gif new file mode 100644 index 000000000..ba4e4566f Binary files /dev/null and b/Tests/images/iss634.gif differ diff --git a/Tests/test_file_gif.py b/Tests/test_file_gif.py index e31779df0..2aa7f1f3b 100644 --- a/Tests/test_file_gif.py +++ b/Tests/test_file_gif.py @@ -106,6 +106,50 @@ class TestFileGif(PillowTestCase): GifImagePlugin._save_netpbm(img, 0, tempfile) self.assert_image_similar(img, Image.open(tempfile).convert("L"), 0) + def test_seek(self): + img = Image.open("Tests/images/dispose_none.gif") + framecount = 0 + try: + while True: + framecount += 1 + img.seek(img.tell() +1) + except EOFError: + assert(framecount == 5) + + def test_dispose_none(self): + img = Image.open("Tests/images/dispose_none.gif") + try: + while True: + img.seek(img.tell() +1) + assert(img.disposal_method == 1) + except EOFError: + pass + + def test_dispose_background(self): + img = Image.open("Tests/images/dispose_bgnd.gif") + try: + while True: + img.seek(img.tell() +1) + assert(img.disposal_method == 2) + except EOFError: + pass + + def test_dispose_previous(self): + img = Image.open("Tests/images/dispose_prev.gif") + try: + while True: + img.seek(img.tell() +1) + assert(img.disposal_method == 3) + except EOFError: + pass + + def test_iss634(self): + img = Image.open("Tests/images/iss634.gif") + # seek to the second frame + img.seek(img.tell() +1) + # all transparent pixels should be replaced with the color from the first frame + assert(img.histogram()[img.info['transparency']] == 0) + if __name__ == '__main__': unittest.main()