Skip to content

Commit 330db17

Browse files
committed
Fix test
1 parent 3e09118 commit 330db17

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

tests/src/python/test_qgsrelationeditwidget.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@
3434
)
3535

3636
from qgis.PyQt.QtCore import QTimer
37-
from qgis.PyQt.QtWidgets import QToolButton, QTableView, QApplication
37+
from qgis.PyQt.QtWidgets import (
38+
QToolButton,
39+
QMessageBox,
40+
QDialogButtonBox,
41+
QTableView,
42+
QApplication
43+
)
3844
from qgis.testing import start_app, unittest
3945

4046
start_app()
@@ -108,6 +114,16 @@ def test_delete_feature(self):
108114
self.widget.featureSelectionManager().select([fid])
109115

110116
btn = self.widget.findChild(QToolButton, 'mDeleteFeatureButton')
117+
118+
def clickOk():
119+
# Click the "Delete features" button on the confirmation message
120+
# box
121+
widget = self.widget.findChild(QMessageBox)
122+
buttonBox = widget.findChild(QDialogButtonBox)
123+
deleteButton = next((b for b in buttonBox.buttons() if buttonBox.buttonRole(b) == QDialogButtonBox.AcceptRole))
124+
deleteButton.click()
125+
126+
QTimer.singleShot(1, clickOk)
111127
btn.click()
112128

113129
# This is the important check that the feature is deleted

0 commit comments

Comments
 (0)