From b12285bc3d49b0d17751ebaf0853f3642b4b8b29 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Sun, 6 Apr 2014 22:42:29 -0500 Subject: Verify empty SmoothedAnimation doesn't keep animation system running. Change-Id: I8f8a9d31241e1bff9e72524b69d625258885558a Reviewed-by: Robin Burchell --- .../tst_qquicksmoothedanimation.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests/auto/quick/qquicksmoothedanimation') diff --git a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp index 650ce09dfa..7642583bb1 100644 --- a/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp +++ b/tests/auto/quick/qquicksmoothedanimation/tst_qquicksmoothedanimation.cpp @@ -61,6 +61,7 @@ private slots: void behavior(); void deleteOnUpdate(); void zeroDuration(); + void noStart(); private: QQmlEngine engine; @@ -263,6 +264,27 @@ void tst_qquicksmoothedanimation::zeroDuration() delete rect; } +//verify that an empty SmoothedAnimation does not fire up the animation system +//and keep it running forever +void tst_qquicksmoothedanimation::noStart() +{ + QQmlEngine engine; + QQmlComponent c(&engine, testFileUrl("smoothedanimation1.qml")); + QQuickSmoothedAnimation *obj = qobject_cast(c.create()); + + QVERIFY(obj != 0); + + obj->start(); + QCOMPARE(obj->isRunning(), false); + QTest::qWait(100); + QCOMPARE(obj->isRunning(), false); + //this could fail if the test is being run in parallel with other tests + //or if an earlier test failed and didn't clean up (left an animation running) + //QCOMPARE(QUnifiedTimer::instance()->runningAnimationCount(), 0); + + delete obj; +} + QTEST_MAIN(tst_qquicksmoothedanimation) #include "tst_qquicksmoothedanimation.moc" -- cgit v1.2.3