diff options
author | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-10-11 16:01:22 +0300 |
---|---|---|
committer | Tarja Sundqvist <tarja.sundqvist@qt.io> | 2023-10-11 16:01:22 +0300 |
commit | e1b1a0d2970fd384bd52c734a72536d8452ad070 (patch) | |
tree | 494b70bc1a1e115d7ecce39e698d9621af717971 /tests | |
parent | c1f8fa2578d99e07f5e581f26bd532695b9534f9 (diff) | |
parent | b59fdcefdbce6a1870e49b0da14d30b51293dea6 (diff) |
Merge remote-tracking branch 'origin/tqtc/lts-5.15.12' into tqtc/lts-5.15-opensourcev5.15.12-lts-lgpl
Change-Id: If1ce1579db02b74dde74731fcf6163614961841f
Diffstat (limited to 'tests')
4 files changed, 123 insertions, 0 deletions
diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/data/createMultipleAsync.qml b/tests/auto/quick3d/quick3dnodeinstantiator/data/createMultipleAsync.qml new file mode 100644 index 000000000..be6c46582 --- /dev/null +++ b/tests/auto/quick3d/quick3dnodeinstantiator/data/createMultipleAsync.qml @@ -0,0 +1,13 @@ +import QtQml 2.1 +import Qt3D.Core 2.0 + +Entity { + NodeInstantiator { + model: 10 + asynchronous: true + delegate: Entity { + property bool success: true + property int idx: index + } + } +} diff --git a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp index 501b3d9bf..1e7d6c593 100644 --- a/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp +++ b/tests/auto/quick3d/quick3dnodeinstantiator/tst_quick3dnodeinstantiator.cpp @@ -39,6 +39,7 @@ #include <QtQml/qqmlengine.h> #include <QtQml/qqmlcomponent.h> #include <QtQml/qqmlcontext.h> +#include <QtQml/qqmlincubator.h> using namespace Qt3DCore::Quick; @@ -55,6 +56,8 @@ private slots: void activeProperty(); void intModelChange(); void createAndRemove(); + void asynchronous_data(); + void asynchronous(); }; void tst_quick3dnodeinstantiator::createNone() @@ -251,6 +254,48 @@ void tst_quick3dnodeinstantiator::createAndRemove() QCOMPARE(object->property("datum").toString(), names[i]); } } + +void tst_quick3dnodeinstantiator::asynchronous_data() +{ + QTest::addColumn<bool>("asyncIncubator"); + QTest::addColumn<QString>("fileName"); + + QTest::newRow("Asynchronous Instantiator") << false << "createMultipleAsync.qml"; + QTest::newRow("Nested-asynchronous Instantiator") << true << "createMultiple.qml"; +} + +void tst_quick3dnodeinstantiator::asynchronous() +{ + QFETCH(bool, asyncIncubator); + QFETCH(QString, fileName); + + QQmlEngine engine; + QQmlIncubationController incubationController; + engine.setIncubationController(&incubationController); + QQmlComponent component(&engine, testFileUrl(fileName)); + QQmlIncubator incubator(asyncIncubator ? QQmlIncubator::Asynchronous : QQmlIncubator::Synchronous); + component.create(incubator); + while (!incubator.isReady()) + incubationController.incubateFor(10); + QObject *rootObject = incubator.object(); + QVERIFY(rootObject != nullptr); + while (incubationController.incubatingObjectCount() > 0) + incubationController.incubateFor(10); + Quick3DNodeInstantiator *instantiator = rootObject->findChild<Quick3DNodeInstantiator *>(); + QVERIFY(instantiator != nullptr); + QCOMPARE(instantiator->isActive(), true); + QCOMPARE(instantiator->count(), 10); + + for (int i=0; i<10; i++) { + QObject *object = instantiator->objectAt(i); + QVERIFY(object); + QCOMPARE(object->parent(), rootObject); + QCOMPARE(object->property("success").toBool(), true); + QCOMPARE(object->property("idx").toInt(), i); + } +} + + QTEST_MAIN(tst_quick3dnodeinstantiator) #include "tst_quick3dnodeinstantiator.moc" diff --git a/tests/auto/render/opengl/renderviews/tst_renderviews.cpp b/tests/auto/render/opengl/renderviews/tst_renderviews.cpp index aec13071a..196ee85d4 100644 --- a/tests/auto/render/opengl/renderviews/tst_renderviews.cpp +++ b/tests/auto/render/opengl/renderviews/tst_renderviews.cpp @@ -307,6 +307,68 @@ private Q_SLOTS: << (QVector<ShaderParameterPack>() << pack1 << minifiedPack1 << minifiedPack1 << pack1 << minifiedPack1 << minifiedPack1); } + void checkShaderParameterPackStoresSingleUBOPerBlockIndex() + { + // GIVEN + ShaderParameterPack pack; + auto nodeId1 = Qt3DCore::QNodeId::createId(); + auto nodeId2 = Qt3DCore::QNodeId::createId(); + + BlockToUBO ubo1 { 1, nodeId1, false, {}}; + BlockToUBO ubo2 { 1, nodeId2, false, {}}; + + // WHEN + pack.setUniformBuffer(ubo1); + pack.setUniformBuffer(ubo2); + + // THEN + QCOMPARE(pack.uniformBuffers().size(), 1); + QCOMPARE(pack.uniformBuffers().front().m_blockIndex, 1); + QCOMPARE(pack.uniformBuffers().front().m_bufferID, nodeId2); + + // WHEN + BlockToUBO ubo3 { 2, nodeId2, false, {}}; + pack.setUniformBuffer(ubo3); + + // THEN + QCOMPARE(pack.uniformBuffers().size(), 2); + QCOMPARE(pack.uniformBuffers().front().m_blockIndex, 1); + QCOMPARE(pack.uniformBuffers().front().m_bufferID, nodeId2); + QCOMPARE(pack.uniformBuffers().back().m_blockIndex, 2); + QCOMPARE(pack.uniformBuffers().back().m_bufferID, nodeId2); + } + + void checkShaderParameterPackStoresSingleSSBOPerBlockIndex() + { + // GIVEN + ShaderParameterPack pack; + auto nodeId1 = Qt3DCore::QNodeId::createId(); + auto nodeId2 = Qt3DCore::QNodeId::createId(); + + BlockToSSBO ssbo1 { 1, 0, nodeId1}; + BlockToSSBO ssbo2 { 1, 0, nodeId2}; + + // WHEN + pack.setShaderStorageBuffer(ssbo1); + pack.setShaderStorageBuffer(ssbo2); + + // THEN + QCOMPARE(pack.shaderStorageBuffers().size(), 1); + QCOMPARE(pack.shaderStorageBuffers().front().m_blockIndex, 1); + QCOMPARE(pack.shaderStorageBuffers().front().m_bufferID, nodeId2); + + // WHEN + BlockToSSBO ssbo3 { 2, 1, nodeId2}; + pack.setShaderStorageBuffer(ssbo3); + + // THEN + QCOMPARE(pack.shaderStorageBuffers().size(), 2); + QCOMPARE(pack.shaderStorageBuffers().front().m_blockIndex, 1); + QCOMPARE(pack.shaderStorageBuffers().front().m_bufferID, nodeId2); + QCOMPARE(pack.shaderStorageBuffers().back().m_blockIndex, 2); + QCOMPARE(pack.shaderStorageBuffers().back().m_bufferID, nodeId2); + } + void checkRenderViewUniformMinification() { QFETCH(QVector<QShaderProgram*>, shaders); diff --git a/tests/auto/render/raycasting/BLACKLIST b/tests/auto/render/raycasting/BLACKLIST new file mode 100644 index 000000000..8d957b4ca --- /dev/null +++ b/tests/auto/render/raycasting/BLACKLIST @@ -0,0 +1,3 @@ +# See qtbase/src/testlib/qtestblacklist.cpp for format +[shouldReturnAllResults] +ci ubuntu-20.04 # QTBUG-108918 |