mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Use more descriptive button labels in update check prompt
This commit is contained in:
parent
5acb96884a
commit
53115b3ffa
2 changed files with 23 additions and 9 deletions
|
@ -32,11 +32,11 @@ log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
MSG_CONFIRM_UPDATE_CHECKS = """\
|
MSG_CONFIRM_UPDATE_CHECKS = """\
|
||||||
<p><b>Do you want to be notified about new Dangerzone releases?</b></p>
|
<p><b>Do you want Dangerzone to automatically check for updates?</b></p>
|
||||||
|
|
||||||
<p>If <i>"Yes"</i>, Dangerzone will check the
|
<p>If you accept, Dangerzone will check the
|
||||||
<a href="https://github.com/freedomofpress/dangerzone/releases">latest releases page</a>
|
<a href="https://github.com/freedomofpress/dangerzone/releases">latest releases page</a>
|
||||||
in github.com on startup. If <i>"No"</i>, Dangerzone will make no network requests and
|
in github.com on startup. Otherwise it will make no network requests and
|
||||||
won't inform you about new releases.</p>
|
won't inform you about new releases.</p>
|
||||||
|
|
||||||
<p>If you prefer another way of getting notified about new releases, we suggest adding
|
<p>If you prefer another way of getting notified about new releases, we suggest adding
|
||||||
|
@ -140,8 +140,8 @@ class UpdaterThread(QtCore.QThread):
|
||||||
prompt = UpdateCheckPrompt(
|
prompt = UpdateCheckPrompt(
|
||||||
self.dangerzone,
|
self.dangerzone,
|
||||||
message=MSG_CONFIRM_UPDATE_CHECKS,
|
message=MSG_CONFIRM_UPDATE_CHECKS,
|
||||||
ok_text="Yes",
|
ok_text="Check Automatically",
|
||||||
cancel_text="No",
|
cancel_text="Don't Check",
|
||||||
)
|
)
|
||||||
check = prompt.launch()
|
check = prompt.launch()
|
||||||
if not check and prompt.x_pressed:
|
if not check and prompt.x_pressed:
|
||||||
|
|
|
@ -400,8 +400,22 @@ def test_update_check_prompt(
|
||||||
qt_updater.dangerzone.settings.set("updater_last_check", 0)
|
qt_updater.dangerzone.settings.set("updater_last_check", 0)
|
||||||
|
|
||||||
# Test 1 - Check that on the second run of Dangerzone, the user is prompted to
|
# Test 1 - Check that on the second run of Dangerzone, the user is prompted to
|
||||||
# choose if they want to enable update checks. By clicking on, we store this
|
# choose if they want to enable update checks.
|
||||||
# decision in the settings.
|
def check_button_labels() -> None:
|
||||||
|
dialog = qt_updater.dangerzone.app.activeWindow()
|
||||||
|
assert dialog.ok_button.text() == "Check Automatically" # type: ignore [attr-defined]
|
||||||
|
assert dialog.cancel_button.text() == "Don't Check" # type: ignore [attr-defined]
|
||||||
|
dialog.ok_button.click() # type: ignore [attr-defined]
|
||||||
|
|
||||||
|
QtCore.QTimer.singleShot(500, check_button_labels)
|
||||||
|
res = qt_updater.should_check_for_updates()
|
||||||
|
|
||||||
|
assert res == True
|
||||||
|
|
||||||
|
# Test 2 - Check that when the user chooses to enable update checks, we
|
||||||
|
# store that decision in the settings.
|
||||||
|
qt_updater.check = None
|
||||||
|
|
||||||
def click_ok() -> None:
|
def click_ok() -> None:
|
||||||
dialog = qt_updater.dangerzone.app.activeWindow()
|
dialog = qt_updater.dangerzone.app.activeWindow()
|
||||||
dialog.ok_button.click() # type: ignore [attr-defined]
|
dialog.ok_button.click() # type: ignore [attr-defined]
|
||||||
|
@ -412,7 +426,7 @@ def test_update_check_prompt(
|
||||||
assert res == True
|
assert res == True
|
||||||
assert qt_updater.check == True
|
assert qt_updater.check == True
|
||||||
|
|
||||||
# Test 2 - Same as the previous test, but check that clicking on cancel stores the
|
# Test 3 - Same as the previous test, but check that clicking on cancel stores the
|
||||||
# opposite decision.
|
# opposite decision.
|
||||||
qt_updater.check = None
|
qt_updater.check = None
|
||||||
|
|
||||||
|
@ -426,7 +440,7 @@ def test_update_check_prompt(
|
||||||
assert res == False
|
assert res == False
|
||||||
assert qt_updater.check == False
|
assert qt_updater.check == False
|
||||||
|
|
||||||
# Test 3 - Same as the previous test, but check that clicking on "X" does not store
|
# Test 4 - Same as the previous test, but check that clicking on "X" does not store
|
||||||
# any decision.
|
# any decision.
|
||||||
qt_updater.check = None
|
qt_updater.check = None
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue