diff --git a/nose2.cfg b/nose2.cfg index ae73407d7..451737d6c 100644 --- a/nose2.cfg +++ b/nose2.cfg @@ -1,5 +1,5 @@ [unittest] -verbose = True +verbose = true plugins = nose2.plugins.mp [log-capture] @@ -9,19 +9,19 @@ filter = -nose log-level = ERROR [test-result] -always-on = True -descriptions = True +always-on = true +descriptions = true [coverage] -always-on = True +always-on = true coverage = openlp coverage-report = html [multiprocess] -always-on = False +always-on = false processes = 4 [output-buffer] -always-on = True -stderr = True -stdout = False +always-on = true +stderr = true +stdout = true diff --git a/tests/functional/openlp_core/display/test_screens.py b/tests/functional/openlp_core/display/test_screens.py index 6aac3cd9f..a58ed600d 100644 --- a/tests/functional/openlp_core/display/test_screens.py +++ b/tests/functional/openlp_core/display/test_screens.py @@ -28,7 +28,7 @@ from unittest.mock import MagicMock from PyQt5 import QtCore, QtWidgets from openlp.core.common.registry import Registry -from openlp.core.display.screens import ScreenList +from openlp.core.display.screens import ScreenList, Screen SCREEN = { 'primary': False, @@ -62,6 +62,45 @@ class TestScreenList(TestCase): del self.screens del self.application + def test_current_display_screen(self): + """ + Test that the "current" property returns the first display screen + """ + # GIVEN: A new ScreenList object with some screens + screen_list = ScreenList() + screen_list.screens = [ + Screen(number=0, geometry=QtCore.QRect(0, 0, 1024, 768), is_primary=True), + Screen(number=1, geometry=QtCore.QRect(1024, 0, 1024, 768), is_primary=False, is_display=True) + ] + + # WHEN: The current property is accessed + screen = screen_list.current + + # THEN: It should be the display screen + assert screen.number == 1 + assert screen.geometry == QtCore.QRect(1024, 0, 1024, 768) + assert screen.is_primary is False + assert screen.is_display is True + + def test_current_primary_screen(self): + """ + Test that the "current" property returns the first primary screen + """ + # GIVEN: A new ScreenList object with some screens + screen_list = ScreenList() + screen_list.screens = [ + Screen(number=0, geometry=QtCore.QRect(0, 0, 1024, 768), is_primary=True) + ] + + # WHEN: The current property is accessed + screen = screen_list.current + + # THEN: It should be the display screen + assert screen.number == 0 + assert screen.geometry == QtCore.QRect(0, 0, 1024, 768) + assert screen.is_primary is True + assert screen.is_display is False + def test_create_screen_list(self): """ Create the screen list diff --git a/tests/functional/openlp_core/ui/test_mainwindow.py b/tests/functional/openlp_core/ui/test_mainwindow.py index 8987d4095..fb65a1ffb 100644 --- a/tests/functional/openlp_core/ui/test_mainwindow.py +++ b/tests/functional/openlp_core/ui/test_mainwindow.py @@ -158,8 +158,12 @@ class TestMainWindow(TestCase, TestMixin): # WHEN: you check the started functions # THEN: the following registry functions should have been registered - assert len(self.registry.service_list) == 12, \ - 'The registry should have 12 services, got {}'.format(self.registry.service_list.keys()) + expected_service_list = ['application', 'main_window', 'media_controller', 'settings_form', 'plugin_manager', + 'image_manager', 'preview_controller', 'live_controller', 'service_manager', + 'theme_manager', 'projector_manager'] + assert list(self.registry.service_list.keys()) == expected_service_list, \ + 'The registry should have the following services: {}, got {}'.format(expected_service_list, + self.registry.service_list.keys()) assert len(self.registry.functions_list) == 19, \ 'The registry should have 19 functions, got {}'.format(self.registry.functions_list.keys()) assert 'application' in self.registry.service_list, 'The application should have been registered.'