diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-11-19 02:41:19 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-11-19 02:41:19 (GMT) |
commit | 8ca9ca77884229b04f3b48bb7fe085e56e3a9023 (patch) | |
tree | 31259940ee2ae678ec224854280b980a1a5cfe4e /tests/auto | |
parent | 6366969eaac962338424c49619a8664b03428985 (diff) | |
download | Qt-8ca9ca77884229b04f3b48bb7fe085e56e3a9023.zip Qt-8ca9ca77884229b04f3b48bb7fe085e56e3a9023.tar.gz Qt-8ca9ca77884229b04f3b48bb7fe085e56e3a9023.tar.bz2 |
Make sure we restore the base state correctly after the base state changes.
This worked correctly as long as there was a transition between the
states. Now it works correctly with no transition as well.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/declarative/states/tst_states.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index 92d278a..a4da1f1 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -68,6 +68,7 @@ private slots: void restoreEntryValues(); void explicitChanges(); void propertyErrors(); + void incorrectRestoreBug(); }; void tst_states::basicChanges() @@ -711,6 +712,32 @@ void tst_states::propertyErrors() rect->setState("blue"); } +void tst_states::incorrectRestoreBug() +{ + QmlEngine engine; + + QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); + QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + // make sure if we change the base state value, we then restore to it correctly + rect->setColor(QColor("green")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("green")); +} + QTEST_MAIN(tst_states) #include "tst_states.moc" |