diff options
Diffstat (limited to 'tests/auto/core/common')
-rw-r--r-- | tests/auto/core/common/common.pri | 9 | ||||
-rw-r--r-- | tests/auto/core/common/qbackendnodetester.cpp | 29 | ||||
-rw-r--r-- | tests/auto/core/common/qbackendnodetester.h | 6 | ||||
-rw-r--r-- | tests/auto/core/common/testarbiter.h | 64 | ||||
-rw-r--r-- | tests/auto/core/common/testpostmanarbiter.cpp | 113 | ||||
-rw-r--r-- | tests/auto/core/common/testpostmanarbiter.h | 83 |
6 files changed, 66 insertions, 238 deletions
diff --git a/tests/auto/core/common/common.pri b/tests/auto/core/common/common.pri index 9b761b8e0..53d2b1ac2 100644 --- a/tests/auto/core/common/common.pri +++ b/tests/auto/core/common/common.pri @@ -1,9 +1,3 @@ -SOURCES += \ - $$PWD/testpostmanarbiter.cpp - -HEADERS += \ - $$PWD/testpostmanarbiter.h - INCLUDEPATH += $$PWD qtConfig(private_tests) { @@ -11,7 +5,8 @@ qtConfig(private_tests) { $$PWD/qbackendnodetester.cpp HEADERS += \ - $$PWD/qbackendnodetester.h + $$PWD/qbackendnodetester.h \ + $$PWD/testarbiter.h } QT += core-private 3dcore 3dcore-private diff --git a/tests/auto/core/common/qbackendnodetester.cpp b/tests/auto/core/common/qbackendnodetester.cpp index 13f4683d9..64bf21590 100644 --- a/tests/auto/core/common/qbackendnodetester.cpp +++ b/tests/auto/core/common/qbackendnodetester.cpp @@ -52,35 +52,6 @@ void QBackendNodeTester::setPeerId(QBackendNode *backend, QNodeId id) backend->setPeerId(id); } -void QBackendNodeTester::simulateInitialization(QNode *frontend, QBackendNode *backend) -{ - Q_ASSERT(frontend); - Q_ASSERT(backend); - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - const auto change = frontend->createNodeCreationChange(); - backend->setPeerId(change->subjectId()); - backend->setEnabled(change->isNodeEnabled()); - backend->initializeFromPeer(change); - QT_WARNING_POP -} - -void QBackendNodeTester::sceneChangeEvent(QBackendNode *backend, const Qt3DCore::QSceneChangePtr &e) -{ - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - backend->sceneChangeEvent(e); - QT_WARNING_POP -} - -QNodeCreatedChangeBasePtr QBackendNodeTester::creationChange(QNode *frontend) const -{ - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - return frontend->createNodeCreationChange(); - QT_WARNING_POP -} - } // namespace Qt3DCore QT_END_NAMESPACE diff --git a/tests/auto/core/common/qbackendnodetester.h b/tests/auto/core/common/qbackendnodetester.h index a0b89e503..c0f8481df 100644 --- a/tests/auto/core/common/qbackendnodetester.h +++ b/tests/auto/core/common/qbackendnodetester.h @@ -39,8 +39,6 @@ #include <QObject> #include <Qt3DCore/qnodeid.h> -#include <Qt3DCore/qscenechange.h> -#include <Qt3DCore/qnodecreatedchange.h> #include <Qt3DCore/qnode.h> QT_BEGIN_NAMESPACE @@ -57,8 +55,6 @@ public: // Proxies to allow test classes to call private methods on QBackendNode void setPeerId(QBackendNode *backend, QNodeId id); - void sceneChangeEvent(QBackendNode *backend, const Qt3DCore::QSceneChangePtr &e); - Qt3DCore::QNodeCreatedChangeBasePtr creationChange(QNode *frontend) const; template<class Backend> void simulateInitializationSync(QNode *frontend, Backend *backend) @@ -70,8 +66,6 @@ public: backend->setEnabled(frontend->isEnabled()); backend->syncFromFrontEnd(frontend, true); } - - void simulateInitialization(QNode *frontend, QBackendNode *backend); }; } // namespace Qt3DCore diff --git a/tests/auto/core/common/testarbiter.h b/tests/auto/core/common/testarbiter.h new file mode 100644 index 000000000..1c1723fc1 --- /dev/null +++ b/tests/auto/core/common/testarbiter.h @@ -0,0 +1,64 @@ +/**************************************************************************** +** +** Copyright (C) 2020 Klaralvdalens Datakonsult AB (KDAB). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <Qt3DCore/private/qchangearbiter_p.h> +#include <Qt3DCore/private/qnode_p.h> + +QT_BEGIN_NAMESPACE + +class TestArbiter : public Qt3DCore::QChangeArbiter +{ +public: + + void setArbiterOnNode(Qt3DCore::QNode *node) + { + Qt3DCore::QNodePrivate::get(node)->setArbiter(this); + const auto childNodes = node->childNodes(); + for (Qt3DCore::QNode *n : childNodes) + setArbiterOnNode(n); + } + + QVector<Qt3DCore::QNode *> dirtyNodes() const { return m_dirtyFrontEndNodes; } + QVector<Qt3DCore::ComponentRelationshipChange> dirtyComponents() const { return m_dirtyEntityComponentNodeChanges; } + + void clear() + { + m_dirtyFrontEndNodes.clear(); + m_dirtyEntityComponentNodeChanges.clear(); + } +}; + +QT_END_NAMESPACE diff --git a/tests/auto/core/common/testpostmanarbiter.cpp b/tests/auto/core/common/testpostmanarbiter.cpp deleted file mode 100644 index f0c362744..000000000 --- a/tests/auto/core/common/testpostmanarbiter.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -// TODO Remove in Qt6 -#include <QtCore/qcompilerdetection.h> -QT_WARNING_DISABLE_DEPRECATED - -#include "testpostmanarbiter.h" -#include <Qt3DCore/private/qnode_p.h> - -QT_BEGIN_NAMESPACE - -TestPostman::TestPostman(TestArbiter *arbiter) - : m_arbiter(arbiter) -{} - -void TestPostman::setScene(Qt3DCore::QScene *) -{} - -void TestPostman::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) -{} - -void TestPostman::notifyBackend(const Qt3DCore::QSceneChangePtr &e) -{ - m_arbiter->sceneChangeEventWithLock(e); -} - -bool TestPostman::shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &) -{ - return false; -} - -TestArbiter::TestArbiter() - : m_postman(new TestPostman(this)) -{ -} - -TestArbiter::~TestArbiter() -{ -} - -void TestArbiter::sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) -{ - events.push_back(e); -} - -void TestArbiter::sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) -{ - events.push_back(e); -} - -void TestArbiter::sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) -{ - events += QVector<Qt3DCore::QSceneChangePtr>(e.begin(), e.end()); -} - -Qt3DCore::QAbstractPostman *TestArbiter::postman() const -{ - return m_postman; -} - -void TestArbiter::setArbiterOnNode(Qt3DCore::QNode *node) -{ - Qt3DCore::QNodePrivate::get(node)->setArbiter(this); - const auto childNodes = node->childNodes(); - for (Qt3DCore::QNode *n : childNodes) - setArbiterOnNode(n); -} - -void TestArbiter::addDirtyFrontEndNode(Qt3DCore::QNode *node) -{ - if (!dirtyNodes.contains(node)) - dirtyNodes << node; -} - -void TestArbiter::addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) -{ - if (!dirtyNodes.contains(node)) - dirtyNodes << node; - dirtySubNodes.push_back({node, subNode, change, property}); -} - -void TestArbiter::removeDirtyFrontEndNode(Qt3DCore::QNode *node) -{ - dirtyNodes.removeOne(node); -} - -QT_END_NAMESPACE diff --git a/tests/auto/core/common/testpostmanarbiter.h b/tests/auto/core/common/testpostmanarbiter.h deleted file mode 100644 index e927c2489..000000000 --- a/tests/auto/core/common/testpostmanarbiter.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 Klaralvdalens Datakonsult AB (KDAB). -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include <Qt3DCore/private/qpostman_p.h> -#include <Qt3DCore/private/qchangearbiter_p.h> - -QT_BEGIN_NAMESPACE - -namespace Qt3DCore { - class QNode; -} // Qt3D - -class TestArbiter; - -class TestPostman : public Qt3DCore::QAbstractPostman -{ -public: - explicit TestPostman(TestArbiter *arbiter); - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &) final; - void setScene(Qt3DCore::QScene *) final; - void notifyBackend(const Qt3DCore::QSceneChangePtr &e) final; - bool shouldNotifyFrontend(const Qt3DCore::QSceneChangePtr &e) final; - -private: - TestArbiter *m_arbiter; -}; - -class TestArbiter : public Qt3DCore::QAbstractArbiter -{ -public: - TestArbiter(); - ~TestArbiter(); - - void sceneChangeEvent(const Qt3DCore::QSceneChangePtr &e) final; - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangePtr &e) final; - - void sceneChangeEventWithLock(const Qt3DCore::QSceneChangeList &e) final; - - Qt3DCore::QAbstractPostman *postman() const final; - - QVector<Qt3DCore::QSceneChangePtr> events; - QVector<Qt3DCore::QNode *> dirtyNodes; - QVector<Qt3DCore::NodeRelationshipChange> dirtySubNodes; - - void setArbiterOnNode(Qt3DCore::QNode *node); - void addDirtyFrontEndNode(Qt3DCore::QNode *node) final; - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - void addDirtyFrontEndNode(Qt3DCore::QNode *node, Qt3DCore::QNode *subNode, const char *property, Qt3DCore::ChangeFlag change) final; - QT_WARNING_POP - void removeDirtyFrontEndNode(Qt3DCore::QNode *node) final; - -private: - TestPostman *m_postman; -}; - -QT_END_NAMESPACE |