Merge lp:~michael-sheldon/ubuntu-keyboard/fix-autopilot-layout-contains-key into lp:ubuntu-keyboard

Proposed by Michael Sheldon on 2015-07-27
Status: Merged
Approved by: Michael Sheldon on 2015-07-28
Approved revision: 397
Merged at revision: 399
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-autopilot-layout-contains-key
Merge into: lp:ubuntu-keyboard
Diff against target: 46 lines (+9/-5)
1 file modified
tests/autopilot/ubuntu_keyboard/emulators/keyboard.py (+9/-5)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-autopilot-layout-contains-key
Reviewer Review Type Date Requested Status
Ken VanDine 2015-07-27 Approve on 2015-07-28
PS Jenkins bot continuous-integration Approve on 2015-07-27
Review via email: mp+265964@code.launchpad.net

Commit Message

Don't assume that we always have the same layout in autopilot emulator when caching key positions.

Description of the Change

Don't assume that we always have the same layout in autopilot emulator when caching key positions.

To post a comment you must log in.
Michael Sheldon (michael-sheldon) wrote :

Are there any related MPs required for this MP to build/function as expected? Please list.

 * No

Is your branch in sync with latest trunk (e.g. bzr pull lp:trunk -> no changes)

 * Yes

Did you perform an exploratory manual test run of your code change and any related functionality on device or emulator?

 * Yes (ran keyboard tests and system settings tests)

Did you successfully run all tests found in your component's Test Plan (https://wiki.ubuntu.com/Process/Merges/TestPlan/ubuntu-keyboard) on device or emulator?

 * No, code changes are only in the autopilot emulator

If you changed the UI, was the change specified/approved by design?

 * No change

If you changed UI labels, did you update the pot file?

 * No change

If you changed the packaging (debian), did you add a core-dev as a reviewer to this MP?

 * No change

Ken VanDine (ken-vandine) wrote :

I can confirm this fixes the keyboard layout changing issues we've been having with the ubuntu-system-settings autopilot tests.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tests/autopilot/ubuntu_keyboard/emulators/keyboard.py'
2--- tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2015-07-16 13:55:08 +0000
3+++ tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2015-07-27 13:19:44 +0000
4@@ -270,8 +270,9 @@
5 self._show_keypad(keypad_name)
6
7 contained, positions = self.active_keypad.get_key_details()
8- self._keys_contained[self._keyboard_container.state] = contained
9- self._keys_position[self._keyboard_container.state] = positions
10+ layout_state = self.keyboard.layoutId + self._keyboard_container.state
11+ self._keys_contained[layout_state] = contained
12+ self._keys_position[layout_state] = positions
13
14 def _keypad_contains_key(self, keypad_name, key):
15 """Returns the keypad state that key is found in.
16@@ -283,7 +284,8 @@
17 if self._keypad_details_expired(keypad_name):
18 self._update_details_for_keypad(keypad_name)
19
20- return self._keys_contained[keypad_name].get(key, None)
21+ layout_state = self.keyboard.layoutId + keypad_name
22+ return self._keys_contained[layout_state].get(key, None)
23
24 def _get_key_pos_from_keypad(self, keypad_name, key):
25 """Returns the position of the key if it is found on that keypad or
26@@ -293,7 +295,8 @@
27 if self._keypad_details_expired(keypad_name):
28 self._update_details_for_keypad(keypad_name)
29
30- return self._keys_position[keypad_name].get(key, None)
31+ layout_state = self.keyboard.layoutId + keypad_name
32+ return self._keys_position[layout_state].get(key, None)
33
34 def _show_keypad(self, keypad_name):
35 if self._current_keypad_name == keypad_name:
36@@ -352,8 +355,9 @@
37 rate=2.77 * gu, time_between_events=2)
38
39 def _keypad_details_expired(self, keypad_name):
40+ layout_state = self.keyboard.layoutId + keypad_name
41 return (
42- self._keys_contained.get(keypad_name) is None
43+ self._keys_contained.get(layout_state) is None
44 )
45
46 def _translate_key(self, label):

Subscribers

People subscribed via source and target branches