diff options
author | Michael Brasser <michael.brasser@nokia.com> | 2009-06-26 01:10:56 (GMT) |
---|---|---|
committer | Michael Brasser <michael.brasser@nokia.com> | 2009-06-26 01:10:56 (GMT) |
commit | 662488175fb9c6a44e9641867177b5396c507891 (patch) | |
tree | 554411c26dd635e327198b212d1f6648fec57316 /tests/auto/declarative/animations/tst_animations.cpp | |
parent | baff8c7e3bba56c3d9c53300ed4524c4b3546c15 (diff) | |
download | Qt-662488175fb9c6a44e9641867177b5396c507891.zip Qt-662488175fb9c6a44e9641867177b5396c507891.tar.gz Qt-662488175fb9c6a44e9641867177b5396c507891.tar.bz2 |
Fix animation bugs, and add autotest.
Diffstat (limited to 'tests/auto/declarative/animations/tst_animations.cpp')
-rw-r--r-- | tests/auto/declarative/animations/tst_animations.cpp | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp new file mode 100644 index 0000000..1895cef2 --- /dev/null +++ b/tests/auto/declarative/animations/tst_animations.cpp @@ -0,0 +1,82 @@ +#include <qtest.h> +#include <QtDeclarative/qmlengine.h> +#include <QtDeclarative/qmlcomponent.h> +#include <QtDeclarative/qfxview.h> +#include <QtDeclarative/qfxrect.h> + +class tst_animations : public QObject +{ + Q_OBJECT +public: + tst_animations() {} + +private slots: + void badTypes(); + //void mixedTypes(); +}; + +void tst_animations::badTypes() +{ + //don't crash + { + QFxView *view = new QFxView; + view->setUrl(QUrl("file://" SRCDIR "/data/badtype1.qml")); + + view->execute(); + qApp->processEvents(); + + delete view; + } + + //make sure we get a compiler error + { + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype2.qml")); + QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready"); + c.create(); + + QVERIFY(c.errors().count() == 1); + QCOMPARE(c.errors().at(0).description(), QLatin1String("Cannot convert value \"blue\" to double number")); + } + + //make sure we get a compiler error + { + QmlEngine engine; + QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badtype3.qml")); + QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready"); + c.create(); + + QVERIFY(c.errors().count() == 1); + QCOMPARE(c.errors().at(0).description(), QLatin1String("Cannot convert value \"10\" to color")); + } +} + +/*//test animating mixed types with property animation + //for example, int + real; color + real; etc +void tst_animations::mixedTypes() +{ + //### this one isn't real robust because width will likely change to real as well + { + QFxView *view = new QFxView; + view->setUrl(QUrl("file://" SRCDIR "/data/mixedtype1.qml")); + + view->execute(); + qApp->processEvents(); + + delete view; + } + + { + QFxView *view = new QFxView; + view->setUrl(QUrl("file://" SRCDIR "/data/mixedtype2.qml")); + + view->execute(); + qApp->processEvents(); + + delete view; + } +}*/ + +QTEST_MAIN(tst_animations) + +#include "tst_animations.moc" |