@@ -288,14 +288,20 @@ Item {
290 function assertFocusOnIndex(index) {
290 function assertFocusOnIndex(index) {
291+ var launcherPanel = findChild(launcherLoader.item, "launcherPanel");
291− var launcherListView = findChild(launcher, "launcherListView");
292+ var launcherListView = findChild(launcherLoader.item, "launcherListView");
292− var bfbFocusHighlight = findChild(launcher, "bfbFocusHighlight");
293+ var bfbFocusHighlight = findChild(launcherLoader.item, "bfbFocusHighlight");
294− waitForRendering(launcher);
294+ waitForRendering(launcherLoader.item);
295+ tryCompare(launcherPanel, "highlightIndex", index);
295 tryCompare(bfbFocusHighlight, "visible", index === -1);
296 tryCompare(bfbFocusHighlight, "visible", index === -1);
296 for (var i = 0; i < launcherListView.count; i++) {
297 for (var i = 0; i < launcherListView.count; i++) {
297− var focusRing = findChild(findChild(launcher, "launcherDelegate" + i), "focusRing")
298+ var item = findChild(launcher, "launcherDelegate" + i);
299+ // Delegates might be destroyed when not visible. We can't check if they paint a focus highlight.
300+ // Make sure the requested index does have focus. for the others, try best effort to check if they don't
301+ if (index === i || item) {
302+ var focusRing = findChild(item, "focusRing")
298− tryCompare(focusRing, "visible", index === i);
303+ tryCompare(focusRing, "visible", index === i);
@@ -1090,7 +1096,6 @@ Item {
1090 var last = launcherListView.count - 1;
1096 var last = launcherListView.count - 1;
1092 compare(bfbFocusHighlight.visible, false);
1098 compare(bfbFocusHighlight.visible, false);
1094 launcher.openForKeyboardNavigation();
1099 launcher.openForKeyboardNavigation();
1096 assertFocusOnIndex(-1);
1101 assertFocusOnIndex(-1);
@@ -1113,6 +1118,7 @@ Item {
1114 // The list should wrap around
1119 // The list should wrap around
1115 keyClick(Qt.Key_Up);
1120 keyClick(Qt.Key_Up);
1121+ waitForRendering(launcher);
1116 assertFocusOnIndex(last);
1122 assertFocusOnIndex(last);
1118 keyClick(Qt.Key_Down);
1124 keyClick(Qt.Key_Down);
@@ -1145,6 +1151,9 @@ Item {
1145 // Go bar to top by wrapping around
1151 // Go bar to top by wrapping around
1146 keyClick(Qt.Key_Down);
1152 keyClick(Qt.Key_Down);
1147 assertFocusOnIndex(1);
1153 assertFocusOnIndex(1);
1155+ keyClick(Qt.Key_Enter);
1156+ assertFocusOnIndex(-2);
1150 function test_selectQuicklistItemByKeyboard() {
1159 function test_selectQuicklistItemByKeyboard() {