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>bb10
parent
420755edb7
commit
22ff16dc72
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Reference in New Issue