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
1=== modified file 'src/Ubuntu/Components/Popups/1.2/Dialog.qml'
2--- src/Ubuntu/Components/Popups/1.2/Dialog.qml 2015-04-30 08:32:44 +0000
3+++ src/Ubuntu/Components/Popups/1.2/Dialog.qml 2015-11-23 20:21:41 +0000
4@@ -156,6 +156,8 @@
5 activeFocusOnPress: true
6 width: Math.min(minimumWidth, dialog.width)
7 anchors.centerIn: parent
8+ clip: true
9+ objectName: 'dialogForeground'
10
11 // used in the style
12 property string title
13@@ -166,8 +168,9 @@
14 property real margins: units.gu(4)
15 property real itemSpacing: units.gu(2)
16 property Item dismissArea: dialog.dismissArea
17+ property real keyboardHeight: dialog.anchorToKeyboard && UbuntuApplication.inputMethod.visible ? UbuntuApplication.inputMethod.keyboardRectangle.height : 0
18
19- height: Math.min(contentsColumn.height + foreground.margins, dialog.height)
20+ height: Math.min(contentsColumn.height + foreground.margins, dialog.height - keyboardHeight)
21
22 Flickable {
23 anchors.fill: parent
24
25=== modified file 'src/Ubuntu/Components/Popups/1.3/Dialog.qml'
26--- src/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-09-28 14:36:54 +0000
27+++ src/Ubuntu/Components/Popups/1.3/Dialog.qml 2015-11-23 20:21:41 +0000
28@@ -157,6 +157,8 @@
29 focus: visible
30 width: Math.min(minimumWidth, dialog.width)
31 anchors.centerIn: parent
32+ clip: true
33+ objectName: 'dialogForeground'
34
35 // used in the style
36 property string title
37@@ -167,8 +169,9 @@
38 property real margins: units.gu(4)
39 property real itemSpacing: units.gu(2)
40 property Item dismissArea: dialog.dismissArea
41+ property real keyboardHeight: dialog.anchorToKeyboard && UbuntuApplication.inputMethod.visible ? UbuntuApplication.inputMethod.keyboardRectangle.height : 0
42
43- height: Math.min(contentsColumn.height + foreground.margins, dialog.height)
44+ height: Math.min(contentsColumn.height + foreground.margins, dialog.height - keyboardHeight)
45
46 Flickable {
47 anchors.fill: parent
48
49=== modified file 'tests/unit_x11/tst_components/tst_textinput_common.qml'
50--- tests/unit_x11/tst_components/tst_textinput_common.qml 2015-07-03 12:06:16 +0000
51+++ tests/unit_x11/tst_components/tst_textinput_common.qml 2015-11-23 20:21:41 +0000
52@@ -23,7 +23,7 @@
53 Item {
54 id: testMain
55 width: units.gu(40)
56- height: units.gu(71)
57+ height: units.gu(50)
58
59 Component {
60 id: popoverComponent
61@@ -445,5 +445,26 @@
62 verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));
63 }
64
65+ function test_osk_shrinks_dialog() {
66+ var popover = PopupUtils.open(dialogComponent, dialogButton);
67+ waitForRendering(popover);
68+ // Original height before showing OSK
69+ var originalHeight = popover.height;
70+ // Subtract OSK
71+ var expectedHeight = originalHeight - UbuntuApplication.inputMethod.keyboardRectangle.height;
72+ popover.textField.forceActiveFocus();
73+ waitForRendering(popover.textField);
74+ // Only get the value here so in case of failure the popover won't get stuck
75+ var foreground = findChild(popover, "dialogForeground")
76+ var availableHeight = foreground.height;
77+
78+ // dismiss popover
79+ PopupUtils.close(popover);
80+ // add some timeout to get the event buffer cleaned
81+ wait(500);
82+
83+ verify(availableHeight <= expectedHeight, 'Dialog did not shrink (%1 > %2)'.arg(availableHeight).arg(expectedHeight));
84+ }
85+
86 }
87 }
88
89=== modified file 'tests/unit_x11/tst_components/tst_textinput_common13.qml'
90--- tests/unit_x11/tst_components/tst_textinput_common13.qml 2015-11-17 15:17:20 +0000
91+++ tests/unit_x11/tst_components/tst_textinput_common13.qml 2015-11-23 20:21:41 +0000
92@@ -23,7 +23,7 @@
93 Item {
94 id: testMain
95 width: units.gu(40)
96- height: units.gu(71)
97+ height: units.gu(50)
98
99 Component {
100 id: popoverComponent
101@@ -469,6 +469,27 @@
102 verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));
103 }
104
105+ function test_osk_shrinks_dialog() {
106+ var popover = PopupUtils.open(dialogComponent, dialogButton);
107+ waitForRendering(popover);
108+ // Original height before showing OSK
109+ var originalHeight = popover.height;
110+ // Subtract OSK
111+ var expectedHeight = originalHeight - UbuntuApplication.inputMethod.keyboardRectangle.height;
112+ popover.textField.forceActiveFocus();
113+ waitForRendering(popover.textField);
114+ // Only get the value here so in case of failure the popover won't get stuck
115+ var foreground = findChild(popover, "dialogForeground")
116+ var availableHeight = foreground.height;
117+
118+ // dismiss popover
119+ PopupUtils.close(popover);
120+ // add some timeout to get the event buffer cleaned
121+ wait(500);
122+
123+ verify(availableHeight <= expectedHeight, 'Dialog did not shrink (%1 > %2)'.arg(availableHeight).arg(expectedHeight));
124+ }
125+
126 function test_secondaryItem_must_not_grab_focus() {
127 var textField = customTextField;
128 textField.forceActiveFocus();

Subscribers

People subscribed via source and target branches