@@ -17,7 +17,7 @@
17import QtQuick 2.0
17import QtQuick 2.0
18import QtQuick.Layouts 1.1
18import QtQuick.Layouts 1.1
19import QtTest 1.0
19import QtTest 1.0
20−import Unity.Test 0.1 as UT
20+import Unity.Test 0.1
21import Ubuntu.Components 1.1
21import Ubuntu.Components 1.1
22import ".."
22import ".."
23import "../../../qml/Launcher"
23import "../../../qml/Launcher"
@@ -74,12 +74,17 @@ Item {
77+ property Item launcher: launcherLoader.status === Loader.Ready ? launcherLoader.item : null
78 ColumnLayout {
79 ColumnLayout {
79 anchors { bottom: parent.bottom; right: parent.right; margins: units.gu(1) }
80 anchors { bottom: parent.bottom; right: parent.right; margins: units.gu(1) }
80 spacing: units.gu(1)
81 spacing: units.gu(1)
81 width: units.gu(20)
82 width: units.gu(20)
84+ MouseTouchEmulationCheckbox {
85+ id: touchEmulationCheckBox
84 text: "emit hinting signal"
89 text: "emit hinting signal"
85 onClicked: LauncherModel.emitHint()
90 onClicked: LauncherModel.emitHint()
@@ -98,12 +103,11 @@ Item {
98 target: LauncherModel
103 target: LauncherModel
101− UT.UnityTestCase {
106+ LauncherTestCase {
102− id: testCase
107+ id: testCaseTouch
103− name: "Launcher"
108+ name: "LauncherTouch"
104− when: windowShown
109+ launcher: root.launcher
106− property Item launcher: launcherLoader.status === Loader.Ready ? launcherLoader.item : null
107 function cleanup() {
111 function cleanup() {
108 launcherLoader.active = false;
112 launcherLoader.active = false;
109 // 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
@@ -116,6 +120,8 @@ Item {
116 launcherLoader.active = true;
120 launcherLoader.active = true;
118 function init() {
122 function init() {
123+ touchEmulationCheckBox.checked = true;
119 var listView = findChild(launcher, "launcherListView");
125 var listView = findChild(launcher, "launcherListView");
120 // wait for it to settle before doing the flick. Otherwise the flick
126 // wait for it to settle before doing the flick. Otherwise the flick
121 // might fail.
127 // might fail.
@@ -148,23 +154,6 @@ Item {
148 tryCompare(launcher, "state", "visible");
154 tryCompare(launcher, "state", "visible");
151− function waitUntilLauncherDisappears() {
152− var panel = findChild(launcher, "launcherPanel");
153− tryCompare(panel, "x", -panel.width, 1000);
156− function positionLauncherListAtBeginning() {
157− var listView = testCase.findChild(launcherLoader.item, "launcherListView");
158− listView.contentY = -listView.topMargin;
160− function positionLauncherListAtEnd() {
161− var listView = testCase.findChild(launcherLoader.item, "launcherListView");
162− if ((listView.contentHeight + listView.topMargin + listView.bottomMargin) > listView.height) {
163− listView.contentY = listView.topMargin + listView.contentHeight
168 // Drag from the left edge of the screen rightwards and check that the launcher
157 // Drag from the left edge of the screen rightwards and check that the launcher
169 // appears (as if being dragged by the finger/pointer)
158 // appears (as if being dragged by the finger/pointer)
170 function test_dragLeftEdgeToRevealLauncherAndTapCenterToDismiss() {
159 function test_dragLeftEdgeToRevealLauncherAndTapCenterToDismiss() {
@@ -560,4 +549,66 @@ Item {
560 tryCompare(quickList, "state", "");
549 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() {
579+ var panel = findChild(launcher, "launcherPanel");
580+ verify(panel != undefined);
583+ tryCompare(launcher, "state", "visibleTemporary");
585+ // Now move the mouse away and make sure it hides in less than a second
586+ mouseMove(root, root.width, root.height / 2)
588+ tryCompare(launcher, "state", "", 1000, "Launcher didn't hide after moving mouse away from it");
589+ 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();