@@ -30,6 +30,7 @@ import Unity.Test 0.1 as UT
3030import Powerd 0.1
3131
3232import "../../qml"
33+import "../../qml/Notifications"
3334
3435Item {
3536 id: root
@@ -96,25 +97,11 @@ Item {
9697 }
9798 }
9899
99− Component {
100− id: mockNotification
101−
102− QtObject {
103− function invokeAction(actionId) {
104− mockNotificationsModel.actionInvoked(actionId)
105− }
106− }
107− }
108− ListModel {
100+ NotificationModel {
109101 id: mockNotificationsModel
110102
111− signal actionInvoked(string actionId)
112−
113− function getRaw(id) {
114− return mockNotification.createObject(mockNotificationsModel)
115− }
116−
117103 onActionInvoked: {
104+ print("from qml - action invoked")
118105 if(actionId == "ok_id") {
119106 mockNotificationsModel.clear()
120107 }
@@ -222,13 +209,6 @@ Item {
222209
223210 notifications.model = mockNotificationsModel;
224211
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
228− // SnapDecision.
229− var snapDecisionProxyModel = findInvisibleChild(shell, "snapDecisionProxyModel");
230− snapDecisionProxyModel.filterRegExp = RegExp("");
231−
232212 // Pop-up a notification
233213 addSnapDecisionNotification();
234214 waitForRendering(shell);
@@ -253,20 +233,21 @@ Item {
253233 }
254234
255235 function addSnapDecisionNotification() {
256− var n = {
257− type: Notification.SnapDecision,
258− hints: {"x-canonical-private-affirmative-tint": "true"},
259− summary: "Tom Ato",
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.",
261− icon: "../graphics/avatars/funky.png",
262− secondaryIcon: "../graphics/applicationIcons/facebook.png",
263− actions: [{ id: "ok_id", label: "Ok"},
264− { id: "cancel_id", label: "Cancel"},
265− { id: "notreally_id", label: "Not really"},
266− { id: "noway_id", label: "messages:No way"},
267− { id: "nada_id", label: "messages:Nada"}]
268− }
269−
236+ var component = Qt.createComponent("./Notifications/Notification.qml")
237+ var n = component.createObject("notification", {"nid": 1,
238+ "type": Notification.SnapDecision,
239+ "hints": {"x-canonical-private-affirmative-tint": "true"},
240+ "summary": "Tom Ato",
241+ "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.",
242+ "icon": "../graphics/avatars/funky.png",
243+ "secondaryIcon": "../graphics/applicationIcons/facebook.png",
244+ "rawActions": ["ok_id", "Ok",
245+ "cancel_id", "Cancel",
246+ "notreally_id", "Not really",
247+ "noway_id", "messages:No way",
248+ "nada_id", "messages:Nada"]})
249+ n.completed.connect(mockNotificationsModel.onCompleted)
250+ n.actionInvoked.connect(mockNotificationsModel.actionInvoked)
270251 mockNotificationsModel.append(n)
271252 }
272253