Fix tst_QAudioOutput::pushSuspendResume().

Documentation states that state in push mode after suspend and resume
should be QAudio::IdleState.

Task-number: QTBUG-50390
Change-Id: I214f1808948ce862b62afd0fb9d245d0c7e4ad26
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@theqtcompany.com>
This commit is contained in:
Pasi Petäjäjärvi
2016-01-11 13:52:50 +02:00
committed by Yoann Lopes
parent e126dbb6fb
commit 42dc973881

View File

@@ -825,10 +825,10 @@ void tst_QAudioOutput::pushSuspendResume()
// but not too much or the rest of the file may be processed // but not too much or the rest of the file may be processed
QTest::qWait(20); QTest::qWait(20);
// Check that QAudioOutput immediately transitions to ActiveState // Check that QAudioOutput immediately transitions to IdleState
QVERIFY2((stateSignal.count() == 1), QVERIFY2((stateSignal.count() == 1),
QString("didn't emit signal after resume(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData()); QString("didn't emit signal after resume(), got %1 signals instead").arg(stateSignal.count()).toLocal8Bit().constData());
QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after resume()"); QVERIFY2((audioOutput.state() == QAudio::IdleState), "didn't transition to IdleState after resume()");
QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after resume()"); QVERIFY2((audioOutput.error() == QAudio::NoError), "error state is not equal to QAudio::NoError after resume()");
stateSignal.clear(); stateSignal.clear();
@@ -837,6 +837,7 @@ void tst_QAudioOutput::pushSuspendResume()
if (audioOutput.bytesFree() >= audioOutput.periodSize()) { if (audioOutput.bytesFree() >= audioOutput.periodSize()) {
qint64 len = audioFile->read(buffer.data(),audioOutput.periodSize()); qint64 len = audioFile->read(buffer.data(),audioOutput.periodSize());
written += feed->write(buffer.constData(), len); written += feed->write(buffer.constData(), len);
QVERIFY2((audioOutput.state() == QAudio::ActiveState), "didn't transition to ActiveState after writing audio data");
} else } else
QTest::qWait(20); QTest::qWait(20);
} }