From 89583fe7d0232821df9b96010e5ad1662bd21c54 Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Wed, 5 Oct 2022 09:10:16 +0200 Subject: [PATCH] Remove focusProxyAndInputMethods from tst_QWidget focusProxyAndInputMethods tests focus acquisition and inheritance with a toplevel widget, acting as a focus proxy for a child. X11 window managers are set to be bypassed, programmatic focus is set with QApplicationPrivate::setActiveWindow(). The test is flaky on Linux/XCB, and therefore blacklisted on most Linuxes. This patch removes focusProxyAndInputMethods, considering that - focus proxying is tested in tst_QWidget::focusProxy() - window activation and focus inheritance are tested in tst_QWindow::isActive() Change-Id: I510fd935399d9ad0b6cd76f1bd5db0811e0702f6 Reviewed-by: Richard Moe Gustavsen (cherry picked from commit b439f06941007483ee14aeeb4fb09ac8148c8038) --- tests/auto/widgets/kernel/qwidget/BLACKLIST | 5 ---- .../widgets/kernel/qwidget/tst_qwidget.cpp | 29 ------------------- 2 files changed, 34 deletions(-) diff --git a/tests/auto/widgets/kernel/qwidget/BLACKLIST b/tests/auto/widgets/kernel/qwidget/BLACKLIST index 24387635b44..7bd4c0a304c 100644 --- a/tests/auto/widgets/kernel/qwidget/BLACKLIST +++ b/tests/auto/widgets/kernel/qwidget/BLACKLIST @@ -3,11 +3,6 @@ ubuntu-16.04 [restoreVersion1Geometry] ubuntu-16.04 -[focusProxyAndInputMethods] -rhel-7.6 -centos -opensuse-leap -ubuntu [raise] opensuse-leap # QTBUG-68175 diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index b43494ab540..3947e9af0c0 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -368,7 +368,6 @@ private slots: void openModal_taskQTBUG_5804(); void focusProxy(); - void focusProxyAndInputMethods(); void imEnabledNotImplemented(); #ifdef QT_BUILD_INTERNAL @@ -10956,34 +10955,6 @@ void tst_QWidget::focusProxy() QCOMPARE(container2->focusOutCount, 1); } -void tst_QWidget::focusProxyAndInputMethods() -{ - if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) - QSKIP("Window activation is not supported."); - QScopedPointer toplevel(new QWidget(nullptr, Qt::X11BypassWindowManagerHint)); - toplevel->setWindowTitle(QLatin1String(QTest::currentTestFunction())); - toplevel->resize(200, 200); - toplevel->setAttribute(Qt::WA_InputMethodEnabled, true); - - QWidget *child = new QWidget(toplevel.data()); - child->setFocusProxy(toplevel.data()); - child->setAttribute(Qt::WA_InputMethodEnabled, true); - - toplevel->setFocusPolicy(Qt::WheelFocus); - child->setFocusPolicy(Qt::WheelFocus); - - QVERIFY(!child->hasFocus()); - QVERIFY(!toplevel->hasFocus()); - - toplevel->show(); - QVERIFY(QTest::qWaitForWindowExposed(toplevel.data())); - QApplication::setActiveWindow(toplevel.data()); - QVERIFY(QTest::qWaitForWindowActive(toplevel.data())); - QVERIFY(toplevel->hasFocus()); - QVERIFY(child->hasFocus()); - QCOMPARE(qApp->focusObject(), toplevel.data()); -} - void tst_QWidget::imEnabledNotImplemented() { // Check that a plain widget doesn't report that it supports IM. Only