2a2055ebbfe5a965915e0a3fd27c31e0d61a3f4e
[profile/ivi/qtdeclarative.git] / tests / auto / qtquick2 / qdeclarativeanimations / tst_qdeclarativeanimations.cpp
1 /****************************************************************************
2 **
3 ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4 ** All rights reserved.
5 ** Contact: Nokia Corporation (qt-info@nokia.com)
6 **
7 ** This file is part of the test suite of the Qt Toolkit.
8 **
9 ** $QT_BEGIN_LICENSE:LGPL$
10 ** GNU Lesser General Public License Usage
11 ** This file may be used under the terms of the GNU Lesser General Public
12 ** License version 2.1 as published by the Free Software Foundation and
13 ** appearing in the file LICENSE.LGPL included in the packaging of this
14 ** file. Please review the following information to ensure the GNU Lesser
15 ** General Public License version 2.1 requirements will be met:
16 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
17 **
18 ** In addition, as a special exception, Nokia gives you certain additional
19 ** rights. These rights are described in the Nokia Qt LGPL Exception
20 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
21 **
22 ** GNU General Public License Usage
23 ** Alternatively, this file may be used under the terms of the GNU General
24 ** Public License version 3.0 as published by the Free Software Foundation
25 ** and appearing in the file LICENSE.GPL included in the packaging of this
26 ** file. Please review the following information to ensure the GNU General
27 ** Public License version 3.0 requirements will be met:
28 ** http://www.gnu.org/copyleft/gpl.html.
29 **
30 ** Other Usage
31 ** Alternatively, this file may be used in accordance with the terms and
32 ** conditions contained in a signed written agreement between you and Nokia.
33 **
34 **
35 **
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 #include <QtTest/QtTest>
42 #include <QtDeclarative/qdeclarativeengine.h>
43 #include <QtDeclarative/qdeclarativecomponent.h>
44 #include <QtQuick/qquickview.h>
45 #include <QtQuick/private/qquickrectangle_p.h>
46 #include <QtQuick/private/qdeclarativeanimation_p.h>
47 #include <QtQuick/private/qdeclarativetransition_p.h>
48 #include <QtQuick/private/qquickanimation_p.h>
49 #include <QtQuick/private/qdeclarativepathinterpolator_p.h>
50 #include <QtQuick/private/qquickitem_p.h>
51 #include <QVariantAnimation>
52 #include <QEasingCurve>
53
54 #include <limits.h>
55 #include <math.h>
56
57 #include "../../shared/util.h"
58
59 class tst_qdeclarativeanimations : public QObject
60 {
61     Q_OBJECT
62 public:
63     tst_qdeclarativeanimations() {}
64
65 private slots:
66     void initTestCase() { QDeclarativeEngine engine; } // ensure types are registered
67
68     void simpleProperty();
69     void simpleNumber();
70     void simpleColor();
71     void simpleRotation();
72     void simplePath();
73     void pathInterpolator();
74     void pathInterpolatorBackwardJump();
75     void pathWithNoStart();
76     void alwaysRunToEnd();
77     void complete();
78     void resume();
79     void dotProperty();
80     void badTypes();
81     void badProperties();
82     void mixedTypes();
83     void properties();
84     void propertiesTransition();
85     void pathTransition();
86     void disabledTransition();
87     void invalidDuration();
88     void attached();
89     void propertyValueSourceDefaultStart();
90     void dontStart();
91     void easingProperties();
92     void rotation();
93     void runningTrueBug();
94     void nonTransitionBug();
95     void registrationBug();
96     void doubleRegistrationBug();
97     void alwaysRunToEndRestartBug();
98     void transitionAssignmentBug();
99     void pauseBindingBug();
100     void pauseBug();
101 };
102
103 #define QTIMED_COMPARE(lhs, rhs) do { \
104     for (int ii = 0; ii < 5; ++ii) { \
105         if (lhs == rhs)  \
106             break; \
107         QTest::qWait(50); \
108     } \
109     QCOMPARE(lhs, rhs); \
110 } while (false)
111
112 void tst_qdeclarativeanimations::simpleProperty()
113 {
114     QQuickRectangle rect;
115     QDeclarativePropertyAnimation animation;
116     animation.setTarget(&rect);
117     animation.setProperty("x");
118     animation.setTo(200);
119     QVERIFY(animation.target() == &rect);
120     QVERIFY(animation.property() == "x");
121     QVERIFY(animation.to().toReal() == 200.0);
122     animation.start();
123     QVERIFY(animation.isRunning());
124     QTest::qWait(animation.duration());
125     QTIMED_COMPARE(rect.x(), 200.0);
126
127     rect.setPos(QPointF(0,0));
128     animation.start();
129     animation.pause();
130     QVERIFY(animation.isRunning());
131     QVERIFY(animation.isPaused());
132     animation.setCurrentTime(125);
133     QVERIFY(animation.currentTime() == 125);
134     QCOMPARE(rect.x(),100.0);
135 }
136
137 void tst_qdeclarativeanimations::simpleNumber()
138 {
139     QQuickRectangle rect;
140     QDeclarativeNumberAnimation animation;
141     animation.setTarget(&rect);
142     animation.setProperty("x");
143     animation.setTo(200);
144     QVERIFY(animation.target() == &rect);
145     QVERIFY(animation.property() == "x");
146     QVERIFY(animation.to() == 200);
147     animation.start();
148     QVERIFY(animation.isRunning());
149     QTest::qWait(animation.duration());
150     QTIMED_COMPARE(rect.x(), qreal(200));
151
152     rect.setX(0);
153     animation.start();
154     animation.pause();
155     QVERIFY(animation.isRunning());
156     QVERIFY(animation.isPaused());
157     animation.setCurrentTime(125);
158     QVERIFY(animation.currentTime() == 125);
159     QCOMPARE(rect.x(), qreal(100));
160 }
161
162 void tst_qdeclarativeanimations::simpleColor()
163 {
164     QQuickRectangle rect;
165     QDeclarativeColorAnimation animation;
166     animation.setTarget(&rect);
167     animation.setProperty("color");
168     animation.setTo(QColor("red"));
169     QVERIFY(animation.target() == &rect);
170     QVERIFY(animation.property() == "color");
171     QVERIFY(animation.to() == QColor("red"));
172     animation.start();
173     QVERIFY(animation.isRunning());
174     QTest::qWait(animation.duration());
175     QTIMED_COMPARE(rect.color(), QColor("red"));
176
177     rect.setColor(QColor("blue"));
178     animation.start();
179     animation.pause();
180     QVERIFY(animation.isRunning());
181     QVERIFY(animation.isPaused());
182     animation.setCurrentTime(125);
183     QVERIFY(animation.currentTime() == 125);
184     QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1));
185
186     rect.setColor(QColor("green"));
187     animation.setFrom(QColor("blue"));
188     QVERIFY(animation.from() == QColor("blue"));
189     animation.restart();
190     QCOMPARE(rect.color(), QColor("blue"));
191     QVERIFY(animation.isRunning());
192     animation.setCurrentTime(125);
193     QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1));
194 }
195
196 void tst_qdeclarativeanimations::simpleRotation()
197 {
198     QQuickRectangle rect;
199     QDeclarativeRotationAnimation animation;
200     animation.setTarget(&rect);
201     animation.setProperty("rotation");
202     animation.setTo(270);
203     QVERIFY(animation.target() == &rect);
204     QVERIFY(animation.property() == "rotation");
205     QVERIFY(animation.to() == 270);
206     QVERIFY(animation.direction() == QDeclarativeRotationAnimation::Numerical);
207     animation.start();
208     QVERIFY(animation.isRunning());
209     QTest::qWait(animation.duration());
210     QTIMED_COMPARE(rect.rotation(), qreal(270));
211
212     rect.setRotation(0);
213     animation.start();
214     animation.pause();
215     QVERIFY(animation.isRunning());
216     QVERIFY(animation.isPaused());
217     animation.setCurrentTime(125);
218     QVERIFY(animation.currentTime() == 125);
219     QCOMPARE(rect.rotation(), qreal(135));
220 }
221
222 void tst_qdeclarativeanimations::simplePath()
223 {
224     {
225         QDeclarativeEngine engine;
226         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation.qml")));
227         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
228         QVERIFY(rect);
229
230         QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
231         QVERIFY(redRect);
232         QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
233         QVERIFY(pathAnim);
234
235         pathAnim->start();
236         pathAnim->pause();
237
238         pathAnim->setCurrentTime(30);
239         QCOMPARE(redRect->x(), qreal(167));
240         QCOMPARE(redRect->y(), qreal(104));
241
242         pathAnim->setCurrentTime(100);
243         QCOMPARE(redRect->x(), qreal(300));
244         QCOMPARE(redRect->y(), qreal(300));
245
246         //verify animation runs to end
247         pathAnim->start();
248         QCOMPARE(redRect->x(), qreal(50));
249         QCOMPARE(redRect->y(), qreal(50));
250         QTRY_COMPARE(redRect->x(), qreal(300));
251         QCOMPARE(redRect->y(), qreal(300));
252
253         pathAnim->setOrientation(QQuickPathAnimation::RightFirst);
254         QCOMPARE(pathAnim->orientation(), QQuickPathAnimation::RightFirst);
255         pathAnim->start();
256         QTRY_VERIFY(redRect->rotation() != 0);
257         pathAnim->stop();
258     }
259
260     {
261         QDeclarativeEngine engine;
262         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimation2.qml")));
263         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
264         QVERIFY(rect);
265
266         QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
267         QVERIFY(redRect);
268         QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
269         QVERIFY(pathAnim);
270
271         QCOMPARE(pathAnim->orientation(), QQuickPathAnimation::RightFirst);
272
273         pathAnim->start();
274         pathAnim->pause();
275         QCOMPARE(redRect->x(), qreal(50));
276         QCOMPARE(redRect->y(), qreal(50));
277         QCOMPARE(redRect->rotation(), qreal(-360));
278
279         pathAnim->setCurrentTime(50);
280         QCOMPARE(redRect->x(), qreal(175));
281         QCOMPARE(redRect->y(), qreal(175));
282         QCOMPARE(redRect->rotation(), qreal(-315));
283
284         pathAnim->setCurrentTime(100);
285         QCOMPARE(redRect->x(), qreal(300));
286         QCOMPARE(redRect->y(), qreal(300));
287         QCOMPARE(redRect->rotation(), qreal(0));
288     }
289 }
290
291 void tst_qdeclarativeanimations::pathInterpolator()
292 {
293     QDeclarativeEngine engine;
294     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathInterpolator.qml")));
295     QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create());
296     QVERIFY(interpolator);
297
298     QCOMPARE(interpolator->progress(), qreal(0));
299     QCOMPARE(interpolator->x(), qreal(50));
300     QCOMPARE(interpolator->y(), qreal(50));
301     QCOMPARE(interpolator->angle(), qreal(0));
302
303     interpolator->setProgress(.5);
304     QCOMPARE(interpolator->progress(), qreal(.5));
305     QCOMPARE(interpolator->x(), qreal(175));
306     QCOMPARE(interpolator->y(), qreal(175));
307     QCOMPARE(interpolator->angle(), qreal(270));
308
309     interpolator->setProgress(1);
310     QCOMPARE(interpolator->progress(), qreal(1));
311     QCOMPARE(interpolator->x(), qreal(300));
312     QCOMPARE(interpolator->y(), qreal(300));
313     QCOMPARE(interpolator->angle(), qreal(0));
314 }
315
316 void tst_qdeclarativeanimations::pathInterpolatorBackwardJump()
317 {
318     QDeclarativeEngine engine;
319     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathInterpolatorBack.qml")));
320     QDeclarativePathInterpolator *interpolator = qobject_cast<QDeclarativePathInterpolator*>(c.create());
321     QVERIFY(interpolator);
322
323     QCOMPARE(interpolator->progress(), qreal(0));
324     QCOMPARE(interpolator->x(), qreal(50));
325     QCOMPARE(interpolator->y(), qreal(50));
326     QCOMPARE(interpolator->angle(), qreal(270));
327
328     interpolator->setProgress(.5);
329     QCOMPARE(interpolator->progress(), qreal(.5));
330     QCOMPARE(interpolator->x(), qreal(100));
331     QCOMPARE(interpolator->y(), qreal(75));
332     QCOMPARE(interpolator->angle(), qreal(90));
333
334     interpolator->setProgress(1);
335     QCOMPARE(interpolator->progress(), qreal(1));
336     QCOMPARE(interpolator->x(), qreal(200));
337     QCOMPARE(interpolator->y(), qreal(50));
338     QCOMPARE(interpolator->angle(), qreal(0));
339
340     //make sure we don't get caught in infinite loop here
341     interpolator->setProgress(0);
342     QCOMPARE(interpolator->progress(), qreal(0));
343     QCOMPARE(interpolator->x(), qreal(50));
344     QCOMPARE(interpolator->y(), qreal(50));
345     QCOMPARE(interpolator->angle(), qreal(270));
346 }
347
348 void tst_qdeclarativeanimations::pathWithNoStart()
349 {
350     QDeclarativeEngine engine;
351     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathAnimationNoStart.qml")));
352     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
353     QVERIFY(rect);
354
355     QQuickRectangle *redRect = rect->findChild<QQuickRectangle*>();
356     QVERIFY(redRect);
357     QQuickPathAnimation *pathAnim = rect->findChild<QQuickPathAnimation*>();
358     QVERIFY(pathAnim);
359
360     pathAnim->start();
361     pathAnim->pause();
362     QCOMPARE(redRect->x(), qreal(50));
363     QCOMPARE(redRect->y(), qreal(50));
364
365     pathAnim->setCurrentTime(50);
366     QCOMPARE(redRect->x(), qreal(175));
367     QCOMPARE(redRect->y(), qreal(175));
368
369     pathAnim->setCurrentTime(100);
370     QCOMPARE(redRect->x(), qreal(300));
371     QCOMPARE(redRect->y(), qreal(300));
372
373     redRect->setX(100);
374     redRect->setY(100);
375     pathAnim->start();
376     QCOMPARE(redRect->x(), qreal(100));
377     QCOMPARE(redRect->y(), qreal(100));
378     QTRY_COMPARE(redRect->x(), qreal(300));
379     QCOMPARE(redRect->y(), qreal(300));
380 }
381
382 void tst_qdeclarativeanimations::alwaysRunToEnd()
383 {
384     QQuickRectangle rect;
385     QDeclarativePropertyAnimation animation;
386     animation.setTarget(&rect);
387     animation.setProperty("x");
388     animation.setTo(200);
389     animation.setDuration(1000);
390     animation.setLoops(-1);
391     animation.setAlwaysRunToEnd(true);
392     QVERIFY(animation.loops() == -1);
393     QVERIFY(animation.alwaysRunToEnd() == true);
394     animation.start();
395     QTest::qWait(1500);
396     animation.stop();
397     QVERIFY(rect.x() != qreal(200));
398     QTest::qWait(500);
399     QTIMED_COMPARE(rect.x(), qreal(200));
400 }
401
402 void tst_qdeclarativeanimations::complete()
403 {
404     QQuickRectangle rect;
405     QDeclarativePropertyAnimation animation;
406     animation.setTarget(&rect);
407     animation.setProperty("x");
408     animation.setFrom(1);
409     animation.setTo(200);
410     animation.setDuration(500);
411     QVERIFY(animation.from() == 1);
412     animation.start();
413     QTest::qWait(50);
414     animation.stop();
415     QVERIFY(rect.x() != qreal(200));
416     animation.start();
417     QTest::qWait(50);
418     QVERIFY(animation.isRunning());
419     animation.complete();
420     QCOMPARE(rect.x(), qreal(200));
421 }
422
423 void tst_qdeclarativeanimations::resume()
424 {
425     QQuickRectangle rect;
426     QDeclarativePropertyAnimation animation;
427     animation.setTarget(&rect);
428     animation.setProperty("x");
429     animation.setFrom(10);
430     animation.setTo(200);
431     animation.setDuration(1000);
432     QVERIFY(animation.from() == 10);
433
434     animation.start();
435     QTest::qWait(400);
436     animation.pause();
437     qreal x = rect.x();
438     QVERIFY(x != qreal(200) && x != qreal(10));
439     QVERIFY(animation.isRunning());
440     QVERIFY(animation.isPaused());
441
442     animation.resume();
443     QVERIFY(animation.isRunning());
444     QVERIFY(!animation.isPaused());
445     QTest::qWait(400);
446     animation.stop();
447     QVERIFY(rect.x() > x);
448 }
449
450 void tst_qdeclarativeanimations::dotProperty()
451 {
452     QQuickRectangle rect;
453     QDeclarativeNumberAnimation animation;
454     animation.setTarget(&rect);
455     animation.setProperty("border.width");
456     animation.setTo(10);
457     animation.start();
458     QTest::qWait(animation.duration()+50);
459     QTIMED_COMPARE(rect.border()->width(), 10.0);
460
461     rect.border()->setWidth(0);
462     animation.start();
463     animation.pause();
464     animation.setCurrentTime(125);
465     QVERIFY(animation.currentTime() == 125);
466     QCOMPARE(rect.border()->width(), 5.0);
467 }
468
469 void tst_qdeclarativeanimations::badTypes()
470 {
471     //don't crash
472     {
473         QQuickView *view = new QQuickView;
474         view->setSource(QUrl::fromLocalFile(TESTDATA("badtype1.qml")));
475
476         qApp->processEvents();
477
478         delete view;
479     }
480
481     //make sure we get a compiler error
482     {
483         QDeclarativeEngine engine;
484         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype2.qml")));
485         QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
486         c.create();
487
488         QVERIFY(c.errors().count() == 1);
489         QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: number expected"));
490     }
491
492     //make sure we get a compiler error
493     {
494         QDeclarativeEngine engine;
495         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype3.qml")));
496         QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready");
497         c.create();
498
499         QVERIFY(c.errors().count() == 1);
500         QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: color expected"));
501     }
502
503     //don't crash
504     {
505         QDeclarativeEngine engine;
506         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("badtype4.qml")));
507         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
508         QVERIFY(rect);
509
510         QQuickItemPrivate::get(rect)->setState("state1");
511         QTest::qWait(1000 + 50);
512         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("MyRect");
513         QVERIFY(myRect);
514         QCOMPARE(myRect->x(),qreal(200));
515     }
516 }
517
518 void tst_qdeclarativeanimations::badProperties()
519 {
520     //make sure we get a runtime error
521     {
522         QDeclarativeEngine engine;
523
524         QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(TESTDATA("badproperty1.qml")));
525         QByteArray message = QUrl::fromLocalFile(TESTDATA("badproperty1.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate non-existent property \"border.colr\"";
526         QTest::ignoreMessage(QtWarningMsg, message);
527         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c1.create());
528         QVERIFY(rect);
529
530         QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(TESTDATA("badproperty2.qml")));
531         message = QUrl::fromLocalFile(TESTDATA("badproperty2.qml")).toString().toUtf8() + ":18:9: QML ColorAnimation: Cannot animate read-only property \"border\"";
532         QTest::ignoreMessage(QtWarningMsg, message);
533         rect = qobject_cast<QQuickRectangle*>(c2.create());
534         QVERIFY(rect);
535
536         //### should we warn here are well?
537         //rect->setState("state1");
538     }
539 }
540
541 //test animating mixed types with property animation in a transition
542 //for example, int + real; color + real; etc
543 void tst_qdeclarativeanimations::mixedTypes()
544 {
545     //assumes border.width stays a real -- not real robust
546     {
547         QDeclarativeEngine engine;
548         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype1.qml")));
549         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
550         QVERIFY(rect);
551
552         QQuickItemPrivate::get(rect)->setState("state1");
553         QTest::qWait(500);
554         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("MyRect");
555         QVERIFY(myRect);
556
557         //rather inexact -- is there a better way?
558         QVERIFY(myRect->x() > 100 && myRect->x() < 200);
559         QVERIFY(myRect->border()->width() > 1 && myRect->border()->width() < 10);
560     }
561
562     {
563         QDeclarativeEngine engine;
564         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("mixedtype2.qml")));
565         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
566         QVERIFY(rect);
567
568         QQuickItemPrivate::get(rect)->setState("state1");
569         QTest::qWait(500);
570         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("MyRect");
571         QVERIFY(myRect);
572
573         //rather inexact -- is there a better way?
574         QVERIFY(myRect->x() > 100 && myRect->x() < 200);
575         QVERIFY(myRect->color() != QColor("red") && myRect->color() != QColor("blue"));
576     }
577 }
578
579 void tst_qdeclarativeanimations::properties()
580 {
581     const int waitDuration = 300;
582     {
583         QDeclarativeEngine engine;
584         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties.qml")));
585         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
586         QVERIFY(rect);
587
588         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
589         QVERIFY(myRect);
590         QTest::qWait(waitDuration);
591         QTIMED_COMPARE(myRect->x(),qreal(200));
592     }
593
594     {
595         QDeclarativeEngine engine;
596         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties2.qml")));
597         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
598         QVERIFY(rect);
599
600         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
601         QVERIFY(myRect);
602         QTest::qWait(waitDuration);
603         QTIMED_COMPARE(myRect->x(),qreal(200));
604     }
605
606     {
607         QDeclarativeEngine engine;
608         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties3.qml")));
609         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
610         QVERIFY(rect);
611
612         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
613         QVERIFY(myRect);
614         QTest::qWait(waitDuration);
615         QTIMED_COMPARE(myRect->x(),qreal(300));
616     }
617
618     {
619         QDeclarativeEngine engine;
620         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties4.qml")));
621         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
622         QVERIFY(rect);
623
624         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
625         QVERIFY(myRect);
626         QTest::qWait(waitDuration);
627         QTIMED_COMPARE(myRect->y(),qreal(200));
628         QTIMED_COMPARE(myRect->x(),qreal(100));
629     }
630
631     {
632         QDeclarativeEngine engine;
633         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("properties5.qml")));
634         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
635         QVERIFY(rect);
636
637         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
638         QVERIFY(myRect);
639         QTest::qWait(waitDuration);
640         QTIMED_COMPARE(myRect->x(),qreal(100));
641         QTIMED_COMPARE(myRect->y(),qreal(200));
642     }
643 }
644
645 void tst_qdeclarativeanimations::propertiesTransition()
646 {
647     const int waitDuration = 300;
648     {
649         QDeclarativeEngine engine;
650         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition.qml")));
651         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
652         QVERIFY(rect);
653
654         QQuickItemPrivate::get(rect)->setState("moved");
655         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
656         QVERIFY(myRect);
657         QTest::qWait(waitDuration);
658         QTIMED_COMPARE(myRect->x(),qreal(200));
659     }
660
661     {
662         QDeclarativeEngine engine;
663         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition2.qml")));
664         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
665         QVERIFY(rect);
666
667         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
668         QVERIFY(myRect);
669         QQuickItemPrivate::get(rect)->setState("moved");
670         QCOMPARE(myRect->x(),qreal(200));
671         QCOMPARE(myRect->y(),qreal(100));
672         QTest::qWait(waitDuration);
673         QTIMED_COMPARE(myRect->y(),qreal(200));
674     }
675
676     {
677         QDeclarativeEngine engine;
678         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition3.qml")));
679         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
680         QVERIFY(rect);
681
682         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
683         QVERIFY(myRect);
684         QQuickItemPrivate::get(rect)->setState("moved");
685         QCOMPARE(myRect->x(),qreal(200));
686         QCOMPARE(myRect->y(),qreal(100));
687     }
688
689     {
690         QDeclarativeEngine engine;
691         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition4.qml")));
692         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
693         QVERIFY(rect);
694
695         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
696         QVERIFY(myRect);
697         QQuickItemPrivate::get(rect)->setState("moved");
698         QCOMPARE(myRect->x(),qreal(100));
699         QTest::qWait(waitDuration);
700         QTIMED_COMPARE(myRect->x(),qreal(200));
701     }
702
703     {
704         QDeclarativeEngine engine;
705         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition5.qml")));
706         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
707         QVERIFY(rect);
708
709         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
710         QVERIFY(myRect);
711         QQuickItemPrivate::get(rect)->setState("moved");
712         QCOMPARE(myRect->x(),qreal(100));
713         QTest::qWait(waitDuration);
714         QTIMED_COMPARE(myRect->x(),qreal(200));
715     }
716
717     /*{
718         QDeclarativeEngine engine;
719         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition6.qml")));
720         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
721         QVERIFY(rect);
722
723         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
724         QVERIFY(myRect);
725         QQuickItemPrivate::get(rect)->setState("moved");
726         QCOMPARE(myRect->x(),qreal(100));
727         QTest::qWait(waitDuration);
728         QTIMED_COMPARE(myRect->x(),qreal(100));
729     }*/
730
731     {
732         QDeclarativeEngine engine;
733         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("propertiesTransition7.qml")));
734         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
735         QVERIFY(rect);
736
737         QQuickItemPrivate::get(rect)->setState("moved");
738         QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
739         QVERIFY(myRect);
740         QTest::qWait(waitDuration);
741         QTIMED_COMPARE(myRect->x(),qreal(200));
742     }
743
744 }
745
746 void tst_qdeclarativeanimations::pathTransition()
747 {
748     QDeclarativeEngine engine;
749     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pathTransition.qml")));
750     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
751     QVERIFY(rect);
752
753     QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("redRect");
754     QVERIFY(myRect);
755
756     QQuickItemPrivate::get(rect)->setState("moved");
757     QTRY_VERIFY(myRect->x() < 500 && myRect->x() > 100 && myRect->y() > 50 && myRect->y() < 700 );  //animation started
758     QTRY_VERIFY(qFuzzyCompare(myRect->x(), qreal(100)) && qFuzzyCompare(myRect->y(), qreal(700)));
759     QTest::qWait(100);
760
761     QQuickItemPrivate::get(rect)->setState("");
762     QTRY_VERIFY(myRect->x() < 500 && myRect->x() > 100 && myRect->y() > 50 && myRect->y() < 700 );  //animation started
763     QTRY_VERIFY(qFuzzyCompare(myRect->x(), qreal(500)) && qFuzzyCompare(myRect->y(), qreal(50)));
764 }
765
766 void tst_qdeclarativeanimations::disabledTransition()
767 {
768     QDeclarativeEngine engine;
769     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("disabledTransition.qml")));
770     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
771     QVERIFY(rect);
772
773     QQuickRectangle *myRect = rect->findChild<QQuickRectangle*>("TheRect");
774     QVERIFY(myRect);
775
776     QDeclarativeTransition *trans = rect->findChild<QDeclarativeTransition*>();
777     QVERIFY(trans);
778
779     QCOMPARE(trans->enabled(), false);
780
781     QQuickItemPrivate::get(rect)->setState("moved");
782     QCOMPARE(myRect->x(),qreal(200));
783
784     trans->setEnabled(true);
785
786     QQuickItemPrivate::get(rect)->setState("");
787     QCOMPARE(myRect->x(),qreal(200));
788     QTest::qWait(300);
789     QTIMED_COMPARE(myRect->x(),qreal(100));
790 }
791
792 void tst_qdeclarativeanimations::invalidDuration()
793 {
794     QDeclarativePropertyAnimation *animation = new QDeclarativePropertyAnimation;
795     QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML PropertyAnimation: Cannot set a duration of < 0");
796     animation->setDuration(-1);
797     QCOMPARE(animation->duration(), 250);
798
799     QDeclarativePauseAnimation *pauseAnimation = new QDeclarativePauseAnimation;
800     QTest::ignoreMessage(QtWarningMsg, "<Unknown File>: QML PauseAnimation: Cannot set a duration of < 0");
801     pauseAnimation->setDuration(-1);
802     QCOMPARE(pauseAnimation->duration(), 250);
803 }
804
805 void tst_qdeclarativeanimations::attached()
806 {
807     QDeclarativeEngine engine;
808
809     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("attached.qml")));
810     QTest::ignoreMessage(QtDebugMsg, "off");
811     QTest::ignoreMessage(QtDebugMsg, "on");
812     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
813     QVERIFY(rect);
814 }
815
816 void tst_qdeclarativeanimations::propertyValueSourceDefaultStart()
817 {
818     {
819         QDeclarativeEngine engine;
820
821         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource.qml")));
822
823         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
824         QVERIFY(rect);
825
826         QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim");
827         QVERIFY(myAnim);
828         QVERIFY(myAnim->isRunning());
829     }
830
831     {
832         QDeclarativeEngine engine;
833
834         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("valuesource2.qml")));
835
836         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
837         QVERIFY(rect);
838
839         QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim");
840         QVERIFY(myAnim);
841         QVERIFY(myAnim->isRunning() == false);
842     }
843
844     {
845         QDeclarativeEngine engine;
846
847         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontAutoStart.qml")));
848
849         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
850         QVERIFY(rect);
851
852         QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim");
853         QVERIFY(myAnim && myAnim->qtAnimation());
854         QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped);
855     }
856 }
857
858
859 void tst_qdeclarativeanimations::dontStart()
860 {
861     {
862         QDeclarativeEngine engine;
863
864         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart.qml")));
865
866         QString warning = c.url().toString() + ":14:13: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
867         QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
868         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
869         QVERIFY(rect);
870
871         QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim");
872         QVERIFY(myAnim && myAnim->qtAnimation());
873         QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped);
874     }
875
876     {
877         QDeclarativeEngine engine;
878
879         QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("dontStart2.qml")));
880
881         QString warning = c.url().toString() + ":15:17: QML NumberAnimation: setRunning() cannot be used on non-root animation nodes.";
882         QTest::ignoreMessage(QtWarningMsg, qPrintable(warning));
883         QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
884         QVERIFY(rect);
885
886         QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim");
887         QVERIFY(myAnim && myAnim->qtAnimation());
888         QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped);
889     }
890 }
891
892 void tst_qdeclarativeanimations::easingProperties()
893 {
894     {
895         QDeclarativeEngine engine;
896         QString componentStr = "import QtQuick 2.0\nNumberAnimation { easing.type: \"InOutQuad\" }";
897         QDeclarativeComponent animationComponent(&engine);
898         animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
899         QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create());
900
901         QVERIFY(animObject != 0);
902         QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad);
903     }
904
905     {
906         QDeclarativeEngine engine;
907         QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }";
908         QDeclarativeComponent animationComponent(&engine);
909         animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
910         QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create());
911
912         QVERIFY(animObject != 0);
913         QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce);
914         QCOMPARE(animObject->easing().amplitude(), 5.0);
915     }
916
917     {
918         QDeclarativeEngine engine;
919         QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}";
920         QDeclarativeComponent animationComponent(&engine);
921         animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
922         QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create());
923
924         QVERIFY(animObject != 0);
925         QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic);
926         QCOMPARE(animObject->easing().amplitude(), 5.0);
927         QCOMPARE(animObject->easing().period(), 3.0);
928     }
929
930     {
931         QDeclarativeEngine engine;
932         QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }";
933         QDeclarativeComponent animationComponent(&engine);
934         animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
935         QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create());
936
937         QVERIFY(animObject != 0);
938         QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack);
939         QCOMPARE(animObject->easing().overshoot(), 2.0);
940     }
941
942     {
943         QDeclarativeEngine engine;
944         QString componentStr = "import QtQuick 2.0\nPropertyAnimation { easing.type: \"Bezier\"; easing.bezierCurve: [0.5, 0.2, 0.13, 0.65, 1.0, 1.0] }";
945         QDeclarativeComponent animationComponent(&engine);
946         animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
947         QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create());
948
949         QVERIFY(animObject != 0);
950         QCOMPARE(animObject->easing().type(), QEasingCurve::BezierSpline);
951         QList<QPointF> points = animObject->easing().cubicBezierSpline();
952         QCOMPARE(points.count(), 3);
953         QCOMPARE(points.at(0), QPointF(0.5, 0.2));
954         QCOMPARE(points.at(1), QPointF(0.13, 0.65));
955         QCOMPARE(points.at(2), QPointF(1.0, 1.0));
956     }
957 }
958
959 void tst_qdeclarativeanimations::rotation()
960 {
961     QDeclarativeEngine engine;
962     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("rotation.qml")));
963     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
964     QVERIFY(rect);
965
966     QQuickRectangle *rr = rect->findChild<QQuickRectangle*>("rr");
967     QQuickRectangle *rr2 = rect->findChild<QQuickRectangle*>("rr2");
968     QQuickRectangle *rr3 = rect->findChild<QQuickRectangle*>("rr3");
969     QQuickRectangle *rr4 = rect->findChild<QQuickRectangle*>("rr4");
970
971     QQuickItemPrivate::get(rect)->setState("state1");
972     QTest::qWait(800);
973     qreal r1 = rr->rotation();
974     qreal r2 = rr2->rotation();
975     qreal r3 = rr3->rotation();
976     qreal r4 = rr4->rotation();
977
978     QVERIFY(r1 > qreal(0) && r1 < qreal(370));
979     QVERIFY(r2 > qreal(0) && r2 < qreal(370));
980     QVERIFY(r3 < qreal(0) && r3 > qreal(-350));
981     QVERIFY(r4 > qreal(0) && r4 < qreal(10));
982     QCOMPARE(r1,r2);
983     QVERIFY(r4 < r2);
984
985     QTest::qWait(800);
986     QTIMED_COMPARE(rr->rotation() + rr2->rotation() + rr3->rotation() + rr4->rotation(), qreal(370*4));
987 }
988
989 void tst_qdeclarativeanimations::runningTrueBug()
990 {
991     //ensure we start correctly when "running: true" is explicitly set
992     QDeclarativeEngine engine;
993     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("runningTrueBug.qml")));
994     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
995     QVERIFY(rect);
996
997     QQuickRectangle *cloud = rect->findChild<QQuickRectangle*>("cloud");
998     QVERIFY(cloud);
999     QTest::qWait(1000);
1000     QVERIFY(cloud->x() > qreal(0));
1001 }
1002
1003 //QTBUG-12805
1004 void tst_qdeclarativeanimations::nonTransitionBug()
1005 {
1006     //tests that the animation values from the previous transition are properly cleared
1007     //in the case where an animation in the transition doesn't match anything (but previously did)
1008     QDeclarativeEngine engine;
1009
1010     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("nonTransitionBug.qml")));
1011     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
1012     QVERIFY(rect != 0);
1013     QQuickItemPrivate *rectPrivate = QQuickItemPrivate::get(rect);
1014     QQuickRectangle *mover = rect->findChild<QQuickRectangle*>("mover");
1015
1016     mover->setX(100);
1017     QCOMPARE(mover->x(), qreal(100));
1018
1019     rectPrivate->setState("left");
1020     QTRY_COMPARE(mover->x(), qreal(0));
1021
1022     mover->setX(100);
1023     QCOMPARE(mover->x(), qreal(100));
1024
1025     //make sure we don't try to animate back to 0
1026     rectPrivate->setState("free");
1027     QTest::qWait(300);
1028     QCOMPARE(mover->x(), qreal(100));
1029 }
1030
1031 //QTBUG-14042
1032 void tst_qdeclarativeanimations::registrationBug()
1033 {
1034     QDeclarativeEngine engine;
1035
1036     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("registrationBug.qml")));
1037     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
1038     QVERIFY(rect != 0);
1039     QTRY_COMPARE(rect->property("value"), QVariant(int(100)));
1040 }
1041
1042 void tst_qdeclarativeanimations::doubleRegistrationBug()
1043 {
1044     QDeclarativeEngine engine;
1045
1046     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("doubleRegistrationBug.qml")));
1047     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
1048     QVERIFY(rect != 0);
1049
1050     QDeclarativeAbstractAnimation *anim = rect->findChild<QDeclarativeAbstractAnimation*>("animation");
1051     QVERIFY(anim != 0);
1052     QTRY_COMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Stopped);
1053 }
1054
1055 //QTBUG-16736
1056 void tst_qdeclarativeanimations::alwaysRunToEndRestartBug()
1057 {
1058     QQuickRectangle rect;
1059     QDeclarativePropertyAnimation animation;
1060     animation.setTarget(&rect);
1061     animation.setProperty("x");
1062     animation.setTo(200);
1063     animation.setDuration(1000);
1064     animation.setLoops(-1);
1065     animation.setAlwaysRunToEnd(true);
1066     QVERIFY(animation.loops() == -1);
1067     QVERIFY(animation.alwaysRunToEnd() == true);
1068     animation.start();
1069     animation.stop();
1070     animation.start();
1071     animation.stop();
1072     QTest::qWait(500);
1073     QVERIFY(rect.x() != qreal(200));
1074     QTest::qWait(800);
1075     QTIMED_COMPARE(rect.x(), qreal(200));
1076     QCOMPARE(static_cast<QDeclarativeAbstractAnimation*>(&animation)->qtAnimation()->state(), QAbstractAnimation::Stopped);
1077 }
1078
1079 //QTBUG-20227
1080 void tst_qdeclarativeanimations::transitionAssignmentBug()
1081 {
1082     QDeclarativeEngine engine;
1083
1084     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("transitionAssignmentBug.qml")));
1085     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
1086     QVERIFY(rect != 0);
1087
1088     QCOMPARE(rect->property("nullObject").toBool(), false);
1089 }
1090
1091 //QTBUG-19080
1092 void tst_qdeclarativeanimations::pauseBindingBug()
1093 {
1094     QDeclarativeEngine engine;
1095
1096     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBindingBug.qml")));
1097     QQuickRectangle *rect = qobject_cast<QQuickRectangle*>(c.create());
1098     QVERIFY(rect != 0);
1099     QDeclarativeAbstractAnimation *anim = rect->findChild<QDeclarativeAbstractAnimation*>("animation");
1100     QVERIFY(anim->qtAnimation()->state() == QAbstractAnimation::Paused);
1101
1102     delete rect;
1103 }
1104
1105 //QTBUG-13598
1106 void tst_qdeclarativeanimations::pauseBug()
1107 {
1108     QDeclarativeEngine engine;
1109
1110     QDeclarativeComponent c(&engine, QUrl::fromLocalFile(TESTDATA("pauseBug.qml")));
1111     QDeclarativeAbstractAnimation *anim = qobject_cast<QDeclarativeAbstractAnimation*>(c.create());
1112     QVERIFY(anim != 0);
1113     QCOMPARE(anim->qtAnimation()->state(), QAbstractAnimation::Paused);
1114     QCOMPARE(anim->isPaused(), true);
1115     QCOMPARE(anim->isRunning(), true);
1116
1117     delete anim;
1118 }
1119
1120 QTEST_MAIN(tst_qdeclarativeanimations)
1121
1122 #include "tst_qdeclarativeanimations.moc"