From ae728a4b1e2a0065bab67b5c3b114ef1c30b674a Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Mon, 16 Jul 2012 11:28:02 +1000 Subject: Replaced endpoint control with audio input and output controls Change-Id: I981aabe39d106ced4ee1240db9e5b653c6fa5e91 Reviewed-by: Michael Goddard --- .../unit/qaudiorecorder/tst_qaudiorecorder.cpp | 10 +- .../tst_qmediabindableinterface.cpp | 2 +- tests/auto/unit/qmediaobject/tst_qmediaobject.cpp | 2 +- .../unit/qmediarecorder/tst_qmediarecorder.cpp | 18 ++-- .../qmultimedia_common/mockaudioendpointselector.h | 117 --------------------- .../qmultimedia_common/mockaudioinputselector.h | 117 +++++++++++++++++++++ .../qmultimedia_common/mockmediarecorderservice.h | 10 +- .../auto/unit/qmultimedia_common/mockrecorder.pri | 2 +- 8 files changed, 139 insertions(+), 139 deletions(-) delete mode 100644 tests/auto/unit/qmultimedia_common/mockaudioendpointselector.h create mode 100644 tests/auto/unit/qmultimedia_common/mockaudioinputselector.h (limited to 'tests') diff --git a/tests/auto/unit/qaudiorecorder/tst_qaudiorecorder.cpp b/tests/auto/unit/qaudiorecorder/tst_qaudiorecorder.cpp index 9ed941cc1..5616607b8 100644 --- a/tests/auto/unit/qaudiorecorder/tst_qaudiorecorder.cpp +++ b/tests/auto/unit/qaudiorecorder/tst_qaudiorecorder.cpp @@ -47,7 +47,7 @@ #include #include #include -#include +#include #include #include #include @@ -171,19 +171,19 @@ void tst_QAudioRecorder::testAvailableAudioInputChangedSignal() // The availabilityChangedSignal is implemented in QAudioRecorder. SO using it to test the signal. audiosource = new QAudioRecorder; - /* Spy the signal availableEndpointChanged and audioInputchanged */ - QSignalSpy changed(mockMediaRecorderService->mockAudioEndpointSelector, SIGNAL(availableEndpointsChanged())); + /* Spy the signal availableInputsChanged and audioInputchanged */ + QSignalSpy changed(mockMediaRecorderService->mockAudioInputSelector, SIGNAL(availableInputsChanged())); QSignalSpy audioInputchange(audiosource, SIGNAL(availableAudioInputsChanged())); /* Add the end points and verify if the available end point changed signal is emitted. */ - QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioEndpointSelector, "addEndpoints"); + QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioInputSelector, "addInputs"); QVERIFY(changed.count() == 1); QVERIFY(audioInputchange.count() == 1); /* Now try removes */ changed.clear(); audioInputchange.clear(); - QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioEndpointSelector, "removeEndpoints"); + QMetaObject::invokeMethod(mockMediaRecorderService->mockAudioInputSelector, "removeInputs"); QVERIFY(changed.count() == 1); QVERIFY(audioInputchange.count() == 1); } diff --git a/tests/auto/unit/qmediabindableinterface/tst_qmediabindableinterface.cpp b/tests/auto/unit/qmediabindableinterface/tst_qmediabindableinterface.cpp index 58e70e23d..530cf35aa 100644 --- a/tests/auto/unit/qmediabindableinterface/tst_qmediabindableinterface.cpp +++ b/tests/auto/unit/qmediabindableinterface/tst_qmediabindableinterface.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp b/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp index 7157e825a..e54d23a1f 100644 --- a/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp +++ b/tests/auto/unit/qmediaobject/tst_qmediaobject.cpp @@ -48,7 +48,7 @@ #include #include #include -#include +#include #include "mockmediarecorderservice.h" #include "mockmediaserviceprovider.h" diff --git a/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp b/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp index 49f7d57a5..b6763fcb9 100644 --- a/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp +++ b/tests/auto/unit/qmediarecorder/tst_qmediarecorder.cpp @@ -49,7 +49,7 @@ #include #include #include -#include +#include #include #include #include @@ -116,7 +116,7 @@ private slots: private: QAudioEncoderSettingsControl* encode; - QAudioEndpointSelectorControl* audio; + QAudioInputSelectorControl* audio; MockMediaObject *object; MockMediaRecorderService*service; MockMediaRecorderControl *mock; @@ -134,7 +134,7 @@ void tst_QMediaRecorder::initTestCase() object = new MockMediaObject(this, service); capture = new QMediaRecorder(object); - audio = qobject_cast(service->requestControl(QAudioEndpointSelectorControl_iid)); + audio = qobject_cast(service->requestControl(QAudioInputSelectorControl_iid)); encode = qobject_cast(service->requestControl(QAudioEncoderSettingsControl_iid)); videoEncode = qobject_cast(service->requestControl(QVideoEncoderSettingsControl_iid)); } @@ -396,14 +396,14 @@ void tst_QMediaRecorder::testVolume() void tst_QMediaRecorder::testAudioDeviceControl() { - QSignalSpy readSignal(audio,SIGNAL(activeEndpointChanged(QString))); - QVERIFY(audio->availableEndpoints().size() == 3); - QVERIFY(audio->defaultEndpoint().compare("device1") == 0); - audio->setActiveEndpoint("device2"); + QSignalSpy readSignal(audio,SIGNAL(activeInputChanged(QString))); + QVERIFY(audio->availableInputs().size() == 3); + QVERIFY(audio->defaultInput().compare("device1") == 0); + audio->setActiveInput("device2"); QTestEventLoop::instance().enterLoop(1); - QVERIFY(audio->activeEndpoint().compare("device2") == 0); + QVERIFY(audio->activeInput().compare("device2") == 0); QVERIFY(readSignal.count() == 1); - QVERIFY(audio->endpointDescription("device2").compare("dev2 comment") == 0); + QVERIFY(audio->inputDescription("device2").compare("dev2 comment") == 0); } void tst_QMediaRecorder::testAudioEncodeControl() diff --git a/tests/auto/unit/qmultimedia_common/mockaudioendpointselector.h b/tests/auto/unit/qmultimedia_common/mockaudioendpointselector.h deleted file mode 100644 index 34b584b3f..000000000 --- a/tests/auto/unit/qmultimedia_common/mockaudioendpointselector.h +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MOCKAUDIOENDPOINTSELECTOR_H -#define MOCKAUDIOENDPOINTSELECTOR_H - -#include "qaudioendpointselectorcontrol.h" - -class MockAudioEndpointSelector : public QAudioEndpointSelectorControl -{ - Q_OBJECT -public: - MockAudioEndpointSelector(QObject *parent): - QAudioEndpointSelectorControl(parent) - { - m_names << "device1" << "device2" << "device3"; - m_descriptions << "dev1 comment" << "dev2 comment" << "dev3 comment"; - m_audioInput = "device1"; - emit availableEndpointsChanged(); - } - ~MockAudioEndpointSelector() {} - - QList availableEndpoints() const - { - return m_names; - } - - QString endpointDescription(const QString& name) const - { - QString desc; - - for (int i = 0; i < m_names.count(); i++) { - if (m_names.at(i).compare(name) == 0) { - desc = m_descriptions.at(i); - break; - } - } - return desc; - } - - QString defaultEndpoint() const - { - return m_names.at(0); - } - - QString activeEndpoint() const - { - return m_audioInput; - } - -public Q_SLOTS: - - void setActiveEndpoint(const QString& name) - { - m_audioInput = name; - emit activeEndpointChanged(name); - } - - void addEndpoints() - { - m_names << "device4"; - emit availableEndpointsChanged(); - } - - void removeEndpoints() - { - m_names.clear(); - emit availableEndpointsChanged(); - } - -private: - QString m_audioInput; - QList m_names; - QList m_descriptions; -}; - - - -#endif // MOCKAUDIOENDPOINTSELECTOR_H diff --git a/tests/auto/unit/qmultimedia_common/mockaudioinputselector.h b/tests/auto/unit/qmultimedia_common/mockaudioinputselector.h new file mode 100644 index 000000000..02f79f48b --- /dev/null +++ b/tests/auto/unit/qmultimedia_common/mockaudioinputselector.h @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** GNU Lesser General Public License Usage +** This file may be used under the terms of the GNU Lesser General Public +** License version 2.1 as published by the Free Software Foundation and +** appearing in the file LICENSE.LGPL included in the packaging of this +** file. Please review the following information to ensure the GNU Lesser +** General Public License version 2.1 requirements will be met: +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU General +** Public License version 3.0 as published by the Free Software Foundation +** and appearing in the file LICENSE.GPL included in the packaging of this +** file. Please review the following information to ensure the GNU General +** Public License version 3.0 requirements will be met: +** http://www.gnu.org/copyleft/gpl.html. +** +** Other Usage +** Alternatively, this file may be used in accordance with the terms and +** conditions contained in a signed written agreement between you and Nokia. +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MOCKAUDIOINPUTSELECTOR_H +#define MOCKAUDIOINPUTSELECTOR_H + +#include "qaudioinputselectorcontrol.h" + +class MockAudioInputSelector : public QAudioInputSelectorControl +{ + Q_OBJECT +public: + MockAudioInputSelector(QObject *parent): + QAudioInputSelectorControl(parent) + { + m_names << "device1" << "device2" << "device3"; + m_descriptions << "dev1 comment" << "dev2 comment" << "dev3 comment"; + m_audioInput = "device1"; + emit availableInputsChanged(); + } + ~MockAudioInputSelector() {} + + QList availableInputs() const + { + return m_names; + } + + QString inputDescription(const QString& name) const + { + QString desc; + + for (int i = 0; i < m_names.count(); i++) { + if (m_names.at(i).compare(name) == 0) { + desc = m_descriptions.at(i); + break; + } + } + return desc; + } + + QString defaultInput() const + { + return m_names.at(0); + } + + QString activeInput() const + { + return m_audioInput; + } + +public Q_SLOTS: + + void setActiveInput(const QString& name) + { + m_audioInput = name; + emit activeInputChanged(name); + } + + void addInputs() + { + m_names << "device4"; + emit availableInputsChanged(); + } + + void removeInputs() + { + m_names.clear(); + emit availableInputsChanged(); + } + +private: + QString m_audioInput; + QList m_names; + QList m_descriptions; +}; + + + +#endif // MOCKAUDIOINPUTSELECTOR_H diff --git a/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h b/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h index 09218893e..4f0a854e9 100644 --- a/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h +++ b/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h @@ -47,7 +47,7 @@ #include "mockaudioencodercontrol.h" #include "mockmediarecordercontrol.h" #include "mockvideoencodercontrol.h" -#include "mockaudioendpointselector.h" +#include "mockaudioinputselector.h" #include "mockmediacontainercontrol.h" #include "mockmetadatawritercontrol.h" #include "mockavailabilitycontrol.h" @@ -63,7 +63,7 @@ public: mockAvailabilityControl(availability), hasControls(true) { - mockAudioEndpointSelector = new MockAudioEndpointSelector(this); + mockAudioInputSelector = new MockAudioInputSelector(this); mockAudioEncoderControl = new MockAudioEncoderControl(this); mockFormatControl = new MockMediaContainerControl(this); mockVideoEncoderControl = new MockVideoEncoderControl(this); @@ -75,8 +75,8 @@ public: { if (hasControls && qstrcmp(name,QAudioEncoderSettingsControl_iid) == 0) return mockAudioEncoderControl; - if (hasControls && qstrcmp(name,QAudioEndpointSelectorControl_iid) == 0) - return mockAudioEndpointSelector; + if (hasControls && qstrcmp(name,QAudioInputSelectorControl_iid) == 0) + return mockAudioInputSelector; if (hasControls && qstrcmp(name,QMediaRecorderControl_iid) == 0) return mockControl; if (hasControls && qstrcmp(name,QMediaContainerControl_iid) == 0) @@ -98,7 +98,7 @@ public: } QMediaControl *mockControl; - QAudioEndpointSelectorControl *mockAudioEndpointSelector; + QAudioInputSelectorControl *mockAudioInputSelector; QAudioEncoderSettingsControl *mockAudioEncoderControl; QMediaContainerControl *mockFormatControl; QVideoEncoderSettingsControl *mockVideoEncoderControl; diff --git a/tests/auto/unit/qmultimedia_common/mockrecorder.pri b/tests/auto/unit/qmultimedia_common/mockrecorder.pri index 9d2e533fe..bdbcba0b8 100644 --- a/tests/auto/unit/qmultimedia_common/mockrecorder.pri +++ b/tests/auto/unit/qmultimedia_common/mockrecorder.pri @@ -8,7 +8,7 @@ HEADERS *= \ ../qmultimedia_common/mockmediarecordercontrol.h \ ../qmultimedia_common/mockvideoencodercontrol.h \ ../qmultimedia_common/mockaudioencodercontrol.h \ - ../qmultimedia_common/mockaudioendpointselector.h \ + ../qmultimedia_common/mockaudioinputselector.h \ ../qmultimedia_common/mockaudioprobecontrol.h \ # We also need all the container/metadata bits -- cgit v1.2.3