diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-05-07 23:41:10 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-05-07 23:41:10 (GMT) |
commit | f3164b608e83a3e2c54643aea984095edc275346 (patch) | |
tree | 14b532e90e2a15b8d2ac5d46738971b0bedc561e /tests/benchmarks | |
parent | b7ac7f5b4d4c8e08b4ded43c9720c712a3663810 (diff) | |
parent | 90057dabcb99759bcb42c1c21db7151c69d98706 (diff) | |
download | Qt-f3164b608e83a3e2c54643aea984095edc275346.zip Qt-f3164b608e83a3e2c54643aea984095edc275346.tar.gz Qt-f3164b608e83a3e2c54643aea984095edc275346.tar.bz2 |
Merge branch 'kinetic-animations' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
Conflicts:
src/corelib/animation/qabstractanimation.cpp
src/corelib/animation/qabstractanimation_p.h
src/corelib/animation/qpropertyanimation.cpp
Diffstat (limited to 'tests/benchmarks')
-rw-r--r-- | tests/benchmarks/qanimation/main.cpp | 57 | ||||
-rw-r--r-- | tests/benchmarks/qanimation/rectanimation.cpp | 28 | ||||
-rw-r--r-- | tests/benchmarks/qanimation/rectanimation.h | 10 |
3 files changed, 36 insertions, 59 deletions
diff --git a/tests/benchmarks/qanimation/main.cpp b/tests/benchmarks/qanimation/main.cpp index 7bbcffb..7bb770f 100644 --- a/tests/benchmarks/qanimation/main.cpp +++ b/tests/benchmarks/qanimation/main.cpp @@ -11,8 +11,6 @@ class tst_qanimation : public QObject { Q_OBJECT private slots: - void itemAnimation(); - void itemAnimation_data() { data();} void itemPropertyAnimation(); void itemPropertyAnimation_data() { data();} void dummyAnimation(); @@ -32,35 +30,14 @@ private: void tst_qanimation::data() { - QTest::addColumn<bool>("paused"); + QTest::addColumn<bool>("started"); QTest::newRow("NotRunning") << false; - QTest::newRow("Paused") << true; -} - -void tst_qanimation::itemAnimation() -{ - QFETCH(bool, paused); - QGraphicsWidget item; - - //first the item animation - { - QItemAnimation anim(&item, QItemAnimation::Position); - anim.setDuration(ITERATION_COUNT); - anim.setStartValue(QPointF(0,0)); - anim.setEndValue(QPointF(ITERATION_COUNT,ITERATION_COUNT)); - if (paused) - anim.pause(); - QBENCHMARK { - for(int i = 0; i < anim.duration(); ++i) { - anim.setCurrentTime(i); - } - } - } + QTest::newRow("Running") << true; } void tst_qanimation::itemPropertyAnimation() { - QFETCH(bool, paused); + QFETCH(bool, started); QGraphicsWidget item; //then the property animation @@ -69,8 +46,8 @@ void tst_qanimation::itemPropertyAnimation() anim.setDuration(ITERATION_COUNT); anim.setStartValue(QPointF(0,0)); anim.setEndValue(QPointF(ITERATION_COUNT,ITERATION_COUNT)); - if (paused) - anim.pause(); + if (started) + anim.start(); QBENCHMARK { for(int i = 0; i < ITERATION_COUNT; ++i) { anim.setCurrentTime(i); @@ -82,7 +59,7 @@ void tst_qanimation::itemPropertyAnimation() void tst_qanimation::dummyAnimation() { - QFETCH(bool, paused); + QFETCH(bool, started); DummyObject dummy; //first the dummy animation @@ -91,8 +68,8 @@ void tst_qanimation::dummyAnimation() anim.setDuration(ITERATION_COUNT); anim.setStartValue(QRect(0, 0, 0, 0)); anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); - if (paused) - anim.pause(); + if (started) + anim.start(); QBENCHMARK { for(int i = 0; i < anim.duration(); ++i) { anim.setCurrentTime(i); @@ -103,7 +80,7 @@ void tst_qanimation::dummyAnimation() void tst_qanimation::dummyPropertyAnimation() { - QFETCH(bool, paused); + QFETCH(bool, started); DummyObject dummy; //then the property animation @@ -112,8 +89,8 @@ void tst_qanimation::dummyPropertyAnimation() anim.setDuration(ITERATION_COUNT); anim.setStartValue(QRect(0, 0, 0, 0)); anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); - if (paused) - anim.pause(); + if (started) + anim.start(); QBENCHMARK { for(int i = 0; i < ITERATION_COUNT; ++i) { anim.setCurrentTime(i); @@ -125,7 +102,7 @@ void tst_qanimation::dummyPropertyAnimation() void tst_qanimation::rectAnimation() { //this is the simplest animation you can do - QFETCH(bool, paused); + QFETCH(bool, started); DummyObject dummy; //then the property animation @@ -134,8 +111,8 @@ void tst_qanimation::rectAnimation() anim.setDuration(ITERATION_COUNT); anim.setStartValue(QRect(0, 0, 0, 0)); anim.setEndValue(QRect(0, 0, ITERATION_COUNT,ITERATION_COUNT)); - if (paused) - anim.pause(); + if (started) + anim.start(); QBENCHMARK { for(int i = 0; i < ITERATION_COUNT; ++i) { anim.setCurrentTime(i); @@ -147,7 +124,7 @@ void tst_qanimation::rectAnimation() void tst_qanimation::floatAnimation() { //this is the simplest animation you can do - QFETCH(bool, paused); + QFETCH(bool, started); DummyObject dummy; //then the property animation @@ -156,8 +133,8 @@ void tst_qanimation::floatAnimation() anim.setDuration(ITERATION_COUNT); anim.setStartValue(0.f); anim.setEndValue(1.f); - if (paused) - anim.pause(); + if (started) + anim.start(); QBENCHMARK { for(int i = 0; i < ITERATION_COUNT; ++i) { anim.setCurrentTime(i); diff --git a/tests/benchmarks/qanimation/rectanimation.cpp b/tests/benchmarks/qanimation/rectanimation.cpp index 66c7a33..d60a943 100644 --- a/tests/benchmarks/qanimation/rectanimation.cpp +++ b/tests/benchmarks/qanimation/rectanimation.cpp @@ -7,49 +7,49 @@ static inline int interpolateInteger(int from, int to, qreal progress) } -RectAnimation::RectAnimation(DummyObject *obj) : object(obj), dura(250) +RectAnimation::RectAnimation(DummyObject *obj) : m_object(obj), m_dura(250) { } void RectAnimation::setEndValue(const QRect &rect) { - end = rect; + m_end = rect; } void RectAnimation::setStartValue(const QRect &rect) { - start = rect; + m_start = rect; } void RectAnimation::setDuration(int d) { - dura = d; + m_dura = d; } int RectAnimation::duration() const { - return dura; + return m_dura; } void RectAnimation::updateCurrentTime(int msecs) { - qreal progress = easing.valueForProgress( qreal(msecs) / qreal(dura) ); + qreal progress = m_easing.valueForProgress( qreal(msecs) / qreal(m_dura) ); QRect now; - now.setCoords(interpolateInteger(start.left(), end.left(), progress), - interpolateInteger(start.top(), end.top(), progress), - interpolateInteger(start.right(), end.right(), progress), - interpolateInteger(start.bottom(), end.bottom(), progress)); + now.setCoords(interpolateInteger(m_start.left(), m_end.left(), progress), + interpolateInteger(m_start.top(), m_end.top(), progress), + interpolateInteger(m_start.right(), m_end.right(), progress), + interpolateInteger(m_start.bottom(), m_end.bottom(), progress)); - bool changed = (now != current); + bool changed = (now != m_current); if (changed) - current = now; + m_current = now; if (state() == Stopped) return; - if (object) - object->setRect(current); + if (m_object) + m_object->setRect(m_current); } void RectAnimation::updateState(QAbstractAnimation::State state) diff --git a/tests/benchmarks/qanimation/rectanimation.h b/tests/benchmarks/qanimation/rectanimation.h index c9770c4..99b82b4 100644 --- a/tests/benchmarks/qanimation/rectanimation.h +++ b/tests/benchmarks/qanimation/rectanimation.h @@ -21,10 +21,10 @@ public: virtual void updateState(QAbstractAnimation::State state); private: - DummyObject *object; - QEasingCurve easing; - QRect start, end, current; - int dura; + DummyObject *m_object; + QEasingCurve m_easing; + QRect m_start, m_end, m_current; + int m_dura; }; -#endif
\ No newline at end of file +#endif |