Merge lp:~veebers/autopilot/1.3_backspace_fix_1237675 into lp:autopilot/1.3

Proposed by Christopher Lee
Status: Merged
Approved by: Thomi Richards
Approved revision: 349
Merged at revision: 347
Proposed branch: lp:~veebers/autopilot/1.3_backspace_fix_1237675
Merge into: lp:autopilot/1.3
Diff against target: 89 lines (+50/-0)
3 files modified
autopilot/input/_X11.py (+2/-0)
autopilot/input/_uinput.py (+1/-0)
autopilot/tests/functional/test_input_stack.py (+47/-0)
To merge this branch: bzr merge lp:~veebers/autopilot/1.3_backspace_fix_1237675
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Thomi Richards (community) Approve
Review via email: mp+190261@code.launchpad.net

Commit message

Keyboard backends: Add alias so Backspace and BackSpace work.

Description of the change

Keyboard backends: Add alias so Backspace and BackSpace work.

To post a comment you must log in.
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

64 + keyboard.type("Hello1", 0.01)
79 + keyboard.type("Hello1\b", 0.01)

Please don't change the default timings unless there's a very good reason to. I don't see any need for this here.

review: Needs Fixing
Revision history for this message
Christopher Lee (veebers) wrote :

> 64 + keyboard.type("Hello1", 0.01)
> 79 + keyboard.type("Hello1\b", 0.01)
>
> Please don't change the default timings unless there's a very good reason to.
> I don't see any need for this here.

Oh, that's a copy and paste error :-\ Will remove

349. By Christopher Lee

Remove timing change in 'type'

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Thomi Richards (thomir-deactivatedaccount) wrote :

LGTM

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'autopilot/input/_X11.py'
2--- autopilot/input/_X11.py 2013-09-04 03:44:07 +0000
3+++ autopilot/input/_X11.py 2013-10-09 22:44:27 +0000
4@@ -73,6 +73,7 @@
5 '\n': "Return", # for some reason this needs to be cr, not lf
6 '\r': "Return",
7 '\e': "Escape",
8+ '\b': "BackSpace",
9 '!': "exclam",
10 '#': "numbersign",
11 '%': "percent",
12@@ -116,6 +117,7 @@
13 'Shift': 'Shift_L',
14 'Enter': 'Return',
15 'Space': ' ',
16+ 'Backspace': 'BackSpace',
17 }
18
19 def __init__(self):
20
21=== modified file 'autopilot/input/_uinput.py'
22--- autopilot/input/_uinput.py 2013-08-02 02:25:03 +0000
23+++ autopilot/input/_uinput.py 2013-10-09 22:44:27 +0000
24@@ -459,6 +459,7 @@
25 ' ': 'SPACE',
26 '\t': 'TAB',
27 '\n': 'ENTER',
28+ '\b': 'BACKSPACE',
29 'CTRL': 'LEFTCTRL',
30 'ALT': 'LEFTALT',
31 'SHIFT': 'LEFTSHIFT',
32
33=== modified file 'autopilot/tests/functional/test_input_stack.py'
34--- autopilot/tests/functional/test_input_stack.py 2013-09-09 20:59:43 +0000
35+++ autopilot/tests/functional/test_input_stack.py 2013-10-09 22:44:27 +0000
36@@ -158,6 +158,53 @@
37 )
38
39
40+class InputStackKeyboardBackspaceTests(InputStackKeyboardBase):
41+
42+ def start_mock_app(self):
43+ window_spec_file = mktemp(suffix='.json')
44+ window_spec = {"Contents": "TextEdit"}
45+ json.dump(
46+ window_spec,
47+ open(window_spec_file, 'w')
48+ )
49+ self.addCleanup(os.remove, window_spec_file)
50+
51+ return self.launch_test_application(
52+ 'window-mocker',
53+ window_spec_file,
54+ app_type='qt'
55+ )
56+
57+ def test_backspace_works(self):
58+ app_proxy = self.start_mock_app()
59+ text_edit = app_proxy.select_single('QTextEdit')
60+
61+ self.mouse.click_object(text_edit)
62+
63+ keyboard = Keyboard.create(self.backend)
64+ keyboard.type("Hello1")
65+ keyboard.press_and_release("Backspace")
66+
67+ self.assertThat(text_edit.plainText,
68+ Eventually(Equals("Hello")),
69+ "app shows: " + text_edit.plainText
70+ )
71+
72+ def test_inline_backspace_works(self):
73+ app_proxy = self.start_mock_app()
74+ text_edit = app_proxy.select_single('QTextEdit')
75+
76+ self.mouse.click_object(text_edit)
77+
78+ keyboard = Keyboard.create(self.backend)
79+ keyboard.type("Hello1\b")
80+
81+ self.assertThat(text_edit.plainText,
82+ Eventually(Equals("Hello")),
83+ "app shows: " + text_edit.plainText
84+ )
85+
86+
87 @skipIf(platform.model() == 'Desktop', "Only on device")
88 class OSKBackendTests(AutopilotTestCase):
89 """Testing the Onscreen Keyboard (Ubuntu Keyboard) backend specifically.

Subscribers

People subscribed via source and target branches