summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-01-25 13:50:37 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-25 07:18:48 +0100
commit3b00730ecaeb4f780b897c3f0683c1d449e7c6c7 (patch)
tree66fd49c3bf021e4199935d7ab1fcc096ab24fd24 /tests
parent8aef60c1cf3897053a68498db414b91c00eec0fa (diff)
Add a volume (gain) property to QAudioInput.
Only implemented for PulseAudio so far, but the API does explain that it's optional. Change-Id: I4543a1c81d810fe92bb08f1ed13f3a3534a371e4 Reviewed-by: Ling Hu <ling.hu@nokia.com>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/auto/integration/qaudioinput/tst_qaudioinput.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp b/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp
index fafb7e40e..81d0b13a1 100755
--- a/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp
+++ b/tests/auto/integration/qaudioinput/tst_qaudioinput.cpp
@@ -101,6 +101,8 @@ private slots:
void reset();
+ void volume();
+
private:
typedef QSharedPointer<QFile> FilePtr;
@@ -840,6 +842,31 @@ void tst_QAudioInput::reset()
}
}
+void tst_QAudioInput::volume()
+{
+ const qreal half(0.5f);
+ const qreal one(1.0f);
+ // Hard to automatically test, but we can test the get/set a little
+ for (int i=0; i < testFormats.count(); i++) {
+ QAudioInput audioInput(testFormats.at(i), this);
+
+ qreal volume = audioInput.volume();
+ audioInput.setVolume(half);
+ QVERIFY(qFuzzyCompare(audioInput.volume(), half) || qFuzzyCompare(audioInput.volume(), one));
+
+ // Wait a while to see if this changes
+ QTest::qWait(500);
+ QVERIFY(qFuzzyCompare(audioInput.volume(), half) || qFuzzyCompare(audioInput.volume(), one));
+
+ audioInput.setVolume(volume);
+ QVERIFY(qFuzzyCompare(audioInput.volume(), volume));
+
+ // Wait a while to see if this changes
+ QTest::qWait(500);
+ QVERIFY(qFuzzyCompare(audioInput.volume(), volume));
+ }
+}
+
QTEST_MAIN(tst_QAudioInput)
#include "tst_qaudioinput.moc"