forked from equinor/ert
-
Notifications
You must be signed in to change notification settings - Fork 0
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
d294930
commit f48a33c
Showing
2 changed files
with
46 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
21 changes: 21 additions & 0 deletions
21
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,21 @@ | ||
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) | ||
initial_button_text = button.text() | ||
assert initial_button_text == "Copy Debug Info" | ||
qtbot.mouseClick(button, Qt.MouseButton.LeftButton) | ||
assert button.text() == "Copied..." | ||
qtbot.wait_until(lambda: button.text() == initial_button_text, timeout=2000) | ||
assert button_clicked |