on xenial help sign in
Avoid emitting signal completed in the MockNotification, so notifications don't get removed from the model and can still be acted upon/tested further... some test-order reshuffle done.
03082e3Mirco Müller
tests/mocks/Unity/Notifications/MockNotification.cpp+3−1
@@ -19,6 +19,8 @@
19
19
20#include "MockNotification.h"
20#include "MockNotification.h"
21
21
22+#include <QDebug>
23+
22struct MockNotificationPrivate {
24struct MockNotificationPrivate {
23 int id;
25 int id;
24 QString summary;
26 QString summary;
@@ -163,8 +165,8 @@ void MockNotification::setHints(const QVariantMap& hints) {
163void MockNotification::invokeAction(const QString &action) {
165void MockNotification::invokeAction(const QString &action) {
164 for(int i=0; i<p->actions.size(); i++) {
166 for(int i=0; i<p->actions.size(); i++) {
165 if(p->actions[i] == action) {
167 if(p->actions[i] == action) {
166− Q_EMIT completed(p->id);
167 Q_EMIT actionInvoked(action);
168 Q_EMIT actionInvoked(action);
169+ qDebug() << "Info: invoked action" << action;
168 return;
170 return;
169 }
171 }
170 }
172 }
tests/qmltests/Notifications/tst_Notifications.qml+44−44
@@ -268,19 +268,6 @@ Item {
268 property list<Notification> nlist: [
268 property list<Notification> nlist: [
269 Notification {
269 Notification {
270 nid: 1
270 nid: 1
271− type: Notification.SnapDecision
272− hints: {"x-canonical-private-affirmative-tint": "true"}
273− summary: "Theatre at Ferria Stadium"
274− body: "at Ferria Stadium in Bilbao, Spain\n07578545317"
275− icon: ""
276− secondaryIcon: ""
277− value: 0
278− rawActions: ["ok_id", "Ok",
279− "snooze_id", "Snooze",
280− "view_id", "View"]
281− },
282− Notification {
283− nid: 2
284 type: Notification.Ephemeral
271 type: Notification.Ephemeral
285 summary: "Photo upload completed"
272 summary: "Photo upload completed"
286 body: ""
273 body: ""
@@ -290,7 +277,7 @@ Item {
290 rawActions: []
277 rawActions: []
291 },
278 },
292 Notification {
279 Notification {
293− nid: 3
280+ nid: 2
294 type: Notification.Ephemeral
281 type: Notification.Ephemeral
295 hints: {"x-canonical-private-affirmative-tint": "false",
282 hints: {"x-canonical-private-affirmative-tint": "false",
296 "sound-file": "dummy.ogg",
283 "sound-file": "dummy.ogg",
@@ -303,7 +290,7 @@ Item {
303 rawActions: []
290 rawActions: []
304 },
291 },
305 Notification {
292 Notification {
306− nid: 4
293+ nid: 3
307 type: Notification.Interactive
294 type: Notification.Interactive
308 hints: {"x-canonical-private-affirmative-tint": "false",
295 hints: {"x-canonical-private-affirmative-tint": "false",
309 "sound-file": "dummy.ogg"}
296 "sound-file": "dummy.ogg"}
@@ -315,7 +302,7 @@ Item {
315 rawActions: ["reply_id", "Dummy"]
302 rawActions: ["reply_id", "Dummy"]
316 },
303 },
317 Notification {
304 Notification {
318− nid: 5
305+ nid: 4
319 type: Notification.SnapDecision
306 type: Notification.SnapDecision
320 hints: {"x-canonical-private-affirmative-tint": "false",
307 hints: {"x-canonical-private-affirmative-tint": "false",
321 "sound-file": "dummy.ogg"}
308 "sound-file": "dummy.ogg"}
@@ -328,7 +315,7 @@ Item {
328 "reject_id", "Reject"]
315 "reject_id", "Reject"]
329 },
316 },
330 Notification {
317 Notification {
331− nid: 6
318+ nid: 5
332 type: Notification.Ephemeral
319 type: Notification.Ephemeral
333 hints: {"x-canonical-private-affirmative-tint": "false",
320 hints: {"x-canonical-private-affirmative-tint": "false",
334 "sound-file": "dummy.ogg"}
321 "sound-file": "dummy.ogg"}
@@ -340,7 +327,7 @@ Item {
340 rawActions: []
327 rawActions: []
341 },
328 },
342 Notification {
329 Notification {
343− nid: 7
330+ nid: 6
344 type: Notification.Ephemeral
331 type: Notification.Ephemeral
345 hints: {"x-canonical-private-affirmative-tint": "false",
332 hints: {"x-canonical-private-affirmative-tint": "false",
346 "x-canonical-non-shaped-icon": "true"}
333 "x-canonical-non-shaped-icon": "true"}
@@ -352,7 +339,7 @@ Item {
352 rawActions: []
339 rawActions: []
353 },
340 },
354 Notification {
341 Notification {
355− nid: 8
342+ nid: 7
356 type: Notification.Confirmation
343 type: Notification.Confirmation
357 hints: {"x-canonical-non-shaped-icon": "true"}
344 hints: {"x-canonical-non-shaped-icon": "true"}
358 summary: ""
345 summary: ""
@@ -363,7 +350,7 @@ Item {
363 rawActions: []
350 rawActions: []
364 },
351 },
365 Notification {
352 Notification {
366− nid: 9
353+ nid: 8
367 type: Notification.Confirmation
354 type: Notification.Confirmation
368 hints: {"x-canonical-non-shaped-icon": "true",
355 hints: {"x-canonical-non-shaped-icon": "true",
369 "x-canonical-value-bar-tint" : "true"}
356 "x-canonical-value-bar-tint" : "true"}
@@ -373,30 +360,27 @@ Item {
373 secondaryIcon: ""
360 secondaryIcon: ""
374 value: 85
361 value: 85
375 rawActions: []
362 rawActions: []
363+ },
364+ Notification {
365+ nid: 9
366+ type: Notification.SnapDecision
367+ hints: {"x-canonical-private-affirmative-tint": "true"}
368+ summary: "Theatre at Ferria Stadium"
369+ body: "at Ferria Stadium in Bilbao, Spain\n07578545317"
370+ icon: ""
371+ secondaryIcon: ""
372+ value: 0
373+ rawActions: ["ok_id", "Ok",
374+ "snooze_id", "Snooze",
375+ "view_id", "View"]
376 }
376 }
377 ]
377 ]
378
378
379 function test_NotificationRenderer_data() {
379 function test_NotificationRenderer_data() {
380 return [
380 return [
381− {
382− tag: "2-over-1 Snap Decision with button-tint",
383− n: nlist[0],
384− summaryVisible: true,
385− bodyVisible: true,
386− iconVisible: false,
387− centeredIconVisible: false,
388− shaped: false,
389− secondaryIconVisible: false,
390− buttonRowVisible: false,
391− buttonTinted: true,
392− hasSound: false,
393− valueVisible: false,
394− valueLabelVisible: false,
395− valueTinted: false
396− },
397 {
381 {
398 tag: "Ephemeral notification - icon-summary layout",
382 tag: "Ephemeral notification - icon-summary layout",
399− n: nlist[1],
383+ n: nlist[0],
400 summaryVisible: true,
384 summaryVisible: true,
401 bodyVisible: false,
385 bodyVisible: false,
402 iconVisible: true,
386 iconVisible: true,
@@ -412,7 +396,7 @@ Item {
412 },
396 },
413 {
397 {
414 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
398 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
415− n: nlist[2],
399+ n: nlist[1],
416 summaryVisible: true,
400 summaryVisible: true,
417 bodyVisible: false,
401 bodyVisible: false,
418 interactiveAreaEnabled: false,
402 interactiveAreaEnabled: false,
@@ -429,7 +413,7 @@ Item {
429 },
413 },
430 {
414 {
431 tag: "Interactive notification",
415 tag: "Interactive notification",
432− n: nlist[3],
416+ n: nlist[2],
433 summaryVisible: true,
417 summaryVisible: true,
434 bodyVisible: true,
418 bodyVisible: true,
435 iconVisible: true,
419 iconVisible: true,
@@ -445,7 +429,7 @@ Item {
445 },
429 },
446 {
430 {
447 tag: "Snap Decision without secondary icon and no button-tint",
431 tag: "Snap Decision without secondary icon and no button-tint",
448− n: nlist[4],
432+ n: nlist[3],
449 summaryVisible: true,
433 summaryVisible: true,
450 bodyVisible: true,
434 bodyVisible: true,
451 iconVisible: true,
435 iconVisible: true,
@@ -461,7 +445,7 @@ Item {
461 },
445 },
462 {
446 {
463 tag: "Ephemeral notification",
447 tag: "Ephemeral notification",
464− n: nlist[5],
448+ n: nlist[4],
465 summaryVisible: true,
449 summaryVisible: true,
466 bodyVisible: true,
450 bodyVisible: true,
467 iconVisible: true,
451 iconVisible: true,
@@ -477,7 +461,7 @@ Item {
477 },
461 },
478 {
462 {
479 tag: "Ephemeral notification with non-shaped icon",
463 tag: "Ephemeral notification with non-shaped icon",
480− n: nlist[6],
464+ n: nlist[5],
481 summaryVisible: true,
465 summaryVisible: true,
482 bodyVisible: true,
466 bodyVisible: true,
483 iconVisible: true,
467 iconVisible: true,
@@ -493,7 +477,7 @@ Item {
493 },
477 },
494 {
478 {
495 tag: "Confirmation notification with value",
479 tag: "Confirmation notification with value",
496− n: nlist[7],
480+ n: nlist[6],
497 summaryVisible: false,
481 summaryVisible: false,
498 bodyVisible: false,
482 bodyVisible: false,
499 iconVisible: false,
483 iconVisible: false,
@@ -509,7 +493,7 @@ Item {
509 },
493 },
510 {
494 {
511 tag: "Confirmation notification with value, label and tint",
495 tag: "Confirmation notification with value, label and tint",
512− n: nlist[8],
496+ n: nlist[7],
513 summaryVisible: false,
497 summaryVisible: false,
514 bodyVisible: false,
498 bodyVisible: false,
515 iconVisible: false,
499 iconVisible: false,
@@ -522,6 +506,22 @@ Item {
522 valueVisible: true,
506 valueVisible: true,
523 valueLabelVisible: true,
507 valueLabelVisible: true,
524 valueTinted: true
508 valueTinted: true
509+ },
510+ {
511+ tag: "2-over-1 Snap Decision with button-tint",
512+ n: nlist[8],
513+ summaryVisible: true,
514+ bodyVisible: true,
515+ iconVisible: false,
516+ centeredIconVisible: false,
517+ shaped: false,
518+ secondaryIconVisible: false,
519+ buttonRowVisible: false,
520+ buttonTinted: true,
521+ hasSound: false,
522+ valueVisible: false,
523+ valueLabelVisible: false,
524+ valueTinted: false
525 }
525 }
526 ]
526 ]
527 }
527 }