summaryrefslogtreecommitdiffstats
path: root/tests/auto/animation/animationutils/tst_animationutils.cpp
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2017-09-30 10:47:48 +0100
committerSean Harmer <sean.harmer@kdab.com>2017-09-30 17:04:45 +0100
commit9c951154256734b36328142e1078382dc2d7ae01 (patch)
tree60bf432a557511b0a08b2f2dfff8276065e59150 /tests/auto/animation/animationutils/tst_animationutils.cpp
parent205ba7689c3c6c547543cf4d5d7ec968cce9a7a5 (diff)
parentaee10edf33ccb1faf3179b23b44a2ad48bf4d0f0 (diff)
Merge branch '5.9' into 5.10
Conflicts: src/animation/backend/animationutils.cpp src/animation/backend/animationutils_p.h src/render/geometry/qmesh.cpp tests/auto/animation/animation.pro Change-Id: Ifb57bfb0b12b3ebf9ee177d4ea684134455b4143
Diffstat (limited to 'tests/auto/animation/animationutils/tst_animationutils.cpp')
-rw-r--r--tests/auto/animation/animationutils/tst_animationutils.cpp117
1 files changed, 29 insertions, 88 deletions
diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp
index 9bc7a8c47..177dbd19a 100644
--- a/tests/auto/animation/animationutils/tst_animationutils.cpp
+++ b/tests/auto/animation/animationutils/tst_animationutils.cpp
@@ -271,77 +271,6 @@ public:
private Q_SLOTS:
void checkBuildPropertyMappings_data()
{
- QTest::addColumn<Handler *>("handler");
- QTest::addColumn<QVector<ChannelMapping *>>("channelMappings");
- QTest::addColumn<ChannelMapper *>("channelMapper");
- QTest::addColumn<AnimationClip *>("clip");
- QTest::addColumn<QVector<MappingData>>("expectedMappingData");
-
- auto handler = new Handler;
- auto channelMapping = createChannelMapping(handler,
- QLatin1String("Location"),
- Qt3DCore::QNodeId::createId(),
- QLatin1String("translation"),
- "translation",
- static_cast<int>(QVariant::Vector3D));
- QVector<ChannelMapping *> channelMappings;
- channelMappings.push_back(channelMapping);
-
- // ... a channel mapper...
- auto channelMapper = createChannelMapper(handler, QVector<Qt3DCore::QNodeId>() << channelMapping->peerId());
-
- // ...and an animation clip
- auto clip = createAnimationClipLoader(handler, QUrl("qrc:/clip1.json"));
-
- QVector<MappingData> mappingData;
- MappingData mapping;
- mapping.targetId = channelMapping->targetId();
- mapping.propertyName = channelMapping->propertyName(); // Location
- mapping.type = channelMapping->type();
- mapping.channelIndices = QVector<int>() << 0 << 1 << 2; // Location X, Y, Z
- mappingData.push_back(mapping);
-
- QTest::newRow("clip1.json") << handler
- << channelMappings
- << channelMapper
- << clip
- << mappingData;
- }
-
- void checkBuildPropertyMappings()
- {
- // GIVEN
- QFETCH(Handler *, handler);
- QFETCH(QVector<ChannelMapping *>, channelMappings);
- QFETCH(ChannelMapper *, channelMapper);
- QFETCH(AnimationClip *, clip);
- QFETCH(QVector<MappingData>, expectedMappingData);
-
- // WHEN
- // Build the mapping data for the above configuration
- QVector<MappingData> mappingData = buildPropertyMappings(handler, clip, channelMapper);
-
- // THEN
- QCOMPARE(mappingData.size(), expectedMappingData.size());
- for (int i = 0; i < mappingData.size(); ++i) {
- const auto mapping = mappingData[i];
- const auto expectedMapping = expectedMappingData[i];
-
- QCOMPARE(mapping.targetId, expectedMapping.targetId);
- QCOMPARE(mapping.propertyName, expectedMapping.propertyName);
- QCOMPARE(mapping.type, expectedMapping.type);
- QCOMPARE(mapping.channelIndices.size(), expectedMapping.channelIndices.size());
- for (int j = 0; j < mapping.channelIndices.size(); ++j) {
- QCOMPARE(mapping.channelIndices[j], expectedMapping.channelIndices[j]);
- }
- }
-
- // Cleanup
- delete handler;
- }
-
- void checkBuildPropertyMappings2_data()
- {
QTest::addColumn<QVector<ChannelMapping *>>("channelMappings");
QTest::addColumn<QVector<ChannelNameAndType>>("channelNamesAndTypes");
QTest::addColumn<QVector<ComponentIndices>>("channelComponentIndices");
@@ -507,7 +436,7 @@ private Q_SLOTS:
}
}
- void checkBuildPropertyMappings2()
+ void checkBuildPropertyMappings()
{
// GIVEN
QFETCH(QVector<ChannelMapping *>, channelMappings);
@@ -2088,6 +2017,18 @@ private Q_SLOTS:
QTest::newRow("simple lerp") << handler << lerp->peerId() << expectedIds;
}
+
+ {
+ Handler *handler = new Handler;
+
+ const auto value1 = createClipBlendValue(handler);
+ const auto clip1Id = Qt3DCore::QNodeId::createId();
+ value1->setClipId(clip1Id);
+
+ QVector<Qt3DCore::QNodeId> expectedIds = { value1->peerId() };
+
+ QTest::newRow("value only") << handler << value1->peerId() << expectedIds;
+ }
}
void checkGatherValueNodesToEvaluate()
@@ -2694,8 +2635,8 @@ private Q_SLOTS:
clip->setSource(QUrl("qrc:/clip3.json"));
clip->loadAnimation();
- ComponentIndices expectedResults = { 0, 1, 2, 3, // Rotation
- 4, 5, 6, // Location
+ ComponentIndices expectedResults = { 0, 1, 3, 2, // Rotation (y/z swapped in clip3.json)
+ 4, 6, 5, // Location (y/z swapped in clip3.json)
7, 8, 9, // Base Color
10, // Metalness
11 }; // Roughness
@@ -2724,8 +2665,8 @@ private Q_SLOTS:
clip->setSource(QUrl("qrc:/clip3.json"));
clip->loadAnimation();
- ComponentIndices expectedResults = { 4, 5, 6, // Location
- 0, 1, 2, 3, // Rotation
+ ComponentIndices expectedResults = { 4, 6, 5, // Location (y/z swapped in clip3.json)
+ 0, 1, 3, 2, // Rotation (y/z swapped in clip3.json)
7, 8, 9, // Base Color
10, // Metalness
11 }; // Roughness
@@ -2754,8 +2695,8 @@ private Q_SLOTS:
clip->setSource(QUrl("qrc:/clip3.json"));
clip->loadAnimation();
- ComponentIndices expectedResults = { 0, 1, 2, 3, // Rotation
- 4, 5, 6, // Location
+ ComponentIndices expectedResults = { 0, 1, 3, 2, // Rotation (y/z swapped in clip3.json)
+ 4, 6, 5, // Location (y/z swapped in clip3.json)
-1, -1, -1, // Albedo (missing from clip)
10, // Metalness
11 }; // Roughness
@@ -2784,8 +2725,8 @@ private Q_SLOTS:
clip->setSource(QUrl("qrc:/clip3.json"));
clip->loadAnimation();
- ComponentIndices expectedResults = { 4, 5, 6, // Location
- 0, 1, 2, 3, // Rotation
+ ComponentIndices expectedResults = { 4, 6, 5, // Location (y/z swapped in clip3.json)
+ 0, 1, 3, 2, // Rotation (y/z swapped in clip3.json)
-1, -1, -1, // Albedo (missing from clip)
10, // Metalness
11 }; // Roughness
@@ -2825,17 +2766,17 @@ private Q_SLOTS:
clip->setSource(QUrl("qrc:/clip5.json"));
clip->loadAnimation();
- ComponentIndices expectedResults = { 4, 5, 6, // Location, joint 0
- 0, 1, 2, 3, // Rotation, joint 0
+ ComponentIndices expectedResults = { 4, 6, 5, // Location, joint 0 (y/z swapped in clip5.json)
+ 0, 1, 3, 2, // Rotation, joint 0 (y/z swapped in clip5.json)
7, 8, 9, // Scale, joint 0
- 14, 15, 16, // Location, joint 1
- 10, 11, 12, 13, // Rotation, joint 1
+ 14, 16, 15, // Location, joint 1 (y/z swapped in clip5.json)
+ 10, 11, 13, 12, // Rotation, joint 1 (y/z swapped in clip5.json)
17, 18, 19, // Scale, joint 1
- 24, 25, 26, // Location, joint 2
- 20, 21, 22, 23, // Rotation, joint 2
+ 24, 26, 25, // Location, joint 2 (y/z swapped in clip5.json)
+ 20, 21, 23, 22, // Rotation, joint 2 (y/z swapped in clip5.json)
27, 28, 29, // Scale, joint 2
- 34, 35, 36, // Location, joint 3
- 30, 31, 32, 33, // Rotation, joint 3
+ 34, 36, 35, // Location, joint 3 (y/z swapped in clip5.json)
+ 30, 31, 33, 32, // Rotation, joint 3 (y/z swapped in clip5.json)
37, 38, 39 }; // Scale, joint 3
QTest::newRow("skeleton (SQT), 4 joints")