@@ -34,19 +34,23 @@ Item {
35 id: rootRow
35 id: rootRow
37− // add the default/PlaceHolder notification to the model
40+ // add the default/PlaceHolder notification to the model
38− Component.onCompleted: {
41+ Component.onCompleted: {
39− var component = Qt.createComponent("Notification.qml")
42+ var component = Qt.createComponent("Notification.qml")
40− var n = component.createObject("notification", {"nid": index++,
43+ var n = component.createObject("notification", {"nid": index++,
41− "type": Notification.PlaceHolder,
44+ "type": Notification.PlaceHolder,
42− "hints": {},
45+ "hints": {},
43− "summary": "",
46+ "summary": "",
44− "body": "",
47+ "body": "",
45− "icon": "",
48+ "icon": "",
46− "secondaryIcon": "",
49+ "secondaryIcon": "",
47− "rawActions": []})
50+ "rawActions": []})
48− n.completed.connect(Model.onCompleted)
51+ n.completed.connect(mockModel.onCompleted)
49− Model.append(n)
52+ append(n)
52 function add2over1SnapDecisionNotification() {
56 function add2over1SnapDecisionNotification() {
@@ -61,8 +65,8 @@ Item {
61 "rawActions": ["ok_id", "Ok",
65 "rawActions": ["ok_id", "Ok",
62 "snooze_id", "Snooze",
66 "snooze_id", "Snooze",
63 "view_id", "View"]})
67 "view_id", "View"]})
64− n.completed.connect(Model.onCompleted)
68+ n.completed.connect(mockModel.onCompleted)
65− Model.append(n)
69+ mockModel.append(n)
68 function addEphemeralNotification() {
72 function addEphemeralNotification() {
@@ -75,8 +79,8 @@ Item {
75 "icon": "../../tests/graphics/avatars/amanda.png",
79 "icon": "../../tests/graphics/avatars/amanda.png",
76 "secondaryIcon": "../../tests/graphics/applicationIcons/facebook.png",
80 "secondaryIcon": "../../tests/graphics/applicationIcons/facebook.png",
77 "rawActions": ["reply_id", "Dummy"]})
81 "rawActions": ["reply_id", "Dummy"]})
78− n.completed.connect(Model.onCompleted)
82+ n.completed.connect(mockModel.onCompleted)
79− Model.append(n)
83+ mockModel.append(n)
82 function addEphemeralNonShapedIconNotification() {
86 function addEphemeralNonShapedIconNotification() {
@@ -89,8 +93,8 @@ Item {
89 "icon": "../../tests/graphics/applicationIcons/contacts-app.png",
93 "icon": "../../tests/graphics/applicationIcons/contacts-app.png",
90 "secondaryIcon": "",
94 "secondaryIcon": "",
91 "rawActions": ["reply_id", "Dummy"]})
95 "rawActions": ["reply_id", "Dummy"]})
92− n.completed.connect(Model.onCompleted)
96+ n.completed.connect(mockModel.onCompleted)
93− Model.append(n)
97+ mockModel.append(n)
96 function addEphemeralIconSummaryNotification() {
100 function addEphemeralIconSummaryNotification() {
@@ -103,8 +107,8 @@ Item {
103 "icon": "../../tests/graphics/applicationIcons/facebook.png",
107 "icon": "../../tests/graphics/applicationIcons/facebook.png",
104 "secondaryIcon": "",
108 "secondaryIcon": "",
105 "rawActions": ["reply_id", "Dummy"]})
109 "rawActions": ["reply_id", "Dummy"]})
106− n.completed.connect(Model.onCompleted)
110+ n.completed.connect(mockModel.onCompleted)
107− Model.append(n)
111+ mockModel.append(n)
110 function addInteractiveNotification() {
114 function addInteractiveNotification() {
@@ -117,8 +121,8 @@ Item {
117 "icon": "../../tests/graphics/avatars/anna_olsson.png",
121 "icon": "../../tests/graphics/avatars/anna_olsson.png",
118 "secondaryIcon": "",
122 "secondaryIcon": "",
119 "rawActions": ["reply_id", "Dummy"]})
123 "rawActions": ["reply_id", "Dummy"]})
120− n.completed.connect(Model.onCompleted)
124+ n.completed.connect(mockModel.onCompleted)
121− Model.append(n)
125+ mockModel.append(n)
124 function addConfirmationNotification() {
128 function addConfirmationNotification() {
@@ -132,8 +136,8 @@ Item {
132 "secondaryIcon": "",
136 "secondaryIcon": "",
133 "value": 50,
137 "value": 50,
134 "rawActions": ["reply_id", "Dummy"]})
138 "rawActions": ["reply_id", "Dummy"]})
135− n.completed.connect(Model.onCompleted)
139+ n.completed.connect(mockModel.onCompleted)
136− Model.append(n)
140+ mockModel.append(n)
139 function add2ndConfirmationNotification() {
143 function add2ndConfirmationNotification() {
@@ -148,19 +152,19 @@ Item {
148 "secondaryIcon": "",
152 "secondaryIcon": "",
149 "value": 85,
153 "value": 85,
150 "rawActions": ["reply_id", "Dummy"]})
154 "rawActions": ["reply_id", "Dummy"]})
151− n.completed.connect(Model.onCompleted)
155+ n.completed.connect(mockModel.onCompleted)
152− Model.append(n)
156+ mockModel.append(n)
155 function clearNotifications() {
159 function clearNotifications() {
156− while(Model.count > 1) {
160+ while(mockModel.count > 1) {
157 remove1stNotification()
161 remove1stNotification()
161 function remove1stNotification() {
165 function remove1stNotification() {
162− if (Model.count > 1) {
166+ if (mockModel.count > 1) {
163− Model.removeSecond()
167+ mockModel.removeSecond()
@@ -182,7 +186,7 @@ Item {
182 margin: units.gu(1)
186 margin: units.gu(1)
184 anchors.fill: parent
188 anchors.fill: parent
185− model: Model
189+ model: mockModel
186 hasMouse: fakeMouseCB.checked
190 hasMouse: fakeMouseCB.checked
187 inverseMode: inverseModeCB.checked
191 inverseMode: inverseModeCB.checked
@@ -554,7 +558,7 @@ Item {
554 SignalSpy {
558 SignalSpy {
555 id: actionSpy
559 id: actionSpy
557− target: Model
561+ target: mockModel
558 signalName: "actionInvoked"
562 signalName: "actionInvoked"
@@ -565,19 +569,19 @@ Item {
566 function test_NotificationRenderer(data) {
570 function test_NotificationRenderer(data) {
567 // make sure the clicks on mocked notifications can be checked against by "actionSpy" (mimicking the NotificationServer component)
571 // make sure the clicks on mocked notifications can be checked against by "actionSpy" (mimicking the NotificationServer component)
568− data.n.actionInvoked.connect(Model.actionInvoked)
572+ data.n.actionInvoked.connect(mockModel.actionInvoked)
570 // hook up notification's completed-signal with model's onCompleted-slot, so that remove() (model) happens on close() (notification)
574 // hook up notification's completed-signal with model's onCompleted-slot, so that remove() (model) happens on close() (notification)
571− data.n.completed.connect(Model.onCompleted)
575+ data.n.completed.connect(mockModel.onCompleted)
573 // populate model with some mock notifications
577 // populate model with some mock notifications
574− Model.append(data.n)
578+ mockModel.append(data.n)
576 // make sure the view is properly updated before going on
580 // make sure the view is properly updated before going on
577 notifications.forceLayout();
581 notifications.forceLayout();
578 waitForRendering(notifications);
582 waitForRendering(notifications);
580− var notification = findChild(notifications, "notification" + (Model.count - 1))
584+ var notification = findChild(notifications, "notification" + (mockModel.count - 1))
581 verify(notification !== undefined, "notification wasn't found");
585 verify(notification !== undefined, "notification wasn't found");
583 waitForRendering(notification);
587 waitForRendering(notification);
@@ -623,7 +627,7 @@ Item {
624 // After clicking the state of notifications can change so let's wait
628 // After clicking the state of notifications can change so let's wait
625 // for their height animations to finish before continuing
629 // for their height animations to finish before continuing
626− for (var i = 0; i < Model.count; ++i) {
630+ for (var i = 0; i < mockModel.count; ++i) {
627 var n = findChild(notifications, "notification" + i)
631 var n = findChild(notifications, "notification" + i)
628 tryCompare(n, "height", n.state === "contracted" ? units.gu(10) : n.implicitHeight);
632 tryCompare(n, "height", n.state === "contracted" ? units.gu(10) : n.implicitHeight);
@@ -681,16 +685,16 @@ Item {
682 // swipe-to-dismiss check
686 // swipe-to-dismiss check
683 waitForRendering(notification)
687 waitForRendering(notification)
684− var before = Model.count
688+ var before = mockModel.count
685 var dragStart = notification.width * 0.25;
689 var dragStart = notification.width * 0.25;
686 var dragEnd = notification.width;
690 var dragEnd = notification.width;
687 var dragY = notification.height / 2;
691 var dragY = notification.height / 2;
688 touchFlick(notification, dragStart, dragY, dragEnd, dragY)
692 touchFlick(notification, dragStart, dragY, dragEnd, dragY)
689 waitForRendering(notification)
693 waitForRendering(notification)
690 if ((data.n.type === Notification.SnapDecision && notification.state === "expanded") || data.n.type === Notification.Confirmation) {
694 if ((data.n.type === Notification.SnapDecision && notification.state === "expanded") || data.n.type === Notification.Confirmation) {
691− tryCompare(Model, "count", before)
695+ tryCompare(mockModel, "count", before)
693− tryCompare(Model, "count", before - 1)
697+ tryCompare(mockModel, "count", before - 1)
@@ -701,27 +705,27 @@ Item {
702 function test_clickToClose(data) {
706 function test_clickToClose(data) {
703 // populate model with some mock notifications
707 // populate model with some mock notifications
704− Model.append(data.n)
708+ mockModel.append(data.n)
706 // make sure the view is properly updated before going on
710 // make sure the view is properly updated before going on
707 notifications.forceLayout();
711 notifications.forceLayout();
708 waitForRendering(notifications);
712 waitForRendering(notifications);
710− var notification = findChild(notifications, "notification" + (Model.count - 1))
714+ var notification = findChild(notifications, "notification" + (mockModel.count - 1))
711 verify(!!notification, "notification wasn't found");
715 verify(!!notification, "notification wasn't found");
713 // click-to-dismiss check
717 // click-to-dismiss check
714 waitForRendering(notification);
718 waitForRendering(notification);
715− var before = Model.count;
719+ var before = mockModel.count;
716 var canBeClosed = notification.canBeClosed;
720 var canBeClosed = notification.canBeClosed;
717 mouseClick(notification);
721 mouseClick(notification);
719 if (canBeClosed) {
723 if (canBeClosed) {
720 // closing the notification, the model count should be one less
724 // closing the notification, the model count should be one less
721− tryCompare(Model, "count", before - 1)
725+ tryCompare(mockModel, "count", before - 1)
723 // not closing, model stays the same
727 // not closing, model stays the same
724− tryCompare(Model, "count", before)
728+ tryCompare(mockModel, "count", before)