on xenial help sign in
Fix Gestures tests on Qt >= 5.9
4dd4d1eIvan Semkin
tests/plugins/Ubuntu/CMakeLists.txt+1−1
@@ -1 +1 @@
1−#add_subdirectory(Gestures) #FIXME broken with qt 5.9
1+add_subdirectory(Gestures)
tests/plugins/Ubuntu/Gestures/GestureTest.cpp+10−1
@@ -17,6 +17,7 @@
17#include "GestureTest.h"
17#include "GestureTest.h"
18
18
19#include <qpa/qwindowsysteminterface.h>
19#include <qpa/qwindowsysteminterface.h>
20+#include <private/qquickanimatorcontroller_p.h>
20#include <private/qquickwindow_p.h>
21#include <private/qquickwindow_p.h>
21#include <QQmlEngine>
22#include <QQmlEngine>
22#include <QQuickView>
23#include <QQuickView>
@@ -108,7 +109,15 @@ void GestureTest::sendTouch(qint64 timestamp, int id, QPointF pos,
108 QCoreApplication::sendEvent(m_view, &touchEvent);
109 QCoreApplication::sendEvent(m_view, &touchEvent);
109
110
110 QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(m_view);
111 QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(m_view);
111− windowPrivate->flushDelayedTouchEvent();
112+ if (windowPrivate->delayedTouch) {
113+ windowPrivate->deliverDelayedTouchEvent();
114+
115+ // Touch events which constantly start animations (such as a behavior tracking
116+ // the mouse point) need animations to start.
117+ QQmlAnimationTimer *ut = QQmlAnimationTimer::instance();
118+ if (ut && ut->hasStartAnimationPending())
119+ ut->startAnimations();
120+ }
112}
121}
113
122
114void GestureTest::passTime(qint64 timeSpanMs)
123void GestureTest::passTime(qint64 timeSpanMs)
tests/plugins/Ubuntu/Gestures/tst_TouchGate.cpp+10−1
@@ -19,6 +19,7 @@
19#include <QQmlEngine>
19#include <QQmlEngine>
20#include <QQuickView>
20#include <QQuickView>
21#include <QSharedPointer>
21#include <QSharedPointer>
22+#include <private/qquickanimatorcontroller_p.h>
22#include <private/qquickwindow_p.h>
23#include <private/qquickwindow_p.h>
23
24
24// C++ std lib
25// C++ std lib
@@ -191,7 +192,15 @@ void tst_TouchGate::holdsEventsUntilGainsOwnership()
191 if (!ownershipAfterTouchEnd) {
192 if (!ownershipAfterTouchEnd) {
192 touchRegistry->removeCandidateOwnerForTouch(0, candidateItem);
193 touchRegistry->removeCandidateOwnerForTouch(0, candidateItem);
193 QQuickWindowPrivate *wp = QQuickWindowPrivate::get(testItem->window());
194 QQuickWindowPrivate *wp = QQuickWindowPrivate::get(testItem->window());
194− wp->flushDelayedTouchEvent();
195+ if (wp->delayedTouch) {
196+ wp->deliverDelayedTouchEvent();
197+
198+ // Touch events which constantly start animations (such as a behavior tracking
199+ // the mouse point) need animations to start.
200+ QQmlAnimationTimer *ut = QQmlAnimationTimer::instance();
201+ if (ut && ut->hasStartAnimationPending())
202+ ut->startAnimations();
203+ }
195 // TouchGate should now open its flood gates and let testItem get all
204 // TouchGate should now open its flood gates and let testItem get all
196 // events from touch 0 produced so far
205 // events from touch 0 produced so far
197 QCOMPARE(testItem->touchEventsReceived.count(), 2);
206 QCOMPARE(testItem->touchEventsReceived.count(), 2);