diff options
Diffstat (limited to 'tests/auto/quick/touchmouse/tst_touchmouse.cpp')
-rw-r--r-- | tests/auto/quick/touchmouse/tst_touchmouse.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/tests/auto/quick/touchmouse/tst_touchmouse.cpp b/tests/auto/quick/touchmouse/tst_touchmouse.cpp index 0d1256e368..501d996797 100644 --- a/tests/auto/quick/touchmouse/tst_touchmouse.cpp +++ b/tests/auto/quick/touchmouse/tst_touchmouse.cpp @@ -1,5 +1,5 @@ // Copyright (C) 2020 The Qt Company Ltd. -// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only #include <QtTest/QtTest> @@ -713,7 +713,7 @@ void tst_TouchMouse::touchButtonOnFlickable() QTRY_COMPARE(eventItem2->touchUngrabCount, 1); qCDebug(lcTests) << "expected delivered events: press(touch) move(touch)" << eventItem2->eventList; - QCOMPARE(eventItem2->eventList.size(), 2); + QCOMPARE(eventItem2->eventList.size(), 3); QCOMPARE(eventItem2->eventList.at(1).type, QEvent::TouchUpdate); QCOMPARE(grabMonitor.exclusiveGrabber, flickable); // both EventItem and Flickable handled the actual touch, so synth-mouse doesn't happen @@ -1440,6 +1440,7 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 QQuickView window; QVERIFY(QQuickTest::showView(window, testFileUrl("hoverMouseAreas.qml"))); QQuickItem *root = window.rootObject(); + auto deliveryAgent = QQuickWindowPrivate::get(&window)->deliveryAgentPrivate(); QQuickMouseArea *mouseArea1 = root->findChild<QQuickMouseArea*>("mouseArea1"); QVERIFY(mouseArea1 != nullptr); @@ -1449,11 +1450,11 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 QSignalSpy enterSpy1(mouseArea1, SIGNAL(entered())); QSignalSpy exitSpy1(mouseArea1, SIGNAL(exited())); - QSignalSpy clickSpy1(mouseArea1, SIGNAL(clicked(QQuickMouseEvent *))); + QSignalSpy clickSpy1(mouseArea1, SIGNAL(clicked(QQuickMouseEvent*))); QSignalSpy enterSpy2(mouseArea2, SIGNAL(entered())); QSignalSpy exitSpy2(mouseArea2, SIGNAL(exited())); - QSignalSpy clickSpy2(mouseArea2, SIGNAL(clicked(QQuickMouseEvent *))); + QSignalSpy clickSpy2(mouseArea2, SIGNAL(clicked(QQuickMouseEvent*))); QPoint p1(150, 150); QPoint p2(150, 250); @@ -1467,6 +1468,7 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 // ------------------------- Touch click on mouseArea1 QTest::touchEvent(&window, device).press(0, p1, &window); + deliveryAgent->flushFrameSynchronousEvents(&window); QCOMPARE(enterSpy1.size(), 1); QCOMPARE(enterSpy2.size(), 0); @@ -1475,37 +1477,42 @@ void tst_TouchMouse::hoverEnabled() // QTBUG-40856 QVERIFY(!mouseArea2->hovered()); QTest::touchEvent(&window, device).release(0, p1, &window); + deliveryAgent->flushFrameSynchronousEvents(&window); QVERIFY(clickSpy1.size() == 1); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); // ------------------------- Touch click on mouseArea2 QTest::touchEvent(&window, device).press(0, p2, &window); + deliveryAgent->flushFrameSynchronousEvents(&window); - QVERIFY(mouseArea1->hovered()); + QVERIFY(!mouseArea1->hovered()); QVERIFY(mouseArea2->hovered()); QVERIFY(mouseArea2->isPressed()); QCOMPARE(enterSpy1.size(), 1); QCOMPARE(enterSpy2.size(), 1); QTest::touchEvent(&window, device).release(0, p2, &window); + deliveryAgent->flushFrameSynchronousEvents(&window); QVERIFY(clickSpy2.size() == 1); - QVERIFY(mouseArea1->hovered()); + QVERIFY(!mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); - QCOMPARE(exitSpy1.size(), 0); + QCOMPARE(exitSpy1.size(), 1); QCOMPARE(exitSpy2.size(), 1); // ------------------------- Another touch click on mouseArea1 QTest::touchEvent(&window, device).press(0, p1, &window); + deliveryAgent->flushFrameSynchronousEvents(&window); - QCOMPARE(enterSpy1.size(), 1); + QCOMPARE(enterSpy1.size(), 2); QCOMPARE(enterSpy2.size(), 1); QVERIFY(mouseArea1->isPressed()); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea2->hovered()); QTest::touchEvent(&window, device).release(0, p1, &window); + deliveryAgent->flushFrameSynchronousEvents(&window); QCOMPARE(clickSpy1.size(), 2); QVERIFY(mouseArea1->hovered()); QVERIFY(!mouseArea1->isPressed()); |