Fix flaky tst_QScroller::overshoot on multiple Windows versions

tst_QScroller::overshoot is flaky on multiple versions of Windows 11.
The failure occurs in the part testing overshoot always off and slow,
where the result of the deltaPos and the startPos are equal to 0
instead of being smaller.

Slightly increase the value of touchEnd so that deltaPos is smaller.
As a drive-by, constify a local variable.

Fix the flakiness on Windows 11 24h2 mingw.

Fixes: QTBUG-137201
Change-Id: I6dacc7b5ac140f427fa6fbb8fddb5447ae14a233
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
This commit is contained in:
Frédéric Lefebvre 2025-05-27 12:45:22 +02:00 committed by Axel Spoerl
parent c29868830c
commit f6126ccb1c

View File

@ -482,12 +482,12 @@ void tst_QScroller::overshoot()
sp1.setScrollMetric(QScrollerProperties::HorizontalOvershootPolicy, QVariant::fromValue(QScrollerProperties::OvershootAlwaysOff));
s1->setScrollerProperties(sp1);
kineticScrollNoTest(sw.data(), QPointF(500, 500), QPoint(0, 0), QPoint(200, 0), QPoint(215, 0));
kineticScrollNoTest(sw.data(), QPointF(500, 500), QPoint(0, 0), QPoint(200, 0), QPoint(250, 0));
// Check that segment parameters are consistent
QScrollerPrivate* priv = s1->d_func();
QVERIFY(priv->xSegments.size() == 1);
auto& segment = priv->xSegments.head();
const auto& segment = priv->xSegments.head();
QCOMPARE_LT(segment.startPos + segment.deltaPos, segment.stopPos);
QTRY_COMPARE(s1->state(), QScroller::Inactive);