37
|
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 "ut_cpplugincommon.h"
|
|
19 |
#include "qtestmains60.h"
|
|
20 |
#include <gsmerror.h>
|
|
21 |
#include <exterror.h>
|
|
22 |
#include <etelmm.h>
|
|
23 |
#include <btsapdomainpskeys.h>
|
|
24 |
#define private public
|
|
25 |
#include "cpplugincommon.h"
|
|
26 |
|
|
27 |
/*!
|
|
28 |
UT_CpPluginCommon::UT_CpPluginCommon
|
|
29 |
*/
|
|
30 |
UT_CpPluginCommon::UT_CpPluginCommon()
|
|
31 |
: mWrapper(NULL)
|
|
32 |
{
|
|
33 |
}
|
|
34 |
|
|
35 |
/*!
|
|
36 |
UT_CpPluginCommon::~UT_CpPluginCommon
|
|
37 |
*/
|
|
38 |
UT_CpPluginCommon::~UT_CpPluginCommon()
|
|
39 |
{
|
|
40 |
delete mWrapper;
|
|
41 |
}
|
|
42 |
|
|
43 |
/*!
|
|
44 |
UT_CpPluginCommon::init
|
|
45 |
*/
|
|
46 |
void UT_CpPluginCommon::init()
|
|
47 |
{
|
|
48 |
initialize();
|
|
49 |
|
|
50 |
mWrapper = new CpSettingsWrapper();
|
|
51 |
}
|
|
52 |
|
|
53 |
/*!
|
|
54 |
UT_CpPluginCommon::cleanup
|
|
55 |
*/
|
|
56 |
void UT_CpPluginCommon::cleanup()
|
|
57 |
{
|
|
58 |
reset();
|
|
59 |
|
|
60 |
delete mWrapper;
|
|
61 |
mWrapper = NULL;
|
|
62 |
}
|
|
63 |
|
|
64 |
/*!
|
|
65 |
UT_CpPluginCommon::t_memleak
|
|
66 |
*/
|
|
67 |
void UT_CpPluginCommon::t_memleak()
|
|
68 |
{
|
|
69 |
|
|
70 |
}
|
|
71 |
|
|
72 |
/*!
|
|
73 |
UT_CpPluginCommon::t_memleak
|
|
74 |
*/
|
|
75 |
void UT_CpPluginCommon::t_showCallDuration()
|
|
76 |
{
|
|
77 |
expect("XQSettingsManager::readItemValue").
|
|
78 |
returns(QVariant(23324));
|
|
79 |
|
|
80 |
mWrapper->showCallDuration();
|
|
81 |
QVERIFY(verify());
|
|
82 |
}
|
|
83 |
|
|
84 |
/*!
|
|
85 |
UT_CpPluginCommon::t_memleak
|
|
86 |
*/
|
|
87 |
void UT_CpPluginCommon::t_setShowCallDuration()
|
|
88 |
{
|
|
89 |
mWrapper->setShowCallDuration(true);
|
|
90 |
}
|
|
91 |
|
|
92 |
/*!
|
|
93 |
UT_CpPluginCommon::t_memleak
|
|
94 |
*/
|
|
95 |
void UT_CpPluginCommon::t_readSoftRejectText()
|
|
96 |
{
|
|
97 |
QString text="";
|
|
98 |
bool userDefined=true;
|
|
99 |
expect("XQSettingsManager::readItemValue").
|
|
100 |
returns(QVariant(true));
|
|
101 |
|
|
102 |
expect("XQSettingsManager::readItemValue").
|
|
103 |
returns(QVariant("text"));
|
|
104 |
|
|
105 |
mWrapper->readSoftRejectText(text, userDefined);
|
|
106 |
QVERIFY(verify());
|
|
107 |
}
|
|
108 |
|
|
109 |
/*!
|
|
110 |
UT_CpPluginCommon::t_memleak
|
|
111 |
*/
|
|
112 |
void UT_CpPluginCommon::t_writeSoftRejectText()
|
|
113 |
{
|
|
114 |
QString text="";
|
|
115 |
bool userDefined=true;
|
|
116 |
mWrapper->writeSoftRejectText(text, userDefined);
|
|
117 |
}
|
|
118 |
|
|
119 |
/*!
|
|
120 |
UT_CpPluginCommon::t_memleak
|
|
121 |
*/
|
|
122 |
void UT_CpPluginCommon::t_numberGroupingSupported()
|
|
123 |
{
|
|
124 |
expect("XQSettingsManager::readItemValue").
|
|
125 |
returns(QVariant(true));
|
|
126 |
|
|
127 |
mWrapper->numberGroupingSupported();
|
|
128 |
QVERIFY(verify());
|
|
129 |
}
|
|
130 |
|
|
131 |
/*!
|
|
132 |
UT_CpPluginCommon::t_voipSupported
|
|
133 |
*/
|
|
134 |
|
|
135 |
void UT_CpPluginCommon::t_voipSupported()
|
|
136 |
{
|
|
137 |
expect("XQSysInfo::isSupported").with(
|
|
138 |
KFeatureIdCommonVoip).returns(false);
|
|
139 |
QCOMPARE( Tools::voipSupported(), false );
|
|
140 |
expect("XQSysInfo::isSupported").with(
|
|
141 |
KFeatureIdCommonVoip).returns(true);
|
|
142 |
QCOMPARE( Tools::voipSupported(), true );
|
|
143 |
|
|
144 |
QVERIFY( verify() );
|
|
145 |
}
|
|
146 |
|
|
147 |
/*!
|
|
148 |
UT_CpPluginCommon::t_videoSupported
|
|
149 |
*/
|
|
150 |
void UT_CpPluginCommon::t_videoSupported()
|
|
151 |
{
|
|
152 |
expect("XQSysInfo::isSupported").with(
|
|
153 |
KFeatureIdCsVideoTelephony).returns(true);
|
|
154 |
QCOMPARE( Tools::videoSupported(), true );
|
|
155 |
expect("XQSysInfo::isSupported").with(
|
|
156 |
KFeatureIdCsVideoTelephony).returns(false);
|
|
157 |
QCOMPARE( Tools::videoSupported(), false );
|
|
158 |
|
|
159 |
QVERIFY( verify() );
|
|
160 |
}
|
|
161 |
|
|
162 |
/*!
|
|
163 |
UT_CpPluginCommon::t_memleak
|
|
164 |
*/
|
|
165 |
void UT_CpPluginCommon::t_errorCodeTextMapping()
|
|
166 |
{
|
|
167 |
QString text = "";
|
|
168 |
Tools::errorCodeTextMapping(KErrGsmSSSubscriptionViolation, text);
|
|
169 |
QCOMPARE( text, QString(
|
|
170 |
"txt_phone_info_barring_operation_not_successful"));
|
|
171 |
Tools::errorCodeTextMapping(KErrGsmSSUnknownSubscriber, text);
|
|
172 |
QCOMPARE( text, QString(
|
|
173 |
"txt_phone_info_not_allowed"));
|
|
174 |
Tools::errorCodeTextMapping(KErrGsmSSAbsentSubscriber, text);
|
|
175 |
QCOMPARE( text, QString(
|
|
176 |
"txt_phone_info_not_allowed"));
|
|
177 |
Tools::errorCodeTextMapping(KErrGsmSSIllegalOperation, text);
|
|
178 |
QCOMPARE( text, QString(
|
|
179 |
"txt_phone_info_not_allowed"));
|
|
180 |
Tools::errorCodeTextMapping(KErrGsmSSIllegalSubscriber, text);
|
|
181 |
QCOMPARE( text, QString(
|
|
182 |
"txt_phone_info_not_allowed"));
|
|
183 |
Tools::errorCodeTextMapping(KErrGsmSSIllegalEquipment, text);
|
|
184 |
QCOMPARE( text, QString(
|
|
185 |
"txt_phone_info_not_allowed"));
|
|
186 |
Tools::errorCodeTextMapping(KErrGsmSSCallBarred, text);
|
|
187 |
QCOMPARE( text, QString(
|
|
188 |
"txt_phone_info_not_allowed"));
|
|
189 |
Tools::errorCodeTextMapping(KErrGsmSSDataMissing, text);
|
|
190 |
QCOMPARE( text, QString(
|
|
191 |
"txt_phone_info_not_allowed"));
|
|
192 |
Tools::errorCodeTextMapping(KErrGsmSSIncompatibility, text);
|
|
193 |
QCOMPARE( text, QString(
|
|
194 |
"Services in conflict"));
|
|
195 |
Tools::errorCodeTextMapping(KErrGsmSSSystemFailure, text);
|
|
196 |
QCOMPARE( text, QString(
|
|
197 |
"txt_phone_info_result_unknown"));
|
|
198 |
Tools::errorCodeTextMapping(KErrGsmSSUnexpectedDataValue, text);
|
|
199 |
QCOMPARE( text, QString(
|
|
200 |
"txt_phone_info_request_rejected"));
|
|
201 |
Tools::errorCodeTextMapping(KErrGsmSSResourcesUnavailable, text);
|
|
202 |
QCOMPARE( text, QString(
|
|
203 |
"txt_phone_info_request_rejected"));
|
|
204 |
Tools::errorCodeTextMapping(KErrGsmSSNegativePasswordCheck, text);
|
|
205 |
QCOMPARE( text, QString(
|
|
206 |
"Password error"));
|
|
207 |
Tools::errorCodeTextMapping(KErrGsmSSPasswordRegistrationFailure, text);
|
|
208 |
QCOMPARE( text, QString(
|
|
209 |
"Password error"));
|
|
210 |
Tools::errorCodeTextMapping(KErrGsmSSPasswordAttemptsViolation, text);
|
|
211 |
QCOMPARE( text, QString(
|
|
212 |
"txt_phone_info_barring_password_blocked"));
|
|
213 |
Tools::errorCodeTextMapping(KErrGsmSMSNoNetworkService, text);
|
|
214 |
QCOMPARE( text, QString(
|
|
215 |
"No network coverage"));
|
|
216 |
Tools::errorCodeTextMapping(KErrGsmNoService, text);
|
|
217 |
QCOMPARE( text, QString(
|
|
218 |
"No network coverage"));
|
|
219 |
Tools::errorCodeTextMapping(KErrSsActivationDataLost, text);
|
|
220 |
QCOMPARE( text, QString(
|
|
221 |
"Check network services"));
|
|
222 |
Tools::errorCodeTextMapping(KErrGsmSSUnknownAlphabet, text);
|
|
223 |
QCOMPARE( text, QString("txt_phone_info_invalid_phone_number"));
|
|
224 |
|
|
225 |
expect("XQSysInfo::isSupported").returns(false);
|
|
226 |
Tools::errorCodeTextMapping(KErrGsmOfflineOpNotAllowed, text);
|
|
227 |
QCOMPARE( text, QString(
|
|
228 |
"txt_phone_info_request_not_completed"));
|
|
229 |
QVERIFY( verify() );
|
|
230 |
|
|
231 |
expect("XQSysInfo::isSupported").returns(true);
|
|
232 |
expect("XQSettingsManager::readItemValue").returns(QVariant(EBTSapConnected));
|
|
233 |
Tools::errorCodeTextMapping(KErrGsmOfflineOpNotAllowed, text);
|
|
234 |
QCOMPARE( text, QString(
|
|
235 |
"Operation not possible in SIM access profile mode"));
|
|
236 |
QVERIFY( verify() );
|
|
237 |
|
|
238 |
expect("XQSysInfo::isSupported").returns(true);
|
|
239 |
expect("XQSettingsManager::readItemValue").returns(QVariant(EBTSapNotConnected));
|
|
240 |
Tools::errorCodeTextMapping(KErrGsmOfflineOpNotAllowed, text);
|
|
241 |
QCOMPARE( text, QString(
|
|
242 |
"Operation not possible in Off-line mode"));
|
|
243 |
|
|
244 |
Tools::errorCodeTextMapping(-1, text);
|
|
245 |
QCOMPARE( text, QString(
|
|
246 |
"txt_phone_info_request_not_completed"));
|
|
247 |
|
|
248 |
QVERIFY( verify() );
|
|
249 |
|
|
250 |
}
|
|
251 |
|
|
252 |
|
|
253 |
QTEST_MAIN_S60(UT_CpPluginCommon)
|