equal
deleted
inserted
replaced
45 #include <private/qdeclarativerectangle_p.h> |
45 #include <private/qdeclarativerectangle_p.h> |
46 #include <private/qdeclarativeanimation_p.h> |
46 #include <private/qdeclarativeanimation_p.h> |
47 #include <private/qdeclarativeitem_p.h> |
47 #include <private/qdeclarativeitem_p.h> |
48 #include <QVariantAnimation> |
48 #include <QVariantAnimation> |
49 #include <QEasingCurve> |
49 #include <QEasingCurve> |
|
50 |
|
51 #include "../../../shared/util.h" |
50 |
52 |
51 #ifdef Q_OS_SYMBIAN |
53 #ifdef Q_OS_SYMBIAN |
52 // In Symbian OS test data is located in applications private dir |
54 // In Symbian OS test data is located in applications private dir |
53 #define SRCDIR "." |
55 #define SRCDIR "." |
54 #endif |
56 #endif |
80 void propertyValueSourceDefaultStart(); |
82 void propertyValueSourceDefaultStart(); |
81 void dontStart(); |
83 void dontStart(); |
82 void easingProperties(); |
84 void easingProperties(); |
83 void rotation(); |
85 void rotation(); |
84 void runningTrueBug(); |
86 void runningTrueBug(); |
|
87 void nonTransitionBug(); |
85 }; |
88 }; |
86 |
89 |
87 #define QTIMED_COMPARE(lhs, rhs) do { \ |
90 #define QTIMED_COMPARE(lhs, rhs) do { \ |
88 for (int ii = 0; ii < 5; ++ii) { \ |
91 for (int ii = 0; ii < 5; ++ii) { \ |
89 if (lhs == rhs) \ |
92 if (lhs == rhs) \ |
549 QDeclarativeItemPrivate::get(rect)->setState("moved"); |
552 QDeclarativeItemPrivate::get(rect)->setState("moved"); |
550 QCOMPARE(myRect->x(),qreal(100)); |
553 QCOMPARE(myRect->x(),qreal(100)); |
551 QTest::qWait(waitDuration); |
554 QTest::qWait(waitDuration); |
552 QTIMED_COMPARE(myRect->x(),qreal(100)); |
555 QTIMED_COMPARE(myRect->x(),qreal(100)); |
553 }*/ |
556 }*/ |
|
557 |
|
558 { |
|
559 QDeclarativeEngine engine; |
|
560 QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition7.qml")); |
|
561 QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); |
|
562 QVERIFY(rect); |
|
563 |
|
564 QDeclarativeItemPrivate::get(rect)->setState("moved"); |
|
565 QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); |
|
566 QVERIFY(myRect); |
|
567 QTest::qWait(waitDuration); |
|
568 QTIMED_COMPARE(myRect->x(),qreal(200)); |
|
569 } |
|
570 |
554 } |
571 } |
555 |
572 |
556 void tst_qdeclarativeanimations::invalidDuration() |
573 void tst_qdeclarativeanimations::invalidDuration() |
557 { |
574 { |
558 QDeclarativePropertyAnimation *animation = new QDeclarativePropertyAnimation; |
575 QDeclarativePropertyAnimation *animation = new QDeclarativePropertyAnimation; |
746 QVERIFY(cloud); |
763 QVERIFY(cloud); |
747 QTest::qWait(1000); |
764 QTest::qWait(1000); |
748 QVERIFY(cloud->x() > qreal(0)); |
765 QVERIFY(cloud->x() > qreal(0)); |
749 } |
766 } |
750 |
767 |
|
768 //QTBUG-12805 |
|
769 void tst_qdeclarativeanimations::nonTransitionBug() |
|
770 { |
|
771 //tests that the animation values from the previous transition are properly cleared |
|
772 //in the case where an animation in the transition doesn't match anything (but previously did) |
|
773 QDeclarativeEngine engine; |
|
774 |
|
775 QDeclarativeComponent c(&engine, SRCDIR "/data/nonTransitionBug.qml"); |
|
776 QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); |
|
777 QVERIFY(rect != 0); |
|
778 QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); |
|
779 QDeclarativeRectangle *mover = rect->findChild<QDeclarativeRectangle*>("mover"); |
|
780 |
|
781 mover->setX(100); |
|
782 QCOMPARE(mover->x(), qreal(100)); |
|
783 |
|
784 rectPrivate->setState("left"); |
|
785 QTRY_COMPARE(mover->x(), qreal(0)); |
|
786 |
|
787 mover->setX(100); |
|
788 QCOMPARE(mover->x(), qreal(100)); |
|
789 |
|
790 //make sure we don't try to animate back to 0 |
|
791 rectPrivate->setState("free"); |
|
792 QTest::qWait(300); |
|
793 QCOMPARE(mover->x(), qreal(100)); |
|
794 } |
|
795 |
751 QTEST_MAIN(tst_qdeclarativeanimations) |
796 QTEST_MAIN(tst_qdeclarativeanimations) |
752 |
797 |
753 #include "tst_qdeclarativeanimations.moc" |
798 #include "tst_qdeclarativeanimations.moc" |