forked from openlp/openlp
Refactored+update part 1; from UpperCaseWords to lower_case_words
Added attribute songid and changed names bzr-revno: 275
This commit is contained in:
parent
41977dad1c
commit
9887764d51
File diff suppressed because it is too large
Load Diff
@ -1,189 +1,174 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4
|
||||||
"""
|
"""
|
||||||
OpenLP - Open Source Lyrics Projection
|
OpenLP - Open Source Lyrics Projection
|
||||||
Copyright (c) 2008 Raoul Snyman
|
Copyright (c) 2008 Raoul Snyman
|
||||||
Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Carsten Tinggaard
|
Portions copyright (c) 2008 Martin Thompson, Tim Bentley, Carsten Tinggaard
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under
|
This program is free software; you can redistribute it and/or modify it under
|
||||||
the terms of the GNU General Public License as published by the Free Software
|
the terms of the GNU General Public License as published by the Free Software
|
||||||
Foundation; version 2 of the License.
|
Foundation; version 2 of the License.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||||
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License along with
|
You should have received a copy of the GNU General Public License along with
|
||||||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
||||||
Place, Suite 330, Boston, MA 02111-1307 USA
|
Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import py.test
|
import py.test
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
__ThisDir__ = os.path.dirname(__file__)
|
__ThisDir__ = os.path.dirname(__file__)
|
||||||
if "" == __ThisDir__ :
|
if "" == __ThisDir__ :
|
||||||
__ThisDir__ = os.path.abspath(".")
|
__ThisDir__ = os.path.abspath(".")
|
||||||
|
|
||||||
sys.path.append(os.path.abspath("%s/../../../.."%__ThisDir__))
|
sys.path.append(os.path.abspath("%s/../../../.."%__ThisDir__))
|
||||||
|
|
||||||
from openlp.plugins.songs.lib.songxml import *
|
from openlp.plugins.songs.lib.songxml import *
|
||||||
|
|
||||||
class Test_Basic(object):
|
class Test_Basic(object):
|
||||||
"""Class for first initialization check
|
"""Class for first initialization check
|
||||||
set-get functions
|
set-get functions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def test_Creation(self):
|
def test_Creation(self):
|
||||||
"""Init: Create as empty"""
|
"""Init: Create as empty"""
|
||||||
s = Song()
|
s = Song()
|
||||||
assert(True)
|
assert(True)
|
||||||
|
|
||||||
def test_str(self):
|
def test_Title1(self):
|
||||||
"""Init: Empty, use __str__ to count public attributes & methods"""
|
"""Set an empty title - raises an exception"""
|
||||||
s = Song()
|
s = Song()
|
||||||
r = s.__str__()
|
py.test.raises(SongTitleError, s.set_title, "")
|
||||||
l = r.split("\n")
|
|
||||||
assert(len(l) == 55)
|
def test_Title2(self):
|
||||||
|
"""Set a normal title"""
|
||||||
def test_asString(self):
|
s = Song()
|
||||||
"""Init: Empty asString - initial values"""
|
t = "A normal title"
|
||||||
s = Song()
|
s.set_title(t)
|
||||||
r = s._get_as_string()
|
assert(s.get_title() == t)
|
||||||
#print r
|
assert(s.get_search_title() == t)
|
||||||
flag = r.endswith("__None__None__None__None__None__None__1__1__1__1__[]__None__None__None__None__BlankSong__None_")
|
|
||||||
assert(flag)
|
def test_Title3(self):
|
||||||
|
"""Set a titel with punctuation 1"""
|
||||||
def test_Title1(self):
|
s = Song()
|
||||||
"""Set an empty title - raises an exception"""
|
t1 = "Hey! Come on, ya programmers*"
|
||||||
s = Song()
|
t2 = "Hey Come on ya programmers"
|
||||||
py.test.raises(SongTitleError, s.SetTitle, "")
|
s.set_title(t1)
|
||||||
|
assert(s.get_title() == t1)
|
||||||
def test_Title2(self):
|
assert(s.get_search_title() == t2)
|
||||||
"""Set a normal title"""
|
|
||||||
s = Song()
|
def test_Title4(self):
|
||||||
t = "A normal title"
|
"""Set a titel with punctuation 2"""
|
||||||
s.SetTitle(t)
|
s = Song()
|
||||||
assert(s.GetTitle() == t)
|
t1 = "??#Hey! Come on, ya programmers*"
|
||||||
assert(s.GetSearchableTitle() == t)
|
t2 = "Hey Come on ya programmers"
|
||||||
|
s.set_title(t1)
|
||||||
def test_Title3(self):
|
assert(s.get_title() == t1)
|
||||||
"""Set a titel with punctuation 1"""
|
assert(s.get_search_title() == t2)
|
||||||
s = Song()
|
|
||||||
t1 = "Hey! Come on, ya programmers*"
|
def test_Title5(self):
|
||||||
t2 = "Hey Come on ya programmers"
|
"""Set a title, where searchable title becomes empty - raises an exception"""
|
||||||
s.SetTitle(t1)
|
s = Song()
|
||||||
assert(s.GetTitle() == t1)
|
py.test.raises(SongTitleError, s.set_title, ",*")
|
||||||
assert(s.GetSearchableTitle() == t2)
|
|
||||||
|
def test_Copyright(self):
|
||||||
def test_Title4(self):
|
"""Set a copyright string"""
|
||||||
"""Set a titel with punctuation 2"""
|
s = Song()
|
||||||
s = Song()
|
assert(s.get_copyright() == "")
|
||||||
t1 = "??#Hey! Come on, ya programmers*"
|
s.set_copyright("A B Car")
|
||||||
t2 = "Hey Come on ya programmers"
|
assert(s.get_copyright() == "A B Car")
|
||||||
s.SetTitle(t1)
|
|
||||||
assert(s.GetTitle() == t1)
|
def test_SongCclino(self):
|
||||||
assert(s.GetSearchableTitle() == t2)
|
"""Set a SongCcliNo"""
|
||||||
|
s = Song()
|
||||||
def test_Title5(self):
|
assert(s.get_song_cclino() == "")
|
||||||
"""Set a title, where searchable title becomes empty - raises an exception"""
|
s.set_song_cclino(12345)
|
||||||
s = Song()
|
assert(s.get_song_cclino() == "12345")
|
||||||
py.test.raises(SongTitleError, s.SetTitle, ",*")
|
|
||||||
|
def test_SongBook(self):
|
||||||
def test_Copyright(self):
|
"""Set a songbook value"""
|
||||||
"""Set a copyright string"""
|
s = Song()
|
||||||
s = Song()
|
assert(s.get_song_book() == "")
|
||||||
assert(s.GetCopyright() == "")
|
s.set_song_book("Hymns")
|
||||||
s.SetCopyright("A B Car")
|
assert(s.get_song_book() == "Hymns")
|
||||||
assert(s.GetCopyright() == "A B Car")
|
|
||||||
|
def test_SongNumber(self):
|
||||||
def test_SongCclino(self):
|
"""Set a song number"""
|
||||||
"""Set a SongCcliNo"""
|
s = Song()
|
||||||
s = Song()
|
assert(s.get_song_number() == "")
|
||||||
assert(s.GetSongCcliNo() == "")
|
s.set_song_number(278)
|
||||||
s.SetSongCcliNo(12345)
|
assert(s.get_song_number() == "278")
|
||||||
assert(s.GetSongCcliNo() == "12345")
|
|
||||||
|
def test_Theme(self):
|
||||||
def test_SongBook(self):
|
"""Set a theme name"""
|
||||||
"""Set a songbook value"""
|
s = Song()
|
||||||
s = Song()
|
assert(s.get_theme() == "")
|
||||||
assert(s.GetSongBook() == "")
|
s.set_theme("Red")
|
||||||
s.SetSongBook("Hymns")
|
assert(s.get_theme() == "Red")
|
||||||
assert(s.GetSongBook() == "Hymns")
|
|
||||||
|
def test_VerseOrder(self):
|
||||||
def test_SongNumber(self):
|
"""Set a verse order"""
|
||||||
"""Set a song number"""
|
s = Song()
|
||||||
s = Song()
|
assert(s.get_verse_order() == "")
|
||||||
assert(s.GetSongNumber() == "")
|
s.set_verse_order("V1 C V2")
|
||||||
s.SetSongNumber(278)
|
assert(s.get_verse_order() == "V1 C V2")
|
||||||
assert(s.GetSongNumber() == "278")
|
|
||||||
|
def test_Comments(self):
|
||||||
def test_Theme(self):
|
"""Set a comment"""
|
||||||
"""Set a theme name"""
|
s = Song()
|
||||||
s = Song()
|
assert(s.get_comments() == "")
|
||||||
assert(s.GetTheme() == "")
|
s.set_comments("a comment")
|
||||||
s.SetTheme("Red")
|
assert(s.get_comments() == "a comment")
|
||||||
assert(s.GetTheme() == "Red")
|
|
||||||
|
def test_AuthorList(self):
|
||||||
def test_VerseOrder(self):
|
"""Set author lists"""
|
||||||
"""Set a verse order"""
|
s = Song()
|
||||||
s = Song()
|
assert(s.get_author_list(True) == "")
|
||||||
assert(s.GetVerseOrder() == "")
|
assert(s.get_author_list(False) == [])
|
||||||
s.SetVerseOrder("V1 C V2")
|
t1 = "John Newton"
|
||||||
assert(s.GetVerseOrder() == "V1 C V2")
|
s.set_author_list(t1)
|
||||||
|
assert(s.get_author_list(True) == t1)
|
||||||
def test_Comments(self):
|
assert(s.get_author_list(False) == [t1])
|
||||||
"""Set a comment"""
|
s.set_author_list(" Peter Done , John Newton")
|
||||||
s = Song()
|
assert(s.get_author_list(True)== "Peter Done, John Newton")
|
||||||
assert(s.GetComments() == "")
|
assert(s.get_author_list(False) == ["Peter Done", "John Newton"])
|
||||||
s.SetComments("a comment")
|
s.set_author_list(None)
|
||||||
assert(s.GetComments() == "a comment")
|
assert(s.get_author_list(True) == "")
|
||||||
|
assert(s.get_author_list(False) == [])
|
||||||
def test_AuthorList(self):
|
s.set_author_list("")
|
||||||
"""Set author lists"""
|
assert(s.get_author_list(True) == "")
|
||||||
s = Song()
|
assert(s.get_author_list(False) == [""])
|
||||||
assert(s.GetAuthorList(True) == "")
|
s.set_author_list([])
|
||||||
assert(s.GetAuthorList(False) == [])
|
assert(s.get_author_list(True) == "")
|
||||||
t1 = "John Newton"
|
assert(s.get_author_list(False) == [""])
|
||||||
s.SetAuthorList(t1)
|
|
||||||
assert(s.GetAuthorList(True) == t1)
|
def test_CategoryArray(self):
|
||||||
assert(s.GetAuthorList(False) == [t1])
|
"""Set categories"""
|
||||||
s.SetAuthorList(" Peter Done , John Newton")
|
s = Song()
|
||||||
assert(s.GetAuthorList(True)== "Peter Done, John Newton")
|
assert(s.get_category_array(True) == "")
|
||||||
assert(s.GetAuthorList(False) == ["Peter Done", "John Newton"])
|
assert(s.get_category_array(False) == [])
|
||||||
s.SetAuthorList(None)
|
t1 = "Gospel"
|
||||||
assert(s.GetAuthorList(True) == "")
|
s.set_category_array(t1)
|
||||||
assert(s.GetAuthorList(False) == [])
|
assert(s.get_category_array(True) == t1)
|
||||||
s.SetAuthorList("")
|
assert(s.get_category_array(False) == [t1])
|
||||||
assert(s.GetAuthorList(True) == "")
|
s.set_category_array(" Gospel, Hymns ")
|
||||||
assert(s.GetAuthorList(False) == [""])
|
assert(s.get_category_array(True) == "Gospel, Hymns")
|
||||||
s.SetAuthorList([])
|
assert(s.get_category_array(False) == ["Gospel", "Hymns"])
|
||||||
assert(s.GetAuthorList(True) == "")
|
s.set_category_array(None)
|
||||||
assert(s.GetAuthorList(False) == [""])
|
assert(s.get_category_array(True) == "")
|
||||||
|
assert(s.get_category_array(False) == [])
|
||||||
def test_CategoryArray(self):
|
s.set_category_array("")
|
||||||
"""Set categories"""
|
assert(s.get_category_array(True) == "")
|
||||||
s = Song()
|
assert(s.get_category_array(False) == [""])
|
||||||
assert(s.GetCategoryArray(True) == "")
|
s.set_category_array([])
|
||||||
assert(s.GetCategoryArray(False) == [])
|
assert(s.get_category_array(True) == "")
|
||||||
t1 = "Gospel"
|
assert(s.get_category_array(False) == [""])
|
||||||
s.SetCategoryArray(t1)
|
|
||||||
assert(s.GetCategoryArray(True) == t1)
|
if '__main__' == __name__:
|
||||||
assert(s.GetCategoryArray(False) == [t1])
|
r = Test_Basic()
|
||||||
s.SetCategoryArray(" Gospel, Hymns ")
|
r.test_asString()
|
||||||
assert(s.GetCategoryArray(True) == "Gospel, Hymns")
|
|
||||||
assert(s.GetCategoryArray(False) == ["Gospel", "Hymns"])
|
|
||||||
s.SetCategoryArray(None)
|
|
||||||
assert(s.GetCategoryArray(True) == "")
|
|
||||||
assert(s.GetCategoryArray(False) == [])
|
|
||||||
s.SetCategoryArray("")
|
|
||||||
assert(s.GetCategoryArray(True) == "")
|
|
||||||
assert(s.GetCategoryArray(False) == [""])
|
|
||||||
s.SetCategoryArray([])
|
|
||||||
assert(s.GetCategoryArray(True) == "")
|
|
||||||
assert(s.GetCategoryArray(False) == [""])
|
|
||||||
|
|
||||||
if '__main__' == __name__:
|
|
||||||
r = Test_Basic()
|
|
||||||
r.test_asString()
|
|
||||||
|
@ -122,64 +122,64 @@ class Test_OpenSong(object):
|
|||||||
def test_sample1(self):
|
def test_sample1(self):
|
||||||
"""OpenSong: handwritten sample1"""
|
"""OpenSong: handwritten sample1"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.FromOpenSongBuffer(_sample1)
|
s.from_opensong_buffer(_sample1)
|
||||||
l = s.GetLyrics()
|
l = s.get_lyrics()
|
||||||
assert(len(l) == (4*3+3))
|
assert(len(l) == (4*3+3))
|
||||||
assert(s.GetNumberOfSlides() == 4)
|
assert(s.get_number_of_slides() == 4)
|
||||||
|
|
||||||
def test_sample2(self):
|
def test_sample2(self):
|
||||||
"""OpenSong: handwritten sample2 - with verses and chorus"""
|
"""OpenSong: handwritten sample2 - with verses and chorus"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.FromOpenSongBuffer(_sample2)
|
s.from_opensong_buffer(_sample2)
|
||||||
l = s.GetLyrics()
|
l = s.get_lyrics()
|
||||||
assert(len(l) == (4*3+3))
|
assert(len(l) == (4*3+3))
|
||||||
assert(s.GetNumberOfSlides() == 4)
|
assert(s.get_number_of_slides() == 4)
|
||||||
|
|
||||||
def test_sample3(self):
|
def test_sample3(self):
|
||||||
"""OpenSong: handwritten sample3 - with verses, chorus, bridge and pre-chorus"""
|
"""OpenSong: handwritten sample3 - with verses, chorus, bridge and pre-chorus"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.FromOpenSongBuffer(_sample3)
|
s.from_opensong_buffer(_sample3)
|
||||||
l = s.GetLyrics()
|
l = s.get_lyrics()
|
||||||
assert(len(l) == (4*3+4+5+4))
|
assert(len(l) == (4*3+4+5+4))
|
||||||
assert(s.GetNumberOfSlides() == 6)
|
assert(s.get_number_of_slides() == 6)
|
||||||
|
|
||||||
def test_file1(self):
|
def test_file1(self):
|
||||||
"""OpenSong: parse Amazing Grace"""
|
"""OpenSong: parse Amazing Grace"""
|
||||||
global __ThisDir__
|
global __ThisDir__
|
||||||
s = Song()
|
s = Song()
|
||||||
s.FromOpenSongFile("%s/data_opensong/Amazing Grace"%(__ThisDir__))
|
s.from_opensong_file("%s/data_opensong/Amazing Grace"%(__ThisDir__))
|
||||||
assert(s.GetTitle() == "Amazing Grace")
|
assert(s.get_title() == "Amazing Grace")
|
||||||
assert(s.GetCopyright() == "1982 Jubilate Hymns Limited")
|
assert(s.get_copyright() == "1982 Jubilate Hymns Limited")
|
||||||
assert(s.GetSongCcliNo() == "1037882")
|
assert(s.get_song_cclino() == "1037882")
|
||||||
assert(s.GetCategoryArray(True) == "God: Attributes")
|
assert(s.get_category_array(True) == "God: Attributes")
|
||||||
assert(s.GetAuthorList(True) == "John Newton")
|
assert(s.get_author_list(True) == "John Newton")
|
||||||
assert(s.GetVerseOrder() == "")
|
assert(s.get_verse_order() == "")
|
||||||
assert(s.GetNumberOfSlides() == 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.FromOpenSongFile("%s/data_opensong/The Solid Rock"%(__ThisDir__))
|
s.from_opensong_file("%s/data_opensong/The Solid Rock"%(__ThisDir__))
|
||||||
assert(s.GetTitle() == "The Solid Rock")
|
assert(s.get_title() == "The Solid Rock")
|
||||||
assert(s.GetCopyright() == "Public Domain")
|
assert(s.get_copyright() == "Public Domain")
|
||||||
assert(s.GetSongCcliNo() == "101740")
|
assert(s.get_song_cclino() == "101740")
|
||||||
assert(s.GetCategoryArray(True) == "Christ: Victory, Fruit: Peace/Comfort")
|
assert(s.get_category_array(True) == "Christ: Victory, Fruit: Peace/Comfort")
|
||||||
assert(s.GetAuthorList(True) == "Edward Mote, John B. Dykes")
|
assert(s.get_author_list(True) == "Edward Mote, John B. Dykes")
|
||||||
assert(s.GetVerseOrder() == "V1 C V2 C V3 C V4 C")
|
assert(s.get_verse_order() == "V1 C V2 C V3 C V4 C")
|
||||||
assert(s.GetNumberOfSlides() == 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.FromOpenSongFile("%s/data_opensong/På en fjern ensom høj"%(__ThisDir__))
|
s.from_opensong_file("%s/data_opensong/På en fjern ensom høj"%(__ThisDir__))
|
||||||
assert(s.GetTitle() == u"På en fjern ensom høj")
|
assert(s.get_title() == u"På en fjern ensom høj")
|
||||||
assert(s.GetCopyright() == "")
|
assert(s.get_copyright() == "")
|
||||||
assert(s.GetSongCcliNo() == "")
|
assert(s.get_song_cclino() == "")
|
||||||
assert(s.GetCategoryArray(True) == "")
|
assert(s.get_category_array(True) == "")
|
||||||
assert(s.GetAuthorList(True) == "")
|
assert(s.get_author_list(True) == "")
|
||||||
assert(s.GetVerseOrder() == "V1 C1 V2 C2 V3 C3 V4 C4")
|
assert(s.get_verse_order() == "V1 C1 V2 C2 V3 C3 V4 C4")
|
||||||
assert(s.GetNumberOfSlides() == 8)
|
assert(s.get_number_of_slides() == 8)
|
||||||
|
|
||||||
if '__main__' == __name__:
|
if '__main__' == __name__:
|
||||||
r = Test_OpenSong()
|
r = Test_OpenSong()
|
||||||
|
@ -35,23 +35,23 @@ class Test_Text(object):
|
|||||||
"""OpenSong: parse CCLI example"""
|
"""OpenSong: parse CCLI example"""
|
||||||
global __ThisDir__
|
global __ThisDir__
|
||||||
s = Song()
|
s = Song()
|
||||||
s.FromTextFile("%s/data_text/CCLI example.txt"%(__ThisDir__))
|
s.from_ccli_text_file("%s/data_text/CCLI example.txt"%(__ThisDir__))
|
||||||
assert(s.GetTitle() == "Song Title Here")
|
assert(s.get_title() == "Song Title Here")
|
||||||
assert(s.GetAuthorList(True) == "Author, artist name")
|
assert(s.get_author_list(True) == "Author, artist name")
|
||||||
assert(s.GetCopyright() == "1996 Publisher Info")
|
assert(s.get_copyright() == "1996 Publisher Info")
|
||||||
assert(s.GetSongCcliNo() == "1234567")
|
assert(s.get_song_cclino() == "1234567")
|
||||||
assert(s.GetNumberOfSlides() == 4)
|
assert(s.get_number_of_slides() == 4)
|
||||||
|
|
||||||
def test_file2(self):
|
def test_file2(self):
|
||||||
"""OpenSong: parse PåEnFjern (danish)"""
|
"""OpenSong: parse PåEnFjern (danish)"""
|
||||||
global __ThisDir__
|
global __ThisDir__
|
||||||
s = Song()
|
s = Song()
|
||||||
s.FromTextFile("%s/data_text/PåEnFjern.txt"%(__ThisDir__))
|
s.from_ccli_text_file("%s/data_text/PåEnFjern.txt"%(__ThisDir__))
|
||||||
assert(s.GetTitle() == "På en fjern ensom høj")
|
assert(s.get_title() == "På en fjern ensom høj")
|
||||||
assert(s.GetAuthorList(True) == "Georg Bennard")
|
assert(s.get_author_list(True) == "Georg Bennard")
|
||||||
assert(s.GetCopyright() == "")
|
assert(s.get_copyright() == "")
|
||||||
assert(s.GetSongCcliNo() == "")
|
assert(s.get_song_cclino() == "")
|
||||||
assert(s.GetNumberOfSlides() == 8)
|
assert(s.get_number_of_slides() == 8)
|
||||||
|
|
||||||
if '__main__' == __name__:
|
if '__main__' == __name__:
|
||||||
# for local debugging
|
# for local debugging
|
||||||
|
@ -39,11 +39,11 @@ class Test_Verse(object):
|
|||||||
self.author = "John Newton"
|
self.author = "John Newton"
|
||||||
self.copyright = "Peter Hamil"
|
self.copyright = "Peter Hamil"
|
||||||
self.ccli = "123456"
|
self.ccli = "123456"
|
||||||
s.SetLyrics(["# verse","a single line"])
|
s.set_lyrics(["# verse","a single line"])
|
||||||
s.SetTitle(self.title)
|
s.set_title(self.title)
|
||||||
s.SetCopyright(self.copyright)
|
s.set_copyright(self.copyright)
|
||||||
s.SetAuthorList(self.author)
|
s.set_author_list(self.author)
|
||||||
s.SetSongCcliNo(self.ccli)
|
s.set_song_cclino(self.ccli)
|
||||||
return s
|
return s
|
||||||
|
|
||||||
def check_allfields(self, r, isblank = 0):
|
def check_allfields(self, r, isblank = 0):
|
||||||
@ -69,84 +69,84 @@ class Test_Verse(object):
|
|||||||
def test_title_show_noshow(self):
|
def test_title_show_noshow(self):
|
||||||
"""Test the show title flag"""
|
"""Test the show title flag"""
|
||||||
s = self.stdSong()
|
s = self.stdSong()
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
s.SetShowTitle(False)
|
s.set_show_title(False)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r, 1)
|
self.check_allfields(r, 1)
|
||||||
s.SetShowTitle(True)
|
s.set_show_title(True)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
|
|
||||||
def test_author_show_noshow(self):
|
def test_author_show_noshow(self):
|
||||||
"""Test the show author flag"""
|
"""Test the show author flag"""
|
||||||
s = self.stdSong()
|
s = self.stdSong()
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
s.SetShowAuthorList(False)
|
s.set_show_author_list(False)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r, 2)
|
self.check_allfields(r, 2)
|
||||||
s.SetShowAuthorList(True)
|
s.set_show_author_list(True)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
|
|
||||||
def test_copyright_show_noshow(self):
|
def test_copyright_show_noshow(self):
|
||||||
"""Test the show copyright flag"""
|
"""Test the show copyright flag"""
|
||||||
s = self.stdSong()
|
s = self.stdSong()
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
s.SetShowCopyright(False)
|
s.set_show_copyright(False)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r, 3)
|
self.check_allfields(r, 3)
|
||||||
s.SetShowCopyright(True)
|
s.set_show_copyright(True)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
|
|
||||||
def test_ccli_show_noshow(self):
|
def test_ccli_show_noshow(self):
|
||||||
"""Test the show copyright flag"""
|
"""Test the show copyright flag"""
|
||||||
s = self.stdSong()
|
s = self.stdSong()
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
s.SetShowSongCcliNo(False)
|
s.set_show_song_cclino(False)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r, 4)
|
self.check_allfields(r, 4)
|
||||||
s.SetShowSongCcliNo(True)
|
s.set_show_song_cclino(True)
|
||||||
r = s.GetRenderSlide(1)
|
r = s.get_render_slide(1)
|
||||||
self.check_allfields(r)
|
self.check_allfields(r)
|
||||||
|
|
||||||
def test_verse1(self):
|
def test_verse1(self):
|
||||||
"""Test an empty verse list"""
|
"""Test an empty verse list"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.SetLyrics([])
|
s.set_lyrics([])
|
||||||
assert(s.GetNumberOfSlides() == 0)
|
assert(s.get_number_of_slides() == 0)
|
||||||
|
|
||||||
def test_verse2(self):
|
def test_verse2(self):
|
||||||
"""Test a list with an empty string"""
|
"""Test a list with an empty string"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.SetLyrics([""])
|
s.set_lyrics([""])
|
||||||
assert(s.GetNumberOfSlides() == 0)
|
assert(s.get_number_of_slides() == 0)
|
||||||
|
|
||||||
def test_verse3a(self):
|
def test_verse3a(self):
|
||||||
"""Test a one liner song"""
|
"""Test a one liner song"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.SetLyrics(["Single verse"])
|
s.set_lyrics(["Single verse"])
|
||||||
assert(s.GetNumberOfSlides() == 1)
|
assert(s.get_number_of_slides() == 1)
|
||||||
|
|
||||||
def test_verse3b(self):
|
def test_verse3b(self):
|
||||||
"""Test a one liner song"""
|
"""Test a one liner song"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.SetLyrics(["", "Single verse"])
|
s.set_lyrics(["", "Single verse"])
|
||||||
assert(s.GetNumberOfSlides() == 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.SetLyrics(["", "Single verse", "", ""])
|
s.set_lyrics(["", "Single verse", "", ""])
|
||||||
assert(s.GetNumberOfSlides() == 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.SetLyrics(["", "# Verse", "", ""])
|
s.set_lyrics(["", "# Verse", "", ""])
|
||||||
assert(s.GetNumberOfSlides() == 1)
|
assert(s.get_number_of_slides() == 1)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user