summaryrefslogtreecommitdiffstats
path: root/tests/auto/input/qmousedevice/tst_qmousedevice.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2020-01-13 07:53:41 +0100
committerPaul Lemire <paul.lemire@kdab.com>2020-01-28 06:27:54 +0100
commit64f983af68440ff73b985b133a73bd66178557da (patch)
tree85817af83933cfc1556efac367b7b63869e05b4c /tests/auto/input/qmousedevice/tst_qmousedevice.cpp
parent97c534b60f21d232dd814534fd9b53f77bc73fa3 (diff)
QMouseDevice: add updateAxesContinuously property
The default behavior is to only update axes when one of the mouse buttons is pressed. This property, when enabled, allows to record X/Y axes value changes regardless of the state of the mouse buttons. [ChangeLog] QMouseDevice add updateAxesContinuously property Change-Id: Ib54a1e54c6c278ea08722760c2d317ec46437b2f Reviewed-by: Mike Krus <mike.krus@kdab.com>
Diffstat (limited to 'tests/auto/input/qmousedevice/tst_qmousedevice.cpp')
-rw-r--r--tests/auto/input/qmousedevice/tst_qmousedevice.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/input/qmousedevice/tst_qmousedevice.cpp b/tests/auto/input/qmousedevice/tst_qmousedevice.cpp
index fd2c8e603..6a8f39c71 100644
--- a/tests/auto/input/qmousedevice/tst_qmousedevice.cpp
+++ b/tests/auto/input/qmousedevice/tst_qmousedevice.cpp
@@ -50,6 +50,7 @@ private Q_SLOTS:
// THEN
QCOMPARE(mouseDevice.sensitivity(), 0.1f);
+ QCOMPARE(mouseDevice.updateAxesContinuously(), false);
QCOMPARE(mouseDevice.axisCount(), 4);
QCOMPARE(mouseDevice.buttonCount(), 3);
QCOMPARE(mouseDevice.axisNames(), QStringList()
@@ -96,6 +97,25 @@ private Q_SLOTS:
QCOMPARE(mouseDevice.sensitivity(), newValue);
QCOMPARE(spy.count(), 0);
}
+ {
+ // WHEN
+ QSignalSpy spy(&mouseDevice, SIGNAL(updateAxesContinuouslyChanged(bool)));
+ const bool newValue = true;
+ mouseDevice.setUpdateAxesContinuously(newValue);
+
+ // THEN
+ QVERIFY(spy.isValid());
+ QCOMPARE(mouseDevice.updateAxesContinuously(), newValue);
+ QCOMPARE(spy.count(), 1);
+
+ // WHEN
+ spy.clear();
+ mouseDevice.setUpdateAxesContinuously(newValue);
+
+ // THEN
+ QCOMPARE(mouseDevice.updateAxesContinuously(), newValue);
+ QCOMPARE(spy.count(), 0);
+ }
}
void checkCreationData()
@@ -175,6 +195,31 @@ private Q_SLOTS:
}
+ void checkUpdateAxesContinuouslyUpdate()
+ {
+ // GIVEN
+ TestArbiter arbiter;
+ Qt3DInput::QMouseDevice mouseDevice;
+ arbiter.setArbiterOnNode(&mouseDevice);
+
+ {
+ // WHEN
+ mouseDevice.setUpdateAxesContinuously(true);
+ // THEN
+ QCOMPARE(arbiter.dirtyNodes.size(), 1);
+ QCOMPARE(arbiter.dirtyNodes.front(), &mouseDevice);
+ }
+
+ {
+ // WHEN
+ mouseDevice.setSensitivity(true);
+
+ QCOMPARE(arbiter.dirtyNodes.size(), 1);
+ QCOMPARE(arbiter.dirtyNodes.front(), &mouseDevice);
+ }
+
+ }
+
};
QTEST_MAIN(tst_QMouseDevice)