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

Proposed by Michael Sheldon
Status: Merged
Approved by: Bill Filler
Approved revision: 264
Merged at revision: 253
Proposed branch: lp:~michael-sheldon/ubuntu-keyboard/fix-autopilot
Merge into: lp:ubuntu-keyboard
Diff against target: 560 lines (+143/-132)
10 files modified
debian/control (+4/-4)
debian/rules (+2/-4)
debian/ubuntu-keyboard-autopilot.install (+1/-0)
qml/Keyboard.qml (+2/-0)
qml/KeyboardContainer.qml (+5/-0)
tests/autopilot/setup.py (+3/-0)
tests/autopilot/ubuntu-keyboard-tester.desktop (+9/-0)
tests/autopilot/ubuntu_keyboard/emulators/keyboard.py (+7/-5)
tests/autopilot/ubuntu_keyboard/emulators/keypad.py (+1/-0)
tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py (+109/-119)
To merge this branch: bzr merge lp:~michael-sheldon/ubuntu-keyboard/fix-autopilot
Reviewer Review Type Date Requested Status
Bill Filler (community) Approve
PS Jenkins bot continuous-integration Approve
Ken VanDine packaging Approve
Review via email: mp+242494@code.launchpad.net

Commit message

Fix old autopilot tests and implement some new ones.

Description of the change

Fix old autopilot tests and implement some new ones.

To post a comment you must log in.
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?

 * Yes

262. By Michael Sheldon

Update comment on .desktop file usage

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ken VanDine (ken-vandine) wrote :

+1 on the packaging changes

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

Add missing dependency on python3-evdev for autopilot tests

Revision history for this message
Bill Filler (bfiller) wrote :
Download full text (21.7 KiB)

all tests are passing on latest vivid image with the exception of one, which repeatedly fails:
ubuntu_keyboard.tests.test_keyboard.UbuntuKeyboardAdvancedFeatures.test_autocomplete

13:40:31.930 DEBUG test_keyboard:60 - Waiting for maliit-server to be ready
13:40:41.937 INFO _logging:40 - ************************************************************
13:40:41.942 INFO _logging:41 - Starting test ubuntu_keyboard.tests.test_keyboard.UbuntuKeyboardAdvancedFeatures.test_autocomplete
13:40:42.122 WARNING testcase:175 - Process manager backend unavailable, application snapshot support disabled.
13:40:42.154 WARNING base:49 - This function is deprecated. Use get_toolkit_launcher_command() instead.
13:40:42.433 INFO _launcher:373 - Attempting to launch application '/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene' with arguments '/tmp/tmpyd8y_kba.qml --desktop_file_hint=/usr/share/applications/ubuntu-keyboard-tester.desktop' as a normal process
13:40:42.446 INFO _launcher:431 - Launching process: ['/usr/lib/arm-linux-gnueabihf/qt5/bin/qmlscene', '-testability', '/tmp/tmpyd8y_kba.qml', '--desktop_file_hint=/usr/share/applications/ubuntu-keyboard-tester.desktop']
13:40:45.046 DEBUG _common:45 - Moving to object's globalRect coordinates.
13:40:45.047 DEBUG _uinput:472 - Tapping at: 177,193
13:40:47.688 DEBUG keyboard:243 - Keypad lookup
13:40:47.727 DEBUG dbus:352 - Selecting objects of type CharKey with attributes: {}
13:40:47.909 WARNING backends:229 - Your query 'Query(b'/maliit-server/QQuickView/Keyboard/OrientationHelper/QQuickItem/QQuickMouseArea/QQuickItem/QQuickItem/KeyboardContainer/QQuickLoader/KeyPad[id=12]//CharKey')' returned a lot of data (28 items). This is likely to be slow. You may want to consider optimising your query to return fewer items.
13:40:48.242 DEBUG dbus:352 - Selecting objects of type ActionKey with attributes: {}
13:40:48.350 DEBUG dbus:352 - Selecting objects of type ShiftKey with attributes: {}
13:40:48.514 DEBUG _common:65 - Moving to object's center point calculated from x,y,w,h attributes.
13:40:48.515 DEBUG _uinput:472 - Tapping at: 460,984
13:40:48.849 DEBUG _common:65 - Moving to object's center point calculated from x,y,w,h attributes.
13:40:48.850 DEBUG _uinput:472 - Tapping at: 194,867
13:40:49.216 DEBUG _common:65 - Moving to object's center point calculated from x,y,w,h attributes.
13:40:49.216 DEBUG _uinput:472 - Tapping at: 726,984
13:40:49.541 DEBUG _common:65 - Moving to object's center point calculated from x,y,w,h attributes.
13:40:49.542 DEBUG _uinput:472 - Tapping at: 422,1232
13:41:01.214 DEBUG _uinput:543 - Dragging from 235,1193 to 235,1577
13:41:01.219 DEBUG _uinput:414 - Moving pointing 'finger' to position 235,1203.
13:41:01.220 DEBUG _uinput:419 - The pointing 'finger' is now at position 235,1203.
13:41:01.231 DEBUG _uinput:414 - Moving pointing 'finger' to position 235,1213.
13:41:01.233 DEBUG _uinput:419 - The pointing 'finger' is now at position 235,1213.
13:41:01.245 DEBUG _uinput:414 - Moving pointing 'finger' to position 235,1223.
13:41:01.246 DEBUG _uinput:419 - The pointing 'finger' is now at position 235,1223.
13:41:01.257 DEBUG _uinput:414 - Moving pointing 'finger' to position 235,1233.
13:...

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

Clear any learnt predictions before running tests

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

works great

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-11-19 15:39:32 +0000
3+++ debian/control 2014-12-02 12:52:47 +0000
4@@ -16,8 +16,8 @@
5 libxml2-utils,
6 maliit-framework-dev (>= 0.99.0+git20130615+97e8335-0ubuntu3),
7 pkg-config,
8- python:any (>= 2.7),
9- python-setuptools,
10+ python3,
11+ python3-setuptools,
12 qt5-default,
13 qtbase5-dev,
14 qtdeclarative5-dev,
15@@ -76,9 +76,9 @@
16 Depends: libautopilot-qt (>= 1.4),
17 ${misc:Depends},
18 ${python:Depends},
19+ python3-evdev,
20 ubuntu-keyboard (>= ${source:Version}),
21- ubuntu-ui-toolkit-autopilot,
22- unity8-autopilot,
23+ ubuntu-ui-toolkit-autopilot
24 Description: Tests and emulators package for ubuntu-keyboard
25 Autopilot tests for the ubuntu-keyboard package
26
27
28=== modified file 'debian/rules'
29--- debian/rules 2014-02-28 21:28:23 +0000
30+++ debian/rules 2014-12-02 12:52:47 +0000
31@@ -4,7 +4,7 @@
32 export DPKG_GENSYMBOLS_CHECK_LEVEL=4
33
34 %:
35- dh $@ --fail-missing --with python2
36+ dh $@ --fail-missing --with python3
37
38 override_dh_auto_configure:
39 dh_auto_configure -- -recursive \
40@@ -29,9 +29,7 @@
41 override_dh_install:
42 # install autopilot tests
43 cd tests/autopilot; \
44- set -ex; for python in $(shell pyversions -r); do \
45- $$python setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
46- done; \
47+ python3 setup.py install --root=$(CURDIR)/debian/tmp --install-layout=deb; \
48 cd $(CURDIR)
49 # Don't install the other tests
50 rm debian/tmp/usr/bin/ut_*
51
52=== modified file 'debian/ubuntu-keyboard-autopilot.install'
53--- debian/ubuntu-keyboard-autopilot.install 2013-08-16 06:23:07 +0000
54+++ debian/ubuntu-keyboard-autopilot.install 2014-12-02 12:52:47 +0000
55@@ -1,1 +1,2 @@
56 usr/lib/python*/*/ubuntu_keyboard*
57+usr/share/applications/*
58
59=== modified file 'qml/Keyboard.qml'
60--- qml/Keyboard.qml 2014-10-29 17:50:51 +0000
61+++ qml/Keyboard.qml 2014-12-02 12:52:47 +0000
62@@ -87,6 +87,8 @@
63
64 property bool firstShow: true
65
66+ property string layoutId: "freetext"
67+
68 onXChanged: fullScreenItem.reportKeyboardVisibleRect();
69 onYChanged: fullScreenItem.reportKeyboardVisibleRect();
70 onWidthChanged: fullScreenItem.reportKeyboardVisibleRect();
71
72=== modified file 'qml/KeyboardContainer.qml'
73--- qml/KeyboardContainer.qml 2014-11-12 15:19:36 +0000
74+++ qml/KeyboardContainer.qml 2014-12-02 12:52:47 +0000
75@@ -204,11 +204,13 @@
76 {
77 // if (contentType === InputMethod.NumberContentType) {
78 if (contentType === 1) {
79+ canvas.layoutId = "number";
80 return "languages/Keyboard_numbers.qml";
81 }
82
83 // if (contentType === InputMethod.PhoneNumberContentType) {
84 if (contentType === 2) {
85+ canvas.layoutId = "telephone";
86 return "languages/Keyboard_telephone.qml";
87 }
88
89@@ -220,15 +222,18 @@
90
91 // if (contentType === InputMethod.EmailContentType) {
92 if (contentType === 3) {
93+ canvas.layoutId = "email";
94 return "lib/"+locale+"/Keyboard_"+locale+"_email.qml";
95 }
96
97 // if (contentType === InputMethod.UrlContentType) {
98 if (contentType === 4) {
99+ canvas.layoutId = "url";
100 return "lib/"+locale+"/Keyboard_"+locale+"_url_search.qml";
101 }
102
103 // FreeTextContentType used as fallback
104+ canvas.layoutId = "freetext";
105 return freeTextLanguageKeyboard(activeLanguage);
106 }
107 }
108
109=== modified file 'tests/autopilot/setup.py'
110--- tests/autopilot/setup.py 2013-08-20 23:08:38 +0000
111+++ tests/autopilot/setup.py 2014-12-02 12:52:47 +0000
112@@ -29,4 +29,7 @@
113 url='https://launchpad.net/ubuntu-keyboard',
114 license='GPLv3',
115 packages=find_packages(),
116+ data_files=[
117+ ('share/applications', ['ubuntu-keyboard-tester.desktop'])
118+ ]
119 )
120
121=== added file 'tests/autopilot/ubuntu-keyboard-tester.desktop'
122--- tests/autopilot/ubuntu-keyboard-tester.desktop 1970-01-01 00:00:00 +0000
123+++ tests/autopilot/ubuntu-keyboard-tester.desktop 2014-12-02 12:52:47 +0000
124@@ -0,0 +1,9 @@
125+[Desktop Entry]
126+Version=1.0
127+Name=Ubuntu Keyboard Tester
128+GenericName=Ubuntu Keyboard Tester
129+Comment=Test application for Ubuntu Keyboard autopilot tests
130+Type=Application
131+Terminal=false
132+X-Ubuntu-Touch=true
133+X-Ubuntu-Single-Instance=true
134
135=== modified file 'tests/autopilot/ubuntu_keyboard/emulators/keyboard.py'
136--- tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2013-11-07 11:06:18 +0000
137+++ tests/autopilot/ubuntu_keyboard/emulators/keyboard.py 2014-12-02 12:52:47 +0000
138@@ -136,9 +136,8 @@
139 if self.is_available():
140 x, y, h, w = self._keyboard_container.globalRect
141 x_pos = int(w / 2)
142- # start_y: just inside the keyboard, must be a better way than +1px
143- start_y = y - 10
144- end_y = y + int(h / 2)
145+ start_y = y + int(h / 2)
146+ end_y = y + h
147 self.pointer.drag(x_pos, start_y, x_pos, end_y)
148
149 self.keyboard.state.wait_for("HIDDEN")
150@@ -161,7 +160,7 @@
151 except AssertionError:
152 return False
153
154- def press_key(self, key):
155+ def press_key(self, key, capslock_switch=False):
156 """Tap on the key with the internal pointer
157
158 :params key: String containing the text of the key to tap.
159@@ -177,7 +176,10 @@
160 key = self._translate_key(key)
161
162 req_keypad = KeyboardState.character
163- req_key_state = self._keypad_contains_key(req_keypad, key)
164+ if capslock_switch:
165+ req_key_state = "CAPSLOCK"
166+ else:
167+ req_key_state = self._keypad_contains_key(req_keypad, key)
168 if req_key_state is None:
169 req_keypad = KeyboardState.symbol
170 req_key_state = self._keypad_contains_key(req_keypad, key)
171
172=== modified file 'tests/autopilot/ubuntu_keyboard/emulators/keypad.py'
173--- tests/autopilot/ubuntu_keyboard/emulators/keypad.py 2013-10-20 22:21:37 +0000
174+++ tests/autopilot/ubuntu_keyboard/emulators/keypad.py 2014-12-02 12:52:47 +0000
175@@ -54,5 +54,6 @@
176
177 _iter_keys("CharKey", lambda x: x.label)
178 _iter_keys("ActionKey", lambda x: x.action)
179+ _iter_keys("ShiftKey", lambda x: x.action)
180
181 return (contained_keys, key_positions)
182
183=== modified file 'tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py'
184--- tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2013-11-07 11:37:16 +0000
185+++ tests/autopilot/ubuntu_keyboard/tests/test_keyboard.py 2014-12-02 12:52:47 +0000
186@@ -17,7 +17,8 @@
187 # along with this program. If not, see <http://www.gnu.org/licenses/>.
188 #
189
190-import os
191+import os, os.path
192+import shutil
193 import subprocess
194
195 from testtools import skip
196@@ -31,115 +32,64 @@
197 from autopilot.introspection import get_proxy_object_for_existing_process
198 from autopilot.matchers import Eventually
199 from autopilot.platform import model
200-from unity8 import process_helpers
201-from unity8.shell.emulators.dash import Dash
202-from unity8.shell.emulators import UnityEmulatorBase
203 from ubuntuuitoolkit import base
204
205 from ubuntu_keyboard.emulators.keyboard import Keyboard
206 from ubuntu_keyboard.emulators.keypad import KeyPadState
207
208+from gi.repository import Gio
209+
210 import logging
211
212
213 logger = logging.getLogger(__name__)
214
215
216-def _stop_unity8():
217- status = process_helpers._get_unity_status()
218- if "start/" in status:
219- try:
220- logger.debug("Stopping unity8")
221- subprocess.check_call(['initctl', 'stop', 'unity8'])
222- except subprocess.CalledProcessError as e:
223- e.args += ("Unable to stop unity8",)
224- raise
225- else:
226- logger.debug("No need to stop unity.")
227-
228-
229-def _start_unity8():
230- status = process_helpers._get_unity_status()
231- if "stop/" in status:
232- try:
233- logger.debug("Starting unity8")
234- subprocess.check_call(['initctl', 'start', 'unity8'])
235- except subprocess.CalledProcessError as e:
236- e.args += ("Unable to start unity8",)
237- raise
238- else:
239- raise RuntimeError(
240- "Unable to start unity8: server is currently running."
241- )
242-
243-
244-def _assertUnityReady():
245- unity_pid = process_helpers._get_unity_pid()
246- unity = get_proxy_object_for_existing_process(
247- pid=unity_pid,
248- emulator_base=UnityEmulatorBase,
249- )
250- dash = unity.wait_select_single(Dash)
251- home_scope = dash.get_scope('home')
252-
253- home_scope.isLoaded.wait_for(True)
254- home_scope.isCurrent.wait_for(True)
255-
256-
257-def _restart_unity8():
258- _stop_unity8()
259- _start_unity8()
260-
261-
262 class UbuntuKeyboardTests(AutopilotTestCase):
263- maliit_override_file = os.path.expanduser(
264- "~/.config/upstart/maliit-server.override"
265- )
266
267 @classmethod
268 def setUpClass(cls):
269- try:
270- logger.debug("Creating the override file.")
271- with open(
272- UbuntuKeyboardTests.maliit_override_file, 'w'
273- ) as override_file:
274- override_file.write("exec maliit-server -testability")
275-
276- process_helpers.restart_unity_with_testability()
277- _assertUnityReady()
278- #### FIXME: This is a work around re: lp:1238417 ####
279- if model() != "Desktop":
280- from autopilot.input import _uinput
281- _uinput._touch_device = _uinput.create_touch_device()
282- ####
283-
284- #### FIXME: Workaround re: lp:1248902 and lp:1248913
285- logger.debug("Waiting for maliit-server to be ready")
286- sleep(10)
287- ####
288-
289- except IOError as e:
290- e.args += (
291- "Failed attempting to write override file to {file}".format(
292- file=UbuntuKeyboardTests.maliit_override_file
293- ),
294- )
295- raise
296+ # Clear away any learnt predictions
297+ presagedir = os.path.expanduser("~/.presage")
298+ if os.path.exists(presagedir):
299+ os.rename(presagedir, presagedir + ".bak")
300+ subprocess.check_call(['initctl', 'set-env', 'QT_LOAD_TESTABILITY=1'])
301+ subprocess.check_call(['restart', 'maliit-server'])
302+ #### FIXME: This is a work around re: lp:1238417 ####
303+ if model() != "Desktop":
304+ from autopilot.input import _uinput
305+ _uinput._touch_device = _uinput.create_touch_device()
306+ ####
307+
308+ #### FIXME: Workaround re: lp:1248902 and lp:1248913
309+ logger.debug("Waiting for maliit-server to be ready")
310+ sleep(10)
311+ ####
312
313 @classmethod
314 def tearDownClass(cls):
315- try:
316- os.remove(UbuntuKeyboardTests.maliit_override_file)
317- except OSError:
318- logger.warning("Attempted to remove non-existent override file")
319- _restart_unity8()
320+ presagedir = os.path.expanduser("~/.presage")
321+ if os.path.exists(presagedir + ".bak") and os.path.exists(presagedir):
322+ shutil.rmtree(presagedir)
323+ os.rename(presagedir + ".bak", presagedir)
324
325 def setUp(self):
326 if model() == "Desktop":
327 self.skipTest("Ubuntu Keyboard tests only run on device.")
328 super(UbuntuKeyboardTests, self).setUp()
329+ self.set_test_settings()
330 self.pointer = Pointer(Touch.create())
331
332+ def set_test_settings(self):
333+ gsettings = Gio.Settings.new("com.canonical.keyboard.maliit")
334+ gsettings.set_string("active-language", "en")
335+ gsettings.set_strv("enabled-languages", ["en", "es", "de", "zh"])
336+ gsettings.set_boolean("auto-capitalization", True)
337+ gsettings.set_boolean("auto-completion", True)
338+ gsettings.set_boolean("predictive-text", True)
339+ gsettings.set_boolean("spell-checking", True)
340+ gsettings.set_boolean("double-space-full-stop", True)
341+
342 def launch_test_input_area(self, label="", input_hints=None):
343 self.app = self._launch_simple_input(label, input_hints)
344 text_area = self.app.select_single("QQuickTextInput")
345@@ -158,7 +108,9 @@
346 open(qml_path, 'w').write(script_contents)
347 self.addCleanup(os.remove, qml_path)
348
349- desktop_file = self._write_test_desktop_file()
350+ # Use installed desktop file so that Mir allows us to connect with
351+ # our test QML apps
352+ desktop_file = "/usr/share/applications/ubuntu-keyboard-tester.desktop"
353 return self.launch_test_application(
354 base.get_qmlscene_launch_command(),
355 qml_path,
356@@ -195,9 +147,8 @@
357 )
358
359 def _launch_simple_input(self, label="", input_hints=None):
360- if input_hints is None:
361- extra_script = "Qt.ImhNoPredictiveText"
362- else:
363+ extra_script = "undefined"
364+ if input_hints is not None:
365 extra_script = "|".join(input_hints)
366
367 simple_script = dedent("""
368@@ -243,7 +194,7 @@
369 def test_keyboard_is_available(self):
370 keyboard = Keyboard()
371 self.addCleanup(keyboard.dismiss)
372- app = self._launch_simple_input()
373+ app = self._launch_simple_input(input_hints=['Qt.ImhNoPredictiveText'])
374 text_rectangle = app.select_single("QQuickTextInput")
375
376 self.pointer.click_object(text_rectangle)
377@@ -287,7 +238,7 @@
378 ]
379
380 def test_can_type_string(self):
381- text_area = self.launch_test_input_area(label=self.label)
382+ text_area = self.launch_test_input_area(label=self.label, input_hints=['Qt.ImhNoPredictiveText'])
383 self.ensure_focus_on_input(text_area)
384 keyboard = Keyboard()
385 self.addCleanup(keyboard.dismiss)
386@@ -298,18 +249,12 @@
387
388 class UbuntuKeyboardStateChanges(UbuntuKeyboardTests):
389
390- # Note: this is a failing test due to bug lp:1214695
391- # Note: based on UX design doc
392 def test_keyboard_layout_starts_shifted(self):
393 """When first launched the keyboard state must be
394 shifted/capitalised.
395
396 """
397- self.skip(
398- "Skipping as feature hasn't landed yet, refer to bug lp:1214695"
399- )
400-
401- text_area = self.launch_test_input_area()
402+ text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
403 self.ensure_focus_on_input(text_area)
404 keyboard = Keyboard()
405 self.addCleanup(keyboard.dismiss)
406@@ -328,11 +273,7 @@
407 until the shift key is clicked again.
408
409 """
410- self.skip(
411- "Skipping due to bug in emulator: lp:1237846"
412- )
413-
414- text_area = self.launch_test_input_area()
415+ text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
416 self.ensure_focus_on_input(text_area)
417 keyboard = Keyboard()
418 self.addCleanup(keyboard.dismiss)
419@@ -341,7 +282,7 @@
420 # Bug lp:1229003 and lp:1229001
421 sleep(.2)
422 keyboard.press_key('shift')
423- keyboard.press_key('shift')
424+ keyboard.press_key('shift', True)
425
426 self.assertThat(
427 keyboard.active_keypad_state,
428@@ -354,7 +295,7 @@
429 shift the keyboard back into the default state.
430
431 """
432- text_area = self.launch_test_input_area()
433+ text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
434 self.ensure_focus_on_input(text_area)
435 keyboard = Keyboard()
436 self.addCleanup(keyboard.dismiss)
437@@ -374,17 +315,12 @@
438
439 self.assertThat(text_area.text, Eventually(Equals('abcA')))
440
441- # Note: this is a failing test due to bug lp:1214695
442- # Note: Based on UX design doc.
443 def test_shift_state_entered_after_fullstop(self):
444 """After typing a fullstop the keyboard state must automatically
445 enter the shifted state.
446
447 """
448- self.skip(
449- "Skipping as feature hasn't landed yet, refer to bug lp:1214695"
450- )
451- text_area = self.launch_test_input_area()
452+ text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
453 self.ensure_focus_on_input(text_area)
454 keyboard = Keyboard()
455 self.addCleanup(keyboard.dismiss)
456@@ -401,18 +337,39 @@
457 Eventually(Equals(KeyPadState.SHIFTED))
458 )
459
460+ def test_shift_state_left_after_deleting_fullstop(self):
461+ """After deleting a fullstop the keyboard should return to the normal
462+ state.
463+ """
464+ text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
465+ self.ensure_focus_on_input(text_area)
466+ keyboard = Keyboard()
467+ self.addCleanup(keyboard.dismiss)
468+
469+ keyboard.type("Hello my friend.\b")
470+
471+ self.assertThat(
472+ text_area.text,
473+ Eventually(Equals("Hello my friend"))
474+ )
475+
476+ self.assertThat(
477+ keyboard.active_keypad_state,
478+ Eventually(Equals(KeyPadState.NORMAL))
479+ )
480+
481 def test_switching_between_states(self):
482 """The user must be able to type many different characters including
483 spaces and backspaces.
484
485 """
486- text_area = self.launch_test_input_area()
487+ text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
488 self.ensure_focus_on_input(text_area)
489 keyboard = Keyboard()
490 self.addCleanup(keyboard.dismiss)
491
492 keyboard.type(
493- 'abc gone\b\b & \bABC (123)'
494+ 'abc gone\b\b & \b ABC (123)'
495 )
496
497 expected = "abc go & ABC (123)"
498@@ -423,11 +380,6 @@
499
500
501 class UbuntuKeyboardInputTypeStateChange(UbuntuKeyboardTests):
502- """Note: these tests are currently failing due to bug lp:1214694 (the
503- activeView detail isn't exposed correctly nor is it updated as expected
504- (i.e. when the view changes.))
505-
506- """
507
508 scenarios = [
509 (
510@@ -465,7 +417,6 @@
511 ]
512
513 # Note: based on UX design doc
514- @skip("Unable to determine LayoutId re: bug lp:1248796")
515 def test_keyboard_layout(self):
516 """The Keyboard must respond to the input type and change to be the
517 correct state.
518@@ -480,3 +431,42 @@
519 keyboard.keyboard.layoutId,
520 Eventually(Equals(self.expected_activeview))
521 )
522+
523+
524+class UbuntuKeyboardAdvancedFeatures(UbuntuKeyboardTests):
525+
526+ def test_double_space_fullstop(self):
527+ """After tapping space twice a fullstop should be entered.
528+
529+ """
530+ text_area = self.launch_test_input_area(input_hints=['Qt.ImhNoPredictiveText'])
531+ self.ensure_focus_on_input(text_area)
532+ keyboard = Keyboard()
533+ self.addCleanup(keyboard.dismiss)
534+
535+ keyboard.type('This is a test ')
536+
537+ expected = "This is a test. "
538+ self.assertThat(
539+ text_area.text,
540+ Eventually(Equals(expected))
541+ )
542+
543+ def test_autocomplete(self):
544+ """Tapping space in a field that supports auto-complete should
545+ complete a word.
546+
547+ """
548+ text_area = self.launch_test_input_area()
549+ self.ensure_focus_on_input(text_area)
550+ keyboard = Keyboard()
551+ self.addCleanup(keyboard.dismiss)
552+
553+ keyboard.type('Pic ')
554+
555+ expected = "Picture "
556+ self.assertThat(
557+ text_area.text,
558+ Eventually(Equals(expected))
559+ )
560+

Subscribers

People subscribed via source and target branches