forked from openlp/openlp
Path check improved - test can be executed in all folders
bzr-revno: 235
This commit is contained in:
parent
b198db1b3e
commit
5ba4665ee5
@ -3,7 +3,7 @@
|
|||||||
"""
|
"""
|
||||||
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,
|
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
|
||||||
@ -21,9 +21,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
import py.test
|
import py.test
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.abspath("./../../../.."))
|
|
||||||
|
|
||||||
from openlp.plugins.songs.songxml import *
|
__ThisDir__ = os.path.dirname(__file__)
|
||||||
|
if "" == __ThisDir__ :
|
||||||
|
__ThisDir__ = os.path.abspath(".")
|
||||||
|
|
||||||
|
sys.path.append(os.path.abspath("%s/../../../.."%__ThisDir__))
|
||||||
|
|
||||||
|
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
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# -*- coding:iso-8859-1 -*-
|
# -*- coding:iso-8859-1 -*-
|
||||||
|
# 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 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
|
||||||
@ -18,12 +19,15 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.abspath("./../../../.."))
|
|
||||||
|
|
||||||
from openlp.plugins.songs.songxml import *
|
|
||||||
|
|
||||||
|
__ThisDir__ = os.path.dirname(__file__)
|
||||||
|
if "" == __ThisDir__ :
|
||||||
__ThisDir__ = os.path.abspath(".")
|
__ThisDir__ = os.path.abspath(".")
|
||||||
|
|
||||||
|
sys.path.append(os.path.abspath("%s/../../../.."%__ThisDir__))
|
||||||
|
|
||||||
|
from openlp.plugins.songs.lib.songxml import *
|
||||||
|
|
||||||
|
|
||||||
_sample1 = \
|
_sample1 = \
|
||||||
'''<?xml version="1.0" encoding="UTF-8"?>
|
'''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
@ -79,6 +83,39 @@ _sample2 = \
|
|||||||
</song>
|
</song>
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
_sample3 = \
|
||||||
|
'''<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<song>
|
||||||
|
<title></title>
|
||||||
|
<author></author>
|
||||||
|
<copyright></copyright>
|
||||||
|
<presentation></presentation>
|
||||||
|
<ccli></ccli>
|
||||||
|
<theme></theme>
|
||||||
|
<lyrics>[V]
|
||||||
|
1verse 1 line 1
|
||||||
|
2verse 2 line 1
|
||||||
|
3verse 3 line 1
|
||||||
|
1verse 1 line 2
|
||||||
|
2verse 2 line 2
|
||||||
|
3verse 3 line 2
|
||||||
|
|
||||||
|
[C]
|
||||||
|
chorus line 1
|
||||||
|
chorus line 2
|
||||||
|
|
||||||
|
[P]
|
||||||
|
pre-chorus line 1
|
||||||
|
pre-chorus line 2
|
||||||
|
pre-chorus line 3
|
||||||
|
|
||||||
|
[B]
|
||||||
|
bridge line 1
|
||||||
|
bridge line 2
|
||||||
|
</lyrics>
|
||||||
|
</song>
|
||||||
|
'''
|
||||||
|
|
||||||
class Test_OpenSong(object):
|
class Test_OpenSong(object):
|
||||||
"""Test cases for converting from OpenSong xml format to Song"""
|
"""Test cases for converting from OpenSong xml format to Song"""
|
||||||
|
|
||||||
@ -91,13 +128,21 @@ class Test_OpenSong(object):
|
|||||||
assert(s.GetNumberOfSlides() == 4)
|
assert(s.GetNumberOfSlides() == 4)
|
||||||
|
|
||||||
def test_sample2(self):
|
def test_sample2(self):
|
||||||
"""OpenSong: handwritten sample2"""
|
"""OpenSong: handwritten sample2 - with verses and chorus"""
|
||||||
s = Song()
|
s = Song()
|
||||||
s.FromOpenSongBuffer(_sample2)
|
s.FromOpenSongBuffer(_sample2)
|
||||||
l = s.GetLyrics()
|
l = s.GetLyrics()
|
||||||
assert(len(l) == (4*3+3))
|
assert(len(l) == (4*3+3))
|
||||||
assert(s.GetNumberOfSlides() == 4)
|
assert(s.GetNumberOfSlides() == 4)
|
||||||
|
|
||||||
|
def test_sample3(self):
|
||||||
|
"""OpenSong: handwritten sample3 - with verses, chorus, bridge and pre-chorus"""
|
||||||
|
s = Song()
|
||||||
|
s.FromOpenSongBuffer(_sample3)
|
||||||
|
l = s.GetLyrics()
|
||||||
|
assert(len(l) == (4*3+4+5+4))
|
||||||
|
assert(s.GetNumberOfSlides() == 6)
|
||||||
|
|
||||||
def test_file1(self):
|
def test_file1(self):
|
||||||
"""OpenSong: parse Amazing Grace"""
|
"""OpenSong: parse Amazing Grace"""
|
||||||
global __ThisDir__
|
global __ThisDir__
|
||||||
@ -123,12 +168,12 @@ class Test_OpenSong(object):
|
|||||||
assert(s.GetVerseOrder() == "V1 C V2 C V3 C V4 C")
|
assert(s.GetVerseOrder() == "V1 C V2 C V3 C V4 C")
|
||||||
assert(s.GetNumberOfSlides() == 5)
|
assert(s.GetNumberOfSlides() == 5)
|
||||||
|
|
||||||
def Etest_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.FromOpenSongFile("%s/data_opensong/På en fjern ensom høj"%(__ThisDir__))
|
||||||
assert(s.GetTitle() == "På en fjern ensom høj")
|
assert(s.GetTitle() == u"På en fjern ensom høj")
|
||||||
assert(s.GetCopyright() == "")
|
assert(s.GetCopyright() == "")
|
||||||
assert(s.GetSongCcliNo() == "")
|
assert(s.GetSongCcliNo() == "")
|
||||||
assert(s.GetCategoryArray(True) == "")
|
assert(s.GetCategoryArray(True) == "")
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
# -*- coding:iso-8859-1 -*-
|
# -*- coding:iso-8859-1 -*-
|
||||||
|
# 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 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
|
||||||
@ -18,12 +19,15 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.abspath("./../../../.."))
|
|
||||||
|
|
||||||
from openlp.plugins.songs.songxml import *
|
|
||||||
|
|
||||||
|
__ThisDir__ = os.path.dirname(__file__)
|
||||||
|
if "" == __ThisDir__ :
|
||||||
__ThisDir__ = os.path.abspath(".")
|
__ThisDir__ = os.path.abspath(".")
|
||||||
|
|
||||||
|
sys.path.append(os.path.abspath("%s/../../../.."%__ThisDir__))
|
||||||
|
|
||||||
|
from openlp.plugins.songs.lib.songxml import *
|
||||||
|
|
||||||
class Test_Text(object):
|
class Test_Text(object):
|
||||||
"""Test cases for converting from text format to Song"""
|
"""Test cases for converting from text format to Song"""
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
# -*- coding:iso-8859-1 -*-
|
||||||
|
# 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 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
|
||||||
@ -18,9 +20,14 @@ Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
import py.test
|
import py.test
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
sys.path.append(os.path.abspath("./../../../.."))
|
|
||||||
|
|
||||||
from openlp.plugins.songs.songxml import *
|
__ThisDir__ = os.path.dirname(__file__)
|
||||||
|
if "" == __ThisDir__ :
|
||||||
|
__ThisDir__ = os.path.abspath(".")
|
||||||
|
|
||||||
|
sys.path.append(os.path.abspath("%s/../../../.."%__ThisDir__))
|
||||||
|
|
||||||
|
from openlp.plugins.songs.lib.songxml import *
|
||||||
|
|
||||||
class Test_Verse(object):
|
class Test_Verse(object):
|
||||||
"""Class for testing verses for preview and review"""
|
"""Class for testing verses for preview and review"""
|
||||||
|
Loading…
Reference in New Issue
Block a user