summaryrefslogtreecommitdiffstats
path: root/tests/auto/unit/qmultimedia_common
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-03-02 00:21:04 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-02 09:30:34 +0100
commit2a8463711c7fd683ddf46f716bfff47c1603e863 (patch)
tree88a504ca27afe1891cce66f678cee5be9cba7993 /tests/auto/unit/qmultimedia_common
parentd1b6bf5fac54a39d911079ba792ca95424c5c70c (diff)
Expose availability from the backend to C++ and QML.
The availabilityError property was static based on the service, but it can change at run time, so add the plumbing to allow the backend to report it itself. Also make sure that both QML and C++ expose the availability. The radio tuner and data controls previously had properties (but no signals) for availability - these have been removed. Change-Id: I9240cf93e2a51b14cd38642f9312ae3c75f05361 Reviewed-by: Ling Hu <ling.hu@nokia.com>
Diffstat (limited to 'tests/auto/unit/qmultimedia_common')
-rw-r--r--tests/auto/unit/qmultimedia_common/mock.pri3
-rw-r--r--tests/auto/unit/qmultimedia_common/mockavailabilitycontrol.h75
-rw-r--r--tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h8
-rw-r--r--tests/auto/unit/qmultimedia_common/mockradiodatacontrol.h9
-rw-r--r--tests/auto/unit/qmultimedia_common/mockradiotunercontrol.h9
5 files changed, 84 insertions, 20 deletions
diff --git a/tests/auto/unit/qmultimedia_common/mock.pri b/tests/auto/unit/qmultimedia_common/mock.pri
index 8b8f3e7fa..269981a86 100644
--- a/tests/auto/unit/qmultimedia_common/mock.pri
+++ b/tests/auto/unit/qmultimedia_common/mock.pri
@@ -4,4 +4,5 @@ INCLUDEPATH += $$PWD \
HEADERS *= \
../qmultimedia_common/mockmediaserviceprovider.h \
../qmultimedia_common/mockmediaservice.h \
- ../qmultimedia_common/mockmediaobject.h
+ ../qmultimedia_common/mockmediaobject.h \
+ ../qmultimedia_common/mockavailabilitycontrol.h
diff --git a/tests/auto/unit/qmultimedia_common/mockavailabilitycontrol.h b/tests/auto/unit/qmultimedia_common/mockavailabilitycontrol.h
new file mode 100644
index 000000000..9e449da10
--- /dev/null
+++ b/tests/auto/unit/qmultimedia_common/mockavailabilitycontrol.h
@@ -0,0 +1,75 @@
+/****************************************************************************
+**
+** 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 MOCKAVAILABILITYCONTROL_H
+#define MOCKAVAILABILITYCONTROL_H
+
+#include <qmediaavailabilitycontrol.h>
+
+class MockAvailabilityControl : public QMediaAvailabilityControl
+{
+ Q_OBJECT
+
+public:
+ MockAvailabilityControl(QtMultimedia::AvailabilityError available)
+ : m_availability(available)
+ {
+
+ }
+
+ QtMultimedia::AvailabilityError availability() const
+ {
+ return m_availability;
+ }
+
+ void setAvailability(QtMultimedia::AvailabilityError availability)
+ {
+ if (m_availability != availability) {
+ m_availability = availability;
+ emit availabilityChanged(availability);
+ }
+ }
+
+ QtMultimedia::AvailabilityError m_availability;
+};
+
+#endif // MOCKAVAILABILITYCONTROL_H
diff --git a/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h b/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h
index bce8c42c9..7d2307316 100644
--- a/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h
+++ b/tests/auto/unit/qmultimedia_common/mockmediarecorderservice.h
@@ -50,14 +50,16 @@
#include "mockaudioendpointselector.h"
#include "mockmediacontainercontrol.h"
#include "mockmetadatawritercontrol.h"
+#include "mockavailabilitycontrol.h"
class MockMediaRecorderService : public QMediaService
{
Q_OBJECT
public:
- MockMediaRecorderService(QObject *parent = 0, QMediaControl *control = 0):
+ MockMediaRecorderService(QObject *parent = 0, QMediaControl *control = 0, MockAvailabilityControl *availability = 0):
QMediaService(parent),
mockControl(control),
+ mockAvailabilityControl(availability),
hasControls(true)
{
mockAudioEndpointSelector = new MockAudioEndpointSelector(parent);
@@ -81,6 +83,8 @@ public:
return mockVideoEncoderControl;
if (hasControls && qstrcmp(name, QMetaDataWriterControl_iid) == 0)
return mockMetaDataControl;
+ if (hasControls && qstrcmp(name, QMediaAvailabilityControl_iid) == 0)
+ return mockAvailabilityControl;
return 0;
}
@@ -95,6 +99,8 @@ public:
QMediaContainerControl *mockFormatControl;
QVideoEncoderControl *mockVideoEncoderControl;
MockMetaDataWriterControl *mockMetaDataControl;
+ MockAvailabilityControl *mockAvailabilityControl;
+
bool hasControls;
};
diff --git a/tests/auto/unit/qmultimedia_common/mockradiodatacontrol.h b/tests/auto/unit/qmultimedia_common/mockradiodatacontrol.h
index 45bec9e42..35e482ff3 100644
--- a/tests/auto/unit/qmultimedia_common/mockradiodatacontrol.h
+++ b/tests/auto/unit/qmultimedia_common/mockradiodatacontrol.h
@@ -57,15 +57,6 @@ public:
using QRadioDataControl::error;
- bool isAvailable() const
- {
- return true;
- }
- QtMultimedia::AvailabilityError availabilityError() const
- {
- return QtMultimedia::NoError;
- }
-
QRadioData::Error error() const
{
return m_err;
diff --git a/tests/auto/unit/qmultimedia_common/mockradiotunercontrol.h b/tests/auto/unit/qmultimedia_common/mockradiotunercontrol.h
index 5b1fe7a09..226cd94e0 100644
--- a/tests/auto/unit/qmultimedia_common/mockradiotunercontrol.h
+++ b/tests/auto/unit/qmultimedia_common/mockradiotunercontrol.h
@@ -66,15 +66,6 @@ public:
return m_active ? QRadioTuner::ActiveState : QRadioTuner::StoppedState;
}
- bool isAvailable() const
- {
- return true;
- }
- QtMultimedia::AvailabilityError availabilityError() const
- {
- return QtMultimedia::NoError;
- }
-
QRadioTuner::Band band() const
{
return m_band;