diff options
author | Mike Krus <mike.krus@kdab.com> | 2019-10-07 21:40:27 +0100 |
---|---|---|
committer | Mike Krus <mike.krus@kdab.com> | 2019-10-11 07:23:14 +0100 |
commit | 02ec5db08128030ce0891ebbd86fccd0b82e3c0c (patch) | |
tree | 3f3cbbf6b5d35a0cd1f65f9442b8f6c01810e980 /tests | |
parent | 8db80eb521e5a439cb9b499bd17253059b3b340d (diff) |
Update LoadProxyDeviceJob to use direct sync
Change-Id: I6d49abd28a665f89096ec2baaa861490c071d3d3
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'tests')
4 files changed, 6 insertions, 57 deletions
diff --git a/tests/auto/input/commons/testdeviceproxy.h b/tests/auto/input/commons/testdeviceproxy.h index 13e10d501..737eadfe7 100644 --- a/tests/auto/input/commons/testdeviceproxy.h +++ b/tests/auto/input/commons/testdeviceproxy.h @@ -103,9 +103,10 @@ public: return d->m_device; } - void simulateSceneChangeEvent(const Qt3DCore::QSceneChangePtr &change) + void setDevice(TestPhysicalDevice *device) { - Qt3DInput::QAbstractPhysicalDeviceProxy::sceneChangeEvent(change); + Q_D(TestProxy); + d->setDevice(device); } private: diff --git a/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp b/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp index 5c069d15a..985ee1955 100644 --- a/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp +++ b/tests/auto/input/loadproxydevicejob/tst_loadproxydevicejob.cpp @@ -125,6 +125,7 @@ private Q_SLOTS: // THEN QCOMPARE(manager->lookupResource(proxy.id()), backendProxy); QCOMPARE(backendProxy->deviceName(), QStringLiteral("TestProxy")); + QVERIFY(backendProxy->physicalDeviceId().isNull()); const QVector<Qt3DCore::QNodeId> pendingProxies = manager->takePendingProxiesToLoad(); QCOMPARE(pendingProxies.size(), 1); @@ -138,11 +139,7 @@ private Q_SLOTS: job.run(); // THEN -> PhysicalDeviceWrapper::setDevice should have been called - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "device"); - QVERIFY(change->value().value<Qt3DInput::QAbstractPhysicalDevice *>() != nullptr); - QCOMPARE(change->subjectId(), proxy.id()); + QVERIFY(!backendProxy->physicalDeviceId().isNull()); } // WHEN -> invalid name diff --git a/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp b/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp index 84ae82e43..aaf46a54b 100644 --- a/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp +++ b/tests/auto/input/physicaldeviceproxy/tst_physicaldeviceproxy.cpp @@ -109,27 +109,6 @@ private Q_SLOTS: QCOMPARE(pendingWrappers.first(), deviceProxy.id()); } - void checkDeviceLoadedNotification() - { - // GIVEN - Qt3DInput::Input::PhysicalDeviceProxy backendPhysicalDeviceProxy; - TestPhysicalDevice physicalDevice; - TestArbiter arbiter; - - // WHEN - Qt3DCore::QBackendNodePrivate::get(&backendPhysicalDeviceProxy)->setArbiter(&arbiter); - - backendPhysicalDeviceProxy.setDevice(&physicalDevice); - - // THEN - QCOMPARE(arbiter.events.count(), 1); - Qt3DCore::QPropertyUpdatedChangePtr change = arbiter.events.first().staticCast<Qt3DCore::QPropertyUpdatedChange>(); - QCOMPARE(change->propertyName(), "device"); - QCOMPARE(change->value().value<Qt3DInput::QAbstractPhysicalDevice *>(), &physicalDevice); - QCOMPARE(change->subjectId(), backendPhysicalDeviceProxy.peerId()); - QCOMPARE(backendPhysicalDeviceProxy.physicalDeviceId(), physicalDevice.id()); - } - void checkCleanupState() { // GIVEN diff --git a/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp b/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp index b4dfef05e..aef76cc0d 100644 --- a/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp +++ b/tests/auto/input/qabstractphysicaldeviceproxy/tst_qabstractphysicaldeviceproxy.cpp @@ -55,30 +55,6 @@ private Q_SLOTS: QVERIFY(abstractPhysicalDeviceProxy.device() == nullptr); } - - void checkDeviceLoading() - { - // GIVEN - TestProxy abstractPhysicalDeviceProxy; - - // WHEN - TestPhysicalDevice *device = new TestPhysicalDevice(); - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("device"); - change->setValue(QVariant::fromValue(device)); - - abstractPhysicalDeviceProxy.simulateSceneChangeEvent(change); - - // THEN - QCOMPARE(abstractPhysicalDeviceProxy.deviceName(), QLatin1String("TestProxy")); - QCOMPARE(abstractPhysicalDeviceProxy.status(), Qt3DInput::QAbstractPhysicalDeviceProxy::Ready); - QCOMPARE(abstractPhysicalDeviceProxy.axisCount(), device->axisCount()); - QCOMPARE(abstractPhysicalDeviceProxy.buttonCount(), device->buttonCount()); - QCOMPARE(abstractPhysicalDeviceProxy.axisNames(), device->axisNames()); - QCOMPARE(abstractPhysicalDeviceProxy.buttonNames(), device->buttonNames()); - QVERIFY(abstractPhysicalDeviceProxy.device() == device); - } - void checkDeviceBookkeeping() { // GIVEN @@ -86,11 +62,7 @@ private Q_SLOTS: // WHEN TestPhysicalDevice *device = new TestPhysicalDevice(); - auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(Qt3DCore::QNodeId()); - change->setPropertyName("device"); - change->setValue(QVariant::fromValue(device)); - - abstractPhysicalDeviceProxy->simulateSceneChangeEvent(change); + abstractPhysicalDeviceProxy->setDevice(device); // THEN QVERIFY(abstractPhysicalDeviceProxy->device() == device); |