Fix test coverage of wordlist dialog

This commit is contained in:
Veronica Berglyd Olsen
2023-06-13 21:10:11 +02:00
parent 8d38f27eee
commit f33ba03a2f
17 changed files with 52 additions and 60 deletions
+5 -5
View File
@@ -114,7 +114,7 @@ class GuiWordList(QDialog):
return
def __del__(self):
def __del__(self): # pragma: no cover
logger.debug("Delete: GuiWordList")
return
@@ -122,25 +122,25 @@ class GuiWordList(QDialog):
# Slots
##
def _doAdd(self) -> bool:
def _doAdd(self):
"""Add a new word to the word list."""
word = self.newEntry.text().strip()
if word == "":
self.mainGui.makeAlert(self.tr(
"Cannot add a blank word."
), nwAlert.ERROR)
return False
return
if self.listBox.findItems(word, Qt.MatchExactly):
self.mainGui.makeAlert(self.tr(
"The word '{0}' is already in the word list."
).format(word), nwAlert.ERROR)
return False
return
self.listBox.addItem(word)
self.newEntry.setText("")
return True
return
def _doDelete(self):
"""Delete the selected item."""