on xenial help sign in
Make the dragged distance be a multiple of the dragged area

This is a workaround for a bug in if the last remaining bit of dragging is just 1 pixel to the left of one of the multiples the drag seems to go back I've traced this as far as the bug seems to be in /dev/uinput or the input layer in mir so filed a bug for it and workarounding it here for the test

commitabff1489c5c30dfa8c3d2d32c4184c7a391b2aa5 authorAlbert Astals <albert.astals@canonical.com> dateFri 5 Dec 2014, 16:44 (12 years ago) parent933ab1b
2 files changed+12−10
qml/Dash/DashContent.qml−4 tests/autopilot/unity8/shell/emulators/dash.py+12−6
qml/Dash/DashContent.qml−4
@@ -118,10 +118,6 @@ Item {
118118 cacheBuffer: 1073741823
119119 onMovementStarted: currentItem.item.showHeader();
120120 clip: parent.x != 0
121− onDraggingChanged: console.log("dragging", dragging);
122− onMovingChanged: console.log("moving", moving);
123− onContentXChanged: console.log("contentX", contentX);
124− onCurrentIndexChanged: console.log("currentIndex", currentIndex);
125121
126122 // TODO QTBUG-40846 and QTBUG-40848
127123 // The remove transition doesn't happen when removing the last item
tests/autopilot/unity8/shell/emulators/dash.py+12−6
@@ -129,10 +129,13 @@ class Dash(emulators.UnityEmulatorBase):
129129 original_index = self.dash_content_list.currentIndex
130130 dash_content = self.select_single(objectName="dashContent")
131131 x, y, width, height = dash_content.globalRect
132− start_x = x + width / 5
133− stop_x = x + width / 5 * 4
132+ rate = 10
133+ divisions = 5
134+ jump = ( width / divisions ) // rate * rate
135+ start_x = x + jump
136+ stop_x = x + jump * (divisions - 1)
134137 start_y = stop_y = y + 1
135− self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
138+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate)
136139 self.dash_content_list.currentIndex.wait_for(original_index - 1)
137140
138141 @autopilot_logging.log_action(logger.info)
@@ -140,10 +143,13 @@ class Dash(emulators.UnityEmulatorBase):
140143 original_index = self.dash_content_list.currentIndex
141144 dash_content = self.select_single(objectName="dashContent")
142145 x, y, width, height = dash_content.globalRect
143− start_x = x + width / 5 * 4
144− stop_x = x + width / 5
146+ rate = 10
147+ divisions = 5
148+ jump = ( width / divisions ) // rate * rate
149+ start_x = x + jump * (divisions - 1)
150+ stop_x = x + jump
145151 start_y = stop_y = y + 1
146− self.pointing_device.drag(start_x, start_y, stop_x, stop_y)
152+ self.pointing_device.drag(start_x, start_y, stop_x, stop_y, rate)
147153 self.dash_content_list.currentIndex.wait_for(original_index + 1)
148154
149155 def enter_search_query(self, query):