Fix issue where enable-chord settings was not setup correctly for tests.

This commit is contained in:
Tomas Groth 2017-05-30 22:06:27 +02:00
parent 4a3e4e1ad4
commit ad55a8d254
3 changed files with 23 additions and 3 deletions

View File

@ -27,10 +27,15 @@ from unittest.mock import MagicMock
from PyQt5 import QtCore from PyQt5 import QtCore
from openlp.core.common import Settings
from openlp.plugins.songs.forms.editverseform import EditVerseForm from openlp.plugins.songs.forms.editverseform import EditVerseForm
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'songs/enable chords': True,
}
class TestEditVerseForm(TestCase, TestMixin): class TestEditVerseForm(TestCase, TestMixin):
""" """
@ -40,9 +45,10 @@ class TestEditVerseForm(TestCase, TestMixin):
""" """
Set up the components need for all tests. Set up the components need for all tests.
""" """
self.edit_verse_form = EditVerseForm(None)
self.setup_application() self.setup_application()
self.build_settings() self.build_settings()
Settings().extend_default_settings(__default_settings__)
self.edit_verse_form = EditVerseForm(None)
QtCore.QLocale.setDefault(QtCore.QLocale('en_GB')) QtCore.QLocale.setDefault(QtCore.QLocale('en_GB'))
def tearDown(self): def tearDown(self):

View File

@ -27,12 +27,16 @@ from unittest.mock import MagicMock
from PyQt5 import QtWidgets from PyQt5 import QtWidgets
from openlp.core.common import Registry from openlp.core.common import Registry, Settings
from openlp.core.common.uistrings import UiStrings from openlp.core.common.uistrings import UiStrings
from openlp.plugins.songs.forms.editsongform import EditSongForm from openlp.plugins.songs.forms.editsongform import EditSongForm
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'songs/enable chords': True,
}
class TestEditSongForm(TestCase, TestMixin): class TestEditSongForm(TestCase, TestMixin):
""" """
@ -48,12 +52,15 @@ class TestEditSongForm(TestCase, TestMixin):
self.main_window = QtWidgets.QMainWindow() self.main_window = QtWidgets.QMainWindow()
Registry().register('main_window', self.main_window) Registry().register('main_window', self.main_window)
Registry().register('theme_manager', MagicMock()) Registry().register('theme_manager', MagicMock())
self.build_settings()
Settings().extend_default_settings(__default_settings__)
self.form = EditSongForm(MagicMock(), self.main_window, MagicMock()) self.form = EditSongForm(MagicMock(), self.main_window, MagicMock())
def tearDown(self): def tearDown(self):
""" """
Delete all the C++ objects at the end so that we don't have a segfault Delete all the C++ objects at the end so that we don't have a segfault
""" """
self.destroy_settings()
del self.form del self.form
del self.main_window del self.main_window

View File

@ -26,10 +26,14 @@ from unittest import TestCase
from PyQt5 import QtCore, QtTest, QtWidgets from PyQt5 import QtCore, QtTest, QtWidgets
from openlp.core.common import Registry from openlp.core.common import Registry, Settings
from openlp.plugins.songs.forms.editverseform import EditVerseForm from openlp.plugins.songs.forms.editverseform import EditVerseForm
from tests.helpers.testmixin import TestMixin from tests.helpers.testmixin import TestMixin
__default_settings__ = {
'songs/enable chords': True,
}
class TestEditVerseForm(TestCase, TestMixin): class TestEditVerseForm(TestCase, TestMixin):
""" """
@ -44,12 +48,15 @@ class TestEditVerseForm(TestCase, TestMixin):
self.setup_application() self.setup_application()
self.main_window = QtWidgets.QMainWindow() self.main_window = QtWidgets.QMainWindow()
Registry().register('main_window', self.main_window) Registry().register('main_window', self.main_window)
self.build_settings()
Settings().extend_default_settings(__default_settings__)
self.form = EditVerseForm() self.form = EditVerseForm()
def tearDown(self): def tearDown(self):
""" """
Delete all the C++ objects at the end so that we don't have a segfault Delete all the C++ objects at the end so that we don't have a segfault
""" """
self.destroy_settings()
del self.form del self.form
del self.main_window del self.main_window