forked from openlp/openlp
Fix review comments
This commit is contained in:
parent
5bc10bf1a9
commit
a73d4cce08
@ -322,7 +322,6 @@ class Settings(QtCore.QSettings):
|
|||||||
"""
|
"""
|
||||||
# if group() is not empty the group has not been specified together with the key.
|
# if group() is not empty the group has not been specified together with the key.
|
||||||
if self.group():
|
if self.group():
|
||||||
qq = self.group() + u'/' + key
|
|
||||||
default_value = Settings.__default_settings__[unicode(self.group() + u'/' + key)]
|
default_value = Settings.__default_settings__[unicode(self.group() + u'/' + key)]
|
||||||
else:
|
else:
|
||||||
default_value = Settings.__default_settings__[key]
|
default_value = Settings.__default_settings__[key]
|
||||||
|
@ -4,13 +4,13 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from mock import MagicMock
|
|
||||||
from openlp.core.lib import Settings
|
from openlp.core.lib import Settings
|
||||||
|
|
||||||
from PyQt4 import QtGui, QtTest
|
from PyQt4 import QtGui, QtTest
|
||||||
|
|
||||||
TESTPATH = os.path.abspath(os.path.join(os.path.dirname(__file__), u'..', u'..', u'resources'))
|
TESTPATH = os.path.abspath(os.path.join(os.path.dirname(__file__), u'..', u'..', u'resources'))
|
||||||
|
|
||||||
|
|
||||||
class TestSettings(TestCase):
|
class TestSettings(TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
@ -29,7 +29,7 @@ class TestSettings(TestCase):
|
|||||||
del self.application
|
del self.application
|
||||||
try:
|
try:
|
||||||
os.remove(Settings().fileName())
|
os.remove(Settings().fileName())
|
||||||
except:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def settings_basic_test(self):
|
def settings_basic_test(self):
|
||||||
@ -42,13 +42,13 @@ class TestSettings(TestCase):
|
|||||||
default_value = Settings().value(u'general/has run wizard')
|
default_value = Settings().value(u'general/has run wizard')
|
||||||
|
|
||||||
# THEN the default value is returned
|
# THEN the default value is returned
|
||||||
assert default_value is False, u'The default value defined is returned'
|
assert default_value is False, u'The default value defined has not been returned'
|
||||||
|
|
||||||
# WHEN a new value is saved into config
|
# WHEN a new value is saved into config
|
||||||
Settings().setValue(u'general/has run wizard', True)
|
Settings().setValue(u'general/has run wizard', True)
|
||||||
|
|
||||||
# THEN the new value is returned when re-read
|
# THEN the new value is returned when re-read
|
||||||
assert Settings().value(u'general/has run wizard') is True, u'The saved value is returned'
|
assert Settings().value(u'general/has run wizard') is True, u'The saved value has not been returned'
|
||||||
|
|
||||||
def settings_override_test(self):
|
def settings_override_test(self):
|
||||||
"""
|
"""
|
||||||
@ -88,10 +88,10 @@ class TestSettings(TestCase):
|
|||||||
extend = settings.value(u'extend')
|
extend = settings.value(u'extend')
|
||||||
|
|
||||||
# THEN the default value is returned
|
# THEN the default value is returned
|
||||||
assert extend == u'very wide', u'The default value defined is returned'
|
assert extend == u'very wide', u'The default value defined has not been returned'
|
||||||
|
|
||||||
# WHEN a new value is saved into config
|
# WHEN a new value is saved into config
|
||||||
Settings().setValue(u'test/extend', u'very short')
|
Settings().setValue(u'test/extend', u'very short')
|
||||||
|
|
||||||
# THEN the new value is returned when re-read
|
# THEN the new value is returned when re-read
|
||||||
assert Settings().value(u'test/extend') == u'very short', u'The saved value is returned'
|
assert Settings().value(u'test/extend') == u'very short', u'The saved value has not been returned'
|
||||||
|
Loading…
Reference in New Issue
Block a user