diff --git a/openlp/plugins/plugin.txt b/documentation/plugin.txt similarity index 100% rename from openlp/plugins/plugin.txt rename to documentation/plugin.txt diff --git a/openlp/core/test/data_for_tests/render_theme.xml b/openlp/core/test/data_for_tests/render_theme.xml deleted file mode 100644 index 63dfddc02..000000000 --- a/openlp/core/test/data_for_tests/render_theme.xml +++ /dev/null @@ -1,19 +0,0 @@ - - - openlp.org Packaged Theme - 0 - clWhite - - - Tahoma - $00007F - 53 - pixels - 0 - $000000 - 0 - $000000 - 0 - 0 - 1 - diff --git a/openlp/core/test/data_for_tests/snowbig.jpg b/openlp/core/test/data_for_tests/snowbig.jpg deleted file mode 100644 index f1d041927..000000000 Binary files a/openlp/core/test/data_for_tests/snowbig.jpg and /dev/null differ diff --git a/openlp/core/test/data_for_tests/snowsmall.jpg b/openlp/core/test/data_for_tests/snowsmall.jpg deleted file mode 100644 index 3fd506415..000000000 Binary files a/openlp/core/test/data_for_tests/snowsmall.jpg and /dev/null differ diff --git a/openlp/core/test/data_for_tests/sunset1.jpg b/openlp/core/test/data_for_tests/sunset1.jpg deleted file mode 100644 index 75e819c6e..000000000 Binary files a/openlp/core/test/data_for_tests/sunset1.jpg and /dev/null differ diff --git a/openlp/core/test/data_for_tests/treesbig.jpg b/openlp/core/test/data_for_tests/treesbig.jpg deleted file mode 100644 index 9454b3a68..000000000 Binary files a/openlp/core/test/data_for_tests/treesbig.jpg and /dev/null differ diff --git a/openlp/core/test/data_for_tests/treessmall.jpg b/openlp/core/test/data_for_tests/treessmall.jpg deleted file mode 100644 index d52ec6e80..000000000 Binary files a/openlp/core/test/data_for_tests/treessmall.jpg and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_bg_shrink_x.bmp b/openlp/core/test/golden_bitmaps/test_bg_shrink_x.bmp deleted file mode 100644 index c7261c100..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_bg_shrink_x.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_bg_shrink_y.bmp b/openlp/core/test/golden_bitmaps/test_bg_shrink_y.bmp deleted file mode 100644 index 91adf0188..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_bg_shrink_y.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_bg_stretch_x.bmp b/openlp/core/test/golden_bitmaps/test_bg_stretch_x.bmp deleted file mode 100644 index 9741a266b..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_bg_stretch_x.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_bg_stretch_y.bmp b/openlp/core/test/golden_bitmaps/test_bg_stretch_y.bmp deleted file mode 100644 index a05a930d8..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_bg_stretch_y.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_gradient_h.bmp b/openlp/core/test/golden_bitmaps/test_gradient_h.bmp deleted file mode 100644 index f968fe8b7..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_gradient_h.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_gradient_v.bmp b/openlp/core/test/golden_bitmaps/test_gradient_v.bmp deleted file mode 100644 index 1b9b434e3..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_gradient_v.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_basic.bmp b/openlp/core/test/golden_bitmaps/test_theme_basic.bmp deleted file mode 100644 index b156ac762..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_basic.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_font.bmp b/openlp/core/test/golden_bitmaps/test_theme_font.bmp deleted file mode 100644 index c0f6f3aa5..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_font.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_centre.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_centre.bmp deleted file mode 100644 index 2c10be95e..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_centre.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left.bmp deleted file mode 100644 index c7245748e..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left_lyric.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left_lyric.bmp deleted file mode 100644 index 8e3fc877a..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_left_lyric.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_right.bmp b/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_right.bmp deleted file mode 100644 index 7d404a85e..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_horizontal_align_right.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_shadow_outline.bmp b/openlp/core/test/golden_bitmaps/test_theme_shadow_outline.bmp deleted file mode 100644 index daa1e07dd..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_shadow_outline.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_bot.bmp b/openlp/core/test/golden_bitmaps/test_theme_vertical_align_bot.bmp deleted file mode 100644 index d43698b9f..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_bot.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_cen.bmp b/openlp/core/test/golden_bitmaps/test_theme_vertical_align_cen.bmp deleted file mode 100644 index be19a7288..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_cen.bmp and /dev/null differ diff --git a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_top.bmp b/openlp/core/test/golden_bitmaps/test_theme_vertical_align_top.bmp deleted file mode 100644 index c7245748e..000000000 Binary files a/openlp/core/test/golden_bitmaps/test_theme_vertical_align_top.bmp and /dev/null differ diff --git a/openlp/core/test/test_mediamanageritem.py b/openlp/core/test/test_mediamanageritem.py deleted file mode 100644 index a80bcdb64..000000000 --- a/openlp/core/test/test_mediamanageritem.py +++ /dev/null @@ -1,110 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import logging -import os -import sys - -from PyQt4 import QtCore, QtGui - -from openlp.core.lib import MediaManagerItem - -logging.basicConfig(level=logging.DEBUG, - format='%(asctime)s %(name)-30s %(levelname)-8s %(message)s', - datefmt='%m-%d %H:%M', - filename='plugins.log', - filemode='w') - -console=logging.StreamHandler() -# set a format which is simpler for console use -formatter = logging.Formatter(u'%(name)24s: %(levelname)-8s %(message)s') -# tell the handler to use this format -console.setFormatter(formatter) -logging.getLogger(u'').addHandler(console) -log = logging.getLogger(u'') -logging.info(u'Logging started') -mypath = os.path.split(os.path.abspath(__file__))[0] -sys.path.insert(0,(os.path.join(mypath, '..' ,'..', '..'))) - -class TestMediaManager: - def setup_class(self): - self.app = QtGui.QApplication([]) - logging.info (u'App is ' + unicode(self.app)) - self.main_window = QtGui.QMainWindow() - self.main_window.resize(200, 600) - self.MediaManagerDock = QtGui.QDockWidget(self.main_window) - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.MediaManagerDock.sizePolicy().hasHeightForWidth()) - self.MediaManagerDock.setSizePolicy(sizePolicy) - icon = QtGui.QIcon() - icon.addPixmap(QtGui.QPixmap(u':/system/system_mediamanager.png'), - QtGui.QIcon.Normal, QtGui.QIcon.Off) - self.MediaManagerDock.setWindowIcon(icon) - self.MediaManagerDock.setFloating(False) - self.MediaManagerContents = QtGui.QWidget() - sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, - QtGui.QSizePolicy.Expanding) - sizePolicy.setHorizontalStretch(0) - sizePolicy.setVerticalStretch(0) - sizePolicy.setHeightForWidth( - self.MediaManagerContents.sizePolicy().hasHeightForWidth()) - self.MediaManagerContents.setSizePolicy(sizePolicy) - self.MediaManagerLayout = QtGui.QHBoxLayout(self.MediaManagerContents) - self.MediaManagerLayout.setContentsMargins(0, 2, 0, 0) - self.MediaToolBox = QtGui.QToolBox(self.MediaManagerContents) - self.MediaManagerDock.setWidget(self.MediaManagerContents) - self.main_window.addDockWidget(QtCore.Qt.DockWidgetArea(1), - self.MediaManagerDock) - self.MediaManagerLayout.addWidget(self.MediaToolBox) - def test1(self): - log=logging.getLogger(u'test1') - log.info(u'Start') - i1=MediaManagerItem(self.MediaToolBox) - i2=MediaManagerItem(self.MediaToolBox) - log.info(u'i1'+unicode(i1)) - log.info(u'i2'+unicode(i2)) - i1.addToolbar() - i1.addToolbarButton(u'Test1', u'Test1', None) - i2.addToolbar() - i2.addToolbarButton(u'Test2', u'Test2', None) - self.MediaToolBox.setItemText( - self.MediaToolBox.indexOf(i1), self.trUtf8('Item1')) - self.MediaToolBox.setItemText( - self.MediaToolBox.indexOf(i2), self.trUtf8('Item2')) - log.info(u'Show window') - self.main_window.show() - log.info(u'End') - return 1 - -if __name__ == "__main__": - t=TestMediaManager() - t.setup_class() - t.test1() - log.info(u'exec') - sys.exit(t.app.exec_()) diff --git a/openlp/core/test/test_plugin_manager.py b/openlp/core/test/test_plugin_manager.py deleted file mode 100644 index c927fce9b..000000000 --- a/openlp/core/test/test_plugin_manager.py +++ /dev/null @@ -1,74 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import logging -import os -import sys - -from openlp.core.lib.pluginmanager import PluginManager - -logging.basicConfig(level=logging.DEBUG, - format='%(asctime)s %(name)-12s %(levelname)-8s %(message)s', - datefmt='%m-%d %H:%M', - filename='plugins.log', - filemode='w') - -console=logging.StreamHandler() -# set a format which is simpler for console use -formatter = logging.Formatter(u'%(name)-12s: %(levelname)-8s %(message)s') -# tell the handler to use this format -console.setFormatter(formatter) -logging.getLogger(u'').addHandler(console) -log = logging.getLogger(u'') -logging.info(u'Logging started') -mypath = os.path.split(os.path.abspath(__file__))[0] -sys.path.insert(0,(os.path.join(mypath, '..' ,'..', '..'))) - -# test the plugin manager with some plugins in the test_plugins directory -class TestPluginManager: - def test_init(self): - self.p = PluginManager(u'./testplugins') - p = self.p - p.find_plugins(u'./testplugins', None, None) - assert(len(p.plugins) == 2) - # get list of the names of the plugins - names = [plugin.name for plugin in p.plugins] - # see which ones we've got - assert(u'testplugin1' in names) - assert(u'testplugin2' in names) - # and not got - it's too deep in the hierarchy! - assert(u'testplugin3' not in names) - # test that the weighting is done right - assert(p.plugins[0].name == "testplugin2") - assert(p.plugins[1].name == "testplugin1") - -if __name__ == "__main__": - log.debug(u'Starting') - t = TestPluginManager() - t.test_init() - log.debug(u'List of plugins found:') - for plugin in t.p.plugins: - log.debug(u'Plugin %s, name=%s (version=%d)' %(unicode(plugin), - plugin.name, plugin.version)) diff --git a/openlp/core/test/test_render.py b/openlp/core/test/test_render.py deleted file mode 100644 index 92f79cf37..000000000 --- a/openlp/core/test/test_render.py +++ /dev/null @@ -1,241 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import sys -import os -import os.path - -from PyQt4 import QtGui, QtCore - -from openlp.core.theme import Theme -from openlp.core.lib import Renderer - -mypath = os.path.split(os.path.abspath(__file__))[0] -sys.path.insert(0, (os.path.join(mypath, '..', '..', '..'))) - -# from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062 -def whoami(depth=1): - return sys._getframe(depth).f_code.co_name - -class TstFrame: - # {{{ init - - def __init__(self, size): - """Create the DemoPanel.""" - self.width = size.width(); - self.height = size.height(); - # create something to be painted into - self._Buffer = QtGui.QPixmap(self.width, self.height) - def GetPixmap(self): - return self._Buffer - - # }}} - -class TestRender_base: - def __init__(self): - if not os.path.exists(u'test_results'): - os.mkdir(u'test_results') - self.app = None - def write_to_file(self, pixmap, name): - im=pixmap.toImage() - testpathname = os.path.join(u'test_results', name+'.bmp') - if os.path.exists(testpathname): - os.unlink(testpathname) - im.save(testpathname, 'bmp') - return im - # xxx quitting the app still leaves it hanging aroudn so we die - # when trying to start another one. Not quitting doesn't help - # though This means that the py.test runs both test modules in - # sequence and the second one tries to create another application - # which gives us errors :( - - def setup_class(self): - print "class setup", self - try: - if self.app is None: - pass - except AttributeError: # didn't have one - print "No app" - self.app = None - - print "Test app (should be None)" - if self.app is None: - print "App is None" - self.app = QtGui.QApplication([]) - else: - print "class setup, app is", app -# self.app = QtGui.QApplication([]) - - def teardown_class(self): - print "class quit", self, self.app - self.app.quit() - - def setup_method(self, method): - print "SSsetup", method - if not hasattr(self, 'app'): - self.app = None - try: # see if we already have an app for some reason. - # have to try and so something, cant just test against None - print "app", self.app, ";;;" - print self.app.quit() - print "quitted" - except RuntimeError: # not valid app, create one - print "Runtime error" - except AttributeError: # didn't have one - print "Attribute error" -# print "App", self.app -# self.app = QtGui.QApplication([]) - print "Application created and sorted" - self.size = QtCore.QSize(800,600) - frame = TstFrame(size = self.size) - self.frame = frame - self.paintdest = frame.GetPixmap() - self.renderer = Renderer() - self.renderer.set_paint_dest(self.paintdest) - self.expected_answer = "Don't know yet" - self.answer = None - print "--------------- Setup Done -------------" - - def teardown_method(self, method): - self.write_to_file(self.frame.GetPixmap(), 'test_render') - -class TestRender(TestRender_base): - def __init__(self): - TestRender_base.__init__(self) - - def setup_method(self, method): - TestRender_base.setup_method(self, method) - self.renderer.set_debug(1) - themefile = os.path.abspath(u'data_for_tests/render_theme.xml') - self.renderer.set_theme(Theme(themefile)) # set default theme - self.renderer._render_background() - self.renderer.set_text_rectangle(QtCore.QRect( - 0,0, self.size.width()-1, self.size.height()-1)) - self.msg = None - - def test_easy(self): - answer = self.renderer._render_single_line( - u'Test line', tlcorner = (0,100)) - assert(answer == (219,163)) - - def test_longer(self): - answer = self.renderer._render_single_line( - u'Test line with more words than fit on one line', - tlcorner = (10,10)) - assert(answer == (753,136)) - - def test_even_longer(self): - answer = self.renderer._render_single_line( - u'Test line with more words than fit on either one or two lines', - tlcorner = (10,10)) - assert(answer == (753,199)) - def test_lines(self): - lines = [] - lines.append(u'Line One') - lines.append(u'Line Two') - lines.append(u'Line Three and should be long enough to wrap') - lines.append(u'Line Four and should be long enough to wrap also') - answer = self.renderer._render_lines(lines) - assert(answer == QtCore.QRect(0,0,741,378)) - - def test_set_words_openlp(self): - words=""" -Verse 1: Line 1 -Line 2 - -Verse 2: Line 1 -Line 2 - -Verse 3: Line 1 -Line 2 -Line 3""" - expected_answer = ["Verse 1: Line 1\nLine 2","Verse 2: Line 1\nLine 2","Verse 3: Line 1\nLine 2\nLine 3"] - answer = self.renderer.set_words_openlp(words) - assert(answer == expected_answer) - - def test_render_screens(self): - words=""" -Verse 1: Line 1 -Line 2 - -Verse 2: Line 1 -Line 2 - -Verse 3: Line 1 -Line 2 -Line 3""" - verses = self.renderer.set_words_openlp(words) - expected_answer = ["Verse 1: Line 1\nLine 2","Verse 2: Line 1\nLine 2","Verse 3: Line 1\nLine 2\nLine 3"] - assert(verses == expected_answer) - - expected_answer = [QtCore.QRect(0,0,397,126), QtCore.QRect(0,0,397,126), - QtCore.QRect(0,0,397,189)] - for v in range(len(verses)): - answer=self.renderer.render_screen(v) -# print v, answer.x(), answer.y(), answer.width(), answer.height() - assert(answer == expected_answer[v]) - - def split_test(self, number, answer, expected_answers): - lines=[] - print "Split test", number, answer - for i in range(number): - extra="" - 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" - lines.append(u'Line %d %s' % (i, extra)) - result = self.renderer.split_set_of_lines(lines) - print "results---------------__", result - for i in range(len(result)): - self.setup_method(None) - answer = self.renderer._render_lines(result[i]) - print answer - self.write_to_file(self.frame.GetPixmap(), "split_test_%03d"% i) - print number, i, answer.x(), answer.y(), answer.width(), \ - answer.height() - e = expected_answers[i] - assert(answer == QtCore.QRect(e[0],e[1],e[2],e[3])) - - - def test_splits(self): - print "Test splits" - self.split_test(100, 11, [(0,0,180,567), (0,0,214,567), (0,0,214,567), - (0,0,214,567), (0,0,214,567), (0,0,214,378), (0,0,759,567), - (0,0,214,567), (0,0,214,567), (0,0,214,567), (0,0,214,567), - (0,0,214,567), (0,0,214,567)]) - self.split_test(30, 4, [ (0,0,180,441), (0,0,214,441), (0,0,214,441), - (0,0,214,441)]) - self.split_test(20, 3, [(0,0,180,378), (0,0,214,378), (0,0,214,378)]) - self.split_test(12, 2, [(0,0,180,378), (0,0,214,378)]) - self.split_test(4, 1, [(0,0,180,252)]) - self.split_test(6, 1, [(0,0,180,378)]) - self.split_test(8, 1, [(0,0,180,504)]) - -if __name__ == "__main__": - t = TestRender() - t.setup_class() - t.setup_method(None) - t.test_easy() - t.test_splits() - t.teardown_method(None) diff --git a/openlp/core/test/test_render_theme.py b/openlp/core/test/test_render_theme.py deleted file mode 100644 index 2b5d1a2b5..000000000 --- a/openlp/core/test/test_render_theme.py +++ /dev/null @@ -1,319 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import sys -import os - -from PyQt4 import QtGui, QtCore - -from openlp.core.theme import Theme -from test_render import TestRender_base, whoami - -pypath = os.path.split(os.path.abspath(__file__))[0] -sys.path.insert(0, (os.path.join(mypath, '..', '..', '..'))) - -def compare_images(goldenim, testim, threshold=0.01): - # easy test first - if goldenim == testim: - return 1 - # how close are they? Calculated the sum of absolute differences in - # each channel of each pixel and divide by the number of pixels in the image - # if this sum is < threshold, the images are deemed to be "close enough" - sad = 0; - for x in range(goldenim.width()): - for y in range(goldenim.height()): - p1=goldenim.pixel(x,y) - p2=testim.pixel(x,y) - sad += abs((p1&0xFF)-(p2&0xFF)) - sad += abs((p1>>8&0xFF)-(p2>>8&0xFF)) - sad += abs((p1>>16&0xFF)-(p2>>16&0xFF)) - sad /= float(goldenim.width()*goldenim.height()) - if (sad < threshold): - return 1 - return 0 - -class TestRenderTheme(TestRender_base): - # {{{ Basics - - def __init__(self): - TestRender_base.__init__(self) - - def setup_method(self, method): - TestRender_base.setup_method(self, method) - print "Theme setup", method -# print "setup theme" - self.renderer.set_theme(Theme(u'blank_theme.xml')) # set "blank" theme - self.renderer.set_text_rectangle(QtCore.QRect(0,0, self.size.width(), - self.size.height())) - words = """How sweet the name of Jesus sounds -In a believer's ear! -It soothes his sorrows, heals his wounds, -And drives away his fear. -""" - verses = self.renderer.set_words_openlp(words) -# usually the same - self.expected_answer = QtCore.QRect(0, 0, 559, 342) - self.msg = None - self.bmpname = "Not set a bitmap yet" - print "------------- setup done --------------" - - def teardown_method(self, method): - print "============ teardown =============", method, self.bmpname - if self.bmpname is not None: - assert (self.compare_DC_to_file(self.bmpname)) - if self.expected_answer is not None: # result=None => Nothing to check - assert self.expected_answer == self.answer - print "============ teardown done =========" - - def compare_DC_to_file(self, name): - """writes DC out to a bitmap file and then compares it with a golden - one returns True if OK, False if not (so you can assert on it) - - """ - print "--- compare DC to file --- ", name - p = self.frame.GetPixmap() - im = self.write_to_file(p, name) - print "Compare" - goldenfilename=os.path.join(u'golden_bitmaps",name+".bmp') - if os.path.exists(goldenfilename): - goldenim = QtGui.QImage(goldenfilename) - else: - print "File", goldenfilename, "not found" - return False - if (compare_images(goldenim, im)): - print name, "Images match" - return True - else: - print name, goldenfilename, "Images don't match" - return False - - def test_theme_basic(self): - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - print self.renderer._theme.FontProportion - print self.answer, self.expected_answer, \ - self.answer == self.expected_answer -# self.msg=self.bmpname - - # }}} - - # {{{ Gradients - def test_gradient_h(self): - # normally we wouldn't hack with these directly! - self.renderer._theme.BackgroundType = 1 - self.renderer._theme.BackgroundParameter1 = QtGui.QColor(255,0,0) - self.renderer._theme.BackgroundParameter2 = QtGui.QColor(255,255,0) - self.renderer._theme.BackgroundParameter3 = 1 - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - - def test_gradient_v(self): - # normally we wouldn't hack with these directly! - self.renderer._theme.BackgroundType = 1 - self.renderer._theme.BackgroundParameter1 = QtGui.QColor(255,0,0) - self.renderer._theme.BackgroundParameter2 = QtGui.QColor(255,255,0) - self.renderer._theme.BackgroundParameter3 = 0 - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - # }}} - - # {{{ backgrounds - def test_bg_stretch_y(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 2 - t.BackgroundParameter1 = os.path.join(u'data_for_tests', - 'snowsmall.jpg') - t.BackgroundParameter2 = QtGui.QColor(0,0,64) - t.BackgroundParameter3 = 0 - t.Name = "stretch y" - self.renderer.set_theme(t) - print "render" - self.answer = self.renderer.render_screen(0) - print "whoami" - self.bmpname = whoami() - print "fone" - - def test_bg_shrink_y(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 2 - t.BackgroundParameter1 = os.path.join(u'data_for_tests', 'snowbig.jpg') - t.BackgroundParameter2 = QtGui.QColor(0,0,64) - t.BackgroundParameter3 = 0 - t.Name = "shrink y" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - - def test_bg_stretch_x(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 2 - t.BackgroundParameter1 = os.path.join(u'data_for_tests', - 'treessmall.jpg') - t.BackgroundParameter2 = QtGui.QColor(0,0,64) - t.BackgroundParameter3 = 0 - t.VerticalAlign = 2 - t.Name = "stretch x" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.expected_answer = QtCore.QRect(0, 129, 559, 342) - self.bmpname = whoami() - - def test_bg_shrink_x(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 2 - t.BackgroundParameter1 = os.path.join(u'data_for_tests', - 'treesbig.jpg') - t.BackgroundParameter2 = QtGui.QColor(0,0,64) - t.BackgroundParameter3 = 0 - t.VerticalAlign = 2 - t.Name = "shrink x" - self.renderer.set_theme(t) - self.expected_answer = QtCore.QRect(0, 129, 559, 342) - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - # }}} - - # {{{ Vertical alignment - def test_theme_vertical_align_top(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.VerticalAlign = 0 - t.Name = "valign top" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - - def test_theme_vertical_align_bot(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.VerticalAlign = 1 - t.Name = "valign bot" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.expected_answer = QtCore.QRect(0, 257, 559, 342) - self.bmpname = whoami() - - def test_theme_vertical_align_cen(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.VerticalAlign = 2 - t.Name = "valign cen" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.expected_answer = QtCore.QRect(0, 129, 559, 342) - self.bmpname = whoami() - # }}} - - # {{{ Horzontal alignment - def test_theme_horizontal_align_left(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.VerticalAlign = 0 - t.HorizontalAlign = 0 - t.Name = "halign left" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - - def test_theme_horizontal_align_right(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.VerticalAlign = 0 - t.HorizontalAlign = 1 - t.Name = "halign right" - self.renderer.set_theme(t) - self.expected_answer = QtCore.QRect(0, 0, 800, 342) - self.answer = self.renderer.render_screen(0) - self.bmpname = whoami() - - def test_theme_horizontal_align_centre(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.VerticalAlign = 0 - t.HorizontalAlign = 2 - t.Name = "halign centre" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.expected_answer = QtCore.QRect(0, 0, 679, 342) - self.bmpname = whoami() - - def test_theme_horizontal_align_left_lyric(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.VerticalAlign = 0 - t.HorizontalAlign = 0 - t.WrapStyle = 1 - t.Name = "halign left lyric" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.expected_answer = QtCore.QRect(0, 0, 778, 342) - self.bmpname = whoami() - # }}} - - # {{{ Shadows and outlines - def test_theme_shadow_outline(self): - t = Theme(u'blank_theme.xml') - - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,0); - t.Name="shadow/outline" - t.Shadow = 1 - t.Outline = 1 - t.ShadowColor = QtGui.QColor(64,128,0) - t.OutlineColor = QtGui.QColor(128,0,0) - self.renderer.set_debug(1) - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - hoffset = self.renderer._shadow_offset+2*(self.renderer._outline_offset) - voffset = hoffset * (len(self.renderer.words[0])+1) - - self.expected_answer = QtCore.QRect(0, 0, 559+hoffset, 342+voffset) - self.bmpname = whoami() - # }}} - - def test_theme_font(self): - t = Theme(u'blank_theme.xml') - t.BackgroundType = 0 - t.BackgroundParameter1 = QtGui.QColor(0,0,64) - t.Name = "font" - t.FontName = "Times New Roman" - self.renderer.set_theme(t) - self.answer = self.renderer.render_screen(0) - self.expected_answer = QtCore.QRect(0, 0, 499, 336) - self.bmpname=whoami() - -if __name__ == "__main__": - test_render_theme = TestRenderTheme() - test_render_theme.setup_class() - test_render_theme.setup_method(None) - test_render_theme.test_bg_stretch_y() - test_render_theme.teardown_method(None) diff --git a/openlp/core/test/testplugins/deeper/__init__.py b/openlp/core/test/testplugins/deeper/__init__.py deleted file mode 100644 index 8b1378917..000000000 --- a/openlp/core/test/testplugins/deeper/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/openlp/core/test/testplugins/deeper/toodeep/__init__.py b/openlp/core/test/testplugins/deeper/toodeep/__init__.py deleted file mode 100644 index 8b1378917..000000000 --- a/openlp/core/test/testplugins/deeper/toodeep/__init__.py +++ /dev/null @@ -1 +0,0 @@ - diff --git a/openlp/core/test/testplugins/deeper/toodeep/plugin3toodeep.py b/openlp/core/test/testplugins/deeper/toodeep/plugin3toodeep.py deleted file mode 100644 index 9746dbdd2..000000000 --- a/openlp/core/test/testplugins/deeper/toodeep/plugin3toodeep.py +++ /dev/null @@ -1,13 +0,0 @@ -from openlp.core.lib import Plugin -import logging - -class testplugin3toodeep(Plugin): - name="testplugin3" - version=0 - global log - log=logging.getLogger(u'testplugin1') - log.info(u'Started') - weight=10 - def __init__(self): - pass - \ No newline at end of file diff --git a/openlp/core/test/testplugins/testplugin1.py b/openlp/core/test/testplugins/testplugin1.py deleted file mode 100644 index 01ae468e6..000000000 --- a/openlp/core/test/testplugins/testplugin1.py +++ /dev/null @@ -1,13 +0,0 @@ -from openlp.core.lib import Plugin -import logging - -class testplugin1(Plugin): - name="testplugin1" - version=0 - global log - log=logging.getLogger(u'testplugin1') - log.info(u'Started') - weight=10 - def __init__(self): - pass - \ No newline at end of file diff --git a/openlp/core/test/testplugins/testplugin2/__init__.py b/openlp/core/test/testplugins/testplugin2/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/openlp/core/test/testplugins/testplugin2/testplugin2.py b/openlp/core/test/testplugins/testplugin2/testplugin2.py deleted file mode 100644 index c1687d2d9..000000000 --- a/openlp/core/test/testplugins/testplugin2/testplugin2.py +++ /dev/null @@ -1,8 +0,0 @@ -from openlp.core.lib import Plugin - -class testplugin2(Plugin): - name="testplugin2" - version=1 - weight=1 - def __init__(self): - pass diff --git a/openlp/core/theme/test/test_theme.py b/openlp/core/theme/test/test_theme.py deleted file mode 100644 index 2e8c2b500..000000000 --- a/openlp/core/theme/test/test_theme.py +++ /dev/null @@ -1,82 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import os -import os.path -import sys - -from PyQt4 import QtGui - -from openlp.core.theme import Theme - -mypath = os.path.split(os.path.abspath(__file__))[0] -sys.path.insert(0, (os.path.join(mypath, '..', '..', '..', '..'))) - -print sys.path - -def test_read_theme(): - dir = os.path.split(__file__)[0] - # test we can read a theme - theme = Theme(os.path.join(dir, 'test_theme.xml')) - print theme - assert(theme.BackgroundParameter1 == 'sunset1.jpg') - assert(theme.BackgroundParameter2 is None) - assert(theme.BackgroundParameter3 is None) - assert(theme.BackgroundType == 2) - assert(theme.FontColor == QtGui.QColor(255,255,255)) - assert(theme.FontName == 'Tahoma') - assert(theme.FontProportion == 16) - assert(theme.FontUnits == 'pixels') - assert(theme.HorizontalAlign == 2) - assert(theme.Name == 'openlp.org Packaged Theme') - assert(theme.Outline == -1) - assert(theme.OutlineColor == QtGui.QColor(255,0,0)) - assert(theme.Shadow == -1) - assert(theme.ShadowColor == QtGui.QColor(0,0,1)) - assert(theme.VerticalAlign == 0) - -def test_theme(): - # test we create a "blank" theme correctly - theme = Theme() - print theme - assert(theme.BackgroundParameter1 == QtGui.QColor(0,0,0)) - assert(theme.BackgroundParameter2 is None) - assert(theme.BackgroundParameter3 is None) - assert(theme.BackgroundType == 0) - assert(theme.FontColor == QtGui.QColor(255,255,255)) - assert(theme.FontName == 'Arial') - assert(theme.FontProportion == 30) - assert(theme.HorizontalAlign == 0) - assert(theme.FontUnits == 'pixels') - assert(theme.Name == 'BlankStyle') - assert(theme.Outline == 0) - assert(theme.Shadow == 0) - assert(theme.VerticalAlign == 0) - - print "Tests passed" - -if __name__ == "__main__": - test_read_theme() - test_theme() diff --git a/openlp/core/theme/test/test_theme.xml b/openlp/core/theme/test/test_theme.xml deleted file mode 100644 index 79bc2107f..000000000 --- a/openlp/core/theme/test/test_theme.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - openlp.org Packaged Theme - 2 - sunset1.jpg - - - Tahoma - clWhite - 16 - pixels - -1 - $00000001 - -1 - clRed - 2 - 0 - diff --git a/openlp/core/ui/test/test_service_manager.py b/openlp/core/ui/test/test_service_manager.py deleted file mode 100644 index 3755e459c..000000000 --- a/openlp/core/ui/test/test_service_manager.py +++ /dev/null @@ -1,160 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import sys -import os -import os.path -import logging - -from PyQt4 import QtGui - -from openlp.core.ui import ServiceManager -from openlp.plugins.images.lib import ImageServiceItem - -mypath = os.path.split(os.path.abspath(__file__))[0] -sys.path.insert(0, (os.path.join(mypath, '..', '..', '..', '..'))) - -logging.basicConfig(filename='test_service_manager.log', level=logging.INFO, - filemode='w') - -# # from http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66062 -# def whoami(depth=1): -# return sys._getframe(depth).f_code.co_name -global app -global log -log = logging.getLogger(u'TestServiceManager') - -class TestServiceManager_base: - def __init__(self): - pass - - def setup_class(self): - log.info( "class setup" + unicode(self)) - try: - if app is None: - app = QtGui.QApplication([]) - except UnboundLocalError: - app = QtGui.QApplication([]) - - def teardown_class(self): - pass - - def setup_method(self, method): - log.info(u'Setup method:' + unicode(method)) - self.expected_answer = "Don't know yet" - self.answer = None - self.s = ServiceManager(None) - log.info(u'--------------- Setup Done -------------') - - def teardown_method(self, method): - self.s = None - - def select_row(self, row): - # now select the line we just added - # first get the index - i = QModelIndex(self.s.service_data.index(0,0)) - # make a selection of it - self.sm = QItemSelectionModel(self.s.service_data) - self.sm.select(i, QItemSelectionModel.ClearAndSelect) - log.info(unicode(self.sm.selectedIndexes())) - self.s.TreeView.setSelectionModel(self.sm) - log.info(u'Selected indexes = ' + unicode( - self.s.TreeView.selectedIndexes())) - - def test_easy(self): - log.info(u'test_easy') - item = ImageServiceItem(None) - item.add(u'test.gif') - self.s.addServiceItem(item) - answer = self.s.service_as_text() - log.info(u'Answer = ' + unicode(answer)) - lines = answer.split(u'\n') - log.info(u'lines = ' + unicode(lines)) - assert lines[0].startswith(u'# - - Amazing Grace - John Newton - 1982 Jubilate Hymns Limited - - - - - 1037882 - God: Attributes - - - - - [V1] -. D D7 G D Bm E A A7 - Amazing grace how sweet the sound that saved a wretch like me; -. D D7 G D Bm A G D - I once was lost but now I'm found, was blind but now I see. - -[V2] -. D D7 G D Bm E A A7 - Twas grace that taught my heart to fear, and grace my fears relieved; -. D D7 G D Bm A G D - How precious did that grace appear the hour I first believed! - -[V3] -. D D7 G D Bm E A A7 - Through many dangers, toils, and snares I have already come; -. D D7 G D Bm A G D - 'Tis grace that brought me safe thus far and grace will lead me home. - -[V4] -. D D7 G D Bm E A A7 - When we've been there ten thousand years bright shining as the sun; -. D D7 G D Bm A G D - We've no less days to sing God's praise than when we'd first begun! \ No newline at end of file diff --git a/openlp/plugins/songs/test/data_opensong/PÃ¥ en fjern ensom høj b/openlp/plugins/songs/test/data_opensong/PÃ¥ en fjern ensom høj deleted file mode 100644 index 6023414ca..000000000 --- a/openlp/plugins/songs/test/data_opensong/PÃ¥ en fjern ensom høj +++ /dev/null @@ -1,56 +0,0 @@ -PÃ¥ en fjern ensom høj[V1] - PÃ¥ en fjern ensom høj, - Jesu kors dyrest stod, - symbolet pÃ¥ smerte og skam. - O, jeg elsker det kors, - hvor Guds søn gjorde bod, - da forbandelsen blev lagt pÃ¥ ham. - -[C1] - Jeg vil elske det urgamle kors, - i det kraft er der sejer og sang. - Lad mig favne det hellige kors, - det med kronen ombyttes engang. - -[V2] - O, det urgamle kors, - med sin hvile og fred, - tilhyllet i verdens foragt. - Se, det hellige lam, - som pÃ¥ Golgatha stred, - og til jorden Guds nÃ¥de har bragt. - -[C2] - Jeg vil elske det urgamle kors, - i det kraft er der sejer og sang. - Lad mig favne det hellige kors, - det med kronen ombyttes engang. - -[V3] - I det urgamle kors, - i hans blod farvet rødt, - en underfuld skønhed jeg ser. - Ja, det var pÃ¥ det kors, - at han selv blev forstødt, - nu skal aldrig for dommen jeg mer. - -[C3] - Jeg vil elske det urgamle kors, - i det kraft er der sejer og sang. - Lad mig favne det hellige kors, - det med kronen ombyttes engang. - -[V4] - For det urgamle kors, - stÃ¥r mit hjerte i brand, - min plads jeg nu har ved dets fod. - Til han kalder en dag, - mig til himmelens land, - og til hvilen hos Faderen god. - -[C4] - Jeg vil elske det urgamle kors, - i det kraft er der sejer og sang. - Lad mig favne det hellige kors, - det med kronen ombyttes engang. -V1 C1 V2 C2 V3 C3 V4 C4 \ No newline at end of file diff --git a/openlp/plugins/songs/test/data_opensong/The Solid Rock b/openlp/plugins/songs/test/data_opensong/The Solid Rock deleted file mode 100644 index bb1eecc97..000000000 --- a/openlp/plugins/songs/test/data_opensong/The Solid Rock +++ /dev/null @@ -1,28 +0,0 @@ - - - The Solid Rock - Edward Mote and John B. Dykes - Public Domain - V1 C V2 C V3 C V4 C - 101740 - Christ: Victory - Fruit: Peace/Comfort - [V] -. E B A B E -1My hope is built on nothing less than Jesus' blood and righteousness; -2When darkness veils His lovely face, I rest on His un___changing grace. -3His oath, His cove_____nant, His blood|support me in the whelming flood; -4When He shall come with trumpet sound, O may I then in Him be found; -. E B A B E -1I dare not trust the sweetest frame, but wholly lean on Jesus' name. -2In every high and stormy gale, my anchor holds within the veil. -3When all around my soul gives way, He then is all my hope and stay. -4Dressed in His righteous___ness alone, fault___less to stand be_fore the throne. - -[C] -. E A - On Christ, the solid rock I stand; -. E B - All other ground is sinking sand, -. A B E - All other ground is sinking sand. \ No newline at end of file diff --git a/openlp/plugins/songs/test/data_text/CCLI example.txt b/openlp/plugins/songs/test/data_text/CCLI example.txt deleted file mode 100644 index 6a5c23222..000000000 --- a/openlp/plugins/songs/test/data_text/CCLI example.txt +++ /dev/null @@ -1,36 +0,0 @@ -Song Title Here - - -Chorus 1 -Lyrics -Lyrics -Lyrics -Lyrics - - -Verse 1 -Lyrics -Lyrics -Lyrics - - -Verse 2 -Lyrics -Lyrics -Lyrics - - -Misc 1 -(BRIDGE) -Lyrics -Lyrics -Lyrics -Lyrics - - - -CCLI Song No. 1234567 -© 1996 Publisher Info -Author/artist name -For use solely in accordance with the SongSelect Advanced Terms of Agreement. All rights Reserved. -CCLI License No. 1234567 \ No newline at end of file diff --git a/openlp/plugins/songs/test/data_text/PÃ¥EnFjern.txt b/openlp/plugins/songs/test/data_text/PÃ¥EnFjern.txt deleted file mode 100644 index 34a6da1ce..000000000 --- a/openlp/plugins/songs/test/data_text/PÃ¥EnFjern.txt +++ /dev/null @@ -1,61 +0,0 @@ -På en fjern ensom høj - -Verse 1 -På en fjern ensom høj, -Jesu kors dyrest stod, -symbolet på smerte og skam. -O, jeg elsker det kors, -hvor Guds søn gjorde bod, -da forbandelsen blev lagt på ham. - -Chorus 1 -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - -Verse 2 -O, det urgamle kors, -med sin hvile og fred, -tilhyllet i verdens foragt. -Se, det hellige lam, -som på Golgatha stred, -og til jorden Guds nåde har bragt. - -Chorus 2 -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - -Verse 3 -I det urgamle kors, -i hans blod farvet rødt, -en underfuld skønhed jeg ser. -Ja, det var på det kors, -at han selv blev forstødt, -nu skal aldrig for dommen jeg mer. - -Chorus 3 -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - -Verse 4 -For det urgamle kors, -står mit hjerte i brand, -min plads jeg nu har ved dets fod. -Til han kalder en dag, -mig til himmelens land, -og til hvilen hos Faderen god. - -Chorus 4 -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - -CCLI Song No. -© -Georg Bennard diff --git a/openlp/plugins/songs/test/data_xml/amazing1.xml b/openlp/plugins/songs/test/data_xml/amazing1.xml deleted file mode 100644 index 9cc7e1b97..000000000 --- a/openlp/plugins/songs/test/data_xml/amazing1.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -Amazing Grace - - -Amazing grace how sweet the sound that saved a wretch like me; -I once was lost but now I'm found, was blind but now I see. - - -Twas grace that taught my heart to fear, and grace my fears relieved; -How precious did that grace appear the hour I first believed! - - -Through many dangers, toils, and snares I have already come; -'Tis grace that brought me safe thus far and grace will lead me home. - - -When we've been there ten thousand years bright shining as the sun; -We've no less days to sing God's praise than when we'd first begun! - - - \ No newline at end of file diff --git a/openlp/plugins/songs/test/data_xml/amazing2.xml b/openlp/plugins/songs/test/data_xml/amazing2.xml deleted file mode 100644 index 8ea0666ef..000000000 --- a/openlp/plugins/songs/test/data_xml/amazing2.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -Amazing Grace - - -Amazing grace how sweet the sound that saved a wretch like me; -I once was lost but now I'm found, was blind but now I see. - - -Twas grace that taught my heart to fear, and grace my fears relieved; -How precious did that grace appear the hour I first believed! - - -Through many dangers, toils, and snares I have already come; -'Tis grace that brought me safe thus far and grace will lead me home. - - -When we've been there ten thousand years bright shining as the sun; -We've no less days to sing God's praise than when we'd first begun! - - - \ No newline at end of file diff --git a/openlp/plugins/songs/test/data_xml/danish1.xml b/openlp/plugins/songs/test/data_xml/danish1.xml deleted file mode 100644 index ec53ac150..000000000 --- a/openlp/plugins/songs/test/data_xml/danish1.xml +++ /dev/null @@ -1,62 +0,0 @@ - - -PÃ¥ en fjern ensom høj - - -PÃ¥ en fjern ensom høj, -Jesu kors dyrest stod, -symbolet pÃ¥ smerte og skam. -O, jeg elsker det kors, -hvor Guds søn gjorde bod, -da forbandelsen blev lagt pÃ¥ ham. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - -O, det urgamle kors, -med sin hvile og fred, -tilhyllet i verdens foragt. -Se, det hellige lam, -som pÃ¥ Golgatha stred, -og til jorden Guds nÃ¥de har bragt. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - -I det urgamle kors, -i hans blod farvet rødt, -en underfuld skønhed jeg ser. -Ja, det var pÃ¥ det kors, -at han selv blev forstødt, -nu skal aldrig for dommen jeg mer. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - -For det urgamle kors, -stÃ¥r mit hjerte i brand, -min plads jeg nu har ved dets fod. -Til han kalder en dag, -mig til himmelens land, -og til hvilen hos Faderen god. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - - diff --git a/openlp/plugins/songs/test/data_xml/danish2.xml b/openlp/plugins/songs/test/data_xml/danish2.xml deleted file mode 100644 index e7edb5bf5..000000000 --- a/openlp/plugins/songs/test/data_xml/danish2.xml +++ /dev/null @@ -1,62 +0,0 @@ - - -På en fjern ensom høj - - -På en fjern ensom høj, -Jesu kors dyrest stod, -symbolet på smerte og skam. -O, jeg elsker det kors, -hvor Guds søn gjorde bod, -da forbandelsen blev lagt på ham. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - -O, det urgamle kors, -med sin hvile og fred, -tilhyllet i verdens foragt. -Se, det hellige lam, -som på Golgatha stred, -og til jorden Guds nåde har bragt. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - -I det urgamle kors, -i hans blod farvet rødt, -en underfuld skønhed jeg ser. -Ja, det var på det kors, -at han selv blev forstødt, -nu skal aldrig for dommen jeg mer. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - -For det urgamle kors, -står mit hjerte i brand, -min plads jeg nu har ved dets fod. -Til han kalder en dag, -mig til himmelens land, -og til hvilen hos Faderen god. - - -Jeg vil elske det urgamle kors, -i det kraft er der sejer og sang. -Lad mig favne det hellige kors, -det med kronen ombyttes engang. - - - diff --git a/openlp/plugins/songs/test/data_xml/format1.xml b/openlp/plugins/songs/test/data_xml/format1.xml deleted file mode 100644 index f80ea8704..000000000 --- a/openlp/plugins/songs/test/data_xml/format1.xml +++ /dev/null @@ -1,22 +0,0 @@ - - -Amazing Grace - - -Amazing grace how sweet the sound that saved a wretch like me; -I once was lost but now I'm found, was blind but now I see. - - -Twas grace that taught my heart to fear, and grace my fears relieved; -How precious did that grace appear the hour I first believed! - - -Through many dangers, toils, and snares I have already come; -'Tis grace that brought me safe thus far and grace will lead me home. - - -When we've been there ten thousand years bright shining as the sun; -We've no less days to sing God's praise than when we'd first begun! - - - \ No newline at end of file diff --git a/openlp/plugins/songs/test/data_xml/sample1.xml b/openlp/plugins/songs/test/data_xml/sample1.xml deleted file mode 100644 index 11a8576ad..000000000 --- a/openlp/plugins/songs/test/data_xml/sample1.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - Amazing Grace - - name of verse specific theme - any text - - Amazing grace, how ... - - - A b c - D e f - - ... - - - any text - ... - - - - Erstaunliche Anmut - - Erstaunliche Anmut, wie - ... - - - ... - - - diff --git a/openlp/plugins/songs/test/test_song_basic.py b/openlp/plugins/songs/test/test_song_basic.py deleted file mode 100644 index 2cbfdd8ff..000000000 --- a/openlp/plugins/songs/test/test_song_basic.py +++ /dev/null @@ -1,182 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import py.test -import os -import sys - -__ThisDir__ = os.path.dirname(__file__) -if "" == __ThisDir__ : - __ThisDir__ = os.path.abspath(u'.') - -sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__)) - -from openlp.plugins.songs.lib.songxml import * - -class Test_Basic(object): - """Class for first initialization check - set-get functions - """ - - def test_Creation(self): - """Init: Create as empty""" - s = Song() - assert(True) - - def test_Title1(self): - """Set an empty title - raises an exception""" - s = Song() - py.test.raises(SongTitleError, s.set_title, '') - - def test_Title2(self): - """Set a normal title""" - s = Song() - t = "A normal title" - s.set_title(t) - assert(s.get_title() == t) - assert(s.get_search_title() == t) - - def test_Title3(self): - """Set a titel with punctuation 1""" - s = Song() - t1 = "Hey! Come on, ya programmers*" - t2 = "Hey Come on ya programmers" - s.set_title(t1) - assert(s.get_title() == t1) - assert(s.get_search_title() == t2) - - def test_Title4(self): - """Set a titel with punctuation 2""" - s = Song() - t1 = "??#Hey! Come on, ya programmers*" - t2 = "Hey Come on ya programmers" - s.set_title(t1) - assert(s.get_title() == t1) - assert(s.get_search_title() == t2) - - def test_Title5(self): - """ - Set a title - Where searchable title becomes empty raises an exception - """ - s = Song() - py.test.raises(SongTitleError, s.set_title, ',*') - - def test_Copyright(self): - """Set a copyright string""" - s = Song() - assert(s.get_copyright() == '') - s.set_copyright(u'A B Car') - assert(s.get_copyright() == 'A B Car') - - def test_SongCclino(self): - """Set a SongCcliNo""" - s = Song() - assert(s.get_song_cclino() == '') - s.set_song_cclino(12345) - assert(s.get_song_cclino() == '12345') - - def test_SongBook(self): - """Set a songbook value""" - s = Song() - assert(s.get_song_book() == '') - s.set_song_book(u'Hymns') - assert(s.get_song_book() == u'Hymns') - - def test_SongNumber(self): - """Set a song number""" - s = Song() - assert(s.get_song_number() == '') - s.set_song_number(278) - assert(s.get_song_number() == '278') - - def test_Theme(self): - """Set a theme name""" - s = Song() - assert(s.get_theme() == '') - s.set_theme(u'Red') - assert(s.get_theme() == 'Red') - - def test_VerseOrder(self): - """Set a verse order""" - s = Song() - assert(s.get_verse_order() == '') - s.set_verse_order(u'V1 C V2') - assert(s.get_verse_order() == 'V1 C V2') - - def test_Comments(self): - """Set a comment""" - s = Song() - assert(s.get_comments() == '') - s.set_comments(u'a comment') - assert(s.get_comments() == 'a comment') - - def test_AuthorList(self): - """Set author lists""" - s = Song() - assert(s.get_author_list(True) == '') - assert(s.get_author_list(False) == []) - t1 = "John Newton" - s.set_author_list(t1) - assert(s.get_author_list(True) == t1) - assert(s.get_author_list(False) == [t1]) - s.set_author_list(u' 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']) - s.set_author_list(None) - assert(s.get_author_list(True) == '') - assert(s.get_author_list(False) == []) - s.set_author_list(u'') - assert(s.get_author_list(True) == '') - assert(s.get_author_list(False) == [""]) - s.set_author_list([]) - assert(s.get_author_list(True) == '') - assert(s.get_author_list(False) == [""]) - - def test_CategoryArray(self): - """Set categories""" - s = Song() - assert(s.get_category_array(True) == '') - assert(s.get_category_array(False) == []) - t1 = "Gospel" - s.set_category_array(t1) - assert(s.get_category_array(True) == t1) - assert(s.get_category_array(False) == [t1]) - s.set_category_array(u' Gospel, Hymns ') - assert(s.get_category_array(True) == 'Gospel, Hymns') - assert(s.get_category_array(False) == ["Gospel", u'Hymns']) - s.set_category_array(None) - assert(s.get_category_array(True) == '') - assert(s.get_category_array(False) == []) - s.set_category_array(u'') - assert(s.get_category_array(True) == '') - assert(s.get_category_array(False) == [""]) - s.set_category_array([]) - assert(s.get_category_array(True) == '') - assert(s.get_category_array(False) == [""]) - -if '__main__' == __name__: - r = Test_Basic() - r.test_asString() diff --git a/openlp/plugins/songs/test/test_song_opensong.py b/openlp/plugins/songs/test/test_song_opensong.py deleted file mode 100644 index d0c716d7d..000000000 --- a/openlp/plugins/songs/test/test_song_opensong.py +++ /dev/null @@ -1,192 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import os -import sys - -__ThisDir__ = os.path.dirname(__file__) -if "" == __ThisDir__ : - __ThisDir__ = os.path.abspath(u'.') - -sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__)) - -from openlp.plugins.songs.lib.songxml import * - - -_sample1 = \ -''' - - - - - - - - [V1] -. chord line 1 - verse 1 line 1 -. chord line 2 - verse 1 line 2 - -[V2] - verse 2 line 1 - verse 2 line 2 - -[V3] - verse 3 line 1 - verse 3 line 2 - -[C] -. chorus chord line 1 - chorus line 1 -. chorus chord line 2 - chorus line 2 - -''' - -_sample2 = \ -''' - - - - - - - - [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 - -''' - -_sample3 = \ -''' - - - - - - - - [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 - - -''' - -class Test_OpenSong(object): - """Test cases for converting from OpenSong xml format to Song""" - - def test_sample1(self): - """OpenSong: handwritten sample1""" - s = Song() - s.from_opensong_buffer(_sample1) - l = s.get_lyrics() - assert(len(l) == (4*3+3)) - assert(s.get_number_of_slides() == 4) - - def test_sample2(self): - """OpenSong: handwritten sample2 - with verses and chorus""" - s = Song() - s.from_opensong_buffer(_sample2) - l = s.get_lyrics() - assert(len(l) == (4*3+3)) - assert(s.get_number_of_slides() == 4) - - def test_sample3(self): - """OpenSong: handwritten sample3 - with verses, chorus, bridge and pre-chorus""" - s = Song() - s.from_opensong_buffer(_sample3) - l = s.get_lyrics() - assert(len(l) == (4*3+4+5+4)) - assert(s.get_number_of_slides() == 6) - - def test_file1(self): - """OpenSong: parse Amazing Grace""" - global __ThisDir__ - s = Song() - s.from_opensong_file(u'%s/data_opensong/Amazing Grace'%(__ThisDir__)) - assert(s.get_title() == 'Amazing Grace') - assert(s.get_copyright() == '1982 Jubilate Hymns Limited') - assert(s.get_song_cclino() == '1037882') - assert(s.get_category_array(True) == 'God: Attributes') - assert(s.get_author_list(True) == 'John Newton') - assert(s.get_verse_order() == '') - assert(s.get_number_of_slides() == 4) - - def test_file2(self): - """OpenSong: parse The Solid Rock""" - s = Song() - s.from_opensong_file(u'%s/data_opensong/The Solid Rock'%(__ThisDir__)) - assert(s.get_title() == 'The Solid Rock') - assert(s.get_copyright() == 'Public Domain') - assert(s.get_song_cclino() == '101740') - 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_verse_order() == 'V1 C V2 C V3 C V4 C') - assert(s.get_number_of_slides() == 5) - - def test_file3(self): - """OpenSong: parse 'PÃ¥ en fjern ensom høj' (danish)""" - #FIXME: problem with XML convert and danish characters - s = Song() - 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_copyright() == '') - assert(s.get_song_cclino() == '') - assert(s.get_category_array(True) == '') - assert(s.get_author_list(True) == '') - assert(s.get_verse_order() == 'V1 C1 V2 C2 V3 C3 V4 C4') - assert(s.get_number_of_slides() == 8) - -if '__main__' == __name__: - r = Test_OpenSong() - r.test_file3() diff --git a/openlp/plugins/songs/test/test_song_text.py b/openlp/plugins/songs/test/test_song_text.py deleted file mode 100644 index 810428233..000000000 --- a/openlp/plugins/songs/test/test_song_text.py +++ /dev/null @@ -1,66 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import os -import sys - -__ThisDir__ = os.path.dirname(__file__) -if "" == __ThisDir__ : - __ThisDir__ = os.path.abspath(u'.') - -sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__)) - -from openlp.plugins.songs.lib.songxml import * - -class Test_Text(object): - """Test cases for converting from text format to Song""" - - def test_file1(self): - """OpenSong: parse CCLI example""" - global __ThisDir__ - s = Song() - s.from_ccli_text_file(u'%s/data_text/CCLI example.txt'%(__ThisDir__)) - assert(s.get_title() == 'Song Title Here') - assert(s.get_author_list(True) == 'Author, artist name') - assert(s.get_copyright() == '1996 Publisher Info') - assert(s.get_song_cclino() == '1234567') - assert(s.get_number_of_slides() == 4) - - def test_file2(self): - """OpenSong: parse PÃ¥EnFjern (danish)""" - global __ThisDir__ - s = Song() - s.from_ccli_text_file(u'%s/data_text/PÃ¥EnFjern.txt'%(__ThisDir__)) - assert(s.get_title() == 'PÃ¥ en fjern ensom høj') - assert(s.get_author_list(True) == 'Georg Bennard') - assert(s.get_copyright() == '') - assert(s.get_song_cclino() == '') - assert(s.get_number_of_slides() == 8) - -if '__main__' == __name__: - # for local debugging - r = Test_Text() - r.test_file1() - r.test_file2() diff --git a/openlp/plugins/songs/test/test_song_verse.py b/openlp/plugins/songs/test/test_song_verse.py deleted file mode 100644 index 7467bbb1b..000000000 --- a/openlp/plugins/songs/test/test_song_verse.py +++ /dev/null @@ -1,156 +0,0 @@ -# -*- coding: utf-8 -*- -# vim: autoindent shiftwidth=4 expandtab textwidth=80 tabstop=4 softtabstop=4 - -############################################################################### -# OpenLP - Open Source Lyrics Projection # -# --------------------------------------------------------------------------- # -# Copyright (c) 2008-2010 Raoul Snyman # -# Portions copyright (c) 2008-2010 Tim Bentley, Jonathan Corwin, Michael # -# Gorven, Scott Guerrieri, Christian Richter, Maikel Stuivenberg, Martin # -# Thompson, Jon Tibble, Carsten Tinggaard # -# --------------------------------------------------------------------------- # -# 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 Foundation; version 2 of the License. # -# # -# 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 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 this program; if not, write to the Free Software Foundation, Inc., 59 # -# Temple Place, Suite 330, Boston, MA 02111-1307 USA # -############################################################################### - -import os -import sys - -__ThisDir__ = os.path.dirname(__file__) -if "" == __ThisDir__ : - __ThisDir__ = os.path.abspath(u'.') - -sys.path.append(os.path.abspath(u'%s/../../../..'%__ThisDir__)) - -from openlp.plugins.songs.lib.songxml import * - -class Test_Verse(object): - """Class for testing verses for preview and review""" - - def stdSong(self): - """Definition of a standard song""" - s = Song() - self.title = "A song" - self.author = "John Newton" - self.copyright = "Peter Hamil" - self.ccli = "123456" - s.set_lyrics(["# verse","a single line"]) - s.set_title(self.title) - s.set_copyright(self.copyright) - s.set_author_list(self.author) - s.set_song_cclino(self.ccli) - return s - - def check_allfields(self, r, isblank = 0): - #[theme, title, author, cpright, ccli, lyrics] - if isblank == 1 : - assert(r[1] == '') - else : - assert(r[1] == self.title) - if isblank == 2 : - assert(r[2] == '') - else : - assert(r[2] == self.author) - if isblank == 3 : - assert(r[3] == '') - else : - assert(r[3] == self.copyright) - if isblank == 4 : - assert(r[4] == '') - else : - assert(r[4] == self.ccli) - - - def test_title_show_noshow(self): - """Test the show title flag""" - s = self.stdSong() - r = s.get_render_slide(1) - self.check_allfields(r) - s.set_show_title(False) - r = s.get_render_slide(1) - self.check_allfields(r, 1) - s.set_show_title(True) - r = s.get_render_slide(1) - self.check_allfields(r) - - def test_author_show_noshow(self): - """Test the show author flag""" - s = self.stdSong() - r = s.get_render_slide(1) - self.check_allfields(r) - s.set_show_author_list(False) - r = s.get_render_slide(1) - self.check_allfields(r, 2) - s.set_show_author_list(True) - r = s.get_render_slide(1) - self.check_allfields(r) - - def test_copyright_show_noshow(self): - """Test the show copyright flag""" - s = self.stdSong() - r = s.get_render_slide(1) - self.check_allfields(r) - s.set_show_copyright(False) - r = s.get_render_slide(1) - self.check_allfields(r, 3) - s.set_show_copyright(True) - r = s.get_render_slide(1) - self.check_allfields(r) - - def test_ccli_show_noshow(self): - """Test the show copyright flag""" - s = self.stdSong() - r = s.get_render_slide(1) - self.check_allfields(r) - s.set_show_song_cclino(False) - r = s.get_render_slide(1) - self.check_allfields(r, 4) - s.set_show_song_cclino(True) - r = s.get_render_slide(1) - self.check_allfields(r) - - def test_verse1(self): - """Test an empty verse list""" - s = Song() - s.set_lyrics([]) - assert(s.get_number_of_slides() == 0) - - def test_verse2(self): - """Test a list with an empty string""" - s = Song() - s.set_lyrics([""]) - assert(s.get_number_of_slides() == 0) - - def test_verse3a(self): - """Test a one liner song""" - s = Song() - s.set_lyrics(["Single verse"]) - assert(s.get_number_of_slides() == 1) - - def test_verse3b(self): - """Test a one liner song""" - s = Song() - s.set_lyrics(["", u'Single verse']) - assert(s.get_number_of_slides() == 1) - - def test_verse3c(self): - """Test a one liner song""" - s = Song() - s.set_lyrics(["", u'Single verse', u'', u'']) - assert(s.get_number_of_slides() == 1) - - def test_verse3d(self): - """Test a one liner song""" - s = Song() - s.set_lyrics(["", u'# Verse', u'', u'']) - assert(s.get_number_of_slides() == 1)