on xenial help sign in
redo the close notification test, using the close button
commitf59e405ca24254bcb4723f00b7b0f7d7ef573841 authorLukáš Tinkl <lukas.tinkl@canonical.com> dateTue 12 Apr 2016, 12:39 (11 years ago) parenta9709b7
1 file changed+13−13
tests/qmltests/Notifications/tst_Notifications.qml+13−13
tests/qmltests/Notifications/tst_Notifications.qml+13−13
@@ -689,12 +689,15 @@ Item {
689689 }
690690 }
691691
692− function test_clickToClose_data() { // reuse the data
692+ function test_closeButton_data() { // reuse the data
693693 notifications.hasMouse = true;
694694 return test_NotificationRenderer_data();
695695 }
696696
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+
698701 // populate model with some mock notifications
699702 mockModel.append(data.n)
700703
@@ -703,21 +706,18 @@ Item {
703706 waitForRendering(notifications);
704707
705708 var notification = findChild(notifications, "notification" + (mockModel.count - 1))
709+ waitForRendering(notification);
706710 verify(!!notification, "notification wasn't found");
707711
708− // click-to-dismiss check
709− waitForRendering(notification);
712+ // close button check
713+ mouseMove(notification, notification.width/2, notification.height/2);
714+ var closeButton = findChild(notification, "closeButton");
715+ tryCompare(closeButton, "visible", true);
710716 var before = mockModel.count;
711− var canBeClosed = notification.canBeClosed;
712− mouseClick(notification);
717+ mouseClick(closeButton);
713718
714− if (canBeClosed) {
715− // closing the notification, the model count should be one less
716− tryCompare(mockModel, "count", before - 1)
717− } else {
718− // not closing, model stays the same
719− tryCompare(mockModel, "count", before)
720− }
719+ // closing the notification, the model count should be one less
720+ tryCompare(mockModel, "count", before - 1)
721721 }
722722
723723 function cleanupTestCase() {