diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2011-09-30 09:04:11 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-09-30 10:37:05 +0200 |
commit | f32a83bfcf5a667a81fdd2020f119cdeec79a9f1 (patch) | |
tree | 8fd1c7e520743db050ff2369c0fdab1bbcbf6786 /tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp | |
parent | 3fff5e654e1b39844deae43cf5b211c2f196227f (diff) |
Fix issue with interpolating more than one path segment backwards.
Change-Id: I463010ed63d41be80db96e8306aef8caa3863ccf
Reviewed-on: http://codereview.qt-project.org/5821
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Martin Jones <martin.jones@nokia.com>
Diffstat (limited to 'tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp')
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp index 303268eba6..652e357d5c 100644 --- a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -75,6 +75,7 @@ private slots: void simpleRotation(); void simplePath(); void pathInterpolator(); + void pathInterpolatorBackwardJump(); void pathWithNoStart(); void alwaysRunToEnd(); void complete(); @@ -316,6 +317,38 @@ void tst_qdeclarativeanimations::pathInterpolator() QCOMPARE(interpolator->angle(), qreal(0)); } +void tst_qdeclarativeanimations::pathInterpolatorBackwardJump() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathInterpolatorBack.qml")); + QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create()); + QVERIFY(interpolator); + + QCOMPARE(interpolator->progress(), qreal(0)); + QCOMPARE(interpolator->x(), qreal(50)); + QCOMPARE(interpolator->y(), qreal(50)); + QCOMPARE(interpolator->angle(), qreal(270)); + + interpolator->setProgress(.5); + QCOMPARE(interpolator->progress(), qreal(.5)); + QCOMPARE(interpolator->x(), qreal(100)); + QCOMPARE(interpolator->y(), qreal(75)); + QCOMPARE(interpolator->angle(), qreal(90)); + + interpolator->setProgress(1); + QCOMPARE(interpolator->progress(), qreal(1)); + QCOMPARE(interpolator->x(), qreal(200)); + QCOMPARE(interpolator->y(), qreal(50)); + QCOMPARE(interpolator->angle(), qreal(0)); + + //make sure we don't get caught in infinite loop here + interpolator->setProgress(0); + QCOMPARE(interpolator->progress(), qreal(0)); + QCOMPARE(interpolator->x(), qreal(50)); + QCOMPARE(interpolator->y(), qreal(50)); + QCOMPARE(interpolator->angle(), qreal(270)); +} + void tst_qdeclarativeanimations::pathWithNoStart() { QDeclarativeEngine engine; |