From 3ee6d65377cb563d49d81c3adac0523e4ae8a0b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Otto=20Ryyn=C3=A4nen?= Date: Wed, 23 May 2018 09:10:34 +0300 Subject: Add a support for selecting the output device used by QSoundEffect The QSoundEffect can be forced to use a specific audio output device. This is useful on a system with multiple output devices as individual QSoundeffects can use separate output devices. Due to way QAudioOutput (alternate implementation behind QSoundEffect) is implemented, QAudioDeviceInfo is used as a method of defining the output device to be used. Task-number: QTBUG-63596 Change-Id: Ibfb9894fec914726faee4e31c42ab08832693cf6 Reviewed-by: VaL Doroshchuk --- tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp') diff --git a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp index fa98c8b16..7cbd57007 100644 --- a/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp +++ b/tests/auto/integration/qsoundeffect/tst_qsoundeffect.cpp @@ -60,6 +60,7 @@ private slots: void testSetSourceWhileLoading(); void testSetSourceWhilePlaying(); + void testSupportedMimeTypes_data(); void testSupportedMimeTypes(); void testCorruptFile(); void testPlaying24Bits(); @@ -387,9 +388,19 @@ void tst_QSoundEffect::testSetSourceWhilePlaying() } } +void tst_QSoundEffect::testSupportedMimeTypes_data() +{ + // Verify also passing of audio device info as parameter + QTest::addColumn("instance"); + QTest::newRow("without QAudioDeviceInfo") << sound; + QAudioDeviceInfo deviceInfo(QAudioDeviceInfo::defaultOutputDevice()); + QTest::newRow("with QAudioDeviceInfo") << new QSoundEffect(deviceInfo, this); +} + void tst_QSoundEffect::testSupportedMimeTypes() { - QStringList mimeTypes = sound->supportedMimeTypes(); + QFETCH(QSoundEffect*, instance); + QStringList mimeTypes = instance->supportedMimeTypes(); QVERIFY(!mimeTypes.empty()); QVERIFY(mimeTypes.indexOf(QLatin1String("audio/wav")) != -1 || mimeTypes.indexOf(QLatin1String("audio/x-wav")) != -1 || -- cgit v1.2.3