aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp')
-rw-r--r--tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
index 2d267cc668..3e49f3b3c4 100644
--- a/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
+++ b/tests/auto/qml/qqmlbinding/tst_qqmlbinding.cpp
@@ -50,6 +50,8 @@ private slots:
void restoreBindingWithLoop();
void restoreBindingWithoutCrash();
void deletedObject();
+ void warningOnUnknownProperty();
+ void warningOnReadOnlyProperty();
private:
QQmlEngine engine;
@@ -224,6 +226,38 @@ void tst_qqmlbinding::deletedObject()
delete rect;
}
+void tst_qqmlbinding::warningOnUnknownProperty()
+{
+ QQmlTestMessageHandler messageHandler;
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("unknownProperty.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(item);
+ delete item;
+
+ QCOMPARE(messageHandler.messages().count(), 1);
+
+ const QString expectedMessage = c.url().toString() + QLatin1String(":6:5: QML Binding: Property 'unknown' does not exist on Item.");
+ QCOMPARE(messageHandler.messages().first(), expectedMessage);
+}
+
+void tst_qqmlbinding::warningOnReadOnlyProperty()
+{
+ QQmlTestMessageHandler messageHandler;
+
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("readonlyProperty.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(item);
+ delete item;
+
+ QCOMPARE(messageHandler.messages().count(), 1);
+
+ const QString expectedMessage = c.url().toString() + QLatin1String(":8:5: QML Binding: Property 'name' on Item is read-only.");
+ QCOMPARE(messageHandler.messages().first(), expectedMessage);
+}
+
QTEST_MAIN(tst_qqmlbinding)
#include "tst_qqmlbinding.moc"