@@ -98,6 +98,11 @@ Row {
102+ id: launcherShowDashHomeSpy
103+ signalName: "showDashHome"
101 SignalSpy {
106 SignalSpy {
102 id: sessionSpy
107 id: sessionSpy
103 signalName: "sessionStarted"
108 signalName: "sessionStarted"
@@ -131,9 +136,13 @@ Row {
132 sessionSpy.target = findChild(shell, "greeter")
137 sessionSpy.target = findChild(shell, "greeter")
133 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
138 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
140+ launcherShowDashHomeSpy.target = findChild(shell, "launcher");
136 function cleanup() {
143 function cleanup() {
144+ launcherShowDashHomeSpy.target = null;
137 shellLoader.itemDestroyed = false;
146 shellLoader.itemDestroyed = false;
139 shellLoader.active = false;
148 shellLoader.active = false;
@@ -608,5 +617,70 @@ Row {
608 tryCompare(topmostSurface, "touchPressCount", 0);
617 tryCompare(topmostSurface, "touchPressCount", 0);
609 tryCompare(topmostSurface, "touchReleaseCount", 0);
618 tryCompare(topmostSurface, "touchReleaseCount", 0);
621+ function waitUntilFocusedApplicationIsShowingItsSurface()
623+ var spreadDelegate = findChild(shell, "appDelegate0");
624+ var appState = findInvisibleChild(spreadDelegate, "applicationWindowStateGroup");
625+ tryCompare(appState, "state", "surface");
626+ var transitions = appState.transitions;
627+ for (var i = 0; i < transitions.length; ++i) {
628+ var transition = transitions[i];
629+ tryCompare(transition, "running", false, 2000);
633+ function swipeFromRightEdgeToShowAppSpread()
635+ // perform a right-edge drag to show the spread
636+ var touchStartX = shell.width - (shell.edgeSize / 2)
637+ var touchStartY = shell.height / 2;
638+ touchFlick(shell, touchStartX, touchStartY, units.gu(1) /* endX */, touchStartY /* endY */);
640+ // check if it's indeed showing the spread
641+ var stage = findChild(shell, "stage");
642+ var spreadView = findChild(stage, "spreadView");
643+ tryCompare(spreadView, "phase", 2);
646+ function test_tapUbuntuIconInLauncherOverAppSpread() {
648+ waitUntilFocusedApplicationIsShowingItsSurface();
650+ swipeFromRightEdgeToShowAppSpread();
652+ var launcher = findChild(shell, "launcher");
654+ // ensure the launcher dimissal timer never gets triggered during the test run
655+ var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
656+ dismissTimer.interval = 60 * 60 * 1000;
658+ dragLauncherIntoView();
660+ // Emulate a tap with a finger, where the touch position drifts during the tap.
662+ var buttonShowDashHome = findChild(launcher, "buttonShowDashHome");
663+ var startPos = buttonShowDashHome.mapToItem(shell,
664+ buttonShowDashHome.width * 0.2,
665+ buttonShowDashHome.height * 0.2);
666+ var endPos = buttonShowDashHome.mapToItem(shell,
667+ buttonShowDashHome.width * 0.8,
668+ buttonShowDashHome.height * 0.8);
669+ touchFlick(shell, startPos.x, startPos.y, endPos.x, endPos.y);
672+ compare(launcherShowDashHomeSpy.count, 1);
674+ // check that the stage has left spread mode.
676+ var stage = findChild(shell, "stage");
677+ var spreadView = findChild(stage, "spreadView");
678+ tryCompare(spreadView, "phase", 0);
681+ // check that the launcher got dismissed
682+ var launcherPanel = findChild(shell, "launcherPanel");
683+ tryCompare(launcherPanel, "x", -launcherPanel.width);