@@ -30,7 +30,6 @@ import Unity.Test 0.1 as UT
30import Powerd 0.1
30import Powerd 0.1
32import "../../qml"
32import "../../qml"
33−import "../../qml/Notifications"
@@ -97,12 +96,27 @@ Item {
100− NotificationModel {
99+ Component {
100+ id: mockNotification
103+ function invokeAction(actionId) {
104+ mockNotificationsModel.actionInvoked(actionId)
101 id: mockNotificationsModel
109 id: mockNotificationsModel
111+ signal actionInvoked(string actionId)
113+ function getRaw(id) {
114+ return mockNotification.createObject(mockNotificationsModel)
103 onActionInvoked: {
117 onActionInvoked: {
104− if(action == "ok_id") {
118+ if(actionId == "ok_id") {
105− mockNotificationsModel.remove(1)
119+ mockNotificationsModel.clear()
@@ -128,6 +142,12 @@ Item {
128 signalName: "unlockingAllModems"
142 signalName: "unlockingAllModems"
146+ id: notificationActionSpy
147+ target: mockNotificationsModel
148+ signalName: "actionInvoked"
131 Telephony.CallEntry {
151 Telephony.CallEntry {
132 id: phoneCall
152 id: phoneCall
133 phoneNumber: "+447812221111"
153 phoneNumber: "+447812221111"
@@ -202,6 +222,13 @@ Item {
203 notifications.model = mockNotificationsModel;
223 notifications.model = mockNotificationsModel;
225+ // FIXME: Hack: UnitySortFilterProxyModelQML doesn't work with QML ListModels which we use
226+ // for mocking here (RoleType can't be found in the QML model). As we only need to show
227+ // one SnapDecision lets just disable the filtering and make appear any notification as a
229+ var snapDecisionProxyModel = findInvisibleChild(shell, "snapDecisionProxyModel");
230+ snapDecisionProxyModel.filterRegExp = RegExp("");
205 // Pop-up a notification
232 // Pop-up a notification
206 addSnapDecisionNotification();
233 addSnapDecisionNotification();
207 waitForRendering(shell);
234 waitForRendering(shell);
@@ -226,21 +253,20 @@ Item {
228 function addSnapDecisionNotification() {
255 function addSnapDecisionNotification() {
229− var component = Qt.createComponent("./Notifications/Notification.qml")
256+ var n = {
230− var n = component.createObject("notification", {"nid": 1,
231− "type": Notification.SnapDecision,
257+ type: Notification.SnapDecision,
232− "hints": {"x-canonical-private-affirmative-tint": "true"},
258+ hints: {"x-canonical-private-affirmative-tint": "true"},
233− "summary": "Tom Ato",
259+ summary: "Tom Ato",
234− "body": "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
260+ body: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua.",
235− "icon": "../graphics/avatars/funky.png",
261+ icon: "../graphics/avatars/funky.png",
236− "secondaryIcon": "../graphics/applicationIcons/facebook.png",
262+ secondaryIcon: "../graphics/applicationIcons/facebook.png",
237− "rawActions": ["ok_id", "Ok",
263+ actions: [{ id: "ok_id", label: "Ok"},
238− "cancel_id", "Cancel",
264+ { id: "cancel_id", label: "Cancel"},
239− "notreally_id", "Not really",
265+ { id: "notreally_id", label: "Not really"},
240− "noway_id", "messages:No way",
266+ { id: "noway_id", label: "messages:No way"},
241− "nada_id", "messages:Nada"]})
267+ { id: "nada_id", label: "messages:Nada"}]
242− n.completed.connect(mockNotificationsModel.onCompleted)
268+ }
243− n.actionInvoked.connect(mockNotificationsModel.actionInvoked)
269+
244 mockNotificationsModel.append(n)
270 mockNotificationsModel.append(n)