on xenial help sign in
Add regression test Shell.test_tapUbuntuIconInLauncherOverAppSpread
58685a4Daniel d'Andrada
qml/Launcher/LauncherPanel.qml+1
@@ -45,6 +45,7 @@ Rectangle {
45 }
45 }
46
46
47 Rectangle {
47 Rectangle {
48+ objectName: "buttonShowDashHome"
48 width: parent.width
49 width: parent.width
49 height: units.gu(7)
50 height: units.gu(7)
50 color: UbuntuColors.orange
51 color: UbuntuColors.orange
tests/qmltests/tst_Shell.qml+74
@@ -98,6 +98,11 @@ Row {
98 }
98 }
99 }
99 }
100
100
101+ SignalSpy {
102+ id: launcherShowDashHomeSpy
103+ signalName: "showDashHome"
104+ }
105+
101 SignalSpy {
106 SignalSpy {
102 id: sessionSpy
107 id: sessionSpy
103 signalName: "sessionStarted"
108 signalName: "sessionStarted"
@@ -131,9 +136,13 @@ Row {
131
136
132 sessionSpy.target = findChild(shell, "greeter")
137 sessionSpy.target = findChild(shell, "greeter")
133 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
138 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
139+
140+ launcherShowDashHomeSpy.target = findChild(shell, "launcher");
134 }
141 }
135
142
136 function cleanup() {
143 function cleanup() {
144+ launcherShowDashHomeSpy.target = null;
145+
137 shellLoader.itemDestroyed = false;
146 shellLoader.itemDestroyed = false;
138
147
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);
610 }
619 }
620+
621+ function waitUntilFocusedApplicationIsShowingItsSurface()
622+ {
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);
630+ }
631+ }
632+
633+ function swipeFromRightEdgeToShowAppSpread()
634+ {
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 */);
639+
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);
644+ }
645+
646+ function test_tapUbuntuIconInLauncherOverAppSpread() {
647+
648+ waitUntilFocusedApplicationIsShowingItsSurface();
649+
650+ swipeFromRightEdgeToShowAppSpread();
651+
652+ var launcher = findChild(shell, "launcher");
653+
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;
657+
658+ dragLauncherIntoView();
659+
660+ // Emulate a tap with a finger, where the touch position drifts during the tap.
661+ {
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);
670+ }
671+
672+ compare(launcherShowDashHomeSpy.count, 1);
673+
674+ // check that the stage has left spread mode.
675+ {
676+ var stage = findChild(shell, "stage");
677+ var spreadView = findChild(stage, "spreadView");
678+ tryCompare(spreadView, "phase", 0);
679+ }
680+
681+ // check that the launcher got dismissed
682+ var launcherPanel = findChild(shell, "launcherPanel");
683+ tryCompare(launcherPanel, "x", -launcherPanel.width);
684+ }
611 }
685 }
612}
686}