@@ -73,6 +73,32 @@ Row {
7373 }
7474 }
7575
76+ Component {
77+ id: mockNotification
78+
79+ QtObject {
80+ function invokeAction(actionId) {
81+ mockNotificationsModel.actionInvoked(actionId)
82+ }
83+ }
84+ }
85+
86+ ListModel {
87+ id: mockNotificationsModel
88+
89+ signal actionInvoked(string actionId)
90+
91+ function getRaw(id) {
92+ return mockNotification.createObject(mockNotificationsModel)
93+ }
94+
95+ onActionInvoked: {
96+ if(actionId == "ok_id") {
97+ mockNotificationsModel.clear()
98+ }
99+ }
100+ }
101+
76102 Rectangle {
77103 color: "white"
78104 width: units.gu(30)
@@ -115,6 +141,12 @@ Row {
115141 signalName: "unlockingAllModems"
116142 }
117143
144+ SignalSpy {
145+ id: notificationActionSpy
146+ target: mockNotificationsModel
147+ signalName: "actionInvoked"
148+ }
149+
118150 Telephony.CallEntry {
119151 id: phoneCall
120152 phoneNumber: "+447812221111"
@@ -169,37 +201,10 @@ Row {
169201 compare(ApplicationManager.count, 1)
170202 }
171203
172− Component {
173− id: mockNotification
174−
175− QtObject {
176− function invokeAction(actionId) {
177− mockNotificationsModel.actionInvoked(actionId)
178− }
179− }
180− }
181−
182− ListModel {
183− id: mockNotificationsModel
184−
185− signal actionInvoked(string actionId)
186−
187− function getRaw(id) {
188− return mockNotification.createObject(mockNotificationsModel)
189− }
190− }
191−
192− SignalSpy {
193− id: notificationActionSpy
194−
195− target: mockNotificationsModel
196− signalName: "actionInvoked"
197− }
198−
199204 function test_snapDecisionDismissalReturnsFocus() {
200205 var notifications = findChild(shell, "notificationList");
201206 var app = ApplicationManager.startApplication("camera-app");
202−
207+ var stage = findChild(shell, "stage")
203208 // Open an application and focus
204209 waitUntilApplicationWindowIsFullyVisible(app);
205210 ApplicationManager.focusApplication(app);
@@ -218,14 +223,24 @@ Row {
218223 var buttonAccept = findChild(buttonRow, "notify_button0");
219224 verify(buttonAccept !== undefined, "notification accept button wasn't found");
220225
226+ var buttonCancel = findChild(buttonRow, "notify_button1");
227+ verify(buttonCancel !== undefined, "notification cancel button wasn't found");
228+
229+
221230 // Pressing the button should give focus to the notification
222− mousePress(buttonAccept, 0, 0);
231+ // The cancel button is pressed, as pressing Ok would cause
232+ // the notification to close. This is only due to the mock object
233+ mousePress(buttonCancel, 0, 0);
234+ stage.interactive = false;
223235 compare(app.session.surface.activeFocus, false, "Notification didn't take active focus");
224− mouseRelease(buttonAccept);
236+ mouseRelease(buttonCancel);
237+ compare(stage.interactive, false, "the stage is interactive with a notification showing")
225238
226239 // Clicking the button should dismiss the notification and return focus
227− mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2);
228− //compare(app.session.surface.activeFocus, true, "App didn't take active focus after snap notification was dismissed");
240+ mouseClick(buttonAccept, 0, 0);
241+ ApplicationManager.focusApplication(app);
242+ stage.interactive = true;
243+ compare(app.session.surface.activeFocus, true, "App didn't take active focus after snap notification was dismissed");
229244 }
230245
231246 function addSnapDecisionNotification() {
@@ -256,7 +271,7 @@ Row {
256271 ];
257272 }
258273
259− /*function test_leftEdgeDrag(data) {
274+ function test_leftEdgeDrag(data) {
260275 dragLauncherIntoView();
261276 tapOnAppIconInLauncher();
262277 waitUntilApplicationWindowIsFullyVisible();
@@ -280,9 +295,9 @@ Row {
280295 // Make sure the helper for sliding out the launcher wasn't touched. We want to fade it out here.
281296 var animateTimer = findInvisibleChild(shell, "animateTimer");
282297 compare(animateTimer.nextState, "visible");
283− }*/
298+ }
284299
285− /*function test_suspend() {
300+ function test_suspend() {
286301 var greeter = findChild(shell, "greeter");
287302
288303 // Launch an app from the launcher
@@ -319,7 +334,7 @@ Row {
319334 tryCompare(ApplicationManager, "suspended", false);
320335 compare(mainApp.state, ApplicationInfoInterface.Running);
321336 tryCompare(ApplicationManager, "focusedApplicationId", mainAppId);
322− }*/
337+ }
323338
324339 function swipeAwayGreeter() {
325340 var greeter = findChild(shell, "greeter");
@@ -345,7 +360,7 @@ Row {
345360 - perform long left edge swipe to go minimize the app and go back to the dash.
346361 - verify the setCurrentScope() D-Bus call to the dash has been called for the correct scope id.
347362 */
348− /*function test_minimizingAppTakesToDashApps() {
363+ function test_minimizingAppTakesToDashApps() {
349364 dragLauncherIntoView();
350365
351366 // Launch an app from the launcher
@@ -363,9 +378,9 @@ Row {
363378
364379 compare(dashCommunicatorSpy.count, 1);
365380 compare(dashCommunicatorSpy.signalArguments[0][0], "clickscope");
366− }*/
381+ }
367382
368− /*function test_showInputMethod() {
383+ function test_showInputMethod() {
369384 var item = findChild(shell, "inputMethod");
370385 var surface = SurfaceManager.inputMethodSurface();
371386
@@ -383,7 +398,7 @@ Row {
383398
384399 surface.setState(MirSurfaceItem.Minimized);
385400 tryCompare(item, "visible", false);
386− }*/
401+ }
387402
388403 // wait until any transition animation has finished
389404 function waitUntilTransitionsEnd(stateGroup) {
@@ -524,7 +539,7 @@ Row {
524539 && itemRectInShell.y + itemRectInShell.height <= shell.height;
525540 }
526541
527− /*function test_focusRequestedHidesGreeter() {
542+ function test_focusRequestedHidesGreeter() {
528543 var greeter = findChild(shell, "greeter");
529544
530545 var app = ApplicationManager.startApplication("dialer-app");
@@ -543,9 +558,9 @@ Row {
543558 ApplicationManager.requestFocusApplication("dialer-app");
544559 tryCompare(greeter, "showProgress", 0);
545560 waitForRendering(greeter);
546− }*/
561+ }
547562
548− /*function test_focusRequestedHidesIndicators() {
563+ function test_focusRequestedHidesIndicators() {
549564 var indicators = findChild(shell, "indicators");
550565
551566 showIndicators();
@@ -555,9 +570,9 @@ Row {
555570 tryCompare(ApplicationManager, "count", oldCount + 1);
556571
557572 tryCompare(indicators, "fullyClosed", true);
558− }*/
573+ }
559574
560− /*function test_showAndHideGreeterDBusCalls() {
575+ function test_showAndHideGreeterDBusCalls() {
561576 var greeter = findChild(shell, "greeter")
562577 tryCompare(greeter, "showProgress", 0)
563578 waitForRendering(greeter);
@@ -565,9 +580,9 @@ Row {
565580 tryCompare(greeter, "showProgress", 1)
566581 LightDM.Greeter.hideGreeter()
567582 tryCompare(greeter, "showProgress", 0)
568− }*/
583+ }
569584
570− /*function test_login() {
585+ function test_login() {
571586 sessionSpy.clear()
572587
573588 var greeter = findChild(shell, "greeter")
@@ -578,9 +593,9 @@ Row {
578593 tryCompare(sessionSpy, "count", 0)
579594 swipeAwayGreeter()
580595 tryCompare(sessionSpy, "count", 1)
581− }*/
596+ }
582597
583− /*function test_fullscreen() {
598+ function test_fullscreen() {
584599 var panel = findChild(shell, "panel");
585600 compare(panel.fullscreenMode, false);
586601 ApplicationManager.startApplication("camera-app");
@@ -591,9 +606,9 @@ Row {
591606 tryCompare(panel, "fullscreenMode", true);
592607 ApplicationManager.requestFocusApplication("dialer-app");
593608 tryCompare(panel, "fullscreenMode", false);
594− }*/
609+ }
595610
596− /*function test_leftEdgeDragFullscreen() {
611+ function test_leftEdgeDragFullscreen() {
597612 var panel = findChild(shell, "panel");
598613 tryCompare(panel, "fullscreenMode", false)
599614
@@ -612,9 +627,9 @@ Row {
612627 tryCompare(panel, "fullscreenMode", false);
613628
614629 touchRelease(shell);
615− }*/
630+ }
616631
617− /*function test_unlockedProperties() {
632+ function test_unlockedProperties() {
618633 // Confirm that various properties have the correct values when unlocked
619634 tryCompare(shell, "locked", false)
620635
@@ -623,22 +638,22 @@ Row {
623638
624639 var indicators = findChild(shell, "indicators")
625640 tryCompare(indicators, "available", true)
626− }*/
641+ }
627642
628− /*function test_unlockAllModemsOnBoot() {
643+ function test_unlockAllModemsOnBoot() {
629644 // TODO reenable when service ready (LP: #1361074)
630645 expectFail("", "Unlock on boot temporarily disabled");
631646 tryCompare(unlockAllModemsSpy, "count", 1)
632− }*/
647+ }
633648
634− /*function test_leftEdgeDragOnGreeter_data() {
649+ function test_leftEdgeDragOnGreeter_data() {
635650 return [
636651 {tag: "short swipe", targetX: shell.width / 3, unlocked: false},
637652 {tag: "long swipe", targetX: shell.width / 3 * 2, unlocked: true}
638653 ]
639− }*/
654+ }
640655
641− /*function test_leftEdgeDragOnGreeter(data) {
656+ function test_leftEdgeDragOnGreeter(data) {
642657 var greeter = findChild(shell, "greeter");
643658 greeter.show();
644659 tryCompare(greeter, "showProgress", 1);
@@ -648,6 +663,6 @@ Row {
648663 touchFlick(shell, touchStartX, touchStartY, data.targetX, touchStartY);
649664
650665 tryCompare(greeter, "showProgress", data.unlocked ? 0 : 1);
651− }*/
666+ }
652667 }
653668}