This commit is contained in:
Tim Bentley 2013-01-20 17:12:33 +00:00
parent d4db88d2a4
commit 3681ef911c
5 changed files with 109 additions and 54 deletions

View File

@ -468,8 +468,7 @@ from plugin import PluginStatus, StringContent, Plugin
from pluginmanager import PluginManager
from settingstab import SettingsTab
from serviceitem import ServiceItem, ServiceItemType, ItemCapabilities
from htmlbuilder import build_html, build_lyrics_format_css, \
build_lyrics_outline_css
from htmlbuilder import build_html, build_lyrics_format_css, build_lyrics_outline_css
from toolbar import OpenLPToolbar
from dockwidget import OpenLPDockWidget
from imagemanager import ImageManager

View File

@ -37,7 +37,7 @@ import logging
import os
import uuid
from PyQt4 import QtCore, QtGui
from PyQt4 import QtGui
from openlp.core.lib import build_icon, clean_tags, expand_tags, translate, ImageSource, Settings

View File

@ -0,0 +1,79 @@
(lp1
(dp2
Vserviceitem
p3
(dp4
Vheader
p5
(dp6
Vfooter
p7
(lp8
sVaudit
p9
V
sVsearch
p10
V
sVwill_auto_start
p11
I00
sVname
p12
Vimages
p13
sVplugin
p14
g13
sVdata
p15
V
sVnotes
p16
V
sVtitle
p17
VImages
p18
sVfrom_plugin
p19
I00
sVcapabilities
p20
(lp21
I3
aI1
aI5
aI6
asVmedia_length
p22
I0
sVtheme_overwritten
p23
I00
sVtheme
p24
I-1
sVxml_version
p25
NsVend_time
p26
I0
sVbackground_audio
p27
(lp28
sVtype
p29
I2
sVstart_time
p30
I0
sVicon
p31
V:/plugins/plugin_images.png
p32
ssg15
(lp33
VIMG_7453.JPG
p34
assa.

View File

@ -5,8 +5,11 @@ import os
import cPickle
from unittest import TestCase
from mock import MagicMock
from openlp.core.lib import ServiceItem
from mock import MagicMock, patch
from PyQt4 import QtGui
from openlp.core.lib import ServiceItem, Settings
VERSE = u'The Lord said to {r}Noah{/r}: \n'\
'There\'s gonna be a {su}floody{/su}, {sb}floody{/sb}\n'\
@ -166,7 +169,7 @@ class TestServiceItem(TestCase):
def serviceitem_load_custom_from_service_test(self):
"""
Test the Service Item - adding from a saved service
Test the Service Item - adding a custom slide from a saved service
"""
# GIVEN: A new service item and a mocked add icon function
service_item = ServiceItem(None)
@ -186,6 +189,28 @@ class TestServiceItem(TestCase):
service_item.render(True)
assert (service_item.get_display_title()) == u'Test Custom', u'The custom title is correct'
def serviceitem_load_image_from_service_test(self):
"""
Test the Service Item - adding an image from a saved service
"""
# GIVEN: A new service item and a mocked add icon function
service_item = ServiceItem(None)
mocked_add_icon = MagicMock()
service_item.add_icon = mocked_add_icon
mocked_renderer = MagicMock()
service_item.renderer = mocked_renderer
# WHEN: adding a custom from a saved Service
#with patch(u'openlp_core_lib_settings') as mocked_settings:
# line = self.convert_file_service_item(u'serviceitem_image1.osd')
# service_item.set_from_service(line)
# THEN: We should get back a valid service item
#assert service_item.is_valid is True, u'The new service item should be valid'
#assert len(service_item._display_frames) == 0, u'The service item has no display frames'
#assert len(service_item.capabilities) == 5, u'There are 5 default custom item capabilities'
#assert (service_item.get_display_title()) == u'Test Custom', u'The custom title is correct'
def convert_file_service_item(self, name):
service_file = os.path.join(TESTPATH, name)
try:

View File

@ -1,48 +0,0 @@
"""
Package to test the openlp.core.ui package.
"""
import sys
from unittest import TestCase
from mock import MagicMock
from openlp.core.ui import starttimeform
from PyQt4 import QtCore, QtGui, QtTest
class TestStartTimeDialog(TestCase):
def setUp(self):
"""
Create the UI
"""
self.app = QtGui.QApplication(sys.argv)
self.window = QtGui.QMainWindow()
self.form = starttimeform.StartTimeForm(self.window)
def ui_defaults_test(self):
"""
Test StartTimeDialog defaults
"""
self.assertEqual(self.form.hourSpinBox.minimum(), 0)
self.assertEqual(self.form.hourSpinBox.maximum(), 4)
self.assertEqual(self.form.minuteSpinBox.minimum(), 0)
self.assertEqual(self.form.minuteSpinBox.maximum(), 59)
self.assertEqual(self.form.secondSpinBox.minimum(), 0)
self.assertEqual(self.form.secondSpinBox.maximum(), 59)
self.assertEqual(self.form.hourFinishSpinBox.minimum(), 0)
self.assertEqual(self.form.hourFinishSpinBox.maximum(), 4)
self.assertEqual(self.form.minuteFinishSpinBox.minimum(), 0)
self.assertEqual(self.form.minuteFinishSpinBox.maximum(), 59)
self.assertEqual(self.form.secondFinishSpinBox.minimum(), 0)
self.assertEqual(self.form.secondFinishSpinBox.maximum(), 59)
def time_display_test(self):
"""
Test StartTimeDialog display initialisation
"""
#GIVEN: A service item with with time
mocked_serviceitem = MagicMock()
mocked_serviceitem.start_time = 61
mocked_serviceitem.end_time = 3701
self.form.item = mocked_serviceitem
#self.form.exec_()