~mzanetti/unity8/hide-settings-count-emblem

« back to all changes in this revision

Viewing changes to tests/qmltests/Launcher/tst_Launcher.qml

  • Committer: CI Train Bot
  • Author(s): Daniel d'Andrada
  • Date: 2015-02-11 17:11:21 UTC
  • mfrom: (1593.1.2 improveLauncherTests)
  • Revision ID: ci-train-bot@canonical.com-20150211171121-x0v536z3kj78n8r8
Improve Launcher tests, making them more reliable 
Approved by: Michael Zanetti, PS Jenkins bot

Show diffs side-by-side

added added

removed removed

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