on xenial help sign in
Add test for not overlapping navigation panes
5fb82faMichał Sawicz
qml/Dash/DashNavigationButton.qml+2−1
@@ -78,6 +78,7 @@ AbstractButton {
78 ListView {
78 ListView {
79 id: navigationListView
79 id: navigationListView
80 objectName: "navigationListView"
80 objectName: "navigationListView"
81+ visible: height > 0
81 orientation: ListView.Horizontal
82 orientation: ListView.Horizontal
82 interactive: false
83 interactive: false
83 clip: root.width != windowWidth
84 clip: root.width != windowWidth
@@ -105,7 +106,7 @@ AbstractButton {
105 highlightMoveDuration: UbuntuAnimation.FastDuration
106 highlightMoveDuration: UbuntuAnimation.FastDuration
106 delegate: DashNavigationList {
107 delegate: DashNavigationList {
107 objectName: "navigation" + index
108 objectName: "navigation" + index
108− visible: height != 0
109+ visible: height > 0
109 width: navigationListView.width
110 width: navigationListView.width
110 scopeStyle: root.scopeStyle
111 scopeStyle: root.scopeStyle
111 foregroundColor: root.foregroundColor
112 foregroundColor: root.foregroundColor
tests/qmltests/Dash/tst_DashContent.qml+41−2
@@ -434,13 +434,52 @@ Item {
434 waitForRendering(navigationListView.currentItem);
434 waitForRendering(navigationListView.currentItem);
435 verify(!backButton.visible, "Back button should not be visible");
435 verify(!backButton.visible, "Back button should not be visible");
436
436
437− var navigationList1 = findChild(dashNavigationButton, "navigation1");
438− verify(navigationList1 === null, "There should be no second-level navigation");
437+ compare(navigationListView.count, 1, "There should be no second-level navigation");
439
438
440 mouseClick(dashNavigationButton, 0, 0);
439 mouseClick(dashNavigationButton, 0, 0);
441 compare(dashNavigationButton.showList, false);
440 compare(dashNavigationButton.showList, false);
442 }
441 }
443
442
443+ function test_navigationsClosing() {
444+ var dashContentList = findChild(dashContent, "dashContentList");
445+ tryCompareFunction(function() { return findChild(dashContentList.currentItem, "dashNavigation") != null; }, true);
446+ var dashNavigation = findChild(dashContentList.currentItem, "dashNavigation");
447+ tryCompare(dashNavigation, "visible", true);
448+ var dashNavigationButton = findChild(dashContentList.currentItem, "navigationButton");
449+ verify(dashNavigationButton, "Can't find navigation button");
450+ var dashAltNavigationButton = findChild(dashContentList.currentItem, "altNavigationButton");
451+ verify(dashAltNavigationButton, "Can't find alternative navigation button");
452+
453+ waitForRendering(dashNavigationButton);
454+ waitForRendering(dashAltNavigationButton);
455+
456+ compare(dashNavigationButton.showList, false);
457+ compare(dashAltNavigationButton.showList, false);
458+
459+ mouseClick(dashNavigation, 0, 0);
460+ compare(dashNavigationButton.showList, false);
461+ compare(dashAltNavigationButton.showList, true);
462+
463+ var navigationListView = findChild(dashAltNavigationButton, "navigationListView");
464+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
465+
466+ mouseClick(dashNavigation, dashNavigationButton.x, 0);
467+ compare(dashNavigationButton.showList, false);
468+ compare(dashAltNavigationButton.showList, false);
469+
470+ tryCompare(navigationListView, "visible", false);
471+
472+ mouseClick(dashNavigation, dashNavigationButton.x, 0);
473+ compare(dashNavigationButton.showList, true);
474+ compare(dashAltNavigationButton.showList, false);
475+
476+ navigationListView = findChild(dashNavigationButton, "navigationListView");
477+ tryCompare(navigationListView.currentItem.navigation, "loaded", true);
478+
479+ mouseClick(dashNavigation, 0, 0);
480+ compare(dashNavigationButton.showList, false);
481+ compare(dashAltNavigationButton.showList, false);
482+ }
444
483
445 function test_searchHint() {
484 function test_searchHint() {
446 var dashContentList = findChild(dashContent, "dashContentList");
485 var dashContentList = findChild(dashContent, "dashContentList");