summaryrefslogtreecommitdiffstats
path: root/tests/auto/declarative/animatedimage
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-11-03 05:31:07 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-11-03 05:32:28 (GMT)
commitc8be1c487994fda855b9f2dc7c005db4686981c0 (patch)
tree2629236ce0cbfdc94ac454a14368f0a46bca42d7 /tests/auto/declarative/animatedimage
parent43c15688888b433d6d3c01c0d68168fec81cf06a (diff)
downloadQt-c8be1c487994fda855b9f2dc7c005db4686981c0.zip
Qt-c8be1c487994fda855b9f2dc7c005db4686981c0.tar.gz
Qt-c8be1c487994fda855b9f2dc7c005db4686981c0.tar.bz2
Get AnimatedImage + autotests working again.
There are still failures, but at least the tests no longer crash.
Diffstat (limited to 'tests/auto/declarative/animatedimage')
-rw-r--r--tests/auto/declarative/animatedimage/tst_animatedimage.cpp38
1 files changed, 22 insertions, 16 deletions
diff --git a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp
index f6141cb..6ae2112 100644
--- a/tests/auto/declarative/animatedimage/tst_animatedimage.cpp
+++ b/tests/auto/declarative/animatedimage/tst_animatedimage.cpp
@@ -61,34 +61,40 @@ private slots:
void tst_animatedimage::play()
{
- QmlGraphicsAnimatedImageItem anim;
- anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
- QVERIFY(anim.isPlaying());
+ QmlEngine engine;
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickman.qml"));
+ QmlGraphicsAnimatedImageItem *anim = qobject_cast<QmlGraphicsAnimatedImageItem *>(component.create());
+ QVERIFY(anim);
+ QVERIFY(anim->isPlaying());
}
void tst_animatedimage::pause()
{
- QmlGraphicsAnimatedImageItem anim;
- anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
- anim.setPaused(true);
- QVERIFY(!anim.isPlaying());
+ QmlEngine engine;
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanpause.qml"));
+ QmlGraphicsAnimatedImageItem *anim = qobject_cast<QmlGraphicsAnimatedImageItem *>(component.create());
+ QVERIFY(anim);
+ QVERIFY(anim->isPlaying());
+ QVERIFY(anim->isPaused());
}
void tst_animatedimage::setFrame()
{
- QmlGraphicsAnimatedImageItem anim;
- anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
- anim.setPaused(true);
- QVERIFY(!anim.isPlaying());
- anim.setCurrentFrame(2);
- QCOMPARE(anim.currentFrame(), 2);
+ QmlEngine engine;
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickmanpause.qml"));
+ QmlGraphicsAnimatedImageItem *anim = qobject_cast<QmlGraphicsAnimatedImageItem *>(component.create());
+ QVERIFY(anim);
+ QVERIFY(anim->isPlaying());
+ QCOMPARE(anim->currentFrame(), 2);
}
void tst_animatedimage::frameCount()
{
- QmlGraphicsAnimatedImageItem anim;
- anim.setSource(QUrl("file://" SRCDIR "/data/stickman.gif"));
- QCOMPARE(anim.frameCount(), 299);
+ QmlEngine engine;
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/data/stickman.qml"));
+ QmlGraphicsAnimatedImageItem *anim = qobject_cast<QmlGraphicsAnimatedImageItem *>(component.create());
+ QVERIFY(anim);
+ QCOMPARE(anim->frameCount(), 299);
}
QTEST_MAIN(tst_animatedimage)