diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-07 09:18:11 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-06-07 09:18:11 (GMT) |
commit | 6bf28141cc8679bf56a8da4183e9862115ef56f7 (patch) | |
tree | f6604bb555842ccb69aa9fa23303297e3e5a63d6 /tests/auto/declarative/qdeclarativestates | |
parent | d3527d779b784ad89285bcb8790504354d9dd3ae (diff) | |
parent | d660ea1a68d282763e8f574f066d2ef958cd3c1b (diff) | |
download | Qt-6bf28141cc8679bf56a8da4183e9862115ef56f7.zip Qt-6bf28141cc8679bf56a8da4183e9862115ef56f7.tar.gz Qt-6bf28141cc8679bf56a8da4183e9862115ef56f7.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Accept enter key in the webbrower demo url input.
Keep reported point/pixel size in sync.
Remove unnecessary CloseSoftwareInputPanel events after TextEdit or TextInput has lost focus
Ensure state operations assigned to the default state are triggered
Add image example.
Fix regression in input panel autotests
Improve docs about Qml component case sensitivity.
Add some performance tips to QML docs.
Move QListModelInterface into util.
Ensure ParticleMotionGravity always pulls in the right direction.
Remove version ifdefs from Particles; only 4.7 is supported.
Update docs for the runtime.orientation values
Revert to Portrait/Landscape terminology for Orientation enum, with
Add more Q_AUTOTEST_EXPORTs
Improve input panel handling in declarative demos and examples
Always integer align anchor center points
Add header and footer to GridView
Diffstat (limited to 'tests/auto/declarative/qdeclarativestates')
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/returnToBase.qml | 21 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 21 |
2 files changed, 42 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml b/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml new file mode 100644 index 0000000..e342331 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/returnToBase.qml @@ -0,0 +1,21 @@ +import Qt 4.7 + +Rectangle { + id: theRect + property bool triggerState: false + property string stateString: "" + states: [ State { + when: triggerState + PropertyChanges { + target: theRect + stateString: "inState" + } + }, + State { + name: "" + PropertyChanges { + target: theRect + stateString: "originalState" + } + }] +} 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" |