From 74c202f913cc870459250b5ea9c45500e472fd20 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 17 Mar 2016 10:01:55 +0100 Subject: 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 --- tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tests/auto/testlib/selftests/cmptest/tst_cmptest.cpp') 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 #include #ifdef QT_GUI_LIB +#include #include #include #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("opA"); -- cgit v1.2.3