Merge lp:~cr3/checkbox/touchpad_scroll_resource_deprecate into lp:checkbox
- touchpad_scroll_resource_deprecate
- Merge into trunk
Status: | Merged |
---|---|
Merged at revision: | 1791 |
Proposed branch: | lp:~cr3/checkbox/touchpad_scroll_resource_deprecate |
Merge into: | lp:checkbox |
Diff against target: |
252 lines (+32/-86) 8 files modified
checkbox/parsers/tests/test_xinput.py (+2/-2) checkbox/parsers/xinput.py (+2/-2) data/whitelists/default.whitelist (+1/-1) debian/changelog (+2/-0) jobs/resource.txt.in (+4/-4) jobs/touchpad.txt.in (+15/-4) jobs/touchscreen.txt.in (+6/-2) scripts/touchpad_scroll_resource (+0/-71) |
To merge this branch: | bzr merge lp:~cr3/checkbox/touchpad_scroll_resource_deprecate |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jeff Marcom (community) | Approve | ||
Marc Tardif (community) | Needs Resubmitting | ||
Review via email: mp+130607@code.launchpad.net |
Commit message
Merged fix to touchpad scroll tests and replacement of touchpad_
Description of the change
This merge request fixes a problem noticed by spideyman where the scroll tests prompt the user on an all-in-one system. While fixing this problem, I took the opportunity to replace the touchpad_
- 1786. By Marc Tardif
-
Fixed strings in touchpad/vertical requires line.
- 1787. By Marc Tardif
-
Added requires line to touchpad/
multitouch- automated.
Marc Tardif (cr3) wrote : | # |
For 1, you're absolutely right, fixed!
For 2, I left that out on purpose because it would automatically report fail if there was no touchpad. However, it would probably make more sense for that test to report unsupported. Also fixed.
Jeff Marcom (jeffmarcom) wrote : | # |
> For 1, you're absolutely right, fixed!
>
> For 2, I left that out on purpose because it would automatically report fail
> if there was no touchpad. However, it would probably make more sense for that
> test to report unsupported. Also fixed.
Thanks, and for 2 I agree. I would rather see it say unsupported for both single and multi. It shouldn't fail if it doesn't meet the criteria for one or the other. I realize my initial request did not recover this, and I was just looking for their to be a check before initiating the test at all.
Let me know and we can have a follow up discussion on this. I'd rather have this decided before a commit.
Thanks
Jeff Marcom (jeffmarcom) wrote : | # |
In case it wasn't clear from the above statement, it's still marking single-touch automated as "fail" on my laptop.
Marc Tardif (cr3) wrote : | # |
What makes you say that your touchpad is not multitouch on your laptop?
- 1788. By Marc Tardif
-
Renamed class to device_class in xinput parser so that it doesn't conflict with the Python name.
- 1789. By Marc Tardif
-
Improved touchpad/
singletouch- automated, touchpad/ multitouch- automated, touchscreen/ nontouch- automated and touchscreen/ multitouch- automated so that they return unsupported instead of fail when the device is not singletouch for example.
Marc Tardif (cr3) wrote : | # |
Done, the touchpad/
Jeff Marcom (jeffmarcom) wrote : | # |
Awesome, thanks for your patience!
Preview Diff
1 | === modified file 'checkbox/parsers/tests/test_xinput.py' | |||
2 | --- checkbox/parsers/tests/test_xinput.py 2012-10-09 13:32:06 +0000 | |||
3 | +++ checkbox/parsers/tests/test_xinput.py 2012-10-22 19:47:20 +0000 | |||
4 | @@ -118,7 +118,7 @@ | |||
5 | 118 | self.assertEquals(len(devices), 1) | 118 | self.assertEquals(len(devices), 1) |
6 | 119 | 119 | ||
7 | 120 | classes = [cls for cls in devices[0]["classes"] | 120 | classes = [cls for cls in devices[0]["classes"] |
9 | 121 | if cls["class"] == "XITouchClass"] | 121 | if cls["device_class"] == "XITouchClass"] |
10 | 122 | self.assertEquals(len(classes), 1) | 122 | self.assertEquals(len(classes), 1) |
11 | 123 | self.assertEquals(classes[0]["touch_mode"], "dependent") | 123 | self.assertEquals(classes[0]["touch_mode"], "dependent") |
12 | 124 | 124 | ||
13 | @@ -130,6 +130,6 @@ | |||
14 | 130 | self.assertEquals(len(devices), 1) | 130 | self.assertEquals(len(devices), 1) |
15 | 131 | 131 | ||
16 | 132 | classes = [cls for cls in devices[0]["classes"] | 132 | classes = [cls for cls in devices[0]["classes"] |
18 | 133 | if cls["class"] == "XITouchClass"] | 133 | if cls["device_class"] == "XITouchClass"] |
19 | 134 | self.assertEquals(len(classes), 1) | 134 | self.assertEquals(len(classes), 1) |
20 | 135 | self.assertEquals(classes[0]["touch_mode"], "direct") | 135 | self.assertEquals(classes[0]["touch_mode"], "direct") |
21 | 136 | 136 | ||
22 | === modified file 'checkbox/parsers/xinput.py' | |||
23 | --- checkbox/parsers/xinput.py 2012-09-14 19:52:57 +0000 | |||
24 | +++ checkbox/parsers/xinput.py 2012-10-22 19:47:20 +0000 | |||
25 | @@ -69,7 +69,7 @@ | |||
26 | 69 | "Buttons supported": "buttons_supported", | 69 | "Buttons supported": "buttons_supported", |
27 | 70 | "Button labels": "button_labels", | 70 | "Button labels": "button_labels", |
28 | 71 | "Button state": "button_state", | 71 | "Button state": "button_state", |
30 | 72 | "Class originated from": "class", | 72 | "Class originated from": "device_class", |
31 | 73 | "Keycodes supported": "keycodes_supported", | 73 | "Keycodes supported": "keycodes_supported", |
32 | 74 | "Touch mode": "touch_mode", | 74 | "Touch mode": "touch_mode", |
33 | 75 | "Max number of touches": "max_touch", | 75 | "Max number of touches": "max_touch", |
34 | @@ -185,7 +185,7 @@ | |||
35 | 185 | value = self._parseValue(match.group("value")) | 185 | value = self._parseValue(match.group("value")) |
36 | 186 | 186 | ||
37 | 187 | # Special case for the class | 187 | # Special case for the class |
39 | 188 | if key == "class" and device_class: | 188 | if key == "device_class" and device_class: |
40 | 189 | result.addXinputDeviceClass(device, device_class) | 189 | result.addXinputDeviceClass(device, device_class) |
41 | 190 | device_class = {} | 190 | device_class = {} |
42 | 191 | prefix = "" | 191 | prefix = "" |
43 | 192 | 192 | ||
44 | === modified file 'data/whitelists/default.whitelist' | |||
45 | --- data/whitelists/default.whitelist 2012-10-15 20:03:32 +0000 | |||
46 | +++ data/whitelists/default.whitelist 2012-10-22 19:47:20 +0000 | |||
47 | @@ -14,9 +14,9 @@ | |||
48 | 14 | optical_drive | 14 | optical_drive |
49 | 15 | package | 15 | package |
50 | 16 | sleep | 16 | sleep |
51 | 17 | touchpad_scroll | ||
52 | 18 | uname | 17 | uname |
53 | 19 | usb | 18 | usb |
54 | 19 | xinput | ||
55 | 20 | __info__ | 20 | __info__ |
56 | 21 | codecs_attachment | 21 | codecs_attachment |
57 | 22 | cpuinfo_attachment | 22 | cpuinfo_attachment |
58 | 23 | 23 | ||
59 | === modified file 'debian/changelog' | |||
60 | --- debian/changelog 2012-10-22 14:38:54 +0000 | |||
61 | +++ debian/changelog 2012-10-22 19:47:20 +0000 | |||
62 | @@ -36,6 +36,8 @@ | |||
63 | 36 | * debian/control: Added python3-gi to run checkbox-qt. | 36 | * debian/control: Added python3-gi to run checkbox-qt. |
64 | 37 | * jobs/input.txt.in, jobs/touchpad.txt.in: Added input/pointing tests | 37 | * jobs/input.txt.in, jobs/touchpad.txt.in: Added input/pointing tests |
65 | 38 | and simplified horizontal/vertical scrolling tests. | 38 | and simplified horizontal/vertical scrolling tests. |
66 | 39 | * scripts/touchpad_scroll_resource, scripts/xinput_resource: Replaced | ||
67 | 40 | the touchpad_scroll_resource by reusing the xinput_resource script. | ||
68 | 39 | 41 | ||
69 | 40 | [Sean Feole] | 42 | [Sean Feole] |
70 | 41 | * [FEATURE] jobs/optical.txt.in: modified existing automation test | 43 | * [FEATURE] jobs/optical.txt.in: modified existing automation test |
71 | 42 | 44 | ||
72 | === modified file 'jobs/resource.txt.in' | |||
73 | --- jobs/resource.txt.in 2012-10-16 20:45:22 +0000 | |||
74 | +++ jobs/resource.txt.in 2012-10-22 19:47:20 +0000 | |||
75 | @@ -12,7 +12,7 @@ | |||
76 | 12 | name: dpkg | 12 | name: dpkg |
77 | 13 | plugin: resource | 13 | plugin: resource |
78 | 14 | command: dpkg_resource | 14 | command: dpkg_resource |
80 | 15 | description:Gets info on the version of dpkg installed | 15 | description: Gets info on the version of dpkg installed |
81 | 16 | 16 | ||
82 | 17 | name: gconf | 17 | name: gconf |
83 | 18 | plugin: resource | 18 | plugin: resource |
84 | @@ -88,10 +88,10 @@ | |||
85 | 88 | lsusb |grep -q "Linux Foundation ${version}.0 root hub" && echo "supported" || echo "unsupported" | 88 | lsusb |grep -q "Linux Foundation ${version}.0 root hub" && echo "supported" || echo "unsupported" |
86 | 89 | done | 89 | done |
87 | 90 | 90 | ||
89 | 91 | name: touchpad_scroll | 91 | name: xinput |
90 | 92 | plugin: resource | 92 | plugin: resource |
93 | 93 | command: touchpad_scroll_resource | 93 | command: xinput_resource |
94 | 94 | description: gives information on a touchpad's scroll support | 94 | description: Creates resource info from xinput output. |
95 | 95 | 95 | ||
96 | 96 | name: environment | 96 | name: environment |
97 | 97 | plugin: resource | 97 | plugin: resource |
98 | 98 | 98 | ||
99 | === modified file 'jobs/touchpad.txt.in' | |||
100 | --- jobs/touchpad.txt.in 2012-10-16 15:57:00 +0000 | |||
101 | +++ jobs/touchpad.txt.in 2012-10-22 19:47:20 +0000 | |||
102 | @@ -1,5 +1,6 @@ | |||
103 | 1 | plugin: manual | 1 | plugin: manual |
104 | 2 | name: touchpad/basic | 2 | name: touchpad/basic |
105 | 3 | requires: dmi.product in ['Notebook','Laptop','Portable'] | ||
106 | 3 | _description: | 4 | _description: |
107 | 4 | PURPOSE: | 5 | PURPOSE: |
108 | 5 | Touchpad verification | 6 | Touchpad verification |
109 | @@ -11,7 +12,9 @@ | |||
110 | 11 | 12 | ||
111 | 12 | plugin: manual | 13 | plugin: manual |
112 | 13 | name: touchpad/horizontal | 14 | name: touchpad/horizontal |
114 | 14 | requires: touchpad_scroll.horizontal_scroll == 'supported' | 15 | requires: |
115 | 16 | xinput.touch_mode == 'dependent' | ||
116 | 17 | 'Button Horiz Wheel Left' in xinput.button_labels and 'Button Horiz Wheel Right' in xinput.button_labels | ||
117 | 15 | command: touchpad_test right left | 18 | command: touchpad_test right left |
118 | 16 | _description: | 19 | _description: |
119 | 17 | PURPOSE: | 20 | PURPOSE: |
120 | @@ -24,7 +27,9 @@ | |||
121 | 24 | 27 | ||
122 | 25 | plugin: manual | 28 | plugin: manual |
123 | 26 | name: touchpad/vertical | 29 | name: touchpad/vertical |
125 | 27 | requires: touchpad_scroll.vertical_scroll == 'supported' | 30 | requires: |
126 | 31 | xinput.touch_mode == 'dependent' | ||
127 | 32 | 'Button Wheel Up' in xinput.button_labels and 'Button Wheel Down' in xinput.button_labels | ||
128 | 28 | command: touchpad_test up down | 33 | command: touchpad_test up down |
129 | 29 | _description: | 34 | _description: |
130 | 30 | PURPOSE: | 35 | PURPOSE: |
131 | @@ -37,13 +42,19 @@ | |||
132 | 37 | 42 | ||
133 | 38 | plugin: shell | 43 | plugin: shell |
134 | 39 | name: touchpad/singletouch-automated | 44 | name: touchpad/singletouch-automated |
136 | 40 | command: !(xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: dependent') | 45 | requires: |
137 | 46 | dmi.product in ['Notebook','Laptop','Portable'] | ||
138 | 47 | xinput.device_class == 'XITouchClass' and xinput.touch_mode != 'dependent' | ||
139 | 48 | command: true | ||
140 | 41 | _description: | 49 | _description: |
141 | 42 | Determine whether the touchpad is detected as a singletouch device automatically. | 50 | Determine whether the touchpad is detected as a singletouch device automatically. |
142 | 43 | 51 | ||
143 | 44 | plugin: shell | 52 | plugin: shell |
144 | 45 | name: touchpad/multitouch-automated | 53 | name: touchpad/multitouch-automated |
146 | 46 | command: xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: dependent' | 54 | requires: |
147 | 55 | dmi.product in ['Notebook','Laptop','Portable'] | ||
148 | 56 | xinput.device_class == 'XITouchClass' and xinput.touch_mode == 'dependent' | ||
149 | 57 | command: true | ||
150 | 47 | _description: | 58 | _description: |
151 | 48 | Determine whether the touchpad is detected as a multitouch device automatically. | 59 | Determine whether the touchpad is detected as a multitouch device automatically. |
152 | 49 | 60 | ||
153 | 50 | 61 | ||
154 | === modified file 'jobs/touchscreen.txt.in' | |||
155 | --- jobs/touchscreen.txt.in 2012-09-28 21:57:21 +0000 | |||
156 | +++ jobs/touchscreen.txt.in 2012-10-22 19:47:20 +0000 | |||
157 | @@ -32,13 +32,17 @@ | |||
158 | 32 | 32 | ||
159 | 33 | plugin: shell | 33 | plugin: shell |
160 | 34 | name: touchscreen/nontouch-automated | 34 | name: touchscreen/nontouch-automated |
162 | 35 | command: !(xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: direct') | 35 | requires: |
163 | 36 | xinput.device_class == 'XITouchClass' and xinput.touch_mode != 'direct' | ||
164 | 37 | command: true | ||
165 | 36 | _description: | 38 | _description: |
166 | 37 | Determine whether the screen is detected as a non-touch device automatically. | 39 | Determine whether the screen is detected as a non-touch device automatically. |
167 | 38 | 40 | ||
168 | 39 | plugin: shell | 41 | plugin: shell |
169 | 40 | name: touchscreen/multitouch-automated | 42 | name: touchscreen/multitouch-automated |
171 | 41 | command: xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: direct' | 43 | requires: |
172 | 44 | xinput.device_class == 'XITouchClass' and xinput.touch_mode == 'direct' | ||
173 | 45 | command: true | ||
174 | 42 | _description: | 46 | _description: |
175 | 43 | Determine whether the screen is detected as a multitouch device automatically. | 47 | Determine whether the screen is detected as a multitouch device automatically. |
176 | 44 | 48 | ||
177 | 45 | 49 | ||
178 | === removed file 'scripts/touchpad_scroll_resource' | |||
179 | --- scripts/touchpad_scroll_resource 2012-09-04 09:15:17 +0000 | |||
180 | +++ scripts/touchpad_scroll_resource 1970-01-01 00:00:00 +0000 | |||
181 | @@ -1,71 +0,0 @@ | |||
182 | 1 | #!/usr/bin/env python3 | ||
183 | 2 | |||
184 | 3 | import re | ||
185 | 4 | from io import StringIO | ||
186 | 5 | from subprocess import Popen, PIPE | ||
187 | 6 | from checkbox.parsers.udevadm import UdevadmParser | ||
188 | 7 | |||
189 | 8 | # Command to retrieve udev information. | ||
190 | 9 | COMMAND = 'udevadm info --export-db' | ||
191 | 10 | |||
192 | 11 | |||
193 | 12 | class TouchResult: | ||
194 | 13 | |||
195 | 14 | attributes = {} | ||
196 | 15 | |||
197 | 16 | def addDevice(self, device): | ||
198 | 17 | if getattr(device, 'category') == 'TOUCH': | ||
199 | 18 | self.attributes['product'] = getattr(device, 'product') | ||
200 | 19 | |||
201 | 20 | |||
202 | 21 | def get_touch_attributes(): | ||
203 | 22 | output, err = Popen(COMMAND, stdout=PIPE, shell=True).communicate() | ||
204 | 23 | if err: | ||
205 | 24 | return None | ||
206 | 25 | |||
207 | 26 | udev = UdevadmParser(StringIO(output.decode("unicode-escape"))) | ||
208 | 27 | |||
209 | 28 | result = TouchResult() | ||
210 | 29 | udev.run(result) | ||
211 | 30 | |||
212 | 31 | return result.attributes.get('product') | ||
213 | 32 | |||
214 | 33 | |||
215 | 34 | def can_scroll(touchpad): | ||
216 | 35 | COMMAND = "xinput list '%s'" % touchpad | ||
217 | 36 | horizontal_supported = "" | ||
218 | 37 | vertical_supported = "" | ||
219 | 38 | bl = re.compile("Button labels") | ||
220 | 39 | vert_up = re.compile(".*Button Wheel Up.*") | ||
221 | 40 | vert_down = re.compile(".*Button Wheel Down.*") | ||
222 | 41 | horiz_left = re.compile(".*Button Horiz Wheel Left.*") | ||
223 | 42 | horiz_right = re.compile(".*Button Horiz Wheel Right.*") | ||
224 | 43 | proc = Popen(COMMAND, stdout=PIPE, shell=True, universal_newlines=True) | ||
225 | 44 | output = proc.stdout.read() | ||
226 | 45 | if bl.findall(output): | ||
227 | 46 | if vert_up.search(output) and vert_down.search(output): | ||
228 | 47 | vertical_supported = "supported" | ||
229 | 48 | else: | ||
230 | 49 | vertical_supported = "unsupported" | ||
231 | 50 | if horiz_left.search(output) and horiz_right.search(output): | ||
232 | 51 | horizontal_supported = "supported" | ||
233 | 52 | else: | ||
234 | 53 | horizontal_supported = "unsupported" | ||
235 | 54 | else: | ||
236 | 55 | return "unuspported", "unsupported" | ||
237 | 56 | return horizontal_supported, vertical_supported | ||
238 | 57 | |||
239 | 58 | |||
240 | 59 | def main(): | ||
241 | 60 | product = get_touch_attributes() | ||
242 | 61 | if product: | ||
243 | 62 | print("device_name: %s" % product) | ||
244 | 63 | horiz,vert = can_scroll(product) | ||
245 | 64 | print("horizontal_scroll: %s" % horiz) | ||
246 | 65 | print("vertical_scroll: %s" % vert) | ||
247 | 66 | else: | ||
248 | 67 | print("device_name: None") | ||
249 | 68 | |||
250 | 69 | |||
251 | 70 | if __name__ == "__main__": | ||
252 | 71 | main() |
Okay, so a few problems here.
1.) This works pretty well in an all-in-one config now, however my tested this on my laptop (which is capable of vertical scrolling) and the test was skipped.
2.) Please add this requires line to the automated multitouch touchpad test: dmi.product in ['Notebook' ,'Laptop' ,'Portable' ]