@@ -20,17 +20,34 @@ import ".."
2020import "../../../Notifications"
2121import Ubuntu.Components 0.1
2222import Unity.Test 0.1
23+import Unity.Notifications 1.0
2324
2425Row {
2526 id: rootRow
2627
28+ Component {
29+ id: mockNotification
30+
31+ QtObject {
32+ function invokeAction(actionId) {
33+ mockModel.actionInvoked(actionId)
34+ }
35+ }
36+ }
37+
2738 ListModel {
2839 id: mockModel
40+
41+ signal actionInvoked(string actionId)
42+
43+ function getRaw(id) {
44+ return mockNotification.createObject(mockModel)
45+ }
2946 }
3047
3148 function addSnapDecisionNotification() {
3249 var n = {
33− type: "Notifications.Type.SnapDecision",
50+ type: Notification.SnapDecision,
3451 summary: "Tom Ato",
3552 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.",
3653 icon: "../graphics/avatars/funky.png",
@@ -44,7 +61,7 @@ Row {
4461
4562 function addEphemeralNotification() {
4663 var n = {
47− type: "Notifications.Type.Ephemeral",
64+ type: Notification.Ephemeral,
4865 summary: "Cole Raby",
4966 body: "I did not expect it to be that late.",
5067 icon: "../graphics/avatars/amanda.png",
@@ -57,7 +74,7 @@ Row {
5774
5875 function addEphemeralIconSummaryNotification() {
5976 var n = {
60− type: "Notifications.Type.Ephemeral",
77+ type: Notification.Ephemeral,
6178 summary: "Photo upload completed",
6279 body: "",
6380 icon: "",
@@ -70,7 +87,7 @@ Row {
7087
7188 function addInteractiveNotification() {
7289 var n = {
73− type: "Notifications.Type.Interactive",
90+ type: Notification.Interactive,
7491 summary: "Interactive notification",
7592 body: "This is a notification that can be clicked",
7693 icon: "../graphics/avatars/anna_olsson.png",
@@ -170,7 +187,7 @@ Row {
170187 return [
171188 {
172189 tag: "Snap Decision with secondary icon",
173− type: "Notifications.Type.SnapDecision",
190+ type: Notification.SnapDecision,
174191 summary: "Tom Ato",
175192 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.",
176193 icon: "../graphics/avatars/funky.png",
@@ -186,7 +203,7 @@ Row {
186203 },
187204 {
188205 tag: "Ephemeral notification - icon-summary layout",
189− type: "Notifications.Type.Ephemeral",
206+ type: Notification.Ephemeral,
190207 summary: "Photo upload completed",
191208 body: "",
192209 icon: "",
@@ -201,7 +218,7 @@ Row {
201218 },
202219 {
203220 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
204− type: "Notifications.Type.Ephemeral",
221+ type: Notification.Ephemeral,
205222 summary: "New comment successfully published",
206223 body: "",
207224 icon: "",
@@ -216,7 +233,7 @@ Row {
216233 },
217234 {
218235 tag: "Interactive notification",
219− type: "Notifications.Type.Interactive",
236+ type: Notification.Interactive,
220237 summary: "Interactive notification",
221238 body: "This is a notification that can be clicked",
222239 icon: "../graphics/avatars/amanda.png",
@@ -231,7 +248,7 @@ Row {
231248 },
232249 {
233250 tag: "Snap Decision without secondary icon",
234− type: "Notifications.Type.SnapDecision",
251+ type: Notification.SnapDecision,
235252 summary: "Bro Coly",
236253 body: "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
237254 icon: "../graphics/avatars/anna_olsson.png",
@@ -247,7 +264,7 @@ Row {
247264 },
248265 {
249266 tag: "Ephemeral notification",
250− type: "Notifications.Type.Ephemeral",
267+ type: Notification.Ephemeral,
251268 summary: "Cole Raby",
252269 body: "I did not expect it to be that late.",
253270 icon: "../graphics/avatars/funky.png",
@@ -272,6 +289,8 @@ Row {
272289
273290 SignalSpy {
274291 id: actionSpy
292+
293+ target: mockModel
275294 signalName: "actionInvoked"
276295 }
277296
@@ -303,7 +322,6 @@ Row {
303322 compare(interactiveArea.enabled, data.interactiveAreaEnabled, "check for interactive area")
304323
305324 if(data.interactiveAreaEnabled) {
306− actionSpy.target = notification
307325 mouseClick(notification, notification.width / 2, notification.height / 2)
308326 actionSpy.wait()
309327 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id for interactive action")
@@ -323,7 +341,6 @@ Row {
323341 var buttonAccept = findChild(buttonRow, "button0")
324342
325343 waitForRendering(notification)
326− actionSpy.target = notification
327344 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
328345 actionSpy.wait()
329346 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
@@ -332,6 +349,7 @@ Row {
332349 mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2)
333350 actionSpy.wait()
334351 compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
352+ actionSpy.clear()
335353 }
336354 }
337355 }