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

Proposed by Cris Dywan
Status: Merged
Approved by: Timo Jyrinki
Approved revision: 1852
Merged at revision: 1896
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/bottomKeyboard
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 207 lines (+87/-11)
6 files modified
src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml (+14/-0)
src/Ubuntu/Components/plugin/ucbottomedge.cpp (+9/-0)
src/Ubuntu/Components/plugin/ucbottomedgehint.cpp (+10/-2)
tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp (+28/-0)
tests/unit_x11/tst_components/tst_bottomedgehint.qml (+10/-5)
tests/unit_x11/tst_components/tst_focus.qml (+16/-4)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/bottomKeyboard
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Zsombor Egri Approve
Review via email: mp+285592@code.launchpad.net

Commit message

BottomEdge(Hint) focus and close via keyboard

To post a comment you must log in.
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Zsombor Egri (zsombi) wrote :

It feels good, works nicely! Good job!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) 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 'src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml'
2--- src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2016-01-27 15:17:56 +0000
3+++ src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2016-03-15 12:06:06 +0000
4@@ -112,6 +112,9 @@
5 }
6 name: "toolkit_bottom-edge-hint"
7 color: foregroundColor
8+
9+ FocusShape {
10+ }
11 }
12
13 Rectangle {
14@@ -128,6 +131,17 @@
15 anchors.top: parent.top
16 }
17
18+ FocusShape {
19+ anchors {
20+ fill: undefined
21+ margins: 0
22+ top: parent.top
23+ bottom: parent.bottom
24+ horizontalCenter: parent.horizontalCenter
25+ }
26+ // icon, spacing, label, margin on either side
27+ width: icon.width + units.gu(1) + label.width + units.gu(0.46) * 2
28+ }
29 Row {
30 anchors {
31 top: parent.top
32
33=== modified file 'src/Ubuntu/Components/plugin/ucbottomedge.cpp'
34--- src/Ubuntu/Components/plugin/ucbottomedge.cpp 2016-02-20 15:11:02 +0000
35+++ src/Ubuntu/Components/plugin/ucbottomedge.cpp 2016-03-15 12:06:06 +0000
36@@ -831,6 +831,15 @@
37 }
38 break;
39 }
40+ case QEvent::KeyPress: {
41+ QKeyEvent *keyPress = static_cast<QKeyEvent*>(event);
42+ switch (keyPress->key()) {
43+ case Qt::Key_Escape:
44+ collapse();
45+ default:
46+ break;
47+ }
48+ }
49 default: break;
50 }
51 return UCStyledItemBase::eventFilter(target, event);
52
53=== modified file 'src/Ubuntu/Components/plugin/ucbottomedgehint.cpp'
54--- src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2016-02-01 18:57:26 +0000
55+++ src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2016-03-15 12:06:06 +0000
56@@ -198,8 +198,16 @@
57 void UCBottomEdgeHint::keyPressEvent(QKeyEvent *event)
58 {
59 UCActionItem::keyPressEvent(event);
60- if ((status() >= Active) && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)) {
61- Q_EMIT clicked();
62+ if (status() == Hidden)
63+ return;
64+ switch (event->key()) {
65+ case Qt::Key_Enter:
66+ case Qt::Key_Return:
67+ case Qt::Key_Space:
68+ Q_EMIT clicked();
69+ break;
70+ default:
71+ break;
72 }
73 }
74
75
76=== modified file 'tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp'
77--- tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2016-02-20 15:11:02 +0000
78+++ tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2016-03-15 12:06:06 +0000
79@@ -31,6 +31,8 @@
80 #include "ucbottomedgestyle.h"
81 #undef private
82
83+Q_DECLARE_METATYPE(Qt::Key)
84+
85 #define QVERIFY_RETURN(statement, returnValue) \
86 do {\
87 if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\
88@@ -889,6 +891,32 @@
89 QCOMPARE(bottomEdge->isEnabled(), bottomEdge->hint()->isEnabled());
90 }
91
92+ void test_collapse_by_keyboard_data()
93+ {
94+ QTest::addColumn<Qt::Key>("key");
95+
96+ QTest::newRow("space") << Qt::Key_Space;
97+ QTest::newRow("enter") << Qt::Key_Enter;
98+ QTest::newRow("return") << Qt::Key_Return;
99+ }
100+ void test_collapse_by_keyboard() {
101+ QFETCH(Qt::Key, key);
102+
103+ QScopedPointer<BottomEdgeTestCase> view(new BottomEdgeTestCase("Defaults.qml"));
104+ view->rootObject()->forceActiveFocus();
105+ QTRY_COMPARE_WITH_TIMEOUT(view->rootObject()->property("activeFocus").toBool(), true, 1000);
106+ UCBottomEdge *bottomEdge = view->testItem();
107+ QTest::keyClick(bottomEdge->hint()->window(), Qt::Key_Tab);
108+ QTRY_COMPARE_WITH_TIMEOUT(bottomEdge->hint()->property("activeFocus").toBool(), true, 1000);
109+ QTRY_COMPARE_WITH_TIMEOUT(bottomEdge->hint()->property("keyNavigationFocus").toBool(), true, 1000);
110+ QTest::keyClick(bottomEdge->hint()->window(), key);
111+ QSignalSpy commitCompletedSpy(bottomEdge, SIGNAL(commitCompleted()));
112+ QTRY_COMPARE_WITH_TIMEOUT(commitCompletedSpy.count(), 1, 1000);
113+ QTest::keyClick(bottomEdge->hint()->window(), Qt::Key_Escape);
114+ QSignalSpy collapseCompletedSpy(bottomEdge, SIGNAL(collapseCompleted()));
115+ QTRY_COMPARE_WITH_TIMEOUT(collapseCompletedSpy.count(), 1, 1000);
116+ }
117+
118 void test_preload_content()
119 {
120 QScopedPointer<BottomEdgeTestCase> test(new BottomEdgeTestCase("PreloadedContent.qml"));
121
122=== modified file 'tests/unit_x11/tst_components/tst_bottomedgehint.qml'
123--- tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-12-07 10:05:10 +0000
124+++ tests/unit_x11/tst_components/tst_bottomedgehint.qml 2016-03-15 12:06:06 +0000
125@@ -188,20 +188,25 @@
126 return [
127 {tag: "enter and unlocked", key: Qt.Key_Return, status: BottomEdgeHint.Inactive},
128 {tag: "return and unlocked", key: Qt.Key_Enter, status: BottomEdgeHint.Inactive},
129+ {tag: "space and unlocked", key: Qt.Key_Space, status: BottomEdgeHint.Inactive},
130 {tag: "enter and locked", key: Qt.Key_Return, status: BottomEdgeHint.Locked},
131 {tag: "return and locked", key: Qt.Key_Enter, status: BottomEdgeHint.Locked},
132+ {tag: "space and locked", key: Qt.Key_Space, status: BottomEdgeHint.Locked},
133 ];
134 }
135 function test_activate_by_key(data) {
136- if (hasMouseAttached && !data.locked) {
137- skip(data.tag, "Test requires ability to unlock");
138+ switch (data.status) {
139+ case BottomEdgeHint.Inactive:
140+ QuickUtils.mouseAttached = false; break;
141+ case BottomEdgeHint.Locked:
142+ QuickUtils.mouseAttached = true; break;
143+ default:
144+ fail("Unexpected status %1".arg(data.status));
145 }
146 bottomEdgeHint.status = data.status;
147 bottomEdgeHint.forceActiveFocus();
148+ verify(bottomEdgeHint.activeFocus, "Hint doesn't have the focus");
149 keyPress(data.key);
150- if (bottomEdgeHint.status != BottomEdgeHint.Locked) {
151- expectFailContinue(data.tag, "should fail");
152- }
153 clickSpy.wait(400);
154 keyRelease(data.key);
155 }
156
157=== modified file 'tests/unit_x11/tst_components/tst_focus.qml'
158--- tests/unit_x11/tst_components/tst_focus.qml 2016-02-11 17:31:14 +0000
159+++ tests/unit_x11/tst_components/tst_focus.qml 2016-03-15 12:06:06 +0000
160@@ -66,6 +66,11 @@
161 id: textArea
162 text: "This is a text area with some text handling focus"
163 }
164+ Item {
165+ BottomEdgeHint {
166+ id: bottomEdgeHint
167+ }
168+ }
169 Button {
170 id: button
171 text: "Press me"
172@@ -198,7 +203,10 @@
173 {tag: "TextField(back)", from: textField, to: dummy, key: Qt.Key_Backtab},
174 {tag: "TextArea", from: textField, to: textArea, key: Qt.Key_Tab},
175 {tag: "TextArea(back)", from: textArea, to: textField, key: Qt.Key_Backtab},
176- {tag: "Button(back)", from: button, to: textArea, key: Qt.Key_Backtab},
177+ {tag: "BottomEdgeHint", from: textArea, to: bottomEdgeHint, key: Qt.Key_Tab},
178+ {tag: "BottomEdgeHint(back)", from: bottomEdgeHint, to: textArea, key: Qt.Key_Backtab},
179+ {tag: "Button", from: bottomEdgeHint, to: button, key: Qt.Key_Tab},
180+ {tag: "Button(back)", from: button, to: bottomEdgeHint, key: Qt.Key_Backtab},
181 {tag: "CheckBox", from: checkbox, to: switchbox, key: Qt.Key_Tab},
182 {tag: "CheckBox", from: switchbox, to: checkbox, key: Qt.Key_Backtab},
183 {tag: "Switch", from: switchbox, to: slider, key: Qt.Key_Tab},
184@@ -220,8 +228,11 @@
185 ];
186 }
187 function test_tab_focus(data) {
188- data.from.forceActiveFocus();
189- verify(data.from.activeFocus, "Source component is not focused");
190+ data.from.focus = true;
191+ verify(data.from.enabled, "Source component is invalid");
192+ verify(data.to.enabled, "Target component is invalid");
193+ verify(data.from.activeFocus, "Source component is not focused - focus is on %1"
194+ .arg(String(window.activeFocusItem).split("(")[0]));
195 if (data.key == Qt.LeftButton) {
196 verify(data.to.activeFocusOnPress, "Target doesn't take focus on click");
197 mouseClick(data.to, centerOf(data.to).x, centerOf(data.to).y);
198@@ -231,7 +242,8 @@
199 }
200 waitForRendering(data.to, 500);
201 verify(!data.from.activeFocus, "Source component still keeps focus");
202- verify(data.to.activeFocus, "Target component is not focused");
203+ verify(data.to.activeFocus, "Target component is not focused - focus is on %1"
204+ .arg(String(window.activeFocusItem).split("(")[0]));
205 }
206
207 function test_hide_osk_when_pickerpanel_opens() {

Subscribers

People subscribed via source and target branches