diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2017-07-31 14:57:02 +0200 |
---|---|---|
committer | Tony Sarajärvi <tony.sarajarvi@qt.io> | 2017-08-27 06:17:32 +0000 |
commit | eb93d7b51773b43e6a3e41961898a6033bcd9479 (patch) | |
tree | fb96e5115a5c5e4a92dc775d4c6b8a5f611cb392 /src/testlib | |
parent | ca0df4b2694fc3ca0c31cda0d5edec7e76f7dfcb (diff) |
Testlib: Format QVector2/3/4D in QCOMPARE
Change-Id: Ia0709e598d2fddd6c2f448633b484749146265f7
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtest_gui.h | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h index d0d56e7bd0..d848f08d55 100644 --- a/src/testlib/qtest_gui.h +++ b/src/testlib/qtest_gui.h @@ -59,6 +59,9 @@ #include <QtGui/qpixmap.h> #include <QtGui/qimage.h> #include <QtGui/qregion.h> +#include <QtGui/qvector2d.h> +#include <QtGui/qvector3d.h> +#include <QtGui/qvector4d.h> #ifdef QT_WIDGETS_LIB #include <QtGui/qicon.h> @@ -116,6 +119,32 @@ template<> inline char *toString(const QRegion ®ion) return qstrdup(result.constData()); } +#ifndef QT_NO_VECTOR2D +template<> inline char *toString(const QVector2D &v) +{ + QByteArray result = "QVector2D(" + QByteArray::number(v.x()) + ", " + + QByteArray::number(v.y()) + ')'; + return qstrdup(result.constData()); +} +#endif // !QT_NO_VECTOR2D +#ifndef QT_NO_VECTOR3D +template<> inline char *toString(const QVector3D &v) +{ + QByteArray result = "QVector3D(" + QByteArray::number(v.x()) + ", " + + QByteArray::number(v.y()) + ", " + QByteArray::number(v.z()) + ')'; + return qstrdup(result.constData()); +} +#endif // !QT_NO_VECTOR3D +#ifndef QT_NO_VECTOR4D +template<> inline char *toString(const QVector4D &v) +{ + QByteArray result = "QVector4D(" + QByteArray::number(v.x()) + ", " + + QByteArray::number(v.y()) + ", " + QByteArray::number(v.z()) + + ", " + QByteArray::number(v.w()) + ')'; + return qstrdup(result.constData()); +} +#endif // !QT_NO_VECTOR4D + inline bool qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line) { |