TST: Barn-door testing of SaveButtons clicks

The canny_simple.py demo in viewer_examples/plugins has a save
button that raises an AttributeError in PIL because the button
click is passing 'False' to the SaveButtons.save_to_file function
when it expects a filename or None.
This commit is contained in:
Eric Dill
2015-03-18 17:30:43 -04:00
parent 6051ff215c
commit 8af43739c4
2 changed files with 7 additions and 2 deletions
+5
View File
@@ -101,6 +101,11 @@ def test_save_buttons():
timer = QtCore.QTimer()
timer.singleShot(100, QtGui.QApplication.quit)
# exercise the button clicks
sv.save_stack.click()
sv.save_file.click()
# call the save functions directly
sv.save_to_stack()
with expected_warnings(['precision loss']):
sv.save_to_file(filename)
+2 -2
View File
@@ -80,9 +80,9 @@ class SaveButtons(BaseWidget):
notify(msg)
def save_to_file(self, filename=None):
if filename is None:
if not filename:
filename = dialogs.save_file_dialog()
if filename is None:
if not filename:
return
image = self.plugin.filtered_image
if image.dtype == np.bool: