From c36f18b4497e8dd52842e10500a3bbc35513dc5e Mon Sep 17 00:00:00 2001 From: Andreas Buhr Date: Mon, 14 Dec 2020 19:27:10 +0100 Subject: [PATCH] Improve error message in bindable property test Change-Id: I96a9f36657b49814b540c0b909c4642422d49b35 Reviewed-by: Fabian Kosmale Reviewed-by: Ivan Solovev --- src/testlib/qpropertytesthelper_p.h | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index 7b22e157843..a6cc9a52d8f 100644 --- a/src/testlib/qpropertytesthelper_p.h +++ b/src/testlib/qpropertytesthelper_p.h @@ -140,10 +140,13 @@ void testReadWritePropertyBasics( const QMetaObject *metaObject = instance.metaObject(); QMetaProperty metaProperty = metaObject->property(metaObject->indexOfProperty(propertyName)); QVERIFY2(metaProperty.metaType() == QMetaType::fromType(), - QByteArray("Preconditions not met for") + propertyName + '\n' + - "The type of initial and changed value does not match the type of the property." - "Please ensure that the types match exactly (convertability is not enough)." - "You can provide the template types to the function explicitly to force a certain type"); + QByteArray("Preconditions not met for ") + propertyName + '\n' + + "The type of initial and changed value does not match the type of the property.\n" + "Please ensure that the types match exactly (convertability is not enough).\n" + "You can provide the template types to the " + "function explicitly to force a certain type.\n" + "Expected was a " + metaProperty.metaType().name() + + " but " + QMetaType::fromType().name() + " was provided."); // in case the TestedClass has setProperty()/property() methods. QObject &testedObj = static_cast(instance); @@ -274,10 +277,13 @@ void testReadOnlyPropertyBasics( QObject &testedObj = static_cast(instance); QVERIFY2(metaProperty.metaType() == QMetaType::fromType(), - QByteArray("Preconditions not met for") + propertyName + '\n' + - "The type of initial and changed value does not match the type of the property." - "Please ensure that the types match exactly (convertability is not enough)." - "You can provide the template types to the function explicitly to force a certain type"); + QByteArray("Preconditions not met for ") + propertyName + '\n' + + "The type of initial and changed value does not match the type of the property.\n" + "Please ensure that the types match exactly (convertability is not enough).\n" + "You can provide the template types to the " + "function explicitly to force a certain type.\n" + "Expected was a " + metaProperty.metaType().name() + + " but " + QMetaType::fromType().name() + " was provided."); QVERIFY2(metaProperty.isBindable(), "Preconditions not met for " + QByteArray(propertyName));