aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/qdeclarativeinstruction
diff options
context:
space:
mode:
authorChris Adams <christopher.adams@nokia.com>2011-07-14 15:40:30 +1000
committerQt by Nokia <qt-info@nokia.com>2011-08-18 09:25:04 +0200
commiteaf52673ef38b4d7a14f9fb9f258d8f1c6097401 (patch)
treea607ea443865da0668029725283009cf17d2ffe1 /tests/auto/declarative/qdeclarativeinstruction
parent36767e3fe1f0038441ae06ef5b5e1cb19a3738fa (diff)
Add support for a vector4d type in QML
QVector4D is a value-type which is supported but was not able to be constructed using a Qt object function. This commit allows properties of vector4d type to be constructed, and adds a function to the global Qt object and adds unit tests to ensure that it behaves correctly. Task-number: QTBUG-18559 Change-Id: I96509a4f496b644d20fdb1d977d0afe430d89e13 Reviewed-on: http://codereview.qt.nokia.com/1626 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Aaron Kennedy <aaron.kennedy@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeinstruction')
-rw-r--r--tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
index e6e87d1bbd..f432cbff49 100644
--- a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
+++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp
@@ -63,6 +63,7 @@ private slots:
void rect();
void rectf();
void vector3d();
+ void vector4d();
void time();
};
@@ -682,6 +683,24 @@ void tst_qdeclarativeinstruction::vector3d()
QCOMPARE(vector.z(), (qreal)(float)12.0);
}
+void tst_qdeclarativeinstruction::vector4d()
+{
+ QCOMPARE(sizeof(QDeclarativeInstruction::instr_storeVector4D::QVector4D), sizeof(QVector4D));
+ QCOMPARE(Q_ALIGNOF(QDeclarativeInstruction::instr_storeVector4D::QVector4D), Q_ALIGNOF(QVector4D));
+
+ QDeclarativeInstruction i;
+ i.storeVector4D.vector.xp = 8.2;
+ i.storeVector4D.vector.yp = 99.3;
+ i.storeVector4D.vector.zp = 12.0;
+ i.storeVector4D.vector.wp = 121.1;
+
+ const QVector4D &vector = (const QVector4D &)(i.storeVector4D.vector);
+ QCOMPARE(vector.x(), (qreal)(float)8.2);
+ QCOMPARE(vector.y(), (qreal)(float)99.3);
+ QCOMPARE(vector.z(), (qreal)(float)12.0);
+ QCOMPARE(vector.w(), (qreal)(float)121.1);
+}
+
void tst_qdeclarativeinstruction::time()
{
QCOMPARE(sizeof(QDeclarativeInstruction::instr_storeTime::QTime), sizeof(QTime));