forked from openlp/openlp
Migrate display
This commit is contained in:
parent
2eb385c774
commit
a544aa11ff
@ -21,49 +21,14 @@
|
|||||||
"""
|
"""
|
||||||
Package to test the openlp.core.lib.screenlist package.
|
Package to test the openlp.core.lib.screenlist package.
|
||||||
"""
|
"""
|
||||||
from unittest import TestCase
|
|
||||||
from unittest.mock import MagicMock, patch
|
from unittest.mock import MagicMock, patch
|
||||||
|
|
||||||
from PyQt5 import QtCore, QtWidgets
|
from PyQt5 import QtCore
|
||||||
|
|
||||||
from openlp.core.common.registry import Registry
|
|
||||||
from openlp.core.display.screens import Screen, ScreenList
|
from openlp.core.display.screens import Screen, ScreenList
|
||||||
|
|
||||||
|
|
||||||
SCREEN = {
|
def test_current_display_screen():
|
||||||
'primary': False,
|
|
||||||
'number': 1,
|
|
||||||
'size': QtCore.QRect(0, 0, 1024, 768)
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class TestScreenList(TestCase):
|
|
||||||
|
|
||||||
def setUp(self):
|
|
||||||
"""
|
|
||||||
Set up the components need for all tests.
|
|
||||||
"""
|
|
||||||
# Mocked out desktop object
|
|
||||||
self.desktop = MagicMock()
|
|
||||||
self.desktop.primaryScreen.return_value = SCREEN['primary']
|
|
||||||
self.desktop.screenCount.return_value = SCREEN['number']
|
|
||||||
self.desktop.screenGeometry.return_value = SCREEN['size']
|
|
||||||
|
|
||||||
self.application = QtWidgets.QApplication.instance()
|
|
||||||
Registry.create()
|
|
||||||
Registry().register('settings', MagicMock())
|
|
||||||
self.application.setOrganizationName('OpenLP-tests')
|
|
||||||
self.application.setOrganizationDomain('openlp.org')
|
|
||||||
self.screens = ScreenList.create(self.desktop)
|
|
||||||
|
|
||||||
def tearDown(self):
|
|
||||||
"""
|
|
||||||
Delete QApplication.
|
|
||||||
"""
|
|
||||||
del self.screens
|
|
||||||
del self.application
|
|
||||||
|
|
||||||
def test_current_display_screen(self):
|
|
||||||
"""
|
"""
|
||||||
Test that the "current" property returns the first display screen
|
Test that the "current" property returns the first display screen
|
||||||
"""
|
"""
|
||||||
@ -83,7 +48,8 @@ class TestScreenList(TestCase):
|
|||||||
assert screen.is_primary is False
|
assert screen.is_primary is False
|
||||||
assert screen.is_display is True
|
assert screen.is_display is True
|
||||||
|
|
||||||
def test_current_primary_screen(self):
|
|
||||||
|
def test_current_primary_screen():
|
||||||
"""
|
"""
|
||||||
Test that the "current" property returns the first primary screen
|
Test that the "current" property returns the first primary screen
|
||||||
"""
|
"""
|
||||||
@ -102,8 +68,9 @@ class TestScreenList(TestCase):
|
|||||||
assert screen.is_primary is True
|
assert screen.is_primary is True
|
||||||
assert screen.is_display is False
|
assert screen.is_display is False
|
||||||
|
|
||||||
@patch('openlp.core.display.screens.QtWidgets.QApplication.screens')
|
|
||||||
def test_create_screen_list(self, mocked_screens):
|
@patch('openlp.core.display.screens.QtWidgets.QApplication.screens')
|
||||||
|
def test_create_screen_list(mocked_screens, settings):
|
||||||
"""
|
"""
|
||||||
Create the screen list
|
Create the screen list
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user