Added two tests for this.

The other to check if visibility is changed to "True" for logo, the other for the opposite.

To do:

How to name this new setting? / Old "Default image" settings.
This commit is contained in:
suutari-olli 2016-03-31 23:35:04 +03:00
parent 005cf54116
commit 3aa7851c7d
2 changed files with 42 additions and 2 deletions

View File

@ -307,7 +307,7 @@ class AdvancedTab(SettingsTab):
self.default_file_label.setText(translate('OpenLP.AdvancedTab', 'Image file:'))
self.default_browse_button.setToolTip(translate('OpenLP.AdvancedTab', 'Browse for an image file to display.'))
self.default_revert_button.setToolTip(translate('OpenLP.AdvancedTab', 'Revert to the default OpenLP logo.'))
self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show Logo '))
self.default_show_nothing_check_box.setText(translate('OpenLP.AdvancedTab', 'Don\'t show image or background'))
self.data_directory_current_label.setText(translate('OpenLP.AdvancedTab', 'Current path:'))
self.data_directory_new_label.setText(translate('OpenLP.AdvancedTab', 'Custom path:'))
self.data_directory_browse_button.setToolTip(translate('OpenLP.AdvancedTab',

View File

@ -26,7 +26,7 @@ from unittest import TestCase, skipUnless
from PyQt5 import QtCore
from openlp.core.common import Registry, is_macosx
from openlp.core.common import Registry, is_macosx, Settings
from openlp.core.lib import ScreenList
from openlp.core.ui import MainDisplay
from openlp.core.ui.maindisplay import TRANSPARENT_STYLESHEET, OPAQUE_STYLESHEET
@ -183,3 +183,43 @@ class TestMainDisplay(TestCase, TestMixin):
'Window level should be NSMainMenuWindowLevel + 2')
self.assertEqual(pyobjc_nsview.window().collectionBehavior(), NSWindowCollectionBehaviorManaged,
'Window collection behavior should be NSWindowCollectionBehaviorManaged')
@patch(u'openlp.core.ui.maindisplay.Settings')
def show_display_startup_logo_test(self, MockedSettings):
# GIVEN: Mocked show_display, setting for logo visibility
display = MagicMock()
main_display = MainDisplay(display)
main_display.frame = MagicMock()
main_display.isHidden = MagicMock()
main_display.isHidden.return_value = True
main_display.setVisible = MagicMock()
mocked_settings = MagicMock()
mocked_settings.value.return_value = False
MockedSettings.return_value = mocked_settings
main_display.shake_web_view = MagicMock()
# WHEN: show_display is called.
main_display.show_display()
# THEN: setVisible should had been called with "True"
main_display.setVisible.assert_called_once_with(True)
@patch(u'openlp.core.ui.maindisplay.Settings')
def show_display_hide_startup_logo_test(self, MockedSettings):
# GIVEN: Mocked show_display, setting for logo visibility
display = MagicMock()
main_display = MainDisplay(display)
main_display.frame = MagicMock()
main_display.isHidden = MagicMock()
main_display.isHidden.return_value = False
main_display.setVisible = MagicMock()
mocked_settings = MagicMock()
mocked_settings.value.return_value = False
MockedSettings.return_value = mocked_settings
main_display.shake_web_view = MagicMock()
# WHEN: show_display is called.
main_display.show_display()
# THEN: setVisible should had not been called
main_display.setVisible.assert_not_called()