From c988a8a28214914d20f4b8858e7f314a51b27507 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Tue, 3 Oct 2017 10:10:46 +0200 Subject: Make QCOMPARE print QColor alpha values on failure Currently, when two colors are equal except for their alpha values, QCOMPARE produces the following failure message: FAIL! : tst_Test::test() Compared values are not the same Actual (colorA): #ff0000 Expected (colorB): #ff0000 By using the HexArgb format instead of the default HexRgb, we can see the full hex string, with alpha values included: FAIL! : tst_Test::test() Compared values are not the same Actual (colorA): #88ff0000 Expected (colorB): #ffff0000 Task-number: QTBUG-55574 Change-Id: Id82c60a1b473ac6025a6f6ac560fce95a910d782 Reviewed-by: Friedemann Kleint Reviewed-by: Edward Welbourne --- src/testlib/qtest_gui.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/testlib') diff --git a/src/testlib/qtest_gui.h b/src/testlib/qtest_gui.h index d848f08d55..2b486aae5d 100644 --- a/src/testlib/qtest_gui.h +++ b/src/testlib/qtest_gui.h @@ -83,7 +83,7 @@ namespace QTest */ template<> inline char *toString(const QColor &color) { - return qstrdup(color.name().toLocal8Bit().constData()); + return qstrdup(color.name(QColor::HexArgb).toLocal8Bit().constData()); } template<> inline char *toString(const QRegion ®ion) -- cgit v1.2.3