diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp index a6e9535e889..18120e8c24f 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -283,13 +283,12 @@ void tst_QScreen::grabWindow() if (!QTest::qWaitForWindowExposed(&window)) QSKIP("Failed to expose window - aborting"); - if (QGuiApplication::platformName().startsWith(QLatin1String("xcb"), Qt::CaseInsensitive)) - QTest::qWait(1500); // this is ridiculously necessary because of effects combined with slowness of VMs -#ifdef Q_OS_MACOS // wait for desktop on screen to scroll into place - QTest::qWait(1000); -#endif + // this is necessary because of scrolling effects combined with potential slowness of VMs + QTest::qWait(1500); - QSize expectedGrabSize = grabRect.isValid() ? grabRect.size() : (grabWindow ? windowRect.size() : screen->size()); + QSize expectedGrabSize = grabRect.isValid() + ? grabRect.size() + : (grabWindow ? windowRect.size() : screen->size()); // we ask for pixel coordinates, but will get a pixmap with device-specific DPR expectedGrabSize *= screen->devicePixelRatio(); @@ -297,7 +296,9 @@ void tst_QScreen::grabWindow() QImage paintedImage = window.image; QCOMPARE(paintedImage.devicePixelRatio(), screenDpr); - const QPixmap pixmap = screen->grabWindow(grabWindow ? window.winId() : 0, grabRect.x(), grabRect.y(), grabRect.width(), grabRect.height()); + const QPixmap pixmap = screen->grabWindow(grabWindow + ? window.winId() + : 0, grabRect.x(), grabRect.y(), grabRect.width(), grabRect.height()); QImage grabbedImage = pixmap.toImage(); const QSize grabbedSize = grabbedImage.size();