aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
diff options
context:
space:
mode:
authorCharles Yin <charles.yin@nokia.com>2012-03-22 14:07:28 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-23 05:19:35 +0100
commitb63ce68f316c91b0a3107d3d20e160628f5cefef (patch)
tree89aaa6345d595097a4975e4455a7dd65e02ed1be /tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
parentc913351c9d6e3181cdddcc851e9d80cd7689fe93 (diff)
Fix crash issue for path animation and path interpulator
When set progress value out of [0,1], path animation and path interpulator should make sure the value be modified in the valid value range, otherwise the QQuickPath::backwardsPointAt() will crash. Task-number: QTBUG-24308 Change-Id: Icd6e9165c9f844ddb8ec84c229eac4db5246a749 Reviewed-by: Michael Brasser <michael.brasser@nokia.com>
Diffstat (limited to 'tests/auto/quick/qquickanimations/tst_qquickanimations.cpp')
-rw-r--r--tests/auto/quick/qquickanimations/tst_qquickanimations.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
index d71100d120..166f4b8276 100644
--- a/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
+++ b/tests/auto/quick/qquickanimations/tst_qquickanimations.cpp
@@ -107,6 +107,7 @@ private slots:
void pauseBug();
void loopingBug();
void anchorBug();
+ void pathAnimationInOutBackBug();
};
#define QTIMED_COMPARE(lhs, rhs) do { \
@@ -455,6 +456,13 @@ void tst_qquickanimations::pathInterpolator()
QCOMPARE(interpolator->x(), qreal(300));
QCOMPARE(interpolator->y(), qreal(300));
QCOMPARE(interpolator->angle(), qreal(0));
+
+ //for path interpulator the progress value must be [0,1] range.
+ interpolator->setProgress(1.1);
+ QCOMPARE(interpolator->progress(), qreal(1));
+
+ interpolator->setProgress(-0.000123);
+ QCOMPARE(interpolator->progress(), qreal(0));
}
void tst_qquickanimations::pathInterpolatorBackwardJump()
@@ -1171,6 +1179,22 @@ void tst_qquickanimations::runningTrueBug()
QVERIFY(cloud->x() > qreal(0));
}
+//QTBUG-24308
+void tst_qquickanimations::pathAnimationInOutBackBug()
+{
+ //ensure we don't pass bad progress value (out of [0,1]) to QQuickPath::backwardsPointAt()
+ QQmlEngine engine;
+ QQmlComponent c(&engine, testFileUrl("pathAnimationInOutBackCrash.qml"));
+ QQuickItem *item = qobject_cast<QQuickItem*>(c.create());
+ QVERIFY(item);
+
+ QQuickRectangle *rect = item->findChild<QQuickRectangle *>("rect");
+ QVERIFY(rect);
+ QTest::qWait(1000);
+ QCOMPARE(rect->x(), qreal(0));
+ QCOMPARE(rect->y(), qreal(0));
+}
+
//QTBUG-12805
void tst_qquickanimations::nonTransitionBug()
{