From 6ff8306403eee1a7f2e684d9b704d4158d4dc6e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 12 Feb 2024 11:33:10 +0100 Subject: [PATCH] tst_QWidgetRepaintManager::staticContents: Trigger resize via QWindow QWidgetPrivate::setGeometry_sys wrongly triggers full update, which is why the test was QEXPECT_FAIL, even on Windows, which does implement static contents. We can test the behavior without involving the broken QWidget behavior by resizing the QWindow instead, which triggers a resize of the platform window and will be fed back through QWSI, similar to when the user resizes the window via the window frame. The QEXPECT_FAIL message for the QWidget resize has been updated to reflect why it's expected to fail. tst_QWidget::optimizedResize_topLevel() has similar issues to this test, and solves it by using Window specific platform code. For now this test has been left alone, as there are a lot more going on in that test in terms of workarounds and blacklistings, so it needs further investigations. Change-Id: I28a55c0723b3e7f16b362d1ebc369e038d5a7ac4 Reviewed-by: Axel Spoerl (cherry picked from commit ea0cf4a9a2535110d6cf325e75537b4618a7374f) Reviewed-by: Qt Cherry-pick Bot --- .../tst_qwidgetrepaintmanager.cpp | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp b/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp index 57bbd09d5bc..68449e1dc77 100644 --- a/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp +++ b/tests/auto/widgets/kernel/qwidgetrepaintmanager/tst_qwidgetrepaintmanager.cpp @@ -433,12 +433,18 @@ void tst_QWidgetRepaintManager::staticContents() widget.setAttribute(Qt::WA_StaticContents); widget.initialShow(); - const QSize oldSize = widget.size(); - - widget.resize(widget.width() + 10, widget.height()); - + // Trigger resize via QWindow (similar to QWSI code path) + QVERIFY(widget.windowHandle()); + QSize oldSize = widget.size(); + widget.windowHandle()->resize(widget.width(), widget.height() + 10); QVERIFY(widget.waitForPainted()); - QEXPECT_FAIL("", "This should just repaint the newly exposed region", Continue); + QCOMPARE(widget.takePaintedRegions(), QRegion(0, oldSize.width(), widget.width(), 10)); + + // Trigger resize via QWidget + oldSize = widget.size(); + widget.resize(widget.width() + 10, widget.height()); + QVERIFY(widget.waitForPainted()); + QEXPECT_FAIL("", "QWidgetPrivate::setGeometry_sys wrongly triggers full update", Continue); QCOMPARE(widget.takePaintedRegions(), QRegion(oldSize.width(), 0, 10, widget.height())); }