Merge remote-tracking branch 'origin/5.5' into 5.6

Change-Id: I01940fe4f3d059fbb425492a1748e2b5d9b6804b
This commit is contained in:
Liang Qi
2016-01-19 09:50:11 +01:00
6 changed files with 8 additions and 10 deletions

View File

@@ -353,7 +353,8 @@ void PrivateSoundSource::stateChanged(QAudio::State state)
#ifdef QT_QAUDIO_DEBUG #ifdef QT_QAUDIO_DEBUG
qDebug() << this << "stateChanged " << state; qDebug() << this << "stateChanged " << state;
#endif #endif
if (state == QAudio::IdleState && m_runningCount == 0) if ((state == QAudio::IdleState && m_runningCount == 0)
|| (state == QAudio::StoppedState && m_audioOutput->error() != QAudio::NoError))
emit soundeffect->stop(); emit soundeffect->stop();
} }

View File

@@ -90,7 +90,7 @@ void QT_WIN_CALLBACK QWindowsAudioInput::waveInProc( HWAVEIN hWaveIn, UINT uMsg,
if(!qAudio) if(!qAudio)
return; return;
QMutexLocker(&qAudio->mutex); QMutexLocker locker(&qAudio->mutex);
switch(uMsg) { switch(uMsg) {
case WIM_OPEN: case WIM_OPEN:

View File

@@ -90,7 +90,7 @@ void CALLBACK QWindowsAudioOutput::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
if(!qAudio) if(!qAudio)
return; return;
QMutexLocker(&qAudio->mutex); QMutexLocker locker(&qAudio->mutex);
switch(uMsg) { switch(uMsg) {
case WOM_OPEN: case WOM_OPEN:

View File

@@ -702,11 +702,11 @@ void tst_QAudioOutput::push()
QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after receiving data"); QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after receiving data");
QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after receiving data"); QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after receiving data");
firstBuffer = false; firstBuffer = false;
stateSignal.clear();
} }
} else } else
QTest::qWait(20); QTest::qWait(20);
} }
stateSignal.clear();
// Wait until playback finishes // Wait until playback finishes
QTest::qWait(3000); // 3 seconds should be plenty QTest::qWait(3000); // 3 seconds should be plenty

View File

@@ -134,7 +134,6 @@ Item {
verify(sound1.muted == false) verify(sound1.muted == false)
verify(sound1.playing == false) verify(sound1.playing == false)
verify(sound1.status == 1) // Status.Loading verify(sound1.status == 1) // Status.Loading
verify(sound1.category == "")
} }
function test_muting() { function test_muting() {

View File

@@ -150,8 +150,7 @@ void tst_QSoundEffect::testLooping()
QCOMPARE(readSignal_Remaining.count(), 0); QCOMPARE(readSignal_Remaining.count(), 0);
sound->play(); sound->play();
QCOMPARE(sound->loopsRemaining(), 5); QVERIFY(readSignal_Remaining.count() > 0);
QCOMPARE(readSignal_Remaining.count(), 1);
// test.wav is about 200ms, wait until it has finished playing 5 times // test.wav is about 200ms, wait until it has finished playing 5 times
QTestEventLoop::instance().enterLoop(3); QTestEventLoop::instance().enterLoop(3);
@@ -172,11 +171,10 @@ void tst_QSoundEffect::testLooping()
QCOMPARE(readSignal_Remaining.count(), 0); QCOMPARE(readSignal_Remaining.count(), 0);
sound->play(); sound->play();
QCOMPARE(sound->loopsRemaining(), 30); QVERIFY(readSignal_Remaining.count() > 0);
QCOMPARE(readSignal_Remaining.count(), 1);
// wait for the sound to be played several times // wait for the sound to be played several times
QTRY_COMPARE(sound->loopsRemaining(), 20); QTRY_VERIFY(sound->loopsRemaining() <= 20);
QVERIFY(readSignal_Remaining.count() >= 10); QVERIFY(readSignal_Remaining.count() >= 10);
readSignal_Count.clear(); readSignal_Count.clear();
readSignal_Remaining.clear(); readSignal_Remaining.clear();