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
=== modified file 'checkbox/parsers/tests/test_xinput.py'
--- checkbox/parsers/tests/test_xinput.py 2012-10-09 13:32:06 +0000
+++ checkbox/parsers/tests/test_xinput.py 2012-10-22 19:47:20 +0000
@@ -118,7 +118,7 @@
118 self.assertEquals(len(devices), 1)118 self.assertEquals(len(devices), 1)
119119
120 classes = [cls for cls in devices[0]["classes"]120 classes = [cls for cls in devices[0]["classes"]
121 if cls["class"] == "XITouchClass"]121 if cls["device_class"] == "XITouchClass"]
122 self.assertEquals(len(classes), 1)122 self.assertEquals(len(classes), 1)
123 self.assertEquals(classes[0]["touch_mode"], "dependent")123 self.assertEquals(classes[0]["touch_mode"], "dependent")
124124
@@ -130,6 +130,6 @@
130 self.assertEquals(len(devices), 1)130 self.assertEquals(len(devices), 1)
131131
132 classes = [cls for cls in devices[0]["classes"]132 classes = [cls for cls in devices[0]["classes"]
133 if cls["class"] == "XITouchClass"]133 if cls["device_class"] == "XITouchClass"]
134 self.assertEquals(len(classes), 1)134 self.assertEquals(len(classes), 1)
135 self.assertEquals(classes[0]["touch_mode"], "direct")135 self.assertEquals(classes[0]["touch_mode"], "direct")
136136
=== modified file 'checkbox/parsers/xinput.py'
--- checkbox/parsers/xinput.py 2012-09-14 19:52:57 +0000
+++ checkbox/parsers/xinput.py 2012-10-22 19:47:20 +0000
@@ -69,7 +69,7 @@
69 "Buttons supported": "buttons_supported",69 "Buttons supported": "buttons_supported",
70 "Button labels": "button_labels",70 "Button labels": "button_labels",
71 "Button state": "button_state",71 "Button state": "button_state",
72 "Class originated from": "class",72 "Class originated from": "device_class",
73 "Keycodes supported": "keycodes_supported",73 "Keycodes supported": "keycodes_supported",
74 "Touch mode": "touch_mode",74 "Touch mode": "touch_mode",
75 "Max number of touches": "max_touch",75 "Max number of touches": "max_touch",
@@ -185,7 +185,7 @@
185 value = self._parseValue(match.group("value"))185 value = self._parseValue(match.group("value"))
186186
187 # Special case for the class187 # Special case for the class
188 if key == "class" and device_class:188 if key == "device_class" and device_class:
189 result.addXinputDeviceClass(device, device_class)189 result.addXinputDeviceClass(device, device_class)
190 device_class = {}190 device_class = {}
191 prefix = ""191 prefix = ""
192192
=== modified file 'data/whitelists/default.whitelist'
--- data/whitelists/default.whitelist 2012-10-15 20:03:32 +0000
+++ data/whitelists/default.whitelist 2012-10-22 19:47:20 +0000
@@ -14,9 +14,9 @@
14optical_drive14optical_drive
15package15package
16sleep16sleep
17touchpad_scroll
18uname17uname
19usb18usb
19xinput
20__info__20__info__
21codecs_attachment21codecs_attachment
22cpuinfo_attachment22cpuinfo_attachment
2323
=== modified file 'debian/changelog'
--- debian/changelog 2012-10-22 14:38:54 +0000
+++ debian/changelog 2012-10-22 19:47:20 +0000
@@ -36,6 +36,8 @@
36 * debian/control: Added python3-gi to run checkbox-qt.36 * debian/control: Added python3-gi to run checkbox-qt.
37 * jobs/input.txt.in, jobs/touchpad.txt.in: Added input/pointing tests37 * jobs/input.txt.in, jobs/touchpad.txt.in: Added input/pointing tests
38 and simplified horizontal/vertical scrolling tests.38 and simplified horizontal/vertical scrolling tests.
39 * scripts/touchpad_scroll_resource, scripts/xinput_resource: Replaced
40 the touchpad_scroll_resource by reusing the xinput_resource script.
3941
40 [Sean Feole]42 [Sean Feole]
41 * [FEATURE] jobs/optical.txt.in: modified existing automation test43 * [FEATURE] jobs/optical.txt.in: modified existing automation test
4244
=== modified file 'jobs/resource.txt.in'
--- jobs/resource.txt.in 2012-10-16 20:45:22 +0000
+++ jobs/resource.txt.in 2012-10-22 19:47:20 +0000
@@ -12,7 +12,7 @@
12name: dpkg12name: dpkg
13plugin: resource13plugin: resource
14command: dpkg_resource14command: dpkg_resource
15description:Gets info on the version of dpkg installed15description: Gets info on the version of dpkg installed
1616
17name: gconf17name: gconf
18plugin: resource18plugin: resource
@@ -88,10 +88,10 @@
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"
89 done89 done
9090
91name: touchpad_scroll91name: xinput
92plugin: resource92plugin: resource
93command: touchpad_scroll_resource93command: xinput_resource
94description: gives information on a touchpad's scroll support94description: Creates resource info from xinput output.
9595
96name: environment96name: environment
97plugin: resource97plugin: resource
9898
=== modified file 'jobs/touchpad.txt.in'
--- jobs/touchpad.txt.in 2012-10-16 15:57:00 +0000
+++ jobs/touchpad.txt.in 2012-10-22 19:47:20 +0000
@@ -1,5 +1,6 @@
1plugin: manual1plugin: manual
2name: touchpad/basic2name: touchpad/basic
3requires: dmi.product in ['Notebook','Laptop','Portable']
3_description:4_description:
4 PURPOSE:5 PURPOSE:
5 Touchpad verification6 Touchpad verification
@@ -11,7 +12,9 @@
1112
12plugin: manual13plugin: manual
13name: touchpad/horizontal14name: touchpad/horizontal
14requires: touchpad_scroll.horizontal_scroll == 'supported'15requires:
16 xinput.touch_mode == 'dependent'
17 'Button Horiz Wheel Left' in xinput.button_labels and 'Button Horiz Wheel Right' in xinput.button_labels
15command: touchpad_test right left18command: touchpad_test right left
16_description:19_description:
17 PURPOSE:20 PURPOSE:
@@ -24,7 +27,9 @@
2427
25plugin: manual28plugin: manual
26name: touchpad/vertical29name: touchpad/vertical
27requires: touchpad_scroll.vertical_scroll == 'supported'30requires:
31 xinput.touch_mode == 'dependent'
32 'Button Wheel Up' in xinput.button_labels and 'Button Wheel Down' in xinput.button_labels
28command: touchpad_test up down33command: touchpad_test up down
29_description:34_description:
30 PURPOSE:35 PURPOSE:
@@ -37,13 +42,19 @@
3742
38plugin: shell43plugin: shell
39name: touchpad/singletouch-automated44name: touchpad/singletouch-automated
40command: !(xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: dependent')45requires:
46 dmi.product in ['Notebook','Laptop','Portable']
47 xinput.device_class == 'XITouchClass' and xinput.touch_mode != 'dependent'
48command: true
41_description:49_description:
42 Determine whether the touchpad is detected as a singletouch device automatically.50 Determine whether the touchpad is detected as a singletouch device automatically.
4351
44plugin: shell52plugin: shell
45name: touchpad/multitouch-automated53name: touchpad/multitouch-automated
46command: xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: dependent'54requires:
55 dmi.product in ['Notebook','Laptop','Portable']
56 xinput.device_class == 'XITouchClass' and xinput.touch_mode == 'dependent'
57command: true
47_description:58_description:
48 Determine whether the touchpad is detected as a multitouch device automatically.59 Determine whether the touchpad is detected as a multitouch device automatically.
4960
5061
=== modified file 'jobs/touchscreen.txt.in'
--- jobs/touchscreen.txt.in 2012-09-28 21:57:21 +0000
+++ jobs/touchscreen.txt.in 2012-10-22 19:47:20 +0000
@@ -32,13 +32,17 @@
3232
33plugin: shell33plugin: shell
34name: touchscreen/nontouch-automated34name: touchscreen/nontouch-automated
35command: !(xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: direct')35requires:
36 xinput.device_class == 'XITouchClass' and xinput.touch_mode != 'direct'
37command: true
36_description:38_description:
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.
3840
39plugin: shell41plugin: shell
40name: touchscreen/multitouch-automated42name: touchscreen/multitouch-automated
41command: xinput_resource | filter_templates -w 'class=XITouchClass' | grep -q 'touch_mode: direct'43requires:
44 xinput.device_class == 'XITouchClass' and xinput.touch_mode == 'direct'
45command: true
42_description:46_description:
43 Determine whether the screen is detected as a multitouch device automatically.47 Determine whether the screen is detected as a multitouch device automatically.
4448
4549
=== removed file 'scripts/touchpad_scroll_resource'
--- scripts/touchpad_scroll_resource 2012-09-04 09:15:17 +0000
+++ scripts/touchpad_scroll_resource 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
1#!/usr/bin/env python3
2
3import re
4from io import StringIO
5from subprocess import Popen, PIPE
6from checkbox.parsers.udevadm import UdevadmParser
7
8# Command to retrieve udev information.
9COMMAND = 'udevadm info --export-db'
10
11
12class TouchResult:
13
14 attributes = {}
15
16 def addDevice(self, device):
17 if getattr(device, 'category') == 'TOUCH':
18 self.attributes['product'] = getattr(device, 'product')
19
20
21def get_touch_attributes():
22 output, err = Popen(COMMAND, stdout=PIPE, shell=True).communicate()
23 if err:
24 return None
25
26 udev = UdevadmParser(StringIO(output.decode("unicode-escape")))
27
28 result = TouchResult()
29 udev.run(result)
30
31 return result.attributes.get('product')
32
33
34def can_scroll(touchpad):
35 COMMAND = "xinput list '%s'" % touchpad
36 horizontal_supported = ""
37 vertical_supported = ""
38 bl = re.compile("Button labels")
39 vert_up = re.compile(".*Button Wheel Up.*")
40 vert_down = re.compile(".*Button Wheel Down.*")
41 horiz_left = re.compile(".*Button Horiz Wheel Left.*")
42 horiz_right = re.compile(".*Button Horiz Wheel Right.*")
43 proc = Popen(COMMAND, stdout=PIPE, shell=True, universal_newlines=True)
44 output = proc.stdout.read()
45 if bl.findall(output):
46 if vert_up.search(output) and vert_down.search(output):
47 vertical_supported = "supported"
48 else:
49 vertical_supported = "unsupported"
50 if horiz_left.search(output) and horiz_right.search(output):
51 horizontal_supported = "supported"
52 else:
53 horizontal_supported = "unsupported"
54 else:
55 return "unuspported", "unsupported"
56 return horizontal_supported, vertical_supported
57
58
59def main():
60 product = get_touch_attributes()
61 if product:
62 print("device_name: %s" % product)
63 horiz,vert = can_scroll(product)
64 print("horizontal_scroll: %s" % horiz)
65 print("vertical_scroll: %s" % vert)
66 else:
67 print("device_name: None")
68
69
70if __name__ == "__main__":
71 main()

Subscribers

People subscribed via source and target branches