From 19e6eba3106500488a05acbc2931d8cc41b5e5a4 Mon Sep 17 00:00:00 2001 From: Damian Jansen Date: Fri, 23 Oct 2009 15:54:27 +1000 Subject: Autotest for QfxAnimatedImage --- .../declarative/animatedimage/animatedimage.pro | 5 ++ .../declarative/animatedimage/data/stickman.gif | Bin 0 -> 164923 bytes .../animatedimage/tst_animatedimage.cpp | 56 +++++++++++++++++++++ 3 files changed, 61 insertions(+) create mode 100644 tests/auto/declarative/animatedimage/animatedimage.pro create mode 100644 tests/auto/declarative/animatedimage/data/stickman.gif create mode 100644 tests/auto/declarative/animatedimage/tst_animatedimage.cpp 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 Binary files /dev/null and b/tests/auto/declarative/animatedimage/data/stickman.gif 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 +#include +#include +#include +#include +#include +#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" -- cgit v0.12