File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change 34
34
)
35
35
36
36
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
+ )
38
44
from qgis .testing import start_app , unittest
39
45
40
46
start_app ()
@@ -108,6 +114,16 @@ def test_delete_feature(self):
108
114
self .widget .featureSelectionManager ().select ([fid ])
109
115
110
116
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 )
111
127
btn .click ()
112
128
113
129
# This is the important check that the feature is deleted
You can’t perform that action at this time.
0 commit comments