|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #include <QTest> |
|
18 #include <QDebug> |
|
19 #include <QSignalSpy> |
|
20 |
|
21 #include "cxetestutils.h" |
|
22 #include "cxefakesettingsmodel.h" |
|
23 #include "unittest_cxesettingsimp.h" |
|
24 |
|
25 const char* FAIL_TEST_SETTING = "Fail test"; |
|
26 |
|
27 UnitTestCxeSettingsImp::UnitTestCxeSettingsImp() : |
|
28 mSettingsModel(NULL), |
|
29 mSettingsImp(NULL) |
|
30 { |
|
31 qRegisterMetaType<CxeScene>("CxeScene"); |
|
32 qRegisterMetaType<CxeError::Id>("CxeError::Id"); |
|
33 qRegisterMetaType<Cxe::CameraMode>("Cxe::CameraMode"); |
|
34 } |
|
35 |
|
36 UnitTestCxeSettingsImp::~UnitTestCxeSettingsImp() |
|
37 { |
|
38 cleanup(); |
|
39 } |
|
40 |
|
41 void UnitTestCxeSettingsImp::init() |
|
42 { |
|
43 mSettingsModel = new CxeFakeSettingsModel; |
|
44 mSettingsModel->initDefaultCameraSettings(); |
|
45 mSettingsImp = new CxeSettingsImp(*mSettingsModel); |
|
46 } |
|
47 |
|
48 void UnitTestCxeSettingsImp::cleanup() |
|
49 { |
|
50 delete mSettingsModel; |
|
51 mSettingsModel = NULL; |
|
52 |
|
53 delete mSettingsImp; |
|
54 mSettingsImp = NULL; |
|
55 } |
|
56 |
|
57 void UnitTestCxeSettingsImp::testLoadSettings() |
|
58 { |
|
59 Cxe::CameraMode mode; |
|
60 |
|
61 /* Observe sceneChanged signal from mSettingsImp |
|
62 */ |
|
63 CxeScene sigSce; |
|
64 QSignalSpy spyStateChange(mSettingsImp, SIGNAL(sceneChanged(CxeScene &))); |
|
65 QVERIFY( spyStateChange.isValid() ); |
|
66 |
|
67 /* Test load settings in camera/video mode. Helpper method is used to get the |
|
68 * new camera mode to test loadSettings method has set right camera mode |
|
69 */ |
|
70 mSettingsImp->loadSettings(Cxe::ImageMode); |
|
71 mode = mSettingsModel->getDummyCameraMode(); |
|
72 QCOMPARE(mode, Cxe::ImageMode); |
|
73 QVERIFY(CxeTestUtils::waitForSignal(spyStateChange, 1000)); // verify statechanges |
|
74 |
|
75 mSettingsImp->loadSettings(Cxe::VideoMode); |
|
76 mode = mSettingsModel->getDummyCameraMode(); |
|
77 QCOMPARE(mode, Cxe::VideoMode); |
|
78 QVERIFY(CxeTestUtils::waitForSignal(spyStateChange, 1000)); // verify statechanges |
|
79 } |
|
80 |
|
81 |
|
82 void UnitTestCxeSettingsImp::testGet() |
|
83 { |
|
84 CxeError::Id err = CxeError::None; |
|
85 |
|
86 QString stringValue; |
|
87 QString expectedValue = "1"; |
|
88 QVariant testValue; |
|
89 |
|
90 /* Test that get -method accepts key and returns correct value. Fakeclass method |
|
91 * is used to check that returned value matches with fakeclass' test values |
|
92 */ |
|
93 err = mSettingsImp->get(CxeSettingIds::BRIGHTNESS, stringValue); |
|
94 QCOMPARE(err, CxeError::None); |
|
95 mSettingsModel->getSettingValue(CxeSettingIds::BRIGHTNESS, testValue); |
|
96 QCOMPARE(stringValue, QString(testValue.toString())); |
|
97 |
|
98 /* Test that returned value can be viewed as string and int, since get -method |
|
99 * may be used for both strings and integers |
|
100 */ |
|
101 int num = 1; |
|
102 QCOMPARE(stringValue, expectedValue); |
|
103 QVERIFY(stringValue.toInt() == num); |
|
104 |
|
105 err = mSettingsImp->get(CxeSettingIds::COLOR_TONE, stringValue); |
|
106 QCOMPARE(err, CxeError::None); |
|
107 mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, testValue); |
|
108 QCOMPARE(stringValue, QString(testValue.toString())); |
|
109 |
|
110 err = mSettingsImp->get(CxeSettingIds::CONTRAST, stringValue); |
|
111 QCOMPARE(err, CxeError::None); |
|
112 mSettingsModel->getSettingValue(CxeSettingIds::CONTRAST, testValue); |
|
113 QCOMPARE(stringValue, QString(testValue.toString())); |
|
114 |
|
115 err = mSettingsImp->get(CxeSettingIds::EV_COMPENSATION_VALUE, stringValue); |
|
116 QCOMPARE(err, CxeError::None); |
|
117 mSettingsModel->getSettingValue(CxeSettingIds::EV_COMPENSATION_VALUE, testValue); |
|
118 QCOMPARE(stringValue, QString(testValue.toString())); |
|
119 |
|
120 err = mSettingsImp->get(CxeSettingIds::EXPOSURE_MODE, stringValue); |
|
121 QCOMPARE(err, CxeError::None); |
|
122 mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, testValue); |
|
123 QCOMPARE(stringValue, QString(testValue.toString())); |
|
124 |
|
125 err = mSettingsImp->get(CxeSettingIds::FLASH_MODE, stringValue); |
|
126 QCOMPARE(err, CxeError::None); |
|
127 mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, testValue); |
|
128 QCOMPARE(stringValue, QString(testValue.toString())); |
|
129 |
|
130 err = mSettingsImp->get(CxeSettingIds::FNAME_FOLDER_SUFFIX, stringValue); |
|
131 QCOMPARE(err, CxeError::None); |
|
132 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_FOLDER_SUFFIX, testValue); |
|
133 QCOMPARE(stringValue, QString(testValue.toString())); |
|
134 |
|
135 err = mSettingsImp->get(CxeSettingIds::FNAME_IMAGE_COUNTER, stringValue); |
|
136 QCOMPARE(err, CxeError::None); |
|
137 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_IMAGE_COUNTER, testValue); |
|
138 QCOMPARE(stringValue, QString(testValue.toString())); |
|
139 |
|
140 err = mSettingsImp->get(CxeSettingIds::FNAME_MONTH_FOLDER, stringValue); |
|
141 QCOMPARE(err, CxeError::None); |
|
142 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_MONTH_FOLDER, testValue); |
|
143 QCOMPARE(stringValue, QString(testValue.toString())); |
|
144 |
|
145 err = mSettingsImp->get(CxeSettingIds::FNAME_VIDEO_COUNTER, stringValue); |
|
146 QCOMPARE(err, CxeError::None); |
|
147 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_VIDEO_COUNTER, testValue); |
|
148 QCOMPARE(stringValue, QString(testValue.toString())); |
|
149 |
|
150 err = mSettingsImp->get(CxeSettingIds::FOCAL_RANGE, stringValue); |
|
151 QCOMPARE(err, CxeError::None); |
|
152 mSettingsModel->getSettingValue(CxeSettingIds::FOCAL_RANGE, testValue); |
|
153 QCOMPARE(stringValue, QString(testValue.toString())); |
|
154 |
|
155 err = mSettingsImp->get(CxeSettingIds::FRAME_RATE, stringValue); |
|
156 QCOMPARE(err, CxeError::None); |
|
157 mSettingsModel->getSettingValue(CxeSettingIds::FRAME_RATE, testValue); |
|
158 QCOMPARE(stringValue, QString(testValue.toString())); |
|
159 |
|
160 err = mSettingsImp->get(CxeSettingIds::IMAGE_QUALITY, stringValue); |
|
161 QCOMPARE(err, CxeError::None); |
|
162 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_QUALITY, testValue); |
|
163 QCOMPARE(stringValue, QString(testValue.toString())); |
|
164 |
|
165 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE, stringValue); |
|
166 QCOMPARE(err, CxeError::None); |
|
167 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE, testValue); |
|
168 QCOMPARE(stringValue, QString(testValue.toString())); |
|
169 |
|
170 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_AUTO, stringValue); |
|
171 QCOMPARE(err, CxeError::None); |
|
172 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_AUTO, testValue); |
|
173 QCOMPARE(stringValue, QString(testValue.toString())); |
|
174 |
|
175 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_CLOSEUP, stringValue); |
|
176 QCOMPARE(err, CxeError::None); |
|
177 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_CLOSEUP, testValue); |
|
178 QCOMPARE(stringValue, QString(testValue.toString())); |
|
179 |
|
180 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_MACRO, stringValue); |
|
181 QCOMPARE(err, CxeError::None); |
|
182 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_MACRO, testValue); |
|
183 QCOMPARE(stringValue, QString(testValue.toString())); |
|
184 |
|
185 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_NIGHT, stringValue); |
|
186 QCOMPARE(err, CxeError::None); |
|
187 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHT, testValue); |
|
188 QCOMPARE(stringValue, QString(testValue.toString())); |
|
189 |
|
190 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_PORTRAIT, stringValue); |
|
191 QCOMPARE(err, CxeError::None); |
|
192 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_PORTRAIT, testValue); |
|
193 QCOMPARE(stringValue, QString(testValue.toString())); |
|
194 |
|
195 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_SCENERY, stringValue); |
|
196 QCOMPARE(err, CxeError::None); |
|
197 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SCENERY, testValue); |
|
198 QCOMPARE(stringValue, QString(testValue.toString())); |
|
199 |
|
200 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, stringValue); |
|
201 QCOMPARE(err, CxeError::None); |
|
202 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, testValue); |
|
203 QCOMPARE(stringValue, QString(testValue.toString())); |
|
204 |
|
205 err = mSettingsImp->get(CxeSettingIds::IMAGE_SCENE_SPORTS, stringValue); |
|
206 QCOMPARE(err, CxeError::None); |
|
207 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SPORTS, testValue); |
|
208 QCOMPARE(stringValue, QString(testValue.toString())); |
|
209 |
|
210 err = mSettingsImp->get(CxeSettingIds::LIGHT_SENSITIVITY, stringValue); |
|
211 QCOMPARE(err, CxeError::None); |
|
212 mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, testValue); |
|
213 QCOMPARE(stringValue, QString(testValue.toString())); |
|
214 |
|
215 err = mSettingsImp->get(CxeSettingIds::SCENE_ID, stringValue); |
|
216 QCOMPARE(err, CxeError::None); |
|
217 mSettingsModel->getSettingValue(CxeSettingIds::SCENE_ID, testValue); |
|
218 QCOMPARE(stringValue, QString(testValue.toString())); |
|
219 |
|
220 err = mSettingsImp->get(CxeSettingIds::SECONDARY_CAMERA, stringValue); |
|
221 QCOMPARE(err, CxeError::None); |
|
222 mSettingsModel->getSettingValue(CxeSettingIds::SECONDARY_CAMERA, testValue); |
|
223 QCOMPARE(stringValue, QString(testValue.toString())); |
|
224 |
|
225 err = mSettingsImp->get(CxeSettingIds::SELF_TIMER, stringValue); |
|
226 QCOMPARE(err, CxeError::None); |
|
227 mSettingsModel->getSettingValue(CxeSettingIds::SELF_TIMER, testValue); |
|
228 QCOMPARE(stringValue, QString(testValue.toString())); |
|
229 |
|
230 err = mSettingsImp->get(CxeSettingIds::SHARPNESS, stringValue); |
|
231 QCOMPARE(err, CxeError::None); |
|
232 mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, testValue); |
|
233 QCOMPARE(stringValue, QString(testValue.toString())); |
|
234 |
|
235 err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE, stringValue); |
|
236 QCOMPARE(err, CxeError::None); |
|
237 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE, testValue); |
|
238 QCOMPARE(stringValue, QString(testValue.toString())); |
|
239 |
|
240 err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_AUTO, stringValue); |
|
241 QCOMPARE(err, CxeError::None); |
|
242 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_AUTO, testValue); |
|
243 QCOMPARE(stringValue, QString(testValue.toString())); |
|
244 |
|
245 err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, stringValue); |
|
246 QCOMPARE(err, CxeError::None); |
|
247 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, testValue); |
|
248 QCOMPARE(stringValue, QString(testValue.toString())); |
|
249 |
|
250 err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_NIGHT, stringValue); |
|
251 QCOMPARE(err, CxeError::None); |
|
252 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHT, testValue); |
|
253 QCOMPARE(stringValue, QString(testValue.toString())); |
|
254 |
|
255 err = mSettingsImp->get(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, stringValue); |
|
256 QCOMPARE(err, CxeError::None); |
|
257 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, testValue); |
|
258 QCOMPARE(stringValue, QString(testValue.toString())); |
|
259 |
|
260 err = mSettingsImp->get(CxeSettingIds::WHITE_BALANCE, stringValue); |
|
261 QCOMPARE(err, CxeError::None); |
|
262 mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, testValue); |
|
263 QCOMPARE(stringValue, QString(testValue.toString())); |
|
264 |
|
265 /* Test error values |
|
266 */ |
|
267 err = mSettingsImp->get(FAIL_TEST_SETTING , stringValue); |
|
268 QCOMPARE(err, CxeError::NotFound); |
|
269 } |
|
270 |
|
271 void UnitTestCxeSettingsImp::testGet2() |
|
272 { |
|
273 QVariant value; |
|
274 QVariant reference; |
|
275 |
|
276 mSettingsImp->get(0, 0, Cxe::Repository, value); |
|
277 mSettingsModel->getSettingValue(0, 0, Cxe::Repository, reference); |
|
278 QCOMPARE(value, reference); |
|
279 |
|
280 mSettingsImp->get(0, 0, Cxe::PublishAndSubscribe, value); |
|
281 mSettingsModel->getSettingValue(0, 0, Cxe::PublishAndSubscribe, reference); |
|
282 QCOMPARE(value, reference); |
|
283 |
|
284 } |
|
285 |
|
286 void UnitTestCxeSettingsImp::testSet() |
|
287 { |
|
288 CxeError::Id error; |
|
289 int range = 0; |
|
290 QString string = ""; |
|
291 QVariant variant(1); |
|
292 QVariant checkValue; |
|
293 |
|
294 /* Test that signal is corresponding correctly when setting value is changed |
|
295 */ |
|
296 QList<QVariant> spyArguments; |
|
297 QSignalSpy signalSpy(mSettingsImp, SIGNAL(settingValueChanged(QString, QVariant))); |
|
298 QVERIFY( signalSpy.isValid() ); |
|
299 |
|
300 error = mSettingsImp->set(CxeSettingIds::BRIGHTNESS, range); |
|
301 QCOMPARE(error, CxeError::None); |
|
302 QVERIFY(CxeTestUtils::waitForSignal(signalSpy, 1000)); // verify statechanges |
|
303 |
|
304 spyArguments = signalSpy.takeFirst(); |
|
305 QCOMPARE(spyArguments.at(0).toString(), QString(CxeSettingIds::BRIGHTNESS)); |
|
306 QCOMPARE(spyArguments.at(1).toInt(), range); |
|
307 |
|
308 /* Test parameters |
|
309 */ |
|
310 error = mSettingsImp->set(CxeSettingIds::BRIGHTNESS, range); |
|
311 QCOMPARE(error, CxeError::None); |
|
312 mSettingsModel->getSettingValue(CxeSettingIds::BRIGHTNESS, checkValue); |
|
313 QCOMPARE(int(checkValue.toInt()), range); |
|
314 |
|
315 error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneNormal); |
|
316 QCOMPARE(error, CxeError::None); |
|
317 mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue); |
|
318 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneNormal)); |
|
319 |
|
320 error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneSepia); |
|
321 QCOMPARE(error, CxeError::None); |
|
322 mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue); |
|
323 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneSepia)); |
|
324 |
|
325 error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneNegative); |
|
326 QCOMPARE(error, CxeError::None); |
|
327 mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue); |
|
328 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneNegative)); |
|
329 |
|
330 error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneBlackAndWhite); |
|
331 QCOMPARE(error, CxeError::None); |
|
332 mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue); |
|
333 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneBlackAndWhite)); |
|
334 |
|
335 error = mSettingsImp->set(CxeSettingIds::COLOR_TONE, Cxe::ColortoneVivid); |
|
336 QCOMPARE(error, CxeError::None); |
|
337 mSettingsModel->getSettingValue(CxeSettingIds::COLOR_TONE, checkValue); |
|
338 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ColortoneVivid)); |
|
339 |
|
340 error = mSettingsImp->set(CxeSettingIds::CONTRAST, range); |
|
341 QCOMPARE(error, CxeError::None); |
|
342 mSettingsModel->getSettingValue(CxeSettingIds::CONTRAST, checkValue); |
|
343 QCOMPARE(int(checkValue.toInt()), range); |
|
344 |
|
345 error = mSettingsImp->set(CxeSettingIds::EV_COMPENSATION_VALUE, range); |
|
346 QCOMPARE(error, CxeError::None); |
|
347 mSettingsModel->getSettingValue(CxeSettingIds::EV_COMPENSATION_VALUE, checkValue); |
|
348 QCOMPARE(int(checkValue.toInt()), range); |
|
349 |
|
350 error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureAuto); |
|
351 QCOMPARE(error, CxeError::None); |
|
352 mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue); |
|
353 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureAuto)); |
|
354 |
|
355 error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureBacklight); |
|
356 QCOMPARE(error, CxeError::None); |
|
357 mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue); |
|
358 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureBacklight)); |
|
359 |
|
360 error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureNight); |
|
361 QCOMPARE(error, CxeError::None); |
|
362 mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue); |
|
363 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureNight)); |
|
364 |
|
365 error = mSettingsImp->set(CxeSettingIds::EXPOSURE_MODE, Cxe::ExposureSport); |
|
366 QCOMPARE(error, CxeError::None); |
|
367 mSettingsModel->getSettingValue(CxeSettingIds::EXPOSURE_MODE, checkValue); |
|
368 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::ExposureSport)); |
|
369 |
|
370 error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashAntiRedEye); |
|
371 QCOMPARE(error, CxeError::None); |
|
372 mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue); |
|
373 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashAntiRedEye)); |
|
374 |
|
375 error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashAuto); |
|
376 QCOMPARE(error, CxeError::None); |
|
377 mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue); |
|
378 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashAuto)); |
|
379 |
|
380 error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashOff); |
|
381 QCOMPARE(error, CxeError::None); |
|
382 mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue); |
|
383 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashOff)); |
|
384 |
|
385 error = mSettingsImp->set(CxeSettingIds::FLASH_MODE, Cxe::FlashOn); |
|
386 QCOMPARE(error, CxeError::None); |
|
387 mSettingsModel->getSettingValue(CxeSettingIds::FLASH_MODE, checkValue); |
|
388 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::FlashOn)); |
|
389 |
|
390 error = mSettingsImp->set(CxeSettingIds::FNAME_FOLDER_SUFFIX, range); |
|
391 QCOMPARE(error, CxeError::None); |
|
392 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_FOLDER_SUFFIX, checkValue); |
|
393 QCOMPARE(int(checkValue.toInt()), range); |
|
394 |
|
395 error = mSettingsImp->set(CxeSettingIds::FNAME_IMAGE_COUNTER, range); |
|
396 QCOMPARE(error, CxeError::None); |
|
397 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_IMAGE_COUNTER, checkValue); |
|
398 QCOMPARE(int(checkValue.toInt()), range); |
|
399 |
|
400 error = mSettingsImp->set(CxeSettingIds::FNAME_MONTH_FOLDER, string); |
|
401 QCOMPARE(error, CxeError::None); |
|
402 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_MONTH_FOLDER, checkValue); |
|
403 QCOMPARE(int(checkValue.toInt()), range); |
|
404 |
|
405 error = mSettingsImp->set(CxeSettingIds::FNAME_VIDEO_COUNTER, range); |
|
406 QCOMPARE(error, CxeError::None); |
|
407 mSettingsModel->getSettingValue(CxeSettingIds::FNAME_VIDEO_COUNTER, checkValue); |
|
408 QCOMPARE(int(checkValue.toInt()), range); |
|
409 |
|
410 error = mSettingsImp->set(CxeSettingIds::FOCAL_RANGE, range); |
|
411 QCOMPARE(error, CxeError::None); |
|
412 mSettingsModel->getSettingValue(CxeSettingIds::FOCAL_RANGE, checkValue); |
|
413 QCOMPARE(int(checkValue.toInt()), range); |
|
414 |
|
415 error = mSettingsImp->set(CxeSettingIds::IMAGE_QUALITY, range); |
|
416 QCOMPARE(error, CxeError::None); |
|
417 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_QUALITY, checkValue); |
|
418 QCOMPARE(int(checkValue.toInt()), range); |
|
419 |
|
420 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE, range); |
|
421 QCOMPARE(error, CxeError::None); |
|
422 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE, checkValue); |
|
423 QCOMPARE(int(checkValue.toInt()), range); |
|
424 |
|
425 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_AUTO, range); |
|
426 QCOMPARE(error, CxeError::None); |
|
427 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_AUTO, checkValue); |
|
428 QCOMPARE(int(checkValue.toInt()), range); |
|
429 |
|
430 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_CLOSEUP, range); |
|
431 QCOMPARE(error, CxeError::None); |
|
432 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_CLOSEUP, checkValue); |
|
433 QCOMPARE(int(checkValue.toInt()), range); |
|
434 |
|
435 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_MACRO, range); |
|
436 QCOMPARE(error, CxeError::None); |
|
437 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_MACRO, checkValue); |
|
438 QCOMPARE(int(checkValue.toInt()), range); |
|
439 |
|
440 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_NIGHT, range); |
|
441 QCOMPARE(error, CxeError::None); |
|
442 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHT, checkValue); |
|
443 QCOMPARE(int(checkValue.toInt()), range); |
|
444 |
|
445 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, range); |
|
446 QCOMPARE(error, CxeError::None); |
|
447 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT, checkValue); |
|
448 QCOMPARE(int(checkValue.toInt()), range); |
|
449 |
|
450 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_PORTRAIT, range); |
|
451 QCOMPARE(error, CxeError::None); |
|
452 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_PORTRAIT, checkValue); |
|
453 QCOMPARE(int(checkValue.toInt()), range); |
|
454 |
|
455 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_SCENERY, range); |
|
456 QCOMPARE(error, CxeError::None); |
|
457 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SCENERY, checkValue); |
|
458 QCOMPARE(int(checkValue.toInt()), range); |
|
459 |
|
460 error = mSettingsImp->set(CxeSettingIds::IMAGE_SCENE_SPORTS, range); |
|
461 QCOMPARE(error, CxeError::None); |
|
462 mSettingsModel->getSettingValue(CxeSettingIds::IMAGE_SCENE_SPORTS, checkValue); |
|
463 QCOMPARE(int(checkValue.toInt()), range); |
|
464 |
|
465 error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityAutomatic); |
|
466 QCOMPARE(error, CxeError::None); |
|
467 mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue); |
|
468 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityAutomatic)); |
|
469 |
|
470 error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityHigh); |
|
471 QCOMPARE(error, CxeError::None); |
|
472 mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue); |
|
473 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityHigh)); |
|
474 |
|
475 error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityLow); |
|
476 QCOMPARE(error, CxeError::None); |
|
477 mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue); |
|
478 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityLow)); |
|
479 |
|
480 error = mSettingsImp->set(CxeSettingIds::LIGHT_SENSITIVITY, Cxe::LightSensitivityMedium); |
|
481 QCOMPARE(error, CxeError::None); |
|
482 mSettingsModel->getSettingValue(CxeSettingIds::LIGHT_SENSITIVITY, checkValue); |
|
483 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::LightSensitivityMedium)); |
|
484 |
|
485 error = mSettingsImp->set(CxeSettingIds::SCENE_ID, range); |
|
486 QCOMPARE(error, CxeError::None); |
|
487 mSettingsModel->getSettingValue(CxeSettingIds::SCENE_ID, checkValue); |
|
488 QCOMPARE(int(checkValue.toInt()), range); |
|
489 |
|
490 error = mSettingsImp->set(CxeSettingIds::SECONDARY_CAMERA, range); |
|
491 QCOMPARE(error, CxeError::None); |
|
492 mSettingsModel->getSettingValue(CxeSettingIds::SECONDARY_CAMERA, checkValue); |
|
493 QCOMPARE(int(checkValue.toInt()), range); |
|
494 |
|
495 error = mSettingsImp->set(CxeSettingIds::SELF_TIMER, range); |
|
496 QCOMPARE(error, CxeError::None); |
|
497 mSettingsModel->getSettingValue(CxeSettingIds::SELF_TIMER, checkValue); |
|
498 QCOMPARE(int(checkValue.toInt()), range); |
|
499 |
|
500 error = mSettingsImp->set(CxeSettingIds::SHARPNESS, Cxe::SharpnessHard); |
|
501 QCOMPARE(error, CxeError::None); |
|
502 mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, checkValue); |
|
503 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::SharpnessHard)); |
|
504 |
|
505 error = mSettingsImp->set(CxeSettingIds::SHARPNESS, Cxe::SharpnessNormal); |
|
506 QCOMPARE(error, CxeError::None); |
|
507 mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, checkValue); |
|
508 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::SharpnessNormal)); |
|
509 |
|
510 error = mSettingsImp->set(CxeSettingIds::SHARPNESS, Cxe::SharpnessSoft); |
|
511 QCOMPARE(error, CxeError::None); |
|
512 mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, checkValue); |
|
513 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::SharpnessSoft)); |
|
514 |
|
515 error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE, range); |
|
516 QCOMPARE(error, CxeError::None); |
|
517 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE, checkValue); |
|
518 QCOMPARE(int(checkValue.toInt()), range); |
|
519 |
|
520 error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_AUTO, range); |
|
521 QCOMPARE(error, CxeError::None); |
|
522 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_AUTO, checkValue); |
|
523 QCOMPARE(int(checkValue.toInt()), range); |
|
524 |
|
525 error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, range); |
|
526 QCOMPARE(error, CxeError::None); |
|
527 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, checkValue); |
|
528 QCOMPARE(int(checkValue.toInt()), range); |
|
529 |
|
530 error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_NIGHT, range); |
|
531 QCOMPARE(error, CxeError::None); |
|
532 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHT, checkValue); |
|
533 QCOMPARE(int(checkValue.toInt()), range); |
|
534 |
|
535 error = mSettingsImp->set(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, range); |
|
536 QCOMPARE(error, CxeError::None); |
|
537 mSettingsModel->getSettingValue(CxeSettingIds::VIDEO_SCENE_NIGHTPORTRAIT, checkValue); |
|
538 QCOMPARE(int(checkValue.toInt()), range); |
|
539 |
|
540 error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceAutomatic); |
|
541 QCOMPARE(error, CxeError::None); |
|
542 mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue); |
|
543 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceAutomatic)); |
|
544 |
|
545 error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceCloudy); |
|
546 QCOMPARE(error, CxeError::None); |
|
547 mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue); |
|
548 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceCloudy)); |
|
549 |
|
550 error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceFluorescent); |
|
551 QCOMPARE(error, CxeError::None); |
|
552 mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue); |
|
553 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceFluorescent)); |
|
554 |
|
555 error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceIncandescent); |
|
556 QCOMPARE(error, CxeError::None); |
|
557 mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue); |
|
558 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceIncandescent)); |
|
559 |
|
560 error = mSettingsImp->set(CxeSettingIds::WHITE_BALANCE, Cxe::WhitebalanceSunny); |
|
561 QCOMPARE(error, CxeError::None); |
|
562 mSettingsModel->getSettingValue(CxeSettingIds::WHITE_BALANCE, checkValue); |
|
563 QCOMPARE(int(checkValue.toInt()), ((int)Cxe::WhitebalanceSunny)); |
|
564 |
|
565 /* Test fail parameter |
|
566 */ |
|
567 error = mSettingsImp->set(FAIL_TEST_SETTING, Cxe::ColortoneNormal); |
|
568 QCOMPARE(error, CxeError::NotFound); |
|
569 } |
|
570 |
|
571 // main() function non-GUI testing |
|
572 QTEST_MAIN(UnitTestCxeSettingsImp) |
|
573 |