1/****************************************************************************
2**
3** Copyright (C) 2016 The Qt Company Ltd.
4** Contact: https://www.qt.io/licensing/
5**
6** This file is part of the test suite of the Qt Toolkit.
7**
8** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9** Commercial License Usage
10** Licensees holding valid commercial Qt licenses may use this file in
11** accordance with the commercial license agreement provided with the
12** Software or, alternatively, in accordance with the terms contained in
13** a written agreement between you and The Qt Company. For licensing terms
14** and conditions see https://www.qt.io/terms-conditions. For further
15** information use the contact form at https://www.qt.io/contact-us.
16**
17** GNU General Public License Usage
18** Alternatively, this file may be used under the terms of the GNU
19** General Public License version 3 as published by the Free Software
20** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21** included in the packaging of this file. Please review the following
22** information to ensure the GNU General Public License requirements will
23** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24**
25** $QT_END_LICENSE$
26**
27****************************************************************************/
28
29#ifndef MOCKCAMERAIMAGEPROCESSINGCONTROL_H
30#define MOCKCAMERAIMAGEPROCESSINGCONTROL_H
31
32#include "qcameraimageprocessingcontrol.h"
33
34class MockImageProcessingControl : public QCameraImageProcessingControl
35{
36 Q_OBJECT
37public:
38 MockImageProcessingControl(QObject *parent = 0)
39 : QCameraImageProcessingControl(parent)
40 {
41 m_supportedWhiteBalance.insert(value: QCameraImageProcessing::WhiteBalanceAuto);
42 }
43
44 QCameraImageProcessing::WhiteBalanceMode whiteBalanceMode() const
45 {
46 return m_whiteBalanceMode;
47 }
48 void setWhiteBalanceMode(QCameraImageProcessing::WhiteBalanceMode mode)
49 {
50 m_whiteBalanceMode = mode;
51 }
52
53 bool isWhiteBalanceModeSupported(QCameraImageProcessing::WhiteBalanceMode mode) const
54 {
55 return m_supportedWhiteBalance.contains(value: mode);
56 }
57
58 void setSupportedWhiteBalanceModes(QSet<QCameraImageProcessing::WhiteBalanceMode> modes)
59 {
60 m_supportedWhiteBalance = modes;
61 }
62
63 bool isParameterSupported(ProcessingParameter parameter) const
64 {
65 switch (parameter)
66 {
67 case ContrastAdjustment:
68 case BrightnessAdjustment:
69 case SharpeningAdjustment:
70 case SaturationAdjustment:
71 case DenoisingAdjustment:
72 case ColorTemperature:
73 case WhiteBalancePreset:
74 return true;
75 default :
76 return false;
77 }
78 }
79
80 bool isParameterValueSupported(ProcessingParameter parameter, const QVariant &value) const
81 {
82 if (parameter != WhiteBalancePreset)
83 return false;
84
85 return m_supportedWhiteBalance.contains(value: value.value<QCameraImageProcessing::WhiteBalanceMode>());
86 }
87
88 QVariant parameter(ProcessingParameter parameter) const
89 {
90 switch (parameter) {
91 case ContrastAdjustment:
92 return m_contrast;
93 case SaturationAdjustment:
94 return m_saturation;
95 case BrightnessAdjustment:
96 return m_brightness;
97 case SharpeningAdjustment:
98 return m_sharpeningLevel;
99 case DenoisingAdjustment:
100 return m_denoising;
101 case ColorTemperature:
102 return m_manualWhiteBalance;
103 case WhiteBalancePreset:
104 return QVariant::fromValue<QCameraImageProcessing::WhiteBalanceMode>(value: m_whiteBalanceMode);
105 default:
106 return QVariant();
107 }
108 }
109 void setParameter(ProcessingParameter parameter, const QVariant &value)
110 {
111 switch (parameter) {
112 case ContrastAdjustment:
113 m_contrast = value;
114 break;
115 case SaturationAdjustment:
116 m_saturation = value;
117 break;
118 case BrightnessAdjustment:
119 m_brightness = value;
120 break;
121 case SharpeningAdjustment:
122 m_sharpeningLevel = value;
123 break;
124 case DenoisingAdjustment:
125 m_denoising = value;
126 break;
127 case ColorTemperature:
128 m_manualWhiteBalance = value;
129 break;
130 case WhiteBalancePreset:
131 m_whiteBalanceMode = value.value<QCameraImageProcessing::WhiteBalanceMode>();
132 break;
133 default:
134 break;
135 }
136 }
137
138
139private:
140 QCameraImageProcessing::WhiteBalanceMode m_whiteBalanceMode;
141 QSet<QCameraImageProcessing::WhiteBalanceMode> m_supportedWhiteBalance;
142 QVariant m_manualWhiteBalance;
143 QVariant m_contrast;
144 QVariant m_sharpeningLevel;
145 QVariant m_saturation;
146 QVariant m_brightness;
147 QVariant m_denoising;
148};
149
150#endif // MOCKCAMERAIMAGEPROCESSINGCONTROL_H
151

source code of qtmultimedia/tests/auto/unit/qmultimedia_common/mockcameraimageprocessingcontrol.h