summaryrefslogtreecommitdiffstats
path: root/tests/auto/qpropertyanimation
diff options
context:
space:
mode:
authorLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-05-15 12:40:00 +0200
committerLeonardo Sobral Cunha <leo.cunha@nokia.com>2009-05-15 13:59:59 +0200
commit4f07fd724a7cc763d57f4b2e23d407b820bb8880 (patch)
tree5378ab131f7438104058a92a97826b683111645b /tests/auto/qpropertyanimation
parent9227f6249de0e60a2a428549848c875c01dbf4d2 (diff)
Update current value on QVariantAnimation::setKeyValues
The current value was udpated on setKeyValueAt, but not on setKeyValues and this was leading to a semantic inconsistency. Reviewed-by: janarve
Diffstat (limited to 'tests/auto/qpropertyanimation')
-rw-r--r--tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
index c753477c80..7e910d4b8f 100644
--- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
+++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp
@@ -42,6 +42,7 @@
#include <QtTest/QtTest>
#include <QtCore/qpropertyanimation.h>
+#include <QtCore/qvariantanimation.h>
#include <QtGui/qwidget.h>
//TESTED_CLASS=QPropertyAnimation
@@ -96,6 +97,7 @@ private slots:
void operationsInStates_data();
void operationsInStates();
void oneKeyValue();
+ void updateOnSetKeyValues();
};
tst_QPropertyAnimation::tst_QPropertyAnimation()
@@ -881,5 +883,37 @@ void tst_QPropertyAnimation::oneKeyValue()
QCOMPARE(o.property("ole").toInt(), 42);
}
+void tst_QPropertyAnimation::updateOnSetKeyValues()
+{
+ QObject o;
+ o.setProperty("ole", 100);
+ QCOMPARE(o.property("ole").toInt(), 100);
+
+ QPropertyAnimation animation(&o, "ole");
+ animation.setStartValue(100);
+ animation.setEndValue(200);
+ animation.setDuration(100);
+
+ animation.setCurrentTime(50);
+ QCOMPARE(animation.currentValue().toInt(), 150);
+ animation.setKeyValueAt(0.0, 300);
+ QCOMPARE(animation.currentValue().toInt(), 250);
+
+ o.setProperty("ole", 100);
+ QPropertyAnimation animation2(&o, "ole");
+ QVariantAnimation::KeyValues kValues;
+ kValues << QVariantAnimation::KeyValue(0.0, 100) << QVariantAnimation::KeyValue(1.0, 200);
+ animation2.setKeyValues(kValues);
+ animation2.setDuration(100);
+ animation2.setCurrentTime(50);
+ QCOMPARE(animation2.currentValue().toInt(), 150);
+
+ kValues.clear();
+ kValues << QVariantAnimation::KeyValue(0.0, 300) << QVariantAnimation::KeyValue(1.0, 200);
+ animation2.setKeyValues(kValues);
+
+ QCOMPARE(animation2.currentValue().toInt(), animation.currentValue().toInt());
+}
+
QTEST_MAIN(tst_QPropertyAnimation)
#include "tst_qpropertyanimation.moc"