diff options
Diffstat (limited to 'tests/auto/integration')
-rwxr-xr-x | tests/auto/integration/qaudioinput/tst_qaudioinput.cpp | 27 |
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" |