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
=== modified file 'tests/autopilot/ubuntu_keyboard/emulators/keyboard.py'
--- tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2014-12-08 15:09:24 +0000
+++ tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2015-01-08 10:31:23 +0000
@@ -160,7 +160,7 @@
160 except AssertionError:160 except AssertionError:
161 return False161 return False
162162
163 def press_key(self, key, capslock_switch=False):163 def press_key(self, key, capslock_switch=False, long_press=False):
164 """Tap on the key with the internal pointer164 """Tap on the key with the internal pointer
165165
166 :params key: String containing the text of the key to tap.166 :params key: String containing the text of the key to tap.
@@ -191,7 +191,10 @@
191 self._show_keypad(req_keypad)191 self._show_keypad(req_keypad)
192 self._change_keypad_to_state(req_key_state)192 self._change_keypad_to_state(req_key_state)
193193
194 self._tap_key(key_pos)194 if long_press:
195 self._long_press_key(key_pos)
196 else:
197 self._tap_key(key_pos)
195198
196 def type(self, string, delay=0.1):199 def type(self, string, delay=0.1):
197 """Type the string *string* with a delay of *delay* between each key200 """Type the string *string* with a delay of *delay* between each key
@@ -311,6 +314,14 @@
311 pointer = Pointer(Touch.create())314 pointer = Pointer(Touch.create())
312 pointer.click_object(key_rect)315 pointer.click_object(key_rect)
313316
317 def _long_press_key(self, key_rect, pointer=None):
318 if pointer is None:
319 pointer = Pointer(Touch.create())
320 pointer.move(key_rect.x + key_rect.w / 2.0, key_rect.y + key_rect.h / 2.0)
321 pointer.press()
322 sleep(1)
323 pointer.release()
324
314 def _keyboard_details_changed(self):325 def _keyboard_details_changed(self):
315 return self._orientation_changed()326 return self._orientation_changed()
316327
317328
=== modified file 'tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py'
--- tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2014-12-11 15:24:55 +0000
+++ tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2015-01-08 10:31:23 +0000
@@ -72,6 +72,7 @@
72 if os.path.exists(presagedir + ".bak") and os.path.exists(presagedir):72 if os.path.exists(presagedir + ".bak") and os.path.exists(presagedir):
73 shutil.rmtree(presagedir)73 shutil.rmtree(presagedir)
74 os.rename(presagedir + ".bak", presagedir)74 os.rename(presagedir + ".bak", presagedir)
75 subprocess.check_call(['restart', 'maliit-server'])
7576
76 def setUp(self):77 def setUp(self):
77 if model() == "Desktop":78 if model() == "Desktop":
@@ -387,7 +388,8 @@
387 dict(388 dict(
388 label="Url",389 label="Url",
389 hints=['Qt.ImhUrlCharactersOnly'],390 hints=['Qt.ImhUrlCharactersOnly'],
390 expected_activeview="url"391 expected_activeview="url",
392 text="google.com"
391 )393 )
392 ),394 ),
393 (395 (
@@ -395,7 +397,8 @@
395 dict(397 dict(
396 label="Email",398 label="Email",
397 hints=['Qt.ImhEmailCharactersOnly'],399 hints=['Qt.ImhEmailCharactersOnly'],
398 expected_activeview="email"400 expected_activeview="email",
401 text="test.user@example.com"
399 )402 )
400 ),403 ),
401 (404 (
@@ -403,7 +406,8 @@
403 dict(406 dict(
404 label="Number",407 label="Number",
405 hints=['Qt.ImhFormattedNumbersOnly'],408 hints=['Qt.ImhFormattedNumbersOnly'],
406 expected_activeview="number"409 expected_activeview="number",
410 text="3.14159"
407 )411 )
408 ),412 ),
409 (413 (
@@ -411,7 +415,8 @@
411 dict(415 dict(
412 label="Telephone",416 label="Telephone",
413 hints=['Qt.ImhDigitsOnly'],417 hints=['Qt.ImhDigitsOnly'],
414 expected_activeview="number"418 expected_activeview="number",
419 text="01189998819991197253"
415 )420 )
416 ),421 ),
417 ]422 ]
@@ -432,6 +437,17 @@
432 Eventually(Equals(self.expected_activeview))437 Eventually(Equals(self.expected_activeview))
433 )438 )
434439
440 if self.text[-4:] == ".com":
441 keyboard.type(self.text[:-4])
442 keyboard.press_key(".com")
443 else:
444 keyboard.type(self.text)
445
446 self.assertThat(
447 text_area.text,
448 Eventually(Equals(self.text))
449 )
450
435451
436class UbuntuKeyboardAdvancedFeatures(UbuntuKeyboardTests):452class UbuntuKeyboardAdvancedFeatures(UbuntuKeyboardTests):
437453
@@ -470,6 +486,24 @@
470 Eventually(Equals(expected))486 Eventually(Equals(expected))
471 )487 )
472488
489 def test_long_press(self):
490 """Long pressing a key should enter the default extended character.
491
492 """
493
494 text_area = self.launch_test_input_area()
495 self.ensure_focus_on_input(text_area)
496 keyboard = Keyboard()
497 self.addCleanup(keyboard.dismiss)
498
499 keyboard.press_key('t', long_press=True)
500
501 expected = "5"
502 self.assertThat(
503 text_area.text,
504 Eventually(Equals(expected))
505 )
506
473507
474class UbuntuKeyboardPinyin(UbuntuKeyboardTests):508class UbuntuKeyboardPinyin(UbuntuKeyboardTests):
475509

Subscribers

People subscribed via source and target branches