tst_QWidget: account for resize event after receiving safe margins

The top level widget in the test might be too big in some Android
devices and ends up overlapping the system areas, it would then
receive a non-null safe margins and then a resize event, so the
test needs to account for that case.

Pick-to: 6.10 6.9
Fixes: QTBUG-140192
Change-Id: Iff7194e48cc000cc0a37b66f8ac219f54a87d6db
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Assam Boudjelthia 2025-09-17 12:54:15 +03:00
parent b4c59c7d49
commit 73e13a88f7
1 changed files with 6 additions and 1 deletions

View File

@ -3445,7 +3445,12 @@ void tst_QWidget::resizeEvent()
QCOMPARE (wTopLevel.m_resizeEventCount, 1); QCOMPARE (wTopLevel.m_resizeEventCount, 1);
QTestPrivate::androidCompatibleShow(&wTopLevel); QTestPrivate::androidCompatibleShow(&wTopLevel);
QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel)); QVERIFY(QTest::qWaitForWindowExposed(&wTopLevel));
QCOMPARE (wTopLevel.m_resizeEventCount, 2); // The top level widget can receive new margins after show
// if the size is big enough to end up overlapping safe areas.
int safeMarginsResizeCount = 0;
if (!wTopLevel.windowHandle()->safeAreaMargins().isNull())
safeMarginsResizeCount = 1;
QCOMPARE (wTopLevel.m_resizeEventCount, 2 + safeMarginsResizeCount);
} }
} }