diff options
author | Ivan Solovev <ivan.solovev@qt.io> | 2022-08-17 15:54:16 +0200 |
---|---|---|
committer | Ivan Solovev <ivan.solovev@qt.io> | 2022-08-30 22:46:35 +0200 |
commit | 56ec6a392a0301b733d0cb2f3d63453236ecdbff (patch) | |
tree | e062b2d583b3c9d6ac3795ff423c3fca80d3b6bb /tests/auto/gui/kernel/qguiapplication | |
parent | 2e69ef6af9ee0f0135d0d8fd0b9bd91140a1d756 (diff) |
tst_qguiapplication: guard the usage of deprecated signals
The paletteChanged() and fontChanged() signals were deprecated
in Qt 6.0, but the test was still using them unconditionally.
This patch guards the usage of the deprecated signals with
the usual QT_DEPRECATED_SINCE(6, 0) check, so that the test
can be built and run with QT_DISABLE_DEPRECATED_UP_TO >= 0x060000
This commit amends 68ea9c022701359b447be076888331a4f9d9085b
Task-number: QTBUG-104858
Change-Id: Idb2da6d91afcdb664f325f23ec625947c9a7fac0
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'tests/auto/gui/kernel/qguiapplication')
-rw-r--r-- | tests/auto/gui/kernel/qguiapplication/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp | 12 |
2 files changed, 10 insertions, 3 deletions
diff --git a/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt index a605657f86..e2bc3bb0f8 100644 --- a/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt +++ b/tests/auto/gui/kernel/qguiapplication/CMakeLists.txt @@ -27,7 +27,6 @@ qt_internal_add_test(tst_qguiapplication ../../../corelib/kernel/qcoreapplication/tst_qcoreapplication.cpp ../../../corelib/kernel/qcoreapplication/tst_qcoreapplication.h # special case tst_qguiapplication.cpp DEFINES - QT_DISABLE_DEPRECATED_UP_TO=0x050E00 QT_QGUIAPPLICATIONTEST=1 INCLUDE_DIRECTORIES ../../../corelib/kernel/qcoreapplication diff --git a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp index e8c283252e..f1851e72bc 100644 --- a/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp +++ b/tests/auto/gui/kernel/qguiapplication/tst_qguiapplication.cpp @@ -532,16 +532,16 @@ void tst_QGuiApplication::palette() QVERIFY(palettesMatch(QGuiApplication::palette(), newPalette)); #if QT_DEPRECATED_SINCE(6, 0) QCOMPARE(signalSpy.count(), 1); -#endif QVERIFY(palettesMatch(signalSpy.at(0).at(0).value<QPalette>(), newPalette)); +#endif QCOMPARE(QGuiApplication::palette(), QPalette()); QGuiApplication::setPalette(oldPalette); QVERIFY(palettesMatch(QGuiApplication::palette(), oldPalette)); #if QT_DEPRECATED_SINCE(6, 0) QCOMPARE(signalSpy.count(), 2); -#endif QVERIFY(palettesMatch(signalSpy.at(1).at(0).value<QPalette>(), oldPalette)); +#endif QCOMPARE(QGuiApplication::palette(), QPalette()); QGuiApplication::setPalette(oldPalette); @@ -557,24 +557,32 @@ void tst_QGuiApplication::font() int argc = 1; char *argv[] = { const_cast<char*>("tst_qguiapplication") }; QGuiApplication app(argc, argv); +#if QT_DEPRECATED_SINCE(6, 0) QSignalSpy signalSpy(&app, SIGNAL(fontChanged(QFont))); +#endif QFont oldFont = QGuiApplication::font(); QFont newFont = QFont("BogusFont", 33); QGuiApplication::setFont(newFont); QCOMPARE(QGuiApplication::font(), newFont); +#if QT_DEPRECATED_SINCE(6, 0) QCOMPARE(signalSpy.count(), 1); QCOMPARE(signalSpy.at(0).at(0), QVariant(newFont)); +#endif QGuiApplication::setFont(oldFont); QCOMPARE(QGuiApplication::font(), oldFont); +#if QT_DEPRECATED_SINCE(6, 0) QCOMPARE(signalSpy.count(), 2); QCOMPARE(signalSpy.at(1).at(0), QVariant(oldFont)); +#endif QGuiApplication::setFont(oldFont); QCOMPARE(QGuiApplication::font(), oldFont); +#if QT_DEPRECATED_SINCE(6, 0) QCOMPARE(signalSpy.count(), 2); +#endif } class BlockableWindow : public QWindow |