Files
qml-virtualkey/VirtualKey/Private/InputEventSource.qml
MidoriYakumo df63bc71ef v0.2.0
2017-04-03 22:53:22 +08:00

23 lines
711 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);
}
}