forked from openlp/openlp
Fix up the tests
This commit is contained in:
parent
c7ea4c460e
commit
f69757a59d
16
nose2.cfg
16
nose2.cfg
@ -1,5 +1,5 @@
|
|||||||
[unittest]
|
[unittest]
|
||||||
verbose = True
|
verbose = true
|
||||||
plugins = nose2.plugins.mp
|
plugins = nose2.plugins.mp
|
||||||
|
|
||||||
[log-capture]
|
[log-capture]
|
||||||
@ -9,19 +9,19 @@ filter = -nose
|
|||||||
log-level = ERROR
|
log-level = ERROR
|
||||||
|
|
||||||
[test-result]
|
[test-result]
|
||||||
always-on = True
|
always-on = true
|
||||||
descriptions = True
|
descriptions = true
|
||||||
|
|
||||||
[coverage]
|
[coverage]
|
||||||
always-on = True
|
always-on = true
|
||||||
coverage = openlp
|
coverage = openlp
|
||||||
coverage-report = html
|
coverage-report = html
|
||||||
|
|
||||||
[multiprocess]
|
[multiprocess]
|
||||||
always-on = False
|
always-on = false
|
||||||
processes = 4
|
processes = 4
|
||||||
|
|
||||||
[output-buffer]
|
[output-buffer]
|
||||||
always-on = True
|
always-on = true
|
||||||
stderr = True
|
stderr = true
|
||||||
stdout = False
|
stdout = true
|
||||||
|
@ -28,7 +28,7 @@ from unittest.mock import MagicMock
|
|||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore, QtWidgets
|
||||||
|
|
||||||
from openlp.core.common.registry import Registry
|
from openlp.core.common.registry import Registry
|
||||||
from openlp.core.display.screens import ScreenList
|
from openlp.core.display.screens import ScreenList, Screen
|
||||||
|
|
||||||
SCREEN = {
|
SCREEN = {
|
||||||
'primary': False,
|
'primary': False,
|
||||||
@ -62,6 +62,45 @@ class TestScreenList(TestCase):
|
|||||||
del self.screens
|
del self.screens
|
||||||
del self.application
|
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):
|
def test_create_screen_list(self):
|
||||||
"""
|
"""
|
||||||
Create the screen list
|
Create the screen list
|
||||||
|
@ -158,8 +158,12 @@ class TestMainWindow(TestCase, TestMixin):
|
|||||||
# WHEN: you check the started functions
|
# WHEN: you check the started functions
|
||||||
|
|
||||||
# THEN: the following registry functions should have been registered
|
# THEN: the following registry functions should have been registered
|
||||||
assert len(self.registry.service_list) == 12, \
|
expected_service_list = ['application', 'main_window', 'media_controller', 'settings_form', 'plugin_manager',
|
||||||
'The registry should have 12 services, got {}'.format(self.registry.service_list.keys())
|
'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, \
|
assert len(self.registry.functions_list) == 19, \
|
||||||
'The registry should have 19 functions, got {}'.format(self.registry.functions_list.keys())
|
'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.'
|
assert 'application' in self.registry.service_list, 'The application should have been registered.'
|
||||||
|
Loading…
Reference in New Issue
Block a user