diff options
Diffstat (limited to 'tests/auto/qmltest/events/tst_drag.qml')
-rw-r--r-- | tests/auto/qmltest/events/tst_drag.qml | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/qmltest/events/tst_drag.qml b/tests/auto/qmltest/events/tst_drag.qml index 2653848adc..5c5b885e6c 100644 --- a/tests/auto/qmltest/events/tst_drag.qml +++ b/tests/auto/qmltest/events/tst_drag.qml @@ -150,6 +150,15 @@ Rectangle{ SignalSpy {} } + Component { + id: mouseAreaComponent + + MouseArea { + anchors.fill: parent + hoverEnabled: true + } + } + TestCase { name:"mouserelease" when:windowShown @@ -295,5 +304,26 @@ Rectangle{ else verify(contentYSpy.count > 0) } + + function test_negativeDragDistance_data() { + return [ + { tag: "horizontal", startX: 100, startY: 100, xDistance: -90, yDistance: 0 }, + { tag: "vertical", startX: 100, startY: 100, xDistance: 0, yDistance: -90 } + ] + } + + // Tests that dragging to the left or top actually results in intermediate mouse moves. + function test_negativeDragDistance(data) { + let mouseArea = createTemporaryObject(mouseAreaComponent, root) + verify(mouseArea) + + let positionSpy = signalSpyComponent.createObject(mouseArea, + { target: mouseArea, signalName: "positionChanged" }) + verify(positionSpy) + verify(positionSpy.valid) + + mouseDrag(mouseArea, data.startX, data.startY, data.xDistance, data.yDistance) + verify(positionSpy.count > 2, "Expected more than 2 mouse position changes, but only got " + positionSpy.count) + } } } |