summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index 94afff6e40..26a6245164 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -63,6 +63,7 @@ private slots:
void hideNativeByDestruction();
void explicitDoneAfterButtonClicked();
+ void legacyApiReturnValue();
void cleanup();
};
@@ -511,7 +512,7 @@ QT_WARNING_DISABLE_DEPRECATED
// the button text versions
closeHelper.start(Qt::Key_Enter);
ret = QMessageBox::information(nullptr, "title", "text", "Yes", "No", QString(), 1);
- COMPARE(ret, 3); // Custom button opaque result
+ COMPARE(ret, 1);
QVERIFY(closeHelper.done());
#endif // QT_DEPRECATED_SINCE(6, 2)
#undef COMPARE
@@ -863,5 +864,21 @@ void tst_QMessageBox::explicitDoneAfterButtonClicked()
QCOMPARE(rejectedSpy.size(), 3);
}
+void tst_QMessageBox::legacyApiReturnValue()
+{
+ ExecCloseHelper closeHelper;
+ for (int i = 0; i < 3; ++i) {
+ closeHelper.start(Qt::Key_Enter);
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
+ QCOMPARE(QMessageBox::warning(nullptr, "Title", "Text",
+ "Button 0", "Button 1", "Button 2", i), i);
+ closeHelper.start(Qt::Key_Escape);
+ QCOMPARE(QMessageBox::warning(nullptr, "Title", "Text",
+ "Button 0", "Button 1", "Button 2", 0, i), i);
+QT_WARNING_POP
+ }
+}
+
QTEST_MAIN(tst_QMessageBox)
#include "tst_qmessagebox.moc"