on xenial help sign in
Make testDragHandle pass again

The swipeArea internals changed yet again on the SDK

commit3c93564af2e9b223c951c96bdfc0e2c57b564116 authorAlbert Astals Cid <albert.astals@canonical.com> dateThu 14 Jan 2016, 11:45 (11 years ago) parent2d33181
3 files changed+8−6
debian/control+1 tests/qmltests/Components/CMakeLists.txt+1 tests/qmltests/Components/tst_DragHandle.cpp+6−6
debian/control+1
@@ -29,6 +29,7 @@ Build-Depends: cmake,
2929 libqt5xmlpatterns5-dev,
3030 libsystemsettings-dev,
3131 libubuntugestures5-dev,
32+ libubuntugestures5-private-dev,
3233 libudev-dev,
3334 libunity-api-dev (>= 7.105),
3435 libusermetricsoutput1-dev,
tests/qmltests/Components/CMakeLists.txt+1
@@ -10,6 +10,7 @@ include_directories(
1010 ${CMAKE_CURRENT_BINARY_DIR}
1111 ${Qt5Gui_PRIVATE_INCLUDE_DIRS}
1212 ${Qt5Quick_PRIVATE_INCLUDE_DIRS}
13+ ${UBUNTUGESTURES_INCLUDEDIR}/UbuntuGestures/${UBUNTUGESTURES_VERSION}
1314 )
1415
1516add_executable(DragHandleTestExec tst_DragHandle.cpp)
tests/qmltests/Components/tst_DragHandle.cpp+6−6
@@ -21,6 +21,7 @@
2121#include <QtQuick/QQuickView>
2222#include <QtQml/QQmlEngine>
2323#include <private/qquickwindow_p.h>
24+#include <UbuntuGestures/private/ucswipearea_p_p.h>
2425
2526#include <AxisVelocityCalculator.h>
2627#include <Timer>
@@ -200,12 +201,11 @@ QQuickItem *tst_DragHandle::fetchAndSetupDragHandle(const char *objectName)
200201 QQuickItem *dragHandle =
201202 m_view->rootObject()->findChild<QQuickItem*>(objectName);
202203 Q_ASSERT(dragHandle != 0);
203− auto children = dragHandle->findChildren<QObject*>();
204− Q_FOREACH(QObject *child, children) {
205− if (child->metaObject()->className() == QByteArray("UCSwipeAreaPrivate")) {
206− QMetaObject::invokeMethod(child, "setRecognitionTimer", Q_ARG(UbuntuGestures::AbstractTimer*, m_fakeTimer));
207− QMetaObject::invokeMethod(child, "setTimeSource", Q_ARG(UbuntuGestures::SharedTimeSource, m_fakeTimeSource));
208− }
204+ UCSwipeArea *swipeArea = dynamic_cast<UCSwipeArea*>(dragHandle);
205+ if (swipeArea) {
206+ UCSwipeAreaPrivate *swipeAreaPrivate = dynamic_cast<UCSwipeAreaPrivate *>(QQuickItemPrivate::get(swipeArea));
207+ swipeAreaPrivate->setRecognitionTimer(m_fakeTimer);
208+ swipeAreaPrivate->setTimeSource(m_fakeTimeSource);
209209 }
210210
211211 AxisVelocityCalculator *edgeDragEvaluator =