diff --git a/test/__init__.py b/test/__init__.py index f4f6ab4..0972c4f 100644 --- a/test/__init__.py +++ b/test/__init__.py @@ -145,21 +145,21 @@ def run_with_fsleyes(func, *args, **kwargs): idle.idleLoop.allowErrors = True propagateRaise = kwargs.pop('propagateRaise', True) - startingDelay = kwargs.pop('startingDelay', 500) + startingDelay = kwargs.pop('startingDelay', 500) finishingDelay = kwargs.pop('finishingDelay', 250) - callAfterApp = kwargs.pop('callAfterApp', None) + callAfterApp = kwargs.pop('callAfterApp', None) class State(object): pass - state = State() - state.result = None - state.raised = None - state.frame = None - state.app = None - state.dummy = None - state.panel = None - - glver = os.environ.get('FSLEYES_TEST_GL', None) + state = State() + state.result = None + state.raised = None + state.frame = None + state.app = None + state.dummy = None + state.panel = None + + glver = os.environ.get('FSLEYES_TEST_GL', None) if glver is not None: glver = [int(v) for v in glver.split('.')] @@ -181,7 +181,7 @@ def finish(): def run(): overlayList = fsloverlay.OverlayList() - displayCtx = dc.DisplayContext(overlayList) + displayCtx = dc.DisplayContext(overlayList) state.frame = fslframe.FSLeyesFrame(None, overlayList, displayCtx) @@ -209,7 +209,7 @@ def run(): finally: wx.CallLater(finishingDelay, finish) - state.app = fslmain.FSLeyesApp() + state.app = fslmain.FSLeyesApp() state.dummy = wx.Frame(None) state.panel = wx.Panel(state.dummy) state.sizer = wx.BoxSizer(wx.HORIZONTAL) @@ -261,7 +261,7 @@ def run(): def run_with_viewpanel(func, vptype, *args, **kwargs): def inner(frame, overlayList, displayCtx, *a, **kwa): - panel = frame.addViewPanel(vptype) + panel = frame.addViewPanel(vptype) displayCtx = panel.displayCtx try: while not panel.IsShownOnScreen(): @@ -352,8 +352,10 @@ def GetEventObject(self): sim.MouseMove(round(x), round(y)) realYield() - if stype == 0: sim.MouseClick(btn) - elif stype == 1: sim.MouseDblClick(btn) + if stype == 0: + sim.MouseClick(btn) + elif stype == 1: + sim.MouseDblClick(btn) else: sim.MouseDown(btn) sim.MouseUp(btn) diff --git a/test/gui/test_tabs.py b/test/gui/test_tabs.py index 0c1542d..e7fbf60 100644 --- a/test/gui/test_tabs.py +++ b/test/gui/test_tabs.py @@ -71,12 +71,8 @@ def _test_st_plugin_dcm2niix_run(view, overlayList, displayCtx): widget.SetValue(tmp) realYield() - # Simulate a mouse click on the run button - sim = wx.UIActionSimulator() - for widget in list_widgets: - if isinstance(widget, wx.Button): - if widget.GetLabel() == 'Run': - simclick(sim, widget) + # Call the function ran when clicking run button + dcm2nifti_tab.run_component.run() # Search for files in the overlay for a maximum of 20s time_limit = 20 # s