mirror of
https://github.com/bec-project/bec_widgets.git
synced 2026-11-27 19:47:58 +01:00
fix(scan_control): restore confirms a typed scan name like start
This commit is contained in:
1 parent
b3b3615dcb
commit
850a6d57f6
2 files changed
+13
-1
No files matched your search
@@ -488,7 +488,9 @@ class ScanControl(BECWidget, QWidget):
|
||||
"""
|
||||
if not self.last_scan_button.isEnabled():
|
||||
return
|
||||
# A scan name that is typed but not confirmed yet must not be fetched.
|
||||
# Like Start: confirm a typed scan name (or fall back to the selected scan) first, also
|
||||
# when the click did not take the focus from the selector, e.g. with its popup open.
|
||||
self.validate_scan_selection()
|
||||
current_scan = self.current_scan
|
||||
if not current_scan:
|
||||
# e.g. an empty selector after a filter change - nothing to restore
|
||||
|
||||
@@ -1079,6 +1079,16 @@ def test_run_scan_confirms_typed_scan_name(scan_control, qtbot):
|
||||
scans.grid_scan.assert_called_once_with()
|
||||
|
||||
|
||||
@pytest.mark.parametrize("typed, fetched", [("grid_scan", "grid_scan"), ("grid_sca", "line_scan")])
|
||||
def test_restore_last_scan_parameters_confirms_typed_scan_name(scan_control, qtbot, typed, fetched):
|
||||
_type_scan_name(qtbot, scan_control, typed)
|
||||
with patch.object(scan_control, "submit_task") as submit:
|
||||
scan_control.request_last_executed_scan_parameters()
|
||||
|
||||
assert scan_control.current_scan == fetched
|
||||
assert submit.call_args.args[2] == fetched # (fetch, generation, scan name)
|
||||
|
||||
|
||||
def test_run_scan_discards_unfinished_scan_name(scan_control, qtbot):
|
||||
combo = scan_control.comboBox_scan_selection
|
||||
_type_scan_name(qtbot, scan_control, "grid_sca")
|
||||
|
||||
Reference in new issue
Block a user