on xenial help sign in
Add regression test Shell.test_tapUbuntuIconInLauncherOverAppSpread
commit58685a40828aea7fe0bad699273aaf5e8b775924 authorDaniel d'Andrada <daniel.dandrada@canonical.com> dateMon 6 Oct 2014, 12:21 (12 years ago) parent963005e
2 files changed+75
qml/Launcher/LauncherPanel.qml+1 tests/qmltests/tst_Shell.qml+74
qml/Launcher/LauncherPanel.qml+1
@@ -45,6 +45,7 @@ Rectangle {
4545 }
4646
4747 Rectangle {
48+ objectName: "buttonShowDashHome"
4849 width: parent.width
4950 height: units.gu(7)
5051 color: UbuntuColors.orange
tests/qmltests/tst_Shell.qml+74
@@ -98,6 +98,11 @@ Row {
9898 }
9999 }
100100
101+ SignalSpy {
102+ id: launcherShowDashHomeSpy
103+ signalName: "showDashHome"
104+ }
105+
101106 SignalSpy {
102107 id: sessionSpy
103108 signalName: "sessionStarted"
@@ -131,9 +136,13 @@ Row {
131136
132137 sessionSpy.target = findChild(shell, "greeter")
133138 dashCommunicatorSpy.target = findInvisibleChild(shell, "dashCommunicator");
139+
140+ launcherShowDashHomeSpy.target = findChild(shell, "launcher");
134141 }
135142
136143 function cleanup() {
144+ launcherShowDashHomeSpy.target = null;
145+
137146 shellLoader.itemDestroyed = false;
138147
139148 shellLoader.active = false;
@@ -608,5 +617,70 @@ Row {
608617 tryCompare(topmostSurface, "touchPressCount", 0);
609618 tryCompare(topmostSurface, "touchReleaseCount", 0);
610619 }
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+ }
611685 }
612686}