diff options
author | Jesper Thomschutz <jesper.thomschutz@nokia.com> | 2010-09-15 07:45:55 (GMT) |
---|---|---|
committer | A-Team <ateam@pad.test.qt.nokia.com> | 2010-09-15 07:46:55 (GMT) |
commit | f78119906b0ffc7fd3dd36d6d827d456478a7fd5 (patch) | |
tree | e161fe397dedd702f86d186ef32eabcf7cae00d8 /tests/auto/declarative/qdeclarativestates | |
parent | 66420856664c7a412b3c9efe4be6ff7a6061e5f2 (diff) | |
parent | 05ab8ad1577fc038aa2b3bd96cedda54e6a64979 (diff) | |
download | Qt-f78119906b0ffc7fd3dd36d6d827d456478a7fd5.zip Qt-f78119906b0ffc7fd3dd36d6d827d456478a7fd5.tar.gz Qt-f78119906b0ffc7fd3dd36d6d827d456478a7fd5.tar.bz2 |
git Merge branch '4.7-upstream' into 4.7-doc
Conflicts:
src/gui/kernel/qgesturemanager.cpp
Diffstat (limited to 'tests/auto/declarative/qdeclarativestates')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/parentChange6.qml | 30 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 15 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml new file mode 100644 index 0000000..be92aba --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange6.qml @@ -0,0 +1,30 @@ +import Qt 4.7 + +Rectangle { + width: 400; height: 400 + Rectangle { + id: myRect + objectName: "MyRect" + x: 5; y: 5 + width: 100; height: 100 + color: "red" + } + MouseArea { + id: clickable + anchors.fill: parent + } + + Item { + id: newParent + rotation: 180 + } + + states: State { + name: "reparented" + when: clickable.pressed + ParentChange { + target: myRect + parent: newParent + } + } +} diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 6ae2759..0621602 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -581,6 +581,21 @@ void tst_qdeclarativestates::parentChange() //do a non-qFuzzyCompare fuzzy compare QVERIFY(innerRect->y() < qreal(0.00001) && innerRect->y() > qreal(-0.00001)); } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange6.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QDeclarativeItemPrivate::get(rect)->setState("reparented"); + QCOMPARE(innerRect->rotation(), qreal(180)); + QCOMPARE(innerRect->scale(), qreal(1)); + QCOMPARE(innerRect->x(), qreal(-105)); + QCOMPARE(innerRect->y(), qreal(-105)); + } } void tst_qdeclarativestates::parentChangeErrors() |