diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/quick/qquickstates/data/removeBindingWithTransition.qml | 23 | ||||
-rw-r--r-- | tests/auto/quick/qquickstates/tst_qquickstates.cpp | 21 |
2 files changed, 44 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickstates/data/removeBindingWithTransition.qml b/tests/auto/quick/qquickstates/data/removeBindingWithTransition.qml new file mode 100644 index 0000000000..ed40e18374 --- /dev/null +++ b/tests/auto/quick/qquickstates/data/removeBindingWithTransition.qml @@ -0,0 +1,23 @@ +import QtQuick + +Item { + id: root + property bool toggle: true + property int state1Width: 500 + + states: [ + State { + when: root.toggle + PropertyChanges { root.width: root.state1Width } + }, + State { + when: !root.toggle + PropertyChanges { root.width: 300 } + } + ] + + transitions: Transition { + id: transition + SmoothedAnimation { target: root; property: "width"; velocity: 200 } + } +} diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index d6814bd057..35d6deee58 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -207,6 +207,7 @@ private slots: void parentChangeInvolvingBindings(); void deferredProperties(); void rewindAnchorChange(); + void bindingProperlyRemovedWithTransition(); }; void tst_qquickstates::initTestCase() @@ -1978,6 +1979,26 @@ void tst_qquickstates::rewindAnchorChange() QTRY_COMPARE(innerRect->height(), 200); } +void tst_qquickstates::bindingProperlyRemovedWithTransition() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("removeBindingWithTransition.qml")); + QVERIFY2(c.isReady(), qPrintable(c.errorString())); + QScopedPointer<QObject> root(c.create()); + QVERIFY(root); + QQuickItem *item = qobject_cast<QQuickItem *>(root.get()); + QVERIFY(item); + + item->setProperty("toggle", false); + QTRY_COMPARE(item->width(), 300); + + item->setProperty("state1Width", 100); + QCOMPARE(item->width(), 300); + + item->setProperty("toggle", true); + QTRY_COMPARE(item->width(), 100); +} + QTEST_MAIN(tst_qquickstates) #include "tst_qquickstates.moc" |