@@ -153,9 +153,6 @@ Item {
154 var priv = findInvisibleChild(menu, "d");
154 var priv = findInvisibleChild(menu, "d");
156− keyClick(Qt.Key_Down, Qt.NoModifier);
157− compare(priv.currentItem, item0, "CurrentItem should have moved to item 0");
159 keyClick(Qt.Key_Down, Qt.NoModifier);
156 keyClick(Qt.Key_Down, Qt.NoModifier);
160 compare(priv.currentItem, item1, "CurrentItem should have moved to item 1");
157 compare(priv.currentItem, item1, "CurrentItem should have moved to item 1");
@@ -164,6 +161,9 @@ Item {
165 keyClick(Qt.Key_Down, Qt.NoModifier);
162 keyClick(Qt.Key_Down, Qt.NoModifier);
166 compare(priv.currentItem, item0, "CurrentItem should have moved to item 0");
163 compare(priv.currentItem, item0, "CurrentItem should have moved to item 0");
165+ keyClick(Qt.Key_Down, Qt.NoModifier);
166+ compare(priv.currentItem, item1, "CurrentItem should have moved to item 1");
169 function test_keyboardNavigation_UpKeySelectsAndOpensPreviousMenuItemAndRotates() {
169 function test_keyboardNavigation_UpKeySelectsAndOpensPreviousMenuItemAndRotates() {
@@ -175,17 +175,17 @@ Item {
176 var priv = findInvisibleChild(menu, "d");
176 var priv = findInvisibleChild(menu, "d");
178− keyClick(Qt.Key_Down, Qt.NoModifier);
178+ keyClick(Qt.Key_Up, Qt.NoModifier);
179− compare(priv.currentItem, item0, "CurrentItem should have moved to item 2");
179+ compare(priv.currentItem, item2, "CurrentItem should have moved to item 2");
181− keyClick(Qt.Key_Down, Qt.NoModifier);
181+ keyClick(Qt.Key_Up, Qt.NoModifier);
182 compare(priv.currentItem, item1, "CurrentItem should have moved to item 1");
182 compare(priv.currentItem, item1, "CurrentItem should have moved to item 1");
184− keyClick(Qt.Key_Down, Qt.NoModifier);
184+ keyClick(Qt.Key_Up, Qt.NoModifier);
185− compare(priv.currentItem, item2, "CurrentItem should have moved to item 0");
185+ compare(priv.currentItem, item0, "CurrentItem should have moved to item 0");
187− keyClick(Qt.Key_Down, Qt.NoModifier);
187+ keyClick(Qt.Key_Up, Qt.NoModifier);
188− compare(priv.currentItem, item0, "CurrentItem should have moved to item 2");
188+ compare(priv.currentItem, item2, "CurrentItem should have moved to item 2");
191 function test_aboutToShow() {
191 function test_aboutToShow() {
@@ -242,7 +242,7 @@ Item {
243 var menuItem = findChild(menu, "menu-item0"); verify(menuItem);
243 var menuItem = findChild(menu, "menu-item0"); verify(menuItem);
244 mouseClick(menuItem, menuItem.width/2, menuItem.height/2);
244 mouseClick(menuItem, menuItem.width/2, menuItem.height/2);
245− tryCompareFunction(function() { return menuItem.popup !== null && menuItem.popup.visible }, true);
245+ tryCompareFunction(function() { return menuItem.popup !== null && findInvisibleChild(menuItem.popup, "d").currentItem !== null }, true);
247 keyClick(Qt.Key_Left, Qt.NoModifier);
247 keyClick(Qt.Key_Left, Qt.NoModifier);
248 tryCompareFunction(function() { return menuItem.popup !== null && menuItem.popup.visible }, false);
248 tryCompareFunction(function() { return menuItem.popup !== null && menuItem.popup.visible }, false);
@@ -270,13 +270,16 @@ Item {
271 menu.unityMenuModel.modelData = differentSizesMenu;
271 menu.unityMenuModel.modelData = differentSizesMenu;
273− waitForRendering(menu);
273+ // Wait for the two items to be there
274+ tryCompareFunction(function() { return findChild(menu, "menu-item1") !== null; }, true);
274 var longWidth = menu.width;
275 var longWidth = menu.width;
277+ // Now pop one item and make sure it's smaller
275 differentSizesMenu.pop();
278 differentSizesMenu.pop();
276 menu.unityMenuModel.modelData = differentSizesMenu;
279 menu.unityMenuModel.modelData = differentSizesMenu;
278− waitForRendering(menu);
281+ tryCompareFunction(function() { return findChild(menu, "menu-item0") !== null; }, true);
279− verify(menu.width < longWidth);
282+ tryCompareFunction(function() { return menu.width < longWidth; }, true);
282 function test_minimumWidth() {
285 function test_minimumWidth() {