diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-03-24 21:03:05 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-04-03 07:04:26 +0200 |
commit | 36fc392147ea79bb665058ea165c86f6cd6680d7 (patch) | |
tree | d95cb07098a6bf41111ea95b96c5a0fc65eba6a4 /tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | |
parent | e40098c5303e7af4b12c64093b120405c63fdf8d (diff) |
Implement support for property observers
Syntactically we call them signal handler expressions :-), now also
working when the underlying property doesn't emit an old-style signal
but is just a QProperty.
Change-Id: I719a3e428f44af0fd48036434aefa682a02f7de1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 2a23d7ec60..fc50c2a09f 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -9288,8 +9288,11 @@ 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); test->setProperty("externalValue", 100); QCOMPARE(test->property("value").toInt(), 100); + QCOMPARE(test->property("changeHandlerCount").toInt(), 1); QVERIFY(qobject_cast<ClassWithQProperty*>(test.data())); QProperty<int> &qprop = static_cast<ClassWithQProperty*>(test.data())->value; |