Skip to content
Snippets Groups Projects
Commit 37f0f376 authored by Oscar Gustafsson's avatar Oscar Gustafsson :bicyclist:
Browse files

Increase test coverage and fix issue with removing op from GUI dict

parent a6f817cb
No related branches found
No related tags found
No related merge requests found
Pipeline #88133 passed
......@@ -222,5 +222,8 @@ class DragButton(QPushButton):
if self in self._window.pressed_operations:
self._window.pressed_operations.remove(self)
if self in self._window.dragOperationSceneDict.keys():
if self in self._window.dragOperationSceneDict:
del self._window.dragOperationSceneDict[self]
if self.operation in self._window.operationDragDict:
del self._window.operationDragDict[self.operation]
......@@ -23,3 +23,32 @@ def test_load(qtbot, datadir):
assert not widget.sfg_dict
widget.exit_app()
def test_flip(qtbot, datadir):
widget = GUI.MainWindow()
qtbot.addWidget(widget)
widget._load_from_file(datadir.join('twotapfir.py'))
sfg = widget.sfg_dict['twotapfir']
op = sfg.find_by_name("cmul2")
dragbutton = widget.operationDragDict[op[0]]
assert not dragbutton.is_flipped()
dragbutton._flip()
assert dragbutton.is_flipped()
widget.exit_app()
def test_sfg_invalidated_by_remove_of_operation(qtbot, datadir):
widget = GUI.MainWindow()
qtbot.addWidget(widget)
widget._load_from_file(datadir.join('twotapfir.py'))
sfg = widget.sfg_dict['twotapfir']
ops_before_remove = len(widget.operationDragDict)
op = sfg.find_by_name("cmul2")
dragbutton = widget.operationDragDict[op[0]]
dragbutton.remove()
assert not widget.sfg_dict
assert ops_before_remove -1 == len(widget.operationDragDict)
widget.exit_app()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment