summaryrefslogtreecommitdiffstats
path: root/tests/auto/input
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-12 03:04:37 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2019-10-12 03:04:37 +0200
commitf42bf69fc702ccf6abeb9ae8699c309c24b30f1b (patch)
treec488518a79b807f847ebff74a3f85acbe177ae59 /tests/auto/input
parent08afa0d65437f1afe700d06cbb3d729322371993 (diff)
parent73bfd21fcbe9f7f647edcbe19b7153ac4cc5c859 (diff)
Merge remote-tracking branch 'origin/5.15' into dev
Diffstat (limited to 'tests/auto/input')
-rw-r--r--tests/auto/input/axis/tst_axis.cpp25
-rw-r--r--tests/auto/input/qaxis/tst_qaxis.cpp18
2 files changed, 18 insertions, 25 deletions
diff --git a/tests/auto/input/axis/tst_axis.cpp b/tests/auto/input/axis/tst_axis.cpp
index 42f7f56fc..8ad8098af 100644
--- a/tests/auto/input/axis/tst_axis.cpp
+++ b/tests/auto/input/axis/tst_axis.cpp
@@ -65,7 +65,7 @@ private Q_SLOTS:
axis.addInput(&axisInput);
// WHEN
- simulateInitialization(&axis, &backendAxis);
+ simulateInitializationSync(&axis, &backendAxis);
// THEN
QCOMPARE(backendAxis.peerId(), axis.id());
@@ -97,7 +97,7 @@ private Q_SLOTS:
axis.addInput(&axisInput);
// WHEN
- simulateInitialization(&axis, &backendAxis);
+ simulateInitializationSync(&axis, &backendAxis);
backendAxis.setAxisValue(883.0f);
backendAxis.cleanup();
@@ -110,33 +110,30 @@ private Q_SLOTS:
void checkPropertyChanges()
{
// GIVEN
+ Qt3DInput::QAxis axis;
Qt3DInput::Input::Axis backendAxis;
- Qt3DCore::QPropertyUpdatedChangePtr updateChange;
+ simulateInitializationSync(&axis, &backendAxis);
// WHEN
- updateChange = QSharedPointer<Qt3DCore::QPropertyUpdatedChange>::create(Qt3DCore::QNodeId());
- updateChange->setPropertyName("enabled");
- updateChange->setValue(true);
- backendAxis.sceneChangeEvent(updateChange);
+ axis.setEnabled(false);
+ backendAxis.syncFromFrontEnd(&axis, false);
// THEN
- QCOMPARE(backendAxis.isEnabled(), true);
+ QCOMPARE(backendAxis.isEnabled(), false);
// WHEN
DummyAxisInput input;
const Qt3DCore::QNodeId inputId = input.id();
- const auto nodeAddedChange = Qt3DCore::QPropertyNodeAddedChangePtr::create(Qt3DCore::QNodeId(), &input);
- nodeAddedChange->setPropertyName("input");
- backendAxis.sceneChangeEvent(nodeAddedChange);
+ axis.addInput(&input);
+ backendAxis.syncFromFrontEnd(&axis, false);
// THEN
QCOMPARE(backendAxis.inputs().size(), 1);
QCOMPARE(backendAxis.inputs().first(), inputId);
// WHEN
- const auto nodeRemovedChange = Qt3DCore::QPropertyNodeRemovedChangePtr::create(Qt3DCore::QNodeId(), &input);
- nodeRemovedChange->setPropertyName("input");
- backendAxis.sceneChangeEvent(nodeRemovedChange);
+ axis.removeInput(&input);
+ backendAxis.syncFromFrontEnd(&axis, false);
// THEN
QCOMPARE(backendAxis.inputs().size(), 0);
diff --git a/tests/auto/input/qaxis/tst_qaxis.cpp b/tests/auto/input/qaxis/tst_qaxis.cpp
index 35cee0bba..03ddcb76d 100644
--- a/tests/auto/input/qaxis/tst_qaxis.cpp
+++ b/tests/auto/input/qaxis/tst_qaxis.cpp
@@ -113,24 +113,20 @@ private Q_SLOTS:
QCoreApplication::processEvents();
// THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QPropertyNodeAddedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeAddedChange>();
- QCOMPARE(change->propertyName(), "input");
- QCOMPARE(change->addedNodeId(), input->id());
- QCOMPARE(change->type(), Qt3DCore::PropertyValueAdded);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(arbiter.dirtyNodes.size(), 1);
+ QCOMPARE(arbiter.dirtyNodes.front(), axis.data());
- arbiter.events.clear();
+ arbiter.dirtyNodes.clear();
// WHEN
axis->removeInput(input);
QCoreApplication::processEvents();
// THEN
- QCOMPARE(arbiter.events.size(), 1);
- Qt3DCore::QPropertyNodeRemovedChangePtr nodeRemovedChange = arbiter.events.first().staticCast<Qt3DCore::QPropertyNodeRemovedChange>();
- QCOMPARE(nodeRemovedChange->propertyName(), "input");
- QCOMPARE(nodeRemovedChange->removedNodeId(), input->id());
- QCOMPARE(nodeRemovedChange->type(), Qt3DCore::PropertyValueRemoved);
+ QCOMPARE(arbiter.events.size(), 0);
+ QCOMPARE(arbiter.dirtyNodes.size(), 1);
+ QCOMPARE(arbiter.dirtyNodes.front(), axis.data());
arbiter.events.clear();
}