Merge lp:~cr3/checkbox/touchpad_scroll_resource_deprecate into lp:checkbox

Proposed by Marc Tardif
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
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_scroll_resource script by cr3.

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_scroll_resource script to reuse the more general xinput_resource script.

To post a comment you must log in.
Revision history for this message
Jeff Marcom (jeffmarcom) wrote :

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']

review: Needs Fixing
1786. By Marc Tardif

Fixed strings in touchpad/vertical requires line.

1787. By Marc Tardif

Added requires line to touchpad/multitouch-automated.

Revision history for this message
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.

review: Needs Resubmitting
Revision history for this message
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

review: Needs Information
Revision history for this message
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.

Revision history for this message
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.

Revision history for this message
Marc Tardif (cr3) wrote :

Done, the touchpad/singletouch should now return as unsupported on your laptop. When testing again, please make sure to branch in a new directory instead of pulling the latest changes. That way, you make sure there's no cache and no store from your previous run. Thanks!

review: Needs Resubmitting
Revision history for this message
Jeff Marcom (jeffmarcom) wrote :

Awesome, thanks for your patience!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
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 self.assertEquals(len(devices), 1)
6
7 classes = [cls for cls in devices[0]["classes"]
8- if cls["class"] == "XITouchClass"]
9+ if cls["device_class"] == "XITouchClass"]
10 self.assertEquals(len(classes), 1)
11 self.assertEquals(classes[0]["touch_mode"], "dependent")
12
13@@ -130,6 +130,6 @@
14 self.assertEquals(len(devices), 1)
15
16 classes = [cls for cls in devices[0]["classes"]
17- if cls["class"] == "XITouchClass"]
18+ if cls["device_class"] == "XITouchClass"]
19 self.assertEquals(len(classes), 1)
20 self.assertEquals(classes[0]["touch_mode"], "direct")
21
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 "Buttons supported": "buttons_supported",
27 "Button labels": "button_labels",
28 "Button state": "button_state",
29- "Class originated from": "class",
30+ "Class originated from": "device_class",
31 "Keycodes supported": "keycodes_supported",
32 "Touch mode": "touch_mode",
33 "Max number of touches": "max_touch",
34@@ -185,7 +185,7 @@
35 value = self._parseValue(match.group("value"))
36
37 # Special case for the class
38- if key == "class" and device_class:
39+ if key == "device_class" and device_class:
40 result.addXinputDeviceClass(device, device_class)
41 device_class = {}
42 prefix = ""
43
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 optical_drive
49 package
50 sleep
51-touchpad_scroll
52 uname
53 usb
54+xinput
55 __info__
56 codecs_attachment
57 cpuinfo_attachment
58
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 * debian/control: Added python3-gi to run checkbox-qt.
64 * jobs/input.txt.in, jobs/touchpad.txt.in: Added input/pointing tests
65 and simplified horizontal/vertical scrolling tests.
66+ * scripts/touchpad_scroll_resource, scripts/xinput_resource: Replaced
67+ the touchpad_scroll_resource by reusing the xinput_resource script.
68
69 [Sean Feole]
70 * [FEATURE] jobs/optical.txt.in: modified existing automation test
71
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 name: dpkg
77 plugin: resource
78 command: dpkg_resource
79-description:Gets info on the version of dpkg installed
80+description: Gets info on the version of dpkg installed
81
82 name: gconf
83 plugin: resource
84@@ -88,10 +88,10 @@
85 lsusb |grep -q "Linux Foundation ${version}.0 root hub" && echo "supported" || echo "unsupported"
86 done
87
88-name: touchpad_scroll
89+name: xinput
90 plugin: resource
91-command: touchpad_scroll_resource
92-description: gives information on a touchpad's scroll support
93+command: xinput_resource
94+description: Creates resource info from xinput output.
95
96 name: environment
97 plugin: resource
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 plugin: manual
104 name: touchpad/basic
105+requires: dmi.product in ['Notebook','Laptop','Portable']
106 _description:
107 PURPOSE:
108 Touchpad verification
109@@ -11,7 +12,9 @@
110
111 plugin: manual
112 name: touchpad/horizontal
113-requires: touchpad_scroll.horizontal_scroll == 'supported'
114+requires:
115+ xinput.touch_mode == 'dependent'
116+ 'Button Horiz Wheel Left' in xinput.button_labels and 'Button Horiz Wheel Right' in xinput.button_labels
117 command: touchpad_test right left
118 _description:
119 PURPOSE:
120@@ -24,7 +27,9 @@
121
122 plugin: manual
123 name: touchpad/vertical
124-requires: touchpad_scroll.vertical_scroll == 'supported'
125+requires:
126+ xinput.touch_mode == 'dependent'
127+ 'Button Wheel Up' in xinput.button_labels and 'Button Wheel Down' in xinput.button_labels
128 command: touchpad_test up down
129 _description:
130 PURPOSE:
131@@ -37,13 +42,19 @@
132
133 plugin: shell
134 name: touchpad/singletouch-automated
135-command: !(xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: dependent')
136+requires:
137+ dmi.product in ['Notebook','Laptop','Portable']
138+ xinput.device_class == 'XITouchClass' and xinput.touch_mode != 'dependent'
139+command: true
140 _description:
141 Determine whether the touchpad is detected as a singletouch device automatically.
142
143 plugin: shell
144 name: touchpad/multitouch-automated
145-command: xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: dependent'
146+requires:
147+ dmi.product in ['Notebook','Laptop','Portable']
148+ xinput.device_class == 'XITouchClass' and xinput.touch_mode == 'dependent'
149+command: true
150 _description:
151 Determine whether the touchpad is detected as a multitouch device automatically.
152
153
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
159 plugin: shell
160 name: touchscreen/nontouch-automated
161-command: !(xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: direct')
162+requires:
163+ xinput.device_class == 'XITouchClass' and xinput.touch_mode != 'direct'
164+command: true
165 _description:
166 Determine whether the screen is detected as a non-touch device automatically.
167
168 plugin: shell
169 name: touchscreen/multitouch-automated
170-command: xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: direct'
171+requires:
172+ xinput.device_class == 'XITouchClass' and xinput.touch_mode == 'direct'
173+command: true
174 _description:
175 Determine whether the screen is detected as a multitouch device automatically.
176
177
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-#!/usr/bin/env python3
183-
184-import re
185-from io import StringIO
186-from subprocess import Popen, PIPE
187-from checkbox.parsers.udevadm import UdevadmParser
188-
189-# Command to retrieve udev information.
190-COMMAND = 'udevadm info --export-db'
191-
192-
193-class TouchResult:
194-
195- attributes = {}
196-
197- def addDevice(self, device):
198- if getattr(device, 'category') == 'TOUCH':
199- self.attributes['product'] = getattr(device, 'product')
200-
201-
202-def get_touch_attributes():
203- output, err = Popen(COMMAND, stdout=PIPE, shell=True).communicate()
204- if err:
205- return None
206-
207- udev = UdevadmParser(StringIO(output.decode("unicode-escape")))
208-
209- result = TouchResult()
210- udev.run(result)
211-
212- return result.attributes.get('product')
213-
214-
215-def can_scroll(touchpad):
216- COMMAND = "xinput list '%s'" % touchpad
217- horizontal_supported = ""
218- vertical_supported = ""
219- bl = re.compile("Button labels")
220- vert_up = re.compile(".*Button Wheel Up.*")
221- vert_down = re.compile(".*Button Wheel Down.*")
222- horiz_left = re.compile(".*Button Horiz Wheel Left.*")
223- horiz_right = re.compile(".*Button Horiz Wheel Right.*")
224- proc = Popen(COMMAND, stdout=PIPE, shell=True, universal_newlines=True)
225- output = proc.stdout.read()
226- if bl.findall(output):
227- if vert_up.search(output) and vert_down.search(output):
228- vertical_supported = "supported"
229- else:
230- vertical_supported = "unsupported"
231- if horiz_left.search(output) and horiz_right.search(output):
232- horizontal_supported = "supported"
233- else:
234- horizontal_supported = "unsupported"
235- else:
236- return "unuspported", "unsupported"
237- return horizontal_supported, vertical_supported
238-
239-
240-def main():
241- product = get_touch_attributes()
242- if product:
243- print("device_name: %s" % product)
244- horiz,vert = can_scroll(product)
245- print("horizontal_scroll: %s" % horiz)
246- print("vertical_scroll: %s" % vert)
247- else:
248- print("device_name: None")
249-
250-
251-if __name__ == "__main__":
252- main()

Subscribers

People subscribed via source and target branches