diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-12 01:14:04 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2009-10-12 01:14:04 (GMT) |
commit | 4d6958dd6d62441d98826ce141b5824d7eb0dfb0 (patch) | |
tree | 4b7edd4c6113fcb475d63ef970e0ab21d3050d71 /tests/auto/declarative | |
parent | de4d752b3b1c475e1d5b7bf1539fa6a80a52ba1d (diff) | |
download | Qt-4d6958dd6d62441d98826ce141b5824d7eb0dfb0.zip Qt-4d6958dd6d62441d98826ce141b5824d7eb0dfb0.tar.gz Qt-4d6958dd6d62441d98826ce141b5824d7eb0dfb0.tar.bz2 |
The root object is always last default object
Fix for QT-2301
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/qmlecmascript/data/signalTriggeredBindings.qml | 20 | ||||
-rw-r--r-- | tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 28 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/auto/declarative/qmlecmascript/data/signalTriggeredBindings.qml b/tests/auto/declarative/qmlecmascript/data/signalTriggeredBindings.qml new file mode 100644 index 0000000..f65e253 --- /dev/null +++ b/tests/auto/declarative/qmlecmascript/data/signalTriggeredBindings.qml @@ -0,0 +1,20 @@ +import Qt.test 1.0 +import Qt 4.6 + +MyQmlObject { + property real base: 50 + property alias test1: myObject.test1 + property alias test2: myObject.test2 + + objectProperty: Object { + id: myObject + property real test1: base + property real test2: Math.max(0, base) + } + + // Signal with no args + onBasicSignal: base = 200 + // Signal with args + onArgumentSignal: base = 400 +} + diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp index 5e04f7c..f976e41 100644 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp @@ -62,6 +62,7 @@ private slots: void selfDeletingBinding(); void extendedObjectPropertyLookup(); void scriptErrors(); + void signalTriggeredBindings(); private: QmlEngine engine; @@ -759,6 +760,33 @@ void tst_qmlecmascript::scriptErrors() QVERIFY(object != 0); } +/* +Test bindings still work when the reeval is triggered from within +a signal script. +*/ +void tst_qmlecmascript::signalTriggeredBindings() +{ + QmlComponent component(&engine, TEST_FILE("signalTriggeredBindings.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("base").toReal(), 50.); + QCOMPARE(object->property("test1").toReal(), 50.); + QCOMPARE(object->property("test2").toReal(), 50.); + + object->basicSignal(); + + QCOMPARE(object->property("base").toReal(), 200.); + QCOMPARE(object->property("test1").toReal(), 200.); + QCOMPARE(object->property("test2").toReal(), 200.); + + object->argumentSignal(10, QString(), 10); + + QCOMPARE(object->property("base").toReal(), 400.); + QCOMPARE(object->property("test1").toReal(), 400.); + QCOMPARE(object->property("test2").toReal(), 400.); +} + QTEST_MAIN(tst_qmlecmascript) #include "tst_qmlecmascript.moc" |