summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/dialogs
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2021-04-16 10:33:56 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2021-04-23 08:52:01 +0200
commit83eca9a087e569bcdeaaeeddab84c9524952d23e (patch)
tree04afde74bef3b98526bc56c412dabdf2238fa44d /tests/auto/widgets/dialogs
parent00988adcf96ff6b3bab90ff798b060e27d865b45 (diff)
Mark obsolete QMessageBox members as deprecated
Those overloads have been documented as obsolete, but never been deprecated. Add the deprecation macros to trigger warnings as of Qt 6.2. The overloads taking a single StandardButton should not be deprecated until Qt 7, as otherwise porting from old to new API will require an unnecessary cast to StandardButtons for calls with only a single enum value. The unit test explicitly tests the deprecated members, so disable warnings there. Fixes: QTBUG-92483 Change-Id: I283ddce4681eafda2378607f999946e56bbb777e Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/widgets/dialogs')
-rw-r--r--tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
index ce84459973..4210c428ec 100644
--- a/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
+++ b/tests/auto/widgets/dialogs/qmessagebox/tst_qmessagebox.cpp
@@ -388,6 +388,8 @@ void tst_QMessageBox::staticSourceCompat()
int ret;
// source compat tests for < 4.2
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
ExecCloseHelper closeHelper;
closeHelper.start(Qt::Key_Enter);
ret = QMessageBox::information(nullptr, "title", "text", QMessageBox::Yes, QMessageBox::No);
@@ -438,10 +440,13 @@ void tst_QMessageBox::staticSourceCompat()
QCOMPARE(ret, 1);
QVERIFY(closeHelper.done());
}
+QT_WARNING_POP
}
void tst_QMessageBox::instanceSourceCompat()
{
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
QMessageBox mb("Application name here",
"Saving the file will overwrite the original file on the disk.\n"
"Do you really want to save?",
@@ -466,6 +471,7 @@ void tst_QMessageBox::instanceSourceCompat()
closeHelper.start(QKeyCombination(Qt::ALT | Qt::Key_Z).toCombined(), &mb);
QCOMPARE(mb.exec(), 1);
#endif
+QT_WARNING_POP
}
void tst_QMessageBox::detailsText()
@@ -546,8 +552,11 @@ void tst_QMessageBox::incorrectDefaultButton()
closeHelper.start(Qt::Key_Escape);
QTest::ignoreMessage(QtWarningMsg, "QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
QTest::ignoreMessage(QtWarningMsg, "QDialogButtonBox::createButton: Invalid ButtonRole, button not added");
+QT_WARNING_PUSH
+QT_WARNING_DISABLE_DEPRECATED
//do not crash here -> call old function of QMessageBox in this case
QMessageBox::question(nullptr, "", "I've been hit!",QMessageBox::Ok | QMessageBox::Cancel,QMessageBox::Save | QMessageBox::Cancel,QMessageBox::Ok);
+QT_WARNING_POP
QVERIFY(closeHelper.done());
}