Fix compilation errors in openlp dir

This commit is contained in:
Jon Tibble 2009-09-03 16:19:30 +01:00
parent cd3fe8b38f
commit 796ad1f4cf
16 changed files with 189 additions and 172 deletions

View File

@ -23,44 +23,52 @@ from openlp.core.lib import MediaManagerItem
class TestMediaManager: class TestMediaManager:
def setup_class(self): def setup_class(self):
self.app = QtGui.QApplication([]) self.app = QtGui.QApplication([])
logging.info (u'App is " + unicode(self.app)) logging.info (u'App is ' + unicode(self.app))
self.main_window = QtGui.QMainWindow() self.main_window = QtGui.QMainWindow()
self.main_window.resize(200, 600) self.main_window.resize(200, 600)
self.MediaManagerDock = QtGui.QDockWidget(self.main_window) self.MediaManagerDock = QtGui.QDockWidget(self.main_window)
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.MediaManagerDock.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(
self.MediaManagerDock.sizePolicy().hasHeightForWidth())
self.MediaManagerDock.setSizePolicy(sizePolicy) self.MediaManagerDock.setSizePolicy(sizePolicy)
icon = QtGui.QIcon() icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(u':/system/system_mediamanager.png'), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon.addPixmap(QtGui.QPixmap(u':/system/system_mediamanager.png'),
QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.MediaManagerDock.setWindowIcon(icon) self.MediaManagerDock.setWindowIcon(icon)
self.MediaManagerDock.setFloating(False) self.MediaManagerDock.setFloating(False)
self.MediaManagerContents = QtGui.QWidget() self.MediaManagerContents = QtGui.QWidget()
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
sizePolicy.setHorizontalStretch(0) sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0) sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.MediaManagerContents.sizePolicy().hasHeightForWidth()) sizePolicy.setHeightForWidth(
self.MediaManagerContents.sizePolicy().hasHeightForWidth())
self.MediaManagerContents.setSizePolicy(sizePolicy) self.MediaManagerContents.setSizePolicy(sizePolicy)
self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents) self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents)
self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0) self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0)
self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents) self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents)
self.MediaManagerDock.setWidget(self.MediaManagerContents) self.MediaManagerDock.setWidget(self.MediaManagerContents)
self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.MediaManagerDock) self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1),
self.MediaManagerDock)
self.MediaManagerLayout.addWidget(self.MediaToolBox) self.MediaManagerLayout.addWidget(self.MediaToolBox)
def test1(self): def test1(self):
log=logging.getLogger(u'test1') log=logging.getLogger(u'test1')
log.info(u'Start') log.info(u'Start')
i1=MediaManagerItem(self.MediaToolBox) i1=MediaManagerItem(self.MediaToolBox)
i2=MediaManagerItem(self.MediaToolBox) i2=MediaManagerItem(self.MediaToolBox)
log.info(u'i1"+unicode(i1)) log.info(u'i1'+unicode(i1))
log.info(u'i2"+unicode(i2)) log.info(u'i2'+unicode(i2))
i1.addToolbar() i1.addToolbar()
i1.addToolbarButton(u'Test1", u'Test1", None) i1.addToolbarButton(u'Test1', u'Test1', None)
i2.addToolbar() i2.addToolbar()
i2.addToolbarButton(u'Test2", u'Test2", None) i2.addToolbarButton(u'Test2', u'Test2', None)
self.MediaToolBox.setItemText(self.MediaToolBox.indexOf(i1), translate(u'main_window", u'Item1")) self.MediaToolBox.setItemText(self.MediaToolBox.indexOf(i1),
self.MediaToolBox.setItemText(self.MediaToolBox.indexOf(i2), translate(u'main_window", u'Item2")) translate(u'main_window', u'Item1'))
self.MediaToolBox.setItemText(self.MediaToolBox.indexOf(i2),
translate(u'main_window', u'Item2'))
log.info(u'Show window') log.info(u'Show window')
self.main_window.show() self.main_window.show()
log.info(u'End') log.info(u'End')

View File

@ -31,10 +31,10 @@ class TestPluginManager:
# get list of the names of the plugins # get list of the names of the plugins
names=[plugin.name for plugin in p.plugins] names=[plugin.name for plugin in p.plugins]
# see which ones we've got # see which ones we've got
assert (u'testplugin1" in names) assert (u'testplugin1' in names)
assert (u'testplugin2" in names) assert (u'testplugin2' in names)
# and not got - it's too deep in the hierarchy! # and not got - it's too deep in the hierarchy!
assert (u'testplugin3" not in names) assert (u'testplugin3' not in names)
# test that the weighting is done right # test that the weighting is done right
assert p.plugins[0].name == "testplugin2" assert p.plugins[0].name == "testplugin2"
assert p.plugins[1].name == "testplugin1" assert p.plugins[1].name == "testplugin1"
@ -44,4 +44,5 @@ if __name__=="__main__":
t.test_init() t.test_init()
log.debug(u'List of plugins found:') log.debug(u'List of plugins found:')
for plugin in t.p.plugins: for plugin in t.p.plugins:
log.debug(u'Plugin %s, name=%s (version=%d)"%(unicode(plugin), plugin.name, plugin.version)) log.debug(u'Plugin %s, name=%s (version=%d)' %(unicode(plugin),
plugin.name, plugin.version))

View File

@ -84,7 +84,7 @@ class TestRender_base:
def setup_method(self, method): def setup_method(self, method):
print "SSsetup", method print "SSsetup", method
if not hasattr(self, "app'): if not hasattr(self, 'app'):
self.app=None self.app=None
try: # see if we already have an app for some reason. try: # see if we already have an app for some reason.
# have to try and so something, cant just test against None # have to try and so something, cant just test against None
@ -109,7 +109,7 @@ class TestRender_base:
print "--------------- Setup Done -------------" print "--------------- Setup Done -------------"
def teardown_method(self, method): def teardown_method(self, method):
self.write_to_file(self.frame.GetPixmap(), "test_render') self.write_to_file(self.frame.GetPixmap(), 'test_render')
class TestRender(TestRender_base): class TestRender(TestRender_base):
def __init__(self): def __init__(self):
@ -121,18 +121,21 @@ class TestRender(TestRender_base):
themefile=os.path.abspath(u'data_for_tests/render_theme.xml') themefile=os.path.abspath(u'data_for_tests/render_theme.xml')
self.r.set_theme(Theme(themefile)) # set default theme self.r.set_theme(Theme(themefile)) # set default theme
self.r._render_background() self.r._render_background()
self.r.set_text_rectangle(QtCore.QRect(0,0, self.size.width()-1, self.size.height()-1)) self.r.set_text_rectangle(QtCore.QRect(0,0, self.size.width()-1,
self.size.height()-1))
self.msg=None self.msg=None
def test_easy(self): def test_easy(self):
answer=self.r._render_single_line(u'Test line", tlcorner=(0,100)) answer=self.r._render_single_line(u'Test line', tlcorner=(0,100))
assert (answer==(219,163)) assert (answer==(219,163))
def test_longer(self): def test_longer(self):
answer=self.r._render_single_line(u'Test line with more words than fit on one line", answer=self.r._render_single_line(
u'Test line with more words than fit on one line',
tlcorner=(10,10)) tlcorner=(10,10))
assert (answer==(753,136)) assert (answer==(753,136))
def test_even_longer(self): def test_even_longer(self):
answer=self.r._render_single_line(u'Test line with more words than fit on either one or two lines", answer=self.r._render_single_line(
u'Test line with more words than fit on either one or two lines',
tlcorner=(10,10)) tlcorner=(10,10))
assert(answer==(753,199)) assert(answer==(753,199))
def test_lines(self): def test_lines(self):
@ -187,7 +190,7 @@ Line 3"""
extra="" extra=""
if i == 51: # make an extra long line on line 51 to test wrapping if i == 51: # make an extra long line on line 51 to test wrapping
extra="Some more words to make it wrap around don't you know until it wraps so many times we don't know what to do" extra="Some more words to make it wrap around don't you know until it wraps so many times we don't know what to do"
lines.append(u'Line %d %s" % (i, extra)) lines.append(u'Line %d %s' % (i, extra))
result=self.r.split_set_of_lines(lines) result=self.r.split_set_of_lines(lines)
print "results---------------__", result print "results---------------__", result
for i in range(len(result)): for i in range(len(result)):

View File

@ -131,7 +131,7 @@ And drives away his fear.
def test_bg_stretch_y(self): def test_bg_stretch_y(self):
t=Theme(u'blank_theme.xml') t=Theme(u'blank_theme.xml')
t.BackgroundType = 2 t.BackgroundType = 2
t.BackgroundParameter1 = os.path.join(u'data_for_tests', "snowsmall.jpg'); t.BackgroundParameter1 = os.path.join(u'data_for_tests', 'snowsmall.jpg');
t.BackgroundParameter2 = QtGui.QColor(0,0,64); t.BackgroundParameter2 = QtGui.QColor(0,0,64);
t.BackgroundParameter3 = 0 t.BackgroundParameter3 = 0
t.Name="stretch y" t.Name="stretch y"
@ -144,7 +144,7 @@ And drives away his fear.
def test_bg_shrink_y(self): def test_bg_shrink_y(self):
t=Theme(u'blank_theme.xml') t=Theme(u'blank_theme.xml')
t.BackgroundType = 2 t.BackgroundType = 2
t.BackgroundParameter1 = os.path.join(u'data_for_tests', "snowbig.jpg'); t.BackgroundParameter1 = os.path.join(u'data_for_tests', 'snowbig.jpg');
t.BackgroundParameter2 = QtGui.QColor(0,0,64); t.BackgroundParameter2 = QtGui.QColor(0,0,64);
t.BackgroundParameter3 = 0 t.BackgroundParameter3 = 0
t.Name="shrink y" t.Name="shrink y"
@ -155,7 +155,8 @@ And drives away his fear.
def test_bg_stretch_x(self): def test_bg_stretch_x(self):
t=Theme(u'blank_theme.xml') t=Theme(u'blank_theme.xml')
t.BackgroundType = 2 t.BackgroundType = 2
t.BackgroundParameter1 = os.path.join(u'data_for_tests', "treessmall.jpg'); t.BackgroundParameter1 = os.path.join(u'data_for_tests',
'treessmall.jpg');
t.BackgroundParameter2 = QtGui.QColor(0,0,64); t.BackgroundParameter2 = QtGui.QColor(0,0,64);
t.BackgroundParameter3 = 0 t.BackgroundParameter3 = 0
t.VerticalAlign = 2 t.VerticalAlign = 2
@ -168,7 +169,7 @@ And drives away his fear.
def test_bg_shrink_x(self): def test_bg_shrink_x(self):
t=Theme(u'blank_theme.xml') t=Theme(u'blank_theme.xml')
t.BackgroundType = 2 t.BackgroundType = 2
t.BackgroundParameter1 = os.path.join(u'data_for_tests', "treesbig.jpg'); t.BackgroundParameter1 = os.path.join(u'data_for_tests', 'treesbig.jpg');
t.BackgroundParameter2 = QtGui.QColor(0,0,64); t.BackgroundParameter2 = QtGui.QColor(0,0,64);
t.BackgroundParameter3 = 0 t.BackgroundParameter3 = 0
t.VerticalAlign = 2 t.VerticalAlign = 2

View File

@ -11,18 +11,18 @@ from PyQt4 import QtGui
def test_read_theme(): def test_read_theme():
dir=os.path.split(__file__)[0] dir=os.path.split(__file__)[0]
# test we can read a theme # test we can read a theme
t=Theme(os.path.join(dir, "test_theme.xml')) t=Theme(os.path.join(dir, 'test_theme.xml'))
print t print t
assert(t.BackgroundParameter1 == "sunset1.jpg') assert(t.BackgroundParameter1 == 'sunset1.jpg')
assert(t.BackgroundParameter2 == None) assert(t.BackgroundParameter2 == None)
assert(t.BackgroundParameter3 == None) assert(t.BackgroundParameter3 == None)
assert(t.BackgroundType == 2) assert(t.BackgroundType == 2)
assert(t.FontColor == QtGui.QColor(255,255,255)) assert(t.FontColor == QtGui.QColor(255,255,255))
assert(t.FontName == "Tahoma') assert(t.FontName == 'Tahoma')
assert(t.FontProportion == 16) assert(t.FontProportion == 16)
assert(t.FontUnits == "pixels') assert(t.FontUnits == 'pixels')
assert(t.HorizontalAlign == 2) assert(t.HorizontalAlign == 2)
assert(t.Name == "openlp.org Packaged Theme') assert(t.Name == 'openlp.org Packaged Theme')
assert(t.Outline == -1) assert(t.Outline == -1)
assert(t.OutlineColor == QtGui.QColor(255,0,0)) assert(t.OutlineColor == QtGui.QColor(255,0,0))
assert(t.Shadow == -1) assert(t.Shadow == -1)
@ -37,11 +37,11 @@ def test_theme():
assert(t.BackgroundParameter3 == None) assert(t.BackgroundParameter3 == None)
assert(t.BackgroundType == 0) assert(t.BackgroundType == 0)
assert(t.FontColor == QtGui.QColor(255,255,255)) assert(t.FontColor == QtGui.QColor(255,255,255))
assert(t.FontName == "Arial') assert(t.FontName == 'Arial')
assert(t.FontProportion == 30) assert(t.FontProportion == 30)
assert(t.HorizontalAlign == 0) assert(t.HorizontalAlign == 0)
assert(t.FontUnits == "pixels') assert(t.FontUnits == 'pixels')
assert(t.Name == "BlankStyle') assert(t.Name == 'BlankStyle')
assert(t.Outline == 0) assert(t.Outline == 0)
assert(t.Shadow == 0) assert(t.Shadow == 0)
assert(t.VerticalAlign == 0) assert(t.VerticalAlign == 0)

View File

@ -28,7 +28,8 @@ from openlp.core.ui import ServiceManager
from openlp.plugins.images.lib import ImageServiceItem from openlp.plugins.images.lib import ImageServiceItem
import logging import logging
logging.basicConfig(filename="test_service_manager.log",level=logging.INFO, filemode="w') logging.basicConfig(filename='test_service_manager.log', level=logging.INFO,
filemode='w')
# # from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062 # # from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062
# def whoami(depth=1): # def whoami(depth=1):
@ -53,7 +54,7 @@ class TestServiceManager_base:
pass pass
def setup_method(self, method): def setup_method(self, method):
log.info(u'Setup method:"+unicode(method)) log.info(u'Setup method:' + unicode(method))
self.expected_answer="Don't know yet" self.expected_answer="Don't know yet"
self.answer=None self.answer=None
self.s=ServiceManager(None) self.s=ServiceManager(None)
@ -71,16 +72,16 @@ class TestServiceManager_base:
self.sm.select(i, QItemSelectionModel.ClearAndSelect) self.sm.select(i, QItemSelectionModel.ClearAndSelect)
log.info(unicode(self.sm.selectedIndexes())) log.info(unicode(self.sm.selectedIndexes()))
self.s.TreeView.setSelectionModel(self.sm) self.s.TreeView.setSelectionModel(self.sm)
log.info(u'Selected indexes = " + unicode(self.s.TreeView.selectedIndexes())) log.info(u'Selected indexes = ' + unicode(self.s.TreeView.selectedIndexes()))
def test_easy(self): def test_easy(self):
log.info(u'test_easy') log.info(u'test_easy')
item=ImageServiceItem(None) item=ImageServiceItem(None)
item.add(u'test.gif') item.add(u'test.gif')
self.s.addServiceItem(item) self.s.addServiceItem(item)
answer = self.s.oos_as_text() answer = self.s.oos_as_text()
log.info(u'Answer = " + unicode(answer)) log.info(u'Answer = ' + unicode(answer))
lines=answer.split(u'\n') lines=answer.split(u'\n')
log.info(u'lines = " + unicode(lines)) log.info(u'lines = ' + unicode(lines))
assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object') assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')
assert lines[1] == "test.gif" assert lines[1] == "test.gif"
log.info(u'done') log.info(u'done')
@ -96,9 +97,9 @@ class TestServiceManager_base:
item.add(u'test3.gif') item.add(u'test3.gif')
self.s.addServiceItem(item) self.s.addServiceItem(item)
answer = self.s.oos_as_text() answer = self.s.oos_as_text()
log.info(u'Answer = " + unicode(answer)) log.info(u'Answer = ' + unicode(answer))
lines=answer.split(u'\n') lines=answer.split(u'\n')
log.info(u'lines = " + unicode(lines)) log.info(u'lines = ' + unicode(lines))
assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object') assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')
assert lines[1] == "test.gif" assert lines[1] == "test.gif"
assert lines[2].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object') assert lines[2].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')
@ -113,15 +114,15 @@ class TestServiceManager_base:
item.add(u'test.gif') item.add(u'test.gif')
self.s.addServiceItem(item) self.s.addServiceItem(item)
self.select_row(0) self.select_row(0)
log.info(u'Selected indexes = " + unicode(self.s.TreeView.selectedIndexes())) log.info(u'Selected indexes = ' + unicode(self.s.TreeView.selectedIndexes()))
item=ImageServiceItem(None) item=ImageServiceItem(None)
item.add(u'test2.gif') item.add(u'test2.gif')
item.add(u'test3.gif') item.add(u'test3.gif')
self.s.addServiceItem(item) self.s.addServiceItem(item)
answer = self.s.oos_as_text() answer = self.s.oos_as_text()
log.info(u'Answer = " + unicode(answer)) log.info(u'Answer = ' + unicode(answer))
lines=answer.split(u'\n') lines=answer.split(u'\n')
log.info(u'lines = " + unicode(lines)) log.info(u'lines = ' + unicode(lines))
assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object') assert lines[0].startswith(u'# <openlp.plugins.images.imageserviceitem.ImageServiceItem object')
assert lines[1] == "test.gif" assert lines[1] == "test.gif"
assert lines[2] == "test2.gif" assert lines[2] == "test2.gif"

View File

@ -53,8 +53,8 @@ class TestBibleManager:
def testRegisterCSVBibleFiles(self): def testRegisterCSVBibleFiles(self):
# Register a bible from files # Register a bible from files
log.debug(u'\n.......testRegisterBibleFiles') log.debug(u'\n.......testRegisterBibleFiles')
self.bm.registerFileBible(u'TheMessage",'biblebooks_msg_short.csv','bibleverses_msg_short.csv') self.bm.registerFileBible(u'TheMessage','biblebooks_msg_short.csv','bibleverses_msg_short.csv')
self.bm.registerFileBible(u'NIV",'biblebooks_niv_short.csv','bibleverses_niv_short.csv') self.bm.registerFileBible(u'NIV','biblebooks_niv_short.csv','bibleverses_niv_short.csv')
b = self.bm.get_bibles() b = self.bm.get_bibles()
for b1 in b: for b1 in b:
log.debug( b1) log.debug( b1)
@ -62,10 +62,11 @@ class TestBibleManager:
def testRegisterHTTPBible(self): def testRegisterHTTPBible(self):
# Register a bible from files # Register a bible from files
log.debug( "\n.......testRegisterBibleHTTP') log.debug( '\n.......testRegisterBibleHTTP')
self.bm.registerHTTPBible(u'asv","Crosswalk", u'", u'", u'') self.bm.registerHTTPBible(u'asv', u'Crosswalk', u'', u'', u'')
self.bm.registerHTTPBible(u'nasb","Biblegateway", u'", u'", u'') self.bm.registerHTTPBible(u'nasb', u'Biblegateway', u'', u'', u'')
self.bm.registerHTTPBible(u'nkj","Biblegateway", u'http://tigger2:3128/", u'", u'') self.bm.registerHTTPBible(u'nkj', u'Biblegateway',
u'http://tigger2:3128/', u'', u'')
b = self.bm.get_bibles() b = self.bm.get_bibles()
for b1 in b: for b1 in b:
log.debug( b1) log.debug( b1)
@ -73,7 +74,7 @@ class TestBibleManager:
def testGetBibles(self): def testGetBibles(self):
log.debug( "\n.......testGetBibles') log.debug(u'\n.......testGetBibles')
# make sure the shuffled sequence does not lose any elements # make sure the shuffled sequence does not lose any elements
b = self.bm.get_bibles() b = self.bm.get_bibles()
for b1 in b: for b1 in b:
@ -81,25 +82,25 @@ class TestBibleManager:
assert(b1 in b) assert(b1 in b)
def testGetBibleBooks(self): def testGetBibleBooks(self):
log.debug( "\n.......testGetBibleBooks') log.debug(u'\n.......testGetBibleBooks')
c = self.bm.get_bible_books(u'NIV') c = self.bm.get_bible_books(u'NIV')
for c1 in c: for c1 in c:
log.debug( c1) log.debug( c1)
assert(c1 in c) assert(c1 in c)
def testGetBookChapterCount(self): def testGetBookChapterCount(self):
log.debug( "\n.......testGetBookChapterCount') log.debug(u'\n.......testGetBookChapterCount')
assert(self.bm.get_book_chapter_count(u'Matthew') == '28') assert(self.bm.get_book_chapter_count(u'Matthew') == '28')
def testGetBookVerseCount(self): def testGetBookVerseCount(self):
log.debug( "\n.......testGetBookVerseCount') log.debug(u'\n.......testGetBookVerseCount')
assert(self.bm.get_book_verse_count(u'Genesis", 1) == '31') assert(self.bm.get_book_verse_count(u'Genesis', 1) == '31')
assert(self.bm.get_book_verse_count(u'Genesis", 2) == '25') assert(self.bm.get_book_verse_count(u'Genesis', 2) == '25')
assert(self.bm.get_book_verse_count(u'Matthew", 1) == '25') assert(self.bm.get_book_verse_count(u'Matthew', 1) == '25')
assert(self.bm.get_book_verse_count(u'Revelation", 1) == '20') assert(self.bm.get_book_verse_count(u'Revelation', 1) == '20')
def testGetVerseText(self): def testGetVerseText(self):
log.debug( "\n.......testGetVerseText') log.debug(u'\n.......testGetVerseText')
#c = self.bm.get_verse_text(u'TheMessage",'Genesis',1,2,1) #c = self.bm.get_verse_text(u'TheMessage",'Genesis',1,2,1)
#log.debug( c ) #log.debug( c )
#c = self.bm.get_verse_text(u'NIV','Genesis',1,1,2) #c = self.bm.get_verse_text(u'NIV','Genesis',1,1,2)
@ -112,7 +113,7 @@ class TestBibleManager:
log.debug( c ) log.debug( c )
def testLoadBible(self): def testLoadBible(self):
log.debug( "\n.......testLoadBible') log.debug(u'\n.......testLoadBible')
#self.bm.loadBible(u'asv') #self.bm.loadBible(u'asv')
#self.bm.loadBible(u'nasb') #self.bm.loadBible(u'nasb')
#self.bm.loadBible(u'nkj') #self.bm.loadBible(u'nkj')

View File

@ -51,7 +51,7 @@ class TestBibleManager:
self.bm = BibleManager() self.bm = BibleManager()
def testGetBibles(self): def testGetBibles(self):
log.debug( "\n.......testGetBibles') log.debug(u'\n.......testGetBibles')
# make sure the shuffled sequence does not lose any elements # make sure the shuffled sequence does not lose any elements
b = self.bm.getBibles() b = self.bm.getBibles()
for b1 in b: for b1 in b:
@ -59,36 +59,37 @@ class TestBibleManager:
assert(b1 in b) assert(b1 in b)
def testGetBibleBooks(self): def testGetBibleBooks(self):
log.debug( "\n.......testGetBibleBooks') log.debug(u'\n.......testGetBibleBooks')
c = self.bm.getBibleBooks(u'asv') c = self.bm.getBibleBooks(u'asv')
for c1 in c: for c1 in c:
log.debug( c1) log.debug( c1)
assert(c1 in c) assert(c1 in c)
def testGetBookChapterCount(self): def testGetBookChapterCount(self):
log.debug( "\n.......testGetBookChapterCount') log.debug(u'\n.......testGetBookChapterCount')
assert(self.bm.getBookChapterCount(u'asv","Matthew')[0] == 28) assert(self.bm.getBookChapterCount(u'asv', u'Matthew')[0] == 28)
def testGetBookVerseCount(self): def testGetBookVerseCount(self):
log.debug( "\n.......testGetBookVerseCount') log.debug(u'\n.......testGetBookVerseCount')
assert(self.bm.getBookVerseCount(u'asv","Genesis", 1)[0] == 31) assert(self.bm.getBookVerseCount(u'asv', u'Genesis', 1)[0] == 31)
assert(self.bm.getBookVerseCount(u'TheMessage","Genesis", 2)[0] == 25) assert(self.bm.getBookVerseCount(u'TheMessage', u'Genesis', 2)[0] == 25)
assert(self.bm.getBookVerseCount(u'asv","Matthew", 1)[0] == 25) assert(self.bm.getBookVerseCount(u'asv', u'Matthew', 1)[0] == 25)
assert(self.bm.getBookVerseCount(u'TheMessage","Revelation", 1)[0] == 20) assert(self.bm.getBookVerseCount(u'TheMessage', u'Revelation',
1)[0] == 20)
def testGetVerseText(self): def testGetVerseText(self):
log.debug( "\n.......testGetVerseText') log.debug(u'\n.......testGetVerseText')
#c = self.bm.getVerseText(u'TheMessage",'Genesis',1,2,1) #c = self.bm.getVerseText(u'TheMessage",'Genesis',1,2,1)
#log.debug( c ) #log.debug( c )
#c = self.bm.getVerseText(u'NIV','Genesis',1,1,2) #c = self.bm.getVerseText(u'NIV','Genesis',1,1,2)
#log.debug( c ) #log.debug( c )
c = self.bm.getVerseText(u'asv','Genesis',10,1,20) c = self.bm.getVerseText(u'asv', u'Genesis', 10, 1, 20)
log.debug( c ) log.debug( c )
c = self.bm.getVerseText(u'TheMessage','Genesis',10,1,20) c = self.bm.getVerseText(u'TheMessage', u'Genesis', 10, 1, 20)
log.debug( c ) log.debug( c )
c = self.bm.getVerseText(u'asv','Revelation',10,1,20) c = self.bm.getVerseText(u'asv', u'Revelation', 10, 1, 20)
log.debug( c ) log.debug( c )
c = self.bm.getVersesFromText(u'asv", u'Jesus wept') c = self.bm.getVersesFromText(u'asv', u'Jesus wept')
log.debug( c ) log.debug( c )
c = self.bm.getVersesFromText(u'TheMessage", u'Jesus wept') c = self.bm.getVersesFromText(u'TheMessage', u'Jesus wept')
log.debug( c ) log.debug( c )

View File

@ -53,8 +53,10 @@ class TestBibleManager:
def testRegisterCSVBibleFiles(self): def testRegisterCSVBibleFiles(self):
# Register a bible from files # Register a bible from files
log.debug(u'\n.......testRegisterBibleFiles') log.debug(u'\n.......testRegisterBibleFiles')
self.bm.registerCSVFileBible(u'TheMessage",'biblebooks_msg_short.csv','bibleverses_msg_short.csv') self.bm.registerCSVFileBible(u'TheMessage',
self.bm.registerCSVFileBible(u'NIV",'biblebooks_niv_short.csv','bibleverses_niv_short.csv') u'biblebooks_msg_short.csv', u'bibleverses_msg_short.csv')
self.bm.registerCSVFileBible(u'NIV', u'biblebooks_niv_short.csv',
u'bibleverses_niv_short.csv')
b = self.bm.get_bibles() b = self.bm.get_bibles()
for b1 in b: for b1 in b:
log.debug( b1) log.debug( b1)

View File

@ -53,7 +53,7 @@ class TestBibleManager:
def testRegisterOSISBibleFiles(self): def testRegisterOSISBibleFiles(self):
# Register a bible from files # Register a bible from files
log.debug(u'\n.......testRegisterOSISBibleFiles') log.debug(u'\n.......testRegisterOSISBibleFiles')
self.bm.register_osis_file_bible(u'asv",'asv.osis') self.bm.register_osis_file_bible(u'asv', u'asv.osis')
b = self.bm.get_bibles() b = self.bm.get_bibles()
for b1 in b: for b1 in b:
log.debug( b1) log.debug( b1)

View File

@ -4,7 +4,7 @@ from PyQt4 import QtGui, QtCore
from ctypes import * from ctypes import *
from ctypes.wintypes import RECT from ctypes.wintypes import RECT
pptdll = cdll.LoadLibrary(r"C:\Documents and Settings\jonathan\My Documents\Personal\openlp\openlp-2\trunk\openlp\libraries\pptviewlib\pptviewlib.dll') pptdll = cdll.LoadLibrary(r'C:\Documents and Settings\jonathan\My Documents\Personal\openlp\openlp-2\trunk\openlp\libraries\pptviewlib\pptviewlib.dll')
class BoxLayout(QtGui.QWidget): class BoxLayout(QtGui.QWidget):
def __init__(self, parent=None): def __init__(self, parent=None):
@ -107,7 +107,7 @@ class BoxLayout(QtGui.QWidget):
rect.width = 900 rect.width = 900
rect.hight = 700 rect.hight = 700
#self.pptid = pptdll.OpenPPT(self.PPTEdit.text, None, rect, "c:\temp\slide') #self.pptid = pptdll.OpenPPT(self.PPTEdit.text, None, rect, "c:\temp\slide')
self.pptid = pptdll.OpenPPT(u'C:\\test 1.ppt", None, rect, "c:\temp\slide') self.pptid = pptdll.OpenPPT(u'C:\\test 1.ppt', None, rect, 'c:\temp\slide')
self.total.setText(pptdll.GetSlideCount(self.pptid)) self.total.setText(pptdll.GetSlideCount(self.pptid))
self.slideEdit.setText(unicode(pptdll.GetCurrentSlide(self.pptid))) self.slideEdit.setText(unicode(pptdll.GetCurrentSlide(self.pptid)))

View File

@ -109,7 +109,7 @@ class PPTViewer(QtGui.QWidget):
rect = RECT(100,100,900,700) rect = RECT(100,100,900,700)
filename = unicode(self.PPTEdit.text()) filename = unicode(self.PPTEdit.text())
print filename print filename
self.pptid = pptdll.OpenPPT(filename, None, rect, "c:\\temp\\slide') self.pptid = pptdll.OpenPPT(filename, None, rect, 'c:\\temp\\slide')
print "id: " + unicode(self.pptid) print "id: " + unicode(self.pptid)
if oldid>=0: if oldid>=0:
pptdll.ClosePPT(oldid); pptdll.ClosePPT(oldid);
@ -136,8 +136,8 @@ class PPTViewer(QtGui.QWidget):
self.PPTEdit.setText(QtGui.QFileDialog.getOpenFileName(self, 'Open file')) self.PPTEdit.setText(QtGui.QFileDialog.getOpenFileName(self, 'Open file'))
if __name__ == '__main__': if __name__ == '__main__':
#pptdll = cdll.LoadLibrary(r"C:\Documents and Settings\jonathan\Desktop\pptviewlib.dll') #pptdll = cdll.LoadLibrary(r'C:\Documents and Settings\jonathan\Desktop\pptviewlib.dll')
pptdll = cdll.LoadLibrary(r"pptviewlib.dll') pptdll = cdll.LoadLibrary(r'pptviewlib.dll')
pptdll.SetDebug(1) pptdll.SetDebug(1)
print "Begin..." print "Begin..."
app = QtGui.QApplication(sys.argv) app = QtGui.QApplication(sys.argv)

View File

@ -75,13 +75,13 @@ class _OpenSong(XmlRootClass):
def _reset(self): def _reset(self):
"""Reset all song attributes""" """Reset all song attributes"""
global _blankOpenSongXml global _blankOpenSongXml
self._setFromXml(_blankOpenSongXml, "song') self._setFromXml(_blankOpenSongXml, 'song')
def from_buffer(self, xmlContent): def from_buffer(self, xmlContent):
"""Initialize from buffer(string) with xml content""" """Initialize from buffer(string) with xml content"""
self._reset() self._reset()
if xmlContent != None : if xmlContent != None :
self._setFromXml(xmlContent, "song') self._setFromXml(xmlContent, 'song')
def get_author_list(self): def get_author_list(self):
"""Convert author field to an authorlist """Convert author field to an authorlist
@ -94,7 +94,7 @@ class _OpenSong(XmlRootClass):
lst = self.author.split(u' and ') lst = self.author.split(u' and ')
for l in lst : for l in lst :
res.append(l.strip()) res.append(l.strip())
s = ", u'.join(res) s = u', '.join(res)
return s return s
def get_category_array(self): def get_category_array(self):
@ -107,7 +107,7 @@ class _OpenSong(XmlRootClass):
res.append(self.theme) res.append(self.theme)
if self.alttheme != None : if self.alttheme != None :
res.append(self.alttheme) res.append(self.alttheme)
s = ", u'.join(res) s = u', u'.join(res)
return s return s
def _reorder_verse(self, tag, tmpVerse): def _reorder_verse(self, tag, tmpVerse):
@ -134,7 +134,7 @@ class _OpenSong(XmlRootClass):
newtag = "Pre-chorus" newtag = "Pre-chorus"
else : else :
newtag = t newtag = t
s = (u'# %s %s"%(newtag, c)).rstrip() s = (u'# %s %s'%(newtag, c)).rstrip()
res.append(s) res.append(s)
res.append(l[1:]) res.append(l[1:])
if (len(l) == 0) and (not tagPending) : if (len(l) == 0) and (not tagPending) :
@ -355,7 +355,7 @@ class Song(object) :
elif l.startswith(u'Misc') : elif l.startswith(u'Misc') :
metMisc = True metMisc = True
elif l.startswith(u'Verse') or l.startswith(u'Chorus'): elif l.startswith(u'Verse') or l.startswith(u'Chorus'):
lyrics.append(u'# %s"%l) lyrics.append(u'# %s'%l)
else : else :
# should we remove multiple blank lines? # should we remove multiple blank lines?
if n == 1 : if n == 1 :
@ -366,7 +366,7 @@ class Song(object) :
lst = sAuthor.split(u'/') lst = sAuthor.split(u'/')
if len(lst) < 2: if len(lst) < 2:
lst = sAuthor.split(u'|') lst = sAuthor.split(u'|')
author_list = ", u'.join(lst) author_list = u', '.join(lst)
self.set_title(sName) self.set_title(sName)
self.set_author_list(author_list) self.set_author_list(author_list)
self.set_copyright(sCopyright) self.set_copyright(sCopyright)
@ -413,7 +413,7 @@ class Song(object) :
lst = [] lst = []
else : else :
raise SongTypeError(u'Variable not String or List') raise SongTypeError(u'Variable not String or List')
s = ", u'.join(lst) s = u', '.join(lst)
return s return s
def get_copyright(self): def get_copyright(self):

View File

@ -26,7 +26,7 @@ __ThisDir__ = os.path.dirname(__file__)
if "" == __ThisDir__ : if "" == __ThisDir__ :
__ThisDir__ = os.path.abspath(u'.') __ThisDir__ = os.path.abspath(u'.')
sys.path.append(os.path.abspath(u'%s/../../../.."%__ThisDir__)) sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
from openlp.plugins.songs.lib.songxml import * from openlp.plugins.songs.lib.songxml import *
@ -43,7 +43,7 @@ class Test_Basic(object):
def test_Title1(self): def test_Title1(self):
"""Set an empty title - raises an exception""" """Set an empty title - raises an exception"""
s = Song() s = Song()
py.test.raises(SongTitleError, s.set_title, "') py.test.raises(SongTitleError, s.set_title, '')
def test_Title2(self): def test_Title2(self):
"""Set a normal title""" """Set a normal title"""
@ -74,99 +74,99 @@ class Test_Basic(object):
def test_Title5(self): def test_Title5(self):
"""Set a title, where searchable title becomes empty - raises an exception""" """Set a title, where searchable title becomes empty - raises an exception"""
s = Song() s = Song()
py.test.raises(SongTitleError, s.set_title, ",*') py.test.raises(SongTitleError, s.set_title, ',*')
def test_Copyright(self): def test_Copyright(self):
"""Set a copyright string""" """Set a copyright string"""
s = Song() s = Song()
assert(s.get_copyright() == "') assert(s.get_copyright() == '')
s.set_copyright(u'A B Car') s.set_copyright(u'A B Car')
assert(s.get_copyright() == "A B Car') assert(s.get_copyright() == 'A B Car')
def test_SongCclino(self): def test_SongCclino(self):
"""Set a SongCcliNo""" """Set a SongCcliNo"""
s = Song() s = Song()
assert(s.get_song_cclino() == "') assert(s.get_song_cclino() == '')
s.set_song_cclino(12345) s.set_song_cclino(12345)
assert(s.get_song_cclino() == "12345') assert(s.get_song_cclino() == '12345')
def test_SongBook(self): def test_SongBook(self):
"""Set a songbook value""" """Set a songbook value"""
s = Song() s = Song()
assert(s.get_song_book() == "') assert(s.get_song_book() == '')
s.set_song_book(u'Hymns') s.set_song_book(u'Hymns')
assert(s.get_song_book() == "Hymns') assert(s.get_song_book() == u'Hymns')
def test_SongNumber(self): def test_SongNumber(self):
"""Set a song number""" """Set a song number"""
s = Song() s = Song()
assert(s.get_song_number() == "') assert(s.get_song_number() == '')
s.set_song_number(278) s.set_song_number(278)
assert(s.get_song_number() == "278') assert(s.get_song_number() == '278')
def test_Theme(self): def test_Theme(self):
"""Set a theme name""" """Set a theme name"""
s = Song() s = Song()
assert(s.get_theme() == "') assert(s.get_theme() == '')
s.set_theme(u'Red') s.set_theme(u'Red')
assert(s.get_theme() == "Red') assert(s.get_theme() == 'Red')
def test_VerseOrder(self): def test_VerseOrder(self):
"""Set a verse order""" """Set a verse order"""
s = Song() s = Song()
assert(s.get_verse_order() == "') assert(s.get_verse_order() == '')
s.set_verse_order(u'V1 C V2') s.set_verse_order(u'V1 C V2')
assert(s.get_verse_order() == "V1 C V2') assert(s.get_verse_order() == 'V1 C V2')
def test_Comments(self): def test_Comments(self):
"""Set a comment""" """Set a comment"""
s = Song() s = Song()
assert(s.get_comments() == "') assert(s.get_comments() == '')
s.set_comments(u'a comment') s.set_comments(u'a comment')
assert(s.get_comments() == "a comment') assert(s.get_comments() == 'a comment')
def test_AuthorList(self): def test_AuthorList(self):
"""Set author lists""" """Set author lists"""
s = Song() s = Song()
assert(s.get_author_list(True) == "') assert(s.get_author_list(True) == '')
assert(s.get_author_list(False) == []) assert(s.get_author_list(False) == [])
t1 = "John Newton" t1 = "John Newton"
s.set_author_list(t1) s.set_author_list(t1)
assert(s.get_author_list(True) == t1) assert(s.get_author_list(True) == t1)
assert(s.get_author_list(False) == [t1]) assert(s.get_author_list(False) == [t1])
s.set_author_list(u' Peter Done , John Newton') s.set_author_list(u' Peter Done , John Newton')
assert(s.get_author_list(True)== "Peter Done, John Newton') assert(s.get_author_list(True)== 'Peter Done, John Newton')
assert(s.get_author_list(False) == ["Peter Done", u'John Newton"]) assert(s.get_author_list(False) == ["Peter Done", u'John Newton'])
s.set_author_list(None) s.set_author_list(None)
assert(s.get_author_list(True) == "') assert(s.get_author_list(True) == '')
assert(s.get_author_list(False) == []) assert(s.get_author_list(False) == [])
s.set_author_list(u'') s.set_author_list(u'')
assert(s.get_author_list(True) == "') assert(s.get_author_list(True) == '')
assert(s.get_author_list(False) == [""]) assert(s.get_author_list(False) == [""])
s.set_author_list([]) s.set_author_list([])
assert(s.get_author_list(True) == "') assert(s.get_author_list(True) == '')
assert(s.get_author_list(False) == [""]) assert(s.get_author_list(False) == [""])
def test_CategoryArray(self): def test_CategoryArray(self):
"""Set categories""" """Set categories"""
s = Song() s = Song()
assert(s.get_category_array(True) == "') assert(s.get_category_array(True) == '')
assert(s.get_category_array(False) == []) assert(s.get_category_array(False) == [])
t1 = "Gospel" t1 = "Gospel"
s.set_category_array(t1) s.set_category_array(t1)
assert(s.get_category_array(True) == t1) assert(s.get_category_array(True) == t1)
assert(s.get_category_array(False) == [t1]) assert(s.get_category_array(False) == [t1])
s.set_category_array(u' Gospel, Hymns ') s.set_category_array(u' Gospel, Hymns ')
assert(s.get_category_array(True) == "Gospel, Hymns') assert(s.get_category_array(True) == 'Gospel, Hymns')
assert(s.get_category_array(False) == ["Gospel", u'Hymns"]) assert(s.get_category_array(False) == ["Gospel", u'Hymns'])
s.set_category_array(None) s.set_category_array(None)
assert(s.get_category_array(True) == "') assert(s.get_category_array(True) == '')
assert(s.get_category_array(False) == []) assert(s.get_category_array(False) == [])
s.set_category_array(u'') s.set_category_array(u'')
assert(s.get_category_array(True) == "') assert(s.get_category_array(True) == '')
assert(s.get_category_array(False) == [""]) assert(s.get_category_array(False) == [""])
s.set_category_array([]) s.set_category_array([])
assert(s.get_category_array(True) == "') assert(s.get_category_array(True) == '')
assert(s.get_category_array(False) == [""]) assert(s.get_category_array(False) == [""])
if '__main__' == __name__: if '__main__' == __name__:

View File

@ -24,7 +24,7 @@ __ThisDir__ = os.path.dirname(__file__)
if "" == __ThisDir__ : if "" == __ThisDir__ :
__ThisDir__ = os.path.abspath(u'.') __ThisDir__ = os.path.abspath(u'.')
sys.path.append(os.path.abspath(u'%s/../../../.."%__ThisDir__)) sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
from openlp.plugins.songs.lib.songxml import * from openlp.plugins.songs.lib.songxml import *
@ -147,38 +147,38 @@ class Test_OpenSong(object):
"""OpenSong: parse Amazing Grace""" """OpenSong: parse Amazing Grace"""
global __ThisDir__ global __ThisDir__
s = Song() s = Song()
s.from_opensong_file(u'%s/data_opensong/Amazing Grace"%(__ThisDir__)) s.from_opensong_file(u'%s/data_opensong/Amazing Grace'%(__ThisDir__))
assert(s.get_title() == "Amazing Grace') assert(s.get_title() == 'Amazing Grace')
assert(s.get_copyright() == "1982 Jubilate Hymns Limited') assert(s.get_copyright() == '1982 Jubilate Hymns Limited')
assert(s.get_song_cclino() == "1037882') assert(s.get_song_cclino() == '1037882')
assert(s.get_category_array(True) == "God: Attributes') assert(s.get_category_array(True) == 'God: Attributes')
assert(s.get_author_list(True) == "John Newton') assert(s.get_author_list(True) == 'John Newton')
assert(s.get_verse_order() == "') assert(s.get_verse_order() == '')
assert(s.get_number_of_slides() == 4) assert(s.get_number_of_slides() == 4)
def test_file2(self): def test_file2(self):
"""OpenSong: parse The Solid Rock""" """OpenSong: parse The Solid Rock"""
s = Song() s = Song()
s.from_opensong_file(u'%s/data_opensong/The Solid Rock"%(__ThisDir__)) s.from_opensong_file(u'%s/data_opensong/The Solid Rock'%(__ThisDir__))
assert(s.get_title() == "The Solid Rock') assert(s.get_title() == 'The Solid Rock')
assert(s.get_copyright() == "Public Domain') assert(s.get_copyright() == 'Public Domain')
assert(s.get_song_cclino() == "101740') assert(s.get_song_cclino() == '101740')
assert(s.get_category_array(True) == "Christ: Victory, Fruit: Peace/Comfort') assert(s.get_category_array(True) == 'Christ: Victory, Fruit: Peace/Comfort')
assert(s.get_author_list(True) == "Edward Mote, John B. Dykes') assert(s.get_author_list(True) == 'Edward Mote, John B. Dykes')
assert(s.get_verse_order() == "V1 C V2 C V3 C V4 C') assert(s.get_verse_order() == 'V1 C V2 C V3 C V4 C')
assert(s.get_number_of_slides() == 5) assert(s.get_number_of_slides() == 5)
def test_file3(self): def test_file3(self):
"""OpenSong: parse 'På en fjern ensom høj' (danish)""" """OpenSong: parse 'På en fjern ensom høj' (danish)"""
#FIXME: problem with XML convert and danish characters #FIXME: problem with XML convert and danish characters
s = Song() s = Song()
s.from_opensong_file(u'%s/data_opensong/På en fjern ensom høj"%(__ThisDir__)) s.from_opensong_file(u'%s/data_opensong/På en fjern ensom høj'%(__ThisDir__))
assert(s.get_title() == u"På en fjern ensom høj') assert(s.get_title() == u'På en fjern ensom høj')
assert(s.get_copyright() == "') assert(s.get_copyright() == '')
assert(s.get_song_cclino() == "') assert(s.get_song_cclino() == '')
assert(s.get_category_array(True) == "') assert(s.get_category_array(True) == '')
assert(s.get_author_list(True) == "') assert(s.get_author_list(True) == '')
assert(s.get_verse_order() == "V1 C1 V2 C2 V3 C3 V4 C4') assert(s.get_verse_order() == 'V1 C1 V2 C2 V3 C3 V4 C4')
assert(s.get_number_of_slides() == 8) assert(s.get_number_of_slides() == 8)
if '__main__' == __name__: if '__main__' == __name__:

View File

@ -25,7 +25,7 @@ __ThisDir__ = os.path.dirname(__file__)
if "" == __ThisDir__ : if "" == __ThisDir__ :
__ThisDir__ = os.path.abspath(u'.') __ThisDir__ = os.path.abspath(u'.')
sys.path.append(os.path.abspath(u'%s/../../../.."%__ThisDir__)) sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__))
from openlp.plugins.songs.lib.songxml import * from openlp.plugins.songs.lib.songxml import *
@ -49,19 +49,19 @@ class Test_Verse(object):
def check_allfields(self, r, isblank = 0): def check_allfields(self, r, isblank = 0):
#[theme, title, author, cpright, ccli, lyrics] #[theme, title, author, cpright, ccli, lyrics]
if isblank == 1 : if isblank == 1 :
assert(r[1] == "') assert(r[1] == '')
else : else :
assert(r[1] == self.title) assert(r[1] == self.title)
if isblank == 2 : if isblank == 2 :
assert(r[2] == "') assert(r[2] == '')
else : else :
assert(r[2] == self.author) assert(r[2] == self.author)
if isblank == 3 : if isblank == 3 :
assert(r[3] == "') assert(r[3] == '')
else : else :
assert(r[3] == self.copyright) assert(r[3] == self.copyright)
if isblank == 4 : if isblank == 4 :
assert(r[4] == "') assert(r[4] == '')
else : else :
assert(r[4] == self.ccli) assert(r[4] == self.ccli)
@ -135,18 +135,17 @@ class Test_Verse(object):
def test_verse3b(self): def test_verse3b(self):
"""Test a one liner song""" """Test a one liner song"""
s = Song() s = Song()
s.set_lyrics(["", u'Single verse"]) s.set_lyrics(["", u'Single verse'])
assert(s.get_number_of_slides() == 1) assert(s.get_number_of_slides() == 1)
def test_verse3c(self): def test_verse3c(self):
"""Test a one liner song""" """Test a one liner song"""
s = Song() s = Song()
s.set_lyrics(["", u'Single verse", u'", u'"]) s.set_lyrics(["", u'Single verse', u'', u''])
assert(s.get_number_of_slides() == 1) assert(s.get_number_of_slides() == 1)
def test_verse3d(self): def test_verse3d(self):
"""Test a one liner song""" """Test a one liner song"""
s = Song() s = Song()
s.set_lyrics(["", u'# Verse", u'", u'"]) s.set_lyrics(["", u'# Verse', u'', u''])
assert(s.get_number_of_slides() == 1) assert(s.get_number_of_slides() == 1)