Fix reset footer template

This commit is contained in:
Daniel Martin 2021-03-08 21:14:49 +00:00 committed by Tomas Groth
parent 8123f9d920
commit 7d71b70d62
2 changed files with 15 additions and 1 deletions

View File

@ -269,7 +269,7 @@ class SongsTab(SettingsTab):
if answer == QtWidgets.QMessageBox.Yes:
self.settings.setValue('songs/songselect password', self.ccli_password.text())
# Only save footer template if it has been changed. This allows future updates
if self.footer_edit_box.toPlainText() != self.settings.get_default_value('songs/footer template'):
if self.footer_edit_box.toPlainText() != self.settings.value('songs/footer template'):
self.settings.setValue('songs/footer template', self.footer_edit_box.toPlainText())
self.settings.setValue('songs/add songbook slide', self.songbook_slide)
if self.tab_visited:

View File

@ -206,6 +206,20 @@ def test_footer_reset(form):
assert form.footer_edit_box.toPlainText() == form.settings.get_default_value('songs/footer template')
def test_footer_reset_save(form):
"""
Test the footer can be saved as the default value
"""
# GIVEN: A non default footer template and the default template in the edit box
form.settings.setValue('songs/footer template', 'hello')
default_footer = form.settings.get_default_value('songs/footer template')
form.footer_edit_box.setPlainText(default_footer)
# WHEN: save is invoked
form.save()
# THEN: footer template should have been reset to the default_footer value
assert form.settings.value('songs/footer template') == form.settings.get_default_value('songs/footer template')
def test_save_tab_nochange(form):
"""
Test no changes does not trigger post processing