on xenial help sign in
Adapt notification qmltest to reflect the new layout of snap-decisions with the ComboButton.
c1725b9Mirco Müller
qml/Notifications/Notification.qml+2
@@ -329,6 +329,7 @@ Item {
329 ComboButton {
329 ComboButton {
330 id: comboButton
330 id: comboButton
331
331
332+ objectName: "button2"
332 width: parent.width
333 width: parent.width
333 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3
334 visible: notification.type == Notification.SnapDecision && actionRepeater.count > 3
334 gradient: darkgreyGradient
335 gradient: darkgreyGradient
@@ -365,6 +366,7 @@ Item {
365 MouseArea {
366 MouseArea {
366 id: comboInputArea
367 id: comboInputArea
367
368
369+ objectName: "button" + index
368 width: comboButton.width
370 width: comboButton.width
369 height: comboIcon.height + units.gu(2)
371 height: comboIcon.height + units.gu(2)
370
372
tests/qmltests/Notifications/tst_Notifications.qml+18−23
@@ -71,8 +71,8 @@ Row {
71 actions: [{ id: "ok_id", label: "Ok"},
71 actions: [{ id: "ok_id", label: "Ok"},
72 { id: "cancel_id", label: "Cancel"},
72 { id: "cancel_id", label: "Cancel"},
73 { id: "notreally_id", label: "Not really"},
73 { id: "notreally_id", label: "Not really"},
74− { id: "noway_id", label: "No way"},
74+ { id: "noway_id", label: "messages:No way"},
75− { id: "nada_id", label: "Nada"}]
75+ { id: "nada_id", label: "messages:Nada"}]
76 }
76 }
77
77
78 mockModel.append(n)
78 mockModel.append(n)
@@ -236,8 +236,8 @@ Row {
236 actions: [{ id: "ok_id", label: "Ok"},
236 actions: [{ id: "ok_id", label: "Ok"},
237 { id: "cancel_id", label: "Cancel"},
237 { id: "cancel_id", label: "Cancel"},
238 { id: "notreally_id", label: "Not really"},
238 { id: "notreally_id", label: "Not really"},
239− { id: "noway_id", label: "No way"},
239+ { id: "noway_id", label: "messages:No way"},
240− { id: "nada_id", label: "Nada"}],
240+ { id: "nada_id", label: "messages:Nada"}],
241 summaryVisible: true,
241 summaryVisible: true,
242 bodyVisible: true,
242 bodyVisible: true,
243 iconVisible: true,
243 iconVisible: true,
@@ -439,32 +439,27 @@ Row {
439 actionSpy.clear()
439 actionSpy.clear()
440 waitForRendering(notification)
440 waitForRendering(notification)
441
441
442− // check if there's more than one negative choice
442+ // check if there's a ComboButton created due to more actions being passed
443 if (data.actions.length > 2) {
443 if (data.actions.length > 2) {
444− var initialHeight = notification.implicitHeight
444+ var comboButton = findChild(notification, "button2")
445+ tryCompareFunction(function() { return comboButton.expanded == false; }, true);
445
446
446 // click to expand
447 // click to expand
447− mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
448+ tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == true; }, true);
449+
450+ // try clicking on choices in expanded comboList
448− var contentColumn = findChild(notification, "contentColumn")
451+ var choiceButton1 = findChild(notification, "button3")
449− var collapsedContentColumnHeight = contentColumn.height;
452+ tryCompareFunction(function() { mouseClick(choiceButton1, choiceButton1.width / 2, choiceButton1.height / 2); return actionSpy.signalArguments.length > 0; }, true);
450− // Waiting for the inner column to change height because buttons appear
453+ compare(actionSpy.signalArguments[0][0], data.actions[3]["id"], "got wrong id choice action 1")
451− tryCompareFunction(function() { return collapsedContentColumnHeight != contentColumn.height; }, true);
452− // Waiting for notification to reach its target size
453− tryCompare(notification, "height", contentColumn.height + contentColumn.spacing * 2)
454 actionSpy.clear()
454 actionSpy.clear()
455
455
456− // test the additional buttons
456+ var choiceButton2 = findChild(notification, "button4")
457− for (var i = 2; i < data.actions.length; i++) {
457+ tryCompareFunction(function() { mouseClick(choiceButton2, choiceButton2.width / 2, choiceButton2.height / 2); return actionSpy.signalArguments.length > 0; }, true);
458− var buttonColumn = findChild(notification, "buttonColumn")
459− var button = findChild(buttonColumn, "button" + i)
460− mouseClick(button, button.width / 2, button.height / 2)
461− compare(actionSpy.signalArguments[0][0], data.actions[i]["id"], "got wrong id for additional negative action")
458+ compare(actionSpy.signalArguments[0][0], data.actions[4]["id"], "got wrong id choice action 2")
462− actionSpy.clear()
459+ actionSpy.clear()
463− }
464
460
465 // click to collapse
461 // click to collapse
466− mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
462+ //tryCompareFunction(function() { mouseClick(comboButton, comboButton.width - comboButton.__styleInstance.dropDownWidth / 2, comboButton.height / 2); return comboButton.expanded == false; }, true);
467− tryCompare(notification, "height", initialHeight)
468 } else {
463 } else {
469 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
464 mouseClick(buttonCancel, buttonCancel.width / 2, buttonCancel.height / 2)
470 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
465 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")