From cac8a85c1c4aa77c70ec14cf4323fcf4e2c81f45 Mon Sep 17 00:00:00 2001 From: SanthoshKumar Selvaraj Date: Tue, 15 Sep 2026 17:31:51 +0200 Subject: 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 --- tests/auto/quickcontrols/cursor/tst_cursor.cpp | 4 ++-- 1 file 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); -- cgit v1.2.3