Merge lp:~bzoltan/ubuntu-ui-toolkit/inputMainFocus into lp:ubuntu-ui-toolkit

Proposed by Zoltan Balogh
Status: Rejected
Rejected by: Cris Dywan
Proposed branch: lp:~bzoltan/ubuntu-ui-toolkit/inputMainFocus
Merge into: lp:ubuntu-ui-toolkit
Diff against target: 95 lines (+50/-4)
2 files modified
src/Ubuntu/Components/1.3/InputHandler.qml (+1/-3)
tests/unit_x11/tst_components/tst_textinput_common13.qml (+49/-1)
To merge this branch: bzr merge lp:~bzoltan/ubuntu-ui-toolkit/inputMainFocus
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Ubuntu SDK team Pending
Review via email: mp+294339@code.launchpad.net

Commit message

Text input focus must always follow main component. New tests assert that the OSK is shown. Fixes LP: #1545802

Description of the change

Text input focus must always follow main component. New tests assert that the OSK is shown. Fixes LP: #1545802

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Unmerged revisions

1315. By Zoltan Balogh

Text input focus must always follow main component. New tests assert that the OSK is shown. Fixes LP: #1545802

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/1.3/InputHandler.qml'
2--- src/Ubuntu/Components/1.3/InputHandler.qml 2016-04-25 10:45:41 +0000
3+++ src/Ubuntu/Components/1.3/InputHandler.qml 2016-05-11 09:15:23 +0000
4@@ -292,9 +292,7 @@
5 target: main
6 ignoreUnknownSignals: true
7 onActiveFocusChanged: {
8- if (!main.activeFocus) {
9- input.focus = false;
10- }
11+ input.focus = main.activeFocus;
12 }
13 onKeyNavigationFocusChanged: {
14 if (main.keyNavigationFocus) {
15
16=== modified file 'tests/unit_x11/tst_components/tst_textinput_common13.qml'
17--- tests/unit_x11/tst_components/tst_textinput_common13.qml 2016-04-08 07:40:38 +0000
18+++ tests/unit_x11/tst_components/tst_textinput_common13.qml 2016-05-11 09:15:23 +0000
19@@ -23,7 +23,7 @@
20 Item {
21 id: testMain
22 width: units.gu(40)
23- height: units.gu(50)
24+ height: units.gu(70)
25
26 Component {
27 id: popoverComponent
28@@ -97,6 +97,32 @@
29 id: textField
30 }
31
32+ FocusScope {
33+ id: scope
34+ width: textFieldInMouseArea.implicitWidth
35+ height: textFieldInMouseArea.implicitHeight
36+ TextField {
37+ anchors.fill: parent
38+ id: textFieldInMouseArea
39+ text: 'Lorem ipsum dolor sit amet'
40+ color: UbuntuColors.blue
41+ }
42+ MouseArea {
43+ anchors.fill: parent
44+ enabled: !scope.activeFocus
45+ onClicked: {
46+ textFieldInMouseArea.forceActiveFocus()
47+ textFieldInMouseArea.selectAll()
48+ }
49+ Rectangle {
50+ anchors.fill: parent
51+ color: UbuntuColors.blue
52+ opacity: 0.1
53+ visible: parent.enabled
54+ }
55+ }
56+ }
57+
58 TextField {
59 id: customTextField
60 text: 'Lorem ipsum dolor sit amet'
61@@ -198,6 +224,11 @@
62 cursorRectSpy.clear();
63 scrollerSpy.clear();
64 escapePressedSpy.clear();
65+ // Hide OSK if showing
66+ UbuntuApplication.inputMethod.visible = false;
67+ // Dismiss popover if any
68+ mouseClick(testMain, 1, 1);
69+ wait(500);
70 }
71
72 function test_context_menu_items_data() {
73@@ -543,5 +574,22 @@
74 keyClick(Qt.Key_Escape);
75 compare(escapePressedSpy.count, 1);
76 }
77+
78+ function test_a_text_field_evokes_osk_data() {
79+ return [
80+ { tag: 'textField', input: textField },
81+ { tag: 'textField with icons', input: customTextField },
82+ { tag: 'textArea', input: textArea },
83+ { tag: 'focusScope', input: textFieldInMouseArea },
84+ ];
85+ }
86+ function test_a_text_field_evokes_osk(data) {
87+ waitForRendering(data.input);
88+ compare(data.input.activeFocus, false, 'TextField is not yet focused');
89+ mouseClick(data.input);
90+ waitForRendering(data.input);
91+ compare(data.input.activeFocus, true, 'TextField is focused');
92+ compare(UbuntuApplication.inputMethod.visible, true, 'OSK is visible');
93+ }
94 }
95 }

Subscribers

People subscribed via source and target branches

to status/vote changes: