diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index 1a769bc3f04..7b22e157843 100644 --- a/src/testlib/qpropertytesthelper_p.h +++ b/src/testlib/qpropertytesthelper_p.h @@ -139,6 +139,11 @@ void testReadWritePropertyBasics( // get the property 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"); // in case the TestedClass has setProperty()/property() methods. QObject &testedObj = static_cast(instance); @@ -268,6 +273,12 @@ void testReadOnlyPropertyBasics( // in case the TestedClass has setProperty()/property() methods. 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"); + QVERIFY2(metaProperty.isBindable(), "Preconditions not met for " + QByteArray(propertyName)); QUntypedBindable bindable = metaProperty.bindable(&instance);