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
=== modified file 'src/Ubuntu/Components/1.3/InputHandler.qml'
--- src/Ubuntu/Components/1.3/InputHandler.qml 2016-04-25 10:45:41 +0000
+++ src/Ubuntu/Components/1.3/InputHandler.qml 2016-05-11 09:15:23 +0000
@@ -292,9 +292,7 @@
292 target: main292 target: main
293 ignoreUnknownSignals: true293 ignoreUnknownSignals: true
294 onActiveFocusChanged: {294 onActiveFocusChanged: {
295 if (!main.activeFocus) {295 input.focus = main.activeFocus;
296 input.focus = false;
297 }
298 }296 }
299 onKeyNavigationFocusChanged: {297 onKeyNavigationFocusChanged: {
300 if (main.keyNavigationFocus) {298 if (main.keyNavigationFocus) {
301299
=== modified file 'tests/unit_x11/tst_components/tst_textinput_common13.qml'
--- tests/unit_x11/tst_components/tst_textinput_common13.qml 2016-04-08 07:40:38 +0000
+++ tests/unit_x11/tst_components/tst_textinput_common13.qml 2016-05-11 09:15:23 +0000
@@ -23,7 +23,7 @@
23Item {23Item {
24 id: testMain24 id: testMain
25 width: units.gu(40)25 width: units.gu(40)
26 height: units.gu(50)26 height: units.gu(70)
2727
28 Component {28 Component {
29 id: popoverComponent29 id: popoverComponent
@@ -97,6 +97,32 @@
97 id: textField97 id: textField
98 }98 }
9999
100 FocusScope {
101 id: scope
102 width: textFieldInMouseArea.implicitWidth
103 height: textFieldInMouseArea.implicitHeight
104 TextField {
105 anchors.fill: parent
106 id: textFieldInMouseArea
107 text: 'Lorem ipsum dolor sit amet'
108 color: UbuntuColors.blue
109 }
110 MouseArea {
111 anchors.fill: parent
112 enabled: !scope.activeFocus
113 onClicked: {
114 textFieldInMouseArea.forceActiveFocus()
115 textFieldInMouseArea.selectAll()
116 }
117 Rectangle {
118 anchors.fill: parent
119 color: UbuntuColors.blue
120 opacity: 0.1
121 visible: parent.enabled
122 }
123 }
124 }
125
100 TextField {126 TextField {
101 id: customTextField127 id: customTextField
102 text: 'Lorem ipsum dolor sit amet'128 text: 'Lorem ipsum dolor sit amet'
@@ -198,6 +224,11 @@
198 cursorRectSpy.clear();224 cursorRectSpy.clear();
199 scrollerSpy.clear();225 scrollerSpy.clear();
200 escapePressedSpy.clear();226 escapePressedSpy.clear();
227 // Hide OSK if showing
228 UbuntuApplication.inputMethod.visible = false;
229 // Dismiss popover if any
230 mouseClick(testMain, 1, 1);
231 wait(500);
201 }232 }
202233
203 function test_context_menu_items_data() {234 function test_context_menu_items_data() {
@@ -543,5 +574,22 @@
543 keyClick(Qt.Key_Escape);574 keyClick(Qt.Key_Escape);
544 compare(escapePressedSpy.count, 1);575 compare(escapePressedSpy.count, 1);
545 }576 }
577
578 function test_a_text_field_evokes_osk_data() {
579 return [
580 { tag: 'textField', input: textField },
581 { tag: 'textField with icons', input: customTextField },
582 { tag: 'textArea', input: textArea },
583 { tag: 'focusScope', input: textFieldInMouseArea },
584 ];
585 }
586 function test_a_text_field_evokes_osk(data) {
587 waitForRendering(data.input);
588 compare(data.input.activeFocus, false, 'TextField is not yet focused');
589 mouseClick(data.input);
590 waitForRendering(data.input);
591 compare(data.input.activeFocus, true, 'TextField is focused');
592 compare(UbuntuApplication.inputMethod.visible, true, 'OSK is visible');
593 }
546 }594 }
547}595}

Subscribers

People subscribed via source and target branches

to status/vote changes: