on xenial help sign in
Started to rewrite large portions of the automatic part of the Notification qmltest to work with the new MockNotification and MockNotificationModel... ongoing.
91112e6Mirco Müller
tests/qmltests/Notifications/tst_Notifications.qml+122−92
@@ -267,21 +267,123 @@ Item {
267 name: "NotificationRendererTest"
267 name: "NotificationRendererTest"
268 when: windowShown
268 when: windowShown
269
269
270+ property list<Notification> nlist: [
271+ Notification {
272+ nid: index++
273+ type: Notification.SnapDecision
274+ hints: {"x-canonical-private-affirmative-tint": "true"}
275+ summary: "Theatre at Ferria Stadium"
276+ body: "at Ferria Stadium in Bilbao, Spain\n07578545317"
277+ icon: ""
278+ secondaryIcon: ""
279+ value: 0
280+ rawActions: ["ok_id", "Ok",
281+ "snooze_id", "Snooze",
282+ "view_id", "View"]
283+ },
284+ Notification {
285+ nid: index++
286+ type: Notification.Ephemeral
287+ hints: {}
288+ summary: "Photo upload completed"
289+ body: ""
290+ icon: "../graphics/applicationIcons/facebook.png"
291+ secondaryIcon: ""
292+ value: 0
293+ rawActions: []
294+ },
295+ Notification {
296+ nid: index++
297+ type: Notification.Ephemeral
298+ hints: {"x-canonical-private-affirmative-tint": "false",
299+ "sound-file": "dummy.ogg",
300+ "suppress-sound": "true"}
301+ summary: "New comment successfully published"
302+ body: ""
303+ icon: ""
304+ secondaryIcon: "../graphics/applicationIcons/facebook.png"
305+ value: 0
306+ rawActions: []
307+ },
308+ Notification {
309+ nid: index++
310+ type: Notification.Interactive
311+ hints: {"x-canonical-private-affirmative-tint": "false",
312+ "sound-file": "dummy.ogg"}
313+ summary: "Interactive notification"
314+ body: "This is a notification that can be clicked"
315+ icon: "../graphics/avatars/amanda.png"
316+ secondaryIcon: ""
317+ value: 0
318+ rawActions: ["reply_id", "Dummy"]
319+ },
320+ Notification {
321+ nid: index++
322+ type: Notification.SnapDecision
323+ hints: {"x-canonical-private-affirmative-tint": "false",
324+ "sound-file": "dummy.ogg"}
325+ summary: "Bro Coly"
326+ body: "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."
327+ icon: "../graphics/avatars/anna_olsson.png"
328+ secondaryIcon: ""
329+ value: 0
330+ rawActions: ["accept_id", "Accept",
331+ "reject_id", "Reject"]
332+ },
333+ Notification {
334+ nid: index++
335+ type: Notification.Ephemeral
336+ hints: {"x-canonical-private-affirmative-tint": "false",
337+ "sound-file": "dummy.ogg"}
338+ summary: "Cole Raby"
339+ body: "I did not expect it to be that late."
340+ icon: "../graphics/avatars/funky.png"
341+ secondaryIcon: "../graphics/applicationIcons/facebook.png"
342+ value: 0
343+ rawActions: []
344+ },
345+ Notification {
346+ nid: index++
347+ type: Notification.Ephemeral
348+ hints: {"x-canonical-private-affirmative-tint": "false",
349+ "x-canonical-non-shaped-icon": "true"}
350+ summary: "Contacts"
351+ body: "Synchronised contacts-database with cloud-storage."
352+ icon: "image://theme/contacts-app"
353+ secondaryIcon: ""
354+ value: 0
355+ rawActions: []
356+ },
357+ Notification {
358+ nid: index++
359+ type: Notification.Confirmation
360+ hints: {"x-canonical-non-shaped-icon": "true"}
361+ summary: ""
362+ body: ""
363+ icon: "image://theme/audio-volume-medium"
364+ secondaryIcon: ""
365+ value: 50
366+ rawActions: []
367+ },
368+ Notification {
369+ nid: index++
370+ type: Notification.Confirmation
371+ hints: {"x-canonical-non-shaped-icon": "true",
372+ "x-canonical-value-bar-tint" : "true"}
373+ summary: ""
374+ body: "High Volume"
375+ icon: "image://theme/audio-volume-high"
376+ secondaryIcon: ""
377+ value: 85
378+ rawActions: []
379+ }
380+ ]
381+
270 function test_NotificationRenderer_data() {
382 function test_NotificationRenderer_data() {
271 return [
383 return [
272 {
384 {
273 tag: "2-over-1 Snap Decision with button-tint",
385 tag: "2-over-1 Snap Decision with button-tint",
274− type: Notification.SnapDecision,
386+ n: nlist[0],
275− nid: 2,
276− hints: {"x-canonical-private-affirmative-tint": "true"},
277− summary: "Theatre at Ferria Stadium",
278− body: "at Ferria Stadium in Bilbao, Spain\n07578545317",
279− icon: "",
280− secondaryIcon: "",
281− value: 0,
282− actions: [{ id: "ok_id", label: "Ok"},
283− { id: "snooze_id", label: "Snooze"},
284− { id: "view_id", label: "View"}],
285 summaryVisible: true,
387 summaryVisible: true,
286 bodyVisible: true,
388 bodyVisible: true,
287 iconVisible: false,
389 iconVisible: false,
@@ -297,15 +399,7 @@ Item {
297 },
399 },
298 {
400 {
299 tag: "Ephemeral notification - icon-summary layout",
401 tag: "Ephemeral notification - icon-summary layout",
300− type: Notification.Ephemeral,
402+ n: nlist[1],
301− nid: 3,
302− hints: {},
303− summary: "Photo upload completed",
304− body: "",
305− icon: "../graphics/applicationIcons/facebook.png",
306− secondaryIcon: "",
307− value: 0,
308− actions: [],
309 summaryVisible: true,
403 summaryVisible: true,
310 bodyVisible: false,
404 bodyVisible: false,
311 iconVisible: true,
405 iconVisible: true,
@@ -321,17 +415,7 @@ Item {
321 },
415 },
322 {
416 {
323 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
417 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
324− type: Notification.Ephemeral,
418+ n: nlist[2],
325− nid: 4,
326− hints: {"x-canonical-private-affirmative-tint": "false",
327− "sound-file": "dummy.ogg",
328− "suppress-sound": "true"},
329− summary: "New comment successfully published",
330− body: "",
331− icon: "",
332− secondaryIcon: "../graphics/applicationIcons/facebook.png",
333− value: 0,
334− actions: [],
335 summaryVisible: true,
419 summaryVisible: true,
336 bodyVisible: false,
420 bodyVisible: false,
337 interactiveAreaEnabled: false,
421 interactiveAreaEnabled: false,
@@ -348,16 +432,7 @@ Item {
348 },
432 },
349 {
433 {
350 tag: "Interactive notification",
434 tag: "Interactive notification",
351− type: Notification.Interactive,
435+ n: nlist[3],
352− nid: 5,
353− hints: {"x-canonical-private-affirmative-tint": "false",
354− "sound-file": "dummy.ogg"},
355− summary: "Interactive notification",
356− body: "This is a notification that can be clicked",
357− icon: "../graphics/avatars/amanda.png",
358− secondaryIcon: "",
359− value: 0,
360− actions: [{ id: "reply_id", label: "Dummy"}],
361 summaryVisible: true,
436 summaryVisible: true,
362 bodyVisible: true,
437 bodyVisible: true,
363 iconVisible: true,
438 iconVisible: true,
@@ -373,17 +448,7 @@ Item {
373 },
448 },
374 {
449 {
375 tag: "Snap Decision without secondary icon and no button-tint",
450 tag: "Snap Decision without secondary icon and no button-tint",
376− type: Notification.SnapDecision,
451+ n: nlist[4],
377− nid: 6,
378− hints: {"x-canonical-private-affirmative-tint": "false",
379− "sound-file": "dummy.ogg"},
380− summary: "Bro Coly",
381− body: "At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.",
382− icon: "../graphics/avatars/anna_olsson.png",
383− secondaryIcon: "",
384− value: 0,
385− actions: [{ id: "accept_id", label: "Accept"},
386− { id: "reject_id", label: "Reject"}],
387 summaryVisible: true,
452 summaryVisible: true,
388 bodyVisible: true,
453 bodyVisible: true,
389 iconVisible: true,
454 iconVisible: true,
@@ -399,16 +464,7 @@ Item {
399 },
464 },
400 {
465 {
401 tag: "Ephemeral notification",
466 tag: "Ephemeral notification",
402− type: Notification.Ephemeral,
467+ n: nlist[5],
403− nid: 7,
404− hints: {"x-canonical-private-affirmative-tint": "false",
405− "sound-file": "dummy.ogg"},
406− summary: "Cole Raby",
407− body: "I did not expect it to be that late.",
408− icon: "../graphics/avatars/funky.png",
409− secondaryIcon: "../graphics/applicationIcons/facebook.png",
410− value: 0,
411− actions: [],
412 summaryVisible: true,
468 summaryVisible: true,
413 bodyVisible: true,
469 bodyVisible: true,
414 iconVisible: true,
470 iconVisible: true,
@@ -424,16 +480,7 @@ Item {
424 },
480 },
425 {
481 {
426 tag: "Ephemeral notification with non-shaped icon",
482 tag: "Ephemeral notification with non-shaped icon",
427− type: Notification.Ephemeral,
483+ n: nlist[6],
428− nid: 8,
429− hints: {"x-canonical-private-affirmative-tint": "false",
430− "x-canonical-non-shaped-icon": "true"},
431− summary: "Contacts",
432− body: "Synchronised contacts-database with cloud-storage.",
433− icon: "image://theme/contacts-app",
434− secondaryIcon: "",
435− value: 0,
436− actions: [],
437 summaryVisible: true,
484 summaryVisible: true,
438 bodyVisible: true,
485 bodyVisible: true,
439 iconVisible: true,
486 iconVisible: true,
@@ -449,15 +496,7 @@ Item {
449 },
496 },
450 {
497 {
451 tag: "Confirmation notification with value",
498 tag: "Confirmation notification with value",
452− type: Notification.Confirmation,
499+ n: nlist[7],
453− nid: 9,
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,
500 summaryVisible: false,
462 bodyVisible: false,
501 bodyVisible: false,
463 iconVisible: false,
502 iconVisible: false,
@@ -473,16 +512,7 @@ Item {
473 },
512 },
474 {
513 {
475 tag: "Confirmation notification with value, label and tint",
514 tag: "Confirmation notification with value, label and tint",
476− type: Notification.Confirmation,
515+ n: nlist[8],
477− nid: 10,
478− hints: {"x-canonical-non-shaped-icon": "true",
479− "x-canonical-value-bar-tint" : "true"},
480− summary: "",
481− body: "High Volume",
482− icon: "image://theme/audio-volume-high",
483− secondaryIcon: "",
484− value: 85,
485− actions: [],
486 summaryVisible: false,
516 summaryVisible: false,
487 bodyVisible: false,
517 bodyVisible: false,
488 iconVisible: false,
518 iconVisible: false,
@@ -520,7 +550,7 @@ Item {
520
550
521 function test_NotificationRenderer(data) {
551 function test_NotificationRenderer(data) {
522 // populate model with some mock notifications
552 // populate model with some mock notifications
523− mockModel.append(data)
553+ mockModel.append(data.n)
524
554
525 // make sure the view is properly updated before going on
555 // make sure the view is properly updated before going on
526 notifications.forceLayout();
556 notifications.forceLayout();