diff options
author | Andreas Buhr <andreas.buhr@qt.io> | 2020-12-14 19:27:10 +0100 |
---|---|---|
committer | Andreas Buhr <andreas.buhr@qt.io> | 2021-04-23 16:50:54 +0200 |
commit | c36f18b4497e8dd52842e10500a3bbc35513dc5e (patch) | |
tree | fd809ae0208099d01811c8912e54972d5b0ea85a /src/testlib/qpropertytesthelper_p.h | |
parent | 2393a40ccd455cc2dca410e8a1830856dbfde12d (diff) |
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>
Diffstat (limited to 'src/testlib/qpropertytesthelper_p.h')
-rw-r--r-- | src/testlib/qpropertytesthelper_p.h | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/src/testlib/qpropertytesthelper_p.h b/src/testlib/qpropertytesthelper_p.h index 7b22e15784..a6cc9a52d8 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<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)); |