From 8a3706a5a1a9d5839327ede3fa625da8f3c34979 Mon Sep 17 00:00:00 2001 From: Dmytro Poplavskiy Date: Thu, 16 Aug 2012 14:45:46 +1000 Subject: [PATCH] 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 --- .../qcamerabackend/tst_qcamerabackend.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index f46ba9b..80651c4 100644 --- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp @@ -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()); - QCOMPARE(camera->error(), QCamera::NoError); - } + 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(), recorder.status()); QTRY_COMPARE(camera->status(), QCamera::ActiveStatus); QTRY_COMPARE(recorder.status(), QMediaRecorder::LoadedStatus); -- 2.7.4