|
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 |
|
18 #include <xqsettingsmanager.h> |
|
19 #include <xqsysinfo.h> |
|
20 #include <gsmerror.h> |
|
21 #include <exterror.h> |
|
22 #include <etelmm.h> |
|
23 #include <btsapdomainpskeys.h> |
|
24 #include "ut_cpplugincommon.h" |
|
25 #include "cpplugincommon.h" |
|
26 #include "qtestmains60.h" |
|
27 |
|
28 /*! |
|
29 UT_CpPluginCommon::UT_CpPluginCommon |
|
30 */ |
|
31 UT_CpPluginCommon::UT_CpPluginCommon() |
|
32 : mWrapper(NULL) |
|
33 { |
|
34 } |
|
35 |
|
36 /*! |
|
37 UT_CpPluginCommon::~UT_CpPluginCommon |
|
38 */ |
|
39 UT_CpPluginCommon::~UT_CpPluginCommon() |
|
40 { |
|
41 delete mWrapper; |
|
42 } |
|
43 |
|
44 /*! |
|
45 UT_CpPluginCommon::init |
|
46 */ |
|
47 void UT_CpPluginCommon::init() |
|
48 { |
|
49 initialize(); |
|
50 |
|
51 mWrapper = new CpSettingsWrapper(); |
|
52 } |
|
53 |
|
54 /*! |
|
55 UT_CpPluginCommon::cleanup |
|
56 */ |
|
57 void UT_CpPluginCommon::cleanup() |
|
58 { |
|
59 reset(); |
|
60 |
|
61 delete mWrapper; |
|
62 mWrapper = NULL; |
|
63 } |
|
64 |
|
65 /*! |
|
66 UT_CpPluginCommon::t_memleak |
|
67 */ |
|
68 void UT_CpPluginCommon::t_memleak() |
|
69 { |
|
70 |
|
71 } |
|
72 |
|
73 /*! |
|
74 UT_CpPluginCommon::t_showCallDuration |
|
75 */ |
|
76 void UT_CpPluginCommon::t_showCallDuration() |
|
77 { |
|
78 EXPECT(XQSettingsManager, readItemValue). |
|
79 returns(QVariant(23324)); |
|
80 |
|
81 mWrapper->showCallDuration(); |
|
82 QVERIFY(verify()); |
|
83 } |
|
84 |
|
85 /*! |
|
86 UT_CpPluginCommon::t_setShowCallDuration |
|
87 */ |
|
88 void UT_CpPluginCommon::t_setShowCallDuration() |
|
89 { |
|
90 mWrapper->setShowCallDuration(true); |
|
91 mWrapper->setShowCallDuration(false); |
|
92 QVERIFY(verify()); |
|
93 } |
|
94 |
|
95 /*! |
|
96 UT_CpPluginCommon::t_readSoftRejectText |
|
97 */ |
|
98 void UT_CpPluginCommon::t_readSoftRejectText() |
|
99 { |
|
100 QString text=""; |
|
101 bool userDefined=true; |
|
102 EXPECT(XQSettingsManager, readItemValue). |
|
103 returns(QVariant(true)); |
|
104 |
|
105 EXPECT(XQSettingsManager, readItemValue). |
|
106 returns(QVariant("text")); |
|
107 |
|
108 mWrapper->readSoftRejectText(text, userDefined); |
|
109 |
|
110 userDefined=false; |
|
111 EXPECT(XQSettingsManager, readItemValue). |
|
112 returns(QVariant(false)); |
|
113 EXPECT(XQSettingsManager, readItemValue). |
|
114 returns(QVariant("text")); |
|
115 mWrapper->readSoftRejectText(text, userDefined); |
|
116 |
|
117 QVERIFY(verify()); |
|
118 } |
|
119 |
|
120 /*! |
|
121 UT_CpPluginCommon::t_writeSoftRejectText |
|
122 */ |
|
123 void UT_CpPluginCommon::t_writeSoftRejectText() |
|
124 { |
|
125 QString text=""; |
|
126 bool userDefined=true; |
|
127 mWrapper->writeSoftRejectText(text, userDefined); |
|
128 userDefined=false; |
|
129 mWrapper->writeSoftRejectText(text, userDefined); |
|
130 QVERIFY(verify()); |
|
131 } |
|
132 |
|
133 /*! |
|
134 UT_CpPluginCommon::t_numberGroupingSupported |
|
135 */ |
|
136 void UT_CpPluginCommon::t_numberGroupingSupported() |
|
137 { |
|
138 EXPECT(XQSettingsManager, readItemValue). |
|
139 returns(QVariant(true)); |
|
140 |
|
141 mWrapper->numberGroupingSupported(); |
|
142 QVERIFY(verify()); |
|
143 } |
|
144 |
|
145 /*! |
|
146 UT_CpPluginCommon::t_voipSupported |
|
147 */ |
|
148 |
|
149 void UT_CpPluginCommon::t_voipSupported() |
|
150 { |
|
151 EXPECT(XQSysInfo, isSupported).with( |
|
152 KFeatureIdCommonVoip).returns(false); |
|
153 QCOMPARE( Tools::voipSupported(), false ); |
|
154 EXPECT(XQSysInfo, isSupported).with( |
|
155 KFeatureIdCommonVoip).returns(true); |
|
156 QCOMPARE( Tools::voipSupported(), true ); |
|
157 |
|
158 QVERIFY( verify() ); |
|
159 } |
|
160 |
|
161 /*! |
|
162 UT_CpPluginCommon::t_videoSupported |
|
163 */ |
|
164 void UT_CpPluginCommon::t_videoSupported() |
|
165 { |
|
166 EXPECT(XQSysInfo, isSupported).with( |
|
167 KFeatureIdCsVideoTelephony).returns(true); |
|
168 QCOMPARE( Tools::videoSupported(), true ); |
|
169 EXPECT(XQSysInfo, isSupported).with( |
|
170 KFeatureIdCsVideoTelephony).returns(false); |
|
171 QCOMPARE( Tools::videoSupported(), false ); |
|
172 |
|
173 QVERIFY( verify() ); |
|
174 } |
|
175 |
|
176 /*! |
|
177 UT_CpPluginCommon::t_errorCodeTextMapping |
|
178 */ |
|
179 void UT_CpPluginCommon::t_errorCodeTextMapping() |
|
180 { |
|
181 QString text = ""; |
|
182 Tools::errorCodeTextMapping(KErrGsmSSSubscriptionViolation, text); |
|
183 QCOMPARE( text, QString( |
|
184 "txt_phone_info_barring_operation_not_successful")); |
|
185 Tools::errorCodeTextMapping(KErrGsmSSUnknownSubscriber, text); |
|
186 QCOMPARE( text, QString( |
|
187 "txt_phone_info_not_allowed")); |
|
188 Tools::errorCodeTextMapping(KErrGsmSSAbsentSubscriber, text); |
|
189 QCOMPARE( text, QString( |
|
190 "txt_phone_info_not_allowed")); |
|
191 Tools::errorCodeTextMapping(KErrGsmSSIllegalOperation, text); |
|
192 QCOMPARE( text, QString( |
|
193 "txt_phone_info_not_allowed")); |
|
194 Tools::errorCodeTextMapping(KErrGsmSSIllegalSubscriber, text); |
|
195 QCOMPARE( text, QString( |
|
196 "txt_phone_info_not_allowed")); |
|
197 Tools::errorCodeTextMapping(KErrGsmSSIllegalEquipment, text); |
|
198 QCOMPARE( text, QString( |
|
199 "txt_phone_info_not_allowed")); |
|
200 Tools::errorCodeTextMapping(KErrGsmSSCallBarred, text); |
|
201 QCOMPARE( text, QString( |
|
202 "txt_phone_info_not_allowed")); |
|
203 Tools::errorCodeTextMapping(KErrGsmSSDataMissing, text); |
|
204 QCOMPARE( text, QString( |
|
205 "txt_phone_info_not_allowed")); |
|
206 Tools::errorCodeTextMapping(KErrGsmSSIncompatibility, text); |
|
207 QCOMPARE( text, QString( |
|
208 "txt_phone_info_conflict_error")); |
|
209 Tools::errorCodeTextMapping(KErrGsmSSSystemFailure, text); |
|
210 QCOMPARE( text, QString( |
|
211 "txt_phone_info_result_unknown")); |
|
212 Tools::errorCodeTextMapping(KErrGsmSSUnexpectedDataValue, text); |
|
213 QCOMPARE( text, QString( |
|
214 "txt_phone_info_request_rejected")); |
|
215 Tools::errorCodeTextMapping(KErrGsmSSResourcesUnavailable, text); |
|
216 QCOMPARE( text, QString( |
|
217 "txt_phone_info_request_rejected")); |
|
218 Tools::errorCodeTextMapping(KErrGsmSSNegativePasswordCheck, text); |
|
219 QCOMPARE( text, QString( |
|
220 "Password error")); |
|
221 Tools::errorCodeTextMapping(KErrGsmSSPasswordRegistrationFailure, text); |
|
222 QCOMPARE( text, QString( |
|
223 "Password error")); |
|
224 Tools::errorCodeTextMapping(KErrGsmSSPasswordAttemptsViolation, text); |
|
225 QCOMPARE( text, QString( |
|
226 "txt_phone_info_barring_password_blocked")); |
|
227 Tools::errorCodeTextMapping(KErrGsmSMSNoNetworkService, text); |
|
228 QCOMPARE( text, QString( |
|
229 "No network coverage")); |
|
230 Tools::errorCodeTextMapping(KErrGsmNoService, text); |
|
231 QCOMPARE( text, QString( |
|
232 "No network coverage")); |
|
233 Tools::errorCodeTextMapping(KErrSsActivationDataLost, text); |
|
234 QCOMPARE( text, QString( |
|
235 "Check network services")); |
|
236 Tools::errorCodeTextMapping(KErrGsmSSUnknownAlphabet, text); |
|
237 QCOMPARE( text, QString("txt_phone_info_invalid_phone_number")); |
|
238 |
|
239 EXPECT(XQSysInfo, isSupported).returns(false); |
|
240 Tools::errorCodeTextMapping(KErrGsmOfflineOpNotAllowed, text); |
|
241 QCOMPARE( text, QString( |
|
242 "txt_phone_info_request_not_completed")); |
|
243 QVERIFY( verify() ); |
|
244 |
|
245 EXPECT(XQSysInfo, isSupported).returns(true); |
|
246 EXPECT(XQSettingsManager, readItemValue).returns(QVariant(EBTSapConnected)); |
|
247 Tools::errorCodeTextMapping(KErrGsmOfflineOpNotAllowed, text); |
|
248 QCOMPARE( text, QString( |
|
249 "Operation not possible in SIM access profile mode")); |
|
250 QVERIFY( verify() ); |
|
251 |
|
252 EXPECT(XQSysInfo, isSupported).returns(true); |
|
253 EXPECT(XQSettingsManager, readItemValue).returns(QVariant(EBTSapNotConnected)); |
|
254 Tools::errorCodeTextMapping(KErrGsmOfflineOpNotAllowed, text); |
|
255 QCOMPARE( text, QString( |
|
256 "Operation not possible in Off-line mode")); |
|
257 |
|
258 Tools::errorCodeTextMapping(-1, text); |
|
259 QCOMPARE( text, QString( |
|
260 "txt_phone_info_request_not_completed")); |
|
261 |
|
262 QVERIFY( verify() ); |
|
263 |
|
264 } |
|
265 |
|
266 /*! |
|
267 UT_CpPluginCommon::t_readVtVideoSending |
|
268 */ |
|
269 void UT_CpPluginCommon::t_readVtVideoSending() |
|
270 { |
|
271 EXPECT(XQSettingsManager, readItemValue). |
|
272 returns(QVariant(1)); |
|
273 mWrapper->readVtVideoSending(); |
|
274 QVERIFY( verify() ); |
|
275 } |
|
276 |
|
277 /*! |
|
278 UT_CpPluginCommon::t_writeVtVideoSending |
|
279 */ |
|
280 void UT_CpPluginCommon::t_writeVtVideoSending() |
|
281 { |
|
282 EXPECT(XQSettingsManager, writeItemValue);//. |
|
283 //times(2); |
|
284 int i=0; |
|
285 mWrapper->writeVtVideoSending(i); |
|
286 QVERIFY( verify() ); |
|
287 } |
|
288 |
|
289 /*! |
|
290 UT_CpPluginCommon::t_isFeatureCallWaitingDistiquishNotProvisionedEnabled |
|
291 */ |
|
292 void UT_CpPluginCommon::t_isFeatureCallWaitingDistiquishNotProvisionedEnabled() |
|
293 { |
|
294 EXPECT(XQSettingsManager, readItemValue). |
|
295 returns(QVariant(1)); |
|
296 mWrapper->isFeatureCallWaitingDistiquishNotProvisionedEnabled(); |
|
297 QVERIFY( verify() ); |
|
298 } |
|
299 |
|
300 /*! |
|
301 UT_CpPluginCommon::t_isPhoneOffline |
|
302 */ |
|
303 void UT_CpPluginCommon::t_isPhoneOffline() |
|
304 { |
|
305 EXPECT(XQSettingsManager, readItemValue). |
|
306 returns(QVariant(1)); |
|
307 mWrapper->isPhoneOffline(); |
|
308 |
|
309 QVERIFY(verify()); |
|
310 } |
|
311 |
|
312 /*! |
|
313 UT_CpPluginCommon::t_isOngoingCall |
|
314 */ |
|
315 void UT_CpPluginCommon::t_isOngoingCall() |
|
316 { |
|
317 EXPECT(XQSettingsManager, readItemValue). |
|
318 returns(QVariant(1)); |
|
319 mWrapper->isOngoingCall(); |
|
320 QVERIFY( verify() ); |
|
321 } |
|
322 |
|
323 QTEST_MAIN_S60(UT_CpPluginCommon) |