Files
qml-virtualkey/VirtualKey/InputEventSource.qml
MidoriYakumo 7d415fc4e8 Update readme
2016-10-28 08:27:30 +08:00

23 lines
704 B
QML

pragma Singleton
import QtTest 1.1
TestEvent {
property var dummyKeyEvent
property int threshold: util.dragThreshold+1
property int threshold2: threshold*threshold
property TestUtil util: TestUtil { }
function mouseDrag(item, sx, sy, ex, ey, button, modifiers, delay) {
mousePress(item, sx, sy, button, modifiers, delay)
var dx, dy
dx = ex>sx?threshold:-threshold
dy = ey>sy?threshold:-threshold
mouseMove(item, sx + dx, sy + dy, delay, button) // forward move > threshold
mouseMove(item, (sx + ex)/2 + dx, (sy + ey)/2 + dy, delay, button) // forward move
mouseMove(item, ex + dx, ey + dy, delay, button) // forward move
mouseRelease(item, ex, ey, button, modifiers, delay)
}
}