on xenial help sign in
Improve Launcher tests, making them more reliable
5f946a1Daniel d'Andrada
tests/qmltests/Launcher/tst_Launcher.qml+29−16
@@ -153,6 +153,18 @@ Item {
153 tryCompare(panel, "x", -panel.width, 1000);
153 tryCompare(panel, "x", -panel.width, 1000);
154 }
154 }
155
155
156+ function positionLauncherListAtBeginning() {
157+ var listView = testCase.findChild(launcherLoader.item, "launcherListView");
158+ listView.contentY = -listView.topMargin;
159+ }
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
164+ - listView.height;
165+ }
166+ }
167+
156 // Drag from the left edge of the screen rightwards and check that the launcher
168 // Drag from the left edge of the screen rightwards and check that the launcher
157 // appears (as if being dragged by the finger/pointer)
169 // appears (as if being dragged by the finger/pointer)
158 function test_dragLeftEdgeToRevealLauncherAndTapCenterToDismiss() {
170 function test_dragLeftEdgeToRevealLauncherAndTapCenterToDismiss() {
@@ -179,22 +191,22 @@ Item {
179 launcherApplicationSelected("[...]dialer-app.desktop") */
191 launcherApplicationSelected("[...]dialer-app.desktop") */
180 function test_clickingOnAppIconCausesSignalEmission() {
192 function test_clickingOnAppIconCausesSignalEmission() {
181 dragLauncherIntoView();
193 dragLauncherIntoView();
182− launcher.lastSelectedApplication = ""
194+ launcher.lastSelectedApplication = "";
195+ launcher.inverted = false;
183
196
184− var listView = findChild(launcher, "launcherListView");
197+ positionLauncherListAtBeginning();
185− listView.positionViewAtEnd();
186
198
187− var appIcon = findChild(launcher, "launcherDelegate0")
199+ var appIcon = findChild(launcher, "launcherDelegate0");
188
200
189− verify(appIcon != undefined)
201+ verify(appIcon != undefined);
190
202
191− mouseClick(appIcon)
203+ mouseClick(appIcon);
192
204
193 tryCompare(launcher, "lastSelectedApplication",
205 tryCompare(launcher, "lastSelectedApplication",
194− "dialer-app")
206+ appIcon.appId);
195
207
196 // Tapping on an application icon also dismisses the launcher
208 // Tapping on an application icon also dismisses the launcher
197− waitUntilLauncherDisappears()
209+ waitUntilLauncherDisappears();
198 }
210 }
199
211
200 /* If I click on the dash icon on the launcher
212 /* If I click on the dash icon on the launcher
@@ -290,25 +302,26 @@ Item {
290 function test_clickFlick_data() {
302 function test_clickFlick_data() {
291 var listView = findChild(launcher, "launcherListView");
303 var listView = findChild(launcher, "launcherListView");
292 return [
304 return [
293− {tag: "unfolded top", positionViewAtBeginning: false,
305+ {tag: "unfolded top", positionViewAtBeginning: true,
294 clickY: listView.topMargin + units.gu(2),
306 clickY: listView.topMargin + units.gu(2),
295 expectFlick: false},
307 expectFlick: false},
296
308
297− {tag: "folded top", positionViewAtBeginning: true,
309+ {tag: "folded top", positionViewAtBeginning: false,
298 clickY: listView.topMargin + units.gu(2),
310 clickY: listView.topMargin + units.gu(2),
299 expectFlick: true},
311 expectFlick: true},
300
312
301− {tag: "unfolded bottom", positionViewAtBeginning: true,
313+ {tag: "unfolded bottom", positionViewAtBeginning: false,
302 clickY: listView.height - listView.topMargin - units.gu(1),
314 clickY: listView.height - listView.topMargin - units.gu(1),
303 expectFlick: false},
315 expectFlick: false},
304
316
305− {tag: "folded bottom", positionViewAtBeginning: false,
317+ {tag: "folded bottom", positionViewAtBeginning: true,
306 clickY: listView.height - listView.topMargin - units.gu(1),
318 clickY: listView.height - listView.topMargin - units.gu(1),
307 expectFlick: true},
319 expectFlick: true},
308 ];
320 ];
309 }
321 }
310
322
311 function test_clickFlick(data) {
323 function test_clickFlick(data) {
324+ launcher.inverted = false;
312 launcher.lastSelectedApplication = "";
325 launcher.lastSelectedApplication = "";
313 dragLauncherIntoView();
326 dragLauncherIntoView();
314 var listView = findChild(launcher, "launcherListView");
327 var listView = findChild(launcher, "launcherListView");
@@ -318,9 +331,9 @@ Item {
318 // So for stability's sake we just put the listView in the position
331 // So for stability's sake we just put the listView in the position
319 // we want to to actually start doing what this tests intends to check.
332 // we want to to actually start doing what this tests intends to check.
320 if (data.positionViewAtBeginning) {
333 if (data.positionViewAtBeginning) {
321− listView.positionViewAtBeginning();
334+ positionLauncherListAtBeginning();
322 } else {
335 } else {
323− listView.positionViewAtEnd();
336+ positionLauncherListAtEnd();
324 }
337 }
325 tryCompare(listView, "flicking", false);
338 tryCompare(listView, "flicking", false);
326
339
@@ -455,9 +468,9 @@ Item {
455 // Position launcher to where we need it
468 // Position launcher to where we need it
456 var listView = findChild(launcher, "launcherListView");
469 var listView = findChild(launcher, "launcherListView");
457 if (data.flickTo == "top") {
470 if (data.flickTo == "top") {
458− listView.positionViewAtEnd();
471+ positionLauncherListAtBeginning();
459 } else {
472 } else {
460− listView.positionViewAtBeginning();
473+ positionLauncherListAtEnd();
461 }
474 }
462
475
463 // Doing longpress
476 // Doing longpress