on xenial help sign in
Updated, fixed and extended qmltest for notifications according to the new confirmation-notification support.
5dcfc03Mirco Müller
qml/Notifications/Notification.qml+2−2
@@ -228,7 +228,7 @@ Item {
228 width: type == Notification.Ephemeral && !bodyLabel.visible ? units.gu(3) : units.gu(6)
228 width: type == Notification.Ephemeral && !bodyLabel.visible ? units.gu(3) : units.gu(6)
229 height: width
229 height: width
230 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
230 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
231− visible: iconSource !== undefined && iconSource != "" && type != Notification.Confirmation
231+ visible: iconSource !== undefined && iconSource !== "" && type !== Notification.Confirmation
232 }
232 }
233
233
234 Column {
234 Column {
@@ -293,7 +293,7 @@ Item {
293 height: width
293 height: width
294 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
294 shaped: notification.hints["x-canonical-non-shaped-icon"] == "true" ? false : true
295 fileSource: icon.fileSource
295 fileSource: icon.fileSource
296− visible: fileSource !== undefined && fileSource != "" && type == Notification.Confirmation
296+ visible: fileSource !== undefined && fileSource !== "" && type === Notification.Confirmation
297 anchors.horizontalCenter: parent.horizontalCenter
297 anchors.horizontalCenter: parent.horizontalCenter
298 }
298 }
299
299
tests/qmltests/Notifications/tst_Notifications.qml+102−41
@@ -53,6 +53,7 @@ Row {
53 summary: "",
53 summary: "",
54 body: "",
54 body: "",
55 icon: "",
55 icon: "",
56+ value: 0,
56 secondaryIcon: "",
57 secondaryIcon: "",
57 actions: []
58 actions: []
58 }
59 }
@@ -125,10 +126,11 @@ Row {
125 function addEphemeralIconSummaryNotification() {
126 function addEphemeralIconSummaryNotification() {
126 var n = {
127 var n = {
127 type: Notification.Ephemeral,
128 type: Notification.Ephemeral,
129+ hints: {"x-canonical-non-shaped-icon": "false"},
128 summary: "Photo upload completed",
130 summary: "Photo upload completed",
129 body: "",
131 body: "",
130− icon: "",
131− secondaryIcon: "../graphics/applicationIcons/facebook.png",
132+ icon: "../graphics/applicationIcons/facebook.png",
133+ secondaryIcon: "",
132 actions: []
134 actions: []
133 }
135 }
134
136
@@ -148,20 +150,37 @@ Row {
148 mockModel.append(n)
150 mockModel.append(n)
149 }
151 }
150
152
153+ function addConfirmationNotification() {
154+ var n = {
155+ type: Notification.Confirmation,
156+ hints: {"x-canonical-non-shaped-icon": "true"},
157+ summary: "Confirmation notification",
158+ body: "",
159+ icon: "image://theme/audio-volume-medium",
160+ secondaryIcon: "",
161+ value: 50,
162+ actions: [],
163+ }
164+
165+ mockModel.append(n)
166+ }
167+
151 function clearNotifications() {
168 function clearNotifications() {
152− mockModel.clear()
169+ while(mockModel.count > 1) {
170+ remove1stNotification()
171+ }
153 }
172 }
154
173
155 function remove1stNotification() {
174 function remove1stNotification() {
156− if (mockModel.count > 0)
175+ if (mockModel.count > 1)
157− mockModel.remove(0)
176+ mockModel.remove(1)
158 }
177 }
159
178
160 Rectangle {
179 Rectangle {
161 id: notificationsRect
180 id: notificationsRect
162
181
163 width: units.gu(40)
182 width: units.gu(40)
164− height: units.gu(71)
183+ height: units.gu(90)
165
184
166 MouseArea{
185 MouseArea{
167 id: clickThroughCatcher
186 id: clickThroughCatcher
@@ -183,7 +202,7 @@ Row {
183 id: interactiveControls
202 id: interactiveControls
184
203
185 width: units.gu(30)
204 width: units.gu(30)
186− height: units.gu(81)
205+ height: units.gu(90)
187 color: "grey"
206 color: "grey"
188
207
189 Column {
208 Column {
@@ -227,6 +246,12 @@ Row {
227 onClicked: addInteractiveNotification()
246 onClicked: addInteractiveNotification()
228 }
247 }
229
248
249+ Button {
250+ width: parent.width
251+ text: "add a confirmation"
252+ onClicked: addConfirmationNotification()
253+ }
254+
230 Button {
255 Button {
231 width: parent.width
256 width: parent.width
232 text: "remove 1st notification"
257 text: "remove 1st notification"
@@ -264,12 +289,14 @@ Row {
264 summaryVisible: true,
289 summaryVisible: true,
265 bodyVisible: true,
290 bodyVisible: true,
266 iconVisible: true,
291 iconVisible: true,
267− shapedIcon: true,
292+ centeredIconVisible: false,
268− nonShapedIcon: false,
293+ shaped: true,
294+ nonShaped: false,
269 secondaryIconVisible: true,
295 secondaryIconVisible: true,
270 buttonRowVisible: true,
296 buttonRowVisible: true,
271 buttonTinted: true,
297 buttonTinted: true,
272− hasSound: false
298+ hasSound: false,
299+ valueVisible: false
273 },
300 },
274 {
301 {
275 tag: "2-over-1 Snap Decision with button-tint",
302 tag: "2-over-1 Snap Decision with button-tint",
@@ -285,31 +312,33 @@ Row {
285 summaryVisible: true,
312 summaryVisible: true,
286 bodyVisible: true,
313 bodyVisible: true,
287 iconVisible: false,
314 iconVisible: false,
288− shapedIcon: false,
315+ centeredIconVisible: false,
289− nonShapedIcon: false,
316+ shaped: false,
290 secondaryIconVisible: false,
317 secondaryIconVisible: false,
291 buttonRowVisible: false,
318 buttonRowVisible: false,
292 buttonTinted: true,
319 buttonTinted: true,
293− hasSound: false
320+ hasSound: false,
321+ valueVisible: false
294 },
322 },
295 {
323 {
296 tag: "Ephemeral notification - icon-summary layout",
324 tag: "Ephemeral notification - icon-summary layout",
297 type: Notification.Ephemeral,
325 type: Notification.Ephemeral,
298− hints: {"x-canonical-private-affirmative-tint": "false"},
326+ hints: {},
299 summary: "Photo upload completed",
327 summary: "Photo upload completed",
300 body: "",
328 body: "",
301− icon: "",
302− secondaryIcon: "../graphics/applicationIcons/facebook.png",
329+ icon: "../graphics/applicationIcons/facebook.png",
330+ secondaryIcon: "",
303 actions: [],
331 actions: [],
304 summaryVisible: true,
332 summaryVisible: true,
305 bodyVisible: false,
333 bodyVisible: false,
306− iconVisible: false,
334+ iconVisible: true,
307− shapedIcon: false,
335+ centeredIconVisible: false,
308− nonShapedIcon: false,
336+ shaped: true,
309− secondaryIconVisible: true,
337+ secondaryIconVisible: false,
310 buttonRowVisible: false,
338 buttonRowVisible: false,
311 buttonTinted: false,
339 buttonTinted: false,
312− hasSound: false
340+ hasSound: false,
341+ valueVisible: false
313 },
342 },
314 {
343 {
315 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
344 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
@@ -326,12 +355,13 @@ Row {
326 bodyVisible: false,
355 bodyVisible: false,
327 interactiveAreaEnabled: false,
356 interactiveAreaEnabled: false,
328 iconVisible: false,
357 iconVisible: false,
329− shapedIcon: false,
358+ centeredIconVisible: false,
330− nonShapedIcon: false,
359+ shaped: false,
331 secondaryIconVisible: true,
360 secondaryIconVisible: true,
332 buttonRowVisible: false,
361 buttonRowVisible: false,
333 buttonTinted: false,
362 buttonTinted: false,
334− hasSound: false
363+ hasSound: false,
364+ valueVisible: false
335 },
365 },
336 {
366 {
337 tag: "Interactive notification",
367 tag: "Interactive notification",
@@ -346,12 +376,13 @@ Row {
346 summaryVisible: true,
376 summaryVisible: true,
347 bodyVisible: true,
377 bodyVisible: true,
348 iconVisible: true,
378 iconVisible: true,
349− shapedIcon: true,
379+ centeredIconVisible: false,
350− nonShapedIcon: false,
380+ shaped: true,
351 secondaryIconVisible: false,
381 secondaryIconVisible: false,
352 buttonRowVisible: false,
382 buttonRowVisible: false,
353 buttonTinted: false,
383 buttonTinted: false,
354− hasSound: true
384+ hasSound: true,
385+ valueVisible: false
355 },
386 },
356 {
387 {
357 tag: "Snap Decision without secondary icon and no button-tint",
388 tag: "Snap Decision without secondary icon and no button-tint",
@@ -367,12 +398,13 @@ Row {
367 summaryVisible: true,
398 summaryVisible: true,
368 bodyVisible: true,
399 bodyVisible: true,
369 iconVisible: true,
400 iconVisible: true,
370− shapedIcon: true,
401+ centeredIconVisible: false,
371− nonShapedIcon: false,
402+ shaped: true,
372 secondaryIconVisible: false,
403 secondaryIconVisible: false,
373 buttonRowVisible: true,
404 buttonRowVisible: true,
374 buttonTinted: false,
405 buttonTinted: false,
375− hasSound: true
406+ hasSound: true,
407+ valueVisible: false
376 },
408 },
377 {
409 {
378 tag: "Ephemeral notification",
410 tag: "Ephemeral notification",
@@ -387,12 +419,13 @@ Row {
387 summaryVisible: true,
419 summaryVisible: true,
388 bodyVisible: true,
420 bodyVisible: true,
389 iconVisible: true,
421 iconVisible: true,
390− shapedIcon: true,
422+ centeredIconVisible: false,
391− nonShapedIcon: false,
423+ shaped: true,
392 secondaryIconVisible: true,
424 secondaryIconVisible: true,
393 buttonRowVisible: false,
425 buttonRowVisible: false,
394 buttonTinted: false,
426 buttonTinted: false,
395− hasSound: true
427+ hasSound: true,
428+ valueVisible: false
396 },
429 },
397 {
430 {
398 tag: "Ephemeral notification with non-shaped icon",
431 tag: "Ephemeral notification with non-shaped icon",
@@ -401,18 +434,40 @@ Row {
401 "x-canonical-non-shaped-icon": "true"},
434 "x-canonical-non-shaped-icon": "true"},
402 summary: "Contacts",
435 summary: "Contacts",
403 body: "Synchronised contacts-database with cloud-storage.",
436 body: "Synchronised contacts-database with cloud-storage.",
404− icon: "../graphics/applicationIcons/contacts-app.png",
437+ icon: "image://theme/contacts-app",
405 secondaryIcon: "",
438 secondaryIcon: "",
406 actions: [],
439 actions: [],
407 summaryVisible: true,
440 summaryVisible: true,
408 bodyVisible: true,
441 bodyVisible: true,
409 iconVisible: true,
442 iconVisible: true,
410− shapedIcon: false,
443+ centeredIconVisible: false,
411− nonShapedIcon: true,
444+ shaped: false,
412 secondaryIconVisible: false,
445 secondaryIconVisible: false,
413 buttonRowVisible: false,
446 buttonRowVisible: false,
414 buttonTinted: false,
447 buttonTinted: false,
415− hasSound: false
448+ hasSound: false,
449+ valueVisible: false
450+ },
451+ {
452+ tag: "Confirmation notification with value",
453+ type: Notification.Confirmation,
454+ hints: {"x-canonical-non-shaped-icon": "true"},
455+ summary: "",
456+ body: "",
457+ icon: "image://theme/audio-volume-medium",
458+ secondaryIcon: "",
459+ value: 50,
460+ actions: [],
461+ summaryVisible: false,
462+ bodyVisible: false,
463+ iconVisible: false,
464+ centeredIconVisible: true,
465+ shaped: false,
466+ secondaryIconVisible: false,
467+ buttonRowVisible: false,
468+ buttonTinted: false,
469+ hasSound: false,
470+ valueVisible: true
416 }
471 }
417 ]
472 ]
418 }
473 }
@@ -450,17 +505,23 @@ Row {
450 waitForRendering(notification);
505 waitForRendering(notification);
451
506
452 var icon = findChild(notification, "icon")
507 var icon = findChild(notification, "icon")
453− var shapedIcon = findChild(notification, "shapedIcon")
454− var nonShapedIcon = findChild(notification, "nonShapedIcon")
508+ var centeredIcon = findChild(notification, "centeredIcon")
455 var interactiveArea = findChild(notification, "interactiveArea")
509 var interactiveArea = findChild(notification, "interactiveArea")
456 var secondaryIcon = findChild(notification, "secondaryIcon")
510 var secondaryIcon = findChild(notification, "secondaryIcon")
457 var summaryLabel = findChild(notification, "summaryLabel")
511 var summaryLabel = findChild(notification, "summaryLabel")
458 var bodyLabel = findChild(notification, "bodyLabel")
512 var bodyLabel = findChild(notification, "bodyLabel")
459 var buttonRow = findChild(notification, "buttonRow")
513 var buttonRow = findChild(notification, "buttonRow")
514+ var valueIndicator = findChild(notification, "valueIndicator")
460
515
461 compare(icon.visible, data.iconVisible, "avatar-icon visibility is incorrect")
516 compare(icon.visible, data.iconVisible, "avatar-icon visibility is incorrect")
517+ if (icon.visible) {
518+ compare(icon.shaped, data.shaped, "shaped-status is incorrect")
519+ }
462− compare(shapedIcon.visible, data.shapedIcon, "shaped-icon visibility is incorrect")
520+ compare(centeredIcon.visible, data.centeredIconVisible, "centered-icon visibility is incorrect")
521+ if (centeredIcon.visible) {
522+ compare(centeredIcon.shaped, data.shaped, "shaped-status is incorrect")
523+ }
463− compare(nonShapedIcon.visible, data.nonShapedIcon, "non-shaped-icon visibility is incorrect")
524+ compare(valueIndicator.visible, data.valueVisible, "value-indicator visibility is incorrect")
464
525
465 // test input does not fall through
526 // test input does not fall through
466 mouseClick(notification, notification.width / 2, notification.height / 2)
527 mouseClick(notification, notification.width / 2, notification.height / 2)