summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2009-11-05 04:18:38 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2009-11-10 03:55:12 (GMT)
commit75fb85bbf1b2dc473f99da72124daa65c5839e01 (patch)
tree83975d52d8430270372400c922f9764d5f7adbf6 /tests/auto
parent74d3a4bf9654c8bbe9139951cc5c9352015438a6 (diff)
downloadQt-75fb85bbf1b2dc473f99da72124daa65c5839e01.zip
Qt-75fb85bbf1b2dc473f99da72124daa65c5839e01.tar.gz
Qt-75fb85bbf1b2dc473f99da72124daa65c5839e01.tar.bz2
Changes to low-level audio API.
QAudioFormat::isNull() -> QAudioFormat::isValid() (inverse logic) QAudio::SuspendState -> QAudio::SuspendedState QAudio::StopState -> QAudio::StoppedState QAudioDeviceInfo::deviceList() -> QAudioDeviceInfo::availableDevices() clock() -> elapsedUSecs() totalTime() -> processedUSecs() QIODevice* start(QIODevice*) -> void start(QIODevice*), QIODevice* start() Reviewed-by:Justin McPherson
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp6
-rw-r--r--tests/auto/qaudioformat/tst_qaudioformat.cpp15
-rw-r--r--tests/auto/qaudioinput/tst_qaudioinput.cpp14
-rw-r--r--tests/auto/qaudiooutput/tst_qaudiooutput.cpp18
4 files changed, 28 insertions, 25 deletions
diff --git a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
index 7b9a422..715f219 100644
--- a/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
+++ b/tests/auto/qaudiodeviceinfo/tst_qaudiodeviceinfo.cpp
@@ -77,7 +77,7 @@ private:
void tst_QAudioDeviceInfo::initTestCase()
{
// Only perform tests if audio output device exists!
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput);
+ QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
if(devices.size() > 0)
available = true;
else {
@@ -90,7 +90,7 @@ void tst_QAudioDeviceInfo::checkAvailableDefaultInput()
{
// Only perform tests if audio input device exists!
bool storeAvailable = available;
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput);
+ QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
if(devices.size() > 0)
available = true;
else {
@@ -111,7 +111,7 @@ void tst_QAudioDeviceInfo::checkAvailableDefaultOutput()
void tst_QAudioDeviceInfo::outputList()
{
if(available) {
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput);
+ QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
QVERIFY(devices.size() > 0);
device = new QAudioDeviceInfo(devices.at(0));
}
diff --git a/tests/auto/qaudioformat/tst_qaudioformat.cpp b/tests/auto/qaudioformat/tst_qaudioformat.cpp
index 286e63f..0778a8e 100644
--- a/tests/auto/qaudioformat/tst_qaudioformat.cpp
+++ b/tests/auto/qaudioformat/tst_qaudioformat.cpp
@@ -69,17 +69,20 @@ private slots:
void tst_QAudioFormat::checkNull()
{
- // Default constructed QAudioFormat is null.
+ // Default constructed QAudioFormat is invalid.
QAudioFormat audioFormat0;
- QVERIFY(audioFormat0.isNull());
+ QVERIFY(!audioFormat0.isValid());
- // Null is transferred
+ // validity is transferred
QAudioFormat audioFormat1(audioFormat0);
- QVERIFY(audioFormat1.isNull());
+ QVERIFY(!audioFormat1.isValid());
- // Null is voided on activity
audioFormat0.setFrequency(44100);
- QVERIFY(!audioFormat0.isNull());
+ audioFormat0.setChannels(2);
+ audioFormat0.setSampleSize(16);
+ audioFormat0.setCodec("audio/pcm");
+ audioFormat0.setSampleType(QAudioFormat::SignedInt);
+ QVERIFY(audioFormat0.isValid());
}
void tst_QAudioFormat::checkFrequency()
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
index 3efc346..744ce38 100644
--- a/tests/auto/qaudioinput/tst_qaudioinput.cpp
+++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp
@@ -76,7 +76,7 @@ void tst_QAudioInput::initTestCase()
format.setSampleType(QAudioFormat::UnSignedInt);
// Only perform tests if audio input device exists!
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioInput);
+ QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
if(devices.size() > 0)
available = true;
else {
@@ -137,16 +137,16 @@ void tst_QAudioInput::pullFile()
QSignalSpy stateSignal(audio, SIGNAL(stateChanged(QAudio::State)));
// Always have default states, before start
- QVERIFY(audio->state() == QAudio::StopState);
+ QVERIFY(audio->state() == QAudio::StoppedState);
QVERIFY(audio->error() == QAudio::NoError);
- QVERIFY(audio->clock() == 0);
+ QVERIFY(audio->elapsedUSecs() == 0);
audio->start(&filename);
QTest::qWait(20);
// Check state and periodSize() are valid non-zero values.
QVERIFY(audio->state() == QAudio::ActiveState);
QVERIFY(audio->error() == QAudio::NoError);
- QVERIFY(audio->clock() > 10000 && audio->clock() < 800000);
+ QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000);
QVERIFY(audio->periodSize() > 0);
QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
@@ -154,12 +154,12 @@ void tst_QAudioInput::pullFile()
QTest::qWait(5000);
QVERIFY(readSignal.count() > 0);
- QVERIFY(audio->totalTime() > 0);
+ QVERIFY(audio->processedUSecs() > 0);
audio->stop();
QTest::qWait(20);
- QVERIFY(audio->state() == QAudio::StopState);
- QVERIFY(audio->clock() == 0);
+ QVERIFY(audio->state() == QAudio::StoppedState);
+ QVERIFY(audio->elapsedUSecs() == 0);
// Can only check to make sure we got at least 1 more signal, but can be more.
QVERIFY(stateSignal.count() > 1);
diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
index b001af1..26694cc 100644
--- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
+++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
@@ -79,7 +79,7 @@ void tst_QAudioOutput::initTestCase()
format.setSampleType(QAudioFormat::UnSignedInt);
// Only perform tests if audio output device exists!
- QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::deviceList(QAudio::AudioOutput);
+ QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
if(devices.size() > 0)
available = true;
else {
@@ -140,9 +140,9 @@ void tst_QAudioOutput::pullFile()
audio->setNotifyInterval(100);
// Always have default states, before start
- QVERIFY(audio->state() == QAudio::StopState);
+ QVERIFY(audio->state() == QAudio::StoppedState);
QVERIFY(audio->error() == QAudio::NoError);
- QVERIFY(audio->clock() == 0);
+ QVERIFY(audio->elapsedUSecs() == 0);
audio->start(&file);
QTest::qWait(20); // wait 20ms
@@ -150,12 +150,12 @@ void tst_QAudioOutput::pullFile()
QVERIFY(audio->state() == QAudio::ActiveState);
QVERIFY(audio->error() == QAudio::NoError);
QVERIFY(audio->periodSize() > 0);
- QVERIFY(audio->clock() > 10000 && audio->clock() < 800000);
+ QVERIFY(audio->elapsedUSecs() > 10000 && audio->elapsedUSecs() < 800000);
QVERIFY(stateSignal.count() == 1); // State changed to QAudio::ActiveState
// Wait until finished...
QTestEventLoop::instance().enterLoop(1);
- QCOMPARE(audio->totalTime(), qint64(692250));
+ QCOMPARE(audio->processedUSecs(), qint64(692250));
#ifdef Q_OS_WINCE
// 4.wav is a little less than 700ms, so notify should fire 4 times on Wince!
@@ -166,8 +166,8 @@ void tst_QAudioOutput::pullFile()
#endif
audio->stop();
QTest::qWait(20); // wait 20ms
- QVERIFY(audio->state() == QAudio::StopState);
- QVERIFY(audio->clock() == 0);
+ QVERIFY(audio->state() == QAudio::StoppedState);
+ QVERIFY(audio->elapsedUSecs() == 0);
// Can only check to make sure we got at least 1 more signal, but can be more.
QVERIFY(stateSignal.count() > 1);
@@ -184,7 +184,7 @@ void tst_QAudioOutput::pushFile()
const qint64 fileSize = file.size();
- QIODevice* feed = audio->start(0);
+ QIODevice* feed = audio->start();
char* buffer = new char[fileSize];
file.read(buffer, fileSize);
@@ -199,7 +199,7 @@ void tst_QAudioOutput::pushFile()
QTestEventLoop::instance().enterLoop(1);
QVERIFY(written == fileSize);
- QVERIFY(audio->totalTime() == 692250);
+ QVERIFY(audio->processedUSecs() == 692250);
audio->stop();
file.close();