on xenial help sign in
redo the close notification test, using the close button
f59e405Lukáš Tinkl
tests/qmltests/Notifications/tst_Notifications.qml+13−13
@@ -689,12 +689,15 @@ Item {
689 }
689 }
690 }
690 }
691
691
692− function test_clickToClose_data() { // reuse the data
692+ function test_closeButton_data() { // reuse the data
693 notifications.hasMouse = true;
693 notifications.hasMouse = true;
694 return test_NotificationRenderer_data();
694 return test_NotificationRenderer_data();
695 }
695 }
696
696
697− function test_clickToClose(data) {
697+ function test_closeButton(data) {
698+ // hook up notification's completed-signal with model's onCompleted-slot, so that remove() (model) happens on close() (notification)
699+ data.n.completed.connect(mockModel.onCompleted)
700+
698 // populate model with some mock notifications
701 // populate model with some mock notifications
699 mockModel.append(data.n)
702 mockModel.append(data.n)
700
703
@@ -703,21 +706,18 @@ Item {
703 waitForRendering(notifications);
706 waitForRendering(notifications);
704
707
705 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
708 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
709+ waitForRendering(notification);
706 verify(!!notification, "notification wasn't found");
710 verify(!!notification, "notification wasn't found");
707
711
708− // click-to-dismiss check
712+ // close button check
709− waitForRendering(notification);
713+ mouseMove(notification, notification.width/2, notification.height/2);
714+ var closeButton = findChild(notification, "closeButton");
715+ tryCompare(closeButton, "visible", true);
710 var before = mockModel.count;
716 var before = mockModel.count;
711− var canBeClosed = notification.canBeClosed;
712− mouseClick(notification);
717+ mouseClick(closeButton);
713
718
714− if (canBeClosed) {
715− // closing the notification, the model count should be one less
719+ // closing the notification, the model count should be one less
716− tryCompare(mockModel, "count", before - 1)
720+ tryCompare(mockModel, "count", before - 1)
717− } else {
718− // not closing, model stays the same
719− tryCompare(mockModel, "count", before)
720− }
721 }
721 }
722
722
723 function cleanupTestCase() {
723 function cleanupTestCase() {