on xenial help sign in
Trying to get rid of the FIXME/hack in tst_Shell.qml regarding the focus-reset when notifications closed.
eced120Mirco Müller
tests/qmltests/tst_Shell.qml+18−37
@@ -30,6 +30,7 @@ import Unity.Test 0.1 as UT
30import Powerd 0.1
30import Powerd 0.1
31
31
32import "../../qml"
32import "../../qml"
33+import "../../qml/Notifications"
33
34
34Item {
35Item {
35 id: root
36 id: root
@@ -96,25 +97,11 @@ Item {
96 }
97 }
97 }
98 }
98
99
99− Component {
100+ NotificationModel {
100− id: mockNotification
101−
102− QtObject {
103− function invokeAction(actionId) {
104− mockNotificationsModel.actionInvoked(actionId)
105− }
106− }
107− }
108− ListModel {
109 id: mockNotificationsModel
101 id: mockNotificationsModel
110
102
111− signal actionInvoked(string actionId)
112−
113− function getRaw(id) {
114− return mockNotification.createObject(mockNotificationsModel)
115− }
116−
117 onActionInvoked: {
103 onActionInvoked: {
104+ print("from qml - action invoked")
118 if(actionId == "ok_id") {
105 if(actionId == "ok_id") {
119 mockNotificationsModel.clear()
106 mockNotificationsModel.clear()
120 }
107 }
@@ -222,13 +209,6 @@ Item {
222
209
223 notifications.model = mockNotificationsModel;
210 notifications.model = mockNotificationsModel;
224
211
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−
232 // Pop-up a notification
212 // Pop-up a notification
233 addSnapDecisionNotification();
213 addSnapDecisionNotification();
234 waitForRendering(shell);
214 waitForRendering(shell);
@@ -253,20 +233,21 @@ Item {
253 }
233 }
254
234
255 function addSnapDecisionNotification() {
235 function addSnapDecisionNotification() {
256− var n = {
236+ var component = Qt.createComponent("./Notifications/Notification.qml")
237+ var n = component.createObject("notification", {"nid": 1,
257− type: Notification.SnapDecision,
238+ "type": Notification.SnapDecision,
258− hints: {"x-canonical-private-affirmative-tint": "true"},
239+ "hints": {"x-canonical-private-affirmative-tint": "true"},
259− summary: "Tom Ato",
240+ "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.",
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.",
261− icon: "../graphics/avatars/funky.png",
242+ "icon": "../graphics/avatars/funky.png",
262− secondaryIcon: "../graphics/applicationIcons/facebook.png",
243+ "secondaryIcon": "../graphics/applicationIcons/facebook.png",
263− actions: [{ id: "ok_id", label: "Ok"},
244+ "rawActions": ["ok_id", "Ok",
264− { id: "cancel_id", label: "Cancel"},
245+ "cancel_id", "Cancel",
265− { id: "notreally_id", label: "Not really"},
246+ "notreally_id", "Not really",
266− { id: "noway_id", label: "messages:No way"},
247+ "noway_id", "messages:No way",
267− { id: "nada_id", label: "messages:Nada"}]
248+ "nada_id", "messages:Nada"]})
268− }
249+ n.completed.connect(mockNotificationsModel.onCompleted)
269−
250+ n.actionInvoked.connect(mockNotificationsModel.actionInvoked)
270 mockNotificationsModel.append(n)
251 mockNotificationsModel.append(n)
271 }
252 }
272
253