Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix test
  • Loading branch information
m-kuhn committed Jul 23, 2018
1 parent 3e09118 commit 330db17
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion tests/src/python/test_qgsrelationeditwidget.py
Expand Up @@ -34,7 +34,13 @@
)

from qgis.PyQt.QtCore import QTimer
from qgis.PyQt.QtWidgets import QToolButton, QTableView, QApplication
from qgis.PyQt.QtWidgets import (
QToolButton,
QMessageBox,
QDialogButtonBox,
QTableView,
QApplication
)
from qgis.testing import start_app, unittest

start_app()
Expand Down Expand Up @@ -108,6 +114,16 @@ def test_delete_feature(self):
self.widget.featureSelectionManager().select([fid])

btn = self.widget.findChild(QToolButton, 'mDeleteFeatureButton')

def clickOk():
# Click the "Delete features" button on the confirmation message
# box
widget = self.widget.findChild(QMessageBox)
buttonBox = widget.findChild(QDialogButtonBox)
deleteButton = next((b for b in buttonBox.buttons() if buttonBox.buttonRole(b) == QDialogButtonBox.AcceptRole))
deleteButton.click()

QTimer.singleShot(1, clickOk)
btn.click()

# This is the important check that the feature is deleted
Expand Down

0 comments on commit 330db17

Please sign in to comment.