Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/squeezedDialogs into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Cris Dywan
Approved revision: 1725
Merged at revision: 1726
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/squeezedDialogs
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 128 lines (+52/-4)
4 files modified
src/Ubuntu/Components/Popups/1.2/Dialog.qml (+4/-1)
src/Ubuntu/Components/Popups/1.3/Dialog.qml (+4/-1)
tests/unit_x11/tst_components/tst_textinput_common.qml (+22/-1)
tests/unit_x11/tst_components/tst_textinput_common13.qml (+22/-1)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/squeezedDialogs
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve
Zsombor Egri Approve
Review via email: mp+278368@code.launchpad.net

Commit message

Explicitly handle keyboard anchoring in dialog foreground

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

Shrink it, baby, shrink it!! Nice job!

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

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Ubuntu/Components/Popups/1.2/Dialog.qml'
--- src/Ubuntu/Components/Popups/1.2/Dialog.qml 2015-04-30 08:32:44 +0000
+++ src/Ubuntu/Components/Popups/1.2/Dialog.qml 2015-11-23 20:21:41 +0000
@@ -156,6 +156,8 @@
156 activeFocusOnPress: true156 activeFocusOnPress: true
157 width: Math.min(minimumWidth, dialog.width)157 width: Math.min(minimumWidth, dialog.width)
158 anchors.centerIn: parent158 anchors.centerIn: parent
159 clip: true
160 objectName: 'dialogForeground'
159161
160 // used in the style162 // used in the style
161 property string title163 property string title
@@ -166,8 +168,9 @@
166 property real margins: units.gu(4)168 property real margins: units.gu(4)
167 property real itemSpacing: units.gu(2)169 property real itemSpacing: units.gu(2)
168 property Item dismissArea: dialog.dismissArea170 property Item dismissArea: dialog.dismissArea
171 property real keyboardHeight: dialog.anchorToKeyboard && UbuntuApplication.inputMethod.visible ? UbuntuApplication.inputMethod.keyboardRectangle.height : 0
169172
170 height: Math.min(contentsColumn.height + foreground.margins, dialog.height)173 height: Math.min(contentsColumn.height + foreground.margins, dialog.height - keyboardHeight)
171174
172 Flickable {175 Flickable {
173 anchors.fill: parent176 anchors.fill: parent
174177
=== modified file 'src/Ubuntu/Components/Popups/1.3/Dialog.qml'
--- src/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-09-28 14:36:54 +0000
+++ src/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-11-23 20:21:41 +0000
@@ -157,6 +157,8 @@
157 focus: visible157 focus: visible
158 width: Math.min(minimumWidth, dialog.width)158 width: Math.min(minimumWidth, dialog.width)
159 anchors.centerIn: parent159 anchors.centerIn: parent
160 clip: true
161 objectName: 'dialogForeground'
160162
161 // used in the style163 // used in the style
162 property string title164 property string title
@@ -167,8 +169,9 @@
167 property real margins: units.gu(4)169 property real margins: units.gu(4)
168 property real itemSpacing: units.gu(2)170 property real itemSpacing: units.gu(2)
169 property Item dismissArea: dialog.dismissArea171 property Item dismissArea: dialog.dismissArea
172 property real keyboardHeight: dialog.anchorToKeyboard && UbuntuApplication.inputMethod.visible ? UbuntuApplication.inputMethod.keyboardRectangle.height : 0
170173
171 height: Math.min(contentsColumn.height + foreground.margins, dialog.height)174 height: Math.min(contentsColumn.height + foreground.margins, dialog.height - keyboardHeight)
172175
173 Flickable {176 Flickable {
174 anchors.fill: parent177 anchors.fill: parent
175178
=== modified file 'tests/unit_x11/tst_components/tst_textinput_common.qml'
--- tests/unit_x11/tst_components/tst_textinput_common.qml 2015-07-03 12:06:16 +0000
+++ tests/unit_x11/tst_components/tst_textinput_common.qml 2015-11-23 20:21:41 +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(71)26 height: units.gu(50)
2727
28 Component {28 Component {
29 id: popoverComponent29 id: popoverComponent
@@ -445,5 +445,26 @@
445 verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));445 verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));
446 }446 }
447447
448 function test_osk_shrinks_dialog() {
449 var popover = PopupUtils.open(dialogComponent, dialogButton);
450 waitForRendering(popover);
451 // Original height before showing OSK
452 var originalHeight = popover.height;
453 // Subtract OSK
454 var expectedHeight = originalHeight - UbuntuApplication.inputMethod.keyboardRectangle.height;
455 popover.textField.forceActiveFocus();
456 waitForRendering(popover.textField);
457 // Only get the value here so in case of failure the popover won't get stuck
458 var foreground = findChild(popover, "dialogForeground")
459 var availableHeight = foreground.height;
460
461 // dismiss popover
462 PopupUtils.close(popover);
463 // add some timeout to get the event buffer cleaned
464 wait(500);
465
466 verify(availableHeight <= expectedHeight, 'Dialog did not shrink (%1 > %2)'.arg(availableHeight).arg(expectedHeight));
467 }
468
448 }469 }
449}470}
450471
=== modified file 'tests/unit_x11/tst_components/tst_textinput_common13.qml'
--- tests/unit_x11/tst_components/tst_textinput_common13.qml 2015-11-17 15:17:20 +0000
+++ tests/unit_x11/tst_components/tst_textinput_common13.qml 2015-11-23 20:21:41 +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(71)26 height: units.gu(50)
2727
28 Component {28 Component {
29 id: popoverComponent29 id: popoverComponent
@@ -469,6 +469,27 @@
469 verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));469 verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));
470 }470 }
471471
472 function test_osk_shrinks_dialog() {
473 var popover = PopupUtils.open(dialogComponent, dialogButton);
474 waitForRendering(popover);
475 // Original height before showing OSK
476 var originalHeight = popover.height;
477 // Subtract OSK
478 var expectedHeight = originalHeight - UbuntuApplication.inputMethod.keyboardRectangle.height;
479 popover.textField.forceActiveFocus();
480 waitForRendering(popover.textField);
481 // Only get the value here so in case of failure the popover won't get stuck
482 var foreground = findChild(popover, "dialogForeground")
483 var availableHeight = foreground.height;
484
485 // dismiss popover
486 PopupUtils.close(popover);
487 // add some timeout to get the event buffer cleaned
488 wait(500);
489
490 verify(availableHeight <= expectedHeight, 'Dialog did not shrink (%1 > %2)'.arg(availableHeight).arg(expectedHeight));
491 }
492
472 function test_secondaryItem_must_not_grab_focus() {493 function test_secondaryItem_must_not_grab_focus() {
473 var textField = customTextField;494 var textField = customTextField;
474 textField.forceActiveFocus();495 textField.forceActiveFocus();

Subscribers

People subscribed via source and target branches