summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/kernel
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-03-02 08:46:08 +0100
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-03-15 08:17:31 +0100
commit22ff16dc726d0f551eb6888038b766fd18213bf4 (patch)
tree8f58f3b55e8410eb3f1977feff85a9927f960e89 /tests/auto/widgets/kernel
parent420755edb71267f756df4c61955b910099ec9537 (diff)
Make tst_qwidget pass on Wayland
Several tests failed due to side effects of client side decorations. We explicitly disable this when initializing the test to make things go smoother. In addition, the setToolTip() test tries to set the mouse cursor position programmatically, which is not possible on Wayland. And finally, the qWaitForWindowActive() falls back to qWaitForWindowExposed() on platforms where explicit window activation is not supported. This fixes a few issues, but in cases like focusProxy(), it means we aren't actually waiting for the WindowActivation event. Instead of testing for exposed twice on such platforms (Wayland), we replicate the logic from qWaitForWindowActive() instead and rely on automatic window activation. If it fails, we do a QSKIP, so this shouldn't cause any flaky test failures at least. Task-number: QTBUG-91418 Change-Id: I767c881e7cdc91f43ad357294a2c6240ab1af43c Reviewed-by: Liang Qi <liang.qi@qt.io>
Diffstat (limited to 'tests/auto/widgets/kernel')
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp19
1 files changed, 16 insertions, 3 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 014e31d1a9..8992a0b051 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -607,6 +607,9 @@ tst_QWidget::tst_QWidget()
palette.setColor(QPalette::ToolTipBase, QColor(12, 13, 14));
palette.setColor(QPalette::Text, QColor(21, 22, 23));
QApplication::setPalette(palette, "QPropagationTestWidget");
+
+ if (QApplication::platformName().startsWith(QLatin1String("wayland")))
+ qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1");
}
tst_QWidget::~tst_QWidget()
@@ -6383,6 +6386,9 @@ void tst_QWidget::setCursor()
void tst_QWidget::setToolTip()
{
+ if (QApplication::platformName().startsWith(QLatin1String("wayland")))
+ QSKIP("Setting mouse cursor position is not possible on Wayland");
+
QWidget widget;
widget.resize(200, 200);
// Showing the widget is not required for the tooltip event count test
@@ -10207,9 +10213,16 @@ void tst_QWidget::focusProxy()
window.setFocus();
window.show();
- window.activateWindow();
- if (!QTest::qWaitForWindowExposed(&window) || !QTest::qWaitForWindowActive(&window))
- QSKIP("Window activation failed");
+ if (!QTest::qWaitForWindowExposed(&window))
+ QSKIP("Window exposed failed");
+ if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::WindowActivation)) {
+ window.activateWindow();
+ if (!QTest::qWaitForWindowActive(&window))
+ QSKIP("Window activation failed");
+ } else {
+ if (!QTest::qWaitFor([&]() { return window.windowHandle()->isActive(); }, 5000))
+ QSKIP("Window activation failed");
+ }
// given a widget without focus proxy
QVERIFY(window.hasFocus());