From aa451b13b0914e3c33a4e05e792aa8c5effa7a3a Mon Sep 17 00:00:00 2001 From: Ivan Solovev Date: Wed, 23 Mar 2022 10:37:10 +0100 Subject: [PATCH] Android: enable tst_QScreen::grabWindow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. Fixes: QTBUG-87390 Pick-to: 6.3 6.2 Change-Id: I653a17bac2142838b03a328e1629582384b6c7b3 Reviewed-by: Qt CI Bot Reviewed-by: Morten Johan Sørvig Reviewed-by: Assam Boudjelthia --- tests/auto/gui/kernel/qscreen/BLACKLIST | 2 -- tests/auto/gui/kernel/qscreen/tst_qscreen.cpp | 12 ++++++++++++ 2 files changed, 12 insertions(+), 2 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 ea644e2e2b..c2f0747f18 100644 --- a/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp +++ b/tests/auto/gui/kernel/qscreen/tst_qscreen.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include @@ -282,9 +283,20 @@ 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");