diff options
-rw-r--r-- | src/testlib/qtestcase.qdoc | 4 | ||||
-rw-r--r-- | src/testlib/qtestmouse.h | 18 |
2 files changed, 7 insertions, 15 deletions
diff --git a/src/testlib/qtestcase.qdoc b/src/testlib/qtestcase.qdoc index 5b90419e28..24bb1c3a97 100644 --- a/src/testlib/qtestcase.qdoc +++ b/src/testlib/qtestcase.qdoc @@ -1327,10 +1327,6 @@ // Internals of qtestmouse.h: -/*! \fn void QTest::waitForEvents() - \internal -*/ - /*! \fn void QTest::mouseEvent(MouseAction action, QWidget *widget, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1) \internal */ diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index 55f8baa003..fa524fd8ca 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -80,15 +80,13 @@ namespace QTest // to depend on platform themes. static const int mouseDoubleClickInterval = 500; - static void waitForEvents() - { -#ifdef Q_OS_MAC - QTest::qWait(20); -#else - qApp->processEvents(); -#endif - } +/*! \internal + This function mocks all mouse events by bypassing the windowing system. The + result is that the mouse events do not come from the system via Qt platform + plugins, but are created on the spot and immediately available for processing + by Qt. +*/ static void mouseEvent(MouseAction action, QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1) { @@ -144,13 +142,11 @@ namespace QTest case MouseMove: qt_handleMouseEvent(w, pos, global, lastMouseButton, Qt::NoButton, QEvent::MouseMove, stateKey, ++lastMouseTimestamp); - // No QCursor::setPos() call here. That could potentially result in mouse events sent by the windowing system - // which is highly undesired here. Tests must avoid relying on QCursor. break; default: QTEST_ASSERT(false); } - waitForEvents(); + qApp->processEvents(); } inline void mousePress(QWindow *window, Qt::MouseButton button, |