Deliver events in qtestmouse
Not waiting until the QPA event queue is processed after handleMouseEvent() is wrong. Unlike the synchronous sendEvent() calls these tests most likely utilized earlier, many of the QWindowSystemInterace functions are asynchronous in the sense that they just queue the event, delivery will happen when the event dispatcher on the main thread gets there. Change-Id: I8197d2dc4805cda684a8279ceb8d4b317f19aba7 Reviewed-by: Michael Brasser <michael.brasser@nokia.com> Reviewed-by: Jason McDonald <jason.mcdonald@nokia.com>
This commit is contained in:
parent
02d75eaaf9
commit
268f41ec70
@ -70,6 +70,15 @@ namespace QTest
|
||||
{
|
||||
enum MouseAction { MousePress, MouseRelease, MouseClick, MouseDClick, MouseMove };
|
||||
|
||||
static void waitForEvents()
|
||||
{
|
||||
#ifdef Q_OS_MAC
|
||||
QTest::qWait(20);
|
||||
#else
|
||||
qApp->processEvents();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void mouseEvent(MouseAction action, QWindow *window, Qt::MouseButton button,
|
||||
Qt::KeyboardModifiers stateKey, QPoint pos, int delay=-1)
|
||||
{
|
||||
@ -119,15 +128,11 @@ namespace QTest
|
||||
case MouseMove:
|
||||
QWindowSystemInterface::handleMouseEvent(window,pos,window->mapToGlobal(pos),lastButton,stateKey);
|
||||
//QCursor::setPos(window->mapToGlobal(pos));
|
||||
#ifdef Q_OS_MAC
|
||||
QTest::qWait(20);
|
||||
#else
|
||||
qApp->processEvents();
|
||||
#endif
|
||||
return;
|
||||
break;
|
||||
default:
|
||||
QTEST_ASSERT(false);
|
||||
}
|
||||
waitForEvents();
|
||||
}
|
||||
|
||||
inline void mousePress(QWindow *window, Qt::MouseButton button, Qt::KeyboardModifiers stateKey = 0,
|
||||
|
Loading…
Reference in New Issue
Block a user