summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRohan McGovern <rohan.mcgovern@nokia.com>2010-10-04 03:57:07 (GMT)
committerRohan McGovern <rohan.mcgovern@nokia.com>2010-10-04 03:57:07 (GMT)
commitabcea22c5ba45d00c713d25a77773efbf6d941f7 (patch)
tree9cd98ebad82fc8ef80ff53c47da10f80ec114ffe /tests
parent33b76a659b2f44fa7038e375bbfb4cfd449ae617 (diff)
parente2c45cbacaa0f48e1397572d3e5baa847c86e9b1 (diff)
downloadQt-abcea22c5ba45d00c713d25a77773efbf6d941f7.zip
Qt-abcea22c5ba45d00c713d25a77773efbf6d941f7.tar.gz
Qt-abcea22c5ba45d00c713d25a77773efbf6d941f7.tar.bz2
Merge remote branch 'origin/4.6' into 4.7-from-4.6
Conflicts: src/multimedia/audio/qaudioinput_win32_p.cpp
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qaudioinput/tst_qaudioinput.cpp47
-rw-r--r--tests/auto/qaudiooutput/tst_qaudiooutput.cpp47
2 files changed, 94 insertions, 0 deletions
diff --git a/tests/auto/qaudioinput/tst_qaudioinput.cpp b/tests/auto/qaudioinput/tst_qaudioinput.cpp
index 84c3874..1808b1d 100644
--- a/tests/auto/qaudioinput/tst_qaudioinput.cpp
+++ b/tests/auto/qaudioinput/tst_qaudioinput.cpp
@@ -50,6 +50,8 @@
#define SRCDIR ""
#endif
+Q_DECLARE_METATYPE(QAudioFormat)
+
class tst_QAudioInput : public QObject
{
Q_OBJECT
@@ -58,6 +60,8 @@ public:
private slots:
void initTestCase();
+ void invalidFormat_data();
+ void invalidFormat();
void settings();
void buffers();
void notifyInterval();
@@ -71,6 +75,8 @@ private:
void tst_QAudioInput::initTestCase()
{
+ qRegisterMetaType<QAudioFormat>();
+
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(8);
@@ -91,6 +97,47 @@ void tst_QAudioInput::initTestCase()
audio = new QAudioInput(format, this);
}
+void tst_QAudioInput::invalidFormat_data()
+{
+ QTest::addColumn<QAudioFormat>("invalidFormat");
+
+ QAudioFormat audioFormat;
+
+ QTest::newRow("Null Format")
+ << audioFormat;
+
+ audioFormat = format;
+ audioFormat.setChannels(0);
+ QTest::newRow("Channel count 0")
+ << audioFormat;
+
+ audioFormat = format;
+ audioFormat.setFrequency(0);
+ QTest::newRow("Sample rate 0")
+ << audioFormat;
+
+ audioFormat = format;
+ audioFormat.setSampleSize(0);
+ QTest::newRow("Sample size 0")
+ << audioFormat;
+}
+
+void tst_QAudioInput::invalidFormat()
+{
+ QFETCH(QAudioFormat, invalidFormat);
+
+ QAudioInput audioInput(invalidFormat, this);
+
+ // Check that we are in the default state before calling start
+ QVERIFY2((audioInput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
+ QVERIFY2((audioInput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
+
+ audioInput.start();
+
+ // Check that error is raised
+ QVERIFY2((audioInput.error() == QAudio::OpenError),"error() was not set to QAudio::OpenError after start()");
+}
+
void tst_QAudioInput::settings()
{
if(available) {
diff --git a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
index 437ef5e..e6d11a6 100644
--- a/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
+++ b/tests/auto/qaudiooutput/tst_qaudiooutput.cpp
@@ -52,6 +52,8 @@
#define SRCDIR ""
#endif
+Q_DECLARE_METATYPE(QAudioFormat)
+
class tst_QAudioOutput : public QObject
{
Q_OBJECT
@@ -60,6 +62,8 @@ public:
private slots:
void initTestCase();
+ void invalidFormat_data();
+ void invalidFormat();
void settings();
void buffers();
void notifyInterval();
@@ -74,6 +78,8 @@ private:
void tst_QAudioOutput::initTestCase()
{
+ qRegisterMetaType<QAudioFormat>();
+
format.setFrequency(8000);
format.setChannels(1);
format.setSampleSize(8);
@@ -92,6 +98,47 @@ void tst_QAudioOutput::initTestCase()
audio = new QAudioOutput(format, this);
}
+void tst_QAudioOutput::invalidFormat_data()
+{
+ QTest::addColumn<QAudioFormat>("invalidFormat");
+
+ QAudioFormat audioFormat;
+
+ QTest::newRow("Null Format")
+ << audioFormat;
+
+ audioFormat = format;
+ audioFormat.setChannels(0);
+ QTest::newRow("Channel count 0")
+ << audioFormat;
+
+ audioFormat = format;
+ audioFormat.setFrequency(0);
+ QTest::newRow("Sample rate 0")
+ << audioFormat;
+
+ audioFormat = format;
+ audioFormat.setSampleSize(0);
+ QTest::newRow("Sample size 0")
+ << audioFormat;
+}
+
+void tst_QAudioOutput::invalidFormat()
+{
+ QFETCH(QAudioFormat, invalidFormat);
+
+ QAudioOutput audioOutput(invalidFormat, this);
+
+ // Check that we are in the default state before calling start
+ QVERIFY2((audioOutput.state() == QAudio::StoppedState), "state() was not set to StoppedState before start()");
+ QVERIFY2((audioOutput.error() == QAudio::NoError), "error() was not set to QAudio::NoError before start()");
+
+ audioOutput.start();
+
+ // Check that error is raised
+ QVERIFY2((audioOutput.error() == QAudio::OpenError),"error() was not set to QAudio::OpenError after start()");
+}
+
void tst_QAudioOutput::settings()
{
if(available) {