diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-04-12 01:36:37 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2011-04-12 01:42:19 (GMT) |
commit | 3bc0d853a09ae55c158946a99284a47b0b30a3b4 (patch) | |
tree | 7cadc1f30e68438591946708a9530f61fd7a1740 /tests | |
parent | f2219ce983098fc14655d8f3bb8a7fee2c9abe4d (diff) | |
download | Qt-3bc0d853a09ae55c158946a99284a47b0b30a3b4.zip Qt-3bc0d853a09ae55c158946a99284a47b0b30a3b4.tar.gz Qt-3bc0d853a09ae55c158946a99284a47b0b30a3b4.tar.bz2 |
Fix regression in wigglytext.qml
This change re-adds the code removed in
8e9c28eaa4d7a3372b9a9a21a984701b62f96456 (which caused this regression),
while keeping the new code as well (to specially handle the case of
registration in componentCompleted()).
Change-Id: I707e3d2ead9ea25079f79cd5e5886d1dc1c69d1b
Task-number: QTBUG-18362
Reviewed-by: Aaron Kennedy
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml | 25 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp | 18 |
2 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml b/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml new file mode 100644 index 0000000..aa384c3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/delayedRegistration.qml @@ -0,0 +1,25 @@ +import QtQuick 1.0 + +Rectangle { + id: container + + width: 400; height: 400; + property Item myItem + + function doCreate() { + myItem = myComponent.createObject(container) + myItem.x = 100 + } + + Component { + id: myComponent + Rectangle { + width: 100 + height: 100 + color: "green" + Behavior on x { NumberAnimation { duration: 500 } } + } + } + + Component.onCompleted: doCreate() +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 80ba907..4536d9e 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -81,6 +81,7 @@ private slots: void groupedPropertyCrash(); void runningTrue(); void sameValue(); + void delayedRegistration(); }; void tst_qdeclarativebehaviors::simpleBehavior() @@ -412,6 +413,23 @@ void tst_qdeclarativebehaviors::sameValue() QTRY_VERIFY(target->x() != qreal(0) && target->x() != qreal(100)); } +//QTBUG-18362 +void tst_qdeclarativebehaviors::delayedRegistration() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/delayedRegistration.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + + QDeclarativeItem *innerRect = rect->property("myItem").value<QDeclarativeItem*>(); + QVERIFY(innerRect != 0); + + QCOMPARE(innerRect->property("x").toInt(), int(0)); + + QTRY_COMPARE(innerRect->property("x").toInt(), int(100)); +} + QTEST_MAIN(tst_qdeclarativebehaviors) #include "tst_qdeclarativebehaviors.moc" |