diff options
author | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-17 10:01:55 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> | 2016-03-17 15:35:05 +0000 |
commit | 74c202f913cc870459250b5ea9c45500e472fd20 (patch) | |
tree | 1f980ac3b841a552c5c80d78516568d7687e5735 /src/testlib/qtest_gui.h | |
parent | d19c9cfd29bcb3c8fb8108bbcb29d71be19711f5 (diff) |
QtTest: Add formatting for QColor.
When a QCOMPARE of values of type QColor fails, their
name will now be printed.
Task-number: QTBUG-51124
Change-Id: I76565daa338f038ea4f452e47705e638d94eaeee
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'src/testlib/qtest_gui.h')
-rw-r--r-- | src/testlib/qtest_gui.h | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h index fd09c1202f..2faf37f32b 100644 --- a/src/testlib/qtest_gui.h +++ b/src/testlib/qtest_gui.h @@ -55,6 +55,7 @@ #include <QtTest/qtesttouch.h> #include <QtTest/qtestkeyboard.h> +#include <QtGui/qcolor.h> #include <QtGui/qpixmap.h> #include <QtGui/qimage.h> @@ -73,6 +74,11 @@ QT_BEGIN_NAMESPACE namespace QTest { +template<> inline char *toString(const QColor &color) +{ + return qstrdup(color.name().toLocal8Bit().constData()); +} + inline bool qCompare(QIcon const &t1, QIcon const &t2, const char *actual, const char *expected, const char *file, int line) { |