summaryrefslogtreecommitdiffstats
path: root/tests/auto/other
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-04-21 20:43:33 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-08-27 20:22:29 +0200
commit2436e259ced39657f22176537603da44ff4e2512 (patch)
tree001b836ef64a242bf12693d0a384e2f5da244862 /tests/auto/other
parentaccc833e556ba54038d1cc7e261a936492145240 (diff)
Deprecate QApplication::setActiveWindow() and mark as internal
The function is used the internal window activation machinery and should not be called by user code. Many tests still use this function, and should be ported over to QWidget::activateWindow(). For now they are using the private helper in QApplicationPrivate, so that we can progress with the public API deprecation. Change-Id: I29f1575acf9efdcbae4c005ee9b2eb1bb0c8e5b5 Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/auto/other')
-rw-r--r--tests/auto/other/qaccessibility/tst_qaccessibility.cpp9
-rw-r--r--tests/auto/other/qfocusevent/CMakeLists.txt1
-rw-r--r--tests/auto/other/qfocusevent/tst_qfocusevent.cpp6
3 files changed, 10 insertions, 6 deletions
diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
index 8479985c0e..90f1647567 100644
--- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
+++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp
@@ -21,6 +21,7 @@
#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/private/qhighdpiscaling_p.h>
+#include <QtWidgets/private/qapplication_p.h>
#include <QtWidgets/private/qdialog_p.h>
#if defined(Q_OS_WIN) && defined(interface)
@@ -914,7 +915,7 @@ void tst_QAccessibility::applicationTest()
QWidget widget;
widget.show();
- qApp->setActiveWindow(&widget);
+ QApplicationPrivate::setActiveWindow(&widget);
QVERIFY(QTest::qWaitForWindowActive(&widget));
QAccessibleInterface *widgetIface = QAccessible::queryAccessibleInterface(&widget);
@@ -941,7 +942,7 @@ void tst_QAccessibility::mainWindowTest()
auto mw = mwHolder.get();
mw->resize(300, 200);
mw->show(); // triggers layout
- qApp->setActiveWindow(mw);
+ QApplicationPrivate::setActiveWindow(mw);
QLatin1String name = QLatin1String("I am the main window");
mw->setWindowTitle(name);
@@ -1958,7 +1959,7 @@ void tst_QAccessibility::mdiSubWindowTest()
{
QMdiArea mdiArea;
mdiArea.show();
- qApp->setActiveWindow(&mdiArea);
+ QApplicationPrivate::setActiveWindow(&mdiArea);
QVERIFY(QTest::qWaitForWindowActive(&mdiArea));
@@ -2026,7 +2027,7 @@ void tst_QAccessibility::mdiSubWindowTest()
testWindow->setEnabled(false);
QVERIFY(interface->state().disabled);
testWindow->setEnabled(true);
- qApp->setActiveWindow(&mdiArea);
+ QApplicationPrivate::setActiveWindow(&mdiArea);
mdiArea.setActiveSubWindow(testWindow);
testWindow->setFocus();
QVERIFY(testWindow->isAncestorOf(qApp->focusWidget()));
diff --git a/tests/auto/other/qfocusevent/CMakeLists.txt b/tests/auto/other/qfocusevent/CMakeLists.txt
index a984c7c1d1..24a596182e 100644
--- a/tests/auto/other/qfocusevent/CMakeLists.txt
+++ b/tests/auto/other/qfocusevent/CMakeLists.txt
@@ -14,4 +14,5 @@ qt_internal_add_test(tst_qfocusevent
Qt::Gui
Qt::GuiPrivate
Qt::Widgets
+ Qt::WidgetsPrivate
)
diff --git a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
index 0d34b8dfea..2001f14ca4 100644
--- a/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
+++ b/tests/auto/other/qfocusevent/tst_qfocusevent.cpp
@@ -16,6 +16,8 @@
#include <qpa/qplatformintegration.h>
#include <private/qguiapplication_p.h>
+#include <QtWidgets/private/qapplication_p.h>
+
QT_FORWARD_DECLARE_CLASS(QWidget)
class FocusLineEdit : public QLineEdit
@@ -112,7 +114,7 @@ void tst_QFocusEvent::initWidget()
{
// On X11 we have to ensure the event was processed before doing any checking, on Windows
// this is processed straight away.
- QApplication::setActiveWindow(testFocusWidget);
+ QApplicationPrivate::setActiveWindow(testFocusWidget);
childFocusWidgetOne->setFocus(); // The first lineedit should have focus
QVERIFY(QTest::qWaitForWindowActive(testFocusWidget));
QTRY_VERIFY(childFocusWidgetOne->hasFocus());
@@ -310,7 +312,7 @@ void tst_QFocusEvent::checkReason_ActiveWindow()
QVERIFY(QTest::qWaitForWindowExposed(d));
d->activateWindow(); // ### CDE
- QApplication::setActiveWindow(d);
+ QApplicationPrivate::setActiveWindow(d);
QVERIFY(QTest::qWaitForWindowActive(d));
QTRY_VERIFY(childFocusWidgetOne->focusOutEventRecieved);