diff options
Diffstat (limited to 'tests/auto/declarative')
-rw-r--r-- | tests/auto/declarative/animatedimage/data/colors.gif | bin | 0 -> 505 bytes | |||
-rw-r--r-- | tests/auto/declarative/animatedimage/data/colors.qml | 5 | ||||
-rw-r--r-- | tests/auto/declarative/animatedimage/data/stickmanstopped.qml | 6 | ||||
-rw-r--r-- | tests/auto/declarative/animatedimage/tst_animatedimage.cpp | 38 |
4 files changed, 44 insertions, 5 deletions
diff --git a/tests/auto/declarative/animatedimage/data/colors.gif b/tests/auto/declarative/animatedimage/data/colors.gif Binary files differnew file mode 100644 index 0000000..1270bfa --- /dev/null +++ b/tests/auto/declarative/animatedimage/data/colors.gif diff --git a/tests/auto/declarative/animatedimage/data/colors.qml b/tests/auto/declarative/animatedimage/data/colors.qml new file mode 100644 index 0000000..5bada34 --- /dev/null +++ b/tests/auto/declarative/animatedimage/data/colors.qml @@ -0,0 +1,5 @@ +import Qt 4.6 + +AnimatedImage { + source: "colors.gif" +} diff --git a/tests/auto/declarative/animatedimage/data/stickmanstopped.qml b/tests/auto/declarative/animatedimage/data/stickmanstopped.qml new file mode 100644 index 0000000..53b0c3a --- /dev/null +++ b/tests/auto/declarative/animatedimage/data/stickmanstopped.qml @@ -0,0 +1,6 @@ +import Qt 4.6 + +AnimatedImage { + source: "stickman.gif" + playing: false +} diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp index 262ddda..484fd1a 100644 --- a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp +++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp @@ -44,7 +44,7 @@ #include <QtDeclarative/qmlview.h> #include <private/qmlgraphicsrectangle_p.h> #include <private/qmlgraphicsimage_p.h> -#include <private/qmlgraphicsanimatedimageitem_p.h> +#include <private/qmlgraphicsanimatedimage_p.h> class tst_animatedimage : public QObject { @@ -55,6 +55,7 @@ public: private slots: void play(); void pause(); + void stopped(); void setFrame(); void frameCount(); }; @@ -63,34 +64,61 @@ void tst_animatedimage::play() { QmlEngine engine; QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickman.qml")); - QmlGraphicsAnimatedImageItem *anim = qobject_cast<QmlGraphicsAnimatedImageItem *>(component.create()); + QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); + + delete anim; } void tst_animatedimage::pause() { QmlEngine engine; QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanpause.qml")); - QmlGraphicsAnimatedImageItem *anim = qobject_cast<QmlGraphicsAnimatedImageItem *>(component.create()); + QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); QVERIFY(anim->isPaused()); + + delete anim; +} + +void tst_animatedimage::stopped() +{ + QmlEngine engine; + QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanstopped.qml")); + QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); + QVERIFY(anim); + QVERIFY(!anim->isPlaying()); + QCOMPARE(anim->currentFrame(), 0); + + delete anim; } void tst_animatedimage::setFrame() { QmlEngine engine; QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanpause.qml")); - QmlGraphicsAnimatedImageItem *anim = qobject_cast<QmlGraphicsAnimatedImageItem *>(component.create()); + QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); QVERIFY(anim); QVERIFY(anim->isPlaying()); QCOMPARE(anim->currentFrame(), 2); + + delete anim; } void tst_animatedimage::frameCount() { - // GIF doesn't support frameCount until first pass through + QmlEngine engine; + QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/colors.qml")); + QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); + QVERIFY(anim); + QVERIFY(anim->isPlaying()); + QCOMPARE(anim->frameCount(), 0); // GIF doesn't support frameCount until first pass through + QTest::qWait(600 + 100); + QCOMPARE(anim->frameCount(), 3); + + delete anim; } QTEST_MAIN(tst_animatedimage) |