Camera integration test fixes

Skip the testCtorWithDevice test if camera doesn't
support devices selection;

Allow synchronous camera status changes

Change-Id: I14f4a74f8a92b8dc2f75f8f5df2bcf9c124bda68
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
Dmytro Poplavskiy
2012-08-16 14:45:46 +10:00
committed by Qt by Nokia
parent 37b872da9e
commit 8a3706a5a1

View File

@@ -128,17 +128,16 @@ void tst_QCameraBackend::testDeviceDescription()
void tst_QCameraBackend::testCtorWithDevice()
{
int deviceCount = QMediaServiceProvider::defaultServiceProvider()->devices(QByteArray(Q_MEDIASERVICE_CAMERA)).count();
QCamera *camera = 0;
if (QCamera::availableDevices().isEmpty())
QSKIP("Camera selection not supported");
if (deviceCount == 0) {
camera = new QCamera("random");
QCOMPARE(camera->error(), QCamera::ServiceMissingError);
}
else {
camera = new QCamera(QCamera::availableDevices().first());
QCamera *camera = new QCamera(QCamera::availableDevices().first());
QCOMPARE(camera->error(), QCamera::NoError);
}
delete camera;
//loading non existing camera should fail
camera = new QCamera(QUuid::createUuid().toByteArray());
QCOMPARE(camera->error(), QCamera::ServiceMissingError);
delete camera;
}
@@ -608,7 +607,8 @@ void tst_QCameraBackend::testVideoRecording()
QCOMPARE(recorder.status(), QMediaRecorder::UnloadedStatus);
camera->start();
QCOMPARE(recorder.status(), QMediaRecorder::LoadingStatus);
QVERIFY(recorder.status() == QMediaRecorder::LoadingStatus ||
recorder.status() == QMediaRecorder::LoadedStatus);
QCOMPARE(recorderStatusSignal.last().first().value<QMediaRecorder::Status>(), recorder.status());
QTRY_COMPARE(camera->status(), QCamera::ActiveStatus);
QTRY_COMPARE(recorder.status(), QMediaRecorder::LoadedStatus);