forked from openlp/openlp
test theme, alttheme -> our theme
This commit is contained in:
parent
7297248d88
commit
b3559a993d
@ -118,6 +118,8 @@ class OpenSongImport:
|
||||
self.do_import_file(file)
|
||||
if commit:
|
||||
self.finish()
|
||||
|
||||
|
||||
def do_import_file(self, file):
|
||||
"""
|
||||
Process the OpenSong file - pass in a file-like object, not a filename
|
||||
@ -135,6 +137,13 @@ class OpenSongImport:
|
||||
for (attr, fn) in decode.items():
|
||||
if attr in fields:
|
||||
fn(unicode(root.__getattr__(attr)))
|
||||
|
||||
res = []
|
||||
if u'theme' in fields:
|
||||
res.append(unicode(root.theme))
|
||||
if u'alttheme' in fields:
|
||||
res.append(unicode(root.alttheme))
|
||||
self.song.theme=u', '.join(res)
|
||||
|
||||
# data storage while importing
|
||||
verses = {}
|
||||
|
@ -30,7 +30,7 @@ def test():
|
||||
manager = SongManager()
|
||||
o = OpenSongImport(manager)
|
||||
o.do_import(u'test.opensong', commit=False)
|
||||
# o.finish()
|
||||
o.finish()
|
||||
o.song.print_song()
|
||||
assert o.song.copyright == u'2010 Martin Thompson'
|
||||
assert o.song.authors == [u'MartiÑ Thómpson']
|
||||
@ -45,7 +45,8 @@ def test():
|
||||
assert [u'V2', u'v2 Line 1\nV2 Line 2'] in o.song.verses
|
||||
assert o.song.verse_order_list == [u'V1', u'C', u'V2', u'C2', u'V3', u'B1', u'V1']
|
||||
assert o.song.ccli_number == u'Blah'
|
||||
|
||||
print u':%s:'%o.song.theme
|
||||
assert o.song.theme == u'TestTheme, TestAltTheme'
|
||||
o.do_import(u'test.opensong.zip', commit=False)
|
||||
# o.finish()
|
||||
o.song.print_song()
|
||||
|
Loading…
Reference in New Issue
Block a user