diff options
author | Tor Arne Vestbø <[email protected]> | 2025-05-30 10:56:16 +0200 |
---|---|---|
committer | Assam Boudjelthia <[email protected]> | 2025-05-31 11:36:43 +0300 |
commit | 43821db66383c608bd02f2b6f86ec0b58d650eaf (patch) | |
tree | 9492c51d6b8a5b975a29cafedac38ea90de307c4 /tests | |
parent | 98b34a9bc4ee232e0abf0e443740f8e65982d80f (diff) |
Now that Android takes safe area margins into account on startup,
as of qtbase e96a4b84e136d065054600c07bf5fae17f3049ce, we can't
assume the size of elements placed into the content item is the
same size as the screen's available size.
What these tests seem to test is that the root elements of a
window fill the available space in the window correctly, which
we can check by comparing the size to that of the content item,
which is automatically inset based on the window's safe area
margins.
Pick-to: 6.9
Fixes: QTBUG-137285
Change-Id: I6f40ba824426f0acec73e50cdc9984c05a44bf91
Reviewed-by: Assam Boudjelthia <[email protected]>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quickcontrols/qquickapplicationwindow/tst_qquickapplicationwindow.cpp | 21 |
1 files changed, 4 insertions, 17 deletions
diff --git a/tests/auto/quickcontrols/qquickapplicationwindow/tst_qquickapplicationwindow.cpp b/tests/auto/quickcontrols/qquickapplicationwindow/tst_qquickapplicationwindow.cpp index 0434e5c83e..531e1e5ac4 100644 --- a/tests/auto/quickcontrols/qquickapplicationwindow/tst_qquickapplicationwindow.cpp +++ b/tests/auto/quickcontrols/qquickapplicationwindow/tst_qquickapplicationwindow.cpp @@ -241,19 +241,6 @@ void tst_QQuickApplicationWindow::defaultFocus() QVERIFY_ACTIVE_FOCUS(item); } -static QSizeF getExpectedElementSize() -{ -#ifndef Q_OS_ANDROID - // These values are taken from the QML file. - return QSizeF(400.0, 400.0); -#else - // On Android we have to query screen parameters at runtime, because on - // Android the Quick element will take the whole screen size. - const QSize size = QGuiApplication::primaryScreen()->availableSize(); - return QSizeF(size); -#endif -} - void tst_QQuickApplicationWindow::implicitFill() { QQmlEngine engine; @@ -263,7 +250,7 @@ void tst_QQuickApplicationWindow::implicitFill() QScopedPointer<QObject> cleanup(created); QVERIFY(created); - QQuickWindow* window = qobject_cast<QQuickWindow*>(created); + QQuickApplicationWindow* window = qobject_cast<QQuickApplicationWindow*>(created); QVERIFY(window); QVERIFY(!window->isVisible()); QCOMPARE(window->width(), 400); @@ -273,7 +260,7 @@ void tst_QQuickApplicationWindow::implicitFill() window->requestActivate(); QVERIFY(QTest::qWaitForWindowActive(window)); - const QSizeF expectedSize = getExpectedElementSize(); + const QSizeF expectedSize = window->contentItem()->size(); QQuickItem *stackView = window->property("stackView").value<QQuickItem*>(); QVERIFY(stackView); @@ -521,7 +508,7 @@ void tst_QQuickApplicationWindow::font() QFont font = window->font(); - const QSizeF expectedSize = getExpectedElementSize(); + const QSizeF expectedSize = window->contentItem()->size(); QQuickControl *mainItem = window->property("mainItem").value<QQuickControl*>(); QVERIFY(mainItem); @@ -603,7 +590,7 @@ void tst_QQuickApplicationWindow::locale() QLocale l = window->locale(); - const QSizeF expectedSize = getExpectedElementSize(); + const QSizeF expectedSize = window->contentItem()->size(); QQuickControl *mainItem = window->property("mainItem").value<QQuickControl*>(); QVERIFY(mainItem); |