diff options
author | Lars Knoll <lars.knoll@qt.io> | 2021-05-20 15:59:41 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2021-05-21 12:28:01 +0000 |
commit | bf0f87dc4f4480efe51b8ba5b5706f8c1ce7a4fb (patch) | |
tree | 51e28a0602ac5983cc7fe16cd0a71b61a602b832 /tests | |
parent | 9d2b2a97450095de4a13fd1c3b8d06a4a012bc61 (diff) |
Improve V4L2 support
Check for exposure times and adjustments and implement support
for setting those if the camera supports them.
Check for those in the camerabackend test.
Change-Id: I860b2e7b94ef27e64a62e800cb6c05bfa6134250
Reviewed-by: André de la Rocha <andre.rocha@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp index 4c5f6c251..5692a3845 100644 --- a/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp +++ b/tests/auto/integration/qcamerabackend/tst_qcamerabackend.cpp @@ -360,7 +360,7 @@ void tst_QCameraBackend::testExposureCompensation() QSignalSpy exposureCompensationSignal(&camera, SIGNAL(exposureCompensationChanged(qreal))); //it should be possible to set exposure parameters in Unloaded state - QCOMPARE(camera.exposureCompensation()+1.0, 1.0); + QCOMPARE(camera.exposureCompensation(), 0.); camera.setExposureCompensation(1.0); QCOMPARE(camera.exposureCompensation(), 1.0); QTRY_COMPARE(exposureCompensationSignal.count(), 1); @@ -394,11 +394,13 @@ void tst_QCameraBackend::testExposureMode() QCOMPARE(camera.exposureMode(), QCamera::ExposureAuto); // Night - camera.setExposureMode(QCamera::ExposureNight); - QCOMPARE(camera.exposureMode(), QCamera::ExposureNight); - camera.start(); - QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); - QCOMPARE(camera.exposureMode(), QCamera::ExposureNight); + if (camera.isExposureModeSupported(QCamera::ExposureNight)) { + camera.setExposureMode(QCamera::ExposureNight); + QCOMPARE(camera.exposureMode(), QCamera::ExposureNight); + camera.start(); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(camera.exposureMode(), QCamera::ExposureNight); + } camera.stop(); QTRY_COMPARE(camera.status(), QCamera::InactiveStatus); @@ -409,6 +411,20 @@ void tst_QCameraBackend::testExposureMode() camera.start(); QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); QCOMPARE(camera.exposureMode(), QCamera::ExposureAuto); + + // Manual + if (camera.isExposureModeSupported(QCamera::ExposureManual)) { + camera.setExposureMode(QCamera::ExposureManual); + QCOMPARE(camera.exposureMode(), QCamera::ExposureManual); + camera.start(); + QTRY_COMPARE(camera.status(), QCamera::ActiveStatus); + QCOMPARE(camera.exposureMode(), QCamera::ExposureManual); + + camera.setManualShutterSpeed(.02); // ~20ms should be supported by most cameras + QVERIFY(camera.manualShutterSpeed() > .01 && camera.manualShutterSpeed() < .04); + } + + camera.setExposureMode(QCamera::ExposureAuto); } void tst_QCameraBackend::testVideoRecording_data() |