~mterry/unity8/power-button-on-lock

« back to all changes in this revision

Viewing changes to tests/qmltests/tst_ShellWithPin.qml

  • Committer: Michael Terry
  • Date: 2014-11-24 15:25:42 UTC
  • mfrom: (1368.1.82 unity8)
  • Revision ID: michael.terry@canonical.com-20141124152542-5cysva8ds3qfula6
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
61
61
            property bool itemDestroyed: false
62
62
            sourceComponent: Component {
63
63
                Shell {
 
64
                    property string indicatorProfile: "phone"
 
65
 
64
66
                    Component.onDestruction: {
65
67
                        shellLoader.itemDestroyed = true
66
68
                    }
127
129
        property Item shell: shellLoader.status === Loader.Ready ? shellLoader.item : null
128
130
 
129
131
        function init() {
 
132
            tryCompare(shell, "enabled", true); // will be enabled when greeter is all ready
130
133
            sessionSpy.target = findChild(shell, "greeter")
131
134
            swipeAwayGreeter()
132
135
            waitForLockscreen()
135
138
        }
136
139
 
137
140
        function cleanup() {
 
141
            tryCompare(shell, "enabled", true); // make sure greeter didn't leave us in disabled state
 
142
 
138
143
            shellLoader.itemDestroyed = false
139
144
 
140
145
            shellLoader.active = false
155
160
            AccountsService.enableLauncherWhileLocked = true
156
161
            AccountsService.enableIndicatorsWhileLocked = true
157
162
            AccountsService.demoEdges = false
 
163
            callManager.foregroundCall = null
158
164
 
159
165
            // reload our test subject to get it in a fresh state once again
160
166
            shellLoader.active = true
207
213
            tryCompare(lockscreen, "shown", false)
208
214
            tryCompare(greeter, "hasLockedApp", true)
209
215
            tryCompare(greeter, "lockedApp", app)
 
216
            tryCompare(LightDM.Greeter, "active", true)
210
217
            tryCompare(ApplicationManager, "focusedApplicationId", app)
211
218
        }
212
219
 
381
388
            callManager.foregroundCall = phoneCall
382
389
            confirmLockedApp("dialer-app")
383
390
        }
 
391
 
 
392
        function test_emergencyDialerActiveCallPanel() {
 
393
            // Make sure that the following sequence works:
 
394
            // - Enter emergency mode call
 
395
            // - Return to greeter
 
396
            // - Click on active call panel
 
397
            // - Should be back in emergency mode dialer
 
398
 
 
399
            var greeter = findChild(shell, "greeter");
 
400
            var lockscreen = findChild(shell, "lockscreen");
 
401
 
 
402
            lockscreen.emergencyCall();
 
403
            confirmLockedApp("dialer-app");
 
404
            callManager.foregroundCall = phoneCall;
 
405
 
 
406
            LightDM.Greeter.showGreeter();
 
407
            tryCompare(lockscreen, "shown", true);
 
408
            tryCompare(greeter, "hasLockedApp", false);
 
409
 
 
410
            // simulate a callHint press, the real thing requires dialer: url support
 
411
            ApplicationManager.requestFocusApplication("dialer-app");
 
412
 
 
413
            confirmLockedApp("dialer-app");
 
414
        }
 
415
 
 
416
        function test_normalDialerActiveCallPanel() {
 
417
            // Make sure that the following sequence works:
 
418
            // - Log in
 
419
            // - Start a call
 
420
            // - Switch apps
 
421
            // - Click on active call panel
 
422
            // - Should be back in normal dialer
 
423
            // (we've had a bug where we locked screen in this case)
 
424
 
 
425
            var lockscreen = findChild(shell, "lockscreen");
 
426
            var panel = findChild(shell, "panel");
 
427
 
 
428
            enterPin("1234");
 
429
            tryCompare(lockscreen, "shown", false);
 
430
            tryCompare(LightDM.Greeter, "active", false);
 
431
 
 
432
            ApplicationManager.startApplication("dialer-app", ApplicationManager.NoFlag);
 
433
            tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
 
434
            callManager.foregroundCall = phoneCall;
 
435
 
 
436
            ApplicationManager.requestFocusApplication("unity8-dash");
 
437
            tryCompare(ApplicationManager, "focusedApplicationId", "unity8-dash");
 
438
            tryCompare(panel.callHint, "visible", true);
 
439
 
 
440
            // simulate a callHint press, the real thing requires dialer: url support
 
441
            ApplicationManager.requestFocusApplication("dialer-app");
 
442
 
 
443
            tryCompare(ApplicationManager, "focusedApplicationId", "dialer-app");
 
444
            tryCompare(lockscreen, "shown", false);
 
445
            tryCompare(LightDM.Greeter, "active", false);
 
446
        }
 
447
 
 
448
        function test_suspend() {
 
449
            var greeter = findChild(shell, "greeter");
 
450
 
 
451
            // Put it to sleep
 
452
            Powerd.status = Powerd.Off;
 
453
 
 
454
            // If locked, ApplicationManager.suspended should be true
 
455
            tryCompare(ApplicationManager, "suspended", true);
 
456
 
 
457
            // And wake up
 
458
            Powerd.status = Powerd.On;
 
459
            tryCompare(greeter, "showProgress", 1);
 
460
 
 
461
            // Swipe away greeter to focus app
 
462
            swipeAwayGreeter();
 
463
 
 
464
            // We have a lockscreen, make sure we're still suspended
 
465
            tryCompare(ApplicationManager, "suspended", true);
 
466
 
 
467
            enterPin("1234")
 
468
 
 
469
            // Now that the lockscreen has gone too, make sure we're waking up
 
470
            tryCompare(ApplicationManager, "suspended", false);
 
471
 
 
472
        }
 
473
 
384
474
    }
385
475
}