Merge lp:~chris.gagnon/autopilot/add_press_duration_to_touch_devices into lp:autopilot
- add_press_duration_to_touch_devices
- Merge into trunk
Status: | Rejected | ||||
---|---|---|---|---|---|
Rejected by: | Leo Arias | ||||
Proposed branch: | lp:~chris.gagnon/autopilot/add_press_duration_to_touch_devices | ||||
Merge into: | lp:autopilot | ||||
Diff against target: |
214 lines (+133/-9) 3 files modified
autopilot/input/__init__.py (+4/-4) autopilot/input/_uinput.py (+4/-4) autopilot/tests/functional/test_input_stack.py (+125/-1) |
||||
To merge this branch: | bzr merge lp:~chris.gagnon/autopilot/add_press_duration_to_touch_devices | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Leo Arias (community) | Disapprove | ||
PS Jenkins bot | continuous-integration | Needs Fixing | |
Christopher Lee (community) | Needs Fixing | ||
Review via email:
|
Commit message
add press_duration to touch devices
Description of the change
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:459
http://
Executed test runs:
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:460
http://
Executed test runs:
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Christopher Lee (veebers) wrote : | # |
Failing tests here are Pinch Gesture which is a known issue.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:460
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Christopher Lee (veebers) wrote : | # |
These tests are failing:
- https:/
- https:/
(The other test fails on the mako are known and being fixed)
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Gagnon (chris.gagnon) wrote : | # |
It looks like my test are failing for the same reason the other tests are failing.
File "/usr/lib/
raise ProcessSearchEr
ProcessSearchError: Search criteria (pid = 3675, dbus bus = 'session', object path = '/com/canonical
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Gagnon (chris.gagnon) wrote : | # |
This works on my desktop and in my ubuntu-emulator.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:461
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:461
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
FAILURE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:462
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
FAILURE: http://
FAILURE: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Gagnon (chris.gagnon) wrote : | # |
My tests are passing here on mako
The failure was due to other tests outside the inputstack that failed
the otto tests failed because of otto
/var/log/
/var/log/
/var/log/
/var/log/
/var/log/
/var/log/
/var/log/
/var/log/
/var/log/
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:462
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:462
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Gagnon (chris.gagnon) wrote : | # |
My new test cases for press duration passed, however these unrelated tests failed
autopilot.
autopilot.
- 463. By Chris Gagnon
-
resync with trunk
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
PS Jenkins bot (ps-jenkins) wrote : | # |
FAILED: Continuous integration, rev:463
http://
Executed test runs:
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
FAILURE: http://
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Chris Gagnon (chris.gagnon) wrote : | # |
My new test cases for press duration passed
3 tests that are unrelated to my changes failed:
autopilot.
autopilot.
autopilot.
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Leo Arias (elopio) wrote : | # |
I copied this branch and finished with tests a little different. It's already merged in trunk.
Thanks Chris.
Unmerged revisions
- 463. By Chris Gagnon
-
resync with trunk
- 462. By Chris Gagnon
-
resync with trunk
- 461. By Chris Gagnon
-
fix extra_arg in desktop hint file
- 460. By Chris Gagnon
-
non-pep8 style changes for project, better names for tests
- 459. By Chris Gagnon
-
add press_duration to tap_object
- 458. By Chris Gagnon
-
add press_duration to touch devices
Preview Diff
1 | === modified file 'autopilot/input/__init__.py' |
2 | --- autopilot/input/__init__.py 2014-03-25 14:42:25 +0000 |
3 | +++ autopilot/input/__init__.py 2014-04-22 13:34:51 +0000 |
4 | @@ -440,11 +440,11 @@ |
5 | """ |
6 | raise NotImplementedError("You cannot use this class directly.") |
7 | |
8 | - def tap(self, x, y): |
9 | + def tap(self, x, y, press_duration=0.10): |
10 | """Click (or 'tap') at given x,y coordinates.""" |
11 | raise NotImplementedError("You cannot use this class directly.") |
12 | |
13 | - def tap_object(self, object): |
14 | + def tap_object(self, object, press_duration=0.10): |
15 | """Tap the center point of a given object. |
16 | |
17 | It does this by looking for several attributes, in order. The first |
18 | @@ -610,7 +610,7 @@ |
19 | if button != 1: |
20 | raise ValueError( |
21 | "Touch devices do not have button %d" % (button)) |
22 | - self._device.tap(self._x, self._y) |
23 | + self._device.tap(self._x, self._y, press_duration=press_duration) |
24 | |
25 | def move(self, x, y): |
26 | """Moves the pointer to the specified coordinates. |
27 | @@ -646,7 +646,7 @@ |
28 | """ |
29 | |
30 | self.move_to_object(object_proxy) |
31 | - self.click(button, press_duration) |
32 | + self.click(button, press_duration=press_duration) |
33 | |
34 | def move_to_object(self, object_proxy): |
35 | """Attempts to move the pointer to 'object_proxy's centre point. |
36 | |
37 | === modified file 'autopilot/input/_uinput.py' |
38 | --- autopilot/input/_uinput.py 2014-03-25 14:42:25 +0000 |
39 | +++ autopilot/input/_uinput.py 2014-04-22 13:34:51 +0000 |
40 | @@ -465,7 +465,7 @@ |
41 | def pressed(self): |
42 | return self._device.pressed |
43 | |
44 | - def tap(self, x, y): |
45 | + def tap(self, x, y, press_duration=0.10): |
46 | """Click (or 'tap') at given x and y coordinates. |
47 | |
48 | :raises RuntimeError: if the finger is already pressed. |
49 | @@ -474,10 +474,10 @@ |
50 | """ |
51 | _logger.debug("Tapping at: %d,%d", x, y) |
52 | self._device.finger_down(x, y) |
53 | - sleep(0.1) |
54 | + sleep(press_duration) |
55 | self._device.finger_up() |
56 | |
57 | - def tap_object(self, object_): |
58 | + def tap_object(self, object_, press_duration=0.10): |
59 | """Click (or 'tap') a given object. |
60 | |
61 | :raises RuntimeError: if the finger is already pressed. |
62 | @@ -488,7 +488,7 @@ |
63 | """ |
64 | _logger.debug("Tapping object: %r", object) |
65 | x, y = get_center_point(object_) |
66 | - self.tap(x, y) |
67 | + self.tap(x, y, press_duration=press_duration) |
68 | |
69 | def press(self, x, y): |
70 | """Press and hold a given object or at the given coordinates. |
71 | |
72 | === modified file 'autopilot/tests/functional/test_input_stack.py' |
73 | --- autopilot/tests/functional/test_input_stack.py 2014-04-08 00:04:17 +0000 |
74 | +++ autopilot/tests/functional/test_input_stack.py 2014-04-22 13:34:51 +0000 |
75 | @@ -22,7 +22,13 @@ |
76 | import os |
77 | from tempfile import mktemp |
78 | from testtools import TestCase, skipIf |
79 | -from testtools.matchers import IsInstance, Equals, raises |
80 | +from testtools.matchers import ( |
81 | + IsInstance, |
82 | + Equals, |
83 | + GreaterThan, |
84 | + LessThan, |
85 | + raises, |
86 | +) |
87 | from textwrap import dedent |
88 | from time import sleep |
89 | from unittest import SkipTest |
90 | @@ -506,6 +512,124 @@ |
91 | self.assertThat(p.y, Equals(123)) |
92 | |
93 | |
94 | +class PointerClickTests(AutopilotTestCase): |
95 | + |
96 | + if platform.model() == 'Desktop': |
97 | + scenarios = [('with mouse', dict(input_device_class=Mouse))] |
98 | + else: |
99 | + scenarios = [('with touch', dict(input_device_class=Touch))] |
100 | + |
101 | + test_qml = dedent("""\ |
102 | + import QtQuick 2.0 |
103 | + import Ubuntu.Components 0.1 |
104 | + |
105 | + Rectangle { |
106 | + id: rectangle |
107 | + width: 250 |
108 | + height: 250 |
109 | + |
110 | + property int milliseconds: 0 |
111 | + Column { |
112 | + spacing: 2 |
113 | + Rectangle { |
114 | + width: 50 |
115 | + height: 50 |
116 | + Timer { |
117 | + id: timer |
118 | + //interval seems to be about 10 msec |
119 | + interval: 1 |
120 | + running: false |
121 | + repeat: true |
122 | + onTriggered: timer.runtime() |
123 | + |
124 | + function runtime() { |
125 | + milliseconds = milliseconds+1 |
126 | + time.text = milliseconds |
127 | + } |
128 | + } |
129 | + |
130 | + Text { |
131 | + id: time |
132 | + objectName: "time" |
133 | + } |
134 | + |
135 | + } |
136 | + Rectangle { |
137 | + width: 50 |
138 | + height: 50 |
139 | + Button { |
140 | + id: clickMeButton |
141 | + objectName: "clickMeButton" |
142 | + text: "Click Me" |
143 | + |
144 | + onPressedChanged: { |
145 | + if (clickMeButton.pressed == true) { |
146 | + milliseconds = 0 |
147 | + timer.start() |
148 | + } |
149 | + if (clickMeButton.pressed == false) { |
150 | + timer.stop() |
151 | + } |
152 | + } |
153 | + } |
154 | + } |
155 | + } |
156 | + } |
157 | + """) |
158 | + |
159 | + def _start_qml_script(self, script_contents): |
160 | + """Launch a qml script.""" |
161 | + qml_path = mktemp(suffix='.qml') |
162 | + open(qml_path, 'w').write(script_contents) |
163 | + self.addCleanup(os.remove, qml_path) |
164 | + |
165 | + extra_args = '' |
166 | + |
167 | + if platform.model() != 'Desktop': |
168 | + # We need to add the desktop-file-hint |
169 | + desktop_file = self.useFixture( |
170 | + TempDesktopFile() |
171 | + ).get_desktop_file_path() |
172 | + extra_args = '--desktop_file_hint={}'.format(desktop_file) |
173 | + |
174 | + return self.launch_test_application( |
175 | + "qmlscene", |
176 | + "-qt=qt5", |
177 | + qml_path, |
178 | + extra_args, |
179 | + app_type='qt', |
180 | + ) |
181 | + |
182 | + def setUp(self): |
183 | + self.app = self._start_qml_script(self.test_qml) |
184 | + self.button = self.app.select_single( |
185 | + 'Button', |
186 | + objectName='clickMeButton', |
187 | + ) |
188 | + self.timer_text = self.app.wait_select_single( |
189 | + '*', |
190 | + objectName='time', |
191 | + ) |
192 | + |
193 | + super(PointerClickTests, self).setUp() |
194 | + |
195 | + @property |
196 | + def pointer(self): |
197 | + """ Return pointer """ |
198 | + return Pointer(self.input_device_class.create()) |
199 | + |
200 | + def test_press_duration_1_second(self): |
201 | + self.pointer.click_object(self.button, press_duration=1) |
202 | + # give a couple second for slow emulators to respond |
203 | + self.assertThat(int(self.timer_text.text), LessThan(400)) |
204 | + # verify it's much higher than the default time |
205 | + self.assertThat(int(self.timer_text.text), GreaterThan(98)) |
206 | + |
207 | + def test_press_duration_default_10_ms(self): |
208 | + self.pointer.click_object(self.button) |
209 | + self.assertThat(int(self.timer_text.text), LessThan(11)) |
210 | + |
211 | + |
212 | class InputStackCleanupTests(TestCase): |
213 | |
214 | def test_cleanup_called(self): |
FAILED: Continuous integration, rev:459 jenkins. qa.ubuntu. com/job/ autopilot- ci/611/ jenkins. qa.ubuntu. com/job/ autopilot- trusty- amd64-ci/ 337 jenkins. qa.ubuntu. com/job/ autopilot- trusty- amd64-ci/ 337/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ autopilot- trusty- armhf-ci/ 337/console jenkins. qa.ubuntu. com/job/ autopilot- trusty- i386-ci/ 246 jenkins. qa.ubuntu. com/job/ autopilot- trusty- i386-ci/ 246/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ generic- mediumtests- trusty- autopilot/ 63 jenkins. qa.ubuntu. com/job/ autopilot- testrunner- otto-trusty- autopilot/ 60 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/4229 jenkins. qa.ubuntu. com/job/ generic- mediumtests- builder- trusty- amd64/4229/ artifact/ work/output/ *zip*/output. zip
http://
Executed test runs:
SUCCESS: http://
deb: http://
FAILURE: http://
SUCCESS: http://
deb: http://
UNSTABLE: http://
UNSTABLE: http://
SUCCESS: http://
deb: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/autopilot- ci/611/ rebuild
http://