Skip to content

Commit

Permalink
fix timed-message-box test
Browse files Browse the repository at this point in the history
  • Loading branch information
marsipu committed Sep 24, 2023
1 parent bbf002c commit 8fc02b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mne_pipeline_hd/gui/base_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -1467,8 +1467,8 @@ def _update_timeout_text(self):
self.setText(f"{text}\nTimeout: {self.timeout}")

def countdown(self):
self.timeout -= 1
self._update_timeout_text()
self.timeout -= 1
if self.timeout <= 0:
self.timer.stop()
if self.defaultButton() is not None:
Expand Down
6 changes: 3 additions & 3 deletions mne_pipeline_hd/tests/test_base_widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ def test_timed_messagebox(qtbot):
timed_messagebox = TimedMessageBox(timeout=2, step_length=100, text="Test")
qtbot.addWidget(timed_messagebox)

qtbot.wait(150)
qtbot.waitForWindowShown(timed_messagebox)
# For some reason Windows-CI seems to fail here,
# maybe timed_messagebox.show() is blocking there
assert timed_messagebox.text() == "Test\nTimeout: 1"
assert timed_messagebox.text() == "Test\nTimeout: 2"

# Test messagebox properly closes
qtbot.wait(250)
Expand All @@ -65,5 +65,5 @@ def test_timed_messagebox(qtbot):
ans = TimedMessageBox.information(
1, buttons=TimedMessageBox.Cancel, defaultButton=TimedMessageBox.NoButton
)
qtbot.wait(110)
qtbot.wait(150)
assert ans is None

0 comments on commit 8fc02b6

Please sign in to comment.