@@ -159,6 +159,18 @@ Item {
159 target: LauncherModel
159 target: LauncherModel
163+ id: fakeDismissTimer
164+ property bool running: false
170+ function restart() {
162 UnityTestCase {
174 UnityTestCase {
163 id: testCase
175 id: testCase
164 name: "Launcher"
176 name: "Launcher"
@@ -177,6 +189,11 @@ Item {
177 launcherLoader.active = true;
189 launcherLoader.active = true;
179 function init() {
191 function init() {
192+ var panel = findChild(launcher, "launcherPanel");
195+ panel.dismissTimer = fakeDismissTimer;
180 // Make sure we don't start the test with the mouse hovering the launcher
197 // Make sure we don't start the test with the mouse hovering the launcher
181 mouseMove(root, root.width, root.height / 2);
198 mouseMove(root, root.width, root.height / 2);
@@ -216,11 +233,6 @@ Item {
218 function revealByEdgePush() {
235 function revealByEdgePush() {
219− // make the dismissTimer interval very big temporarily
220− var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
221− var oldInterval = dismissTimer.interval;
222− dismissTimer.interval = 100000;
224 // Place the mouse against the window/screen edge and push beyond the barrier threshold
236 // Place the mouse against the window/screen edge and push beyond the barrier threshold
225 mouseMove(root, 1, root.height / 2);
237 mouseMove(root, 1, root.height / 2);
226 launcher.pushEdge(EdgeBarrierSettings.pushThreshold * 1.1);
238 launcher.pushEdge(EdgeBarrierSettings.pushThreshold * 1.1);
@@ -231,15 +243,6 @@ Item {
231 // wait until it gets fully extended
243 // wait until it gets fully extended
232 tryCompare(panel, "x", 0);
244 tryCompare(panel, "x", 0);
233 tryCompare(launcher, "state", "visibleTemporary");
245 tryCompare(launcher, "state", "visibleTemporary");
235− // move the mouse a bit, this should not be needed but without it
236− // the mouse areas do not realize their containsMouse have changed
237− // i've tested in real life without moving the mouse at all and it works
238− // so it seems to be a test-only issue
239− mouseMove(root, 2, root.height / 2);
241− // now that the launcher is out, bring the interval back
242− dismissTimer.interval = oldInterval;
245 function waitUntilLauncherDisappears() {
248 function waitUntilLauncherDisappears() {
@@ -906,15 +909,13 @@ Item {
906 revealByEdgePush();
909 revealByEdgePush();
907 compare(launcher.state, "visibleTemporary");
910 compare(launcher.state, "visibleTemporary");
909− // wait three times the dismiss timer to check the launcher still shown
910− // because the mouse is still over the launcher
911− var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
912− wait(dismissTimer.interval * 3);
913− compare(panel.x, 0);
915 // Now move the mouse away and make sure it hides in less than a second
912 // Now move the mouse away and make sure it hides in less than a second
916 mouseMove(root, root.width, root.height / 2)
913 mouseMove(root, root.width, root.height / 2)
915+ // trigger the hide timer
916+ fakeDismissTimer.triggered();
917+ tryCompare(panel, "x", 0);
918 tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
919 tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
919 waitUntilLauncherDisappears();
920 waitUntilLauncherDisappears();