The following QML file should confirm that the mouse cursor has constantly moved for 10s:
import QtQuick 2.0 import Ubuntu.Components 0.1
Rectangle { width: 500 height: 500
MouseArea { anchors.fill: parent anchors.margins: 30 onPositionChanged: { if (timer2.running) { timer2.restart(); } } hoverEnabled: true }
Button { id: control anchors.centerIn: parent text: "START" onClicked: { timer3.running = true text = "MOVE YOUR MOUSE" } }
Timer { id: timer1 interval: 1000 running: true repeat: true property int timeout: 8 onTriggered: { timeout = timeout - 1 if (timeout <= 0) { running = false console.log("PASS") Qt.quit() } } }
Timer { id: timer2 interval: 200 running: false repeat: true onTriggered: { running = false console.log("FAIL !!!!") Qt.quit() } }
Timer { id: timer3 interval: 2000 running: false onTriggered: { timer2.running = true } } }
The following QML file should confirm that the mouse cursor has constantly moved for 10s:
import QtQuick 2.0
import Ubuntu.Components 0.1
Rectangle {
width: 500
height: 500
MouseArea {
anchors. fill: parent
anchors. margins: 30
onPositionChan ged: {
timer2. restart( );
hoverEnabled: true
if (timer2.running) {
}
}
}
Button {
anchors. centerIn: parent
timer3. running = true
id: control
text: "START"
onClicked: {
text = "MOVE YOUR MOUSE"
}
}
Timer {
onTriggered: {
running = false
console. log("PASS" )
Qt.quit( )
id: timer1
interval: 1000
running: true
repeat: true
property int timeout: 8
timeout = timeout - 1
if (timeout <= 0) {
}
}
}
Timer {
onTriggered: {
console. log("FAIL !!!!")
Qt. quit()
id: timer2
interval: 200
running: false
repeat: true
running = false
}
}
Timer {
onTriggered: {
timer2. running = true
id: timer3
interval: 2000
running: false
}
}
}