From 0bf62c44ab5bc53162ef0d7efea38764e2df8318 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 28 Feb 2012 09:48:27 +1000 Subject: [PATCH] Correctly set duration and easing for AnchorAnimation. Task-number: QTBUG-24532 Change-Id: I3aad9cd8281b954896c2c1d44b2dcae68f913928 Reviewed-by: Yunqiao Yin --- src/quick/items/qquickanimation.cpp | 2 ++ .../qdeclarativeanimations/tst_qdeclarativeanimations.cpp | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/quick/items/qquickanimation.cpp b/src/quick/items/qquickanimation.cpp index 4880190..641fbb2 100644 --- a/src/quick/items/qquickanimation.cpp +++ b/src/quick/items/qquickanimation.cpp @@ -551,6 +551,8 @@ QAbstractAnimationJob* QQuickAnchorAnimation::transition(QDeclarativeStateAction delete data; } + animator->setDuration(d->duration); + animator->setEasingCurve(d->easing); return initInstance(animator); } diff --git a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index c7a0717..348586c 100644 --- a/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/qtquick2/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -105,6 +106,7 @@ private slots: void pauseBindingBug(); void pauseBug(); void loopingBug(); + void anchorBug(); }; #define QTIMED_COMPARE(lhs, rhs) do { \ @@ -1314,6 +1316,19 @@ void tst_qdeclarativeanimations::loopingBug() delete obj; } +//QTBUG-24532 +void tst_qdeclarativeanimations::anchorBug() +{ + QQuickAnchorAnimation animation; + animation.setDuration(5000); + animation.setEasing(QEasingCurve(QEasingCurve::InOutBack)); + animation.start(); + animation.pause(); + + QCOMPARE(animation.qtAnimation()->duration(), 5000); + QCOMPARE(static_cast(animation.qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutBack)); +} + QTEST_MAIN(tst_qdeclarativeanimations) #include "tst_qdeclarativeanimations.moc" -- 2.7.4