Improve error message in bindable property test
Change-Id: I96a9f36657b49814b540c0b909c4642422d49b35 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
This commit is contained in:
parent
2393a40ccd
commit
c36f18b449
@ -140,10 +140,13 @@ void testReadWritePropertyBasics(
|
||||
const QMetaObject *metaObject = instance.metaObject();
|
||||
QMetaProperty metaProperty = metaObject->property(metaObject->indexOfProperty(propertyName));
|
||||
QVERIFY2(metaProperty.metaType() == QMetaType::fromType<PropertyType>(),
|
||||
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<PropertyType>().name() + " was provided.");
|
||||
|
||||
// in case the TestedClass has setProperty()/property() methods.
|
||||
QObject &testedObj = static_cast<QObject &>(instance);
|
||||
@ -274,10 +277,13 @@ void testReadOnlyPropertyBasics(
|
||||
QObject &testedObj = static_cast<QObject &>(instance);
|
||||
|
||||
QVERIFY2(metaProperty.metaType() == QMetaType::fromType<PropertyType>(),
|
||||
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<PropertyType>().name() + " was provided.");
|
||||
|
||||
QVERIFY2(metaProperty.isBindable(), "Preconditions not met for " + QByteArray(propertyName));
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user