mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-10-01 03:18:16 +03:00
test: isolate exit confirmation translation
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -795,25 +795,35 @@ class ApplicationLifecycleTransactionTest(TestCase):
|
||||
messageBoxType.StandardButton = AppQMessageBox.StandardButton
|
||||
mainWindow = mock.Mock()
|
||||
closeEvent = mock.Mock()
|
||||
translatedQuestion = 'Translated exit question'
|
||||
application = SimpleNamespace(
|
||||
mainWindow=mainWindow,
|
||||
systemTray=None,
|
||||
exit=mock.Mock(),
|
||||
)
|
||||
|
||||
with mock.patch(
|
||||
'Furious.Application.DesktopApplication.AppQMessageBox',
|
||||
messageBoxType,
|
||||
with (
|
||||
mock.patch(
|
||||
'Furious.Application.DesktopApplication.AppQMessageBox',
|
||||
messageBoxType,
|
||||
),
|
||||
mock.patch(
|
||||
'Furious.Application.DesktopApplication._',
|
||||
return_value=translatedQuestion,
|
||||
) as translate,
|
||||
):
|
||||
filtered = DesktopApplication._handleMainWindowCloseEvent(
|
||||
application,
|
||||
closeEvent,
|
||||
)
|
||||
|
||||
translate.assert_called_once_with(
|
||||
'Are you sure you want to exit the application?'
|
||||
)
|
||||
messageBoxType.assert_called_once_with(
|
||||
icon=AppQMessageBox.Icon.Question,
|
||||
parent=mainWindow,
|
||||
text='Are you sure you want to exit the application?',
|
||||
text=translatedQuestion,
|
||||
buttons=(
|
||||
AppQMessageBox.StandardButton.Yes | AppQMessageBox.StandardButton.No
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user