@@ -34,23 +34,19 @@ Item {
3434 Row {
3535 id: rootRow
3636
37− NotificationModel {
38− id: mockModel
39−
40− // add the default/PlaceHolder notification to the model
41− Component.onCompleted: {
42− var component = Qt.createComponent("Notification.qml")
43− var n = component.createObject("notification", {"nid": index++,
44− "type": Notification.PlaceHolder,
45− "hints": {},
46− "summary": "",
47− "body": "",
48− "icon": "",
49− "secondaryIcon": "",
50− "rawActions": []})
51− n.completed.connect(mockModel.onCompleted)
52− append(n)
53− }
37+ // add the default/PlaceHolder notification to the model
38+ Component.onCompleted: {
39+ var component = Qt.createComponent("Notification.qml")
40+ var n = component.createObject("notification", {"nid": index++,
41+ "type": Notification.PlaceHolder,
42+ "hints": {},
43+ "summary": "",
44+ "body": "",
45+ "icon": "",
46+ "secondaryIcon": "",
47+ "rawActions": []})
48+ n.completed.connect(Model.onCompleted)
49+ Model.append(n)
5450 }
5551
5652 function add2over1SnapDecisionNotification() {
@@ -65,8 +61,8 @@ Item {
6561 "rawActions": ["ok_id", "Ok",
6662 "snooze_id", "Snooze",
6763 "view_id", "View"]})
68− n.completed.connect(mockModel.onCompleted)
69− mockModel.append(n)
64+ n.completed.connect(Model.onCompleted)
65+ Model.append(n)
7066 }
7167
7268 function addEphemeralNotification() {
@@ -79,8 +75,8 @@ Item {
7975 "icon": "../../tests/graphics/avatars/amanda.png",
8076 "secondaryIcon": "../../tests/graphics/applicationIcons/facebook.png",
8177 "rawActions": ["reply_id", "Dummy"]})
82− n.completed.connect(mockModel.onCompleted)
83− mockModel.append(n)
78+ n.completed.connect(Model.onCompleted)
79+ Model.append(n)
8480 }
8581
8682 function addEphemeralNonShapedIconNotification() {
@@ -93,8 +89,8 @@ Item {
9389 "icon": "../../tests/graphics/applicationIcons/contacts-app.png",
9490 "secondaryIcon": "",
9591 "rawActions": ["reply_id", "Dummy"]})
96− n.completed.connect(mockModel.onCompleted)
97− mockModel.append(n)
92+ n.completed.connect(Model.onCompleted)
93+ Model.append(n)
9894 }
9995
10096 function addEphemeralIconSummaryNotification() {
@@ -107,8 +103,8 @@ Item {
107103 "icon": "../../tests/graphics/applicationIcons/facebook.png",
108104 "secondaryIcon": "",
109105 "rawActions": ["reply_id", "Dummy"]})
110− n.completed.connect(mockModel.onCompleted)
111− mockModel.append(n)
106+ n.completed.connect(Model.onCompleted)
107+ Model.append(n)
112108 }
113109
114110 function addInteractiveNotification() {
@@ -121,8 +117,8 @@ Item {
121117 "icon": "../../tests/graphics/avatars/anna_olsson.png",
122118 "secondaryIcon": "",
123119 "rawActions": ["reply_id", "Dummy"]})
124− n.completed.connect(mockModel.onCompleted)
125− mockModel.append(n)
120+ n.completed.connect(Model.onCompleted)
121+ Model.append(n)
126122 }
127123
128124 function addConfirmationNotification() {
@@ -136,8 +132,8 @@ Item {
136132 "secondaryIcon": "",
137133 "value": 50,
138134 "rawActions": ["reply_id", "Dummy"]})
139− n.completed.connect(mockModel.onCompleted)
140− mockModel.append(n)
135+ n.completed.connect(Model.onCompleted)
136+ Model.append(n)
141137 }
142138
143139 function add2ndConfirmationNotification() {
@@ -152,19 +148,19 @@ Item {
152148 "secondaryIcon": "",
153149 "value": 85,
154150 "rawActions": ["reply_id", "Dummy"]})
155− n.completed.connect(mockModel.onCompleted)
156− mockModel.append(n)
151+ n.completed.connect(Model.onCompleted)
152+ Model.append(n)
157153 }
158154
159155 function clearNotifications() {
160− while(mockModel.count > 1) {
156+ while(Model.count > 1) {
161157 remove1stNotification()
162158 }
163159 }
164160
165161 function remove1stNotification() {
166− if (mockModel.count > 1) {
167− mockModel.removeSecond()
162+ if (Model.count > 1) {
163+ Model.removeSecond()
168164 }
169165 }
170166
@@ -186,7 +182,7 @@ Item {
186182 margin: units.gu(1)
187183
188184 anchors.fill: parent
189− model: mockModel
185+ model: Model
190186 hasMouse: fakeMouseCB.checked
191187 inverseMode: inverseModeCB.checked
192188 }
@@ -558,7 +554,7 @@ Item {
558554 SignalSpy {
559555 id: actionSpy
560556
561− target: mockModel
557+ target: Model
562558 signalName: "actionInvoked"
563559 }
564560
@@ -569,19 +565,19 @@ Item {
569565
570566 function test_NotificationRenderer(data) {
571567 // make sure the clicks on mocked notifications can be checked against by "actionSpy" (mimicking the NotificationServer component)
572− data.n.actionInvoked.connect(mockModel.actionInvoked)
568+ data.n.actionInvoked.connect(Model.actionInvoked)
573569
574570 // hook up notification's completed-signal with model's onCompleted-slot, so that remove() (model) happens on close() (notification)
575− data.n.completed.connect(mockModel.onCompleted)
571+ data.n.completed.connect(Model.onCompleted)
576572
577573 // populate model with some mock notifications
578− mockModel.append(data.n)
574+ Model.append(data.n)
579575
580576 // make sure the view is properly updated before going on
581577 notifications.forceLayout();
582578 waitForRendering(notifications);
583579
584− var notification = findChild(notifications, "notification" + (mockModel.count - 1))
580+ var notification = findChild(notifications, "notification" + (Model.count - 1))
585581 verify(notification !== undefined, "notification wasn't found");
586582
587583 waitForRendering(notification);
@@ -627,7 +623,7 @@ Item {
627623
628624 // After clicking the state of notifications can change so let's wait
629625 // for their height animations to finish before continuing
630− for (var i = 0; i < mockModel.count; ++i) {
626+ for (var i = 0; i < Model.count; ++i) {
631627 var n = findChild(notifications, "notification" + i)
632628 tryCompare(n, "height", n.state === "contracted" ? units.gu(10) : n.implicitHeight);
633629 }
@@ -685,16 +681,16 @@ Item {
685681
686682 // swipe-to-dismiss check
687683 waitForRendering(notification)
688− var before = mockModel.count
684+ var before = Model.count
689685 var dragStart = notification.width * 0.25;
690686 var dragEnd = notification.width;
691687 var dragY = notification.height / 2;
692688 touchFlick(notification, dragStart, dragY, dragEnd, dragY)
693689 waitForRendering(notification)
694690 if ((data.n.type === Notification.SnapDecision && notification.state === "expanded") || data.n.type === Notification.Confirmation) {
695− tryCompare(mockModel, "count", before)
691+ tryCompare(Model, "count", before)
696692 } else {
697− tryCompare(mockModel, "count", before - 1)
693+ tryCompare(Model, "count", before - 1)
698694 }
699695 }
700696
@@ -705,27 +701,27 @@ Item {
705701
706702 function test_clickToClose(data) {
707703 // populate model with some mock notifications
708− mockModel.append(data.n)
704+ Model.append(data.n)
709705
710706 // make sure the view is properly updated before going on
711707 notifications.forceLayout();
712708 waitForRendering(notifications);
713709
714− var notification = findChild(notifications, "notification" + (mockModel.count - 1))
710+ var notification = findChild(notifications, "notification" + (Model.count - 1))
715711 verify(!!notification, "notification wasn't found");
716712
717713 // click-to-dismiss check
718714 waitForRendering(notification);
719− var before = mockModel.count;
715+ var before = Model.count;
720716 var canBeClosed = notification.canBeClosed;
721717 mouseClick(notification);
722718
723719 if (canBeClosed) {
724720 // closing the notification, the model count should be one less
725− tryCompare(mockModel, "count", before - 1)
721+ tryCompare(Model, "count", before - 1)
726722 } else {
727723 // not closing, model stays the same
728− tryCompare(mockModel, "count", before)
724+ tryCompare(Model, "count", before)
729725 }
730726 }
731727