-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Have CopyDebugInfoButton change text to
Copied...
on click
This commit refactors the copydebuginfobutton in run_dialog.py into its own class, and makes it change text `Copy Debug Info" -> `Copied...` when clicked while running the callback passed to it. After one second, it changes it text back to `Copy Debug Info`.
- Loading branch information
1 parent
8c312f2
commit 3b1db99
Showing
2 changed files
with
53 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/ert/unit_tests/gui/ertwidgets/test_copy_debug_info_button.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
from pytestqt.qtbot import QtBot | ||
from qtpy.QtCore import Qt | ||
|
||
from ert.gui.simulation.run_dialog import CopyDebugInfoButton | ||
|
||
|
||
def test_copy_debug_info_button_alterates_text_when_pressed(qtbot: QtBot): | ||
button_clicked = False | ||
|
||
def on_click(): | ||
nonlocal button_clicked | ||
button_clicked = True | ||
|
||
button = CopyDebugInfoButton(on_click=on_click) | ||
qtbot.addWidget(button) | ||
|
||
assert button.text() == CopyDebugInfoButton._initial_text | ||
qtbot.mouseClick(button, Qt.MouseButton.LeftButton) | ||
assert button.text() == CopyDebugInfoButton._clicked_text | ||
qtbot.wait_until( | ||
lambda: button.text() == CopyDebugInfoButton._initial_text, timeout=2000 | ||
) | ||
assert button_clicked |