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.

Fixes: QTBUG-87390
Pick-to: 6.3 6.2
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>
This commit is contained in:
Ivan Solovev 2022-03-23 10:37:10 +01:00
parent 64fc50e309
commit aa451b13b0
2 changed files with 12 additions and 2 deletions

View File

@ -1,5 +1,3 @@
# QTBUG-87390
[grabWindow]
android
# QTBUG-100412
windows

View File

@ -32,6 +32,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <qpa/qplatformintegration.h>
#include <private/qguiapplication_p.h>
#include <private/qhighdpiscaling_p.h>
#include <QTest>
#include <QSignalSpy>
@ -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");