diff options
Diffstat (limited to 'src/testlib/qtest_gui.h')
-rw-r--r-- | src/testlib/qtest_gui.h | 37 |
1 files changed, 24 insertions, 13 deletions
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h index 68c13ee57b..667debb3c4 100644 --- a/src/testlib/qtest_gui.h +++ b/src/testlib/qtest_gui.h @@ -17,11 +17,15 @@ #include <QtTest/qtestevent.h> #include <QtTest/qtestmouse.h> #include <QtTest/qtesttouch.h> +#include <QtTest/qtestwheel.h> #include <QtTest/qtestkeyboard.h> #include <QtGui/qcolor.h> #include <QtGui/qpixmap.h> #include <QtGui/qimage.h> +#if QT_CONFIG(shortcut) +#include <QtGui/qkeysequence.h> +#endif #include <QtGui/qregion.h> #include <QtGui/qvector2d.h> #include <QtGui/qvector3d.h> @@ -77,7 +81,7 @@ template<> inline char *toString(const QRegion ®ion) return qstrdup(result.constData()); } -#if !defined(QT_NO_VECTOR2D) || defined(Q_CLANG_QDOC) +#if !defined(QT_NO_VECTOR2D) || defined(Q_QDOC) template<> inline char *toString(const QVector2D &v) { QByteArray result = "QVector2D(" + QByteArray::number(double(v.x())) + ", " @@ -85,7 +89,7 @@ template<> inline char *toString(const QVector2D &v) return qstrdup(result.constData()); } #endif // !QT_NO_VECTOR2D -#if !defined(QT_NO_VECTOR3D) || defined(Q_CLANG_QDOC) +#if !defined(QT_NO_VECTOR3D) || defined(Q_QDOC) template<> inline char *toString(const QVector3D &v) { QByteArray result = "QVector3D(" + QByteArray::number(double(v.x())) + ", " @@ -93,7 +97,7 @@ template<> inline char *toString(const QVector3D &v) return qstrdup(result.constData()); } #endif // !QT_NO_VECTOR3D -#if !defined(QT_NO_VECTOR4D) || defined(Q_CLANG_QDOC) +#if !defined(QT_NO_VECTOR4D) || defined(Q_QDOC) template<> inline char *toString(const QVector4D &v) { QByteArray result = "QVector4D(" + QByteArray::number(double(v.x())) + ", " @@ -103,6 +107,13 @@ template<> inline char *toString(const QVector4D &v) } #endif // !QT_NO_VECTOR4D +#if QT_CONFIG(shortcut) +template<> inline char *toString(const QKeySequence &keySequence) +{ + return toString(keySequence.toString()); +} +#endif + inline bool qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line) { @@ -122,17 +133,17 @@ inline bool qCompare(QImage const &t1, QImage const &t2, qsnprintf(msg, 1024, "Compared QImages differ.\n" " Actual (%s).isNull(): %d\n" " Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null); - return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line); + return compare_helper(false, msg, actual, expected, file, line); } if (t1Null && t2Null) - return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line); + return compare_helper(true, nullptr, actual, expected, file, line); if (!qFuzzyCompare(t1.devicePixelRatio(), t2.devicePixelRatio())) { qsnprintf(msg, 1024, "Compared QImages differ in device pixel ratio.\n" " Actual (%s): %g\n" " Expected (%s): %g", actual, t1.devicePixelRatio(), expected, t2.devicePixelRatio()); - return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line); + return compare_helper(false, msg, actual, expected, file, line); } if (t1.width() != t2.width() || t1.height() != t2.height()) { qsnprintf(msg, 1024, "Compared QImages differ in size.\n" @@ -140,17 +151,17 @@ inline bool qCompare(QImage const &t1, QImage const &t2, " Expected (%s): %dx%d", actual, t1.width(), t1.height(), expected, t2.width(), t2.height()); - return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line); + return compare_helper(false, msg, actual, expected, file, line); } if (t1.format() != t2.format()) { qsnprintf(msg, 1024, "Compared QImages differ in format.\n" " Actual (%s): %d\n" " Expected (%s): %d", actual, t1.format(), expected, t2.format()); - return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line); + return compare_helper(false, msg, actual, expected, file, line); } return compare_helper(t1 == t2, "Compared values are not the same", - nullptr, nullptr, actual, expected, file, line); + actual, expected, file, line); } inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, const char *expected, @@ -164,17 +175,17 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c qsnprintf(msg, 1024, "Compared QPixmaps differ.\n" " Actual (%s).isNull(): %d\n" " Expected (%s).isNull(): %d", actual, t1Null, expected, t2Null); - return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line); + return compare_helper(false, msg, actual, expected, file, line); } if (t1Null && t2Null) - return compare_helper(true, nullptr, nullptr, nullptr, actual, expected, file, line); + return compare_helper(true, nullptr, actual, expected, file, line); if (!qFuzzyCompare(t1.devicePixelRatio(), t2.devicePixelRatio())) { qsnprintf(msg, 1024, "Compared QPixmaps differ in device pixel ratio.\n" " Actual (%s): %g\n" " Expected (%s): %g", actual, t1.devicePixelRatio(), expected, t2.devicePixelRatio()); - return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line); + return compare_helper(false, msg, actual, expected, file, line); } if (t1.width() != t2.width() || t1.height() != t2.height()) { qsnprintf(msg, 1024, "Compared QPixmaps differ in size.\n" @@ -182,7 +193,7 @@ inline bool qCompare(QPixmap const &t1, QPixmap const &t2, const char *actual, c " Expected (%s): %dx%d", actual, t1.width(), t1.height(), expected, t2.width(), t2.height()); - return compare_helper(false, msg, nullptr, nullptr, actual, expected, file, line); + return compare_helper(false, msg, actual, expected, file, line); } return qCompare(t1.toImage(), t2.toImage(), actual, expected, file, line); } |