diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2016-10-06 19:44:29 +0200 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2016-10-29 11:31:28 +0000 |
commit | acb2bad7fe2fed502cb41ec8f58dad8a035ef3fb (patch) | |
tree | cc67f630975494b0ad146c81479c4e304aea07f5 /tests/auto/input | |
parent | 0df6b590709e201ee1a06ba2df4bffa0dc3a351a (diff) |
ActionInputs shouldn't process when disabled
Change-Id: I93b6a1416cd97bbc492c69e279dfdb6c62e285f9
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto/input')
-rw-r--r-- | tests/auto/input/actioninput/tst_actioninput.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/input/actioninput/tst_actioninput.cpp b/tests/auto/input/actioninput/tst_actioninput.cpp index 2db4cf760..fd87606a7 100644 --- a/tests/auto/input/actioninput/tst_actioninput.cpp +++ b/tests/auto/input/actioninput/tst_actioninput.cpp @@ -132,6 +132,7 @@ private Q_SLOTS: Qt3DInput::Input::ActionInput backendActionInput; Qt3DInput::QActionInput actionInput; + actionInput.setEnabled(true); actionInput.setButtons(QVector<int>() << Qt::Key_Space << Qt::Key_Return); actionInput.setSourceDevice(device); simulateInitialization(&actionInput, &backendActionInput); @@ -172,6 +173,29 @@ private Q_SLOTS: // THEN QCOMPARE(backendActionInput.process(&handler, 1000000000), false); } + + void shouldNotProcessWhenDisabled() + { + // GIVEN + TestDeviceIntegration deviceIntegration; + TestDevice *device = deviceIntegration.createPhysicalDevice("keyboard"); + TestDeviceBackendNode *deviceBackend = deviceIntegration.physicalDevice(device->id()); + Qt3DInput::Input::InputHandler handler; + handler.addInputDeviceIntegration(&deviceIntegration); + + Qt3DInput::Input::ActionInput backendActionInput; + Qt3DInput::QActionInput actionInput; + actionInput.setEnabled(false); + actionInput.setButtons(QVector<int>() << Qt::Key_Space << Qt::Key_Return); + actionInput.setSourceDevice(device); + simulateInitialization(&actionInput, &backendActionInput); + + // WHEN + deviceBackend->setButtonPressed(Qt::Key_Space, true); + + // THEN + QCOMPARE(backendActionInput.process(&handler, 1000000000), false); + } }; QTEST_APPLESS_MAIN(tst_ActionInput) |