@@ -24,19 +24,19 @@ import "../../../Launcher"
24 launcher. */
24 launcher. */
26 width: units.gu(50)
26 width: units.gu(50)
27− height: units.gu(81)
27+ height: units.gu(50)
29 Launcher {
29 Launcher {
30 id: launcher
30 id: launcher
33 width: units.gu(40)
33 width: units.gu(40)
34− height: units.gu(81)
34+ height: parent.height
36− property string latestApplicationSelected
36+ property string lastSelectedApplication
38 onLauncherApplicationSelected: {
38 onLauncherApplicationSelected: {
39− latestApplicationSelected = desktopFile
39+ lastSelectedApplication = desktopFile
42 property int dashItemSelected_count: 0
42 property int dashItemSelected_count: 0
@@ -57,10 +57,35 @@ Item {
63+ function dragLauncherIntoView() {
64+ var startX = launcher.dragAreaWidth/2
65+ var startY = launcher.height/2
68+ startX+units.gu(8), startY)
70+ var panel = findChild(launcher, "launcherPanel")
71+ verify(panel != undefined)
73+ // wait until it gets fully extended
74+ tryCompare(panel, "x", 0)
75+ tryCompare(launcher, "state", "visible")
78+ function waitUntilLauncherDisappears() {
79+ var panel = findChild(launcher, "launcherPanel")
80+ tryCompare(panel, "x", -panel.width, 1000)
60 UT.UnityTestCase {
85 UT.UnityTestCase {
61 id: testCase
86 id: testCase
62 name: "Launcher"
87 name: "Launcher"
63− when: windowShown
88+ when: windowShown && initTestCase.completed
65 // Drag from the left edge of the screen rightwards and check that the launcher
90 // Drag from the left edge of the screen rightwards and check that the launcher
66 // appears (as if being dragged by the finger/pointer)
91 // appears (as if being dragged by the finger/pointer)
@@ -71,7 +96,7 @@ Item {
71 // it starts out hidden just left of the left launcher edge
96 // it starts out hidden just left of the left launcher edge
72 compare(panel.x, -panel.width)
97 compare(panel.x, -panel.width)
74− dragLauncherIntoView()
99+ revealer.dragLauncherIntoView()
76 // tapping on the center of the screen should dismiss the launcher
101 // tapping on the center of the screen should dismiss the launcher
77 mouseClick(launcher, launcher.width/2, launcher.height/2)
102 mouseClick(launcher, launcher.width/2, launcher.height/2)
@@ -85,20 +110,20 @@ Item {
85 corresponding desktop file. E.g. clicking on phone icon should yield
110 corresponding desktop file. E.g. clicking on phone icon should yield
86 launcherApplicationSelected("[...]phone-app.desktop") */
111 launcherApplicationSelected("[...]phone-app.desktop") */
87 function test_clickingOnAppIconCausesSignalEmission() {
112 function test_clickingOnAppIconCausesSignalEmission() {
88− launcher.latestApplicationSelected = ""
113+ launcher.lastSelectedApplication = ""
90− dragLauncherIntoView()
115+ revealer.dragLauncherIntoView()
92 var appIcon = findChild(launcher, "launcherDelegate0")
117 var appIcon = findChild(launcher, "launcherDelegate0")
93 verify(appIcon != undefined)
118 verify(appIcon != undefined)
95 mouseClick(appIcon, appIcon.width/2, appIcon.height/2)
120 mouseClick(appIcon, appIcon.width/2, appIcon.height/2)
97− tryCompare(launcher, "latestApplicationSelected",
122+ tryCompare(launcher, "lastSelectedApplication",
98 "/usr/share/applications/phone-app.desktop")
123 "/usr/share/applications/phone-app.desktop")
100 // Tapping on an application icon also dismisses the launcher
125 // Tapping on an application icon also dismisses the launcher
101− waitUntilLauncherDisappears()
126+ revealer.waitUntilLauncherDisappears()
104 /* If I click on the dash icon on the launcher
129 /* If I click on the dash icon on the launcher
@@ -106,7 +131,7 @@ Item {
106 function test_clickingOnDashIconCausesSignalEmission() {
131 function test_clickingOnDashIconCausesSignalEmission() {
107 launcher.dashItemSelected_count = 0
132 launcher.dashItemSelected_count = 0
109− dragLauncherIntoView()
134+ revealer.dragLauncherIntoView()
111 var dashIcon = findChild(launcher, "dashItem")
136 var dashIcon = findChild(launcher, "dashItem")
112 verify(dashIcon != undefined)
137 verify(dashIcon != undefined)
@@ -116,30 +141,9 @@ Item {
116 tryCompare(launcher, "dashItemSelected_count", 1)
141 tryCompare(launcher, "dashItemSelected_count", 1)
118 // Tapping on the dash icon also dismisses the launcher
143 // Tapping on the dash icon also dismisses the launcher
119− waitUntilLauncherDisappears()
144+ revealer.waitUntilLauncherDisappears()
122− function dragLauncherIntoView() {
123− var startX = launcher.dragAreaWidth/2
124− var startY = launcher.height/2
125− touchFlick(launcher,
127− startX+units.gu(8), startY)
129− var panel = findChild(launcher, "launcherPanel")
130− verify(panel != undefined)
132− // wait until it gets fully extended
133− tryCompare(panel, "x", 0)
134− tryCompare(launcher, "state", "visible")
137− function waitUntilLauncherDisappears() {
138− var panel = findChild(launcher, "launcherPanel")
139− tryCompare(panel, "x", -panel.width, 1000)
143 function test_teaseLauncher_data() {
147 function test_teaseLauncher_data() {
145 {tag: "available", available: true},
149 {tag: "available", available: true},
@@ -164,7 +168,59 @@ Item {
164 wait(100)
168 wait(100)
165 compare(launcher.maxPanelX, -launcher.panelWidth, "Launcher moved even if it shouldn't")
169 compare(launcher.maxPanelX, -launcher.panelWidth, "Launcher moved even if it shouldn't")
167− waitUntilLauncherDisappears();
171+ revealer.waitUntilLauncherDisappears();
172+ launcher.available = true;
177+ id: clickFlickTestCase
178+ when: windowShown && testCase.completed
180+ function test_clickFlick_data() {
181+ var listView = findChild(launcher, "launcherListView");
183+ {tag: "unfolded top", flickSpeed: units.gu(200), clickY: listView.topMargin + units.gu(2), expectFlick: false},
184+ {tag: "folded top", flickSpeed: -units.gu(200), clickY: listView.topMargin + units.gu(2), expectFlick: true},
185+ {tag: "unfolded bottom", flickSpeed: -units.gu(200), clickY: listView.height - listView.topMargin - units.gu(1), expectFlick: false},
186+ {tag: "folded bottom", flickSpeed: units.gu(200), clickY: listView.height - listView.topMargin - units.gu(1), expectFlick: true},
190+ function test_clickFlick(data) {
191+ launcher.lastSelectedApplication = ""
192+ revealer.dragLauncherIntoView();
193+ var listView = findChild(launcher, "launcherListView");
195+ listView.flick(0, data.flickSpeed);
196+ tryCompare(listView, "flicking", false);
198+ var oldY = listView.contentY;
200+ mouseClick(listView, listView.width / 2, data.clickY);
201+ tryCompare(listView, "flicking", false)
203+ if (data.expectFlick) {
204+ verify(listView.contentY != oldY);
205+ compare(launcher.lastSelectedApplication, "", "Launcher app clicked signal emitted even though it should only flick");
207+ verify(launcher.lastSelectedApplication != "");
208+ compare(listView.contentY, oldY, "Launcher was flicked even though it should only launch an app");
210+ // Click somewhere in the empty space to make it hide in case it isn't
211+ mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
212+ revealer.waitUntilLauncherDisappears();
218+ name: "LauncherInit"
221+ function test_initFirstUnfolded() {
222+ var listView = findChild(launcher, "launcherListView");
223+ compare(listView.contentY, -listView.topMargin, "Launcher did not start up with first item unfolded");