74 initialData = Cxe::ColortoneSepia; |
76 initialData = Cxe::ColortoneSepia; |
75 result = CxeSettingsMapperSymbian::Map2CameraEffect(initialData); |
77 result = CxeSettingsMapperSymbian::Map2CameraEffect(initialData); |
76 QVERIFY(result == CCamera::CCameraImageProcessing::EEffectSepia); |
78 QVERIFY(result == CCamera::CCameraImageProcessing::EEffectSepia); |
77 |
79 |
78 // case 2: try with direct value which is invalid |
80 // case 2: try with direct value which is invalid |
79 result = CxeSettingsMapperSymbian::Map2CameraEffect(-1); |
81 result = CxeSettingsMapperSymbian::Map2CameraEffect( |
|
82 static_cast<Cxe::Colortone>(-1)); |
80 QVERIFY(result == CCamera::CCameraImageProcessing::EEffectNone); |
83 QVERIFY(result == CCamera::CCameraImageProcessing::EEffectNone); |
81 |
84 |
82 } |
85 } |
83 |
86 |
84 void UnitTestCxeSettingsMapperSymbian::testMap2CameraExposureMode() |
87 void UnitTestCxeSettingsMapperSymbian::testMap2CameraExposureMode() |
85 { |
88 { |
86 CCamera::TExposure result; |
89 CCamera::TExposure result; |
87 int initialData = -1; |
90 Cxe::ExposureMode initialData = static_cast<Cxe::ExposureMode>(-1); |
88 |
91 |
89 // case 0: check with unknown value |
92 // case 0: check with unknown value |
90 result = CxeSettingsMapperSymbian::Map2CameraExposureMode(initialData); |
93 result = CxeSettingsMapperSymbian::Map2CameraExposureMode(initialData); |
91 QVERIFY(result == CCamera::EExposureAuto); |
94 QVERIFY(result == CCamera::EExposureAuto); |
92 |
95 |
94 initialData = Cxe::ExposureNight; |
97 initialData = Cxe::ExposureNight; |
95 result = CxeSettingsMapperSymbian::Map2CameraExposureMode(initialData); |
98 result = CxeSettingsMapperSymbian::Map2CameraExposureMode(initialData); |
96 QVERIFY(result == CCamera::EExposureNight); |
99 QVERIFY(result == CCamera::EExposureNight); |
97 |
100 |
98 // case 2: try with direct value which is invalid |
101 // case 2: try with direct value which is invalid |
99 result = CxeSettingsMapperSymbian::Map2CameraExposureMode(99999); |
102 result = CxeSettingsMapperSymbian::Map2CameraExposureMode( |
|
103 static_cast<Cxe::ExposureMode>(99999)); |
100 QVERIFY(result == CCamera::EExposureAuto); |
104 QVERIFY(result == CCamera::EExposureAuto); |
101 } |
105 } |
102 |
106 |
103 void UnitTestCxeSettingsMapperSymbian::testMap2CameraFlash() |
107 void UnitTestCxeSettingsMapperSymbian::testMap2CameraFlash() |
104 { |
108 { |
105 CCamera::TFlash result; |
109 CCamera::TFlash result; |
106 int initialData = -1; |
110 Cxe::FlashMode initialData = static_cast<Cxe::FlashMode>(-1); |
107 |
111 |
108 // case 0: check with unknown value |
112 // case 0: check with unknown value |
109 result = CxeSettingsMapperSymbian::Map2CameraFlash(initialData); |
113 result = CxeSettingsMapperSymbian::Map2CameraFlash(initialData); |
110 QVERIFY(result == CCamera::EFlashAuto); |
114 QVERIFY(result == CCamera::EFlashAuto); |
111 |
115 |
148 initialData = Cxe::WhitebalanceSunny; |
153 initialData = Cxe::WhitebalanceSunny; |
149 result = CxeSettingsMapperSymbian::Map2CameraWb(initialData); |
154 result = CxeSettingsMapperSymbian::Map2CameraWb(initialData); |
150 QVERIFY(result == CCamera::EWBDaylight); |
155 QVERIFY(result == CCamera::EWBDaylight); |
151 |
156 |
152 // case 2: try with direct value which is invalid |
157 // case 2: try with direct value which is invalid |
153 result = CxeSettingsMapperSymbian::Map2CameraWb(99999); |
158 result = CxeSettingsMapperSymbian::Map2CameraWb( |
|
159 static_cast<Cxe::Whitebalance>(99999)); |
154 QVERIFY(result == CCamera::EWBAuto); |
160 QVERIFY(result == CCamera::EWBAuto); |
155 } |
161 } |
156 |
162 |
|
163 void UnitTestCxeSettingsMapperSymbian::testMap2UseCaseHintVideoParameters() |
|
164 { |
|
165 CxeVideoDetails details; |
|
166 MCameraUseCaseHint::TVideoCodec codec = MCameraUseCaseHint::ECodecUnknown; |
|
167 MCameraUseCaseHint::TVideoProfile profile = MCameraUseCaseHint::EProfileUnknown; |
|
168 |
|
169 details.mVideoCodecMimeType = "video/H263-2000"; |
|
170 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
171 QCOMPARE(codec, MCameraUseCaseHint::ECodecH263); |
|
172 QCOMPARE(profile, MCameraUseCaseHint::EProfileH263P0L10); |
|
173 |
|
174 details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=2"; |
|
175 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
176 QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4); |
|
177 QCOMPARE(profile, MCameraUseCaseHint::EProfileMPEG4SpL2); |
|
178 |
|
179 details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=3"; |
|
180 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
181 QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4); |
|
182 QCOMPARE(profile, MCameraUseCaseHint::EProfileMPEG4SpL3); |
|
183 |
|
184 details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=4"; |
|
185 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
186 QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4); |
|
187 QCOMPARE(profile, MCameraUseCaseHint::EProfileMPEG4SpL4a); |
|
188 |
|
189 details.mVideoCodecMimeType = "video/mp4v-es; profile-level-id=foobar"; |
|
190 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
191 QCOMPARE(codec, MCameraUseCaseHint::ECodecMpeg4); |
|
192 QCOMPARE(profile, MCameraUseCaseHint::EProfileUnknown); |
|
193 |
|
194 details.mVideoCodecMimeType = "video/H264; profile-level-id=42801E"; |
|
195 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
196 QCOMPARE(codec, MCameraUseCaseHint::ECodecH264); |
|
197 QCOMPARE(profile, MCameraUseCaseHint::EProfileH264BpL3); |
|
198 |
|
199 details.mVideoCodecMimeType = "video/H264; profile-level-id=42801F"; |
|
200 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
201 QCOMPARE(codec, MCameraUseCaseHint::ECodecH264); |
|
202 QCOMPARE(profile, MCameraUseCaseHint::EProfileH264BpL3_1); |
|
203 |
|
204 details.mVideoCodecMimeType = "video/H264; profile-level-id=foobar"; |
|
205 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
206 QCOMPARE(codec, MCameraUseCaseHint::ECodecH264); |
|
207 QCOMPARE(profile, MCameraUseCaseHint::EProfileUnknown); |
|
208 |
|
209 details.mVideoCodecMimeType = "invalid"; |
|
210 CxeSettingsMapperSymbian::Map2UseCaseHintVideoParameters(details, codec, profile); |
|
211 QCOMPARE(codec, MCameraUseCaseHint::ECodecUnknown); |
|
212 QCOMPARE(profile, MCameraUseCaseHint::EProfileUnknown); |
|
213 } |
|
214 |
157 // main() function non-GUI testing |
215 // main() function non-GUI testing |
158 QTEST_APPLESS_MAIN(UnitTestCxeSettingsMapperSymbian) |
216 QTEST_APPLESS_MAIN(UnitTestCxeSettingsMapperSymbian); |
159 ; |
|