From ef3daddae1720956e746142ac7ee54a27b9299d7 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 28 Mar 2019 17:32:23 +0300 Subject: Use QPlatformTheme::TouchDoubleTapDistance for touch events ... and update the cached values on theme change. Modify tst_QWidget::touchEventSynthesizedMouseEvent() to avoid unexpected double click detection. Change-Id: I151c47e851ebba7550b1b09caca2781c28d7d3d9 Reviewed-by: Shawn Rutledge --- tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp') diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 3b9c9060fa..780cb01e40 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -10152,7 +10152,8 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() // We should see propagation of the TouchBegin into a MouseButtonPress TouchMouseWidget parent; TouchMouseWidget child(&parent); - child.move(5, 5); + const QPoint childPos(5, 5); + child.move(childPos); child.setAcceptMouse(false); parent.show(); QVERIFY(QTest::qWaitForWindowExposed(parent.windowHandle())); @@ -10161,13 +10162,14 @@ void tst_QWidget::touchEventSynthesizedMouseEvent() QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 0); - QTest::touchEvent(parent.window(), m_touchScreen).press(0, QPoint(10, 10), &child); + const QPoint touchPos(20, 20); + QTest::touchEvent(parent.window(), m_touchScreen).press(0, touchPos, &child); QCOMPARE(parent.m_touchEventCount, 0); QCOMPARE(parent.m_mouseEventCount, 1); - QCOMPARE(parent.m_lastMouseEventPos, QPointF(15, 15)); + QCOMPARE(parent.m_lastMouseEventPos, childPos + touchPos); QCOMPARE(child.m_touchEventCount, 0); QCOMPARE(child.m_mouseEventCount, 1); // Attempt at mouse event before propagation - QCOMPARE(child.m_lastMouseEventPos, QPointF(10, 10)); + QCOMPARE(child.m_lastMouseEventPos, touchPos); } } -- cgit v1.2.3