From bf01c2f0a813026a86fa9efbe84fb07537e4c14b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Wed, 6 Feb 2013 10:56:41 +0100 Subject: [PATCH 01/13] use own ScreenList() call instead of using parents to access it --- openlp/plugins/presentations/lib/impresscontroller.py | 3 ++- openlp/plugins/presentations/lib/powerpointcontroller.py | 4 ++-- openlp/plugins/presentations/lib/pptviewcontroller.py | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/openlp/plugins/presentations/lib/impresscontroller.py b/openlp/plugins/presentations/lib/impresscontroller.py index c19653b78..dfb8ad955 100644 --- a/openlp/plugins/presentations/lib/impresscontroller.py +++ b/openlp/plugins/presentations/lib/impresscontroller.py @@ -58,6 +58,7 @@ else: from PyQt4 import QtCore +from openlp.core.lib import ScreenList from openlp.core.utils import delete_file, get_uno_command, get_uno_instance from presentationcontroller import PresentationController, PresentationDocument @@ -254,7 +255,7 @@ class ImpressDocument(PresentationDocument): window = self.document.getCurrentController().getFrame().getContainerWindow() window.setVisible(False) self.presentation = self.document.getPresentation() - self.presentation.Display = self.controller.plugin.renderer.screens.current[u'number'] + 1 + self.presentation.Display = ScreenList().current[u'number'] + 1 self.control = None self.create_thumbnails() return True diff --git a/openlp/plugins/presentations/lib/powerpointcontroller.py b/openlp/plugins/presentations/lib/powerpointcontroller.py index d62465ee7..7a9f548ee 100644 --- a/openlp/plugins/presentations/lib/powerpointcontroller.py +++ b/openlp/plugins/presentations/lib/powerpointcontroller.py @@ -36,6 +36,7 @@ if os.name == u'nt': import win32ui import pywintypes +from openlp.core.lib import ScreenList from presentationcontroller import PresentationController, PresentationDocument log = logging.getLogger(__name__) @@ -252,8 +253,7 @@ class PowerpointDocument(PresentationDocument): dpi = win32ui.GetForegroundWindow().GetDC().GetDeviceCaps(88) except win32ui.error: dpi = 96 - renderer = self.controller.plugin.renderer - rect = renderer.screens.current[u'size'] + rect = ScreenList().current[u'size'] ppt_window = self.presentation.SlideShowSettings.Run() if not ppt_window: return diff --git a/openlp/plugins/presentations/lib/pptviewcontroller.py b/openlp/plugins/presentations/lib/pptviewcontroller.py index ec3adebe4..af66f623d 100644 --- a/openlp/plugins/presentations/lib/pptviewcontroller.py +++ b/openlp/plugins/presentations/lib/pptviewcontroller.py @@ -34,6 +34,7 @@ if os.name == u'nt': from ctypes import cdll from ctypes.wintypes import RECT +from openlp.core.lib import ScreenList from presentationcontroller import PresentationController, PresentationDocument log = logging.getLogger(__name__) @@ -120,8 +121,7 @@ class PptviewDocument(PresentationDocument): PptView task started earlier. """ log.debug(u'LoadPresentation') - renderer = self.controller.plugin.renderer - rect = renderer.screens.current[u'size'] + rect = ScreenList().current[u'size'] rect = RECT(rect.x(), rect.y(), rect.right(), rect.bottom()) filepath = str(self.filepath.replace(u'/', u'\\')) if not os.path.isdir(self.get_temp_folder()): From 7e0ea578eee3e7c8a2750dbe6672ecd032ebf642 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 11:28:37 +0100 Subject: [PATCH 02/13] started with screen tests --- .../openlp_core_lib/test_screenlist.py | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 tests/functional/openlp_core_lib/test_screenlist.py diff --git a/tests/functional/openlp_core_lib/test_screenlist.py b/tests/functional/openlp_core_lib/test_screenlist.py new file mode 100644 index 000000000..e61338d05 --- /dev/null +++ b/tests/functional/openlp_core_lib/test_screenlist.py @@ -0,0 +1,38 @@ +""" +Package to test the openlp.core.lib.screenlist package. +""" +from unittest import TestCase + +#from mock import MagicMock, patch + +from openlp.core.lib import ScreenList + +from PyQt4 import QtGui + +class TestScreenList(object): + + def setUp(self): + """ + Set up the components need for all tests. + """ + self.application = QtGui.QApplication([]) + print ScreenList.create(self.application.desktop()) + self.screen_list = ScreenList() + + def tearDown(self): + """ + Clean up the components needed for the tests. + """ + del self.application + + def basic_test(self): + """ + """ + print self.screen_list.get_screen_list() + + def add_desktop_test(self): + """ + Test to check if new monitors are detected by OpenLP (= plugged in while OpenLP is running). + """ + pass + From b1ec7aa187337cdb18d2c6ea5eec29c5aa3b68f7 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 13:27:13 +0100 Subject: [PATCH 03/13] completed screen list test --- openlp/core/__init__.py | 3 +- .../openlp_core_lib/test_image_manager.py | 3 +- .../openlp_core_lib/test_screenlist.py | 46 +++++++++++-------- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 3ad0e1348..1898c361b 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -276,7 +276,8 @@ def main(args=None): qt_args.append('OpenLP') # Initialise the resources qInitResources() - # Now create and actually run the application. + # Now create and actually run the application.# + print qt_args application = OpenLP(qt_args) application.setOrganizationName(u'OpenLP') application.setOrganizationDomain(u'openlp.org') diff --git a/tests/functional/openlp_core_lib/test_image_manager.py b/tests/functional/openlp_core_lib/test_image_manager.py index d13c82c04..a257fec20 100644 --- a/tests/functional/openlp_core_lib/test_image_manager.py +++ b/tests/functional/openlp_core_lib/test_image_manager.py @@ -28,7 +28,8 @@ class TestImageManager(TestCase): """ Delete all the C++ objects at the end so that we don't have a segfault """ - del self.app + #del self.app + pass def basic_image_manager_test(self): """ diff --git a/tests/functional/openlp_core_lib/test_screenlist.py b/tests/functional/openlp_core_lib/test_screenlist.py index e61338d05..cb7635c71 100644 --- a/tests/functional/openlp_core_lib/test_screenlist.py +++ b/tests/functional/openlp_core_lib/test_screenlist.py @@ -1,38 +1,48 @@ """ Package to test the openlp.core.lib.screenlist package. """ +import copy from unittest import TestCase -#from mock import MagicMock, patch +from mock import MagicMock from openlp.core.lib import ScreenList -from PyQt4 import QtGui +from PyQt4 import QtGui, QtCore -class TestScreenList(object): +class TestScreenList(TestCase): def setUp(self): """ Set up the components need for all tests. """ - self.application = QtGui.QApplication([]) - print ScreenList.create(self.application.desktop()) - self.screen_list = ScreenList() - - def tearDown(self): - """ - Clean up the components needed for the tests. - """ - del self.application - - def basic_test(self): - """ - """ - print self.screen_list.get_screen_list() + self.application = QtGui.QApplication.instance() + self.screens = ScreenList.create(self.application.desktop()) def add_desktop_test(self): """ Test to check if new monitors are detected by OpenLP (= plugged in while OpenLP is running). """ - pass + # GIVEN: The screen list. + old_screens = copy.deepcopy(self.screens.screen_list) + + screen = { + u'primary': False, + u'number': 1, + u'size': QtCore.QRect(0, 0, 1024, 768) + } + # Mock the attributes. + self.screens.desktop.primaryScreen = MagicMock(return_value=screen[u'primary']) + self.screens.desktop.screenCount = MagicMock(return_value=screen[u'number'] + 1) + self.screens.desktop.screenGeometry = MagicMock(return_value=screen[u'size']) + + # WHEN: Add a new screen. + self.screens.screen_count_changed(len(old_screens)) + + # THEN: The screen should have been added. + new_screens = self.screens.screen_list + assert len(old_screens) + 1 == len(new_screens), u'The new_screens list should be bigger.' + + # THEN: The screens should be identically. + assert screen == new_screens.pop(), u'The new screen should be identically to the screen defined above.' From 9ecb575d5b1b2ea4a169a954f9c0c188dc56497c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 13:30:16 +0100 Subject: [PATCH 04/13] clean up --- openlp/core/__init__.py | 3 +-- tests/functional/openlp_core_lib/test_image_manager.py | 7 ------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/openlp/core/__init__.py b/openlp/core/__init__.py index 1898c361b..3ad0e1348 100644 --- a/openlp/core/__init__.py +++ b/openlp/core/__init__.py @@ -276,8 +276,7 @@ def main(args=None): qt_args.append('OpenLP') # Initialise the resources qInitResources() - # Now create and actually run the application.# - print qt_args + # Now create and actually run the application. application = OpenLP(qt_args) application.setOrganizationName(u'OpenLP') application.setOrganizationDomain(u'openlp.org') diff --git a/tests/functional/openlp_core_lib/test_image_manager.py b/tests/functional/openlp_core_lib/test_image_manager.py index a257fec20..10402a808 100644 --- a/tests/functional/openlp_core_lib/test_image_manager.py +++ b/tests/functional/openlp_core_lib/test_image_manager.py @@ -24,13 +24,6 @@ class TestImageManager(TestCase): ScreenList.create(self.app.desktop()) self.image_manager = ImageManager() - def tearDown(self): - """ - Delete all the C++ objects at the end so that we don't have a segfault - """ - #del self.app - pass - def basic_image_manager_test(self): """ Test the Image Manager setup basic functionality From ce1d5b6539642b16d464f3bef012c3f6efbc9a53 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 13:33:54 +0100 Subject: [PATCH 05/13] fixed import order --- tests/functional/openlp_core_lib/test_screenlist.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_screenlist.py b/tests/functional/openlp_core_lib/test_screenlist.py index cb7635c71..4164607de 100644 --- a/tests/functional/openlp_core_lib/test_screenlist.py +++ b/tests/functional/openlp_core_lib/test_screenlist.py @@ -4,11 +4,10 @@ Package to test the openlp.core.lib.screenlist package. import copy from unittest import TestCase -from mock import MagicMock +from PyQt4 import QtGui, QtCore from openlp.core.lib import ScreenList -from PyQt4 import QtGui, QtCore class TestScreenList(TestCase): From b76656420bc31f62183d1d6adf5f32cf23a46698 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 13:40:19 +0100 Subject: [PATCH 06/13] moved file to match file name --- .../openlp_core_lib/{test_screenlist.py => test_screen.py} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/functional/openlp_core_lib/{test_screenlist.py => test_screen.py} (100%) diff --git a/tests/functional/openlp_core_lib/test_screenlist.py b/tests/functional/openlp_core_lib/test_screen.py similarity index 100% rename from tests/functional/openlp_core_lib/test_screenlist.py rename to tests/functional/openlp_core_lib/test_screen.py From 479244fde27a0616bd4eaed87d014e10cdd1679c Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 13:42:25 +0100 Subject: [PATCH 07/13] fixed import I just removed :/ --- tests/functional/openlp_core_lib/test_screen.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/functional/openlp_core_lib/test_screen.py b/tests/functional/openlp_core_lib/test_screen.py index 4164607de..0b708dd94 100644 --- a/tests/functional/openlp_core_lib/test_screen.py +++ b/tests/functional/openlp_core_lib/test_screen.py @@ -4,6 +4,7 @@ Package to test the openlp.core.lib.screenlist package. import copy from unittest import TestCase +from mock import MagicMock from PyQt4 import QtGui, QtCore from openlp.core.lib import ScreenList From bea5fe25963d0b35adfb951b18720d0b7a2c63b2 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 16:02:19 +0100 Subject: [PATCH 08/13] cleaned code --- tests/functional/__init__.py | 7 ++++++- tests/functional/openlp_core_lib/test_image_manager.py | 8 +++++++- tests/functional/openlp_core_lib/test_screen.py | 5 +++++ tests/interfaces/openlp_core_ui/test_filerenamedialog.py | 2 +- tests/interfaces/openlp_core_ui/test_servicemanager.py | 2 +- tests/interfaces/openlp_core_ui/test_servicenotedialog.py | 4 ++-- tests/interfaces/openlp_core_ui/test_starttimedialog.py | 4 ++-- 7 files changed, 24 insertions(+), 8 deletions(-) diff --git a/tests/functional/__init__.py b/tests/functional/__init__.py index e0da50eb3..0b5157b46 100644 --- a/tests/functional/__init__.py +++ b/tests/functional/__init__.py @@ -5,4 +5,9 @@ sip.setapi(u'QString', 2) sip.setapi(u'QTextStream', 2) sip.setapi(u'QTime', 2) sip.setapi(u'QUrl', 2) -sip.setapi(u'QVariant', 2) \ No newline at end of file +sip.setapi(u'QVariant', 2) + +from PyQt4 import QtGui + +# Only one QApplication can be created. Use QtGui.QApplication.instance() when you need to "create" a QApplication. +application = QtGui.QApplication([]) diff --git a/tests/functional/openlp_core_lib/test_image_manager.py b/tests/functional/openlp_core_lib/test_image_manager.py index 10402a808..3256ef86f 100644 --- a/tests/functional/openlp_core_lib/test_image_manager.py +++ b/tests/functional/openlp_core_lib/test_image_manager.py @@ -20,10 +20,16 @@ class TestImageManager(TestCase): Create the UI """ Registry.create() - self.app = QtGui.QApplication([]) + self.app = QtGui.QApplication.instance() ScreenList.create(self.app.desktop()) self.image_manager = ImageManager() + def tearDown(self): + """ + Delete all the C++ objects at the end so that we don't have a segfault + """ + del self.app + def basic_image_manager_test(self): """ Test the Image Manager setup basic functionality diff --git a/tests/functional/openlp_core_lib/test_screen.py b/tests/functional/openlp_core_lib/test_screen.py index 0b708dd94..8f6631043 100644 --- a/tests/functional/openlp_core_lib/test_screen.py +++ b/tests/functional/openlp_core_lib/test_screen.py @@ -19,6 +19,11 @@ class TestScreenList(TestCase): self.application = QtGui.QApplication.instance() self.screens = ScreenList.create(self.application.desktop()) + def tearDown(self): + """ + """ + del self.application + def add_desktop_test(self): """ Test to check if new monitors are detected by OpenLP (= plugged in while OpenLP is running). diff --git a/tests/interfaces/openlp_core_ui/test_filerenamedialog.py b/tests/interfaces/openlp_core_ui/test_filerenamedialog.py index 74fe83b26..941b1485a 100644 --- a/tests/interfaces/openlp_core_ui/test_filerenamedialog.py +++ b/tests/interfaces/openlp_core_ui/test_filerenamedialog.py @@ -15,7 +15,7 @@ class TestStartFileRenameForm(TestCase): Create the UI """ registry = Registry.create() - self.app = QtGui.QApplication([]) + self.app = QtGui.QApplication.instance() self.main_window = QtGui.QMainWindow() Registry().register(u'main_window', self.main_window) self.form = filerenameform.FileRenameForm() diff --git a/tests/interfaces/openlp_core_ui/test_servicemanager.py b/tests/interfaces/openlp_core_ui/test_servicemanager.py index bb62bd6e6..e06edd4a6 100644 --- a/tests/interfaces/openlp_core_ui/test_servicemanager.py +++ b/tests/interfaces/openlp_core_ui/test_servicemanager.py @@ -18,7 +18,7 @@ class TestStartNoteDialog(TestCase): Create the UI """ Registry.create() - self.app = QtGui.QApplication([]) + self.app = QtGui.QApplication.instance() ScreenList.create(self.app.desktop()) Registry().register(u'application', MagicMock()) self.main_window = MainWindow() diff --git a/tests/interfaces/openlp_core_ui/test_servicenotedialog.py b/tests/interfaces/openlp_core_ui/test_servicenotedialog.py index 1cf3fef38..ee0f842bd 100644 --- a/tests/interfaces/openlp_core_ui/test_servicenotedialog.py +++ b/tests/interfaces/openlp_core_ui/test_servicenotedialog.py @@ -17,7 +17,7 @@ class TestStartNoteDialog(TestCase): Create the UI """ Registry.create() - self.app = QtGui.QApplication([]) + self.app = QtGui.QApplication.instance() self.main_window = QtGui.QMainWindow() Registry().register(u'main_window', self.main_window) self.form = servicenoteform.ServiceNoteForm() @@ -66,4 +66,4 @@ class TestStartNoteDialog(TestCase): QtTest.QTest.mouseClick(okWidget, QtCore.Qt.LeftButton) # THEN the following text is returned - self.assertEqual(self.form.text_edit.toPlainText(), text, u'The new text should be returned') \ No newline at end of file + self.assertEqual(self.form.text_edit.toPlainText(), text, u'The new text should be returned') diff --git a/tests/interfaces/openlp_core_ui/test_starttimedialog.py b/tests/interfaces/openlp_core_ui/test_starttimedialog.py index 888402235..c09426a1f 100644 --- a/tests/interfaces/openlp_core_ui/test_starttimedialog.py +++ b/tests/interfaces/openlp_core_ui/test_starttimedialog.py @@ -17,7 +17,7 @@ class TestStartTimeDialog(TestCase): Create the UI """ Registry.create() - self.app = QtGui.QApplication([]) + self.app = QtGui.QApplication.instance() self.main_window = QtGui.QMainWindow() Registry().register(u'main_window', self.main_window) self.form = starttimeform.StartTimeForm() @@ -93,4 +93,4 @@ class TestStartTimeDialog(TestCase): self.assertEqual(self.form.hourSpinBox.value(), 0) self.assertEqual(self.form.minuteSpinBox.value(), 2) self.assertEqual(self.form.secondSpinBox.value(), 3) - self.assertEqual(self.form.item[u'service_item'].start_time, 123, u'The start time should have changed') \ No newline at end of file + self.assertEqual(self.form.item[u'service_item'].start_time, 123, u'The start time should have changed') From a24ff2a4a2ed8fcc763fd020ee382aa3458496f6 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 17:05:39 +0100 Subject: [PATCH 09/13] added newline to end of file --- tests/interfaces/openlp_core_ui/test_servicenotedialog.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/interfaces/openlp_core_ui/test_servicenotedialog.py b/tests/interfaces/openlp_core_ui/test_servicenotedialog.py index ee0f842bd..e04f9975d 100644 --- a/tests/interfaces/openlp_core_ui/test_servicenotedialog.py +++ b/tests/interfaces/openlp_core_ui/test_servicenotedialog.py @@ -67,3 +67,4 @@ class TestStartNoteDialog(TestCase): # THEN the following text is returned self.assertEqual(self.form.text_edit.toPlainText(), text, u'The new text should be returned') + From fab327c89fd458302120943afdb8ea9741889092 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 19:04:17 +0100 Subject: [PATCH 10/13] moved application creation --- tests/interfaces/__init__.py | 7 ++++++- tests/interfaces/openlp_core_lib/test_pluginmanager.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/interfaces/__init__.py b/tests/interfaces/__init__.py index e0da50eb3..0b5157b46 100644 --- a/tests/interfaces/__init__.py +++ b/tests/interfaces/__init__.py @@ -5,4 +5,9 @@ sip.setapi(u'QString', 2) sip.setapi(u'QTextStream', 2) sip.setapi(u'QTime', 2) sip.setapi(u'QUrl', 2) -sip.setapi(u'QVariant', 2) \ No newline at end of file +sip.setapi(u'QVariant', 2) + +from PyQt4 import QtGui + +# Only one QApplication can be created. Use QtGui.QApplication.instance() when you need to "create" a QApplication. +application = QtGui.QApplication([]) diff --git a/tests/interfaces/openlp_core_lib/test_pluginmanager.py b/tests/interfaces/openlp_core_lib/test_pluginmanager.py index 609af01fb..498803c44 100644 --- a/tests/interfaces/openlp_core_lib/test_pluginmanager.py +++ b/tests/interfaces/openlp_core_lib/test_pluginmanager.py @@ -26,7 +26,7 @@ class TestPluginManager(TestCase): Settings().set_filename(self.ini_file) Registry.create() Registry().register(u'service_list', MagicMock()) - self.app = QtGui.QApplication([]) + self.app = QtGui.QApplication.instance() self.main_window = QtGui.QMainWindow() Registry().register(u'main_window', self.main_window) self.plugins_dir = os.path.abspath(os.path.join(os.path.basename(__file__), u'..', u'openlp', u'plugins')) From 10f7a464b4abc797d911228c92da405def0fdc2b Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 19:06:23 +0100 Subject: [PATCH 11/13] delete appliction in tearDown --- tests/interfaces/openlp_core_lib/test_pluginmanager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/interfaces/openlp_core_lib/test_pluginmanager.py b/tests/interfaces/openlp_core_lib/test_pluginmanager.py index 498803c44..ca8ed3f07 100644 --- a/tests/interfaces/openlp_core_lib/test_pluginmanager.py +++ b/tests/interfaces/openlp_core_lib/test_pluginmanager.py @@ -33,6 +33,7 @@ class TestPluginManager(TestCase): def tearDown(self): os.unlink(self.ini_file) + del self.app def find_plugins_test(self): """ From 5b4e285782cb6d36cb09467027a3433754059938 Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 19:14:41 +0100 Subject: [PATCH 12/13] created constant; changed test method description --- .../functional/openlp_core_lib/test_screen.py | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_screen.py b/tests/functional/openlp_core_lib/test_screen.py index 8f6631043..92dd48172 100644 --- a/tests/functional/openlp_core_lib/test_screen.py +++ b/tests/functional/openlp_core_lib/test_screen.py @@ -10,6 +10,13 @@ from PyQt4 import QtGui, QtCore from openlp.core.lib import ScreenList +SCREEN = { + u'primary': False, + u'number': 1, + u'size': QtCore.QRect(0, 0, 1024, 768) +} + + class TestScreenList(TestCase): def setUp(self): @@ -21,25 +28,20 @@ class TestScreenList(TestCase): def tearDown(self): """ + Delete QApplication. """ del self.application def add_desktop_test(self): """ - Test to check if new monitors are detected by OpenLP (= plugged in while OpenLP is running). + Test the ScreenList class' screen_count_changed method to check if new monitors are detected by OpenLP. """ # GIVEN: The screen list. old_screens = copy.deepcopy(self.screens.screen_list) - - screen = { - u'primary': False, - u'number': 1, - u'size': QtCore.QRect(0, 0, 1024, 768) - } # Mock the attributes. - self.screens.desktop.primaryScreen = MagicMock(return_value=screen[u'primary']) - self.screens.desktop.screenCount = MagicMock(return_value=screen[u'number'] + 1) - self.screens.desktop.screenGeometry = MagicMock(return_value=screen[u'size']) + self.screens.desktop.primaryScreen = MagicMock(return_value=SCREEN[u'primary']) + self.screens.desktop.screenCount = MagicMock(return_value=SCREEN[u'number'] + 1) + self.screens.desktop.screenGeometry = MagicMock(return_value=SCREEN[u'size']) # WHEN: Add a new screen. self.screens.screen_count_changed(len(old_screens)) @@ -49,5 +51,5 @@ class TestScreenList(TestCase): assert len(old_screens) + 1 == len(new_screens), u'The new_screens list should be bigger.' # THEN: The screens should be identically. - assert screen == new_screens.pop(), u'The new screen should be identically to the screen defined above.' + assert SCREEN == new_screens.pop(), u'The new screen should be identically to the screen defined above.' From 573f687d9efbc7354b35888c61182c2d97ba3ddb Mon Sep 17 00:00:00 2001 From: Andreas Preikschat Date: Sat, 16 Feb 2013 21:00:31 +0100 Subject: [PATCH 13/13] fixed spaces/lines --- tests/functional/openlp_core_lib/test_serviceitem.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/functional/openlp_core_lib/test_serviceitem.py b/tests/functional/openlp_core_lib/test_serviceitem.py index 05952471d..b731eaf00 100644 --- a/tests/functional/openlp_core_lib/test_serviceitem.py +++ b/tests/functional/openlp_core_lib/test_serviceitem.py @@ -17,7 +17,6 @@ VERSE = u'The Lord said to {r}Noah{/r}: \n'\ '{r}C{/r}{b}h{/b}{bl}i{/bl}{y}l{/y}{g}d{/g}{pk}'\ 'r{/pk}{o}e{/o}{pp}n{/pp} of the Lord\n' FOOTER = [u'Arky Arky (Unknown)', u'Public Domain', u'CCLI 123456'] - TESTPATH = os.path.abspath(os.path.join(os.path.dirname(__file__), u'..', u'..', u'resources')) @@ -39,7 +38,7 @@ class TestServiceItem(TestCase): """ # GIVEN: A new service item - # WHEN:A service item is created (without a plugin) + # WHEN: A service item is created (without a plugin) service_item = ServiceItem(None) # THEN: We should get back a valid service item @@ -209,4 +208,5 @@ class TestServiceItem(TestCase): first_line = items[0] except: first_line = u'' - return first_line \ No newline at end of file + return first_line +