diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2017-10-03 10:10:46 +0200 |
---|---|---|
committer | Edward Welbourne <edward.welbourne@qt.io> | 2017-11-03 14:29:49 +0000 |
commit | c988a8a28214914d20f4b8858e7f314a51b27507 (patch) | |
tree | 41c634e80f3e849eb913225e84b01165852c8f8d /src/testlib | |
parent | 58f46077015fc5dd71543ca25f762ff34fc12621 (diff) |
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 <Friedemann.Kleint@qt.io>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'src/testlib')
-rw-r--r-- | src/testlib/qtest_gui.h | 2 |
1 files changed, 1 insertions, 1 deletions
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) |