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
@ -141,9 +141,12 @@ void testReadWritePropertyBasics(
|
|||||||
QMetaProperty metaProperty = metaObject->property(metaObject->indexOfProperty(propertyName));
|
QMetaProperty metaProperty = metaObject->property(metaObject->indexOfProperty(propertyName));
|
||||||
QVERIFY2(metaProperty.metaType() == QMetaType::fromType<PropertyType>(),
|
QVERIFY2(metaProperty.metaType() == QMetaType::fromType<PropertyType>(),
|
||||||
QByteArray("Preconditions not met for ") + propertyName + '\n' +
|
QByteArray("Preconditions not met for ") + propertyName + '\n' +
|
||||||
"The type of initial and changed value does not match the type of the property."
|
"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)."
|
"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");
|
"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.
|
// in case the TestedClass has setProperty()/property() methods.
|
||||||
QObject &testedObj = static_cast<QObject &>(instance);
|
QObject &testedObj = static_cast<QObject &>(instance);
|
||||||
@ -275,9 +278,12 @@ void testReadOnlyPropertyBasics(
|
|||||||
|
|
||||||
QVERIFY2(metaProperty.metaType() == QMetaType::fromType<PropertyType>(),
|
QVERIFY2(metaProperty.metaType() == QMetaType::fromType<PropertyType>(),
|
||||||
QByteArray("Preconditions not met for ") + propertyName + '\n' +
|
QByteArray("Preconditions not met for ") + propertyName + '\n' +
|
||||||
"The type of initial and changed value does not match the type of the property."
|
"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)."
|
"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");
|
"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));
|
QVERIFY2(metaProperty.isBindable(), "Preconditions not met for " + QByteArray(propertyName));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user