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>
This commit is contained in:
committed by
Qt by Nokia
parent
d1b6bf5fac
commit
2a8463711c
@@ -1059,17 +1059,55 @@ void tst_QMediaRecorder::testAudioSettingsDestructor()
|
||||
/* availabilityError() API test. */
|
||||
void tst_QMediaRecorder::testAvailabilityError()
|
||||
{
|
||||
MockMediaRecorderService service(0, 0);
|
||||
MockMediaObject object(0, &service);
|
||||
QMediaRecorder recorder(&object);
|
||||
QCOMPARE(recorder.availabilityError(), QtMultimedia::ServiceMissingError);
|
||||
{
|
||||
MockMediaRecorderService service(0, 0);
|
||||
MockMediaObject object(0, &service);
|
||||
QMediaRecorder recorder(&object);
|
||||
QCOMPARE(recorder.availabilityError(), QtMultimedia::ServiceMissingError);
|
||||
QCOMPARE(recorder.isAvailable(), false);
|
||||
}
|
||||
{
|
||||
MockMediaRecorderControl recorderControl(0);
|
||||
MockMediaRecorderService service1(0, &recorderControl);
|
||||
service1.mockMetaDataControl->populateMetaData();
|
||||
MockMediaObject object1(0, &service1);
|
||||
QMediaRecorder recorder1(&object1);
|
||||
QCOMPARE(recorder1.availabilityError(), QtMultimedia::NoError);
|
||||
QCOMPARE(recorder1.isAvailable(), true);
|
||||
}
|
||||
{
|
||||
MockMediaRecorderControl recorderControl(0);
|
||||
MockMediaRecorderService service1(0, &recorderControl, 0);
|
||||
service1.mockMetaDataControl->populateMetaData();
|
||||
MockMediaObject object1(0, &service1);
|
||||
QMediaRecorder recorder1(&object1);
|
||||
|
||||
MockMediaRecorderControl recorderControl(0);
|
||||
MockMediaRecorderService service1(0, &recorderControl);
|
||||
service1.mockMetaDataControl->populateMetaData();
|
||||
MockMediaObject object1(0, &service1);
|
||||
QMediaRecorder recorder1(&object1);
|
||||
QCOMPARE(recorder1.availabilityError(), QtMultimedia::NoError);
|
||||
QCOMPARE(recorder1.availabilityError(), QtMultimedia::NoError);
|
||||
QCOMPARE(recorder1.isAvailable(), true);
|
||||
}
|
||||
{
|
||||
MockMediaRecorderControl recorderControl(0);
|
||||
MockAvailabilityControl availability(QtMultimedia::NoError);
|
||||
MockMediaRecorderService service1(0, &recorderControl, &availability);
|
||||
service1.mockMetaDataControl->populateMetaData();
|
||||
MockMediaObject object1(0, &service1);
|
||||
QMediaRecorder recorder1(&object1);
|
||||
|
||||
QSignalSpy spy(&object1, SIGNAL(availabilityErrorChanged(QtMultimedia::AvailabilityError)));
|
||||
|
||||
QCOMPARE(recorder1.availabilityError(), QtMultimedia::NoError);
|
||||
QCOMPARE(recorder1.isAvailable(), true);
|
||||
|
||||
availability.setAvailability(QtMultimedia::BusyError);
|
||||
QCOMPARE(recorder1.availabilityError(), QtMultimedia::BusyError);
|
||||
QCOMPARE(recorder1.isAvailable(), false);
|
||||
QCOMPARE(spy.count(), 1);
|
||||
|
||||
availability.setAvailability(QtMultimedia::NoError);
|
||||
QCOMPARE(recorder1.availabilityError(), QtMultimedia::NoError);
|
||||
QCOMPARE(recorder1.isAvailable(), true);
|
||||
QCOMPARE(spy.count(), 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* isAvailable() API test. */
|
||||
|
||||
Reference in New Issue
Block a user