diff options
Diffstat (limited to 'tests/auto/declarative/qdeclarativebehaviors')
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/startup.qml | 17 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp | 16 |
2 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml new file mode 100644 index 0000000..f3ff620 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/data/startup.qml @@ -0,0 +1,17 @@ +import Qt 4.7 + +Rectangle { + width: 400 + height: 400 + + Rectangle { + objectName: "innerRect" + height: 100; width: 100; color: "green" + property real targetX: 100 + + x: targetX + Behavior on x { + NumberAnimation {} + } + } +} diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp index 26c8231..4c9c9ca 100644 --- a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -68,6 +68,7 @@ private slots: void reassignedAnimation(); void disabled(); void dontStart(); + void startup(); }; void tst_qdeclarativebehaviors::simpleBehavior() @@ -326,6 +327,21 @@ void tst_qdeclarativebehaviors::dontStart() delete rect; } +void tst_qdeclarativebehaviors::startup() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/startup.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *innerRect = rect->findChild<QDeclarativeRectangle*>("innerRect"); + QVERIFY(innerRect); + + QCOMPARE(innerRect->x(), qreal(100)); //should be set immediately + + delete rect; +} + QTEST_MAIN(tst_qdeclarativebehaviors) #include "tst_qdeclarativebehaviors.moc" |