on xenial help sign in
Fix Components tst_DragHandle test on Qt >= 5.9
commit19a1e9b42ac6895c0619ca8760eeca15ed3e541d authorIvan Semkin <ivan@semkin.ru> dateSat 23 Jun 2018, 18:58 (8 years ago) parent4940bc8
2 files changed+20−3
tests/qmltests/CMakeLists.txt+1−1 tests/qmltests/Components/tst_DragHandle.cpp+19−2
tests/qmltests/CMakeLists.txt+1−1
@@ -1,5 +1,5 @@
11
2−#add_subdirectory(Components) #FIXME broken with qt 5.9
2+add_subdirectory(Components)
33
44add_unity8_qmltest(. OrientedShell)
55add_unity8_qmltest(. DisabledScreenNotice)
tests/qmltests/Components/tst_DragHandle.cpp+19−2
@@ -20,6 +20,7 @@
2020#include <qpa/qwindowsysteminterface.h>
2121#include <QtQuick/QQuickView>
2222#include <QtQml/QQmlEngine>
23+#include <private/qquickanimatorcontroller_p.h>
2324#include <private/qquickwindow_p.h>
2425#include <UbuntuGestures/private/ucswipearea_p_p.h>
2526
@@ -179,7 +180,15 @@ void tst_DragHandle::flickAndHold(QQuickItem *dragHandle,
179180 QTest::touchEvent(m_view, m_device).release(0, touchPoint.toPoint());
180181
181182 QQuickWindowPrivate *windowPrivate = QQuickWindowPrivate::get(m_view);
182− windowPrivate->flushDelayedTouchEvent();
183+ if (windowPrivate->delayedTouch) {
184+ windowPrivate->deliverDelayedTouchEvent();
185+
186+ // Touch events which constantly start animations (such as a behavior tracking
187+ // the mouse point) need animations to start.
188+ QQmlAnimationTimer *ut = QQmlAnimationTimer::instance();
189+ if (ut && ut->hasStartAnimationPending())
190+ ut->startAnimations();
191+ }
183192}
184193
185194void tst_DragHandle::drag(QPointF &touchPoint, const QPointF& direction, qreal distance,
@@ -194,7 +203,15 @@ void tst_DragHandle::drag(QPointF &touchPoint, const QPointF& direction, qreal d
194203 m_fakeTimeSource->m_msecsSinceReference += timeStep;
195204 QTest::touchEvent(m_view, m_device).move(0, touchPoint.toPoint());
196205
197− windowPrivate->flushDelayedTouchEvent();
206+ if (windowPrivate->delayedTouch) {
207+ windowPrivate->deliverDelayedTouchEvent();
208+
209+ // Touch events which constantly start animations (such as a behavior tracking
210+ // the mouse point) need animations to start.
211+ QQmlAnimationTimer *ut = QQmlAnimationTimer::instance();
212+ if (ut && ut->hasStartAnimationPending())
213+ ut->startAnimations();
214+ }
198215 }
199216}
200217