Remove "All rights reserved" line from license headers.
[profile/ivi/qtdeclarative.git] / tests / auto / qtquick2 / qdeclarativeanimations / tst_qdeclarativeanimations.cpp
index 2a2055e..1340b51 100644 (file)
@@ -1,8 +1,7 @@
 /****************************************************************************
 **
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/
 **
 ** This file is part of the test suite of the Qt Toolkit.
 **
@@ -35,6 +34,7 @@
 **
 **
 **
+**
 ** $QT_END_LICENSE$
 **
 ****************************************************************************/
 
 #include "../../shared/util.h"
 
-class tst_qdeclarativeanimations : public QObject
+class tst_qdeclarativeanimations : public QDeclarativeDataTest
 {
     Q_OBJECT
 public:
     tst_qdeclarativeanimations() {}
 
 private slots:
-    void initTestCase() { QDeclarativeEngine engine; } // ensure types are registered
+    void initTestCase()
+    {
+        QDeclarativeEngine engine;  // ensure types are registered
+        QDeclarativeDataTest::initTestCase();
+    }
 
     void simpleProperty();
     void simpleNumber();
@@ -181,6 +185,9 @@ void tst_qdeclarativeanimations::simpleColor()
     QVERIFY(animation.isPaused());
     animation.setCurrentTime(125);
     QVERIFY(animation.currentTime() == 125);
+#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__)
+    QEXPECT_FAIL("", "Fails on this platform - QTBUG-23385", Abort);
+#endif
     QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1));
 
     rect.setColor(QColor("green"));
@@ -223,7 +230,7 @@ void tst_qdeclarativeanimations::simplePath()
 {
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("pathAnimation.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -259,7 +266,7 @@ void tst_qdeclarativeanimations::simplePath()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation2.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("pathAnimation2.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -291,7 +298,7 @@ void tst_qdeclarativeanimations::simplePath()
 void tst_qdeclarativeanimations::pathInterpolator()
 {
     QDeclarativeEngine engine;
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathInterpolator.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("pathInterpolator.qml"));
     QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create());
     QVERIFY(interpolator);
 
@@ -304,7 +311,7 @@ void tst_qdeclarativeanimations::pathInterpolator()
     QCOMPARE(interpolator->progress(), qreal(.5));
     QCOMPARE(interpolator->x(), qreal(175));
     QCOMPARE(interpolator->y(), qreal(175));
-    QCOMPARE(interpolator->angle(), qreal(270));
+    QCOMPARE(interpolator->angle(), qreal(90));
 
     interpolator->setProgress(1);
     QCOMPARE(interpolator->progress(), qreal(1));
@@ -315,40 +322,67 @@ void tst_qdeclarativeanimations::pathInterpolator()
 
 void tst_qdeclarativeanimations::pathInterpolatorBackwardJump()
 {
-    QDeclarativeEngine engine;
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("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));
+    {
+        QDeclarativeEngine engine;
+        QDeclarativeComponent c(&engine, testFileUrl("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(90));
+
+        interpolator->setProgress(.5);
+        QCOMPARE(interpolator->progress(), qreal(.5));
+        QCOMPARE(interpolator->x(), qreal(100));
+        QCOMPARE(interpolator->y(), qreal(75));
+        QCOMPARE(interpolator->angle(), qreal(270));
+
+        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(90));
+    }
 
-    //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));
+    {
+        QDeclarativeEngine engine;
+        QDeclarativeComponent c(&engine, testFileUrl("pathInterpolatorBack2.qml"));
+        QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create());
+        QVERIFY(interpolator);
+
+        QCOMPARE(interpolator->progress(), qreal(0));
+        QCOMPARE(interpolator->x(), qreal(200));
+        QCOMPARE(interpolator->y(), qreal(280));
+        QCOMPARE(interpolator->angle(), qreal(180));
+
+        interpolator->setProgress(1);
+        QCOMPARE(interpolator->progress(), qreal(1));
+        QCOMPARE(interpolator->x(), qreal(0));
+        QCOMPARE(interpolator->y(), qreal(80));
+        QCOMPARE(interpolator->angle(), qreal(180));
+
+        //make sure we don't get caught in infinite loop here
+        interpolator->setProgress(0);
+        QCOMPARE(interpolator->progress(), qreal(0));
+        QCOMPARE(interpolator->x(), qreal(200));
+        QCOMPARE(interpolator->y(), qreal(280));
+        QCOMPARE(interpolator->angle(), qreal(180));
+    }
 }
 
 void tst_qdeclarativeanimations::pathWithNoStart()
 {
     QDeclarativeEngine engine;
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimationNoStart.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("pathAnimationNoStart.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect);
 
@@ -471,7 +505,7 @@ void tst_qdeclarativeanimations::badTypes()
     //don't crash
     {
         QQuickView *view = new QQuickView;
-        view->setSource(QUrl::fromLocalFile(TESTDATA("badtype1.qml")));
+        view->setSource(testFileUrl("badtype1.qml"));
 
         qApp->processEvents();
 
@@ -481,7 +515,7 @@ void tst_qdeclarativeanimations::badTypes()
     //make sure we get a compiler error
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype2.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("badtype2.qml"));
         QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
         c.create();
 
@@ -492,7 +526,7 @@ void tst_qdeclarativeanimations::badTypes()
     //make sure we get a compiler error
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype3.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("badtype3.qml"));
         QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
         c.create();
 
@@ -503,7 +537,7 @@ void tst_qdeclarativeanimations::badTypes()
     //don't crash
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype4.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("badtype4.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -521,14 +555,14 @@ void tst_qdeclarativeanimations::badProperties()
     {
         QDeclarativeEngine engine;
 
-        QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(TESTDATA("badproperty1.qml")));
-        QByteArray message = QUrl::fromLocalFile(TESTDATA("badproperty1.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\"";
+        QDeclarativeComponent c1(&engine, testFileUrl("badproperty1.qml"));
+        QByteArray message = testFileUrl("badproperty1.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\"";
         QTest::ignoreMessage(QtWarningMsg, message);
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c1.create());
         QVERIFY(rect);
 
-        QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(TESTDATA("badproperty2.qml")));
-        message = QUrl::fromLocalFile(TESTDATA("badproperty2.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\"";
+        QDeclarativeComponent c2(&engine, testFileUrl("badproperty2.qml"));
+        message = testFileUrl("badproperty2.qml").toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\"";
         QTest::ignoreMessage(QtWarningMsg, message);
         rect = qobject_cast<QQuickRectangle*>(c2.create());
         QVERIFY(rect);
@@ -545,7 +579,7 @@ void tst_qdeclarativeanimations::mixedTypes()
     //assumes border.width stays a real -- not real robust
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype1.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("mixedtype1.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -561,7 +595,7 @@ void tst_qdeclarativeanimations::mixedTypes()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype2.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("mixedtype2.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -572,6 +606,9 @@ void tst_qdeclarativeanimations::mixedTypes()
 
         //rather inexact -- is there a better way?
         QVERIFY(myRect->x() > 100 && myRect->x() < 200);
+#if defined(UBUNTU_ONEIRIC) && defined(__x86_64__)
+        QEXPECT_FAIL("", "Fails on this platform - QTBUG-23385", Continue);
+#endif
         QVERIFY(myRect->color() != QColor("red") && myRect->color() != QColor("blue"));
     }
 }
@@ -581,7 +618,7 @@ void tst_qdeclarativeanimations::properties()
     const int waitDuration = 300;
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("properties.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -593,7 +630,7 @@ void tst_qdeclarativeanimations::properties()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties2.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("properties2.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -605,7 +642,7 @@ void tst_qdeclarativeanimations::properties()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties3.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("properties3.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -617,7 +654,7 @@ void tst_qdeclarativeanimations::properties()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties4.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("properties4.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -630,7 +667,7 @@ void tst_qdeclarativeanimations::properties()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties5.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("properties5.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -647,7 +684,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
     const int waitDuration = 300;
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("propertiesTransition.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -660,7 +697,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition2.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("propertiesTransition2.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -675,7 +712,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition3.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("propertiesTransition3.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -688,7 +725,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition4.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("propertiesTransition4.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -702,7 +739,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition5.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("propertiesTransition5.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -716,7 +753,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
 
     /*{
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition6.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("propertiesTransition6.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -730,7 +767,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
 
     {
         QDeclarativeEngine engine;
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition7.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("propertiesTransition7.qml"));
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
 
@@ -746,7 +783,7 @@ void tst_qdeclarativeanimations::propertiesTransition()
 void tst_qdeclarativeanimations::pathTransition()
 {
     QDeclarativeEngine engine;
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathTransition.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("pathTransition.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect);
 
@@ -766,7 +803,7 @@ void tst_qdeclarativeanimations::pathTransition()
 void tst_qdeclarativeanimations::disabledTransition()
 {
     QDeclarativeEngine engine;
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("disabledTransition.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("disabledTransition.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect);
 
@@ -806,7 +843,7 @@ void tst_qdeclarativeanimations::attached()
 {
     QDeclarativeEngine engine;
 
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("attached.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("attached.qml"));
     QTest::ignoreMessage(QtDebugMsg, "off");
     QTest::ignoreMessage(QtDebugMsg, "on");
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
@@ -818,7 +855,7 @@ void tst_qdeclarativeanimations::propertyValueSourceDefaultStart()
     {
         QDeclarativeEngine engine;
 
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("valuesource.qml"));
 
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
@@ -831,7 +868,7 @@ void tst_qdeclarativeanimations::propertyValueSourceDefaultStart()
     {
         QDeclarativeEngine engine;
 
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource2.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("valuesource2.qml"));
 
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
@@ -844,7 +881,7 @@ void tst_qdeclarativeanimations::propertyValueSourceDefaultStart()
     {
         QDeclarativeEngine engine;
 
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontAutoStart.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("dontAutoStart.qml"));
 
         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
         QVERIFY(rect);
@@ -861,7 +898,7 @@ void tst_qdeclarativeanimations::dontStart()
     {
         QDeclarativeEngine engine;
 
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("dontStart.qml"));
 
         QString warning = c.url().toString() + ":14:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
         QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
@@ -876,7 +913,7 @@ void tst_qdeclarativeanimations::dontStart()
     {
         QDeclarativeEngine engine;
 
-        QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart2.qml")));
+        QDeclarativeComponent c(&engine, testFileUrl("dontStart2.qml"));
 
         QString warning = c.url().toString() + ":15:17: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
         QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
@@ -959,7 +996,7 @@ void tst_qdeclarativeanimations::easingProperties()
 void tst_qdeclarativeanimations::rotation()
 {
     QDeclarativeEngine engine;
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("rotation.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("rotation.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect);
 
@@ -990,7 +1027,7 @@ void tst_qdeclarativeanimations::runningTrueBug()
 {
     //ensure we start correctly when "running: true" is explicitly set
     QDeclarativeEngine engine;
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("runningTrueBug.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("runningTrueBug.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect);
 
@@ -1007,7 +1044,7 @@ void tst_qdeclarativeanimations::nonTransitionBug()
     //in the case where an animation in the transition doesn't match anything (but previously did)
     QDeclarativeEngine engine;
 
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("nonTransitionBug.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("nonTransitionBug.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect != 0);
     QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
@@ -1033,7 +1070,7 @@ void tst_qdeclarativeanimations::registrationBug()
 {
     QDeclarativeEngine engine;
 
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("registrationBug.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("registrationBug.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect != 0);
     QTRY_COMPARE(rect->property("value"), QVariant(int(100)));
@@ -1043,7 +1080,7 @@ void tst_qdeclarativeanimations::doubleRegistrationBug()
 {
     QDeclarativeEngine engine;
 
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("doubleRegistrationBug.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("doubleRegistrationBug.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect != 0);
 
@@ -1081,7 +1118,7 @@ void tst_qdeclarativeanimations::transitionAssignmentBug()
 {
     QDeclarativeEngine engine;
 
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("transitionAssignmentBug.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("transitionAssignmentBug.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect != 0);
 
@@ -1093,7 +1130,7 @@ void tst_qdeclarativeanimations::pauseBindingBug()
 {
     QDeclarativeEngine engine;
 
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBindingBug.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("pauseBindingBug.qml"));
     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
     QVERIFY(rect != 0);
     QDeclarativeAbstractAnimation *anim = rect->findChild<QDeclarativeAbstractAnimation*>("animation");
@@ -1107,7 +1144,7 @@ void tst_qdeclarativeanimations::pauseBug()
 {
     QDeclarativeEngine engine;
 
-    QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBug.qml")));
+    QDeclarativeComponent c(&engine, testFileUrl("pauseBug.qml"));
     QDeclarativeAbstractAnimation *anim = qobject_cast<QDeclarativeAbstractAnimation*>(c.create());
     QVERIFY(anim != 0);
     QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Paused);