From e1da8f02938c15da57f2328b5fa83d4bb664c4c5 Mon Sep 17 00:00:00 2001 From: fsemerar Date: Wed, 20 Mar 2024 08:43:47 -0700 Subject: [PATCH] Added QApplication.processEvents() to flush events --- arcjetCV/gui/custom_classes.py | 2 +- tests/test_gui.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/arcjetCV/gui/custom_classes.py b/arcjetCV/gui/custom_classes.py index 903b536..bbd2aa7 100644 --- a/arcjetCV/gui/custom_classes.py +++ b/arcjetCV/gui/custom_classes.py @@ -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) diff --git a/tests/test_gui.py b/tests/test_gui.py index ecb0e73..7a4c30d 100644 --- a/tests/test_gui.py +++ b/tests/test_gui.py @@ -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 @@ -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