summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2017-06-14 12:40:06 +0200
committerSean Harmer <sean.harmer@kdab.com>2017-06-14 10:50:05 +0000
commit8155dae53f4b9f9d2c9d198758fe8c636c2e1cd1 (patch)
tree39c04b212f46ec5b3070f2d8f58cf1e2735d52cb /tests
parente423907090e2ba1a3f5980b2cbf7e7b4fbc37dfe (diff)
Fix and extend animationutils autotest
Test QColor and fix various issues and typos. Change-Id: I559fa9887f65d176bb4b7d678deab0b182d0b3a8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/animation/animationutils/tst_animationutils.cpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/tests/auto/animation/animationutils/tst_animationutils.cpp b/tests/auto/animation/animationutils/tst_animationutils.cpp
index a70fd271c..fea110856 100644
--- a/tests/auto/animation/animationutils/tst_animationutils.cpp
+++ b/tests/auto/animation/animationutils/tst_animationutils.cpp
@@ -42,6 +42,7 @@
#include <QtGui/qvector3d.h>
#include <QtGui/qvector4d.h>
#include <QtGui/qquaternion.h>
+#include <QtGui/qcolor.h>
#include <qbackendnodetester.h>
#include <testpostmanarbiter.h>
@@ -1000,7 +1001,7 @@ private Q_SLOTS:
MappingData mapping;
mapping.targetId = Qt3DCore::QNodeId::createId();
mapping.propertyName = "foo";
- mapping.type = static_cast<int>(QVariant::Vector2D);
+ mapping.type = static_cast<int>(QVariant::Vector4D);
mapping.channelIndices = QVector<int>() << 0 << 1 << 2 << 3;
mappingData.push_back(mapping);
channelResults = QVector<float>() << 4.0f << 3.0f << 2.0f << 1.0f;
@@ -1036,7 +1037,7 @@ private Q_SLOTS:
auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId);
change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
change->setPropertyName(mapping.propertyName);
- change->setValue(QVariant::fromValue(QQuaternion(1.0f, 0.0f, 0.0f, 1.0f)));
+ change->setValue(QVariant::fromValue(QQuaternion(1.0f, 0.0f, 0.0f, 1.0f).normalized()));
expectedChanges.push_back(change);
QTest::newRow("quaternion rotation")
@@ -1047,6 +1048,34 @@ private Q_SLOTS:
channelResults.clear();
expectedChanges.clear();
}
+
+ // Single property, QColor
+ {
+ animatorId = Qt3DCore::QNodeId::createId();
+ MappingData mapping;
+ mapping.targetId = Qt3DCore::QNodeId::createId();
+ mapping.propertyName = "color";
+ mapping.type = static_cast<int>(QVariant::Color);
+ mapping.channelIndices = QVector<int>() << 0 << 1 << 2;
+ mappingData.push_back(mapping);
+ channelResults = QVector<float>() << 0.5f << 0.4f << 0.3f;
+ finalFrame = false;
+
+ auto change = Qt3DCore::QPropertyUpdatedChangePtr::create(mapping.targetId);
+ change->setDeliveryFlags(Qt3DCore::QSceneChange::DeliverToAll);
+ change->setPropertyName(mapping.propertyName);
+ change->setValue(QVariant::fromValue(QColor::fromRgbF(0.5f, 0.4f, 0.3f)));
+ expectedChanges.push_back(change);
+
+ QTest::newRow("QColor color")
+ << animatorId << mappingData << channelResults << finalFrame
+ << expectedChanges;
+
+ mappingData.clear();
+ channelResults.clear();
+ expectedChanges.clear();
+ }
+
}
void checkPreparePropertyChanges()
@@ -1067,7 +1096,7 @@ private Q_SLOTS:
for (int i = 0; i < actualChanges.size(); ++i) {
auto expectedChange = expectedChanges[i];
auto actualChange
- = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(expectedChanges[i]);
+ = qSharedPointerCast<Qt3DCore::QPropertyUpdatedChange>(actualChanges[i]);
QCOMPARE(actualChange->subjectId(), expectedChange->subjectId());
QCOMPARE(actualChange->deliveryFlags(), expectedChange->deliveryFlags());