diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2012-11-07 16:23:32 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-10 20:08:28 +0100 |
commit | 2d07d3b4e3036179667a822aa40285d071b76b9e (patch) | |
tree | 715e5c6a92426f1ac1cd4cd585e02cf8cab05002 /tests/auto/widgets | |
parent | 1fe0c2c25dc96e9af6f442cf059ad627d45f10fa (diff) |
Add a QEnterEvent containing the mouse position.
Enter handling requires knowledge of the mouse
position. Extend the enter handling of
QWindowSystemInterface to receive the position
(implemented for Windows, XCB and Mac), passing it
on to QEnterEvent. Dispatch QEnterEvent from
widgets code.
Change-Id: I49c07d2b1f46310c877017dd55d4cd7d636bdbce
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@digia.com>
Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
Diffstat (limited to 'tests/auto/widgets')
-rw-r--r-- | tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 7de3f8aced..a70129c5f7 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -5407,6 +5407,7 @@ void tst_QWidget::setToolTip() // Mouse over doesn't work on Windows mobile, so skip the rest of the test for that platform. #ifndef Q_OS_WINCE_WM for (int pass = 0; pass < 2; ++pass) { + QCursor::setPos(0, 0); QScopedPointer<QWidget> popup(new QWidget(0, Qt::Popup)); popup->setObjectName(QString::fromLatin1("tst_qwidget setToolTip #%1").arg(pass)); popup->setWindowTitle(popup->objectName()); @@ -5421,17 +5422,16 @@ void tst_QWidget::setToolTip() popup->setToolTip(QLatin1String("TOOLTIP POPUP")); popup->show(); QVERIFY(QTest::qWaitForWindowExposed(popup.data())); + QWindow *popupWindow = popup->windowHandle(); QTest::qWait(10); - QTest::mouseMove(frame); + QTest::mouseMove(popupWindow, QPoint(25, 25)); QTest::qWait(900); // delay is 700 - if (m_platform == QStringLiteral("xcb")) - QSKIP("QTBUG-26424"); QCOMPARE(spy1.count(), 1); QCOMPARE(spy2.count(), 0); if (pass == 0) QTest::qWait(2200); // delay is 2000 - QTest::mouseMove(popup.data()); + QTest::mouseMove(popupWindow); } #endif } @@ -9635,7 +9635,7 @@ void tst_QWidget::underMouse() // Enter window, outside children // Note: QTest::mouseMove will not generate enter events for windows, so send one explicitly - QWindowSystemInterface::handleEnterEvent(window); + QWindowSystemInterface::handleEnterEvent(window, inWindowPoint, window->mapToGlobal(inWindowPoint)); QTest::mouseMove(window, inWindowPoint); QVERIFY(topLevelWidget.underMouse()); QVERIFY(!childWidget1.underMouse()); @@ -9754,7 +9754,7 @@ void tst_QWidget::underMouse() childWidget1.resetCounts(); // Mouse enters back in, should cause enter to topLevelWidget - QWindowSystemInterface::handleEnterEvent(window); + QWindowSystemInterface::handleEnterEvent(window, inWindowPoint, window->mapToGlobal(inWindowPoint)); QApplication::processEvents(); QVERIFY(!topLevelWidget.underMouse()); QVERIFY(!childWidget1.underMouse()); @@ -9788,7 +9788,8 @@ void tst_QWidget::underMouse() // Mouse enters popup, should cause enter to popup and leave to current widgets under mouse QWindowSystemInterface::handleLeaveEvent(window); - QWindowSystemInterface::handleEnterEvent(popupWindow); + const QPoint popupCenter = popupWindow->geometry().center(); + QWindowSystemInterface::handleEnterEvent(popupWindow, popupWindow->mapFromGlobal(popupCenter), popupCenter); QApplication::processEvents(); QVERIFY(!topLevelWidget.underMouse()); QVERIFY(!childWidget1.underMouse()); @@ -9823,7 +9824,7 @@ void tst_QWidget::underMouse() // Mouse leaves popup and enters topLevelWidget, should cause enter to topLevelWidget and leave for popup QWindowSystemInterface::handleLeaveEvent(popupWindow); - QWindowSystemInterface::handleEnterEvent(window); + QWindowSystemInterface::handleEnterEvent(window, inWindowPoint, window->mapToGlobal(inWindowPoint)); QApplication::processEvents(); QVERIFY(!topLevelWidget.underMouse()); QVERIFY(!childWidget1.underMouse()); @@ -9876,7 +9877,7 @@ public slots: QPoint point2(15, 20); QPoint point3(20, 20); QWindow *window = modal->windowHandle(); - QWindowSystemInterface::handleEnterEvent(window); + QWindowSystemInterface::handleEnterEvent(window, point1, window->mapToGlobal(point1)); QTest::mouseMove(window, point1); QTest::mouseMove(window, point2); QTest::mouseMove(window, point3); @@ -9922,7 +9923,7 @@ void tst_QWidget::taskQTBUG_27643_enterEvents() QWindow *window = dialog.windowHandle(); QPoint overButton(25, 25); - QWindowSystemInterface::handleEnterEvent(window); + QWindowSystemInterface::handleEnterEvent(window, overButton, window->mapToGlobal(overButton)); QTest::mouseMove(window, overButton); QTest::mouseClick(window, Qt::LeftButton, 0, overButton, 0); |