summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-08-13 03:38:22 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-08-13 03:38:22 (GMT)
commit7a2d6086b41aa4877f253dff4d412028506ae38e (patch)
treec140c160219095f6fc7bc9c0ba697d17653d62e7
parentee62807198a2525577c14f718b98d07ae0ec7bec (diff)
parentf9fe93e6e85294274d4e0ce81db09783cfacd733 (diff)
downloadQt-7a2d6086b41aa4877f253dff4d412028506ae38e.zip
Qt-7a2d6086b41aa4877f253dff4d412028506ae38e.tar.gz
Qt-7a2d6086b41aa4877f253dff4d412028506ae38e.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: Clear previous animation data for non-triggering animations. Fix configure -help output. declarative module is built by default.
-rwxr-xr-xconfigure4
-rw-r--r--src/declarative/util/qdeclarativeanimation.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/data/nonTransitionBug.qml30
-rw-r--r--tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp31
4 files changed, 65 insertions, 2 deletions
diff --git a/configure b/configure
index 35fe2eb..7c3f9a3 100755
--- a/configure
+++ b/configure
@@ -3677,8 +3677,8 @@ fi
-no-scripttools .... Do not build the QtScriptTools module.
+ -scripttools ....... Build the QtScriptTools module.
- + -no-declarative .....Do not build the declarative module.
- -declarative ....... Build the declarative module.
+ -no-declarative .....Do not build the declarative module.
+ + -declarative ....... Build the declarative module.
-platform target ... The operating system and compiler you are building
on ($PLATFORM).
diff --git a/src/declarative/util/qdeclarativeanimation.cpp b/src/declarative/util/qdeclarativeanimation.cpp
index a747706..2fca09d 100644
--- a/src/declarative/util/qdeclarativeanimation.cpp
+++ b/src/declarative/util/qdeclarativeanimation.cpp
@@ -2392,6 +2392,8 @@ void QDeclarativePropertyAnimation::transition(QDeclarativeStateActions &actions
d->actions = &data->actions;
} else {
delete data;
+ d->va->setFromSourcedValue(0); //clear previous data
+ d->va->setAnimValue(0, QAbstractAnimation::DeleteWhenStopped); //clear previous data
d->actions = 0;
}
}
diff --git a/tests/auto/declarative/qdeclarativeanimations/data/nonTransitionBug.qml b/tests/auto/declarative/qdeclarativeanimations/data/nonTransitionBug.qml
new file mode 100644
index 0000000..e9dc36e
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativeanimations/data/nonTransitionBug.qml
@@ -0,0 +1,30 @@
+import Qt 4.7
+
+Rectangle {
+ id: root
+ width: 200
+ height: 200
+
+ Rectangle {
+ id: mover
+ objectName: "mover"
+ }
+
+ states: [
+ State {
+ name: "free"
+ },
+ State {
+ name: "left"
+ PropertyChanges {
+ restoreEntryValues: false
+ target: mover
+ x: 0
+ }
+ }
+ ]
+
+ transitions: Transition {
+ PropertyAnimation { properties: "x"; duration: 50 }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
index ec867fe..e5943fb 100644
--- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
+++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp
@@ -48,6 +48,8 @@
#include <QVariantAnimation>
#include <QEasingCurve>
+#include "../../../shared/util.h"
+
#ifdef Q_OS_SYMBIAN
// In Symbian OS test data is located in applications private dir
#define SRCDIR "."
@@ -82,6 +84,7 @@ private slots:
void easingProperties();
void rotation();
void runningTrueBug();
+ void nonTransitionBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -762,6 +765,34 @@ void tst_qdeclarativeanimations::runningTrueBug()
QVERIFY(cloud->x() > qreal(0));
}
+//QTBUG-12805
+void tst_qdeclarativeanimations::nonTransitionBug()
+{
+ //tests that the animation values from the previous transition are properly cleared
+ //in the case where an animation in the transition doesn't match anything (but previously did)
+ QDeclarativeEngine engine;
+
+ QDeclarativeComponent c(&engine, SRCDIR "/data/nonTransitionBug.qml");
+ QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create());
+ QVERIFY(rect != 0);
+ QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect);
+ QDeclarativeRectangle *mover = rect->findChild<QDeclarativeRectangle*>("mover");
+
+ mover->setX(100);
+ QCOMPARE(mover->x(), qreal(100));
+
+ rectPrivate->setState("left");
+ QTRY_COMPARE(mover->x(), qreal(0));
+
+ mover->setX(100);
+ QCOMPARE(mover->x(), qreal(100));
+
+ //make sure we don't try to animate back to 0
+ rectPrivate->setState("free");
+ QTest::qWait(300);
+ QCOMPARE(mover->x(), qreal(100));
+}
+
QTEST_MAIN(tst_qdeclarativeanimations)
#include "tst_qdeclarativeanimations.moc"