@@ -74,7 +74,6 @@ Item {
77− property Item launcher: launcherLoader.status === Loader.Ready ? launcherLoader.item : null
79 ColumnLayout {
78 ColumnLayout {
80 anchors { bottom: parent.bottom; right: parent.right; margins: units.gu(1) }
79 anchors { bottom: parent.bottom; right: parent.right; margins: units.gu(1) }
@@ -103,11 +102,12 @@ Item {
103 target: LauncherModel
102 target: LauncherModel
106− LauncherTestCase {
105+ UnityTestCase {
107− id: testCaseTouch
106+ id: testCase
108− name: "LauncherTouch"
107+ name: "Launcher"
109− launcher: root.launcher
108+ when: windowShown
110+ property Item launcher: launcherLoader.status === Loader.Ready ? launcherLoader.item : null
111 function cleanup() {
111 function cleanup() {
112 launcherLoader.active = false;
112 launcherLoader.active = false;
113 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
113 // Loader.status might be Loader.Null and Loader.item might be null but the Loader
@@ -120,7 +120,8 @@ Item {
120 launcherLoader.active = true;
120 launcherLoader.active = true;
122 function init() {
122 function init() {
123− touchEmulationCheckBox.checked = true;
123+ // Make sure we don't start the test with the mouse hovering the launcher
124+ mouseMove(root, root.width, root.height / 2);
125 var listView = findChild(launcher, "launcherListView");
126 var listView = findChild(launcher, "launcherListView");
126 // wait for it to settle before doing the flick. Otherwise the flick
127 // wait for it to settle before doing the flick. Otherwise the flick
@@ -154,6 +155,34 @@ Item {
154 tryCompare(launcher, "state", "visible");
155 tryCompare(launcher, "state", "visible");
158+ function revealByHover() {
159+ mouseMove(root, 1, root.height / 2);
161+ var panel = findChild(launcher, "launcherPanel");
162+ verify(panel != undefined);
164+ // wait until it gets fully extended
165+ tryCompare(panel, "x", 0);
166+ tryCompare(launcher, "state", "visibleTemporary");
169+ function waitUntilLauncherDisappears() {
170+ var panel = findChild(launcher, "launcherPanel");
171+ tryCompare(panel, "x", -panel.width, 1000);
174+ function positionLauncherListAtBeginning() {
175+ var listView = testCase.findChild(launcherLoader.item, "launcherListView");
176+ listView.contentY = -listView.topMargin;
178+ function positionLauncherListAtEnd() {
179+ var listView = testCase.findChild(launcherLoader.item, "launcherListView");
180+ if ((listView.contentHeight + listView.topMargin + listView.bottomMargin) > listView.height) {
181+ listView.contentY = listView.topMargin + listView.contentHeight
157 // Drag from the left edge of the screen rightwards and check that the launcher
186 // Drag from the left edge of the screen rightwards and check that the launcher
158 // appears (as if being dragged by the finger/pointer)
187 // appears (as if being dragged by the finger/pointer)
159 function test_dragLeftEdgeToRevealLauncherAndTapCenterToDismiss() {
188 function test_dragLeftEdgeToRevealLauncherAndTapCenterToDismiss() {
@@ -178,8 +207,19 @@ Item {
178 Launcher::launcherApplicationSelected signal should be emitted with the
207 Launcher::launcherApplicationSelected signal should be emitted with the
179 corresponding desktop file. E.g. clicking on phone icon should yield
208 corresponding desktop file. E.g. clicking on phone icon should yield
180 launcherApplicationSelected("[...]dialer-app.desktop") */
209 launcherApplicationSelected("[...]dialer-app.desktop") */
210+ function test_clickingOnAppIconCausesSignalEmission_data() {
212+ {tag: "by mouse", mouse: true},
213+ {tag: "by touch", mouse: false}
181− function test_clickingOnAppIconCausesSignalEmission() {
217+ function test_clickingOnAppIconCausesSignalEmission(data) {
182− dragLauncherIntoView();
221+ dragLauncherIntoView();
183 launcher.lastSelectedApplication = "";
223 launcher.lastSelectedApplication = "";
184 launcher.inverted = false;
224 launcher.inverted = false;
@@ -548,32 +588,6 @@ Item {
549 tryCompare(quickList, "state", "");
589 tryCompare(quickList, "state", "");
555− name: "LauncherMouse"
556− launcher: root.launcher
559− touchEmulationCheckBox.checked = false;
561− function cleanup() {
562− // Make sure we don't stop the test with the mouse hovering the launcher
563− mouseMove(root, root.width, root.height / 2);
564− waitUntilLauncherDisappears();
567− function revealByHover() {
568− mouseMove(root, 1, root.height / 2);
570− var panel = findChild(launcher, "launcherPanel");
571− verify(panel != undefined);
573− // wait until it gets fully extended
574− tryCompare(panel, "x", 0);
575− tryCompare(launcher, "state", "visibleTemporary");
578 function test_revealByHover() {
592 function test_revealByHover() {
579 var panel = findChild(launcher, "launcherPanel");
593 var panel = findChild(launcher, "launcherPanel");
@@ -588,27 +602,5 @@ Item {
588 tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
602 tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
589 waitUntilLauncherDisappears();
603 waitUntilLauncherDisappears();
592− function test_launchAppByMouseClick() {
595− launcher.lastSelectedApplication = "";
596− launcher.inverted = false;
598− positionLauncherListAtBeginning();
600− var appIcon = findChild(launcher, "launcherDelegate0");
602− verify(appIcon != undefined);
604− mouseClick(appIcon);
606− tryCompare(launcher, "lastSelectedApplication",
609− // Clicking an icon should make it disappear
610− tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
611− waitUntilLauncherDisappears();