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
=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml'
--- src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2016-01-27 15:17:56 +0000
+++ src/Ubuntu/Components/Themes/Ambiance/1.3/BottomEdgeHintStyle.qml 2016-03-15 12:06:06 +0000
@@ -112,6 +112,9 @@
112 }112 }
113 name: "toolkit_bottom-edge-hint"113 name: "toolkit_bottom-edge-hint"
114 color: foregroundColor114 color: foregroundColor
115
116 FocusShape {
117 }
115 }118 }
116119
117 Rectangle {120 Rectangle {
@@ -128,6 +131,17 @@
128 anchors.top: parent.top131 anchors.top: parent.top
129 }132 }
130133
134 FocusShape {
135 anchors {
136 fill: undefined
137 margins: 0
138 top: parent.top
139 bottom: parent.bottom
140 horizontalCenter: parent.horizontalCenter
141 }
142 // icon, spacing, label, margin on either side
143 width: icon.width + units.gu(1) + label.width + units.gu(0.46) * 2
144 }
131 Row {145 Row {
132 anchors {146 anchors {
133 top: parent.top147 top: parent.top
134148
=== modified file 'src/Ubuntu/Components/plugin/ucbottomedge.cpp'
--- src/Ubuntu/Components/plugin/ucbottomedge.cpp 2016-02-20 15:11:02 +0000
+++ src/Ubuntu/Components/plugin/ucbottomedge.cpp 2016-03-15 12:06:06 +0000
@@ -831,6 +831,15 @@
831 }831 }
832 break;832 break;
833 }833 }
834 case QEvent::KeyPress: {
835 QKeyEvent *keyPress = static_cast<QKeyEvent*>(event);
836 switch (keyPress->key()) {
837 case Qt::Key_Escape:
838 collapse();
839 default:
840 break;
841 }
842 }
834 default: break;843 default: break;
835 }844 }
836 return UCStyledItemBase::eventFilter(target, event);845 return UCStyledItemBase::eventFilter(target, event);
837846
=== modified file 'src/Ubuntu/Components/plugin/ucbottomedgehint.cpp'
--- src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2016-02-01 18:57:26 +0000
+++ src/Ubuntu/Components/plugin/ucbottomedgehint.cpp 2016-03-15 12:06:06 +0000
@@ -198,8 +198,16 @@
198void UCBottomEdgeHint::keyPressEvent(QKeyEvent *event)198void UCBottomEdgeHint::keyPressEvent(QKeyEvent *event)
199{199{
200 UCActionItem::keyPressEvent(event);200 UCActionItem::keyPressEvent(event);
201 if ((status() >= Active) && (event->key() == Qt::Key_Enter || event->key() == Qt::Key_Return)) {201 if (status() == Hidden)
202 Q_EMIT clicked();202 return;
203 switch (event->key()) {
204 case Qt::Key_Enter:
205 case Qt::Key_Return:
206 case Qt::Key_Space:
207 Q_EMIT clicked();
208 break;
209 default:
210 break;
203 }211 }
204}212}
205213
206214
=== modified file 'tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp'
--- tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2016-02-20 15:11:02 +0000
+++ tests/unit_x11/tst_bottomedge/tst_bottomedge.cpp 2016-03-15 12:06:06 +0000
@@ -31,6 +31,8 @@
31#include "ucbottomedgestyle.h"31#include "ucbottomedgestyle.h"
32#undef private32#undef private
3333
34Q_DECLARE_METATYPE(Qt::Key)
35
34#define QVERIFY_RETURN(statement, returnValue) \36#define QVERIFY_RETURN(statement, returnValue) \
35do {\37do {\
36 if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\38 if (!QTest::qVerify((statement), #statement, "", __FILE__, __LINE__))\
@@ -889,6 +891,32 @@
889 QCOMPARE(bottomEdge->isEnabled(), bottomEdge->hint()->isEnabled());891 QCOMPARE(bottomEdge->isEnabled(), bottomEdge->hint()->isEnabled());
890 }892 }
891893
894 void test_collapse_by_keyboard_data()
895 {
896 QTest::addColumn<Qt::Key>("key");
897
898 QTest::newRow("space") << Qt::Key_Space;
899 QTest::newRow("enter") << Qt::Key_Enter;
900 QTest::newRow("return") << Qt::Key_Return;
901 }
902 void test_collapse_by_keyboard() {
903 QFETCH(Qt::Key, key);
904
905 QScopedPointer<BottomEdgeTestCase> view(new BottomEdgeTestCase("Defaults.qml"));
906 view->rootObject()->forceActiveFocus();
907 QTRY_COMPARE_WITH_TIMEOUT(view->rootObject()->property("activeFocus").toBool(), true, 1000);
908 UCBottomEdge *bottomEdge = view->testItem();
909 QTest::keyClick(bottomEdge->hint()->window(), Qt::Key_Tab);
910 QTRY_COMPARE_WITH_TIMEOUT(bottomEdge->hint()->property("activeFocus").toBool(), true, 1000);
911 QTRY_COMPARE_WITH_TIMEOUT(bottomEdge->hint()->property("keyNavigationFocus").toBool(), true, 1000);
912 QTest::keyClick(bottomEdge->hint()->window(), key);
913 QSignalSpy commitCompletedSpy(bottomEdge, SIGNAL(commitCompleted()));
914 QTRY_COMPARE_WITH_TIMEOUT(commitCompletedSpy.count(), 1, 1000);
915 QTest::keyClick(bottomEdge->hint()->window(), Qt::Key_Escape);
916 QSignalSpy collapseCompletedSpy(bottomEdge, SIGNAL(collapseCompleted()));
917 QTRY_COMPARE_WITH_TIMEOUT(collapseCompletedSpy.count(), 1, 1000);
918 }
919
892 void test_preload_content()920 void test_preload_content()
893 {921 {
894 QScopedPointer<BottomEdgeTestCase> test(new BottomEdgeTestCase("PreloadedContent.qml"));922 QScopedPointer<BottomEdgeTestCase> test(new BottomEdgeTestCase("PreloadedContent.qml"));
895923
=== modified file 'tests/unit_x11/tst_components/tst_bottomedgehint.qml'
--- tests/unit_x11/tst_components/tst_bottomedgehint.qml 2015-12-07 10:05:10 +0000
+++ tests/unit_x11/tst_components/tst_bottomedgehint.qml 2016-03-15 12:06:06 +0000
@@ -188,20 +188,25 @@
188 return [188 return [
189 {tag: "enter and unlocked", key: Qt.Key_Return, status: BottomEdgeHint.Inactive},189 {tag: "enter and unlocked", key: Qt.Key_Return, status: BottomEdgeHint.Inactive},
190 {tag: "return and unlocked", key: Qt.Key_Enter, status: BottomEdgeHint.Inactive},190 {tag: "return and unlocked", key: Qt.Key_Enter, status: BottomEdgeHint.Inactive},
191 {tag: "space and unlocked", key: Qt.Key_Space, status: BottomEdgeHint.Inactive},
191 {tag: "enter and locked", key: Qt.Key_Return, status: BottomEdgeHint.Locked},192 {tag: "enter and locked", key: Qt.Key_Return, status: BottomEdgeHint.Locked},
192 {tag: "return and locked", key: Qt.Key_Enter, status: BottomEdgeHint.Locked},193 {tag: "return and locked", key: Qt.Key_Enter, status: BottomEdgeHint.Locked},
194 {tag: "space and locked", key: Qt.Key_Space, status: BottomEdgeHint.Locked},
193 ];195 ];
194 }196 }
195 function test_activate_by_key(data) {197 function test_activate_by_key(data) {
196 if (hasMouseAttached && !data.locked) {198 switch (data.status) {
197 skip(data.tag, "Test requires ability to unlock");199 case BottomEdgeHint.Inactive:
200 QuickUtils.mouseAttached = false; break;
201 case BottomEdgeHint.Locked:
202 QuickUtils.mouseAttached = true; break;
203 default:
204 fail("Unexpected status %1".arg(data.status));
198 }205 }
199 bottomEdgeHint.status = data.status;206 bottomEdgeHint.status = data.status;
200 bottomEdgeHint.forceActiveFocus();207 bottomEdgeHint.forceActiveFocus();
208 verify(bottomEdgeHint.activeFocus, "Hint doesn't have the focus");
201 keyPress(data.key);209 keyPress(data.key);
202 if (bottomEdgeHint.status != BottomEdgeHint.Locked) {
203 expectFailContinue(data.tag, "should fail");
204 }
205 clickSpy.wait(400);210 clickSpy.wait(400);
206 keyRelease(data.key);211 keyRelease(data.key);
207 }212 }
208213
=== modified file 'tests/unit_x11/tst_components/tst_focus.qml'
--- tests/unit_x11/tst_components/tst_focus.qml 2016-02-11 17:31:14 +0000
+++ tests/unit_x11/tst_components/tst_focus.qml 2016-03-15 12:06:06 +0000
@@ -66,6 +66,11 @@
66 id: textArea66 id: textArea
67 text: "This is a text area with some text handling focus"67 text: "This is a text area with some text handling focus"
68 }68 }
69 Item {
70 BottomEdgeHint {
71 id: bottomEdgeHint
72 }
73 }
69 Button {74 Button {
70 id: button75 id: button
71 text: "Press me"76 text: "Press me"
@@ -198,7 +203,10 @@
198 {tag: "TextField(back)", from: textField, to: dummy, key: Qt.Key_Backtab},203 {tag: "TextField(back)", from: textField, to: dummy, key: Qt.Key_Backtab},
199 {tag: "TextArea", from: textField, to: textArea, key: Qt.Key_Tab},204 {tag: "TextArea", from: textField, to: textArea, key: Qt.Key_Tab},
200 {tag: "TextArea(back)", from: textArea, to: textField, key: Qt.Key_Backtab},205 {tag: "TextArea(back)", from: textArea, to: textField, key: Qt.Key_Backtab},
201 {tag: "Button(back)", from: button, to: textArea, key: Qt.Key_Backtab},206 {tag: "BottomEdgeHint", from: textArea, to: bottomEdgeHint, key: Qt.Key_Tab},
207 {tag: "BottomEdgeHint(back)", from: bottomEdgeHint, to: textArea, key: Qt.Key_Backtab},
208 {tag: "Button", from: bottomEdgeHint, to: button, key: Qt.Key_Tab},
209 {tag: "Button(back)", from: button, to: bottomEdgeHint, key: Qt.Key_Backtab},
202 {tag: "CheckBox", from: checkbox, to: switchbox, key: Qt.Key_Tab},210 {tag: "CheckBox", from: checkbox, to: switchbox, key: Qt.Key_Tab},
203 {tag: "CheckBox", from: switchbox, to: checkbox, key: Qt.Key_Backtab},211 {tag: "CheckBox", from: switchbox, to: checkbox, key: Qt.Key_Backtab},
204 {tag: "Switch", from: switchbox, to: slider, key: Qt.Key_Tab},212 {tag: "Switch", from: switchbox, to: slider, key: Qt.Key_Tab},
@@ -220,8 +228,11 @@
220 ];228 ];
221 }229 }
222 function test_tab_focus(data) {230 function test_tab_focus(data) {
223 data.from.forceActiveFocus();231 data.from.focus = true;
224 verify(data.from.activeFocus, "Source component is not focused");232 verify(data.from.enabled, "Source component is invalid");
233 verify(data.to.enabled, "Target component is invalid");
234 verify(data.from.activeFocus, "Source component is not focused - focus is on %1"
235 .arg(String(window.activeFocusItem).split("(")[0]));
225 if (data.key == Qt.LeftButton) {236 if (data.key == Qt.LeftButton) {
226 verify(data.to.activeFocusOnPress, "Target doesn't take focus on click");237 verify(data.to.activeFocusOnPress, "Target doesn't take focus on click");
227 mouseClick(data.to, centerOf(data.to).x, centerOf(data.to).y);238 mouseClick(data.to, centerOf(data.to).x, centerOf(data.to).y);
@@ -231,7 +242,8 @@
231 }242 }
232 waitForRendering(data.to, 500);243 waitForRendering(data.to, 500);
233 verify(!data.from.activeFocus, "Source component still keeps focus");244 verify(!data.from.activeFocus, "Source component still keeps focus");
234 verify(data.to.activeFocus, "Target component is not focused");245 verify(data.to.activeFocus, "Target component is not focused - focus is on %1"
246 .arg(String(window.activeFocusItem).split("(")[0]));
235 }247 }
236248
237 function test_hide_osk_when_pickerpanel_opens() {249 function test_hide_osk_when_pickerpanel_opens() {

Subscribers

People subscribed via source and target branches