summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets
diff options
context:
space:
mode:
authorIvan Solovev <ivan.solovev@qt.io>2022-03-21 17:35:29 +0100
committerIvan Solovev <ivan.solovev@qt.io>2022-03-29 13:56:14 +0100
commitd85c6527b514e36ab06bdf4228113d458e16cae0 (patch)
treedcd1395a41878b8c7181d160f3e948817b658c0d /tests/auto/widgets
parent3033d896746aa931cc3dfcf09f24e73bbed4571a (diff)
Android: fix fullscreen handling
Commit a35a7fcb5a713956e97bc87ccbd273737c7418df introduced the usage of insets to correctly take into account the default Android status bars and other reserved regions. However in practice that does not work as expected - the bottom inset is always reported to be non-zero, even when fullscreen mode is enabled. To fix the issue, FLAG_FULLSCREEN is explicitly checked before applying the insets. Fixes: QTBUG-99624 Pick-to: 6.3 6.2 Change-Id: I8b25f0b06447cd452c42ef072493e3137e25f38b Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r--tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
index 3e6fd735d9..432b1e9189 100644
--- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
+++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp
@@ -445,6 +445,10 @@ private slots:
void activateWhileModalHidden();
+#ifdef Q_OS_ANDROID
+ void showFullscreenAndroid();
+#endif
+
private:
const QString m_platform;
QSize m_testWidgetSize;
@@ -12693,5 +12697,38 @@ void tst_QWidget::activateWhileModalHidden()
QCOMPARE(QApplication::activeWindow(), &window);
}
+#ifdef Q_OS_ANDROID
+void tst_QWidget::showFullscreenAndroid()
+{
+ QWidget w;
+ w.setAutoFillBackground(true);
+ QPalette p = w.palette();
+ p.setColor(QPalette::Window, Qt::red);
+ w.setPalette(p);
+
+ // Need to toggle showFullScreen() twice, see QTBUG-101968
+ w.showFullScreen();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ w.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+ w.showFullScreen();
+ QVERIFY(QTest::qWaitForWindowExposed(&w));
+
+ // Make sure that the lower part of the screen contains the red widget, not
+ // the buttons.
+
+ const QRect fullGeometry = w.screen()->geometry();
+ // Take a rect of (20 x 20) from the bottom area
+ const QRect grabArea(10, fullGeometry.height() - 30, 20, 20);
+ const QImage img = grabFromWidget(&w, grabArea).toImage().convertedTo(QImage::Format_RGB32);
+
+ QPixmap expectedPix(20, 20);
+ expectedPix.fill(Qt::red);
+ const QImage expectedImg = expectedPix.toImage().convertedTo(QImage::Format_RGB32);
+
+ QCOMPARE(img, expectedImg);
+}
+#endif // Q_OS_ANDROID
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"