diff options
-rwxr-xr-x | bin/touchpad_test.py | 72 | ||||
-rw-r--r-- | units/touchpad/jobs.pxu | 33 | ||||
-rw-r--r-- | units/touchpad/test-plan.pxu | 12 |
3 files changed, 58 insertions, 59 deletions
diff --git a/bin/touchpad_test.py b/bin/touchpad_test.py index 6ecde92..83940ec 100755 --- a/bin/touchpad_test.py +++ b/bin/touchpad_test.py @@ -3,6 +3,7 @@ import gi import sys import gettext +from time import sleep from gettext import gettext as _ gi.require_version('Gdk', '3.0') @@ -43,7 +44,7 @@ class GtkScroller(object): # Initialize GTK constants self.ICON_SIZE = Gtk.IconSize.BUTTON self.ICON_TESTED = Gtk.STOCK_YES - self.ICON_UNTESTED = Gtk.STOCK_INDEX + self.ICON_UNTESTED = Gtk.STOCK_DIALOG_QUESTION self.ICON_NOT_REQUIRED = Gtk.STOCK_REMOVE self.button_factory = Gtk.Button @@ -70,7 +71,7 @@ class GtkScroller(object): button_hbox = self._add_hbox(vbox) validation_hbox = self._add_hbox(vbox) self.status = self._add_label(vbox) - self.exit_button = self._add_button(vbox, Gtk.STOCK_CLOSE) + self.exit_button = self._add_button(vbox, "_Close") self.exit_button.connect("clicked", lambda w: self.quit()) # Add widgets for each direction. @@ -78,15 +79,15 @@ class GtkScroller(object): for direction in self.directions: self._add_label(button_hbox, direction.name) self.icons[direction] = self._add_image( - validation_hbox, Gtk.STOCK_INDEX) + validation_hbox, self.ICON_UNTESTED) self.show_text( _("Please move the mouse cursor to this window.") + "\n" + _("Then scroll in each direction on your touchpad.")) - def _add_button(self, context, stock): - button = self.button_factory(stock=stock) + def _add_button(self, context, label): + button = self.button_factory.new_with_mnemonic(label) context.add(button) button.show() return button @@ -124,29 +125,33 @@ class GtkScroller(object): def run(self): # Save touchpad settings. - if self.horiz_scroll_key: - self.saved_horiz_scroll_enabled = \ - self.touchpad_settings.get_boolean("horiz-scroll-enabled") - self.saved_scroll_method = self.touchpad_settings.get_string( - "scroll-method") + self.saved_edge_scrolling_enabled = self.touchpad_settings.get_boolean( + "edge-scrolling-enabled") + self.saved_two_finger_enabled = self.touchpad_settings.get_boolean( + "two-finger-scrolling-enabled") # Set touchpad settings. - if self.horiz_scroll_key: - self.touchpad_settings.set_boolean("horiz-scroll-enabled", True) if self.edge_scroll: - self.touchpad_settings.set_string( - "scroll-method", "edge-scrolling") - + self.touchpad_settings.set_boolean( + "edge-scrolling-enabled", True) + self.touchpad_settings.set_boolean( + "two-finger-scrolling-enabled", False) + else: + self.touchpad_settings.set_boolean( + "two-finger-scrolling-enabled", True) + self.touchpad_settings.set_boolean( + "edge-scrolling-enabled", False) Gtk.main() def quit(self): # Reset touchpad settings. - if self.horiz_scroll_key: - self.touchpad_settings.set_boolean( - "horiz-scroll-enabled", self.saved_horiz_scroll_enabled) - self.touchpad_settings.set_string( - "scroll-method", self.saved_scroll_method) - + self.touchpad_settings.set_boolean( + "two-finger-scrolling-enabled", self.saved_two_finger_enabled) + # GNOME does not like when both settings are set at the same time, so + # waiting a bit. + sleep(0.1) + self.touchpad_settings.set_boolean( + "edge-scrolling-enabled", self.saved_edge_scrolling_enabled) Gtk.main_quit() def show_text(self, text, widget=None): @@ -156,7 +161,7 @@ class GtkScroller(object): def found_direction(self, direction): direction.tested = True - self.icons[direction].set_from_stock( + self.icons[direction].set_from_icon_name( self.ICON_TESTED, size=self.ICON_SIZE) self.check_directions() @@ -169,10 +174,25 @@ class GtkScroller(object): def on_scroll(self, window, event): for direction in self.directions: - if direction.value == event.direction: - self.found_direction(direction) - break - + scroll_delta, delta_x, delta_y = event.get_scroll_deltas() + if scroll_delta: + event_direction = None + # Arbitrarily using 0.8, which requires a little bit of hand + # movement on the touchpads used for testing. + # Note that the directions are based on the default natural + # scrolling settings in GNOME settings. + if delta_x > 0.8: + event_direction = Direction("left") + elif delta_x < -0.8: + event_direction = Direction("right") + if delta_y > 0.8: + event_direction = Direction("up") + elif delta_y < -0.8: + event_direction = Direction("down") + if event_direction: + if direction.value == event_direction.value: + self.found_direction(direction) + break return True diff --git a/units/touchpad/jobs.pxu b/units/touchpad/jobs.pxu index 0a6c52c..11960ee 100644 --- a/units/touchpad/jobs.pxu +++ b/units/touchpad/jobs.pxu @@ -102,37 +102,20 @@ _siblings: plugin: user-interact category_id: com.canonical.plainbox::touchpad -id: touchpad/multitouch-horizontal +id: touchpad/multitouch requires: dmi.product in ['Notebook','Laptop','Portable','Convertible'] -command: touchpad_test.py right left +command: touchpad_test.py up down right left estimated_duration: 120.0 _purpose: - Touchpad 2-touch horizontal scroll verification + Touchpad 2-finger scroll verification _steps: - 1. Select "Test" when ready and place your cursor within the borders of the displayed test window. - 2. Verify that you can move the horizontal slider by moving 2 fingers right and left along the touchpad. + 1. Press "Enter" when ready and place your cursor within the borders of the displayed test window. + 2. Verify that the scroll events are detected by moving two fingers in all four directions along the touchpad. _verification: - Could you scroll right and left? -_siblings: - [{ "id": "touchpad/multitouch-horizontal-after-suspend", - "depends": "suspend/suspend_advanced_auto touchpad/multitouch-horizontal" }] - -plugin: user-interact -category_id: com.canonical.plainbox::touchpad -id: touchpad/multitouch-vertical -requires: dmi.product in ['Notebook','Laptop','Portable','Convertible'] -command: touchpad_test.py up down -estimated_duration: 120.0 -_purpose: - Touchpad 2-touch vertical scroll verification -_steps: - 1. Select "Test" when ready and place your cursor within the borders of the displayed test window. - 2. Verify that you can move the vertical slider by moving 2 fingers up and down along the touchpad. -_verification: - Could you scroll up and down? + Were scroll events detected for all four directions? _siblings: - [{ "id": "touchpad/multitouch-vertical-after-suspend", - "depends": "suspend/suspend_advanced_auto touchpad/multitouch-vertical" }] + [{ "id": "touchpad/multitouch-after-suspend", + "depends": "suspend/suspend_advanced_auto touchpad/multitouch" }] plugin: manual category_id: com.canonical.plainbox::touchpad diff --git a/units/touchpad/test-plan.pxu b/units/touchpad/test-plan.pxu index e03ea54..74d41a5 100644 --- a/units/touchpad/test-plan.pxu +++ b/units/touchpad/test-plan.pxu @@ -20,8 +20,7 @@ include: touchpad/singletouch-selection certification-status=blocker touchpad/drag-and-drop certification-status=blocker touchpad/multitouch-rightclick certification-status=blocker - touchpad/multitouch-horizontal certification-status=blocker - touchpad/multitouch-vertical certification-status=blocker + touchpad/multitouch certification-status=blocker id: touchpad-cert-automated unit: test plan @@ -45,8 +44,7 @@ include: touchpad/singletouch-selection-after-suspend certification-status=blocker touchpad/drag-and-drop-after-suspend certification-status=blocker touchpad/multitouch-rightclick-after-suspend certification-status=blocker - touchpad/multitouch-horizontal-after-suspend certification-status=blocker - touchpad/multitouch-vertical-after-suspend certification-status=blocker + touchpad/multitouch-after-suspend certification-status=blocker id: touchpad-cert-blockers unit: test plan @@ -59,8 +57,7 @@ include: touchpad/singletouch-selection certification-status=blocker touchpad/drag-and-drop certification-status=blocker touchpad/multitouch-rightclick certification-status=blocker - touchpad/multitouch-horizontal certification-status=blocker - touchpad/multitouch-vertical certification-status=blocker + touchpad/multitouch certification-status=blocker id: after-suspend-touchpad-cert-blockers unit: test plan @@ -73,5 +70,4 @@ include: touchpad/singletouch-selection-after-suspend certification-status=blocker touchpad/drag-and-drop-after-suspend certification-status=blocker touchpad/multitouch-rightclick-after-suspend certification-status=blocker - touchpad/multitouch-horizontal-after-suspend certification-status=blocker - touchpad/multitouch-vertical-after-suspend certification-status=blocker + touchpad/multitouch-after-suspend certification-status=blocker |