diff options
author | Justin McPherson <justin.mcpherson@nokia.com> | 2010-03-19 02:56:15 (GMT) |
---|---|---|
committer | Justin McPherson <justin.mcpherson@nokia.com> | 2010-03-19 05:31:59 (GMT) |
commit | 0d4572595698502e04f491bfea3e16bb1851b645 (patch) | |
tree | 3e5545fdf75012a6f899bf4839f4b1556ab9e7e2 /tests/auto/qdeclarativeaudio | |
parent | abf09f87af8f57f670904ff25a626d19ec11120b (diff) | |
download | Qt-0d4572595698502e04f491bfea3e16bb1851b645.zip Qt-0d4572595698502e04f491bfea3e16bb1851b645.tar.gz Qt-0d4572595698502e04f491bfea3e16bb1851b645.tar.bz2 |
Fix; QML Video item is sensitive to property assignment order
Task-number: QTBUG-8605
Reviewed-by: Andrew den Exter
Diffstat (limited to 'tests/auto/qdeclarativeaudio')
-rw-r--r-- | tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp | 66 |
1 files changed, 45 insertions, 21 deletions
diff --git a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp index d750c69..a604854 100644 --- a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp +++ b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp @@ -298,11 +298,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 +317,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 +358,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 +377,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 +410,7 @@ void tst_QmlAudio::source() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); QSignalSpy spy(&audio, SIGNAL(sourceChanged())); @@ -440,6 +443,8 @@ void tst_QmlAudio::playing() int started = 0; int stopped = 0; + audio.componentComplete(); + QCOMPARE(audio.isPlaying(), false); // setPlaying(true) when stopped. @@ -533,6 +538,8 @@ void tst_QmlAudio::paused() int resumed = 0; int stopped = 0; + audio.componentComplete(); + QCOMPARE(audio.isPlaying(), false); QCOMPARE(audio.isPaused(), false); @@ -806,6 +813,8 @@ void tst_QmlAudio::duration() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(durationChanged())); QCOMPARE(audio.duration(), 0); @@ -832,6 +841,7 @@ void tst_QmlAudio::position() { QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); QSignalSpy spy(&audio, SIGNAL(positionChanged())); @@ -853,32 +863,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 +899,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 +936,8 @@ void tst_QmlAudio::bufferProgress() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(bufferProgressChanged())); QCOMPARE(audio.bufferProgress(), qreal(0.0)); @@ -957,6 +971,8 @@ void tst_QmlAudio::seekable() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(seekableChanged())); QCOMPARE(audio.isSeekable(), false); @@ -979,6 +995,8 @@ void tst_QmlAudio::playbackRate() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy spy(&audio, SIGNAL(playbackRateChanged())); QCOMPARE(audio.playbackRate(), qreal(1.0)); @@ -1003,6 +1021,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 +1161,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 +1188,8 @@ void tst_QmlAudio::error() QtTestMediaServiceProvider provider; QDeclarativeAudio audio; + audio.componentComplete(); + QSignalSpy errorSpy(&audio, SIGNAL(error(QDeclarativeAudio::Error,QString))); QSignalSpy errorChangedSpy(&audio, SIGNAL(errorChanged())); |