diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index b3e4296a13..fbb344f9a0 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -381,6 +381,7 @@ private slots: void getThisObject(); void semicolonAfterProperty(); void hugeStack(); + void bindingOnQProperty(); void gcCrashRegressionTest(); @@ -9281,6 +9282,22 @@ void tst_qqmlecmascript::gcCrashRegressionTest() QCOMPARE(process.exitCode(), 0); } +void tst_qqmlecmascript::bindingOnQProperty() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("bindingOnQProperty.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> test(component.create()); + test->setProperty("externalValue", 42); + QCOMPARE(test->property("value").toInt(), 42); + test->setProperty("externalValue", 100); + QCOMPARE(test->property("value").toInt(), 100); + + QVERIFY(qobject_cast<ClassWithQProperty*>(test.data())); + QProperty<int> &qprop = static_cast<ClassWithQProperty*>(test.data())->value; + QVERIFY(qprop.hasBinding()); +} + QTEST_MAIN(tst_qqmlecmascript) #include "tst_qqmlecmascript.moc" |