1 /* |
1 /* |
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
144 error = mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, result); |
144 error = mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, result); |
145 QVERIFY(error == CxeError::None); |
145 QVERIFY(error == CxeError::None); |
146 QCOMPARE(result.toInt(), 0); |
146 QCOMPARE(result.toInt(), 0); |
147 |
147 |
148 // case 1: setting a value to a valid key |
148 // case 1: setting a value to a valid key |
149 error = mSettingsModel->set(CxeSettingIds::SHARPNESS, 100); |
149 error = mSettingsModel->set(CxeSettingIds::SHARPNESS, QVariant(100)); |
150 QVERIFY(error == CxeError::None); |
150 QVERIFY(error == CxeError::None); |
151 |
151 |
152 // case 2: testing if the value set is right to sharpness key |
152 // case 2: testing if the value set is right to sharpness key |
153 error = mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, result); |
153 error = mSettingsModel->getSettingValue(CxeSettingIds::SHARPNESS, result); |
154 QVERIFY(error == CxeError::None); |
154 QVERIFY(error == CxeError::None); |
231 // 3. covers also cases where we test with invalid cases |
231 // 3. covers also cases where we test with invalid cases |
232 void UnitTestCxeSettingsModelImp::testImageScene() |
232 void UnitTestCxeSettingsModelImp::testImageScene() |
233 { |
233 { |
234 CxeScene result; |
234 CxeScene result; |
235 CxeError::Id error; |
235 CxeError::Id error; |
|
236 |
|
237 // do initialization |
|
238 mSettingsModel->cameraModeChanged(Cxe::ImageMode); |
|
239 |
236 // case 1: check the default image scene sharpness value |
240 // case 1: check the default image scene sharpness value |
237 result = mSettingsModel->currentImageScene(); |
241 result = mSettingsModel->currentImageScene(); |
238 QVERIFY(result[CxeSettingIds::SCENE_ID] == CxeSettingIds::IMAGE_SCENE_AUTO); |
242 QVERIFY(result[CxeSettingIds::SCENE_ID] == Cxe::IMAGE_SCENE_AUTO); |
239 QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessNormal); |
243 QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessNormal); |
240 |
244 |
241 QString key = CxeSettingIds::IMAGE_SCENE_PORTRAIT; |
|
242 |
|
243 // case 2: trying to set a new image scene |
245 // case 2: trying to set a new image scene |
244 error = mSettingsModel->setImageScene(key); |
246 QString sceneId = Cxe::IMAGE_SCENE_PORTRAIT; |
|
247 error = mSettingsModel->setImageScene(sceneId); |
245 QVERIFY(error == CxeError::None); |
248 QVERIFY(error == CxeError::None); |
246 |
249 |
247 // case 3: testing if NIGHT image scene is set correctly. checking its sharpness value |
250 // case 3: testing if NIGHT image scene is set correctly. checking its sharpness value |
248 result = mSettingsModel->currentImageScene(); |
251 result = mSettingsModel->currentImageScene(); |
249 QVERIFY(result[CxeSettingIds::SCENE_ID] == key); |
252 QVERIFY(result[CxeSettingIds::SCENE_ID] == sceneId); |
250 QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessSoft); |
253 QVERIFY(result[CxeSettingIds::SHARPNESS] == Cxe::SharpnessSoft); |
251 |
254 |
252 // case 3: trying to set a image scene with invalid value |
255 // case 3: trying to set a image scene with invalid value |
253 error = mSettingsModel->setImageScene(INVALID_KEY); |
256 error = mSettingsModel->setImageScene(INVALID_KEY); |
254 QVERIFY(error == CxeError::NotFound); |
257 QVERIFY(error == CxeError::NotFound); |
266 // 3. covers also cases where we test with invalid cases |
269 // 3. covers also cases where we test with invalid cases |
267 void UnitTestCxeSettingsModelImp::testVideoScene() |
270 void UnitTestCxeSettingsModelImp::testVideoScene() |
268 { |
271 { |
269 CxeScene result; |
272 CxeScene result; |
270 CxeError::Id error; |
273 CxeError::Id error; |
|
274 |
|
275 // do initialization |
|
276 mSettingsModel->cameraModeChanged(Cxe::VideoMode); |
|
277 |
271 // case 1: check the default image scene |
278 // case 1: check the default image scene |
272 result = mSettingsModel->currentVideoScene(); |
279 result = mSettingsModel->currentVideoScene(); |
273 QVERIFY(result[CxeSettingIds::SCENE_ID] == CxeSettingIds::VIDEO_SCENE_AUTO); |
280 QVERIFY(result[CxeSettingIds::SCENE_ID] == Cxe::VIDEO_SCENE_AUTO); |
274 QVERIFY(result[CxeSettingIds::FRAME_RATE] == 0); |
281 QVERIFY(result[CxeSettingIds::FRAME_RATE] == 0); |
275 |
282 |
276 QString key = CxeSettingIds::VIDEO_SCENE_LOWLIGHT; |
|
277 |
|
278 // case 2: trying to set a new image scene |
283 // case 2: trying to set a new image scene |
279 error = mSettingsModel->setVideoScene(key); |
284 QString sceneId = Cxe::VIDEO_SCENE_LOWLIGHT; |
|
285 error = mSettingsModel->setVideoScene(sceneId); |
280 QVERIFY(error == CxeError::None); |
286 QVERIFY(error == CxeError::None); |
281 |
287 |
282 // case 3: testing if NIGHT image scene is set correctly |
288 // case 3: testing if NIGHT image scene is set correctly |
283 result = mSettingsModel->currentVideoScene(); |
289 result = mSettingsModel->currentVideoScene(); |
284 QVERIFY(result[CxeSettingIds::SCENE_ID] == key); |
290 QVERIFY(result[CxeSettingIds::SCENE_ID] == sceneId); |
285 QVERIFY(result[CxeSettingIds::FRAME_RATE] == 15); |
291 QVERIFY(result[CxeSettingIds::FRAME_RATE] == 15); |
286 |
292 |
287 // case 3: trying to set a image scene with invalid value |
293 // case 3: trying to set a image scene with invalid value |
288 error = mSettingsModel->setVideoScene(INVALID_KEY); |
294 error = mSettingsModel->setVideoScene(INVALID_KEY); |
289 QVERIFY(error == CxeError::NotFound); |
295 QVERIFY(error == CxeError::NotFound); |