qtestmouse: do not qWait for mocked events on macOS
This logic initially was copied from QTest::mouse* widget overload (byd130382776
) which uses QCursor::setPos() to generate mouse move events via the windowing system. The QCursor API was later removed by1762bf3394
, but now the redundant qWait logic remained. Later this stray qWait was incorrectly moved to apply for all mouse event types (by268f41ec70
), when originally it was needed (arguably) only for mouse move events due to usage of QCursor. This patch also removes the waitForEvents() function as it is not a documented qtestlib API (in qtestlib only the documented functions should be considered public API, no matter what you can find in the header files). Removal does not affect binary compatibility as this is not an exported symbol. And if somebody has used this non public API, updating code is trivial. Change-Id: Id1dec10f5cf276cee1ac0e8c8f8ba2edc493b667 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
parent
2bb443557d
commit
75e583b3fc
@ -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
|
||||
*/
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user