on xenial help sign in
Fix the tests on the Panel

* Put the mouse somewhere neutral so it doesn't hover over stuff * Staged and Windowed modes were switched in design, correct that. * Be more careful about trusting things to not be null / wait for rendering more often

commitbbea6bd8521bf2c2d619a6b213a06b6311ac8d10 authorDalton Durst <dalton@ubports.com> dateMon 13 May 2019, 16:19 (7 years ago) parent362c740
2 files changed+14−5
qml/Panel/Panel.qml+1−1 tests/qmltests/Panel/tst_Panel.qml+13−4
qml/Panel/Panel.qml+1−1
@@ -86,7 +86,7 @@ Item {
8686 PanelState.decorationsAlwaysVisible
8787
8888 property bool showPointerMenu: revealControls && enablePointerMenu &&
89− (PanelState.decorationsVisible || mode == "staged")
89+ (PanelState.decorationsVisible || mode == "windowed")
9090
9191 property bool enablePointerMenu: applicationMenus.available &&
9292 applicationMenus.model
tests/qmltests/Panel/tst_Panel.qml+13−4
@@ -263,6 +263,10 @@ PanelTest {
263263 PanelState.title = "";
264264 PanelState.decorationsVisible = false;
265265
266+ // Put the mouse somewhere neutral so it doesn't hover over things
267+ // and mess up the test
268+ mouseMove(root, 0, 100);
269+
266270 // Wait for the indicators to get into position.
267271 // (switches between normal and fullscreen modes are animated)
268272 var panelArea = findChild(panel, "panelArea");
@@ -772,9 +776,9 @@ PanelTest {
772776 }
773777 }
774778
775− function test_stagedApplicationMenuBarShowOnMouseHover() {
779+ function test_windowedApplicationMenuBarShowOnMouseHover() {
776780 PanelState.title = "Fake Title";
777− panel.mode = "staged";
781+ panel.mode = "windowed";
778782 mouseEmulation.checked = false;
779783
780784 var appTitle = findChild(panel, "panelTitle"); verify(appTitle);
@@ -786,7 +790,11 @@ PanelTest {
786790
787791 mouseMove(panel, panel.width/2, panel.panelHeight);
788792
789− var appMenuBar = findChild(panel, "menuBar"); verify(appMenuBar);
793+ waitForRendering(panel);
794+
795+ var appMenuBarLoader = findChild(panel, "menuBarLoader")
796+ tryVerify(function() {return appMenuBarLoader.item});
797+ var appMenuBar = appMenuBarLoader.item
790798 tryCompare(appTitle, "visible", false, undefined, "App title should not be visible on mouse hover");
791799 tryCompare(appMenuBar, "visible", true, undefined, "App menu bar should be visible on mouse hover");
792800 }
@@ -833,7 +841,8 @@ PanelTest {
833841
834842 var indicatorsBar = findChild(panel.applicationMenus, "indicatorsBar");
835843
836− PanelState.title = "Fake Title"
844+ PanelState.title = "Fake Title";
845+ waitForRendering(panel);
837846 pullDownApplicationsMenu(0 /*xPos*/);
838847 compare(aboutToShowCalledSpy.count, 1);
839848