Make sure the correct item is selected

This commit is contained in:
Veronica K. B. Olsen
2020-08-20 20:43:19 +02:00
parent d4052568be
commit cff7463a7c
2 changed files with 11 additions and 3 deletions
+1 -1
View File
@@ -617,7 +617,7 @@ class GuiProjectEditReplace(QWidget):
saveKey = "<keyword%d>" % (self.listBox.topLevelItemCount() + 1)
newVal = ""
newItem = QTreeWidgetItem([saveKey, newVal])
self.listBox.insertTopLevelItem(0, newItem)
self.listBox.addTopLevelItem(newItem)
return True
def _delEntry(self):
+10 -2
View File
@@ -337,7 +337,15 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay)
projEdit.tabReplace.listBox.clearSelection()
qtbot.mouseClick(projEdit.tabReplace.addButton, Qt.LeftButton)
projEdit.tabReplace.listBox.topLevelItem(0).setSelected(True)
newIdx = -1
for i in range(projEdit.tabReplace.listBox.topLevelItemCount()):
if projEdit.tabReplace.listBox.topLevelItem(0).text(0) == "<keyword2>":
newIdx = i
break
assert newIdx >= 0
projEdit.tabReplace.listBox.topLevelItem(newIdx).setSelected(True)
for c in "Delete":
qtbot.keyClick(projEdit.tabReplace.editKey, c, delay=keyDelay)
for c in "This Stuff":
@@ -346,7 +354,7 @@ def testProjectEditor(qtbot, nwTempGUI, nwRef, nwTemp):
qtbot.wait(stepDelay)
projEdit.tabReplace.listBox.clearSelection()
projEdit.tabReplace.listBox.topLevelItem(0).setSelected(True)
projEdit.tabReplace.listBox.topLevelItem(newIdx).setSelected(True)
qtbot.mouseClick(projEdit.tabReplace.delButton, Qt.LeftButton)
qtbot.wait(stepDelay)