#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"