@@ -84,21 +84,6 @@ Item {
8484 mockModel.append(n)
8585 }
8686
87− function addSwipeToActNotification() {
88− var n = {
89− type: Notification.SnapDecision,
90− hints: {"x-canonical-snap-decisions-swipe": "true"},
91− summary: "Incoming call",
92− body: "Frank Zappa\n+44 (0)7736 027340",
93− icon: "../graphics/avatars/amanda.png",
94− secondaryIcon: "incoming-call",
95− actions: [{ id: "ok_id", label: "Ok"},
96− { id: "cancel_id", label: "Cancel"}]
97− }
98−
99− mockModel.append(n)
100− }
101−
10287 function add2over1SnapDecisionNotification() {
10388 var n = {
10489 type: Notification.SnapDecision,
@@ -217,12 +202,6 @@ Item {
217202 onClicked: rootRow.addSnapDecisionNotification()
218203 }
219204
220− Button {
221− width: parent.width
222− text: "add a SwipeToAct snap-decision"
223− onClicked: rootRow.addSwipeToActNotification()
224− }
225−
226205 Button {
227206 width: parent.width
228207 text: "add a 2over1 snap-decision"
@@ -299,28 +278,7 @@ Item {
299278 secondaryIconVisible: true,
300279 buttonRowVisible: true,
301280 buttonTinted: true,
302− hasSound: false,
303− hasSwipeToAct: false
304− },
305− {
306− tag: "Snap Decision with SwipeToAct-widget",
307− type: Notification.SnapDecision,
308− hints: {"x-canonical-snap-decisions-swipe": "true"},
309− summary: "Incoming call",
310− body: "Frank Zappa\n+44 (0)7736 027340",
311− icon: "../graphics/avatars/amanda.png",
312− secondaryIcon: "../graphics/applicationIcons/facebook.png",
313− actions: myActionModel,
314− summaryVisible: true,
315− bodyVisible: true,
316− iconVisible: true,
317− shapedIcon: true,
318− nonShapedIcon: false,
319− secondaryIconVisible: true,
320− buttonRowVisible: true,
321− buttonTinted: false,
322− hasSound: false,
323− hasSwipeToAct: true
281+ hasSound: false
324282 },
325283 {
326284 tag: "2-over-1 Snap Decision with button-tint",
@@ -341,8 +299,7 @@ Item {
341299 secondaryIconVisible: false,
342300 buttonRowVisible: false,
343301 buttonTinted: true,
344− hasSound: false,
345− hasSwipeToAct: false
302+ hasSound: false
346303 },
347304 {
348305 tag: "Ephemeral notification - icon-summary layout",
@@ -361,8 +318,7 @@ Item {
361318 secondaryIconVisible: true,
362319 buttonRowVisible: false,
363320 buttonTinted: false,
364− hasSound: false,
365− hasSwipeToAct: false
321+ hasSound: false
366322 },
367323 {
368324 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
@@ -384,8 +340,7 @@ Item {
384340 secondaryIconVisible: true,
385341 buttonRowVisible: false,
386342 buttonTinted: false,
387− hasSound: false,
388− hasSwipeToAct: false
343+ hasSound: false
389344 },
390345 {
391346 tag: "Interactive notification",
@@ -405,8 +360,7 @@ Item {
405360 secondaryIconVisible: false,
406361 buttonRowVisible: false,
407362 buttonTinted: false,
408− hasSound: true,
409− hasSwipeToAct: false
363+ hasSound: true
410364 },
411365 {
412366 tag: "Snap Decision without secondary icon and no button-tint",
@@ -427,8 +381,7 @@ Item {
427381 secondaryIconVisible: false,
428382 buttonRowVisible: true,
429383 buttonTinted: false,
430− hasSound: true,
431− hasSwipeToAct: false
384+ hasSound: true
432385 },
433386 {
434387 tag: "Ephemeral notification",
@@ -448,8 +401,7 @@ Item {
448401 secondaryIconVisible: true,
449402 buttonRowVisible: false,
450403 buttonTinted: false,
451− hasSound: true,
452− hasSwipeToAct: false
404+ hasSound: true
453405 },
454406 {
455407 tag: "Ephemeral notification with non-shaped icon",
@@ -469,8 +421,7 @@ Item {
469421 secondaryIconVisible: false,
470422 buttonRowVisible: false,
471423 buttonTinted: false,
472− hasSound: false,
473− hasSwipeToAct: false
424+ hasSound: false
474425 }
475426 ]
476427 }
@@ -537,61 +488,49 @@ Item {
537488 compare(audioItem.playbackState, data.hasSound ? Audio.PlayingState : Audio.StoppedState, "Audio has wrong state")
538489
539490 if(data.buttonRowVisible) {
540− if(data.hasSwipeToAct) {
541− var swipeButton = findChild(buttonRow, "notify_swipe_button")
542− var slider = findChild(swipeButton, "slider")
543− var swipeMouseArea = findChild(swipeButton, "swipeMouseArea")
544− var x = swipeMouseArea.width / 2
545− var y = swipeMouseArea.height / 2
546− //mouseDrag(swipeButton, x, y, -(swipeMouseArea.width / 2), 0)
547− tryCompareFunction(function() { mouseDrag(slider, x, y, (swipeMouseArea.width / 2) - slider.width, 0); return actionSpy.signalArguments.length > 0; }, true);
548− compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for positive action")
491+ var buttonCancel = findChild(buttonRow, "notify_button1")
492+ var buttonAccept = findChild(buttonRow, "notify_button0")
493+
494+ // only test the left/cancel-button if two actions have been passed in
495+ if (data.actions.length == 2) {
496+ tryCompareFunction(function() { mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2); return actionSpy.signalArguments.length > 0; }, true);
497+ compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
549498 actionSpy.clear()
550− } else {
551− var buttonCancel = findChild(buttonRow, "notify_button1")
552− var buttonAccept = findChild(buttonRow, "notify_button0")
553−
554− // only test the left/cancel-button if two actions have been passed in
555− if (data.actions.length == 2) {
556− tryCompareFunction(function() { mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2); return actionSpy.signalArguments.length > 0; }, true);
557− compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
558− actionSpy.clear()
559− }
560−
561− // check the tinting of the positive/right button
562− verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
563−
564− // click the positive/right button
565− tryCompareFunction(function() { mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2); return actionSpy.signalArguments.length > 0; }, true);
566− compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
499+ }
500+
501+ // check the tinting of the positive/right button
502+ verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
503+
504+ // click the positive/right button
505+ tryCompareFunction(function() { mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2); return actionSpy.signalArguments.length > 0; }, true);
506+ compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
507+ actionSpy.clear()
508+ waitForRendering (notification)
509+
510+ // check if there's a ComboButton created due to more actions being passed
511+ if (data.actions.length > 2) {
512+ var comboButton = findChild(notification, "notify_button2")
513+ tryCompareFunction(function() { return comboButton.expanded == false; }, true);
514+
515+ // click to expand
516+ tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == true; }, true);
517+
518+ // try clicking on choices in expanded comboList
519+ var choiceButton1 = findChild(notification, "notify_button3")
520+ tryCompareFunction(function() { mouseClick(choiceButton1, choiceButton1.width / 2, choiceButton1.height / 2); return actionSpy.signalArguments.length > 0; }, true);
521+ compare(actionSpy.signalArguments[0][0], data.actions[3]["id"], "got wrong id choice action 1")
567522 actionSpy.clear()
568− waitForRendering (notification)
569−
570− // check if there's a ComboButton created due to more actions being passed
571− if (data.actions.length > 2) {
572− var comboButton = findChild(notification, "notify_button2")
573− tryCompareFunction(function() { return comboButton.expanded == false; }, true);
574−
575− // click to expand
576− tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == true; }, true);
577−
578− // try clicking on choices in expanded comboList
579− var choiceButton1 = findChild(notification, "notify_button3")
580− tryCompareFunction(function() { mouseClick(choiceButton1, choiceButton1.width / 2, choiceButton1.height / 2); return actionSpy.signalArguments.length > 0; }, true);
581− compare(actionSpy.signalArguments[0][0], data.actions[3]["id"], "got wrong id choice action 1")
582− actionSpy.clear()
583−
584− var choiceButton2 = findChild(notification, "notify_button4")
585− tryCompareFunction(function() { mouseClick(choiceButton2, choiceButton2.width / 2, choiceButton2.height / 2); return actionSpy.signalArguments.length > 0; }, true);
586− compare(actionSpy.signalArguments[0][0], data.actions[4]["id"], "got wrong id choice action 2")
587− actionSpy.clear()
588−
589− // click to collapse
590− //tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == false; }, true);
591− } else {
592− mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
593− compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
594− }
523+
524+ var choiceButton2 = findChild(notification, "notify_button4")
525+ tryCompareFunction(function() { mouseClick(choiceButton2, choiceButton2.width / 2, choiceButton2.height / 2); return actionSpy.signalArguments.length > 0; }, true);
526+ compare(actionSpy.signalArguments[0][0], data.actions[4]["id"], "got wrong id choice action 2")
527+ actionSpy.clear()
528+
529+ // click to collapse
530+ //tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == false; }, true);
531+ } else {
532+ mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
533+ compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
595534 }
596535 }
597536 }