diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2010-06-07 04:44:06 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2010-06-07 04:45:35 (GMT) |
commit | 0619c12bfee40826034dbc31f9d398182a3aa49f (patch) | |
tree | 8a57c54a654b9fa48852ba2ec11cf1f275cd2814 /tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | |
parent | ed5f6c87e783960f880d56f58149985366d34615 (diff) | |
download | Qt-0619c12bfee40826034dbc31f9d398182a3aa49f.zip Qt-0619c12bfee40826034dbc31f9d398182a3aa49f.tar.gz Qt-0619c12bfee40826034dbc31f9d398182a3aa49f.tar.bz2 |
Ensure state operations assigned to the default state are triggered
when returning to that state.
Task-number: QTBUG-11228
Diffstat (limited to 'tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp index ea074a4..055a34c 100644 --- a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -112,6 +112,7 @@ private slots: void whenOrdering(); void urlResolution(); void unnamedWhen(); + void returnToBase(); }; void tst_qdeclarativestates::initTestCase() @@ -1085,6 +1086,26 @@ void tst_qdeclarativestates::unnamedWhen() QCOMPARE(rect->property("stateString").toString(), QLatin1String("")); } +void tst_qdeclarativestates::returnToBase() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/returnToBase.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + + QCOMPARE(rectPrivate->state(), QLatin1String("")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("")); + rect->setProperty("triggerState", true); + QCOMPARE(rectPrivate->state(), QLatin1String("anonymousState1")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("inState")); + rect->setProperty("triggerState", false); + QCOMPARE(rectPrivate->state(), QLatin1String("")); + QCOMPARE(rect->property("stateString").toString(), QLatin1String("originalState")); +} + + QTEST_MAIN(tst_qdeclarativestates) #include "tst_qdeclarativestates.moc" |