28
28
width: units.gu(50)
29
29
height: units.gu(55)
38
property string lastSelectedApplication
40
onLauncherApplicationSelected: {
41
lastSelectedApplication = appId
44
property int showDashHome_count: 0
49
property int maxPanelX: 0
34
property bool itemDestroyed: false
35
sourceComponent: Component {
43
property string lastSelectedApplication
45
onLauncherApplicationSelected: {
46
lastSelectedApplication = appId
49
property int showDashHome_count: 0
54
property int maxPanelX: 0
57
target: testCase.findChild(launcher, "launcherPanel")
60
if (target.x > launcher.maxPanelX) {
61
launcher.maxPanelX = target.x;
66
Component.onCompleted: {
67
launcherLoader.itemDestroyed = false;
69
Component.onDestruction: {
70
launcherLoader.itemDestroyed = true;
54
78
target: LauncherModel
58
target: testCase.findChild(launcher, "launcherPanel")
61
if (target.x > launcher.maxPanelX) {
62
launcher.maxPanelX = target.x;
86
property Item launcher: launcherLoader.status === Loader.Ready ? launcherLoader.item : null
88
launcherLoader.active = false;
89
// Loader.status might be Loader.Null and Loader.item might be null but the Loader
90
// item might still be alive. So if we set Loader.active back to true
91
// again right now we will get the very same Shell instance back. So no reload
92
// actually took place. Likely because Loader waits until the next event loop
93
// iteration to do its work. So to ensure the reload, we will wait until the
94
// Shell instance gets destroyed.
95
tryCompare(launcherLoader, "itemDestroyed", true);
96
launcherLoader.active = true;
99
var listView = findChild(launcher, "launcherListView");
100
// wait for it to settle before doing the flick. Otherwise the flick
102
// On startup that listView is already moving. maybe because of its contents
103
// growing while populating it with icons etc.
104
tryCompare(listView, "flicking", false);
106
// Make sure noone changed the height of the window. The issue this test case
107
// is verifying only happens on certain heights of the Launcher
108
compare(root.height, units.gu(55));
110
compare(listView.contentY, -listView.topMargin, "Launcher did not start up with first item unfolded");
112
// Now do check that snapping is in fact enabled
113
compare(listView.snapMode, ListView.SnapToItem, "Snapping is not enabled");
115
// Tests can be run in a reaaaaally slow environment or machine. Thus ensure
116
// the dismissTimer doesn't time out inadvertently.
117
var dismissTimer = findInvisibleChild(launcher, "dismissTimer");
118
dismissTimer.interval = 60 * 60 * 1000; // one hour
71
121
function dragLauncherIntoView() {
72
122
var startX = launcher.dragAreaWidth/2;
73
123
var startY = launcher.height/2;
87
137
var panel = findChild(launcher, "launcherPanel");
88
138
tryCompare(panel, "x", -panel.width, 1000);
95
when: windowShown && initTestCase.completed
98
mouseClick(root, root.width / 2, root.height / 2);
99
revealer.waitUntilLauncherDisappears();
102
141
// Drag from the left edge of the screen rightwards and check that the launcher
103
142
// appears (as if being dragged by the finger/pointer)
104
143
function test_dragLeftEdgeToRevealLauncherAndTapCenterToDismiss() {
105
revealer.waitUntilLauncherDisappears();
144
waitUntilLauncherDisappears();
107
146
var panel = findChild(launcher, "launcherPanel")
108
147
verify(panel != undefined)
186
225
compare(launcher.maxPanelX, -launcher.panelWidth, "Launcher moved even if it shouldn't")
188
revealer.waitUntilLauncherDisappears();
227
waitUntilLauncherDisappears();
189
228
launcher.available = true;
192
231
function test_countEmblems() {
193
revealer.dragLauncherIntoView();
232
dragLauncherIntoView();
194
233
var launcherListView = findChild(launcher, "launcherListView");
195
234
for (var i = 0; i < launcherListView.count; ++i) {
196
235
var delegate = findChild(launcherListView, "launcherDelegate" + i)
212
251
function test_focusedHighlight() {
213
revealer.dragLauncherIntoView();
252
dragLauncherIntoView();
214
253
var launcherListView = findChild(launcher, "launcherListView");
215
254
for (var i = 0; i < launcherListView.count; ++i) {
216
255
var delegate = findChild(launcherListView, "launcherDelegate" + i)
217
256
compare(findChild(delegate, "focusedHighlight").visible, LauncherModel.get(i).focused)
223
id: clickFlickTestCase
224
when: windowShown && testCase.completed
226
260
function test_clickFlick_data() {
227
261
var listView = findChild(launcher, "launcherListView");
229
{tag: "unfolded top", flickSpeed: units.gu(200), clickY: listView.topMargin + units.gu(2), expectFlick: false},
230
{tag: "folded top", flickSpeed: -units.gu(200), clickY: listView.topMargin + units.gu(2), expectFlick: true},
231
{tag: "unfolded bottom", flickSpeed: -units.gu(200), clickY: listView.height - listView.topMargin - units.gu(1), expectFlick: false},
232
{tag: "folded bottom", flickSpeed: units.gu(200), clickY: listView.height - listView.topMargin - units.gu(1), expectFlick: true},
263
{tag: "unfolded top", positionViewAtBeginning: false,
264
clickY: listView.topMargin + units.gu(2),
267
{tag: "folded top", positionViewAtBeginning: true,
268
clickY: listView.topMargin + units.gu(2),
271
{tag: "unfolded bottom", positionViewAtBeginning: true,
272
clickY: listView.height - listView.topMargin - units.gu(1),
275
{tag: "folded bottom", positionViewAtBeginning: false,
276
clickY: listView.height - listView.topMargin - units.gu(1),
236
281
function test_clickFlick(data) {
237
282
launcher.lastSelectedApplication = "";
238
revealer.dragLauncherIntoView();
283
dragLauncherIntoView();
239
284
var listView = findChild(launcher, "launcherListView");
241
listView.flick(0, data.flickSpeed);
286
// flicking is unreliable. sometimes it works, sometimes the
287
// list view moves just a tiny bit or not at all, making tests fail.
288
// So for stability's sake we just put the listView in the position
289
// we want to to actually start doing what this tests intends to check.
290
if (data.positionViewAtBeginning) {
291
listView.positionViewAtBeginning();
293
listView.positionViewAtEnd();
242
295
tryCompare(listView, "flicking", false);
244
297
var oldY = listView.contentY;
253
306
verify(launcher.lastSelectedApplication != "");
254
307
compare(listView.contentY, oldY, "Launcher was flicked even though it should only launch an app");
257
// Restore position on top
258
listView.flick(0, units.gu(200));
259
tryCompare(listView, "flicking", false)
260
// Click somewhere in the empty space to make it hide in case it isn't
261
mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
262
revealer.waitUntilLauncherDisappears();
271
function initTestCase() {
272
var listView = findChild(launcher, "launcherListView");
273
tryCompare(listView, "flicking", false)
276
function test_initFirstUnfolded() {
278
// Make sure noone changed the height of the window. The issue this test case
279
// is verifying only happens on certain heights of the Launcher
280
compare(root.height, units.gu(55));
282
var listView = findChild(launcher, "launcherListView");
283
compare(listView.contentY, -listView.topMargin, "Launcher did not start up with first item unfolded");
285
// Now do check that snapping is in fact enabled
286
compare(listView.snapMode, ListView.SnapToItem, "Snapping is not enabled");
292
name: "Drag and Drop"
293
when: windowShown && initTestCase.completed
295
311
function test_dragndrop_data() {
367
383
// Click somewhere in the empty space to make it hide in case it isn't
368
384
mouseClick(launcher, launcher.width - units.gu(1), units.gu(1));
369
revealer.waitUntilLauncherDisappears();
385
waitUntilLauncherDisappears();
372
388
function test_quicklist_dismiss() {
373
revealer.dragLauncherIntoView();
389
dragLauncherIntoView();
374
390
var draggedItem = findChild(launcher, "launcherDelegate5")
375
391
var item0 = findChild(launcher, "launcherDelegate0")
376
392
var fakeDragItem = findChild(launcher, "fakeDragItem")