@@ -320,14 +320,21 @@ Item {
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");
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);
@@ -1129,7 +1136,6 @@ Item {
1129 var last = launcherListView.count - 1;
1136 var last = launcherListView.count - 1;
1131 compare(bfbFocusHighlight.visible, false);
1138 compare(bfbFocusHighlight.visible, false);
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 {
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);
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);
1197+ keyClick(Qt.Key_Enter);
1198+ assertFocusOnIndex(-2);
1191 function test_selectQuicklistItemByKeyboard() {
1201 function test_selectQuicklistItemByKeyboard() {