diff options
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 52b2afe727..deb949e7a5 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -383,6 +383,7 @@ private slots: void semicolonAfterProperty(); void hugeStack(); void bindingOnQProperty(); + void bindingOnQPropertyContextProperty(); void urlConstruction(); void urlPropertyInvalid(); void urlPropertySet(); @@ -9279,17 +9280,28 @@ void tst_qqmlecmascript::bindingOnQProperty() QScopedPointer<QObject> test(component.create()); test->setProperty("externalValue", 42); QCOMPARE(test->property("value").toInt(), 42); - // Value hasn't changed yet... - QCOMPARE(test->property("changeHandlerCount").toInt(), 0); + QCOMPARE(test->property("changeHandlerCount").toInt(), 1); test->setProperty("externalValue", 100); QCOMPARE(test->property("value").toInt(), 100); - QCOMPARE(test->property("changeHandlerCount").toInt(), 1); + QCOMPARE(test->property("changeHandlerCount").toInt(), 2); QVERIFY(qobject_cast<ClassWithQProperty*>(test.data())); QProperty<float> &qprop = static_cast<ClassWithQProperty*>(test.data())->value; QVERIFY(qprop.hasBinding()); } +void tst_qqmlecmascript::bindingOnQPropertyContextProperty() +{ + QQmlEngine engine; + QQmlComponent component(&engine, testFileUrl("bindingOnQPropertyContextProperty.qml")); + QVERIFY2(component.isReady(), qPrintable(component.errorString())); + QScopedPointer<QObject> test(component.create()); + QVERIFY(!test.isNull()); + auto classWithQProperty = test->property("testee").value<ClassWithQProperty2 *>(); + QVERIFY(classWithQProperty); + QCOMPARE(classWithQProperty->value.value(), 2); +} + void tst_qqmlecmascript::urlConstruction() { QQmlEngine qmlengine; |