diff options
author | Jonas Rabbe <jonas.rabbe@nokia.com> | 2012-03-08 11:05:30 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-12 08:21:07 +0100 |
commit | 942ff7a3c6d25dc3a79d28a79676b0995d95874b (patch) | |
tree | b738fe9761a829e216aeeebdabb3a8febcd3e415 /tests/auto/unit/qradiotuner | |
parent | a15b9d3ce88037c973f868fdf6959eea4e157f68 (diff) |
Made QRadioData bind to QRadioTuner to avoid using multiple services
QRadioData has been updated to be a QMediaBindableInterface, and it
will bind to a QRadioTuner instance, i.e. a QMediaObject that provides
a service which implements the QRadioDataControl.
This change is reflected in the declarative implementations of radio
tuner and data. There is a new `radioData` property in the Radio element
which will give access to the declarative RadioData element for the
tuner.
If a RadioData element is created in QML, it will have an anonymous
tuner which communicates with the underlying media service (which is
pretty much the same how the QRadioTuner and QRadioData classes work
previously).
Updated radio tuner and data test cases to use availability control
and extended the mock media service to allow providing a number of
controls rather than just one (needed for testing availability of
all classes extending from or using QMediaObject).
Change-Id: Id41dde66eee529decd828fd2dcdfe4a54c0e81f4
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'tests/auto/unit/qradiotuner')
-rw-r--r-- | tests/auto/unit/qradiotuner/tst_qradiotuner.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/tests/auto/unit/qradiotuner/tst_qradiotuner.cpp b/tests/auto/unit/qradiotuner/tst_qradiotuner.cpp index 9a0172213..07bf8a8fd 100644 --- a/tests/auto/unit/qradiotuner/tst_qradiotuner.cpp +++ b/tests/auto/unit/qradiotuner/tst_qradiotuner.cpp @@ -44,6 +44,7 @@ #include <QtTest/QtTest> #include <QDebug> #include <QTimer> +#include <QtCore/QMap> #include <qmediaobject.h> #include <qmediacontrol.h> @@ -54,6 +55,7 @@ #include "mockmediaserviceprovider.h" #include "mockmediaservice.h" #include "mockradiotunercontrol.h" +#include "mockavailabilitycontrol.h" QT_USE_NAMESPACE @@ -81,6 +83,7 @@ private slots: private: MockRadioTunerControl *mock; + MockAvailabilityControl *mockAvailability; MockMediaService *service; MockMediaServiceProvider *provider; QRadioTuner *radio; @@ -92,7 +95,13 @@ void tst_QRadioTuner::initTestCase() qRegisterMetaType<QRadioTuner::Band>("QRadioTuner::Band"); mock = new MockRadioTunerControl(this); - service = new MockMediaService(this, mock); + mockAvailability = new MockAvailabilityControl(QtMultimedia::NoError); + + QMap<QString, QMediaControl *> map; + map.insert(QRadioTunerControl_iid, mock); + map.insert(QMediaAvailabilityControl_iid, mockAvailability); + + service = new MockMediaService(this, map); provider = new MockMediaServiceProvider(service); QMediaServiceProvider::setDefaultServiceProvider(provider); @@ -129,6 +138,7 @@ void tst_QRadioTuner::cleanupTestCase() delete radio; delete service; delete provider; + delete mockAvailability; } void tst_QRadioTuner::init() |