@@ -84,21 +84,6 @@ Item {
84 mockModel.append(n)
84 mockModel.append(n)
87− function addSwipeToActNotification() {
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"}]
102 function add2over1SnapDecisionNotification() {
87 function add2over1SnapDecisionNotification() {
103 var n = {
88 var n = {
104 type: Notification.SnapDecision,
89 type: Notification.SnapDecision,
@@ -217,12 +202,6 @@ Item {
217 onClicked: rootRow.addSnapDecisionNotification()
202 onClicked: rootRow.addSnapDecisionNotification()
222− text: "add a SwipeToAct snap-decision"
223− onClicked: rootRow.addSwipeToActNotification()
227 width: parent.width
206 width: parent.width
228 text: "add a 2over1 snap-decision"
207 text: "add a 2over1 snap-decision"
@@ -299,28 +278,7 @@ Item {
299 secondaryIconVisible: true,
278 secondaryIconVisible: true,
300 buttonRowVisible: true,
279 buttonRowVisible: true,
301 buttonTinted: true,
280 buttonTinted: true,
302− hasSound: false,
281+ hasSound: false
303− hasSwipeToAct: false
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,
318− nonShapedIcon: false,
319− secondaryIconVisible: true,
320− buttonRowVisible: true,
321− buttonTinted: false,
326 tag: "2-over-1 Snap Decision with button-tint",
284 tag: "2-over-1 Snap Decision with button-tint",
@@ -341,8 +299,7 @@ Item {
341 secondaryIconVisible: false,
299 secondaryIconVisible: false,
342 buttonRowVisible: false,
300 buttonRowVisible: false,
343 buttonTinted: true,
301 buttonTinted: true,
344− hasSound: false,
302+ hasSound: false
345− hasSwipeToAct: false
348 tag: "Ephemeral notification - icon-summary layout",
305 tag: "Ephemeral notification - icon-summary layout",
@@ -361,8 +318,7 @@ Item {
361 secondaryIconVisible: true,
318 secondaryIconVisible: true,
362 buttonRowVisible: false,
319 buttonRowVisible: false,
363 buttonTinted: false,
320 buttonTinted: false,
364− hasSound: false,
321+ hasSound: false
365− hasSwipeToAct: false
368 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
324 tag: "Ephemeral notification - check suppression of secondary icon for icon-summary layout",
@@ -384,8 +340,7 @@ Item {
384 secondaryIconVisible: true,
340 secondaryIconVisible: true,
385 buttonRowVisible: false,
341 buttonRowVisible: false,
386 buttonTinted: false,
342 buttonTinted: false,
387− hasSound: false,
343+ hasSound: false
388− hasSwipeToAct: false
391 tag: "Interactive notification",
346 tag: "Interactive notification",
@@ -405,8 +360,7 @@ Item {
405 secondaryIconVisible: false,
360 secondaryIconVisible: false,
406 buttonRowVisible: false,
361 buttonRowVisible: false,
407 buttonTinted: false,
362 buttonTinted: false,
408− hasSound: true,
363+ hasSound: true
409− hasSwipeToAct: false
412 tag: "Snap Decision without secondary icon and no button-tint",
366 tag: "Snap Decision without secondary icon and no button-tint",
@@ -427,8 +381,7 @@ Item {
427 secondaryIconVisible: false,
381 secondaryIconVisible: false,
428 buttonRowVisible: true,
382 buttonRowVisible: true,
429 buttonTinted: false,
383 buttonTinted: false,
430− hasSound: true,
384+ hasSound: true
431− hasSwipeToAct: false
434 tag: "Ephemeral notification",
387 tag: "Ephemeral notification",
@@ -448,8 +401,7 @@ Item {
448 secondaryIconVisible: true,
401 secondaryIconVisible: true,
449 buttonRowVisible: false,
402 buttonRowVisible: false,
450 buttonTinted: false,
403 buttonTinted: false,
451− hasSound: true,
404+ hasSound: true
452− hasSwipeToAct: false
455 tag: "Ephemeral notification with non-shaped icon",
407 tag: "Ephemeral notification with non-shaped icon",
@@ -469,8 +421,7 @@ Item {
469 secondaryIconVisible: false,
421 secondaryIconVisible: false,
470 buttonRowVisible: false,
422 buttonRowVisible: false,
471 buttonTinted: false,
423 buttonTinted: false,
472− hasSound: false,
424+ hasSound: false
473− hasSwipeToAct: false
@@ -537,61 +488,49 @@ Item {
537 compare(audioItem.playbackState, data.hasSound ? Audio.PlayingState : Audio.StoppedState, "Audio has wrong state")
488 compare(audioItem.playbackState, data.hasSound ? Audio.PlayingState : Audio.StoppedState, "Audio has wrong state")
539 if(data.buttonRowVisible) {
490 if(data.buttonRowVisible) {
540− if(data.hasSwipeToAct) {
541− var swipeButton = findChild(buttonRow, "notify_swipe_button")
491+ var buttonCancel = findChild(buttonRow, "notify_button1")
542− var slider = findChild(swipeButton, "slider")
492+ var buttonAccept = findChild(buttonRow, "notify_button0")
543− var swipeMouseArea = findChild(swipeButton, "swipeMouseArea")
493+
544− var x = swipeMouseArea.width / 2
494+ // only test the left/cancel-button if two actions have been passed in
545− var y = swipeMouseArea.height / 2
495+ if (data.actions.length == 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);
496+ tryCompareFunction(function() { mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2); return actionSpy.signalArguments.length > 0; }, true);
548− compare(actionSpy.signalArguments[0][0], data.actions.data(1, ActionModel.RoleActionId), "got wrong id for positive action")
497+ compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
549 actionSpy.clear()
498 actionSpy.clear()
551− var buttonCancel = findChild(buttonRow, "notify_button1")
500+
552− var buttonAccept = findChild(buttonRow, "notify_button0")
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")
561− // check the tinting of the positive/right button
501+ // check the tinting of the positive/right button
562− verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
502+ verify(buttonAccept.color === data.buttonTinted ? "#3fb24f" : "#dddddd", "button has the wrong color-tint")
564− // click the positive/right button
504+ // click the positive/right button
565− tryCompareFunction(function() { mouseClick(buttonAccept, buttonAccept.width / 2, buttonAccept.height / 2); return actionSpy.signalArguments.length > 0; }, true);
505+ 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")
506+ compare(actionSpy.signalArguments[0][0], data.actions[0]["id"], "got wrong id positive action")
508+ waitForRendering (notification)
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);
516+ tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == true; }, true);
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")
567 actionSpy.clear()
522 actionSpy.clear()
568− waitForRendering (notification)
523+
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);
576− tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == true; }, true);
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")
584− var choiceButton2 = findChild(notification, "notify_button4")
524+ var choiceButton2 = findChild(notification, "notify_button4")
585− tryCompareFunction(function() { mouseClick(choiceButton2, choiceButton2.width / 2, choiceButton2.height / 2); return actionSpy.signalArguments.length > 0; }, true);
525+ 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")
526+ compare(actionSpy.signalArguments[0][0], data.actions[4]["id"], "got wrong id choice action 2")
587− actionSpy.clear()
527+ actionSpy.clear()
589− // click to collapse
529+ // click to collapse
590− //tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == false; }, true);
530+ //tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == false; }, true);
591− } else {
531+ } else {
592− mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
532+ mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
593− compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
533+ compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")