diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-12 01:13:55 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-01-12 01:13:55 (GMT) |
commit | 20098f931b6c19f6caf1fc1fc23297d14cb9e707 (patch) | |
tree | 50585cdf7c550708f4e134b42a3af4ed0bc588d6 /tests/auto/declarative/states | |
parent | c0c2352a287348469617811985d773ec4c3d1875 (diff) | |
download | Qt-20098f931b6c19f6caf1fc1fc23297d14cb9e707.zip Qt-20098f931b6c19f6caf1fc1fc23297d14cb9e707.tar.gz Qt-20098f931b6c19f6caf1fc1fc23297d14cb9e707.tar.bz2 |
Don't double enter states at startup.
QT-2697
Diffstat (limited to 'tests/auto/declarative/states')
-rw-r--r-- | tests/auto/declarative/states/data/autoStateAtStartupRestoreBug.qml | 18 | ||||
-rw-r--r-- | tests/auto/declarative/states/tst_states.cpp | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/declarative/states/data/autoStateAtStartupRestoreBug.qml b/tests/auto/declarative/states/data/autoStateAtStartupRestoreBug.qml new file mode 100644 index 0000000..693a5c5 --- /dev/null +++ b/tests/auto/declarative/states/data/autoStateAtStartupRestoreBug.qml @@ -0,0 +1,18 @@ +import Qt 4.6 + +Item { + id: root + property int input: 1 + property int test: 9 + + states: [ + State { + name: "portrait" + when: root.input == 1 + PropertyChanges { + target: root + test: 3 + } + } + ] +} diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp index 9d9cf07..3301048 100644 --- a/tests/auto/declarative/states/tst_states.cpp +++ b/tests/auto/declarative/states/tst_states.cpp @@ -70,6 +70,7 @@ private slots: void explicitChanges(); void propertyErrors(); void incorrectRestoreBug(); + void autoStateAtStartupRestoreBug(); void deletingChange(); void deletingState(); void tempState(); @@ -743,6 +744,23 @@ void tst_states::incorrectRestoreBug() QCOMPARE(rect->color(),QColor("green")); } +void tst_states::autoStateAtStartupRestoreBug() +{ + QmlEngine engine; + + QmlComponent component(&engine, SRCDIR "/data/autoStateAtStartupRestoreBug.qml"); + QObject *obj = component.create(); + + QVERIFY(obj != 0); + QCOMPARE(obj->property("test").toInt(), 3); + + obj->setProperty("input", 2); + + QCOMPARE(obj->property("test").toInt(), 9); + + delete obj; +} + void tst_states::deletingChange() { QmlEngine engine; |