summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorDamian Jansen <damian.jansen@nokia.com>2009-10-23 05:54:27 (GMT)
committerDamian Jansen <damian.jansen@nokia.com>2009-10-23 05:54:27 (GMT)
commit19e6eba3106500488a05acbc2931d8cc41b5e5a4 (patch)
tree50d4423c4a473d322526231d6bc183ece46b1dea /tests/auto
parentb7b31c15c4544d7e08bfe7b3b21e5144bfdcda10 (diff)
downloadQt-19e6eba3106500488a05acbc2931d8cc41b5e5a4.zip
Qt-19e6eba3106500488a05acbc2931d8cc41b5e5a4.tar.gz
Qt-19e6eba3106500488a05acbc2931d8cc41b5e5a4.tar.bz2
Autotest for QfxAnimatedImage
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/declarative/animatedimage/animatedimage.pro5
-rw-r--r--tests/auto/declarative/animatedimage/data/stickman.gifbin0 -> 164923 bytes
-rw-r--r--tests/auto/declarative/animatedimage/tst_animatedimage.cpp56
3 files changed, 61 insertions, 0 deletions
diff --git a/tests/auto/declarative/animatedimage/animatedimage.pro b/tests/auto/declarative/animatedimage/animatedimage.pro
new file mode 100644
index 0000000..8a92863
--- /dev/null
+++ b/tests/auto/declarative/animatedimage/animatedimage.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_animatedimage.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/animatedimage/data/stickman.gif b/tests/auto/declarative/animatedimage/data/stickman.gif
new file mode 100644
index 0000000..7c4cd18
--- /dev/null
+++ b/tests/auto/declarative/animatedimage/data/stickman.gif
Binary files differ
diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp
new file mode 100644
index 0000000..5c71731
--- /dev/null
+++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp
@@ -0,0 +1,56 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qmlview.h>
+#include <QtDeclarative/qfxrect.h>
+#include <QtDeclarative/qfximage.h>
+#include "qfxanimatedimageitem.h"
+
+class tst_animatedimage : public QObject
+{
+ Q_OBJECT
+public:
+ tst_animatedimage() {}
+
+private slots:
+ void play();
+ void pause();
+ void setFrame();
+ void frameCount();
+};
+
+void tst_animatedimage::play()
+{
+ QFxAnimatedImageItem anim;
+ anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
+ QVERIFY(anim.isPlaying());
+}
+
+void tst_animatedimage::pause()
+{
+ QFxAnimatedImageItem anim;
+ anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
+ anim.setPaused(true);
+ QVERIFY(!anim.isPlaying());
+}
+
+void tst_animatedimage::setFrame()
+{
+ QFxAnimatedImageItem anim;
+ anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
+ anim.setPaused(true);
+ QVERIFY(!anim.isPlaying());
+ anim.setCurrentFrame(2);
+ QCOMPARE(anim.currentFrame(), 2);
+}
+
+void tst_animatedimage::frameCount()
+{
+ QFxAnimatedImageItem anim;
+ anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
+ QCOMPARE(anim.frameCount(), 299);
+}
+
+QTEST_MAIN(tst_animatedimage)
+
+#include "tst_animatedimage.moc"