on xenial help sign in
Make the test more reliable
93f3235Albert Astals
tests/qmltests/Dash/tst_DashContent.qml+17−1
@@ -278,13 +278,29 @@ Item {
278 var tabbar = findChild(dashContent, "tabbar");
278 var tabbar = findChild(dashContent, "tabbar");
279
279
280 compare(dashContent.currentIndex, 0);
280 compare(dashContent.currentIndex, 0);
281+ tryCompare(tabbar, "selectedIndex", 0);
281 tryCompare(tabbar, "selectionMode", false);
282 tryCompare(tabbar, "selectionMode", false);
283+
282 mouseClick(tabbar, units.gu(5), units.gu(5))
284 mouseClick(tabbar, units.gu(5), units.gu(5))
285+
283 tryCompare(tabbar, "selectionMode", true);
286 tryCompare(tabbar, "selectionMode", true);
287+ tryCompare(tabbar, "selectedIndex", 0);
288+ tryCompare(dashContent, "currentIndex", 0);
289+
290+ var button0;
291+ if (tabbar.children[0].children[0].children[0].children[1].x >= 0) {
292+ button0 = tabbar.children[0].children[0].children[0].children[1].children[1];
293+ } else {
284− var button0 = tabbar.children[0].children[0].children[0].children[2].children[1];
294+ button0 = tabbar.children[0].children[0].children[0].children[2].children[1];
295+ }
285 waitForRendering(button0);
296 waitForRendering(button0);
297+
298+ UT.Util.isInstanceOf(button0, "AbstractButton");
299+ UT.Util.isInstanceOf(button0.children[3], "Label");
286 tryCompare(button0.children[3], "text", "Music");
300 tryCompare(button0.children[3], "text", "Music");
301+
287 mouseClick(button0, button0.width / 2, button0.height / 2)
302 mouseClick(button0, button0.width / 2, button0.height / 2)
303+
288 tryCompare(tabbar, "selectionMode", false);
304 tryCompare(tabbar, "selectionMode", false);
289 tryCompare(tabbar, "selectedIndex", 1);
305 tryCompare(tabbar, "selectedIndex", 1);
290 tryCompare(dashContent, "currentIndex", 1);
306 tryCompare(dashContent, "currentIndex", 1);