diff options
author | Martin Jones <martin.jones@nokia.com> | 2010-02-05 06:29:59 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2010-02-05 06:29:59 (GMT) |
commit | 1f221f04afb2fc8a1426d30f77f3e6026fdbdab7 (patch) | |
tree | 7c0f03b49f05263686cd043738818918c00dad43 /tests/auto | |
parent | 785449b78126a03b0d3116b6a9653eed2c15257c (diff) | |
parent | 71f9752031658caebf42c06e1e04f7d03f6860de (diff) | |
download | Qt-1f221f04afb2fc8a1426d30f77f3e6026fdbdab7.zip Qt-1f221f04afb2fc8a1426d30f77f3e6026fdbdab7.tar.gz Qt-1f221f04afb2fc8a1426d30f77f3e6026fdbdab7.tar.bz2 |
Merge branch 'master' of scm.dev.nokia.troll.no:qt/qt-qml
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/behaviors/data/parent.qml | 28 | ||||
-rw-r--r-- | tests/auto/declarative/behaviors/tst_behaviors.cpp | 18 |
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/auto/declarative/behaviors/data/parent.qml b/tests/auto/declarative/behaviors/data/parent.qml new file mode 100644 index 0000000..4f4911b --- /dev/null +++ b/tests/auto/declarative/behaviors/data/parent.qml @@ -0,0 +1,28 @@ +import Qt 4.6 +Rectangle { + width: 400 + height: 400 + Rectangle { + id: rect + objectName: "MyRect" + width: 100; height: 100; color: "green" + parent: Behavior { + SequentialAnimation { + PauseAnimation { duration: 200 } + PropertyAction {} + } + } + } + Item { + id: newParent + objectName: "NewParent" + x: 100 + } + states: State { + name: "reparented" + PropertyChanges { + target: rect + parent: newParent + } + } +} diff --git a/tests/auto/declarative/behaviors/tst_behaviors.cpp b/tests/auto/declarative/behaviors/tst_behaviors.cpp index fe6bc6f..ae1af0e 100644 --- a/tests/auto/declarative/behaviors/tst_behaviors.cpp +++ b/tests/auto/declarative/behaviors/tst_behaviors.cpp @@ -58,6 +58,7 @@ private slots: void cppTriggered(); void loop(); void colorBehavior(); + void parentBehavior(); void replaceBinding(); //void transitionOverrides(); void group(); @@ -134,6 +135,23 @@ void tst_behaviors::colorBehavior() QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered } +void tst_behaviors::parentBehavior() +{ + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/parent.qml")); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("reparented"); + QTest::qWait(100); + QmlGraphicsItem *newParent = rect->findChild<QmlGraphicsItem*>("NewParent"); + QmlGraphicsItem *parent = rect->findChild<QmlGraphicsRectangle*>("MyRect")->parentItem(); + QVERIFY(parent != newParent); + QTest::qWait(300); + parent = rect->findChild<QmlGraphicsRectangle*>("MyRect")->parentItem(); + QVERIFY(parent == newParent); +} + void tst_behaviors::replaceBinding() { QmlEngine engine; |