diff options
author | Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com> | 2012-01-10 13:32:24 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-25 06:14:59 +0100 |
commit | 2db9b4b1c86cc2f8c293102518af382bc5ae92fd (patch) | |
tree | b71b1d45859385701bf0bab1c3390d6cbc793785 /tests/auto/unit/qcamera/tst_qcamera.cpp | |
parent | a9d78fbec94c80241c1f90f660cf27dc259a0df4 (diff) |
QCameraExposure API refactoring
QCameraExposureControl:
Separated requested from actual exposure values.
Removed ParameterFlags, it's confusing and seldom used.
Moved ExposureMode and MeteringMode to parameters.
QCameraExposure:
Added requestedAperture/ShutterSpeed/Iso getters
Change-Id: I408586d85e6c9de0c8a711c32b3c90ea46052270
Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
Diffstat (limited to 'tests/auto/unit/qcamera/tst_qcamera.cpp')
-rw-r--r-- | tests/auto/unit/qcamera/tst_qcamera.cpp | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/auto/unit/qcamera/tst_qcamera.cpp b/tests/auto/unit/qcamera/tst_qcamera.cpp index d972abff9..c244bfa50 100644 --- a/tests/auto/unit/qcamera/tst_qcamera.cpp +++ b/tests/auto/unit/qcamera/tst_qcamera.cpp @@ -626,11 +626,17 @@ void tst_QCamera::testCameraExposure() cameraExposure->setFlashMode(QCameraExposure::FlashSlowSyncFrontCurtain); QCOMPARE(cameraExposure->flashMode(), QCameraExposure::FlashSlowSyncFrontCurtain); + QVERIFY(!cameraExposure->isMeteringModeSupported(QCameraExposure::MeteringAverage)); + QVERIFY(cameraExposure->isMeteringModeSupported(QCameraExposure::MeteringSpot)); + QVERIFY(cameraExposure->isMeteringModeSupported(QCameraExposure::MeteringMatrix)); cameraExposure->setMeteringMode(QCameraExposure::MeteringMatrix); QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringMatrix); + + //MeteringAverage is not supported, metering mode should not be changed cameraExposure->setMeteringMode(QCameraExposure::MeteringAverage); - QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringAverage); + QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringMatrix); + cameraExposure->setMeteringMode(QCameraExposure::MeteringSpot); QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringSpot); @@ -650,17 +656,23 @@ void tst_QCamera::testCameraExposure() int minIso = cameraExposure->supportedIsoSensitivities().first(); int maxIso = cameraExposure->supportedIsoSensitivities().last(); QVERIFY(cameraExposure->isoSensitivity() > 0); + QCOMPARE(cameraExposure->requestedIsoSensitivity(), -1); QVERIFY(minIso > 0); QVERIFY(maxIso > 0); cameraExposure->setManualIsoSensitivity(minIso); QCOMPARE(cameraExposure->isoSensitivity(), minIso); cameraExposure->setManualIsoSensitivity(maxIso*10); QCOMPARE(cameraExposure->isoSensitivity(), maxIso); + QCOMPARE(cameraExposure->requestedIsoSensitivity(), maxIso*10); + cameraExposure->setManualIsoSensitivity(-10); QCOMPARE(cameraExposure->isoSensitivity(), minIso); + QCOMPARE(cameraExposure->requestedIsoSensitivity(), -10); cameraExposure->setAutoIsoSensitivity(); QCOMPARE(cameraExposure->isoSensitivity(), 100); + QCOMPARE(cameraExposure->requestedIsoSensitivity(), -1); + QCOMPARE(cameraExposure->requestedAperture(), -1.0); qreal minAperture = cameraExposure->supportedApertures().first(); qreal maxAperture = cameraExposure->supportedApertures().last(); QVERIFY(minAperture > 0); @@ -671,14 +683,20 @@ void tst_QCamera::testCameraExposure() cameraExposure->setAutoAperture(); QVERIFY(cameraExposure->aperture() >= minAperture); QVERIFY(cameraExposure->aperture() <= maxAperture); + QCOMPARE(cameraExposure->requestedAperture(), -1.0); cameraExposure->setManualAperture(0); QCOMPARE(cameraExposure->aperture(), minAperture); + QCOMPARE(cameraExposure->requestedAperture()+1.0, 1.0); cameraExposure->setManualAperture(10000); QCOMPARE(cameraExposure->aperture(), maxAperture); + QCOMPARE(cameraExposure->requestedAperture(), 10000.0); + cameraExposure->setAutoAperture(); + QCOMPARE(cameraExposure->requestedAperture(), -1.0); + QCOMPARE(cameraExposure->requestedShutterSpeed(), -1.0); qreal minShutterSpeed = cameraExposure->supportedShutterSpeeds().first(); qreal maxShutterSpeed = cameraExposure->supportedShutterSpeeds().last(); QVERIFY(minShutterSpeed > 0); @@ -689,12 +707,18 @@ void tst_QCamera::testCameraExposure() cameraExposure->setAutoShutterSpeed(); QVERIFY(cameraExposure->shutterSpeed() >= minShutterSpeed); QVERIFY(cameraExposure->shutterSpeed() <= maxShutterSpeed); + QCOMPARE(cameraExposure->requestedShutterSpeed(), -1.0); cameraExposure->setManualShutterSpeed(0); QCOMPARE(cameraExposure->shutterSpeed(), minShutterSpeed); + QCOMPARE(cameraExposure->requestedShutterSpeed()+1.0, 1.0); cameraExposure->setManualShutterSpeed(10000); QCOMPARE(cameraExposure->shutterSpeed(), maxShutterSpeed); + QCOMPARE(cameraExposure->requestedShutterSpeed(), 10000.0); + + cameraExposure->setAutoShutterSpeed(); + QCOMPARE(cameraExposure->requestedShutterSpeed(), -1.0); } void tst_QCamera::testCameraFocus() |