diff options
Diffstat (limited to 'tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp')
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 5ef8937dc1..2dde5f003d 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -133,6 +133,7 @@ private slots: void aliasPropertyBindings(); void noContext(); void assignEmptyVariantMap(); + void warnOnInvalidBinding(); void copy(); private: @@ -1708,6 +1709,25 @@ void tst_qqmlproperty::assignEmptyVariantMap() delete obj; } +void tst_qqmlproperty::warnOnInvalidBinding() +{ + QUrl testUrl(testFileUrl("invalidBinding.qml")); + QString expectedWarning; + + // V4 error message for property-to-property binding + expectedWarning = testUrl.toString() + QString::fromLatin1(":6:36: Unable to assign QQuickText to QQuickRectangle"); + QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData()); + + // V8 error message for function-to-property binding + expectedWarning = testUrl.toString() + QString::fromLatin1(":7:36: Unable to assign QQuickText to QQuickRectangle"); + QTest::ignoreMessage(QtWarningMsg, expectedWarning.toLatin1().constData()); + + QQmlComponent component(&engine, testUrl); + QObject *obj = component.create(); + QVERIFY(obj); + delete obj; +} + void tst_qqmlproperty::initTestCase() { QQmlDataTest::initTestCase(); |