Skip to content

Commit

Permalink
Added QApplication.processEvents() to flush events
Browse files Browse the repository at this point in the history
  • Loading branch information
fedesemeraro committed Mar 20, 2024
1 parent fe5262e commit e1da8f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion arcjetCV/gui/custom_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MplCanvas(FigureCanvas):

def __init__(self, parent=None, width=5, height=4, dpi=100):
self.figure = Figure(figsize=(width, height), dpi=dpi)
self.figure.set_tight_layout(True)
self.figure.set_layout_engine('tight')
self.axes = self.figure.add_subplot(111)
super(MplCanvas, self).__init__(self.figure)

Expand Down
4 changes: 4 additions & 0 deletions tests/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,10 @@ def test_toggle_display_shock_checkbox(app, qtbot):
app.ui.checkBox_display_shock.setChecked(True)
initial_state = app.ui.checkBox_display_shock.isChecked()
qtbot.mouseClick(app.ui.checkBox_display_shock, Qt.LeftButton)
QApplication.processEvents()
assert app.ui.checkBox_display_shock.isChecked() != initial_state
qtbot.mouseClick(app.ui.checkBox_display_shock, Qt.LeftButton)
QApplication.processEvents()
assert app.ui.checkBox_display_shock.isChecked() == initial_state


Expand Down Expand Up @@ -411,8 +413,10 @@ def test_toggle_display_shock_2(app, qtbot, mocker):
app.ui.checkBox_display_shock2.setChecked(True)
initial_state = app.ui.checkBox_display_shock2.isChecked()
qtbot.mouseClick(app.ui.checkBox_display_shock2, Qt.LeftButton)
QApplication.processEvents()
assert app.ui.checkBox_display_shock2.isChecked() != initial_state
qtbot.mouseClick(app.ui.checkBox_display_shock2, Qt.LeftButton)
QApplication.processEvents()
assert app.ui.checkBox_display_shock2.isChecked() == initial_state


Expand Down

0 comments on commit e1da8f0

Please sign in to comment.