Merge lp:~michael-sheldon/ubuntu-keyboard/improve-autopilot-tests into lp:ubuntu-keyboard

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 267
Merged at revision: 277
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/improve-autopilot-tests
Merge into: lp:ubuntu-keyboard
Diff against target: 133 lines (+51/-6)
2 files modified
tests/autopilot/ubuntu_keyboard/emulators/keyboard.py (+13/-2)
tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py (+38/-4)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/improve-autopilot-tests
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+245708@code.launchpad.net

Commit message

Extend existing autopilot tests to more thoroughly test each layout, add new tests for extended keys and ".com" key and fix crash when using keyboard after autopilot tests have been run.

Description of the change

Extend existing autopilot tests to more thoroughly test each layout, add new tests for extended keys and ".com" key and fix crash when using keyboard after autopilot tests have been run.

To post a comment you must log in.
266. By Michael Sheldon

Merge from trunk

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
267. By Michael Sheldon

Merge from trunk

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

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?

 * Yes

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

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Bill Filler (bfiller) wrote :

approved

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 2014-12-08 15:09:24 +0000
3+++ tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2015-01-08 10:31:23 +0000
4@@ -160,7 +160,7 @@
5 except AssertionError:
6 return False
7
8- def press_key(self, key, capslock_switch=False):
9+ def press_key(self, key, capslock_switch=False, long_press=False):
10 """Tap on the key with the internal pointer
11
12 :params key: String containing the text of the key to tap.
13@@ -191,7 +191,10 @@
14 self._show_keypad(req_keypad)
15 self._change_keypad_to_state(req_key_state)
16
17- self._tap_key(key_pos)
18+ if long_press:
19+ self._long_press_key(key_pos)
20+ else:
21+ self._tap_key(key_pos)
22
23 def type(self, string, delay=0.1):
24 """Type the string *string* with a delay of *delay* between each key
25@@ -311,6 +314,14 @@
26 pointer = Pointer(Touch.create())
27 pointer.click_object(key_rect)
28
29+ def _long_press_key(self, key_rect, pointer=None):
30+ if pointer is None:
31+ pointer = Pointer(Touch.create())
32+ pointer.move(key_rect.x + key_rect.w / 2.0, key_rect.y + key_rect.h / 2.0)
33+ pointer.press()
34+ sleep(1)
35+ pointer.release()
36+
37 def _keyboard_details_changed(self):
38 return self._orientation_changed()
39
40
41=== modified file 'tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py'
42--- tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2014-12-11 15:24:55 +0000
43+++ tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2015-01-08 10:31:23 +0000
44@@ -72,6 +72,7 @@
45 if os.path.exists(presagedir + ".bak") and os.path.exists(presagedir):
46 shutil.rmtree(presagedir)
47 os.rename(presagedir + ".bak", presagedir)
48+ subprocess.check_call(['restart', 'maliit-server'])
49
50 def setUp(self):
51 if model() == "Desktop":
52@@ -387,7 +388,8 @@
53 dict(
54 label="Url",
55 hints=['Qt.ImhUrlCharactersOnly'],
56- expected_activeview="url"
57+ expected_activeview="url",
58+ text="google.com"
59 )
60 ),
61 (
62@@ -395,7 +397,8 @@
63 dict(
64 label="Email",
65 hints=['Qt.ImhEmailCharactersOnly'],
66- expected_activeview="email"
67+ expected_activeview="email",
68+ text="test.user@example.com"
69 )
70 ),
71 (
72@@ -403,7 +406,8 @@
73 dict(
74 label="Number",
75 hints=['Qt.ImhFormattedNumbersOnly'],
76- expected_activeview="number"
77+ expected_activeview="number",
78+ text="3.14159"
79 )
80 ),
81 (
82@@ -411,7 +415,8 @@
83 dict(
84 label="Telephone",
85 hints=['Qt.ImhDigitsOnly'],
86- expected_activeview="number"
87+ expected_activeview="number",
88+ text="01189998819991197253"
89 )
90 ),
91 ]
92@@ -432,6 +437,17 @@
93 Eventually(Equals(self.expected_activeview))
94 )
95
96+ if self.text[-4:] == ".com":
97+ keyboard.type(self.text[:-4])
98+ keyboard.press_key(".com")
99+ else:
100+ keyboard.type(self.text)
101+
102+ self.assertThat(
103+ text_area.text,
104+ Eventually(Equals(self.text))
105+ )
106+
107
108 class UbuntuKeyboardAdvancedFeatures(UbuntuKeyboardTests):
109
110@@ -470,6 +486,24 @@
111 Eventually(Equals(expected))
112 )
113
114+ def test_long_press(self):
115+ """Long pressing a key should enter the default extended character.
116+
117+ """
118+
119+ text_area = self.launch_test_input_area()
120+ self.ensure_focus_on_input(text_area)
121+ keyboard = Keyboard()
122+ self.addCleanup(keyboard.dismiss)
123+
124+ keyboard.press_key('t', long_press=True)
125+
126+ expected = "5"
127+ self.assertThat(
128+ text_area.text,
129+ Eventually(Equals(expected))
130+ )
131+
132
133 class UbuntuKeyboardPinyin(UbuntuKeyboardTests):
134

Subscribers

People subscribed via source and target branches