2013-02-13 19:10:41 +00:00
|
|
|
"""
|
2013-02-13 19:22:43 +00:00
|
|
|
Package to test the openlp.core.lib package.
|
2013-02-13 19:10:41 +00:00
|
|
|
"""
|
|
|
|
|
2013-02-16 06:51:25 +00:00
|
|
|
from unittest import TestCase
|
2013-02-17 20:11:37 +00:00
|
|
|
from mock import MagicMock, patch
|
2013-02-16 06:51:25 +00:00
|
|
|
|
|
|
|
from PyQt4 import QtGui
|
|
|
|
|
2013-02-13 19:10:41 +00:00
|
|
|
from openlp.core.lib import Registry, ScreenList
|
|
|
|
from openlp.core.ui.mainwindow import MainWindow
|
|
|
|
|
|
|
|
|
2013-02-17 20:11:37 +00:00
|
|
|
class TestServiceManager(TestCase):
|
2013-02-13 19:10:41 +00:00
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
"""
|
|
|
|
Create the UI
|
|
|
|
"""
|
|
|
|
Registry.create()
|
2013-02-17 20:11:37 +00:00
|
|
|
self.app = QtGui.QApplication.instance()
|
2013-02-13 19:10:41 +00:00
|
|
|
ScreenList.create(self.app.desktop())
|
|
|
|
Registry().register(u'application', MagicMock())
|
2013-02-18 19:34:36 +00:00
|
|
|
#with patch(u'openlp.core.lib.PluginManager'):
|
|
|
|
# self.main_window = MainWindow()
|
|
|
|
#self.service_manager = Registry().get(u'service_manager')
|
2013-02-13 19:10:41 +00:00
|
|
|
|
|
|
|
def tearDown(self):
|
|
|
|
"""
|
|
|
|
Delete all the C++ objects at the end so that we don't have a segfault
|
|
|
|
"""
|
2013-02-18 19:34:36 +00:00
|
|
|
#del self.main_window
|
2013-02-13 19:10:41 +00:00
|
|
|
del self.app
|
|
|
|
|
|
|
|
def basic_service_manager_test(self):
|
|
|
|
"""
|
|
|
|
Test the Service Manager display functionality
|
|
|
|
"""
|
|
|
|
# GIVEN: A New Service Manager instance
|
|
|
|
|
|
|
|
# WHEN I have an empty display
|
|
|
|
# THEN the count of items should be zero
|
2013-02-18 19:34:36 +00:00
|
|
|
#self.assertEqual(self.service_manager.service_manager_list.topLevelItemCount(), 0,
|
|
|
|
# u'The service manager list should be empty ')
|
|
|
|
pass
|