Merge lp:~fboucault/qtubuntu-camera/hdr_scene_mode into lp:qtubuntu-camera

Proposed by Florian Boucault
Status: Merged
Approved by: Jim Hodapp
Approved revision: 104
Merged at revision: 96
Proposed branch: lp:~fboucault/qtubuntu-camera/hdr_scene_mode
Merge into: lp:qtubuntu-camera
Diff against target: 585 lines (+413/-4)
12 files modified
src/aalcameraexposurecontrol.cpp (+141/-0)
src/aalcameraexposurecontrol.h (+52/-0)
src/aalcameraservice.cpp (+7/-0)
src/aalcameraservice.h (+3/-0)
src/src.pro (+2/-0)
unittests/aalcameraexposurecontrol/aalcameraexposurecontrol.pro (+20/-0)
unittests/aalcameraexposurecontrol/aalcameraservice.cpp (+76/-0)
unittests/aalcameraexposurecontrol/tst_aalcameraexposurecontrol.cpp (+96/-0)
unittests/mocks/aal/camera_compatibility_layer.cpp (+10/-2)
unittests/mocks/aal/camera_compatibility_layer_capabilities.h (+4/-1)
unittests/mocks/aal/media_recorder_layer.cpp (+1/-1)
unittests/unittests.pro (+1/-0)
To merge this branch: bzr merge lp:~fboucault/qtubuntu-camera/hdr_scene_mode
Reviewer Review Type Date Requested Status
Jim Hodapp (community) code Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+225993@code.launchpad.net

Commit message

Expose scene modes through a custom QCameraExposureControl. Only relevant scene modes for now are AUTO (off) and HDR.

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

MR not ready for review.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Florian Boucault (fboucault) wrote :

Good to go apart from that we need to define a better enum value for HDR than QCameraExposure::ExposureModeVendor

Build will be green when relevant libhybris patch lands.

Revision history for this message
Florian Boucault (fboucault) wrote :
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

The main code looks great, I'd like to see some tests for the logic of setting the exposure mode and making sure the appropriate signals are emitted when expected.

review: Needs Fixing
Revision history for this message
Jim Hodapp (jhodapp) wrote :

By tests, I mean unit tests

102. By Florian Boucault

Empty commit

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
103. By Florian Boucault

Fix unit test.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
104. By Florian Boucault

Properly fixed unit tests.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Jim Hodapp (jhodapp) wrote :

Looks great, thanks

review: Approve (code)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added file 'src/aalcameraexposurecontrol.cpp'
--- src/aalcameraexposurecontrol.cpp 1970-01-01 00:00:00 +0000
+++ src/aalcameraexposurecontrol.cpp 2014-07-15 12:39:22 +0000
@@ -0,0 +1,141 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "aalcameraexposurecontrol.h"
18#include "aalcameracontrol.h"
19#include "aalcameraservice.h"
20
21#include <hybris/camera/camera_compatibility_layer.h>
22#include <hybris/camera/camera_compatibility_layer_capabilities.h>
23
24// Definition of this enum value is duplicated in camera-app
25static const QCameraExposure::ExposureMode ExposureHdr = static_cast<QCameraExposure::ExposureMode>(QCameraExposure::ExposureModeVendor + 1);
26
27AalCameraExposureControl::AalCameraExposureControl(AalCameraService *service, QObject *parent)
28 : QCameraExposureControl(parent),
29 m_service(service),
30 m_requestedExposureMode(QCameraExposure::ExposureAuto),
31 m_actualExposureMode(QCameraExposure::ExposureAuto)
32{
33 m_androidToQtExposureModes[SCENE_MODE_AUTO] = QCameraExposure::ExposureAuto;
34 m_androidToQtExposureModes[SCENE_MODE_ACTION] = QCameraExposure::ExposureSports;
35 m_androidToQtExposureModes[SCENE_MODE_NIGHT] = QCameraExposure::ExposureNight;
36 m_androidToQtExposureModes[SCENE_MODE_PARTY] = QCameraExposure::ExposureAuto; // FIXME: no correspondance
37 m_androidToQtExposureModes[SCENE_MODE_SUNSET] = QCameraExposure::ExposureAuto; // FIXME: no correspondance
38 m_androidToQtExposureModes[SCENE_MODE_HDR] = ExposureHdr;
39}
40
41void AalCameraExposureControl::init(CameraControl *control, CameraControlListener *listener)
42{
43 Q_UNUSED(listener);
44
45 m_requestedExposureMode = QCameraExposure::ExposureAuto;
46 m_actualExposureMode = QCameraExposure::ExposureAuto;
47
48 m_supportedExposureModes.clear();
49 android_camera_enumerate_supported_scene_modes(control, &AalCameraExposureControl::supportedSceneModesCallback, this);
50
51 Q_EMIT requestedValueChanged(QCameraExposureControl::ExposureMode);
52 Q_EMIT actualValueChanged(QCameraExposureControl::ExposureMode);
53 Q_EMIT parameterRangeChanged(QCameraExposureControl::ExposureMode);
54}
55
56void AalCameraExposureControl::supportedSceneModesCallback(void *context, SceneMode sceneMode)
57{
58 AalCameraExposureControl *self = (AalCameraExposureControl*)context;
59 self->m_supportedExposureModes << QVariant::fromValue(self->m_androidToQtExposureModes[sceneMode]);
60}
61
62bool AalCameraExposureControl::setValue(ExposureParameter parameter, const QVariant& value)
63{
64 if (!value.isValid()) {
65 return false;
66 }
67
68 if (parameter == QCameraExposureControl::ExposureMode) {
69 m_requestedExposureMode = value.value<QCameraExposure::ExposureMode>();
70 Q_EMIT requestedValueChanged(QCameraExposureControl::ExposureMode);
71
72 if (m_supportedExposureModes.contains(value)) {
73 SceneMode sceneMode = m_androidToQtExposureModes.key(m_requestedExposureMode);
74 android_camera_set_scene_mode(m_service->androidControl(), sceneMode);
75 m_actualExposureMode = m_requestedExposureMode;
76 Q_EMIT actualValueChanged(QCameraExposureControl::ExposureMode);
77 return true;
78 }
79 }
80
81 return false;
82}
83
84QVariant AalCameraExposureControl::requestedValue(ExposureParameter parameter) const
85{
86 if (parameter == QCameraExposureControl::ExposureMode) {
87 return QVariant::fromValue(m_requestedExposureMode);
88 }
89
90 return QVariant();
91}
92
93QVariant AalCameraExposureControl::actualValue(ExposureParameter parameter) const
94{
95 if (parameter == QCameraExposureControl::ExposureMode) {
96 return QVariant::fromValue(m_actualExposureMode);
97 }
98
99 return QVariant();
100}
101
102bool AalCameraExposureControl::isParameterSupported(ExposureParameter parameter) const
103{
104 switch (parameter) {
105 case QCameraExposureControl::ISO:
106 return false;
107 case QCameraExposureControl::Aperture:
108 return false;
109 case QCameraExposureControl::ShutterSpeed:
110 return false;
111 case QCameraExposureControl::ExposureCompensation:
112 return false;
113 case QCameraExposureControl::FlashPower:
114 return false;
115 case QCameraExposureControl::FlashCompensation:
116 return false;
117 case QCameraExposureControl::TorchPower:
118 return false;
119 case QCameraExposureControl::SpotMeteringPoint:
120 return false;
121 case QCameraExposureControl::ExposureMode:
122 return true;
123 case QCameraExposureControl::MeteringMode:
124 return false;
125 default:
126 return false;
127 }
128}
129
130QVariantList AalCameraExposureControl::supportedParameterRange(ExposureParameter parameter, bool *continuous) const
131{
132 if (continuous != NULL) {
133 *continuous = false;
134 }
135
136 if (parameter == QCameraExposureControl::ExposureMode) {
137 return m_supportedExposureModes;
138 }
139
140 return QVariantList();
141}
0142
=== added file 'src/aalcameraexposurecontrol.h'
--- src/aalcameraexposurecontrol.h 1970-01-01 00:00:00 +0000
+++ src/aalcameraexposurecontrol.h 2014-07-15 12:39:22 +0000
@@ -0,0 +1,52 @@
1/*
2 * Copyright (C) 2014 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#ifndef AALCAMERAEXPOSURECONTROL_H
18#define AALCAMERAEXPOSURECONTROL_H
19
20#include <QtCore/QMap>
21#include <QCameraExposureControl>
22
23#include <hybris/camera/camera_compatibility_layer_capabilities.h>
24
25class AalCameraService;
26class CameraControl;
27class CameraControlListener;
28
29class AalCameraExposureControl : public QCameraExposureControl
30{
31 Q_OBJECT
32public:
33 explicit AalCameraExposureControl(AalCameraService *service, QObject *parent = 0);
34
35 void init(CameraControl *control, CameraControlListener *listener);
36 bool setValue(ExposureParameter parameter, const QVariant& value);
37 QVariant requestedValue(ExposureParameter parameter) const;
38 QVariant actualValue(ExposureParameter parameter) const;
39 bool isParameterSupported(ExposureParameter parameter) const;
40 QVariantList supportedParameterRange(ExposureParameter parameter, bool *continuous) const;
41
42 static void supportedSceneModesCallback(void *context, SceneMode sceneMode);
43
44private:
45 QMap<SceneMode, QCameraExposure::ExposureMode> m_androidToQtExposureModes;
46 AalCameraService *m_service;
47 QVariantList m_supportedExposureModes;
48 QCameraExposure::ExposureMode m_requestedExposureMode;
49 QCameraExposure::ExposureMode m_actualExposureMode;
50};
51
52#endif // AALCAMERAEXPOSURECONTROL_H
053
=== modified file 'src/aalcameraservice.cpp'
--- src/aalcameraservice.cpp 2013-08-01 10:41:04 +0000
+++ src/aalcameraservice.cpp 2014-07-15 12:39:22 +0000
@@ -27,6 +27,7 @@
27#include "aalvideoencodersettingscontrol.h"27#include "aalvideoencodersettingscontrol.h"
28#include "aalvideorenderercontrol.h"28#include "aalvideorenderercontrol.h"
29#include "aalviewfindersettingscontrol.h"29#include "aalviewfindersettingscontrol.h"
30#include "aalcameraexposurecontrol.h"
30#include <storagemanager.h>31#include <storagemanager.h>
3132
32#include <hybris/camera/camera_compatibility_layer.h>33#include <hybris/camera/camera_compatibility_layer.h>
@@ -56,6 +57,7 @@
56 m_videoEncoderControl = new AalVideoEncoderSettingsControl(this);57 m_videoEncoderControl = new AalVideoEncoderSettingsControl(this);
57 m_videoOutput = new AalVideoRendererControl(this);58 m_videoOutput = new AalVideoRendererControl(this);
58 m_viewfinderControl = new AalViewfinderSettingsControl(this);59 m_viewfinderControl = new AalViewfinderSettingsControl(this);
60 m_exposureControl = new AalCameraExposureControl(this);
59}61}
6062
61AalCameraService::~AalCameraService()63AalCameraService::~AalCameraService()
@@ -74,6 +76,7 @@
74 delete m_videoEncoderControl;76 delete m_videoEncoderControl;
75 delete m_videoOutput;77 delete m_videoOutput;
76 delete m_viewfinderControl;78 delete m_viewfinderControl;
79 delete m_exposureControl;
77 if (m_oldAndroidControl)80 if (m_oldAndroidControl)
78 android_camera_delete(m_oldAndroidControl);81 android_camera_delete(m_oldAndroidControl);
79 if (m_androidControl)82 if (m_androidControl)
@@ -119,6 +122,9 @@
119 if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0)122 if (qstrcmp(name, QCameraViewfinderSettingsControl_iid) == 0)
120 return m_viewfinderControl;123 return m_viewfinderControl;
121124
125 if (qstrcmp(name, QCameraExposureControl_iid) == 0)
126 return m_exposureControl;
127
122 return 0;128 return 0;
123}129}
124130
@@ -285,4 +291,5 @@
285 m_viewfinderControl->setAspectRatio(m_videoEncoderControl->getAspectRatio());291 m_viewfinderControl->setAspectRatio(m_videoEncoderControl->getAspectRatio());
286 m_viewfinderControl->init(camControl, listener);292 m_viewfinderControl->init(camControl, listener);
287 m_videoOutput->init(camControl, listener);293 m_videoOutput->init(camControl, listener);
294 m_exposureControl->init(camControl, listener);
288}295}
289296
=== modified file 'src/aalcameraservice.h'
--- src/aalcameraservice.h 2013-08-01 10:41:04 +0000
+++ src/aalcameraservice.h 2014-07-15 12:39:22 +0000
@@ -31,6 +31,7 @@
31class AalVideoEncoderSettingsControl;31class AalVideoEncoderSettingsControl;
32class AalVideoRendererControl;32class AalVideoRendererControl;
33class AalViewfinderSettingsControl;33class AalViewfinderSettingsControl;
34class AalCameraExposureControl;
34class QCameraControl;35class QCameraControl;
3536
36struct CameraControl;37struct CameraControl;
@@ -60,6 +61,7 @@
60 AalVideoEncoderSettingsControl *videoEncoderControl() const { return m_videoEncoderControl; }61 AalVideoEncoderSettingsControl *videoEncoderControl() const { return m_videoEncoderControl; }
61 AalVideoRendererControl *videoOutputControl() const { return m_videoOutput; }62 AalVideoRendererControl *videoOutputControl() const { return m_videoOutput; }
62 AalViewfinderSettingsControl *viewfinderControl() const { return m_viewfinderControl; }63 AalViewfinderSettingsControl *viewfinderControl() const { return m_viewfinderControl; }
64 AalCameraExposureControl *exposureControl() const { return m_exposureControl; }
6365
64 CameraControl *androidControl();66 CameraControl *androidControl();
6567
@@ -99,6 +101,7 @@
99 AalVideoEncoderSettingsControl *m_videoEncoderControl;101 AalVideoEncoderSettingsControl *m_videoEncoderControl;
100 AalVideoRendererControl *m_videoOutput;102 AalVideoRendererControl *m_videoOutput;
101 AalViewfinderSettingsControl *m_viewfinderControl;103 AalViewfinderSettingsControl *m_viewfinderControl;
104 AalCameraExposureControl *m_exposureControl;
102105
103 CameraControl *m_androidControl;106 CameraControl *m_androidControl;
104 CameraControlListener *m_androidListener;107 CameraControlListener *m_androidListener;
105108
=== modified file 'src/src.pro'
--- src/src.pro 2014-01-16 14:20:08 +0000
+++ src/src.pro 2014-07-15 12:39:22 +0000
@@ -33,6 +33,7 @@
33 aalvideoencodersettingscontrol.h \33 aalvideoencodersettingscontrol.h \
34 aalvideorenderercontrol.h \34 aalvideorenderercontrol.h \
35 aalviewfindersettingscontrol.h \35 aalviewfindersettingscontrol.h \
36 aalcameraexposurecontrol.h \
36 storagemanager.h37 storagemanager.h
3738
38SOURCES += \39SOURCES += \
@@ -50,4 +51,5 @@
50 aalvideoencodersettingscontrol.cpp \51 aalvideoencodersettingscontrol.cpp \
51 aalvideorenderercontrol.cpp \52 aalvideorenderercontrol.cpp \
52 aalviewfindersettingscontrol.cpp \53 aalviewfindersettingscontrol.cpp \
54 aalcameraexposurecontrol.cpp \
53 storagemanager.cpp55 storagemanager.cpp
5456
=== added directory 'unittests/aalcameraexposurecontrol'
=== added file 'unittests/aalcameraexposurecontrol/aalcameraexposurecontrol.pro'
--- unittests/aalcameraexposurecontrol/aalcameraexposurecontrol.pro 1970-01-01 00:00:00 +0000
+++ unittests/aalcameraexposurecontrol/aalcameraexposurecontrol.pro 2014-07-15 12:39:22 +0000
@@ -0,0 +1,20 @@
1include(../../coverage.pri)
2
3TARGET = tst_aalcameraexposurecontrol
4
5QT += testlib multimedia opengl
6
7LIBS += -L../mocks/aal -laal
8INCLUDEPATH += ../../src
9INCLUDEPATH += ../mocks/aal
10
11HEADERS += ../../src/aalcameraexposurecontrol.h \
12 ../../src/aalcameraservice.h
13
14SOURCES += tst_aalcameraexposurecontrol.cpp \
15 ../../src/aalcameraexposurecontrol.cpp \
16 aalcameraservice.cpp
17
18check.depends = $${TARGET}
19check.commands = ./$${TARGET}
20QMAKE_EXTRA_TARGETS += check
021
=== added file 'unittests/aalcameraexposurecontrol/aalcameraservice.cpp'
--- unittests/aalcameraexposurecontrol/aalcameraservice.cpp 1970-01-01 00:00:00 +0000
+++ unittests/aalcameraexposurecontrol/aalcameraservice.cpp 2014-07-15 12:39:22 +0000
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include "aalcameraservice.h"
18#include "aalcameraexposurecontrol.h"
19#include "camera_control.h"
20#include "camera_compatibility_layer.h"
21
22AalCameraService *AalCameraService::m_service = 0;
23
24AalCameraService::AalCameraService(QObject *parent) :
25 QMediaService(parent),
26 m_androidControl(0),
27 m_androidListener(0)
28{
29 m_exposureControl = new AalCameraExposureControl(this);
30}
31
32AalCameraService::~AalCameraService()
33{
34 delete m_exposureControl;
35}
36
37QMediaControl *AalCameraService::requestControl(const char *name)
38{
39 Q_UNUSED(name);
40 return 0;
41}
42
43void AalCameraService::releaseControl(QMediaControl *control)
44{
45 Q_UNUSED(control);
46}
47
48CameraControl *AalCameraService::androidControl()
49{
50 return m_androidControl;
51}
52
53bool AalCameraService::connectCamera()
54{
55 m_androidListener = new CameraControlListener;
56 m_androidControl = android_camera_connect_to(BACK_FACING_CAMERA_TYPE, m_androidListener);
57
58 initControls(m_androidControl, m_androidListener);
59
60 return true;
61}
62
63void AalCameraService::disconnectCamera()
64{
65 delete m_androidListener;
66 android_camera_disconnect(m_androidControl);
67}
68
69void AalCameraService::initControls(CameraControl *camControl, CameraControlListener *listener)
70{
71 m_exposureControl->init(camControl, listener);
72}
73
74void AalCameraService::updateCaptureReady()
75{
76}
077
=== added file 'unittests/aalcameraexposurecontrol/tst_aalcameraexposurecontrol.cpp'
--- unittests/aalcameraexposurecontrol/tst_aalcameraexposurecontrol.cpp 1970-01-01 00:00:00 +0000
+++ unittests/aalcameraexposurecontrol/tst_aalcameraexposurecontrol.cpp 2014-07-15 12:39:22 +0000
@@ -0,0 +1,96 @@
1/*
2 * Copyright (C) 2013 Canonical, Ltd.
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU Lesser General Public License as published by
6 * the Free Software Foundation; version 3.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <QtTest/QtTest>
18#include <QSignalSpy>
19
20#include "aalcameraservice.h"
21
22#define private public
23#include "aalcameraexposurecontrol.h"
24
25class tst_AalCameraExposureControl : public QObject
26{
27 Q_OBJECT
28private slots:
29 void initTestCase();
30 void cleanupTestCase();
31
32 void setUnsupportedParameter();
33 void setExposureMode();
34
35private:
36 AalCameraExposureControl *m_exposureControl;
37 AalCameraService *m_service;
38};
39
40void tst_AalCameraExposureControl::initTestCase()
41{
42 m_service = new AalCameraService();
43 m_exposureControl = m_service->exposureControl();
44 m_service->connectCamera();
45}
46
47void tst_AalCameraExposureControl::cleanupTestCase()
48{
49 delete m_service;
50}
51
52void tst_AalCameraExposureControl::setUnsupportedParameter()
53{
54 QCameraExposureControl::ExposureParameter parameter = QCameraExposureControl::ISO;
55
56 QSignalSpy spyActual(m_exposureControl, SIGNAL(actualValueChanged(int)));
57 QSignalSpy spyRequested(m_exposureControl, SIGNAL(requestedValueChanged(int)));
58
59 bool supported = m_exposureControl->isParameterSupported(parameter);
60 bool valid = m_exposureControl->setValue(parameter, QVariant::fromValue(200));
61 QVariant requestedValue = m_exposureControl->requestedValue(parameter);
62 QVariant actualValue = m_exposureControl->actualValue(parameter);
63
64 QVERIFY(!supported);
65 QVERIFY(!valid);
66 QCOMPARE(requestedValue, QVariant());
67 QCOMPARE(actualValue, QVariant());
68
69 QCOMPARE(spyActual.count(), 0);
70 QCOMPARE(spyRequested.count(), 0);
71}
72
73void tst_AalCameraExposureControl::setExposureMode()
74{
75 QCameraExposureControl::ExposureParameter parameter = QCameraExposureControl::ExposureMode;
76
77 QSignalSpy spyActual(m_exposureControl, SIGNAL(actualValueChanged(int)));
78 QSignalSpy spyRequested(m_exposureControl, SIGNAL(requestedValueChanged(int)));
79
80 bool supported = m_exposureControl->isParameterSupported(parameter);
81 bool valid = m_exposureControl->setValue(parameter, QVariant::fromValue(QCameraExposure::ExposureSports));
82 QVariant requestedValue = m_exposureControl->requestedValue(parameter);
83 QVariant actualValue = m_exposureControl->actualValue(parameter);
84
85 QVERIFY(supported);
86 QVERIFY(valid);
87 QCOMPARE(requestedValue, QVariant::fromValue(QCameraExposure::ExposureSports));
88 QCOMPARE(actualValue, QVariant::fromValue(QCameraExposure::ExposureSports));
89
90 QCOMPARE(spyActual.count(), 1);
91 QCOMPARE(spyRequested.count(), 1);
92}
93
94QTEST_MAIN(tst_AalCameraExposureControl)
95
96#include "tst_aalcameraexposurecontrol.moc"
097
=== modified file 'unittests/mocks/aal/camera_compatibility_layer.cpp'
--- unittests/mocks/aal/camera_compatibility_layer.cpp 2013-06-07 08:54:10 +0000
+++ unittests/mocks/aal/camera_compatibility_layer.cpp 2014-07-15 12:39:22 +0000
@@ -16,8 +16,8 @@
16 * Authored by: Thomas Voss <thomas.voss@canonical.com>16 * Authored by: Thomas Voss <thomas.voss@canonical.com>
17 */17 */
1818
19#include <hybris/camera/camera_compatibility_layer.h>19#include "camera_compatibility_layer.h"
20#include <hybris/camera/camera_compatibility_layer_capabilities.h>20#include "camera_compatibility_layer_capabilities.h"
2121
22#include "camera_control.h"22#include "camera_control.h"
2323
@@ -95,6 +95,14 @@
95 crashTest(control);95 crashTest(control);
96}96}
9797
98void android_camera_enumerate_supported_scene_modes(CameraControl* control, scene_mode_callback cb, void* ctx)
99{
100 Q_UNUSED(cb);
101 Q_UNUSED(ctx);
102 crashTest(control);
103 cb(ctx, SCENE_MODE_ACTION);
104}
105
98void android_camera_set_scene_mode(CameraControl* control, SceneMode mode)106void android_camera_set_scene_mode(CameraControl* control, SceneMode mode)
99{107{
100 Q_UNUSED(mode);108 Q_UNUSED(mode);
101109
=== modified file 'unittests/mocks/aal/camera_compatibility_layer_capabilities.h'
--- unittests/mocks/aal/camera_compatibility_layer_capabilities.h 2013-02-11 15:56:21 +0000
+++ unittests/mocks/aal/camera_compatibility_layer_capabilities.h 2014-07-15 12:39:22 +0000
@@ -48,7 +48,8 @@
48 SCENE_MODE_ACTION,48 SCENE_MODE_ACTION,
49 SCENE_MODE_NIGHT,49 SCENE_MODE_NIGHT,
50 SCENE_MODE_PARTY,50 SCENE_MODE_PARTY,
51 SCENE_MODE_SUNSET51 SCENE_MODE_SUNSET,
52 SCENE_MODE_HDR
52} SceneMode;53} SceneMode;
5354
54typedef enum55typedef enum
@@ -95,6 +96,7 @@
95} FocusRegion;96} FocusRegion;
9697
97typedef void (*size_callback)(void* ctx, int width, int height);98typedef void (*size_callback)(void* ctx, int width, int height);
99typedef void (*scene_mode_callback)(void* ctx, SceneMode mode);
98100
99// Dumps the camera parameters to stdout.101// Dumps the camera parameters to stdout.
100void android_camera_dump_parameters(CameraControl* control);102void android_camera_dump_parameters(CameraControl* control);
@@ -115,6 +117,7 @@
115void android_camera_get_effect_mode(CameraControl* control, EffectMode* mode);117void android_camera_get_effect_mode(CameraControl* control, EffectMode* mode);
116void android_camera_get_flash_mode(CameraControl* control, FlashMode* mode);118void android_camera_get_flash_mode(CameraControl* control, FlashMode* mode);
117void android_camera_get_white_balance_mode(CameraControl* control, WhiteBalanceMode* mode);119void android_camera_get_white_balance_mode(CameraControl* control, WhiteBalanceMode* mode);
120void android_camera_enumerate_supported_scene_modes(CameraControl* control, scene_mode_callback cb, void* ctx);
118void android_camera_get_scene_mode(CameraControl* control, SceneMode* mode);121void android_camera_get_scene_mode(CameraControl* control, SceneMode* mode);
119void android_camera_get_auto_focus_mode(CameraControl* control, AutoFocusMode* mode);122void android_camera_get_auto_focus_mode(CameraControl* control, AutoFocusMode* mode);
120void android_camera_get_preview_format(CameraControl* control, CameraPixelFormat* format);123void android_camera_get_preview_format(CameraControl* control, CameraPixelFormat* format);
121124
=== modified file 'unittests/mocks/aal/media_recorder_layer.cpp'
--- unittests/mocks/aal/media_recorder_layer.cpp 2014-06-19 20:54:56 +0000
+++ unittests/mocks/aal/media_recorder_layer.cpp 2014-07-15 12:39:22 +0000
@@ -15,7 +15,7 @@
15 *15 *
16 */16 */
1717
18#include <hybris/media/media_recorder_layer.h>18#include "media_recorder_layer.h"
19#include "camera_control.h"19#include "camera_control.h"
2020
21#include <qglobal.h>21#include <qglobal.h>
2222
=== modified file 'unittests/unittests.pro'
--- unittests/unittests.pro 2013-05-24 11:25:15 +0000
+++ unittests/unittests.pro 2014-07-15 12:39:22 +0000
@@ -3,6 +3,7 @@
3SUBDIRS += \3SUBDIRS += \
4 mocks \4 mocks \
5 aalcameracontrol \5 aalcameracontrol \
6 aalcameraexposurecontrol \
6 aalcameraflashcontrol \7 aalcameraflashcontrol \
7 aalcamerafocuscontrol \8 aalcamerafocuscontrol \
8 aalcamerazoomcontrol \9 aalcamerazoomcontrol \

Subscribers

People subscribed via source and target branches