1 /* |
|
2 * Copyright (c) 2009-2010 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 |
|
18 #include <QTest> |
|
19 |
|
20 #include "cxenamespace.h" |
|
21 #include "cxutils.h" |
|
22 #include "cxeautofocuscontrol.h" |
|
23 #include "cxefakesettings.h" |
|
24 #include "cxefakecameradevice.h" |
|
25 #include "cxefakecameradevicecontrol.h" |
|
26 #include "cxesettingscontrolsymbian.h" |
|
27 #include "unittest_cxesettingscontrolsymbian.h" |
|
28 |
|
29 |
|
30 using namespace Cxe; |
|
31 using namespace CxeSettingIds; |
|
32 |
|
33 |
|
34 UnitTestCxeSettingsControlSymbian::UnitTestCxeSettingsControlSymbian() |
|
35 { |
|
36 } |
|
37 |
|
38 UnitTestCxeSettingsControlSymbian::~UnitTestCxeSettingsControlSymbian() |
|
39 { |
|
40 } |
|
41 |
|
42 void UnitTestCxeSettingsControlSymbian::init() |
|
43 { |
|
44 CX_DEBUG_ENTER_FUNCTION(); |
|
45 |
|
46 mCameraDeviceControl = new CxeFakeCameraDeviceControl(); |
|
47 mCameraDevice = new CxeFakeCameraDevice(); |
|
48 mCameraDevice->newCamera(mCameraDeviceControl->cameraIndex(), mCameraDeviceControl); |
|
49 |
|
50 mSettings = new CxeFakeSettings(); |
|
51 mSettingsControl = new CxeSettingsControlSymbian(*mCameraDevice, *mSettings); |
|
52 |
|
53 CX_DEBUG_EXIT_FUNCTION(); |
|
54 } |
|
55 |
|
56 void UnitTestCxeSettingsControlSymbian::cleanup() |
|
57 { |
|
58 CX_DEBUG_ENTER_FUNCTION(); |
|
59 |
|
60 delete mSettingsControl; |
|
61 mSettingsControl = NULL; |
|
62 |
|
63 delete mSettings; |
|
64 mSettings = NULL; |
|
65 |
|
66 delete mCameraDevice; |
|
67 mCameraDevice = NULL; |
|
68 |
|
69 delete mCameraDeviceControl; |
|
70 mCameraDeviceControl = NULL; |
|
71 |
|
72 CX_DEBUG_EXIT_FUNCTION(); |
|
73 } |
|
74 |
|
75 void UnitTestCxeSettingsControlSymbian::testHandleSettingValueChanged() |
|
76 { |
|
77 CX_DEBUG_ENTER_FUNCTION(); |
|
78 |
|
79 mSettingsControl->handleSettingValueChanged(FLASH_MODE, QVariant(1)); |
|
80 mSettingsControl->handleSettingValueChanged(WHITE_BALANCE, QVariant(1)); |
|
81 mSettingsControl->handleSettingValueChanged(LIGHT_SENSITIVITY, QVariant(1)); |
|
82 mSettingsControl->handleSettingValueChanged(EXPOSURE_MODE, QVariant(1)); |
|
83 mSettingsControl->handleSettingValueChanged(SHARPNESS, QVariant(1)); |
|
84 mSettingsControl->handleSettingValueChanged(COLOR_TONE, QVariant(1)); |
|
85 mSettingsControl->handleSettingValueChanged(EV_COMPENSATION_VALUE, QVariant(1)); |
|
86 mSettingsControl->handleSettingValueChanged(CONTRAST, QVariant(1)); |
|
87 mSettingsControl->handleSettingValueChanged(BRIGHTNESS, QVariant(1)); |
|
88 mSettingsControl->handleSettingValueChanged(FRAME_RATE, QVariant(1)); |
|
89 |
|
90 CX_DEBUG_EXIT_FUNCTION(); |
|
91 } |
|
92 |
|
93 void UnitTestCxeSettingsControlSymbian::testHandleSceneChanged() |
|
94 { |
|
95 CX_DEBUG_ENTER_FUNCTION(); |
|
96 |
|
97 CxeScene videoScene; |
|
98 |
|
99 videoScene.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO); |
|
100 videoScene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
|
101 videoScene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
102 videoScene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
|
103 videoScene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
104 videoScene.insert(CxeSettingIds::CONTRAST, 0); |
|
105 videoScene.insert(CxeSettingIds::FRAME_RATE, 0); |
|
106 videoScene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
107 |
|
108 mSettingsControl->handleSceneChanged(videoScene); |
|
109 |
|
110 CxeScene imageScene; |
|
111 |
|
112 imageScene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT); |
|
113 imageScene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto); |
|
114 imageScene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
115 imageScene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
|
116 imageScene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
117 imageScene.insert(CxeSettingIds::CONTRAST, 0); |
|
118 imageScene.insert(CxeSettingIds::SHARPNESS, SharpnessNormal); |
|
119 imageScene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
120 imageScene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
121 imageScene.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
122 imageScene.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
|
123 |
|
124 mSettingsControl->handleSceneChanged(imageScene); |
|
125 |
|
126 CX_DEBUG_EXIT_FUNCTION(); |
|
127 } |
|
128 |
|
129 |
|
130 // main() function |
|
131 // If need event loop for waiting signals, use QTEST_MAIN. |
|
132 // Need also active scheduler, so can't use QTEST_APPLESS_MAIN |
|
133 QTEST_MAIN(UnitTestCxeSettingsControlSymbian); |
|
134 |
|
135 // end of file |
|