aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/shared
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-07-06 14:51:52 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2017-07-21 07:34:50 +0000
commitfe99ec537d0d247f8a4150341a25a54ec89353ef (patch)
tree379f8e11fd35c6ddc62e05b885ae508b6302d348 /tests/auto/shared
parentef63be14186607c2b806f45d257d8aba6e9a6472 (diff)
Auto tests: incorporate the QEvent::Leave trick to moveMouseAway()
6f1eba89 used QEvent::Leave to make QQuickWindow clear its last known mouse position, which ensures that QQuickWindow won't send unexpected hover events from flushFrameSynchronousEvents(). The same hover events are causing trouble in tst_qquickmenubar too, so incorporate the leave event trick to moveMouseAway() to benefit from it in other tests too. Change-Id: I25a285d008d1cb639c7be09d714e482d472b4e50 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto/shared')
-rw-r--r--tests/auto/shared/visualtestutil.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/tests/auto/shared/visualtestutil.cpp b/tests/auto/shared/visualtestutil.cpp
index 5e44f5e7..47cfd74f 100644
--- a/tests/auto/shared/visualtestutil.cpp
+++ b/tests/auto/shared/visualtestutil.cpp
@@ -39,6 +39,7 @@
#include <QtQuick/QQuickItem>
#include <QtCore/QDebug>
#include <QtGui/QCursor>
+#include <QtCore/QCoreApplication>
bool QQuickVisualTestUtil::delegateVisible(QQuickItem *item)
{
@@ -74,7 +75,10 @@ void QQuickVisualTestUtil::moveMouseAway(QQuickWindow *window)
{
#if QT_CONFIG(cursor) // Get the cursor out of the way.
QCursor::setPos(window->geometry().topRight() + QPoint(100, 100));
-#else
- Q_UNUSED(window)
#endif
+
+ // make sure hover events from QQuickWindowPrivate::flushFrameSynchronousEvents()
+ // do not interfere with the tests
+ QEvent leave(QEvent::Leave);
+ QCoreApplication::sendEvent(window, &leave);
}