mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-12 04:25:08 +08:00
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:
@@ -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)
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user