mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-25 01:16:16 +03:00
Added UnixViewer get_command
This commit is contained in:
parent
e3d5494a51
commit
a0be7b09cc
|
@ -14,6 +14,9 @@ class TestImageShow(PillowTestCase):
|
|||
# Test registering a viewer that is not a class
|
||||
ImageShow.register("not a class")
|
||||
|
||||
# Restore original state
|
||||
ImageShow._viewers.pop()
|
||||
|
||||
def test_show(self):
|
||||
class TestViewer:
|
||||
methodCalled = False
|
||||
|
@ -28,6 +31,9 @@ class TestImageShow(PillowTestCase):
|
|||
self.assertTrue(ImageShow.show(im))
|
||||
self.assertTrue(viewer.methodCalled)
|
||||
|
||||
# Restore original state
|
||||
ImageShow._viewers.pop(0)
|
||||
|
||||
def test_viewer(self):
|
||||
viewer = ImageShow.Viewer()
|
||||
|
||||
|
@ -35,6 +41,10 @@ class TestImageShow(PillowTestCase):
|
|||
|
||||
self.assertRaises(NotImplementedError, viewer.get_command, None)
|
||||
|
||||
def test_viewers(self):
|
||||
for viewer in ImageShow._viewers:
|
||||
viewer.get_command('test.jpg')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
|
|
@ -148,12 +148,9 @@ else:
|
|||
format = "PNG"
|
||||
options = {'compress_level': 1}
|
||||
|
||||
def show_file(self, file, **options):
|
||||
command, executable = self.get_command_ex(file, **options)
|
||||
command = "(%s %s; rm -f %s)&" % (command, quote(file),
|
||||
quote(file))
|
||||
os.system(command)
|
||||
return 1
|
||||
def get_command(self, file, **options):
|
||||
command = self.get_command_ex(file, **options)[0]
|
||||
return "(%s %s; rm -f %s)&" % (command, quote(file), quote(file))
|
||||
|
||||
# implementations
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user