summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-03-23 10:37:10 +0100
committerIvan Solovev <ivan.solovev@qt.io>2022-04-10 21:29:48 +0200
commitdeb8be93e1e09ab1926fe2c4cea5f77e1c02c713 (patch)
tree4f3ce8f5fa4a3fb4acc3a0572a126936ec58f650
parent45c5b5db0bcae9f300e8a98c463143194b9e39a2 (diff)
Android: enable tst_QScreen::grabWindow
Two things are done here: - use showNormal() instead of show() to get an expected widget size. - skip the test if HighDPI scaling is enabled with non-integer scaling factor, because there can be rounding errors. Also had to backport the unconditional delay after showing the window (introduced in 6.3), because the emulator was not fast enough to actually render the window. Fixes: QTBUG-87390 Change-Id: I653a17bac2142838b03a328e1629582384b6c7b3 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io> (cherry picked from commit aa451b13b0914e3c33a4e05e792aa8c5effa7a3a)
-rw-r--r--tests/auto/gui/kernel/qscreen/BLACKLIST2
-rw-r--r--tests/auto/gui/kernel/qscreen/tst_qscreen.cpp19
2 files changed, 14 insertions, 7 deletions
diff --git a/tests/auto/gui/kernel/qscreen/BLACKLIST b/tests/auto/gui/kernel/qscreen/BLACKLIST
index 51fd672239..ca3136fdb2 100644
--- a/tests/auto/gui/kernel/qscreen/BLACKLIST
+++ b/tests/auto/gui/kernel/qscreen/BLACKLIST
@@ -1,5 +1,3 @@
-# QTBUG-87390
[grabWindow]
-android
# QTBUG-100412
windows
diff --git a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
index 789069381b..5ae5028797 100644
--- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
+++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp
@@ -30,6 +30,7 @@
#include <qrasterwindow.h>
#include <qscreen.h>
#include <qpa/qwindowsysteminterface.h>
+#include <private/qhighdpiscaling_p.h>
#include <QTest>
#include <QSignalSpy>
@@ -279,18 +280,26 @@ void tst_QScreen::grabWindow()
QCOMPARE(screen->name().toUtf8(), screenName);
const double screenDpr = screen->devicePixelRatio();
+ if (QHighDpiScaling::isActive()) {
+ const float rawFactor = QHighDpiScaling::factor(screen);
+ const float roundedFactor = qRound(rawFactor);
+ if (!qFuzzyCompare(roundedFactor, rawFactor))
+ QSKIP("HighDPI enabled with non-integer factor. Skip due to possible rounding errors.");
+ }
+
Window window(screen);
window.setGeometry(windowRect);
+#ifndef Q_OS_ANDROID
window.show();
+#else
+ window.showNormal();
+#endif
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());
// we ask for pixel coordinates, but will get a pixmap with device-specific DPR