on xenial help sign in
fix tests
commitde4e86d7b3e8356c87c0fd5d65023a33353e57ec authorLukáš Tinkl <lukas.tinkl@canonical.com> dateWed 6 Apr 2016, 03:27 (11 years ago) parent8db1c75
3 files changed+12−10
qml/Notifications/Notification.qml+1 tests/qmltests/Notifications/tst_Notifications.qml+10−10 tests/qmltests/Notifications/tst_SwipeToAct.qml+1
qml/Notifications/Notification.qml+1
@@ -240,6 +240,7 @@ StyledItem {
240240
241241 Row {
242242 id: topRow
243+ objectName: "topRow"
243244
244245 spacing: notification.margins
245246 anchors {
tests/qmltests/Notifications/tst_Notifications.qml+10−10
@@ -571,10 +571,12 @@ Item {
571571 waitForRendering(notifications);
572572
573573 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
574− verify(notification !== undefined, "notification wasn't found");
575−
576574 waitForRendering(notification);
577− tryCompare(notification, "height", notification.state === "contracted" ? units.gu(10) : notification.implicitHeight);
575+ verify(notification, "notification wasn't found");
576+
577+ var topRow = findChild(notification, "topRow");
578+ tryCompare(notification, "height", notification.state === "contracted" ? topRow.childrenRect.height + notification.margins * 2
579+ : notification.implicitHeight);
578580
579581 var icon = findChild(notification, "icon")
580582 var centeredIcon = findChild(notification, "centeredIcon")
@@ -585,7 +587,6 @@ Item {
585587 var buttonRow = findChild(notification, "buttonRow")
586588 var valueIndicator = findChild(notification, "valueIndicator")
587589 var valueLabel = findChild(notification, "valueLabel")
588− var innerBar = findChild(notification, "innerBar")
589590
590591 compare(icon.visible, data.iconVisible, "avatar-icon visibility is incorrect")
591592 if (icon.visible) {
@@ -596,9 +597,6 @@ Item {
596597 compare(centeredIcon.shaped, data.shaped, "shaped-status is incorrect")
597598 }
598599 compare(valueIndicator.visible, data.valueVisible, "value-indicator visibility is incorrect")
599− if (valueIndicator.visible) {
600− verify(innerBar.color === data.valueTinted ? UbuntuColors.orange : "white", "value-bar has the wrong color-tint")
601− }
602600 compare(valueLabel.visible, data.valueLabelVisible, "value-label visibility is incorrect")
603601
604602 // test input does not fall through
@@ -618,7 +616,9 @@ Item {
618616 // for their height animations to finish before continuing
619617 for (var i = 0; i < mockModel.count; ++i) {
620618 var n = findChild(notifications, "notification" + i)
621− tryCompare(n, "height", n.state === "contracted" ? units.gu(10) : n.implicitHeight);
619+ waitForRendering(n);
620+ var topRow = findChild(n, "topRow");
621+ tryCompare(n, "height", n.state === "contracted" ? topRow.childrenRect.height + n.margins * 2 : n.implicitHeight);
622622 }
623623
624624 if (data.hasSound) {
@@ -651,7 +651,7 @@ Item {
651651 tryCompareFunction(function() { return comboButton.expanded === false; }, true);
652652
653653 // click to expand
654− tryCompareFunction(function() { mouseClick(comboButton, comboButton.width / 2, comboButton.height / 2); return comboButton.expanded === true; }, true);
654+ tryCompareFunction(function() { mouseClick(comboButton, comboButton.width / 2, comboButton.height / 2); return comboButton.expanded; }, true);
655655
656656 // try clicking on choices in expanded comboList
657657 var choiceButton1 = findChild(notification, "notify_button3")
@@ -665,7 +665,7 @@ Item {
665665 actionSpy.clear()
666666
667667 // click to collapse
668− tryCompareFunction(function() { mouseClick(comboButton, comboButton.width / 2, comboButton.height / 2); return comboButton.expanded == false; }, true);
668+ tryCompareFunction(function() { mouseClick(comboButton, comboButton.width / 2, comboButton.height / 2); return !comboButton.expanded; }, true);
669669 } else {
670670 mouseClick(buttonCancel)
671671 compare(actionSpy.signalArguments[0][0], data.n.actions.data(1, ActionModel.RoleActionId), "got wrong id for negative action")
tests/qmltests/Notifications/tst_SwipeToAct.qml+1
@@ -302,6 +302,7 @@ Item {
302302
303303 // add a mock mouse, test clicking the left/right buttons
304304 notifications.hasMouse = true;
305+ waitForRendering(notification);
305306 var leftButton = findChild(swipeButton, "leftButton");
306307 var rightButton = findChild(swipeButton, "rightButton");
307308