summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp')
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 4210c428ec..b67f15458c 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -50,6 +50,7 @@ private slots:
void sanityTest();
void defaultButton();
void escapeButton();
+ void clickedButton();
void button();
void statics();
void about();
@@ -302,6 +303,28 @@ void tst_QMessageBox::escapeButton()
QVERIFY(msgBox3.clickedButton() == msgBox3.button(QMessageBox::Ok)); // auto detected
}
+void tst_QMessageBox::clickedButton()
+{
+ QMessageBox msgBox;
+ msgBox.addButton(QMessageBox::Yes);
+ msgBox.addButton(QMessageBox::No);
+ msgBox.addButton(QMessageBox::Retry);
+
+ QVERIFY(!msgBox.clickedButton());
+
+ for (int i = 0; i < 2; ++i) {
+ QAbstractButton *clickedButtonAfterExex = nullptr;
+ QTimer::singleShot(100, [&] {
+ clickedButtonAfterExex = msgBox.clickedButton();
+ msgBox.close();
+ });
+ msgBox.exec();
+
+ QVERIFY(!clickedButtonAfterExex);
+ QVERIFY(msgBox.clickedButton());
+ }
+}
+
void tst_QMessageBox::statics()
{
QMessageBox::StandardButton (*statics[4])(QWidget *, const QString &,