diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-04-08 02:31:33 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-04-08 02:48:17 (GMT) |
commit | 5d9f5b0ba76bee4b148e13fd880d87d167e6c68d (patch) | |
tree | 862ecb7220c8f1f7a752b19a2d882af89a6c3794 /tests/auto/declarative | |
parent | db3fcbbb2368266d60781189648951ff17895b1e (diff) | |
download | Qt-5d9f5b0ba76bee4b148e13fd880d87d167e6c68d.zip Qt-5d9f5b0ba76bee4b148e13fd880d87d167e6c68d.tar.gz Qt-5d9f5b0ba76bee4b148e13fd880d87d167e6c68d.tar.bz2 |
Prevent Behavior from being triggered on initialization.
Task-number: QTBUG-6332
Diffstat (limited to 'tests/auto/declarative')
-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" |