Skip to content

Commit

Permalink
Add the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
po09i committed Sep 12, 2023
1 parent 1cbd3d4 commit 4bb4ae0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 22 deletions.
34 changes: 18 additions & 16 deletions test/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('.')]

Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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():
Expand Down Expand Up @@ -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)
Expand Down
8 changes: 2 additions & 6 deletions test/gui/test_tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4bb4ae0

Please sign in to comment.