diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-19 07:37:06 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-03-19 07:37:06 (GMT) |
commit | 71dedbee1f5a23411e2c82157a6fe6ee5d48ab6e (patch) | |
tree | 67cc84ebcc6342e4b50432b009f21e832efb5f85 /tests | |
parent | b6e874a0f56e1d81cc2ad355d3dc9e92fd96ddd2 (diff) | |
parent | ace866a969cd438b9f1dc11b7d40a99f53a13009 (diff) | |
download | Qt-71dedbee1f5a23411e2c82157a6fe6ee5d48ab6e.zip Qt-71dedbee1f5a23411e2c82157a6fe6ee5d48ab6e.tar.gz Qt-71dedbee1f5a23411e2c82157a6fe6ee5d48ab6e.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-multimedia-staging:
Add autoLoad property to multimedia declarative elements.
Fix; QML Video item is sensitive to property assignment order
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp | 94 | ||||
-rw-r--r-- | tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp | 38 |
2 files changed, 97 insertions, 35 deletions
diff --git a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp index d750c69..a215bd5 100644 --- a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp +++ b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp @@ -61,6 +61,7 @@ private slots: void nullService(); void source(); + void autoLoad(); void playing(); void paused(); void duration(); @@ -298,11 +299,12 @@ void tst_QmlAudio::nullPlayerControl() QCOMPARE(audio.source(), QUrl()); audio.setSource(QUrl("http://example.com")); - QCOMPARE(audio.source(), QUrl()); + QCOMPARE(audio.source(), QUrl("http://example.com")); QCOMPARE(audio.isPlaying(), false); audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPlaying(), true); + audio.setPlaying(false); audio.play(); QCOMPARE(audio.isPlaying(), false); @@ -316,15 +318,15 @@ void tst_QmlAudio::nullPlayerControl() QCOMPARE(audio.position(), 0); audio.setPosition(10000); - QCOMPARE(audio.position(), 0); + QCOMPARE(audio.position(), 10000); - QCOMPARE(audio.volume(), qreal(0)); - audio.setVolume(50); - QCOMPARE(audio.volume(), qreal(0)); + QCOMPARE(audio.volume(), qreal(1.0)); + audio.setVolume(0.5); + QCOMPARE(audio.volume(), qreal(0.5)); QCOMPARE(audio.isMuted(), false); audio.setMuted(true); - QCOMPARE(audio.isMuted(), false); + QCOMPARE(audio.isMuted(), true); QCOMPARE(audio.bufferProgress(), qreal(0)); @@ -357,11 +359,12 @@ void tst_QmlAudio::nullService() QCOMPARE(audio.source(), QUrl()); audio.setSource(QUrl("http://example.com")); - QCOMPARE(audio.source(), QUrl()); + QCOMPARE(audio.source(), QUrl("http://example.com")); QCOMPARE(audio.isPlaying(), false); audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPlaying(), true); + audio.setPlaying(false); audio.play(); QCOMPARE(audio.isPlaying(), false); @@ -375,15 +378,15 @@ void tst_QmlAudio::nullService() QCOMPARE(audio.position(), 0); audio.setPosition(10000); - QCOMPARE(audio.position(), 0); + QCOMPARE(audio.position(), 10000); - QCOMPARE(audio.volume(), qreal(0)); - audio.setVolume(50); - QCOMPARE(audio.volume(), qreal(0)); + QCOMPARE(audio.volume(), qreal(1.0)); + audio.setVolume(0.5); + QCOMPARE(audio.volume(), qreal(0.5)); QCOMPARE(audio.isMuted(), false); audio.setMuted(true); - QCOMPARE(audio.isMuted(), false); + QCOMPARE(audio.isMuted(), true); QCOMPARE(audio.bufferProgress(), qreal(0)); @@ -408,6 +411,7 @@ void tst_QmlAudio::source() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); QSignalSpy spy(&audio, SIGNAL(sourceChanged())); @@ -427,6 +431,33 @@ void tst_QmlAudio::source() QCOMPARE(spy.count(), 3); } +void tst_QmlAudio::autoLoad() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + audio.componentComplete(); + + QSignalSpy spy(&audio, SIGNAL(autoLoadChanged())); + + QCOMPARE(audio.isAutoLoad(), true); + + audio.setAutoLoad(false); + QCOMPARE(audio.isAutoLoad(), false); + QCOMPARE(spy.count(), 1); + + audio.setSource(QUrl("http://example.com")); + QCOMPARE(audio.source(), QUrl("http://example.com")); + audio.play(); + QCOMPARE(audio.isPlaying(), true); + audio.stop(); + + audio.setAutoLoad(true); + audio.setSource(QUrl("http://example.com")); + audio.setPaused(true); + QCOMPARE(spy.count(), 2); + QCOMPARE(audio.isPaused(), true); +} + void tst_QmlAudio::playing() { QtTestMediaServiceProvider provider; @@ -440,6 +471,8 @@ void tst_QmlAudio::playing() int started = 0; int stopped = 0; + audio.componentComplete(); + QCOMPARE(audio.isPlaying(), false); // setPlaying(true) when stopped. @@ -533,6 +566,8 @@ void tst_QmlAudio::paused() int resumed = 0; int stopped = 0; + audio.componentComplete(); + QCOMPARE(audio.isPlaying(), false); QCOMPARE(audio.isPaused(), false); @@ -806,6 +841,8 @@ void tst_QmlAudio::duration() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(durationChanged())); QCOMPARE(audio.duration(), 0); @@ -832,6 +869,7 @@ void tst_QmlAudio::position() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); QSignalSpy spy(&audio, SIGNAL(positionChanged())); @@ -853,32 +891,33 @@ void tst_QmlAudio::position() audio.setPosition(-5403); QCOMPARE(audio.position(), -5403); QCOMPARE(provider.playerControl()->position(), qint64(-5403)); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.count(), 2); // Check the signal change signal is emitted if the change originates from the media service. provider.playerControl()->setPosition(0); QCOMPARE(audio.position(), 0); - QCOMPARE(spy.count(), 4); + QCOMPARE(spy.count(), 3); connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop())); provider.playerControl()->updateState(QMediaPlayer::PlayingState); QTestEventLoop::instance().enterLoop(1); - QVERIFY(spy.count() > 4 && spy.count() < 7); // 5 or 6 + QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5 provider.playerControl()->updateState(QMediaPlayer::PausedState); QTestEventLoop::instance().enterLoop(1); - QVERIFY(spy.count() < 7); + QVERIFY(spy.count() < 6); } void tst_QmlAudio::volume() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); QSignalSpy spy(&audio, SIGNAL(volumeChanged())); - QCOMPARE(audio.volume(), qreal(0.5)); + QCOMPARE(audio.volume(), qreal(1.0)); audio.setVolume(0.7); QCOMPARE(audio.volume(), qreal(0.7)); @@ -888,17 +927,18 @@ void tst_QmlAudio::volume() audio.setVolume(0.7); QCOMPARE(audio.volume(), qreal(0.7)); QCOMPARE(provider.playerControl()->volume(), 70); - QCOMPARE(spy.count(), 2); + QCOMPARE(spy.count(), 1); provider.playerControl()->setVolume(30); QCOMPARE(audio.volume(), qreal(0.3)); - QCOMPARE(spy.count(), 3); + QCOMPARE(spy.count(), 2); } void tst_QmlAudio::muted() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); QSignalSpy spy(&audio, SIGNAL(mutedChanged())); @@ -924,6 +964,8 @@ void tst_QmlAudio::bufferProgress() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(bufferProgressChanged())); QCOMPARE(audio.bufferProgress(), qreal(0.0)); @@ -957,6 +999,8 @@ void tst_QmlAudio::seekable() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(seekableChanged())); QCOMPARE(audio.isSeekable(), false); @@ -979,6 +1023,8 @@ void tst_QmlAudio::playbackRate() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(playbackRateChanged())); QCOMPARE(audio.playbackRate(), qreal(1.0)); @@ -1003,6 +1049,8 @@ void tst_QmlAudio::status() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy statusChangedSpy(&audio, SIGNAL(statusChanged())); QSignalSpy loadedSpy(&audio, SIGNAL(loaded())); QSignalSpy bufferingSpy(&audio, SIGNAL(buffering())); @@ -1141,6 +1189,8 @@ void tst_QmlAudio::metaData() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(__metaDataChanged())); const int index = audio.metaObject()->indexOfProperty(propertyName.constData()); @@ -1166,6 +1216,8 @@ void tst_QmlAudio::error() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy errorSpy(&audio, SIGNAL(error(QDeclarativeAudio::Error,QString))); QSignalSpy errorChangedSpy(&audio, SIGNAL(errorChanged())); diff --git a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp index 5fd3675..56dce28 100644 --- a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp +++ b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp @@ -304,11 +304,12 @@ void tst_QmlGraphicsVideo::nullPlayerControl() QCOMPARE(video.source(), QUrl()); video.setSource(QUrl("http://example.com")); - QCOMPARE(video.source(), QUrl()); + QCOMPARE(video.source(), QUrl("http://example.com")); QCOMPARE(video.isPlaying(), false); video.setPlaying(true); - QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPlaying(), true); + video.setPlaying(false); video.play(); QCOMPARE(video.isPlaying(), false); @@ -322,15 +323,15 @@ void tst_QmlGraphicsVideo::nullPlayerControl() QCOMPARE(video.position(), 0); video.setPosition(10000); - QCOMPARE(video.position(), 0); + QCOMPARE(video.position(), 10000); - QCOMPARE(video.volume(), qreal(0)); - video.setVolume(50); - QCOMPARE(video.volume(), qreal(0)); + QCOMPARE(video.volume(), qreal(1.0)); + video.setVolume(0.5); + QCOMPARE(video.volume(), qreal(0.5)); QCOMPARE(video.isMuted(), false); video.setMuted(true); - QCOMPARE(video.isMuted(), false); + QCOMPARE(video.isMuted(), true); QCOMPARE(video.bufferProgress(), qreal(0)); @@ -354,11 +355,12 @@ void tst_QmlGraphicsVideo::nullService() QCOMPARE(video.source(), QUrl()); video.setSource(QUrl("http://example.com")); - QCOMPARE(video.source(), QUrl()); + QCOMPARE(video.source(), QUrl("http://example.com")); QCOMPARE(video.isPlaying(), false); video.setPlaying(true); - QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPlaying(), true); + video.setPlaying(false); video.play(); QCOMPARE(video.isPlaying(), false); @@ -372,15 +374,15 @@ void tst_QmlGraphicsVideo::nullService() QCOMPARE(video.position(), 0); video.setPosition(10000); - QCOMPARE(video.position(), 0); + QCOMPARE(video.position(), 10000); - QCOMPARE(video.volume(), qreal(0)); - video.setVolume(50); - QCOMPARE(video.volume(), qreal(0)); + QCOMPARE(video.volume(), qreal(1.0)); + video.setVolume(0.5); + QCOMPARE(video.volume(), qreal(0.5)); QCOMPARE(video.isMuted(), false); video.setMuted(true); - QCOMPARE(video.isMuted(), false); + QCOMPARE(video.isMuted(), true); QCOMPARE(video.bufferProgress(), qreal(0)); @@ -404,6 +406,7 @@ void tst_QmlGraphicsVideo::playing() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; + video.componentComplete(); QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged())); QSignalSpy startedSpy(&video, SIGNAL(started())); @@ -491,6 +494,7 @@ void tst_QmlGraphicsVideo::paused() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; + video.componentComplete(); QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged())); QSignalSpy pausedChangedSpy(&video, SIGNAL(pausedChanged())); @@ -780,6 +784,7 @@ void tst_QmlGraphicsVideo::error() QtTestMediaServiceProvider provider; QDeclarativeVideo video; + video.componentComplete(); QSignalSpy errorSpy(&video, SIGNAL(error(QDeclarativeVideo::Error,QString))); QSignalSpy errorChangedSpy(&video, SIGNAL(errorChanged())); @@ -814,6 +819,7 @@ void tst_QmlGraphicsVideo::hasAudio() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; + video.componentComplete(); QSignalSpy spy(&video, SIGNAL(hasAudioChanged())); @@ -837,6 +843,8 @@ void tst_QmlGraphicsVideo::hasVideo() QtTestMediaServiceProvider provider; QDeclarativeVideo video; + video.componentComplete(); + QSignalSpy spy(&video, SIGNAL(hasVideoChanged())); QCOMPARE(video.hasVideo(), false); @@ -858,6 +866,7 @@ void tst_QmlGraphicsVideo::fillMode() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; + video.componentComplete(); QList<QGraphicsItem *> children = video.childItems(); QCOMPARE(children.count(), 1); @@ -883,6 +892,7 @@ void tst_QmlGraphicsVideo::geometry() { QtTestMediaServiceProvider provider; QDeclarativeVideo video; + video.componentComplete(); QAbstractVideoSurface *surface = provider.rendererControl()->surface(); QVERIFY(surface != 0); |