Moved zoom related properties out of QCameraFocusControl
Change-Id: I16f9b80ebbacc0b325530e81c291dc030763b65e Reviewed-by: Michael Goddard <michael.goddard@nokia.com>
This commit is contained in:
committed by
Qt by Nokia
parent
817fb006c7
commit
155c48b97e
@@ -290,7 +290,7 @@ void tst_QCamera::testSimpleCameraFocus()
|
||||
QVERIFY(!cameraFocus->isFocusModeSupported(QCameraFocus::InfinityFocus));
|
||||
|
||||
QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
|
||||
QTest::ignoreMessage(QtWarningMsg, "Focus points mode selection is not supported");
|
||||
QTest::ignoreMessage(QtWarningMsg, "Focus mode selection is not supported");
|
||||
cameraFocus->setFocusMode(QCameraFocus::ContinuousFocus);
|
||||
QCOMPARE(cameraFocus->focusMode(), QCameraFocus::AutoFocus);
|
||||
|
||||
@@ -308,7 +308,7 @@ void tst_QCamera::testSimpleCameraFocus()
|
||||
QVERIFY(!cameraFocus->isFocusPointModeSupported(QCameraFocus::FocusPointAuto));
|
||||
QCOMPARE(cameraFocus->focusPointMode(), QCameraFocus::FocusPointAuto);
|
||||
|
||||
|
||||
QTest::ignoreMessage(QtWarningMsg, "Focus points mode selection is not supported");
|
||||
cameraFocus->setFocusPointMode( QCameraFocus::FocusPointCenter );
|
||||
QCOMPARE(cameraFocus->focusPointMode(), QCameraFocus::FocusPointAuto);
|
||||
|
||||
@@ -1751,7 +1751,7 @@ void tst_QCamera::testfocusZonesChangedSignal()
|
||||
QVERIFY(cameraFocus != 0);
|
||||
|
||||
QSignalSpy spy(cameraFocus,SIGNAL(focusZonesChanged()));
|
||||
cameraFocus->zoomTo(5.0,6.0);
|
||||
cameraFocus->setCustomFocusPoint(QPointF(0.1, 0.1));
|
||||
QVERIFY(spy.count() == 1);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ HEADERS *= \
|
||||
../qmultimedia_common/mockcameraflashcontrol.h \
|
||||
../qmultimedia_common/mockcameralockscontrol.h \
|
||||
../qmultimedia_common/mockcamerafocuscontrol.h \
|
||||
../qmultimedia_common/mockcamerazoomcontrol.h \
|
||||
../qmultimedia_common/mockcameraimageprocessingcontrol.h \
|
||||
../qmultimedia_common/mockcameraimagecapturecontrol.h \
|
||||
../qmultimedia_common/mockcameraexposurecontrol.h \
|
||||
|
||||
@@ -51,14 +51,9 @@ class MockCameraFocusControl : public QCameraFocusControl
|
||||
public:
|
||||
MockCameraFocusControl(QObject *parent = 0):
|
||||
QCameraFocusControl(parent),
|
||||
m_opticalZoom(1.0),
|
||||
m_digitalZoom(1.0),
|
||||
m_focusMode(QCameraFocus::AutoFocus),
|
||||
m_focusPointMode(QCameraFocus::FocusPointAuto),
|
||||
m_focusPoint(0.5, 0.5),
|
||||
m_maxOpticalZoom(3.0),
|
||||
m_maxDigitalZoom(4.0)
|
||||
|
||||
m_focusPoint(0.5, 0.5)
|
||||
{
|
||||
m_zones << QCameraFocusZone(QRectF(0.45, 0.45, 0.1, 0.1));
|
||||
}
|
||||
@@ -81,45 +76,6 @@ public:
|
||||
return mode == QCameraFocus::AutoFocus || mode == QCameraFocus::ContinuousFocus;
|
||||
}
|
||||
|
||||
qreal maximumOpticalZoom() const
|
||||
{
|
||||
return m_maxOpticalZoom;
|
||||
}
|
||||
|
||||
qreal maximumDigitalZoom() const
|
||||
{
|
||||
return m_maxDigitalZoom;
|
||||
}
|
||||
|
||||
qreal opticalZoom() const
|
||||
{
|
||||
return m_opticalZoom;
|
||||
}
|
||||
|
||||
qreal digitalZoom() const
|
||||
{
|
||||
return m_digitalZoom;
|
||||
}
|
||||
|
||||
void zoomTo(qreal optical, qreal digital)
|
||||
{
|
||||
optical = qBound<qreal>(1.0, optical, maximumOpticalZoom());
|
||||
digital = qBound<qreal>(1.0, digital, maximumDigitalZoom());
|
||||
|
||||
if (!qFuzzyCompare(digital, m_digitalZoom)) {
|
||||
m_digitalZoom = digital;
|
||||
emit digitalZoomChanged(m_digitalZoom);
|
||||
}
|
||||
|
||||
if (!qFuzzyCompare(optical, m_opticalZoom)) {
|
||||
m_opticalZoom = optical;
|
||||
emit opticalZoomChanged(m_opticalZoom);
|
||||
}
|
||||
|
||||
maxOpticalDigitalZoomChange(4.0, 5.0);
|
||||
focusZonesChange(0.50, 0.50, 0.3, 0.3);
|
||||
}
|
||||
|
||||
QCameraFocus::FocusPointMode focusPointMode() const
|
||||
{
|
||||
return m_focusPointMode;
|
||||
@@ -151,6 +107,7 @@ public:
|
||||
void setCustomFocusPoint(const QPointF &point)
|
||||
{
|
||||
m_focusPoint = point;
|
||||
focusZonesChange(0.50, 0.50, 0.3, 0.3);
|
||||
}
|
||||
|
||||
QCameraFocusZoneList focusZones() const
|
||||
@@ -158,20 +115,6 @@ public:
|
||||
return m_zones;
|
||||
}
|
||||
|
||||
// helper function to emit maximum Optical and Digital Zoom Changed signals
|
||||
void maxOpticalDigitalZoomChange(qreal maxOptical, qreal maxDigital)
|
||||
{
|
||||
if (maxOptical != m_maxOpticalZoom) {
|
||||
m_maxOpticalZoom = maxOptical;
|
||||
emit maximumOpticalZoomChanged(m_maxOpticalZoom);
|
||||
}
|
||||
|
||||
if (maxDigital != m_maxDigitalZoom) {
|
||||
m_maxDigitalZoom = maxDigital;
|
||||
emit maximumDigitalZoomChanged(m_maxDigitalZoom);
|
||||
}
|
||||
}
|
||||
|
||||
// helper function to emit Focus Zones Changed signals
|
||||
void focusZonesChange(qreal left, qreal top, qreal width, qreal height)
|
||||
{
|
||||
@@ -184,14 +127,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
qreal m_opticalZoom;
|
||||
qreal m_digitalZoom;
|
||||
QCameraFocus::FocusMode m_focusMode;
|
||||
QCameraFocus::FocusPointMode m_focusPointMode;
|
||||
QPointF m_focusPoint;
|
||||
// to emit maximum Optical and Digital Zoom Changed signals
|
||||
qreal m_maxOpticalZoom;
|
||||
qreal m_maxDigitalZoom;
|
||||
// to emit focus zone changed signal
|
||||
QCameraFocusZoneList m_zones;
|
||||
};
|
||||
|
||||
@@ -46,6 +46,7 @@
|
||||
#include "../qmultimedia_common/mockcameraflashcontrol.h"
|
||||
#include "../qmultimedia_common/mockcameralockscontrol.h"
|
||||
#include "../qmultimedia_common/mockcamerafocuscontrol.h"
|
||||
#include "../qmultimedia_common/mockcamerazoomcontrol.h"
|
||||
#include "../qmultimedia_common/mockcameraimageprocessingcontrol.h"
|
||||
#include "../qmultimedia_common/mockcameraimagecapturecontrol.h"
|
||||
#include "../qmultimedia_common/mockcameraexposurecontrol.h"
|
||||
@@ -99,6 +100,7 @@ public:
|
||||
mockExposureControl = new MockCameraExposureControl(this);
|
||||
mockFlashControl = new MockCameraFlashControl(this);
|
||||
mockFocusControl = new MockCameraFocusControl(this);
|
||||
mockZoomControl = new MockCameraZoomControl(this);
|
||||
mockCaptureControl = new MockCaptureControl(mockControl, this);
|
||||
mockCaptureBufferControl = new MockCaptureBufferFormatControl(this);
|
||||
mockCaptureDestinationControl = new MockCaptureDestinationControl(this);
|
||||
@@ -133,6 +135,9 @@ public:
|
||||
if (qstrcmp(iid, QCameraFocusControl_iid) == 0)
|
||||
return mockFocusControl;
|
||||
|
||||
if (qstrcmp(iid, QCameraZoomControl_iid) == 0)
|
||||
return mockZoomControl;
|
||||
|
||||
if (qstrcmp(iid, QCameraImageCaptureControl_iid) == 0)
|
||||
return mockCaptureControl;
|
||||
|
||||
@@ -183,6 +188,7 @@ public:
|
||||
MockCameraExposureControl *mockExposureControl;
|
||||
MockCameraFlashControl *mockFlashControl;
|
||||
MockCameraFocusControl *mockFocusControl;
|
||||
MockCameraZoomControl *mockZoomControl;
|
||||
MockImageProcessingControl *mockImageProcessingControl;
|
||||
MockImageEncoderControl *mockImageEncoderControl;
|
||||
MockVideoRendererControl *rendererControl;
|
||||
|
||||
134
tests/auto/unit/qmultimedia_common/mockcamerazoomcontrol.h
Normal file
134
tests/auto/unit/qmultimedia_common/mockcamerazoomcontrol.h
Normal file
@@ -0,0 +1,134 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: http://www.qt-project.org/
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef MOCKCAMERAZOOMCONTROL_H
|
||||
#define MOCKCAMERAZOOMCONTROL_H
|
||||
|
||||
#include "qcamerazoomcontrol.h"
|
||||
|
||||
class MockCameraZoomControl : public QCameraZoomControl
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
MockCameraZoomControl(QObject *parent = 0):
|
||||
QCameraZoomControl(parent),
|
||||
m_opticalZoom(1.0),
|
||||
m_digitalZoom(1.0),
|
||||
m_maxOpticalZoom(3.0),
|
||||
m_maxDigitalZoom(4.0)
|
||||
|
||||
{
|
||||
}
|
||||
|
||||
~MockCameraZoomControl() {}
|
||||
|
||||
qreal maximumOpticalZoom() const
|
||||
{
|
||||
return m_maxOpticalZoom;
|
||||
}
|
||||
|
||||
qreal maximumDigitalZoom() const
|
||||
{
|
||||
return m_maxDigitalZoom;
|
||||
}
|
||||
|
||||
qreal currentOpticalZoom() const
|
||||
{
|
||||
return m_opticalZoom;
|
||||
}
|
||||
|
||||
qreal currentDigitalZoom() const
|
||||
{
|
||||
return m_digitalZoom;
|
||||
}
|
||||
|
||||
qreal requestedOpticalZoom() const
|
||||
{
|
||||
return m_opticalZoom;
|
||||
}
|
||||
|
||||
qreal requestedDigitalZoom() const
|
||||
{
|
||||
return m_digitalZoom;
|
||||
}
|
||||
|
||||
void zoomTo(qreal optical, qreal digital)
|
||||
{
|
||||
optical = qBound<qreal>(1.0, optical, maximumOpticalZoom());
|
||||
digital = qBound<qreal>(1.0, digital, maximumDigitalZoom());
|
||||
|
||||
if (!qFuzzyCompare(digital, m_digitalZoom)) {
|
||||
m_digitalZoom = digital;
|
||||
emit requestedDigitalZoomChanged(m_digitalZoom);
|
||||
emit currentDigitalZoomChanged(m_digitalZoom);
|
||||
}
|
||||
|
||||
if (!qFuzzyCompare(optical, m_opticalZoom)) {
|
||||
m_opticalZoom = optical;
|
||||
emit requestedOpticalZoomChanged(m_opticalZoom);
|
||||
emit currentOpticalZoomChanged(m_opticalZoom);
|
||||
}
|
||||
|
||||
maxOpticalDigitalZoomChange(4.0, 5.0);
|
||||
}
|
||||
|
||||
// helper function to emit maximum Optical and Digital Zoom Changed signals
|
||||
void maxOpticalDigitalZoomChange(qreal maxOptical, qreal maxDigital)
|
||||
{
|
||||
if (maxOptical != m_maxOpticalZoom) {
|
||||
m_maxOpticalZoom = maxOptical;
|
||||
emit maximumOpticalZoomChanged(m_maxOpticalZoom);
|
||||
}
|
||||
|
||||
if (maxDigital != m_maxDigitalZoom) {
|
||||
m_maxDigitalZoom = maxDigital;
|
||||
emit maximumDigitalZoomChanged(m_maxDigitalZoom);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
qreal m_opticalZoom;
|
||||
qreal m_digitalZoom;
|
||||
qreal m_maxOpticalZoom;
|
||||
qreal m_maxDigitalZoom;
|
||||
};
|
||||
|
||||
#endif // MOCKCAMERAZOOMCONTROL_H
|
||||
Reference in New Issue
Block a user