on xenial help sign in
merge prereq
391bd94Michael Zanetti
qml/Launcher/Launcher.qml+2−1
@@ -175,7 +175,7 @@ FocusScope {
175 event.accepted = true;
175 event.accepted = true;
176 break;
176 break;
177 case Qt.Key_Escape:
177 case Qt.Key_Escape:
178− panel.highlightIndex = -2
178+ panel.highlightIndex = -2;
179 // Falling through intentionally
179 // Falling through intentionally
180 case Qt.Key_Enter:
180 case Qt.Key_Enter:
181 case Qt.Key_Return:
181 case Qt.Key_Return:
@@ -186,6 +186,7 @@ FocusScope {
186 launcherApplicationSelected(LauncherModel.get(panel.highlightIndex).appId);
186 launcherApplicationSelected(LauncherModel.get(panel.highlightIndex).appId);
187 }
187 }
188 root.hide();
188 root.hide();
189+ panel.highlightIndex = -2
189 event.accepted = true;
190 event.accepted = true;
190 root.focus = false;
191 root.focus = false;
191 }
192 }
tests/qmltests/Launcher/tst_Launcher.qml+13−3
@@ -320,14 +320,21 @@ Item {
320 }
320 }
321
321
322 function assertFocusOnIndex(index) {
322 function assertFocusOnIndex(index) {
323+ var launcherPanel = findChild(launcher, "launcherPanel");
323 var launcherListView = findChild(launcher, "launcherListView");
324 var launcherListView = findChild(launcher, "launcherListView");
324 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
325 var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
325
326
326 waitForRendering(launcher);
327 waitForRendering(launcher);
328+ tryCompare(launcherPanel, "highlightIndex", index);
327 compare(bfbFocusHighlight.visible, index === -1);
329 compare(bfbFocusHighlight.visible, index === -1);
328 for (var i = 0; i < launcherListView.count; i++) {
330 for (var i = 0; i < launcherListView.count; i++) {
329− var focusRing = findChild(findChild(launcher, "launcherDelegate" + i), "focusRing")
331+ var item = findChild(launcher, "launcherDelegate" + i);
332+ // Delegates might be destroyed when not visible. We can't check if they paint a focus highlight.
333+ // Make sure the requested index does have focus. for the others, try best effort to check if they don't
334+ if (index === i || item) {
335+ var focusRing = findChild(item, "focusRing")
330− compare(focusRing.visible, index === i);
336+ tryCompare(focusRing, "visible", index === i);
337+ }
331 }
338 }
332 }
339 }
333
340
@@ -1129,7 +1136,6 @@ Item {
1129 var last = launcherListView.count - 1;
1136 var last = launcherListView.count - 1;
1130
1137
1131 compare(bfbFocusHighlight.visible, false);
1138 compare(bfbFocusHighlight.visible, false);
1132−
1133 launcher.openForKeyboardNavigation();
1139 launcher.openForKeyboardNavigation();
1134 tryCompare(launcherPanel, "x", 0);
1140 tryCompare(launcherPanel, "x", 0);
1135 waitForRendering(launcher);
1141 waitForRendering(launcher);
@@ -1154,6 +1160,7 @@ Item {
1154
1160
1155 // The list should wrap around
1161 // The list should wrap around
1156 keyClick(Qt.Key_Up);
1162 keyClick(Qt.Key_Up);
1163+ waitForRendering(launcher);
1157 assertFocusOnIndex(last);
1164 assertFocusOnIndex(last);
1158
1165
1159 keyClick(Qt.Key_Down);
1166 keyClick(Qt.Key_Down);
@@ -1186,6 +1193,9 @@ Item {
1186 // Go bar to top by wrapping around
1193 // Go bar to top by wrapping around
1187 keyClick(Qt.Key_Down);
1194 keyClick(Qt.Key_Down);
1188 assertFocusOnIndex(1);
1195 assertFocusOnIndex(1);
1196+
1197+ keyClick(Qt.Key_Enter);
1198+ assertFocusOnIndex(-2);
1189 }
1199 }
1190
1200
1191 function test_selectQuicklistItemByKeyboard() {
1201 function test_selectQuicklistItemByKeyboard() {