summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/animatedimage
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/declarative/animatedimage')
-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"