summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorMichael Goddard <michael.goddard@nokia.com>2012-01-06 15:21:38 +1000
committerQt by Nokia <qt-info@nokia.com>2012-01-06 07:26:59 +0100
commit6b67a11032779ff3a7a78a57e8d2bb2cd8b7e525 (patch)
treea40f277b1df310f2a83223d24f0e1f11b69da7f7 /tests/auto
parentc97f5f8c2e91c1b76d42583efaf232487d490060 (diff)
Add the spot for spot metering mode.
Not yet fully documented in QML - needs a bit of an overhaul first. Change-Id: Ic11684858fb872d0b4dcedf60b390571371db252 Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/unit/qcamera/tst_qcamera.cpp13
-rw-r--r--tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h21
2 files changed, 31 insertions, 3 deletions
diff --git a/tests/auto/unit/qcamera/tst_qcamera.cpp b/tests/auto/unit/qcamera/tst_qcamera.cpp
index 8f52e9fa3..5334c5244 100644
--- a/tests/auto/unit/qcamera/tst_qcamera.cpp
+++ b/tests/auto/unit/qcamera/tst_qcamera.cpp
@@ -235,6 +235,10 @@ void tst_QCamera::testSimpleCameraExposure()
cameraExposure->setMeteringMode(QCameraExposure::MeteringSpot);
QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringMatrix);
+ QCOMPARE(cameraExposure->spotMeteringPoint(), QPointF());
+ cameraExposure->setSpotMeteringPoint(QPointF(0.5f, 0.5f));
+ QCOMPARE(cameraExposure->spotMeteringPoint(), QPointF());
+
QCOMPARE(cameraExposure->exposureCompensation(), 0.0);
cameraExposure->setExposureCompensation(2.0);
QCOMPARE(cameraExposure->exposureCompensation(), 0.0);
@@ -626,6 +630,15 @@ void tst_QCamera::testCameraExposure()
cameraExposure->setMeteringMode(QCameraExposure::MeteringSpot);
QCOMPARE(cameraExposure->meteringMode(), QCameraExposure::MeteringSpot);
+ cameraExposure->setSpotMeteringPoint(QPointF(0.5f, 0.25f));
+ QCOMPARE(cameraExposure->spotMeteringPoint(), QPointF(0.5f, 0.25f));
+ cameraExposure->setSpotMeteringPoint(QPointF(0.25f, 56.3f));
+ QCOMPARE(cameraExposure->spotMeteringPoint(), QPointF(0.5f, 0.25f));
+ cameraExposure->setSpotMeteringPoint(QPointF(0, 0));
+ QCOMPARE(cameraExposure->spotMeteringPoint(), QPointF(0, 0));
+ cameraExposure->setSpotMeteringPoint(QPointF(1, 1));
+ QCOMPARE(cameraExposure->spotMeteringPoint(), QPointF(1, 1));
+
QCOMPARE(cameraExposure->exposureCompensation(), 0.0);
cameraExposure->setExposureCompensation(2.0);
QCOMPARE(cameraExposure->exposureCompensation(), 2.0);
diff --git a/tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h b/tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h
index d89762d43..8a7074085 100644
--- a/tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h
+++ b/tests/auto/unit/qmultimedia_common/mockcameraexposurecontrol.h
@@ -56,7 +56,8 @@ public:
m_meteringMode(QCameraExposure::MeteringMatrix),
m_exposureCompensation(0),
m_exposureMode(QCameraExposure::ExposureAuto),
- m_flashMode(QCameraExposure::FlashAuto)
+ m_flashMode(QCameraExposure::FlashAuto),
+ m_spot(0.5, 0.5)
{
m_isoRanges << 100 << 200 << 400 << 800;
m_apertureRanges << 2.8 << 4.0 << 5.6 << 8.0 << 11.0 << 16.0;
@@ -106,6 +107,7 @@ public:
case QCameraExposureControl::ISO:
case QCameraExposureControl::Aperture:
case QCameraExposureControl::ShutterSpeed:
+ case QCameraExposureControl::SpotMeteringPoint:
return true;
default:
return false;
@@ -123,6 +125,8 @@ public:
return QVariant(m_aperture);
case QCameraExposureControl::ShutterSpeed:
return QVariant(m_shutterSpeed);
+ case QCameraExposureControl::SpotMeteringPoint:
+ return QVariant(m_spot);
default:
return QVariant();
}
@@ -234,6 +238,17 @@ public:
}
}
break;
+
+ case QCameraExposureControl::SpotMeteringPoint:
+ {
+ static QRectF valid(0, 0, 1, 1);
+ if (valid.contains(value.toPointF())) {
+ m_spot = value.toPointF();
+ return true;
+ }
+ return false;
+ }
+
default:
return false;
}
@@ -264,8 +279,7 @@ public:
{
return mode == QCameraExposure::MeteringAverage
|| mode == QCameraExposure::MeteringMatrix
- || mode == QCameraExposure::MeteringAverage
- || mode ==QCameraExposure::MeteringSpot;
+ || mode == QCameraExposure::MeteringSpot;
}
private:
@@ -277,6 +291,7 @@ private:
QCameraExposure::ExposureMode m_exposureMode;
QCameraExposure::FlashModes m_flashMode;
QVariantList m_isoRanges,m_apertureRanges, m_shutterRanges, m_exposureRanges, m_res;
+ QPointF m_spot;
};
#endif // MOCKCAMERAEXPOSURECONTROL_H