diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-11-14 13:40:03 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-16 03:29:39 +0100 |
commit | aa599dc4ec09645062b2671ac0482ca051a8a949 (patch) | |
tree | a42389472cf82aa11ba941fb534fb2a1988f6024 /tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | |
parent | 91b44d3e3a1966f2e5117942557139ac08692885 (diff) |
Remove events from the revert list.
State change "events" should be removed from the revert
list the same way property changes are.
Task-number: QTBUG-22583
Change-Id: Ia3f4d16ee8855d163a7f6118a0bc1f8492727940
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index 5c9760aba3..efac99c54c 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -146,6 +146,7 @@ private slots: void editProperties(); void QTBUG_14830(); void avoidFastForward(); + void revertListBug(); }; void tst_qdeclarativestates::initTestCase() @@ -1545,6 +1546,48 @@ void tst_qdeclarativestates::avoidFastForward() QCOMPARE(rect->property("updateCount").toInt(), 1); } +//QTBUG-22583 +void tst_qdeclarativestates::revertListBug() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, TESTDATA("revertListBug.qml")); + QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create()); + QVERIFY(rect != 0); + + QQuickRectangle *rect1 = rect->findChild<QQuickRectangle*>("rect1"); + QQuickRectangle *rect2 = rect->findChild<QQuickRectangle*>("rect2"); + QQuickItem *origParent1 = rect->findChild<QQuickItem*>("originalParent1"); + QQuickItem *origParent2 = rect->findChild<QQuickItem*>("originalParent2"); + QQuickItem *newParent = rect->findChild<QQuickItem*>("newParent"); + + QCOMPARE(rect1->parentItem(), origParent1); + QCOMPARE(rect2->parentItem(), origParent2); + + QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect); + rectPrivate->setState("reparented"); + + QCOMPARE(rect1->parentItem(), newParent); + QCOMPARE(rect2->parentItem(), origParent2); + + rectPrivate->setState(""); + + QCOMPARE(rect1->parentItem(), origParent1); + QCOMPARE(rect2->parentItem(), origParent2); + + QMetaObject::invokeMethod(rect, "switchTargetItem"); + + rectPrivate->setState("reparented"); + + QCOMPARE(rect1->parentItem(), origParent1); + QCOMPARE(rect2->parentItem(), newParent); + + rectPrivate->setState(""); + + QCOMPARE(rect1->parentItem(), origParent1); + QCOMPARE(rect2->parentItem(), origParent2); //QTBUG-22583 causes rect2's parent item to be origParent1 +} + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" |