diff options
| author | SanthoshKumar Selvaraj <santhosh.kumar.selvaraj@qt.io> | 2026-09-15 17:31:51 +0200 |
|---|---|---|
| committer | SanthoshKumar Selvaraj <santhosh.kumar.selvaraj@qt.io> | 2026-10-01 19:52:54 +0000 |
| commit | cac8a85c1c4aa77c70ec14cf4323fcf4e2c81f45 (patch) | |
| tree | bac4d0d5fdfa4b0e9615b04c615e76b2c89752bc | |
| parent | 31d3946adb7ed34bf89eaf0843ceef00c7ad71f5 (diff) | |
ohos: Avoid mouse move exactly on item edge in tst_cursor
controls() and pageIndicator() moved the mouse to the exact (0, 0)
edge of the control under test. QQuickItem::contains() treats bounds
as (x >= 0 && x < width), so a position of QPoint(0, 0) has no margin
for error.
On platforms with a non-integer device pixel ratio (e.g. OHOS, DPR 1.9)
such a position is not delivered exactly. QTest::mouseMove() passes
device-independent coordinates, qt_handleMouseEvent() converts them to
native coordinates, and QWindowSystemInterface::handleMouseEvent()
converts them back by multiplying with scale factor (1/sf). For this
scale factor that round trip is not an exact inverse, so a move
requested at exactly (0, 0) can be delivered a fraction outside the
item.
Move the probe points from (0, 0) to (1, 1), so that the mouse
position lands on the control regardless of the sub-pixel rounding
error.
Fixes: QTBUG-150331
Pick-to: 6.12
Change-Id: I43e15558dc18636f60dd7a70a062c60a3fc17dd4
Reviewed-by: Liang Qi <liang.qi@qt.io>
| -rw-r--r-- | tests/auto/quickcontrols/cursor/tst_cursor.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/auto/quickcontrols/cursor/tst_cursor.cpp b/tests/auto/quickcontrols/cursor/tst_cursor.cpp index 5f900e7ce0..ac8a82bd5e 100644 --- a/tests/auto/quickcontrols/cursor/tst_cursor.cpp +++ b/tests/auto/quickcontrols/cursor/tst_cursor.cpp @@ -86,7 +86,7 @@ void tst_cursor::controls() QTest::mouseMove(&view, control->mapToScene(QPointF(-1, -1)).toPoint()); QCOMPARE(view.cursor().shape(), Qt::ForbiddenCursor); - QTest::mouseMove(&view, control->mapToScene(QPointF(0, 0)).toPoint()); + QTest::mouseMove(&view, control->mapToScene(QPointF(1, 1)).toPoint()); #ifndef Q_OS_WEBOS //webOS cursor handling uses BitmapCursor for ArrowCursor QCOMPARE(view.cursor().shape(), Qt::ArrowCursor); @@ -152,7 +152,7 @@ void tst_cursor::pageIndicator() QTest::mouseMove(&view, indicator->mapToScene(QPointF(-1, -1)).toPoint()); QCOMPARE(view.cursor().shape(), Qt::ForbiddenCursor); - QTest::mouseMove(&view, indicator->mapToScene(QPointF(0, 0)).toPoint()); + QTest::mouseMove(&view, indicator->mapToScene(QPointF(1, 1)).toPoint()); QCOMPARE(view.cursor().shape(), Qt::ForbiddenCursor); indicator->setInteractive(true); |
