Increased test coverage

This commit is contained in:
Andrew Murray 2019-05-26 07:52:32 +10:00
parent 848a629784
commit e8af68bae2

View File

@ -18,18 +18,19 @@ class TestImageShow(PillowTestCase):
ImageShow._viewers.pop()
def test_show(self):
class TestViewer:
class TestViewer(ImageShow.Viewer):
methodCalled = False
def show(self, image, title=None, **options):
def show_image(self, image, **options):
self.methodCalled = True
return True
viewer = TestViewer()
ImageShow.register(viewer, -1)
im = hopper()
self.assertTrue(ImageShow.show(im))
self.assertTrue(viewer.methodCalled)
for mode in ("1", "I;16", "LA", "RGB", "RGBA"):
im = hopper(mode)
self.assertTrue(ImageShow.show(im))
self.assertTrue(viewer.methodCalled)
# Restore original state
ImageShow._viewers.pop(0)