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