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 /tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp | |
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 'tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp')
-rw-r--r-- | tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp index 78bb2247cb..204758f68a 100644 --- a/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp +++ b/tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp @@ -30,6 +30,7 @@ #include <QtCore/QCoreApplication> #include <QtTest/QtTest> #ifdef QT_GUI_LIB +#include <QtGui/QColor> #include <QtGui/QImage> #include <QtGui/QPixmap> #endif @@ -135,6 +136,7 @@ private slots: void compareQListInt(); void compareQListDouble(); #ifdef QT_GUI_LIB + void compareQColor(); void compareQPixmaps(); void compareQPixmaps_data(); void compareQImages(); @@ -346,6 +348,15 @@ void tst_Cmptest::compareQListDouble() } #ifdef QT_GUI_LIB +void tst_Cmptest::compareQColor() +{ + const QColor yellow(Qt::yellow); + const QColor yellowFromName(QStringLiteral("yellow")); + const QColor green(Qt::green); + QCOMPARE(yellow, yellowFromName); + QCOMPARE(yellow, green); +} + void tst_Cmptest::compareQPixmaps_data() { QTest::addColumn<QPixmap>("opA"); |