@@ -210,37 +210,34 @@ Row {
210 ApplicationManager.focusApplication(app);
210 ApplicationManager.focusApplication(app);
211 compare(app.session.surface.activeFocus, true, "Focused application didn't have activeFocus");
211 compare(app.session.surface.activeFocus, true, "Focused application didn't have activeFocus");
213− // Pop-up a notification
214− addSnapDecisionNotification();
215 notifications.model = mockNotificationsModel;
213 notifications.model = mockNotificationsModel;
217− var notification = findChild(notifications, "notification" + (mockNotificationsModel.count - 1));
215+ // FIXME: Hack: SortFilterProxyModelQML doesn't work with QML ListModels which we use
218− verify(notification !== undefined, "notification wasn't found");
216+ // for mocking here (RoleType can't be found in the QML model). As we only need to show
219−
217+ // one SnapDecision lets just disable the filtering and make appear any notification as a
220− var buttonRow = findChild(notification, "buttonRow");
218+ // SnapDecision.
221− verify(buttonRow !== undefined, "notification buttonRow wasn't found");
219+ var snapDecisionProxyModel = findInvisibleChild(shell, "snapDecisionProxyModel");
222−
220+ snapDecisionProxyModel.filterRegExp = RegExp("");
223− var buttonAccept = findChild(buttonRow, "notify_button0");
224− verify(buttonAccept !== undefined, "notification accept button wasn't found");
226− var buttonCancel = findChild(buttonRow, "notify_button1");
222+ // Pop-up a notification
227− verify(buttonCancel !== undefined, "notification cancel button wasn't found");
223+ addSnapDecisionNotification();
224+ waitForRendering(shell);
226+ // Make sure the notification really opened
227+ var notification = findChild(notifications, "notification" + (mockNotificationsModel.count - 1));
228+ verify(notification !== undefined && notification != null, "notification wasn't found");
230− // Pressing the button should give focus to the notification
230+ // Make sure activeFocus went away from the app window
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;
235 compare(app.session.surface.activeFocus, false, "Notification didn't take active focus");
231 compare(app.session.surface.activeFocus, false, "Notification didn't take active focus");
236− mouseRelease(buttonCancel);
237 compare(stage.interactive, false, "the stage is interactive with a notification showing")
232 compare(stage.interactive, false, "the stage is interactive with a notification showing")
239 // Clicking the button should dismiss the notification and return focus
234 // Clicking the button should dismiss the notification and return focus
235+ var buttonAccept = findChild(notification, "notify_button0");
240− mouseClick(buttonAccept, 0, 0);
236+ mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2);
241− ApplicationManager.focusApplication(app);
237+
242− stage.interactive = true;
238+ // Make sure we're back to normal
243 compare(app.session.surface.activeFocus, true, "App didn't take active focus after snap notification was dismissed");
239 compare(app.session.surface.activeFocus, true, "App didn't take active focus after snap notification was dismissed");
240+ compare(stage.interactive, true, "Stages not interactive again after modal notification has closed");
246 function addSnapDecisionNotification() {
243 function addSnapDecisionNotification() {