Merge lp:~raoul-snyman/openlp/mac-niggles into lp:openlp
- mac-niggles
- Merge into trunk
Status: | Merged | ||||||||
---|---|---|---|---|---|---|---|---|---|
Merged at revision: | 2711 | ||||||||
Proposed branch: | lp:~raoul-snyman/openlp/mac-niggles | ||||||||
Merge into: | lp:openlp | ||||||||
Diff against target: |
272 lines (+95/-22) 6 files modified
openlp/core/__init__.py (+17/-5) openlp/core/common/settings.py (+3/-3) openlp/core/ui/mainwindow.py (+8/-11) openlp/core/ui/themewizard.py (+1/-1) tests/functional/openlp_core_ui/test_shortcutlistdialog.py (+60/-0) tests/functional/test_init.py (+6/-2) |
||||||||
To merge this branch: | bzr merge lp:~raoul-snyman/openlp/mac-niggles | ||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Tim Bentley | Approve | ||
Review via email: mp+313403@code.launchpad.net |
Commit message
Description of the change
Fix segfault on click on a spinner on macOS
Fix spurious traceback on some platforms or configurations of media players
Make the tab style affect only the media library tabs, not everything else too
Hide the splash screen when the backup dialog shows and when the exception form shows
Add this to your merge proposal:
-------
lp:~raoul-snyman/openlp/mac-niggles (revision 2713)
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
[SUCCESS] https:/
Tim Bentley (trb143) : | # |
Preview Diff
1 | === modified file 'openlp/core/__init__.py' | |||
2 | --- openlp/core/__init__.py 2016-11-21 20:21:31 +0000 | |||
3 | +++ openlp/core/__init__.py 2016-12-15 22:20:16 +0000 | |||
4 | @@ -129,21 +129,21 @@ | |||
5 | 129 | application_stylesheet += WIN_REPAIR_STYLESHEET | 129 | application_stylesheet += WIN_REPAIR_STYLESHEET |
6 | 130 | if application_stylesheet: | 130 | if application_stylesheet: |
7 | 131 | self.setStyleSheet(application_stylesheet) | 131 | self.setStyleSheet(application_stylesheet) |
10 | 132 | show_splash = Settings().value('core/show splash') | 132 | can_show_splash = Settings().value('core/show splash') |
11 | 133 | if show_splash: | 133 | if can_show_splash: |
12 | 134 | self.splash = SplashScreen() | 134 | self.splash = SplashScreen() |
13 | 135 | self.splash.show() | 135 | self.splash.show() |
14 | 136 | # make sure Qt really display the splash screen | 136 | # make sure Qt really display the splash screen |
15 | 137 | self.processEvents() | 137 | self.processEvents() |
16 | 138 | # Check if OpenLP has been upgrade and if a backup of data should be created | 138 | # Check if OpenLP has been upgrade and if a backup of data should be created |
18 | 139 | self.backup_on_upgrade(has_run_wizard) | 139 | self.backup_on_upgrade(has_run_wizard, can_show_splash) |
19 | 140 | # start the main app window | 140 | # start the main app window |
20 | 141 | self.main_window = MainWindow() | 141 | self.main_window = MainWindow() |
21 | 142 | Registry().execute('bootstrap_initialise') | 142 | Registry().execute('bootstrap_initialise') |
22 | 143 | Registry().execute('bootstrap_post_set_up') | 143 | Registry().execute('bootstrap_post_set_up') |
23 | 144 | Registry().initialise = False | 144 | Registry().initialise = False |
24 | 145 | self.main_window.show() | 145 | self.main_window.show() |
26 | 146 | if show_splash: | 146 | if can_show_splash: |
27 | 147 | # now kill the splashscreen | 147 | # now kill the splashscreen |
28 | 148 | self.splash.finish(self.main_window) | 148 | self.splash.finish(self.main_window) |
29 | 149 | log.debug('Splashscreen closed') | 149 | log.debug('Splashscreen closed') |
30 | @@ -224,13 +224,20 @@ | |||
31 | 224 | self.exception_form = ExceptionForm() | 224 | self.exception_form = ExceptionForm() |
32 | 225 | self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback))) | 225 | self.exception_form.exception_text_edit.setPlainText(''.join(format_exception(exc_type, value, traceback))) |
33 | 226 | self.set_normal_cursor() | 226 | self.set_normal_cursor() |
34 | 227 | is_splash_visible = False | ||
35 | 228 | if hasattr(self, 'splash') and self.splash.isVisible(): | ||
36 | 229 | is_splash_visible = True | ||
37 | 230 | self.splash.hide() | ||
38 | 227 | self.exception_form.exec() | 231 | self.exception_form.exec() |
39 | 232 | if is_splash_visible: | ||
40 | 233 | self.splash.show() | ||
41 | 228 | 234 | ||
43 | 229 | def backup_on_upgrade(self, has_run_wizard): | 235 | def backup_on_upgrade(self, has_run_wizard, can_show_splash): |
44 | 230 | """ | 236 | """ |
45 | 231 | Check if OpenLP has been upgraded, and ask if a backup of data should be made | 237 | Check if OpenLP has been upgraded, and ask if a backup of data should be made |
46 | 232 | 238 | ||
47 | 233 | :param has_run_wizard: OpenLP has been run before | 239 | :param has_run_wizard: OpenLP has been run before |
48 | 240 | :param can_show_splash: Should OpenLP show the splash screen | ||
49 | 234 | """ | 241 | """ |
50 | 235 | data_version = Settings().value('core/application version') | 242 | data_version = Settings().value('core/application version') |
51 | 236 | openlp_version = get_application_version()['version'] | 243 | openlp_version = get_application_version()['version'] |
52 | @@ -239,6 +246,8 @@ | |||
53 | 239 | Settings().setValue('core/application version', openlp_version) | 246 | Settings().setValue('core/application version', openlp_version) |
54 | 240 | # If data_version is different from the current version ask if we should backup the data folder | 247 | # If data_version is different from the current version ask if we should backup the data folder |
55 | 241 | elif data_version != openlp_version: | 248 | elif data_version != openlp_version: |
56 | 249 | if self.splash.isVisible(): | ||
57 | 250 | self.splash.hide() | ||
58 | 242 | if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'), | 251 | if QtWidgets.QMessageBox.question(None, translate('OpenLP', 'Backup'), |
59 | 243 | translate('OpenLP', 'OpenLP has been upgraded, do you want to create\n' | 252 | translate('OpenLP', 'OpenLP has been upgraded, do you want to create\n' |
60 | 244 | 'a backup of the old data folder?'), | 253 | 'a backup of the old data folder?'), |
61 | @@ -261,6 +270,8 @@ | |||
62 | 261 | 270 | ||
63 | 262 | # Update the version in the settings | 271 | # Update the version in the settings |
64 | 263 | Settings().setValue('core/application version', openlp_version) | 272 | Settings().setValue('core/application version', openlp_version) |
65 | 273 | if can_show_splash: | ||
66 | 274 | self.splash.show() | ||
67 | 264 | 275 | ||
68 | 265 | def process_events(self): | 276 | def process_events(self): |
69 | 266 | """ | 277 | """ |
70 | @@ -375,6 +386,7 @@ | |||
71 | 375 | application.setOrganizationName('OpenLP') | 386 | application.setOrganizationName('OpenLP') |
72 | 376 | application.setOrganizationDomain('openlp.org') | 387 | application.setOrganizationDomain('openlp.org') |
73 | 377 | application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) | 388 | application.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True) |
74 | 389 | application.setAttribute(QtCore.Qt.AA_DontCreateNativeWidgetSiblings, True) | ||
75 | 378 | if args and args.portable: | 390 | if args and args.portable: |
76 | 379 | application.setApplicationName('OpenLPPortable') | 391 | application.setApplicationName('OpenLPPortable') |
77 | 380 | Settings.setDefaultFormat(Settings.IniFormat) | 392 | Settings.setDefaultFormat(Settings.IniFormat) |
78 | 381 | 393 | ||
79 | === modified file 'openlp/core/common/settings.py' | |||
80 | --- openlp/core/common/settings.py 2016-10-23 19:24:53 +0000 | |||
81 | +++ openlp/core/common/settings.py 2016-12-15 22:20:16 +0000 | |||
82 | @@ -216,8 +216,8 @@ | |||
83 | 216 | ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4. | 216 | ('advanced/default color', 'core/logo background color', []), # Default image renamed + moved to general > 2.4. |
84 | 217 | ('advanced/default image', 'core/logo file', []), # Default image renamed + moved to general after 2.4. | 217 | ('advanced/default image', 'core/logo file', []), # Default image renamed + moved to general after 2.4. |
85 | 218 | ('shortcuts/escapeItem', 'shortcuts/desktopScreenEnable', []), # Escape item was removed in 2.6. | 218 | ('shortcuts/escapeItem', 'shortcuts/desktopScreenEnable', []), # Escape item was removed in 2.6. |
88 | 219 | ('shortcuts/offlineHelpItem', 'shortcuts/HelpItem', []), # Online and Offline help were combined in 2.6. | 219 | ('shortcuts/offlineHelpItem', 'shortcuts/userManualItem', []), # Online and Offline help were combined in 2.6. |
89 | 220 | ('shortcuts/onlineHelpItem', 'shortcuts/HelpItem', []) # Online and Offline help were combined in 2.6. | 220 | ('shortcuts/onlineHelpItem', 'shortcuts/userManualItem', []) # Online and Offline help were combined in 2.6. |
90 | 221 | ] | 221 | ] |
91 | 222 | 222 | ||
92 | 223 | @staticmethod | 223 | @staticmethod |
93 | @@ -276,7 +276,7 @@ | |||
94 | 276 | 'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)], | 276 | 'shortcuts/fileSaveItem': [QtGui.QKeySequence(QtGui.QKeySequence.Save)], |
95 | 277 | 'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)], | 277 | 'shortcuts/fileOpenItem': [QtGui.QKeySequence(QtGui.QKeySequence.Open)], |
96 | 278 | 'shortcuts/goLive': [], | 278 | 'shortcuts/goLive': [], |
98 | 279 | 'shortcuts/HelpItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)], | 279 | 'shortcuts/userManualItem': [QtGui.QKeySequence(QtGui.QKeySequence.HelpContents)], |
99 | 280 | 'shortcuts/importThemeItem': [], | 280 | 'shortcuts/importThemeItem': [], |
100 | 281 | 'shortcuts/importBibleItem': [], | 281 | 'shortcuts/importBibleItem': [], |
101 | 282 | 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)], | 282 | 'shortcuts/listViewBiblesDeleteItem': [QtGui.QKeySequence(QtGui.QKeySequence.Delete)], |
102 | 283 | 283 | ||
103 | === modified file 'openlp/core/ui/mainwindow.py' | |||
104 | --- openlp/core/ui/mainwindow.py 2016-12-13 06:41:59 +0000 | |||
105 | +++ openlp/core/ui/mainwindow.py 2016-12-15 22:20:16 +0000 | |||
106 | @@ -52,7 +52,7 @@ | |||
107 | 52 | log = logging.getLogger(__name__) | 52 | log = logging.getLogger(__name__) |
108 | 53 | 53 | ||
109 | 54 | MEDIA_MANAGER_STYLE = """ | 54 | MEDIA_MANAGER_STYLE = """ |
111 | 55 | ::tab { | 55 | ::tab#media_tool_box { |
112 | 56 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, | 56 | background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, |
113 | 57 | stop: 0 palette(button), stop: 1.0 palette(mid)); | 57 | stop: 0 palette(button), stop: 1.0 palette(mid)); |
114 | 58 | border: 0; | 58 | border: 0; |
115 | @@ -61,10 +61,8 @@ | |||
116 | 61 | margin-bottom: 0; | 61 | margin-bottom: 0; |
117 | 62 | text-align: left; | 62 | text-align: left; |
118 | 63 | } | 63 | } |
123 | 64 | ::tab:selected { | 64 | /* This is here to make the tabs on KDE with the Breeze theme work */ |
124 | 65 | border: 1px solid palette(highlight); | 65 | ::tab:selected {} |
121 | 66 | font-weight: bold; | ||
122 | 67 | } | ||
125 | 68 | """ | 66 | """ |
126 | 69 | 67 | ||
127 | 70 | PROGRESSBAR_STYLE = """ | 68 | PROGRESSBAR_STYLE = """ |
128 | @@ -310,10 +308,9 @@ | |||
129 | 310 | elif is_macosx(): | 308 | elif is_macosx(): |
130 | 311 | self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir), | 309 | self.local_help_file = os.path.join(AppLocation.get_directory(AppLocation.AppDir), |
131 | 312 | '..', 'Resources', 'OpenLP.help') | 310 | '..', 'Resources', 'OpenLP.help') |
136 | 313 | self.on_help_item = create_action(main_window, 'HelpItem', | 311 | self.user_manual_item = create_action(main_window, 'userManualItem', icon=':/system/system_help_contents.png', |
137 | 314 | icon=':/system/system_help_contents.png', | 312 | can_shortcuts=True, category=UiStrings().Help, |
138 | 315 | can_shortcuts=True, | 313 | triggers=self.on_help_clicked) |
135 | 316 | category=UiStrings().Help, triggers=self.on_help_clicked) | ||
139 | 317 | self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help) | 314 | self.web_site_item = create_action(main_window, 'webSiteItem', can_shortcuts=True, category=UiStrings().Help) |
140 | 318 | # Shortcuts not connected to buttons or menu entries. | 315 | # Shortcuts not connected to buttons or menu entries. |
141 | 319 | self.search_shortcut_action = create_action(main_window, | 316 | self.search_shortcut_action = create_action(main_window, |
142 | @@ -352,7 +349,7 @@ | |||
143 | 352 | add_actions(self.tools_menu, (self.tools_open_data_folder, None)) | 349 | add_actions(self.tools_menu, (self.tools_open_data_folder, None)) |
144 | 353 | add_actions(self.tools_menu, (self.tools_first_time_wizard, None)) | 350 | add_actions(self.tools_menu, (self.tools_first_time_wizard, None)) |
145 | 354 | add_actions(self.tools_menu, [self.update_theme_images]) | 351 | add_actions(self.tools_menu, [self.update_theme_images]) |
147 | 355 | add_actions(self.help_menu, (self.on_help_item, None, self.web_site_item, self.about_item)) | 352 | add_actions(self.help_menu, (self.user_manual_item, None, self.web_site_item, self.about_item)) |
148 | 356 | add_actions(self.menu_bar, (self.file_menu.menuAction(), self.view_menu.menuAction(), | 353 | add_actions(self.menu_bar, (self.file_menu.menuAction(), self.view_menu.menuAction(), |
149 | 357 | self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction())) | 354 | self.tools_menu.menuAction(), self.settings_menu.menuAction(), self.help_menu.menuAction())) |
150 | 358 | add_actions(self, [self.search_shortcut_action]) | 355 | add_actions(self, [self.search_shortcut_action]) |
151 | @@ -448,7 +445,7 @@ | |||
152 | 448 | 'from here.')) | 445 | 'from here.')) |
153 | 449 | self.about_item.setText(translate('OpenLP.MainWindow', '&About')) | 446 | self.about_item.setText(translate('OpenLP.MainWindow', '&About')) |
154 | 450 | self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP.')) | 447 | self.about_item.setStatusTip(translate('OpenLP.MainWindow', 'More information about OpenLP.')) |
156 | 451 | self.on_help_item.setText(translate('OpenLP.MainWindow', '&User Manual')) | 448 | self.user_manual_item.setText(translate('OpenLP.MainWindow', '&User Manual')) |
157 | 452 | self.search_shortcut_action.setText(UiStrings().Search) | 449 | self.search_shortcut_action.setText(UiStrings().Search) |
158 | 453 | self.search_shortcut_action.setToolTip( | 450 | self.search_shortcut_action.setToolTip( |
159 | 454 | translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.')) | 451 | translate('OpenLP.MainWindow', 'Jump to the search box of the current active plugin.')) |
160 | 455 | 452 | ||
161 | === modified file 'openlp/core/ui/themewizard.py' | |||
162 | --- openlp/core/ui/themewizard.py 2016-10-27 17:45:50 +0000 | |||
163 | +++ openlp/core/ui/themewizard.py 2016-12-15 22:20:16 +0000 | |||
164 | @@ -44,9 +44,9 @@ | |||
165 | 44 | theme_wizard.setModal(True) | 44 | theme_wizard.setModal(True) |
166 | 45 | theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages | | 45 | theme_wizard.setOptions(QtWidgets.QWizard.IndependentPages | |
167 | 46 | QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1) | 46 | QtWidgets.QWizard.NoBackButtonOnStartPage | QtWidgets.QWizard.HaveCustomButton1) |
168 | 47 | theme_wizard.setFixedWidth(640) | ||
169 | 47 | if is_macosx(): | 48 | if is_macosx(): |
170 | 48 | theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png')) | 49 | theme_wizard.setPixmap(QtWidgets.QWizard.BackgroundPixmap, QtGui.QPixmap(':/wizards/openlp-osx-wizard.png')) |
171 | 49 | theme_wizard.resize(646, 400) | ||
172 | 50 | else: | 50 | else: |
173 | 51 | theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle) | 51 | theme_wizard.setWizardStyle(QtWidgets.QWizard.ModernStyle) |
174 | 52 | self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) | 52 | self.spacer = QtWidgets.QSpacerItem(10, 0, QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Minimum) |
175 | 53 | 53 | ||
176 | === added file 'tests/functional/openlp_core_ui/test_shortcutlistdialog.py' | |||
177 | --- tests/functional/openlp_core_ui/test_shortcutlistdialog.py 1970-01-01 00:00:00 +0000 | |||
178 | +++ tests/functional/openlp_core_ui/test_shortcutlistdialog.py 2016-12-15 22:20:16 +0000 | |||
179 | @@ -0,0 +1,60 @@ | |||
180 | 1 | # -*- coding: utf-8 -*- | ||
181 | 2 | # vim: autoindent shiftwidth=4 expandtab textwidth=120 tabstop=4 softtabstop=4 | ||
182 | 3 | |||
183 | 4 | ############################################################################### | ||
184 | 5 | # OpenLP - Open Source Lyrics Projection # | ||
185 | 6 | # --------------------------------------------------------------------------- # | ||
186 | 7 | # Copyright (c) 2008-2016 OpenLP Developers # | ||
187 | 8 | # --------------------------------------------------------------------------- # | ||
188 | 9 | # This program is free software; you can redistribute it and/or modify it # | ||
189 | 10 | # under the terms of the GNU General Public License as published by the Free # | ||
190 | 11 | # Software Foundation; version 2 of the License. # | ||
191 | 12 | # # | ||
192 | 13 | # This program is distributed in the hope that it will be useful, but WITHOUT # | ||
193 | 14 | # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or # | ||
194 | 15 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for # | ||
195 | 16 | # more details. # | ||
196 | 17 | # # | ||
197 | 18 | # You should have received a copy of the GNU General Public License along # | ||
198 | 19 | # with this program; if not, write to the Free Software Foundation, Inc., 59 # | ||
199 | 20 | # Temple Place, Suite 330, Boston, MA 02111-1307 USA # | ||
200 | 21 | ############################################################################### | ||
201 | 22 | """ | ||
202 | 23 | Package to test the openlp.core.ui.shortcutlistdialog package. | ||
203 | 24 | """ | ||
204 | 25 | from PyQt5 import QtCore, QtGui, QtWidgets | ||
205 | 26 | |||
206 | 27 | from openlp.core.ui.shortcutlistdialog import CaptureShortcutButton, ShortcutTreeWidget | ||
207 | 28 | |||
208 | 29 | from tests.interfaces import MagicMock, patch | ||
209 | 30 | |||
210 | 31 | |||
211 | 32 | def test_key_press_event(): | ||
212 | 33 | """ | ||
213 | 34 | Test the keyPressEvent method | ||
214 | 35 | """ | ||
215 | 36 | # GIVEN: A checked button and a mocked event | ||
216 | 37 | button = CaptureShortcutButton() | ||
217 | 38 | button.setChecked(True) | ||
218 | 39 | mocked_event = MagicMock() | ||
219 | 40 | mocked_event.key.return_value = QtCore.Qt.Key_Space | ||
220 | 41 | |||
221 | 42 | # WHEN: keyPressEvent is called with an event that should be ignored | ||
222 | 43 | button.keyPressEvent(mocked_event) | ||
223 | 44 | |||
224 | 45 | # THEN: The ignore() method on the event should have been called | ||
225 | 46 | mocked_event.ignore.assert_called_once_with() | ||
226 | 47 | |||
227 | 48 | |||
228 | 49 | def test_keyboard_search(): | ||
229 | 50 | """ | ||
230 | 51 | Test the keyboardSearch method of the ShortcutTreeWidget | ||
231 | 52 | """ | ||
232 | 53 | # GIVEN: A ShortcutTreeWidget | ||
233 | 54 | widget = ShortcutTreeWidget() | ||
234 | 55 | |||
235 | 56 | # WHEN: keyboardSearch() is called | ||
236 | 57 | widget.keyboardSearch('') | ||
237 | 58 | |||
238 | 59 | # THEN: Nothing happens | ||
239 | 60 | assert True | ||
240 | 0 | 61 | ||
241 | === modified file 'tests/functional/test_init.py' | |||
242 | --- tests/functional/test_init.py 2016-05-31 21:40:13 +0000 | |||
243 | +++ tests/functional/test_init.py 2016-12-15 22:20:16 +0000 | |||
244 | @@ -102,7 +102,7 @@ | |||
245 | 102 | mocked_question.return_value = QtWidgets.QMessageBox.No | 102 | mocked_question.return_value = QtWidgets.QMessageBox.No |
246 | 103 | 103 | ||
247 | 104 | # WHEN: We check if a backup should be created | 104 | # WHEN: We check if a backup should be created |
249 | 105 | self.openlp.backup_on_upgrade(old_install) | 105 | self.openlp.backup_on_upgrade(old_install, False) |
250 | 106 | 106 | ||
251 | 107 | # THEN: It should not ask if we want to create a backup | 107 | # THEN: It should not ask if we want to create a backup |
252 | 108 | self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!') | 108 | self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be the same!') |
253 | @@ -120,14 +120,18 @@ | |||
254 | 120 | 'build': 'bzr000' | 120 | 'build': 'bzr000' |
255 | 121 | } | 121 | } |
256 | 122 | Settings().setValue('core/application version', '2.0.5') | 122 | Settings().setValue('core/application version', '2.0.5') |
257 | 123 | self.openlp.splash = MagicMock() | ||
258 | 124 | self.openlp.splash.isVisible.return_value = True | ||
259 | 123 | with patch('openlp.core.get_application_version') as mocked_get_application_version,\ | 125 | with patch('openlp.core.get_application_version') as mocked_get_application_version,\ |
260 | 124 | patch('openlp.core.QtWidgets.QMessageBox.question') as mocked_question: | 126 | patch('openlp.core.QtWidgets.QMessageBox.question') as mocked_question: |
261 | 125 | mocked_get_application_version.return_value = MOCKED_VERSION | 127 | mocked_get_application_version.return_value = MOCKED_VERSION |
262 | 126 | mocked_question.return_value = QtWidgets.QMessageBox.No | 128 | mocked_question.return_value = QtWidgets.QMessageBox.No |
263 | 127 | 129 | ||
264 | 128 | # WHEN: We check if a backup should be created | 130 | # WHEN: We check if a backup should be created |
266 | 129 | self.openlp.backup_on_upgrade(old_install) | 131 | self.openlp.backup_on_upgrade(old_install, True) |
267 | 130 | 132 | ||
268 | 131 | # THEN: It should ask if we want to create a backup | 133 | # THEN: It should ask if we want to create a backup |
269 | 132 | self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!') | 134 | self.assertEqual(Settings().value('core/application version'), '2.2.0', 'Version should be upgraded!') |
270 | 133 | self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!') | 135 | self.assertEqual(mocked_question.call_count, 1, 'A question should have been asked!') |
271 | 136 | self.openlp.splash.hide.assert_called_once_with() | ||
272 | 137 | self.openlp.splash.show.assert_called_once_with() |