on xenial help sign in
Exercise swipe-to-dismiss functionality in notification qmltest.
02c6914Mirco Müller
qml/Notifications/Notification.qml−1
@@ -37,7 +37,6 @@ Item {
37 property var notification
37 property var notification
38 property color color
38 property color color
39 property bool fullscreen: false
39 property bool fullscreen: false
40− //property bool draggable: (notification.type == Notification.SnapDecision && state == "contracted") || notification.type == Notification.Interactive
41 property bool draggable: state == "contracted" || notification.type !== Notification.Confirmation
40 property bool draggable: state == "contracted" || notification.type !== Notification.Confirmation
42 property int maxHeight
41 property int maxHeight
43 property int margins
42 property int margins
tests/qmltests/Notifications/tst_Notifications.qml+15
@@ -33,6 +33,10 @@ Row {
33 function invokeAction(actionId) {
33 function invokeAction(actionId) {
34 mockModel.actionInvoked(actionId)
34 mockModel.actionInvoked(actionId)
35 }
35 }
36+
37+ function close() {
38+ mockModel.remove(1)
39+ }
36 }
40 }
37 }
41 }
38
42
@@ -482,6 +486,17 @@ Row {
482 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
486 compare(actionSpy.signalArguments[0][0], data.actions[1]["id"], "got wrong id for negative action")
483 }
487 }
484 }
488 }
489+
490+ // swipe-to-dismiss check
491+ if (data.type !== Notification.SnapDecision && notification.state !== "expanded") {
492+ var before = mockModel.count
493+ var dragStart = notification.width * 0.25;
494+ var dragEnd = notification.width;
495+ var dragY = notification.height / 2;
496+ touchFlick(notification, dragStart, dragY, dragEnd, dragY)
497+ waitForRendering(notification)
498+ tryCompare(mockModel, "count", before - 1)
499+ }
485 }
500 }
486 }
501 }
487}
502}