From 20d23f70036b7653f2eadcdd6dd45addd300cea4 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 28 Jun 2022 09:29:13 +0200 Subject: [PATCH] Fix tst_QWindow::requestUpdate on Wayland On Wayland there is a special case when decorations are enabled, where we post an initial update request to ensure widgets are redrawn after the buffer is recreated (see af7b60ade5c4be81cbc58eb18307c017d5594071 in qtwayland). To make sure the test behaves the same on Wayland as on other platforms, we disable client-side decorations when running these tests. The flag is primarily required for the requestUpdate() test at the moment, but it is only queried once per application run, so it has to be set before any tests are run. Pick-to: 6.4 Fixes: QTBUG-100889 Change-Id: Ica6d744083ecae4a3722b6d04b956e7615f0dfe5 Reviewed-by: Inho Lee Reviewed-by: Paul Olav Tvete --- tests/auto/gui/kernel/qwindow/tst_qwindow.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp index b94aa10ea58..2ebb9472f68 100644 --- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp +++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp @@ -97,6 +97,11 @@ private: QInputDevice::Capability::Position | QInputDevice::Capability::MouseEmulation); }; +static bool isPlatformWayland() +{ + return QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive); +} + void tst_QWindow::initTestCase() { // Size of reference window, 200 for < 2000, scale up for larger screens @@ -108,6 +113,10 @@ void tst_QWindow::initTestCase() if (screenWidth > 2000) width = 100 * ((screenWidth + 500) / 1000); m_testWindowSize = QSize(width, width); + + // Make sure test runs consistently on all compositors by force-disabling window decorations + if (isPlatformWayland()) + qputenv("QT_WAYLAND_DISABLE_WINDOWDECORATION", "1"); } void tst_QWindow::cleanup() @@ -486,11 +495,6 @@ static QString msgRectMismatch(const QRect &r1, const QRect &r2) return result; } -static bool isPlatformWayland() -{ - return QGuiApplication::platformName().startsWith(QLatin1String("wayland"), Qt::CaseInsensitive); -} - void tst_QWindow::positioning() { #ifdef Q_OS_ANDROID @@ -2538,8 +2542,6 @@ void tst_QWindow::requestUpdate() QCoreApplication::processEvents(); QTRY_VERIFY(window.isExposed()); - if (isPlatformWayland()) - QEXPECT_FAIL("", "Wayland: This fails. See QTBUG-100889.", Abort); QCOMPARE(window.received(QEvent::UpdateRequest), 0); window.requestUpdate();