Do an actual toString conversion for QVariant test failures

A cast is not a conversion. If the value is not already a string type
we are just getting an empty string for all metatypes that can be
converted to string.

Change-Id: I4643cc9fd509c21568fdc2133403c3ed8cb38a10
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Allan Sandfeld Jensen 2016-05-24 15:53:04 +02:00 committed by Allan Sandfeld Jensen
parent 9ebe146fee
commit 459933708a

View File

@ -160,7 +160,7 @@ template<> inline char *toString(const QVariant &v)
if (!v.isNull()) {
vstring.append(',');
if (v.canConvert(QVariant::String)) {
vstring.append(qvariant_cast<QString>(v).toLocal8Bit());
vstring.append(v.toString().toLocal8Bit());
}
else {
vstring.append("<value not representable as string>");