mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
build fix for the case when QT_NO_VECTOR2D, QT_NO_VECTOR3D or QT_NO_VECTOR4D is defined
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
dacb1728d6
commit
c54fb779bc
9 changed files with 295 additions and 29 deletions
|
@ -157,6 +157,8 @@
|
|||
// #cmakedefine QT_NO_TREEVIEW
|
||||
// #cmakedefine QT_NO_TREEWIDGET
|
||||
// #cmakedefine QT_NO_UNDOCOMMAND
|
||||
// #cmakedefine QT_NO_UNDOSTACK
|
||||
// #cmakedefine QT_NO_VALIDATOR
|
||||
|
||||
// Misc
|
||||
#cmakedefine QT_NO_USING_NAMESPACE
|
||||
|
@ -211,9 +213,7 @@
|
|||
#cmakedefine QT_NO_TEXTBROWSER
|
||||
#cmakedefine QT_NO_UDPSOCKET
|
||||
#cmakedefine QT_NO_UNDOGROUP
|
||||
#cmakedefine QT_NO_UNDOSTACK
|
||||
#cmakedefine QT_NO_UNDOVIEW
|
||||
#cmakedefine QT_NO_VALIDATOR
|
||||
#cmakedefine QT_NO_VECTOR2D
|
||||
#cmakedefine QT_NO_VECTOR4D
|
||||
#cmakedefine QT_NO_WARNING_OUTPUT
|
||||
|
|
|
@ -1069,7 +1069,6 @@ bool QDeclarativeMetaType::canCopy(int type)
|
|||
case QMetaType::QLineF:
|
||||
case QMetaType::QPoint:
|
||||
case QMetaType::QPointF:
|
||||
case QMetaType::QVector3D:
|
||||
case QMetaType::QRegExp:
|
||||
case QMetaType::Void:
|
||||
case QMetaType::QFont:
|
||||
|
@ -1093,8 +1092,15 @@ bool QDeclarativeMetaType::canCopy(int type)
|
|||
case QMetaType::QMatrix:
|
||||
case QMetaType::QTransform:
|
||||
case QMetaType::QMatrix4x4:
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
case QMetaType::QVector2D:
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
case QMetaType::QVector3D:
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
case QMetaType::QVector4D:
|
||||
#endif // QT_NO_VECTOR4D
|
||||
#ifndef QT_NO_QUATERNION
|
||||
case QMetaType::QQuaternion:
|
||||
#endif
|
||||
|
@ -1231,9 +1237,6 @@ bool QDeclarativeMetaType::copy(int type, void *data, const void *copy)
|
|||
case QMetaType::QPointF:
|
||||
*static_cast<NS(QPointF) *>(data) = *static_cast<const NS(QPointF)*>(copy);
|
||||
return true;
|
||||
case QMetaType::QVector3D:
|
||||
*static_cast<NS(QVector3D) *>(data) = *static_cast<const NS(QVector3D)*>(copy);
|
||||
return true;
|
||||
case QMetaType::QRegExp:
|
||||
*static_cast<NS(QRegExp) *>(data) = *static_cast<const NS(QRegExp)*>(copy);
|
||||
return true;
|
||||
|
@ -1300,12 +1303,21 @@ bool QDeclarativeMetaType::copy(int type, void *data, const void *copy)
|
|||
case QMetaType::QMatrix4x4:
|
||||
*static_cast<NS(QMatrix4x4) *>(data) = *static_cast<const NS(QMatrix4x4)*>(copy);
|
||||
return true;
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
case QMetaType::QVector2D:
|
||||
*static_cast<NS(QVector2D) *>(data) = *static_cast<const NS(QVector2D)*>(copy);
|
||||
return true;
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
case QMetaType::QVector3D:
|
||||
*static_cast<NS(QVector3D) *>(data) = *static_cast<const NS(QVector3D)*>(copy);
|
||||
return true;
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
case QMetaType::QVector4D:
|
||||
*static_cast<NS(QVector4D) *>(data) = *static_cast<const NS(QVector4D)*>(copy);
|
||||
return true;
|
||||
#endif // QT_NO_VECTOR4D
|
||||
#ifndef QT_NO_QUATERNION
|
||||
case QMetaType::QQuaternion:
|
||||
*static_cast<NS(QQuaternion) *>(data) = *static_cast<const NS(QQuaternion)*>(copy);
|
||||
|
@ -1434,9 +1446,6 @@ bool QDeclarativeMetaType::copy(int type, void *data, const void *copy)
|
|||
case QMetaType::QPointF:
|
||||
*static_cast<NS(QPointF) *>(data) = NS(QPointF)();
|
||||
return true;
|
||||
case QMetaType::QVector3D:
|
||||
*static_cast<NS(QVector3D) *>(data) = NS(QVector3D)();
|
||||
return true;
|
||||
case QMetaType::QRegExp:
|
||||
*static_cast<NS(QRegExp) *>(data) = NS(QRegExp)();
|
||||
return true;
|
||||
|
@ -1503,12 +1512,21 @@ bool QDeclarativeMetaType::copy(int type, void *data, const void *copy)
|
|||
case QMetaType::QMatrix4x4:
|
||||
*static_cast<NS(QMatrix4x4) *>(data) = NS(QMatrix4x4)();
|
||||
return true;
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
case QMetaType::QVector2D:
|
||||
*static_cast<NS(QVector2D) *>(data) = NS(QVector2D)();
|
||||
return true;
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
case QMetaType::QVector3D:
|
||||
*static_cast<NS(QVector3D) *>(data) = NS(QVector3D)();
|
||||
return true;
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
case QMetaType::QVector4D:
|
||||
*static_cast<NS(QVector4D) *>(data) = NS(QVector4D)();
|
||||
return true;
|
||||
#endif // QT_NO_VECTOR4D
|
||||
#ifndef QT_NO_QUATERNION
|
||||
case QMetaType::QQuaternion:
|
||||
*static_cast<NS(QQuaternion) *>(data) = NS(QQuaternion)();
|
||||
|
|
|
@ -105,15 +105,21 @@ QDeclarativeValueType *QDeclarativeValueTypeFactory::valueType(int t)
|
|||
case QVariant::RectF:
|
||||
rv = new QDeclarativeRectFValueType;
|
||||
break;
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
case QVariant::Vector2D:
|
||||
rv = new QDeclarativeVector2DValueType;
|
||||
break;
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
case QVariant::Vector3D:
|
||||
rv = new QDeclarativeVector3DValueType;
|
||||
break;
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
case QVariant::Vector4D:
|
||||
rv = new QDeclarativeVector4DValueType;
|
||||
break;
|
||||
#endif // QT_NO_VECTOR4D
|
||||
#ifndef QT_NO_QUATERNION
|
||||
case QVariant::Quaternion:
|
||||
rv = new QDeclarativeQuaternionValueType;
|
||||
|
@ -469,6 +475,7 @@ void QDeclarativeRectValueType::setHeight(int h)
|
|||
rect.setHeight(h);
|
||||
}
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QDeclarativeVector2DValueType::QDeclarativeVector2DValueType(QObject *parent)
|
||||
: QDeclarativeValueType(parent)
|
||||
{
|
||||
|
@ -516,7 +523,9 @@ void QDeclarativeVector2DValueType::setY(qreal y)
|
|||
{
|
||||
vector.setY(y);
|
||||
}
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QDeclarativeVector3DValueType::QDeclarativeVector3DValueType(QObject *parent)
|
||||
: QDeclarativeValueType(parent)
|
||||
{
|
||||
|
@ -574,7 +583,9 @@ void QDeclarativeVector3DValueType::setZ(qreal z)
|
|||
{
|
||||
vector.setZ(z);
|
||||
}
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QDeclarativeVector4DValueType::QDeclarativeVector4DValueType(QObject *parent)
|
||||
: QDeclarativeValueType(parent)
|
||||
{
|
||||
|
@ -642,6 +653,7 @@ void QDeclarativeVector4DValueType::setW(qreal w)
|
|||
{
|
||||
vector.setW(w);
|
||||
}
|
||||
#endif // QT_NO_VECTOR4D
|
||||
|
||||
#ifndef QT_NO_QUATERNION
|
||||
QDeclarativeQuaternionValueType::QDeclarativeQuaternionValueType(QObject *parent)
|
||||
|
|
|
@ -226,6 +226,7 @@ private:
|
|||
QRect rect;
|
||||
};
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
class Q_AUTOTEST_EXPORT QDeclarativeVector2DValueType : public QDeclarativeValueType
|
||||
{
|
||||
Q_PROPERTY(qreal x READ x WRITE setX)
|
||||
|
@ -247,7 +248,9 @@ public:
|
|||
private:
|
||||
QVector2D vector;
|
||||
};
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
class Q_AUTOTEST_EXPORT QDeclarativeVector3DValueType : public QDeclarativeValueType
|
||||
{
|
||||
Q_PROPERTY(qreal x READ x WRITE setX)
|
||||
|
@ -272,7 +275,9 @@ public:
|
|||
private:
|
||||
QVector3D vector;
|
||||
};
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
class Q_AUTOTEST_EXPORT QDeclarativeVector4DValueType : public QDeclarativeValueType
|
||||
{
|
||||
Q_PROPERTY(qreal x READ x WRITE setX)
|
||||
|
@ -300,6 +305,7 @@ public:
|
|||
private:
|
||||
QVector4D vector;
|
||||
};
|
||||
#endif // QT_NO_VECTOR4D
|
||||
|
||||
#ifndef QT_NO_QUATERNION
|
||||
class Q_AUTOTEST_EXPORT QDeclarativeQuaternionValueType : public QDeclarativeValueType
|
||||
|
|
|
@ -49,9 +49,15 @@ template<> Q_INLINE_TEMPLATE QQuaternion _q_interpolate(const QQuaternion &f,con
|
|||
static int qRegisterGuiGetInterpolator()
|
||||
{
|
||||
qRegisterAnimationInterpolator<QColor>(_q_interpolateVariant<QColor>);
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
qRegisterAnimationInterpolator<QVector2D>(_q_interpolateVariant<QVector2D>);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
qRegisterAnimationInterpolator<QVector3D>(_q_interpolateVariant<QVector3D>);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
qRegisterAnimationInterpolator<QVector4D>(_q_interpolateVariant<QVector4D>);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
#ifndef QT_NO_QUATERNION
|
||||
qRegisterAnimationInterpolator<QQuaternion>(_q_interpolateVariant<QQuaternion>);
|
||||
#endif // QT_NO_QUATERNION
|
||||
|
@ -64,12 +70,18 @@ static int qUnregisterGuiGetInterpolator()
|
|||
// casts required by Sun CC 5.5
|
||||
qRegisterAnimationInterpolator<QColor>(
|
||||
(QVariant (*)(const QColor &, const QColor &, qreal))0);
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
qRegisterAnimationInterpolator<QVector2D>(
|
||||
(QVariant (*)(const QVector2D &, const QVector2D &, qreal))0);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
qRegisterAnimationInterpolator<QVector3D>(
|
||||
(QVariant (*)(const QVector3D &, const QVector3D &, qreal))0);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
qRegisterAnimationInterpolator<QVector4D>(
|
||||
(QVariant (*)(const QVector4D &, const QVector4D &, qreal))0);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
#ifndef QT_NO_QUATERNION
|
||||
qRegisterAnimationInterpolator<QQuaternion>(
|
||||
(QVariant (*)(const QQuaternion &, const QQuaternion &, qreal))0);
|
||||
|
|
|
@ -25,16 +25,14 @@
|
|||
#include <QtCore/qpoint.h>
|
||||
#include <QtCore/qmetatype.h>
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
class QVector3D;
|
||||
class QVector4D;
|
||||
class QVariant;
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
|
||||
class Q_GUI_EXPORT QVector2D
|
||||
{
|
||||
public:
|
||||
|
@ -231,9 +229,8 @@ Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QVector2D &);
|
|||
Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QVector2D &);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#endif
|
||||
#endif // QVECTOR2D_H
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
#include "qundogroup.h"
|
||||
#include "qundostack_p.h"
|
||||
|
||||
#ifndef QT_NO_UNDOCOMMAND
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
#ifndef QT_NO_UNDOCOMMAND
|
||||
|
||||
/*!
|
||||
\class QUndoCommand
|
||||
\brief The QUndoCommand class is the base class of all commands stored on a QUndoStack.
|
||||
|
@ -1150,11 +1150,10 @@ bool QUndoStack::isActive() const
|
|||
\a canRedo specifies the new value.
|
||||
*/
|
||||
|
||||
#endif // QT_NO_UNDOSTACK
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#include "moc_qundostack.h"
|
||||
|
||||
|
||||
#endif // QT_NO_UNDOSTACK
|
||||
|
||||
#include "moc_qundostack_p.h"
|
||||
|
|
|
@ -1314,6 +1314,7 @@ void tst_QVariant::transform()
|
|||
|
||||
void tst_QVariant::vector2D()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVariant variant;
|
||||
QVector2D vector = qvariant_cast<QVector2D>(variant);
|
||||
QVERIFY(vector.isNull());
|
||||
|
@ -1323,10 +1324,14 @@ void tst_QVariant::vector2D()
|
|||
void *pvector = QMetaType::construct(QVariant::Vector2D, 0);
|
||||
QVERIFY(pvector);
|
||||
QMetaType::destroy(QVariant::Vector2D, pvector);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
void tst_QVariant::vector3D()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QVariant variant;
|
||||
QVector3D vector = qvariant_cast<QVector3D>(variant);
|
||||
QVERIFY(vector.isNull());
|
||||
|
@ -1336,10 +1341,14 @@ void tst_QVariant::vector3D()
|
|||
void *pvector = QMetaType::construct(QVariant::Vector3D, 0);
|
||||
QVERIFY(pvector);
|
||||
QMetaType::destroy(QVariant::Vector3D, pvector);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
void tst_QVariant::vector4D()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QVariant variant;
|
||||
QVector4D vector = qvariant_cast<QVector4D>(variant);
|
||||
QVERIFY(vector.isNull());
|
||||
|
@ -1349,6 +1358,9 @@ void tst_QVariant::vector4D()
|
|||
void *pvector = QMetaType::construct(QVariant::Vector4D, 0);
|
||||
QVERIFY(pvector);
|
||||
QMetaType::destroy(QVariant::Vector4D, pvector);
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
void tst_QVariant::quaternion()
|
||||
|
|
|
@ -137,6 +137,7 @@ static bool fuzzyCompare(qreal x, qreal y)
|
|||
// construct, copy, and modify.
|
||||
void tst_QVectorND::create2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector2D null;
|
||||
QCOMPARE(null.x(), (qreal)0.0f);
|
||||
QCOMPARE(null.y(), (qreal)0.0f);
|
||||
|
@ -220,12 +221,16 @@ void tst_QVectorND::create2()
|
|||
QCOMPARE(v10.y(), (qreal)2.5f);
|
||||
QCOMPARE(v10.z(), (qreal)0.0f);
|
||||
QCOMPARE(v10.w(), (qreal)0.0f);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test the creation of QVector3D objects in various ways:
|
||||
// construct, copy, and modify.
|
||||
void tst_QVectorND::create3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QVector3D null;
|
||||
QCOMPARE(null.x(), (qreal)0.0f);
|
||||
QCOMPARE(null.y(), (qreal)0.0f);
|
||||
|
@ -285,6 +290,7 @@ void tst_QVectorND::create3()
|
|||
QCOMPARE(v6.z(), (qreal)0.0f);
|
||||
QVERIFY(!v6.isNull());
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector3D v7(QVector2D(1.0f, 2.5f));
|
||||
QCOMPARE(v7.x(), (qreal)1.0f);
|
||||
QCOMPARE(v7.y(), (qreal)2.5f);
|
||||
|
@ -296,12 +302,15 @@ void tst_QVectorND::create3()
|
|||
QCOMPARE(v8.y(), (qreal)2.5f);
|
||||
QCOMPARE(v8.z(), (qreal)54.25f);
|
||||
QVERIFY(!v8.isNull());
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QVector3D v9(QVector4D(1.0f, 2.5f, 54.25f, 34.0f));
|
||||
QCOMPARE(v9.x(), (qreal)1.0f);
|
||||
QCOMPARE(v9.y(), (qreal)2.5f);
|
||||
QCOMPARE(v9.z(), (qreal)54.25f);
|
||||
QVERIFY(!v9.isNull());
|
||||
#endif // QT_NO_VECTOR4D
|
||||
|
||||
v1.setX(3.0f);
|
||||
QCOMPARE(v1.x(), (qreal)3.0f);
|
||||
|
@ -329,6 +338,7 @@ void tst_QVectorND::create3()
|
|||
QCOMPARE(v1.z(), (qreal)0.0f);
|
||||
QVERIFY(v1.isNull());
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QPoint p1 = v8.toPoint();
|
||||
QCOMPARE(p1.x(), 1);
|
||||
QCOMPARE(p1.y(), 3);
|
||||
|
@ -346,12 +356,17 @@ void tst_QVectorND::create3()
|
|||
QCOMPARE(v11.y(), (qreal)2.5f);
|
||||
QCOMPARE(v11.z(), (qreal)54.25f);
|
||||
QCOMPARE(v11.w(), (qreal)0.0f);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test the creation of QVector4D objects in various ways:
|
||||
// construct, copy, and modify.
|
||||
void tst_QVectorND::create4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QVector4D null;
|
||||
QCOMPARE(null.x(), (qreal)0.0f);
|
||||
QCOMPARE(null.y(), (qreal)0.0f);
|
||||
|
@ -435,13 +450,16 @@ void tst_QVectorND::create4()
|
|||
QCOMPARE(v6.w(), (qreal)0.0f);
|
||||
QVERIFY(!v6.isNull());
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector4D v7(QVector2D(1.0f, 2.5f));
|
||||
QCOMPARE(v7.x(), (qreal)1.0f);
|
||||
QCOMPARE(v7.y(), (qreal)2.5f);
|
||||
QCOMPARE(v7.z(), (qreal)0.0f);
|
||||
QCOMPARE(v7.w(), (qreal)0.0f);
|
||||
QVERIFY(!v7.isNull());
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QVector4D v8(QVector3D(1.0f, 2.5f, -89.25f));
|
||||
QCOMPARE(v8.x(), (qreal)1.0f);
|
||||
QCOMPARE(v8.y(), (qreal)2.5f);
|
||||
|
@ -455,13 +473,16 @@ void tst_QVectorND::create4()
|
|||
QCOMPARE(v9.z(), (qreal)-89.25f);
|
||||
QCOMPARE(v9.w(), (qreal)34.0f);
|
||||
QVERIFY(!v9.isNull());
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector4D v10(QVector2D(1.0f, 2.5f), 23.5f, -8);
|
||||
QCOMPARE(v10.x(), (qreal)1.0f);
|
||||
QCOMPARE(v10.y(), (qreal)2.5f);
|
||||
QCOMPARE(v10.z(), (qreal)23.5f);
|
||||
QCOMPARE(v10.w(), (qreal)-8.0f);
|
||||
QVERIFY(!v10.isNull());
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
v1.setX(3.0f);
|
||||
QCOMPARE(v1.x(), (qreal)3.0f);
|
||||
|
@ -501,6 +522,7 @@ void tst_QVectorND::create4()
|
|||
QCOMPARE(v1.w(), (qreal)0.0f);
|
||||
QVERIFY(v1.isNull());
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QPoint p1 = v8.toPoint();
|
||||
QCOMPARE(p1.x(), 1);
|
||||
QCOMPARE(p1.y(), 3);
|
||||
|
@ -509,30 +531,41 @@ void tst_QVectorND::create4()
|
|||
QCOMPARE((qreal)p2.x(), (qreal)1.0f);
|
||||
QCOMPARE((qreal)p2.y(), (qreal)2.5f);
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector2D v11 = v8.toVector2D();
|
||||
QCOMPARE(v11.x(), (qreal)1.0f);
|
||||
QCOMPARE(v11.y(), (qreal)2.5f);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
QVector3D v12 = v8.toVector3D();
|
||||
QCOMPARE(v12.x(), (qreal)1.0f);
|
||||
QCOMPARE(v12.y(), (qreal)2.5f);
|
||||
QCOMPARE(v12.z(), (qreal)-89.25f);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
QVector4D zerow(1.0f, 2.0f, 3.0f, 0.0f);
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector2D v13 = v9.toVector2DAffine();
|
||||
QVERIFY(fuzzyCompare(v13.x(), (qreal)(1.0f / 34.0f)));
|
||||
QVERIFY(fuzzyCompare(v13.y(), (qreal)(2.5f / 34.0f)));
|
||||
|
||||
QVector4D zerow(1.0f, 2.0f, 3.0f, 0.0f);
|
||||
v13 = zerow.toVector2DAffine();
|
||||
QVERIFY(v13.isNull());
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QVector3D v14 = v9.toVector3DAffine();
|
||||
QVERIFY(fuzzyCompare(v14.x(), (qreal)(1.0f / 34.0f)));
|
||||
QVERIFY(fuzzyCompare(v14.y(), (qreal)(2.5f / 34.0f)));
|
||||
QVERIFY(fuzzyCompare(v14.z(), (qreal)(-89.25f / 34.0f)));
|
||||
|
||||
v14 = zerow.toVector3DAffine();
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
QVERIFY(v14.isNull());
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test vector length computation for 2D vectors.
|
||||
|
@ -551,6 +584,7 @@ void tst_QVectorND::length2_data()
|
|||
}
|
||||
void tst_QVectorND::length2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, len);
|
||||
|
@ -558,6 +592,9 @@ void tst_QVectorND::length2()
|
|||
QVector2D v(x, y);
|
||||
QCOMPARE(v.length(), len);
|
||||
QCOMPARE(v.lengthSquared(), x * x + y * y);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test vector length computation for 3D vectors.
|
||||
|
@ -579,6 +616,7 @@ void tst_QVectorND::length3_data()
|
|||
}
|
||||
void tst_QVectorND::length3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, z);
|
||||
|
@ -587,6 +625,9 @@ void tst_QVectorND::length3()
|
|||
QVector3D v(x, y, z);
|
||||
QCOMPARE(v.length(), len);
|
||||
QCOMPARE(v.lengthSquared(), x * x + y * y + z * z);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test vector length computation for 4D vectors.
|
||||
|
@ -611,6 +652,7 @@ void tst_QVectorND::length4_data()
|
|||
}
|
||||
void tst_QVectorND::length4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, z);
|
||||
|
@ -620,6 +662,9 @@ void tst_QVectorND::length4()
|
|||
QVector4D v(x, y, z, w);
|
||||
QCOMPARE(v.length(), len);
|
||||
QCOMPARE(v.lengthSquared(), x * x + y * y + z * z + w * w);
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test the unit vector conversion for 2D vectors.
|
||||
|
@ -630,6 +675,7 @@ void tst_QVectorND::normalized2_data()
|
|||
}
|
||||
void tst_QVectorND::normalized2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, len);
|
||||
|
@ -642,6 +688,9 @@ void tst_QVectorND::normalized2()
|
|||
QVERIFY(fuzzyCompare(u.length(), qreal(1.0f)));
|
||||
QVERIFY(fuzzyCompare(u.x() * len, v.x()));
|
||||
QVERIFY(fuzzyCompare(u.y() * len, v.y()));
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test the unit vector conversion for 3D vectors.
|
||||
|
@ -652,6 +701,7 @@ void tst_QVectorND::normalized3_data()
|
|||
}
|
||||
void tst_QVectorND::normalized3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, z);
|
||||
|
@ -666,6 +716,9 @@ void tst_QVectorND::normalized3()
|
|||
QVERIFY(fuzzyCompare(u.x() * len, v.x()));
|
||||
QVERIFY(fuzzyCompare(u.y() * len, v.y()));
|
||||
QVERIFY(fuzzyCompare(u.z() * len, v.z()));
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test the unit vector conversion for 4D vectors.
|
||||
|
@ -676,6 +729,7 @@ void tst_QVectorND::normalized4_data()
|
|||
}
|
||||
void tst_QVectorND::normalized4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, z);
|
||||
|
@ -692,6 +746,9 @@ void tst_QVectorND::normalized4()
|
|||
QVERIFY(fuzzyCompare(u.y() * len, v.y()));
|
||||
QVERIFY(fuzzyCompare(u.z() * len, v.z()));
|
||||
QVERIFY(fuzzyCompare(u.w() * len, v.w()));
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test the unit vector conversion for 2D vectors.
|
||||
|
@ -702,6 +759,7 @@ void tst_QVectorND::normalize2_data()
|
|||
}
|
||||
void tst_QVectorND::normalize2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
|
||||
|
@ -712,6 +770,9 @@ void tst_QVectorND::normalize2()
|
|||
QVERIFY(v.isNull());
|
||||
else
|
||||
QVERIFY(fuzzyCompare(v.length(), qreal(1.0f)));
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test the unit vector conversion for 3D vectors.
|
||||
|
@ -722,6 +783,7 @@ void tst_QVectorND::normalize3_data()
|
|||
}
|
||||
void tst_QVectorND::normalize3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, z);
|
||||
|
@ -733,6 +795,9 @@ void tst_QVectorND::normalize3()
|
|||
QVERIFY(v.isNull());
|
||||
else
|
||||
QVERIFY(fuzzyCompare(v.length(), qreal(1.0f)));
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test the unit vector conversion for 4D vectors.
|
||||
|
@ -743,6 +808,7 @@ void tst_QVectorND::normalize4_data()
|
|||
}
|
||||
void tst_QVectorND::normalize4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x);
|
||||
QFETCH(qreal, y);
|
||||
QFETCH(qreal, z);
|
||||
|
@ -755,11 +821,15 @@ void tst_QVectorND::normalize4()
|
|||
QVERIFY(v.isNull());
|
||||
else
|
||||
QVERIFY(fuzzyCompare(v.length(), qreal(1.0f)));
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test the comparison operators for 2D vectors.
|
||||
void tst_QVectorND::compare2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector2D v1(1, 2);
|
||||
QVector2D v2(1, 2);
|
||||
QVector2D v3(3, 2);
|
||||
|
@ -768,11 +838,15 @@ void tst_QVectorND::compare2()
|
|||
QVERIFY(v1 == v2);
|
||||
QVERIFY(v1 != v3);
|
||||
QVERIFY(v1 != v4);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test the comparison operators for 3D vectors.
|
||||
void tst_QVectorND::compare3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QVector3D v1(1, 2, 4);
|
||||
QVector3D v2(1, 2, 4);
|
||||
QVector3D v3(3, 2, 4);
|
||||
|
@ -783,11 +857,15 @@ void tst_QVectorND::compare3()
|
|||
QVERIFY(v1 != v3);
|
||||
QVERIFY(v1 != v4);
|
||||
QVERIFY(v1 != v5);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test the comparison operators for 4D vectors.
|
||||
void tst_QVectorND::compare4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QVector4D v1(1, 2, 4, 8);
|
||||
QVector4D v2(1, 2, 4, 8);
|
||||
QVector4D v3(3, 2, 4, 8);
|
||||
|
@ -800,6 +878,9 @@ void tst_QVectorND::compare4()
|
|||
QVERIFY(v1 != v4);
|
||||
QVERIFY(v1 != v5);
|
||||
QVERIFY(v1 != v6);
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test vector addition for 2D vectors.
|
||||
|
@ -834,6 +915,7 @@ void tst_QVectorND::add2_data()
|
|||
}
|
||||
void tst_QVectorND::add2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, x2);
|
||||
|
@ -853,6 +935,9 @@ void tst_QVectorND::add2()
|
|||
|
||||
QCOMPARE(v4.x(), v1.x() + v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() + v2.y());
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test vector addition for 3D vectors.
|
||||
|
@ -895,6 +980,7 @@ void tst_QVectorND::add3_data()
|
|||
}
|
||||
void tst_QVectorND::add3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -918,6 +1004,9 @@ void tst_QVectorND::add3()
|
|||
QCOMPARE(v4.x(), v1.x() + v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() + v2.y());
|
||||
QCOMPARE(v4.z(), v1.z() + v2.z());
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test vector addition for 4D vectors.
|
||||
|
@ -968,6 +1057,7 @@ void tst_QVectorND::add4_data()
|
|||
}
|
||||
void tst_QVectorND::add4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -995,6 +1085,9 @@ void tst_QVectorND::add4()
|
|||
QCOMPARE(v4.y(), v1.y() + v2.y());
|
||||
QCOMPARE(v4.z(), v1.z() + v2.z());
|
||||
QCOMPARE(v4.w(), v1.w() + v2.w());
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test vector subtraction for 2D vectors.
|
||||
|
@ -1005,6 +1098,7 @@ void tst_QVectorND::subtract2_data()
|
|||
}
|
||||
void tst_QVectorND::subtract2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, x2);
|
||||
|
@ -1032,6 +1126,9 @@ void tst_QVectorND::subtract2()
|
|||
|
||||
QCOMPARE(v5.x(), v3.x() - v2.x());
|
||||
QCOMPARE(v5.y(), v3.y() - v2.y());
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test vector subtraction for 3D vectors.
|
||||
|
@ -1042,6 +1139,7 @@ void tst_QVectorND::subtract3_data()
|
|||
}
|
||||
void tst_QVectorND::subtract3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1074,6 +1172,9 @@ void tst_QVectorND::subtract3()
|
|||
QCOMPARE(v5.x(), v3.x() - v2.x());
|
||||
QCOMPARE(v5.y(), v3.y() - v2.y());
|
||||
QCOMPARE(v5.z(), v3.z() - v2.z());
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test vector subtraction for 4D vectors.
|
||||
|
@ -1084,6 +1185,7 @@ void tst_QVectorND::subtract4_data()
|
|||
}
|
||||
void tst_QVectorND::subtract4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1121,6 +1223,9 @@ void tst_QVectorND::subtract4()
|
|||
QCOMPARE(v5.y(), v3.y() - v2.y());
|
||||
QCOMPARE(v5.z(), v3.z() - v2.z());
|
||||
QCOMPARE(v5.w(), v3.w() - v2.w());
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test component-wise vector multiplication for 2D vectors.
|
||||
|
@ -1155,6 +1260,7 @@ void tst_QVectorND::multiply2_data()
|
|||
}
|
||||
void tst_QVectorND::multiply2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, x2);
|
||||
|
@ -1174,6 +1280,9 @@ void tst_QVectorND::multiply2()
|
|||
|
||||
QCOMPARE(v4.x(), v1.x() * v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() * v2.y());
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test component-wise vector multiplication for 3D vectors.
|
||||
|
@ -1216,6 +1325,7 @@ void tst_QVectorND::multiply3_data()
|
|||
}
|
||||
void tst_QVectorND::multiply3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1239,6 +1349,9 @@ void tst_QVectorND::multiply3()
|
|||
QCOMPARE(v4.x(), v1.x() * v2.x());
|
||||
QCOMPARE(v4.y(), v1.y() * v2.y());
|
||||
QCOMPARE(v4.z(), v1.z() * v2.z());
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test component-wise vector multiplication for 4D vectors.
|
||||
|
@ -1289,6 +1402,7 @@ void tst_QVectorND::multiply4_data()
|
|||
}
|
||||
void tst_QVectorND::multiply4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1316,6 +1430,9 @@ void tst_QVectorND::multiply4()
|
|||
QCOMPARE(v4.y(), v1.y() * v2.y());
|
||||
QCOMPARE(v4.z(), v1.z() * v2.z());
|
||||
QCOMPARE(v4.w(), v1.w() * v2.w());
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test vector multiplication by a factor for 2D vectors.
|
||||
|
@ -1354,6 +1471,7 @@ void tst_QVectorND::multiplyFactor2_data()
|
|||
}
|
||||
void tst_QVectorND::multiplyFactor2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, factor);
|
||||
|
@ -1372,6 +1490,9 @@ void tst_QVectorND::multiplyFactor2()
|
|||
|
||||
QCOMPARE(v3.x(), v1.x() * factor);
|
||||
QCOMPARE(v3.y(), v1.y() * factor);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test vector multiplication by a factor for 3D vectors.
|
||||
|
@ -1417,6 +1538,7 @@ void tst_QVectorND::multiplyFactor3_data()
|
|||
}
|
||||
void tst_QVectorND::multiplyFactor3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1438,6 +1560,9 @@ void tst_QVectorND::multiplyFactor3()
|
|||
QCOMPARE(v3.x(), v1.x() * factor);
|
||||
QCOMPARE(v3.y(), v1.y() * factor);
|
||||
QCOMPARE(v3.z(), v1.z() * factor);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test vector multiplication by a factor for 4D vectors.
|
||||
|
@ -1490,6 +1615,7 @@ void tst_QVectorND::multiplyFactor4_data()
|
|||
}
|
||||
void tst_QVectorND::multiplyFactor4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1514,6 +1640,9 @@ void tst_QVectorND::multiplyFactor4()
|
|||
QCOMPARE(v3.y(), v1.y() * factor);
|
||||
QCOMPARE(v3.z(), v1.z() * factor);
|
||||
QCOMPARE(v3.w(), v1.w() * factor);
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test vector division by a factor for 2D vectors.
|
||||
|
@ -1524,6 +1653,7 @@ void tst_QVectorND::divide2_data()
|
|||
}
|
||||
void tst_QVectorND::divide2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, factor);
|
||||
|
@ -1544,6 +1674,9 @@ void tst_QVectorND::divide2()
|
|||
|
||||
QCOMPARE(v3.x(), v2.x() / factor);
|
||||
QCOMPARE(v3.y(), v2.y() / factor);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test vector division by a factor for 3D vectors.
|
||||
|
@ -1554,6 +1687,7 @@ void tst_QVectorND::divide3_data()
|
|||
}
|
||||
void tst_QVectorND::divide3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1577,6 +1711,9 @@ void tst_QVectorND::divide3()
|
|||
QCOMPARE(v3.x(), v2.x() / factor);
|
||||
QCOMPARE(v3.y(), v2.y() / factor);
|
||||
QCOMPARE(v3.z(), v2.z() / factor);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test vector division by a factor for 4D vectors.
|
||||
|
@ -1587,6 +1724,7 @@ void tst_QVectorND::divide4_data()
|
|||
}
|
||||
void tst_QVectorND::divide4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1613,6 +1751,9 @@ void tst_QVectorND::divide4()
|
|||
QCOMPARE(v3.y(), v2.y() / factor);
|
||||
QCOMPARE(v3.z(), v2.z() / factor);
|
||||
QCOMPARE(v3.w(), v2.w() / factor);
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test vector negation for 2D vectors.
|
||||
|
@ -1623,6 +1764,7 @@ void tst_QVectorND::negate2_data()
|
|||
}
|
||||
void tst_QVectorND::negate2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
|
||||
|
@ -1630,6 +1772,9 @@ void tst_QVectorND::negate2()
|
|||
QVector2D v2(-x1, -y1);
|
||||
|
||||
QVERIFY(-v1 == v2);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test vector negation for 3D vectors.
|
||||
|
@ -1640,6 +1785,7 @@ void tst_QVectorND::negate3_data()
|
|||
}
|
||||
void tst_QVectorND::negate3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1648,6 +1794,9 @@ void tst_QVectorND::negate3()
|
|||
QVector3D v2(-x1, -y1, -z1);
|
||||
|
||||
QVERIFY(-v1 == v2);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test vector negation for 4D vectors.
|
||||
|
@ -1658,6 +1807,7 @@ void tst_QVectorND::negate4_data()
|
|||
}
|
||||
void tst_QVectorND::negate4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1667,6 +1817,9 @@ void tst_QVectorND::negate4()
|
|||
QVector4D v2(-x1, -y1, -z1, -w1);
|
||||
|
||||
QVERIFY(-v1 == v2);
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
// Test the computation of vector cross-products.
|
||||
|
@ -1703,6 +1856,7 @@ void tst_QVectorND::crossProduct_data()
|
|||
}
|
||||
void tst_QVectorND::crossProduct()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1728,6 +1882,9 @@ void tst_QVectorND::crossProduct()
|
|||
QCOMPARE(v4.x(), xres);
|
||||
QCOMPARE(v4.y(), yres);
|
||||
QCOMPARE(v4.z(), zres);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test the computation of normals.
|
||||
|
@ -1738,6 +1895,7 @@ void tst_QVectorND::normal_data()
|
|||
}
|
||||
void tst_QVectorND::normal()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1757,6 +1915,9 @@ void tst_QVectorND::normal()
|
|||
|
||||
QVector3D point(1.0f, 2.0f, 3.0f);
|
||||
QVERIFY(QVector3D::normal(point, v1 + point, v2 + point) == v3.normalized());
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test distance to plane calculations.
|
||||
|
@ -1803,8 +1964,10 @@ void tst_QVectorND::distanceToPlane_data()
|
|||
<< (qreal)0.0f << (qreal)2.0f << (qreal)0.0f
|
||||
<< (qreal)-2.0f;
|
||||
}
|
||||
|
||||
void tst_QVectorND::distanceToPlane()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1830,6 +1993,9 @@ void tst_QVectorND::distanceToPlane()
|
|||
|
||||
QCOMPARE(v3.distanceToPlane(v1, v2), distance);
|
||||
QCOMPARE(v3.distanceToPlane(v1, v4, v5), distance);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test distance to line calculations.
|
||||
|
@ -1878,6 +2044,7 @@ void tst_QVectorND::distanceToLine_data()
|
|||
}
|
||||
void tst_QVectorND::distanceToLine()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1894,6 +2061,9 @@ void tst_QVectorND::distanceToLine()
|
|||
QVector3D v3(x3, y3, z3);
|
||||
|
||||
QCOMPARE(v3.distanceToLine(v1, v2), distance);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test the computation of dot products for 2D vectors.
|
||||
|
@ -1922,6 +2092,7 @@ void tst_QVectorND::dotProduct2_data()
|
|||
}
|
||||
void tst_QVectorND::dotProduct2()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, x2);
|
||||
|
@ -1937,6 +2108,9 @@ void tst_QVectorND::dotProduct2()
|
|||
qreal d = x1 * x2 + y1 * y2;
|
||||
|
||||
QCOMPARE(QVector2D::dotProduct(v1, v2), d);
|
||||
#else // QT_NO_VECTOR2D
|
||||
QSKIP("Katie compiled without 2D vector support (QT_NO_VECTOR2D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
}
|
||||
|
||||
// Test the computation of dot products for 3D vectors.
|
||||
|
@ -1947,6 +2121,7 @@ void tst_QVectorND::dotProduct3_data()
|
|||
}
|
||||
void tst_QVectorND::dotProduct3()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -1971,6 +2146,9 @@ void tst_QVectorND::dotProduct3()
|
|||
qreal d = x1 * x2 + y1 * y2 + z1 * z2;
|
||||
|
||||
QCOMPARE(QVector3D::dotProduct(v1, v2), d);
|
||||
#else // QT_NO_VECTOR3D
|
||||
QSKIP("Katie compiled without 3D vector support (QT_NO_VECTOR3D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
}
|
||||
|
||||
// Test the computation of dot products for 4D vectors.
|
||||
|
@ -2003,6 +2181,7 @@ void tst_QVectorND::dotProduct4_data()
|
|||
}
|
||||
void tst_QVectorND::dotProduct4()
|
||||
{
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QFETCH(qreal, x1);
|
||||
QFETCH(qreal, y1);
|
||||
QFETCH(qreal, z1);
|
||||
|
@ -2022,30 +2201,51 @@ void tst_QVectorND::dotProduct4()
|
|||
qreal d = x1 * x2 + y1 * y2 + z1 * z2 + w1 * w2;
|
||||
|
||||
QCOMPARE(QVector4D::dotProduct(v1, v2), d);
|
||||
#else // QT_NO_VECTOR4D
|
||||
QSKIP("Katie compiled without 4D vector support (QT_NO_VECTOR4D)", SkipAll);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
class tst_QVectorNDProperties : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
Q_PROPERTY(QVector2D vector2D READ vector2D WRITE setVector2D)
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
Q_PROPERTY(QVector3D vector3D READ vector3D WRITE setVector3D)
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
Q_PROPERTY(QVector4D vector4D READ vector4D WRITE setVector4D)
|
||||
#endif // QT_NO_VECTOR4D
|
||||
public:
|
||||
tst_QVectorNDProperties(QObject *parent = 0) : QObject(parent) {}
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector2D vector2D() const { return v2; }
|
||||
void setVector2D(const QVector2D& value) { v2 = value; }
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QVector3D vector3D() const { return v3; }
|
||||
void setVector3D(const QVector3D& value) { v3 = value; }
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QVector4D vector4D() const { return v4; }
|
||||
void setVector4D(const QVector4D& value) { v4 = value; }
|
||||
#endif // QT_NO_VECTOR4D
|
||||
|
||||
private:
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
QVector2D v2;
|
||||
#endif // QT_NO_VECTOR2D
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
QVector3D v3;
|
||||
#endif // QT_NO_VECTOR3D
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
QVector4D v4;
|
||||
#endif // QT_NO_VECTOR4D
|
||||
};
|
||||
|
||||
// Test getting and setting vector properties via the metaobject system.
|
||||
|
@ -2053,46 +2253,56 @@ void tst_QVectorND::properties()
|
|||
{
|
||||
tst_QVectorNDProperties obj;
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
obj.setVector2D(QVector2D(1.0f, 2.0f));
|
||||
obj.setVector3D(QVector3D(3.0f, 4.0f, 5.0f));
|
||||
obj.setVector4D(QVector4D(6.0f, 7.0f, 8.0f, 9.0f));
|
||||
|
||||
QVector2D v2 = qvariant_cast<QVector2D>(obj.property("vector2D"));
|
||||
QCOMPARE(v2.x(), (qreal)1.0f);
|
||||
QCOMPARE(v2.y(), (qreal)2.0f);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
obj.setVector3D(QVector3D(3.0f, 4.0f, 5.0f));
|
||||
QVector3D v3 = qvariant_cast<QVector3D>(obj.property("vector3D"));
|
||||
QCOMPARE(v3.x(), (qreal)3.0f);
|
||||
QCOMPARE(v3.y(), (qreal)4.0f);
|
||||
QCOMPARE(v3.z(), (qreal)5.0f);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
obj.setVector4D(QVector4D(6.0f, 7.0f, 8.0f, 9.0f));
|
||||
QVector4D v4 = qvariant_cast<QVector4D>(obj.property("vector4D"));
|
||||
QCOMPARE(v4.x(), (qreal)6.0f);
|
||||
QCOMPARE(v4.y(), (qreal)7.0f);
|
||||
QCOMPARE(v4.z(), (qreal)8.0f);
|
||||
QCOMPARE(v4.w(), (qreal)9.0f);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
|
||||
#ifndef QT_NO_VECTOR2D
|
||||
obj.setProperty("vector2D",
|
||||
qVariantFromValue(QVector2D(-1.0f, -2.0f)));
|
||||
obj.setProperty("vector3D",
|
||||
qVariantFromValue(QVector3D(-3.0f, -4.0f, -5.0f)));
|
||||
obj.setProperty("vector4D",
|
||||
qVariantFromValue(QVector4D(-6.0f, -7.0f, -8.0f, -9.0f)));
|
||||
|
||||
v2 = qvariant_cast<QVector2D>(obj.property("vector2D"));
|
||||
QCOMPARE(v2.x(), (qreal)-1.0f);
|
||||
QCOMPARE(v2.y(), (qreal)-2.0f);
|
||||
#endif // QT_NO_VECTOR2D
|
||||
|
||||
#ifndef QT_NO_VECTOR3D
|
||||
obj.setProperty("vector3D",
|
||||
qVariantFromValue(QVector3D(-3.0f, -4.0f, -5.0f)));
|
||||
v3 = qvariant_cast<QVector3D>(obj.property("vector3D"));
|
||||
QCOMPARE(v3.x(), (qreal)-3.0f);
|
||||
QCOMPARE(v3.y(), (qreal)-4.0f);
|
||||
QCOMPARE(v3.z(), (qreal)-5.0f);
|
||||
#endif // QT_NO_VECTOR3D
|
||||
|
||||
#ifndef QT_NO_VECTOR4D
|
||||
obj.setProperty("vector4D",
|
||||
qVariantFromValue(QVector4D(-6.0f, -7.0f, -8.0f, -9.0f)));
|
||||
v4 = qvariant_cast<QVector4D>(obj.property("vector4D"));
|
||||
QCOMPARE(v4.x(), (qreal)-6.0f);
|
||||
QCOMPARE(v4.y(), (qreal)-7.0f);
|
||||
QCOMPARE(v4.z(), (qreal)-8.0f);
|
||||
QCOMPARE(v4.w(), (qreal)-9.0f);
|
||||
#endif // QT_NO_VECTOR4D
|
||||
}
|
||||
|
||||
void tst_QVectorND::metaTypes()
|
||||
|
|
Loading…
Add table
Reference in a new issue