author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 24 Nov 2009 08:56:33 +0200 | |
changeset 33 | 50974a8b132e |
parent 22 | fc9cf246af83 |
permissions | -rw-r--r-- |
19 | 1 |
/* |
2 |
* Copyright (c) 2002 - 2007 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 the License "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: Tests sysinfo general information |
|
15 |
* |
|
16 |
*/ |
|
17 |
||
18 |
||
19 |
||
20 |
||
21 |
// INCLUDE FILES |
|
22 |
#include <e32svr.h> |
|
23 |
#include <StifParser.h> |
|
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
24 |
#include <StifTestInterface.h> |
19 | 25 |
#include "tsysgeneral.h" |
33
50974a8b132e
Revision: 200945
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
26 |
#include <coemain.h> |
19 | 27 |
// EXTERNAL DATA STRUCTURES |
28 |
//extern ?external_data; |
|
29 |
||
30 |
// EXTERNAL FUNCTION PROTOTYPES |
|
31 |
//extern ?external_function( ?arg_type,?arg_type ); |
|
32 |
||
33 |
// CONSTANTS |
|
34 |
//const ?type ?constant_var = ?constant; |
|
35 |
||
36 |
// MACROS |
|
37 |
//#define ?macro ?macro_def |
|
38 |
||
39 |
// LOCAL CONSTANTS AND MACROS |
|
40 |
//const ?type ?constant_var = ?constant; |
|
41 |
//#define ?macro_name ?macro_def |
|
42 |
||
43 |
// MODULE DATA STRUCTURES |
|
44 |
//enum ?declaration |
|
45 |
//typedef ?declaration |
|
46 |
||
47 |
// LOCAL FUNCTION PROTOTYPES |
|
48 |
//?type ?function_name( ?arg_type, ?arg_type ); |
|
49 |
||
50 |
// FORWARD DECLARATIONS |
|
51 |
//class ?FORWARD_CLASSNAME; |
|
52 |
||
53 |
// ============================= LOCAL FUNCTIONS =============================== |
|
54 |
||
55 |
// ----------------------------------------------------------------------------- |
|
56 |
// ?function_name ?description. |
|
57 |
// ?description |
|
58 |
// Returns: ?value_1: ?description |
|
59 |
// ?value_n: ?description_line1 |
|
60 |
// ?description_line2 |
|
61 |
// ----------------------------------------------------------------------------- |
|
62 |
// |
|
63 |
/* |
|
64 |
?type ?function_name( |
|
65 |
?arg_type arg, // ?description |
|
66 |
?arg_type arg) // ?description |
|
67 |
{ |
|
68 |
||
69 |
?code // ?comment |
|
70 |
||
71 |
// ?comment |
|
72 |
?code |
|
73 |
} |
|
74 |
*/ |
|
75 |
||
76 |
// ============================ MEMBER FUNCTIONS =============================== |
|
77 |
||
78 |
// ----------------------------------------------------------------------------- |
|
79 |
// Ctsysgeneral::Delete |
|
80 |
// Delete here all resources allocated and opened from test methods. |
|
81 |
// Called from destructor. |
|
82 |
// ----------------------------------------------------------------------------- |
|
83 |
// |
|
84 |
void Ctsysgeneral::Delete() |
|
85 |
{ |
|
86 |
||
87 |
} |
|
88 |
// ----------------------------------------------------------------------------- |
|
89 |
// Ctsysgeneral::RunMethodL |
|
90 |
// Run specified method. Contains also table of test mothods and their names. |
|
91 |
// ----------------------------------------------------------------------------- |
|
92 |
// |
|
93 |
TInt Ctsysgeneral::RunMethodL( |
|
94 |
CStifItemParser& aItem ) |
|
95 |
{ |
|
96 |
||
97 |
static TStifFunctionInfo const KFunctions[] = |
|
98 |
{ |
|
99 |
// Copy this line for every implemented function. |
|
100 |
// First string is the function name used in TestScripter script file. |
|
101 |
// Second is the actual implementation member function. |
|
102 |
ENTRY( "GetDisplayLanguage", Ctsysgeneral::GetDisplayLanguage ), |
|
103 |
ENTRY( "SetWrongDataType", Ctsysgeneral::SetWrongDataType ), |
|
104 |
ENTRY( "SetAndGetInputLanguage", Ctsysgeneral::SetAndGetInputLanguage ), |
|
105 |
ENTRY( "SetAndGetPridictiveText", Ctsysgeneral::SetAndGetPridictiveText ), |
|
106 |
ENTRY( "SetAndGetVibraActive", Ctsysgeneral::SetAndGetVibraActive ), |
|
107 |
ENTRY( "GetActiveUSBMode", Ctsysgeneral::GetActiveUSBMode ), |
|
108 |
ENTRY( "GetAvblUSBMode", Ctsysgeneral::GetAvblUSBMode ), |
|
109 |
ENTRY( "AsyncGetinfoStatus", Ctsysgeneral::AsyncGetinfoStatus) , |
|
110 |
ENTRY( "NotifyIpAndPredText", Ctsysgeneral::NotifyIpAndPredText) , |
|
111 |
ENTRY( "SetWrongKey", Ctsysgeneral::SetWrongKey ), |
|
112 |
ENTRY( "SetWrongEntity", Ctsysgeneral::SetWrongEntity ), |
|
113 |
ENTRY( "GetWrongKey", Ctsysgeneral::GetWrongKey ), |
|
114 |
||
115 |
}; |
|
116 |
||
117 |
const TInt count = sizeof( KFunctions ) / |
|
118 |
sizeof( TStifFunctionInfo ); |
|
119 |
||
120 |
return RunInternalL( KFunctions, count, aItem ); |
|
121 |
||
122 |
} |
|
123 |
||
124 |
// ----------------------------------------------------------------------------- |
|
125 |
// Ctsysgeneral::GetDisplayLanguage |
|
126 |
// Test method for Get DisplayLanguage |
|
127 |
// ----------------------------------------------------------------------------- |
|
128 |
// |
|
129 |
TInt Ctsysgeneral::GetDisplayLanguage( CStifItemParser& aItem ) |
|
130 |
{ |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
131 |
CCoeEnv* coeSupported = NULL; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
132 |
coeSupported = CCoeEnv::Static(); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
133 |
if (coeSupported) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
134 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
135 |
__UHEAP_MARK; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
136 |
_LIT(KEntity, "General") ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
137 |
_LIT(KKey, "DisplayLanguage") ; |
19 | 138 |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
139 |
TInt returnCode = KErrNone; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
140 |
TInt expLanguage = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
141 |
TInt expDataType = 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
142 |
aItem.GetNextInt(expLanguage) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
143 |
CSysInfoService *CoreObj = CSysInfoService::NewL() ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
144 |
if (NULL == CoreObj) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
145 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
146 |
iLog->Log(_L8("Failed.. @Core")) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
147 |
return KErrGeneral; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
148 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
149 |
CSysData *sysData = NULL; |
19 | 150 |
|
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
151 |
iLog->Log(_L8("DisplayLanguage : %d"), expLanguage) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
152 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity, KKey, sysData)) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
153 |
if (KErrNotFound != leaveCode) |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
154 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
155 |
iLog->Log(_L("Failed, Set Display language found ret err: %d"), |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
156 |
leaveCode); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
157 |
returnCode = KErrGeneral; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
158 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
159 |
else |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
160 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
161 |
returnCode = KErrNone; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
162 |
iLog->Log(_L8("P.. @TRAPD")) ; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
163 |
} |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
164 |
|
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
165 |
delete sysData; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
166 |
delete CoreObj; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
167 |
__UHEAP_MARKEND; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
168 |
return returnCode; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
169 |
} |
19 | 170 |
else |
22
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
171 |
{ |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
172 |
iLog->Log(_L("CCoeEnv not supported . So passing the test case")); |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
173 |
return 0; |
fc9cf246af83
Revision: 200931
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
19
diff
changeset
|
174 |
} |
19 | 175 |
} |
176 |
||
177 |
// ----------------------------------------------------------------------------- |
|
178 |
// Ctsysgeneral::SetWrongDataType |
|
179 |
// Test method for setting Wrong DataType |
|
180 |
// ----------------------------------------------------------------------------- |
|
181 |
// |
|
182 |
TInt Ctsysgeneral::SetWrongDataType( CStifItemParser& /*aItem*/ ) |
|
183 |
{ |
|
184 |
||
185 |
__UHEAP_MARK; |
|
186 |
||
187 |
_LIT(KEntity,"Display") ; |
|
188 |
_LIT(KKey,"Brightness") ; |
|
189 |
||
190 |
TInt returnCode = KErrNone ; |
|
191 |
||
192 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
193 |
||
194 |
if( NULL == CoreObj) |
|
195 |
{ |
|
196 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
197 |
return KErrGeneral ; |
|
198 |
} |
|
199 |
||
200 |
CStringData *sysData = CStringData::NewL(KEntity) ; |
|
201 |
||
202 |
TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,sysData)) ; |
|
203 |
||
204 |
if(KErrArgument != leaveCode) |
|
205 |
{ |
|
206 |
returnCode = KErrGeneral ; |
|
207 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
208 |
} |
|
209 |
else |
|
210 |
{ |
|
211 |
iLog->Log(_L8("Passed..")) ; |
|
212 |
} |
|
213 |
||
214 |
delete sysData ; |
|
215 |
delete CoreObj ; |
|
216 |
||
217 |
||
218 |
__UHEAP_MARKEND ; |
|
219 |
return returnCode ; |
|
220 |
||
221 |
} |
|
222 |
||
223 |
||
224 |
||
225 |
// ----------------------------------------------------------------------------- |
|
226 |
// Ctsysgeneral::SetAndGetInputLanguage |
|
227 |
// Test method for Setting and Getting InputLanguage |
|
228 |
// ----------------------------------------------------------------------------- |
|
229 |
// |
|
230 |
TInt Ctsysgeneral::SetAndGetInputLanguage( CStifItemParser& /*aItem*/ ) |
|
231 |
{ |
|
232 |
||
233 |
__UHEAP_MARK; |
|
234 |
||
235 |
_LIT(KEntity,"General") ; |
|
236 |
_LIT(KKey,"InputLanguage") ; |
|
237 |
_LIT(KLangListKey,"SupportedLanguages"); |
|
238 |
||
239 |
TInt returnCode = KErrNone ; |
|
240 |
TInt expLanguage = 0 ; |
|
241 |
TInt expDataType = 0 ; |
|
242 |
TInt engLang = 1 ; |
|
243 |
//aItem.GetNextInt (expLanguage) ; |
|
244 |
||
245 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
246 |
||
247 |
if( NULL == CoreObj) |
|
248 |
{ |
|
249 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
250 |
return KErrGeneral ; |
|
251 |
} |
|
252 |
||
253 |
TInt currLang = -1; |
|
254 |
||
255 |
//get the list of lang's available on the system |
|
256 |
CSysData *sysData1 = NULL; |
|
257 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KLangListKey,sysData1)) ; |
|
258 |
||
259 |
||
260 |
TInt langCount = 0; |
|
261 |
||
262 |
if(KErrNone == leaveCode) |
|
263 |
{ |
|
264 |
//Get list of languages passed.. |
|
265 |
||
266 |
CLanguageList *langListData = NULL; |
|
267 |
TInt retType = sysData1->DataType() ; |
|
268 |
if( CSysData::ELanguageList == retType ) |
|
269 |
{ |
|
270 |
langListData = (CLanguageList*)sysData1 ; |
|
271 |
langCount = langListData->Count(); |
|
272 |
||
273 |
if( langCount > 1 ) |
|
274 |
{ |
|
275 |
//get current lang |
|
276 |
CSysData *sysData = NULL; |
|
277 |
TRAPD(leaveCode1, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; |
|
278 |
if(KErrNone == leaveCode1) |
|
279 |
{ |
|
280 |
TInt retType = sysData->DataType() ; |
|
281 |
||
282 |
if(expDataType == retType) |
|
283 |
{ |
|
284 |
CStatus *status = (CStatus*)sysData ; |
|
285 |
currLang = status->Status(); |
|
286 |
//got the current language.. |
|
287 |
TInt i = 0,newLangCode = -1; |
|
288 |
while( i < langCount ) |
|
289 |
{ |
|
290 |
langListData->At(i,newLangCode); |
|
291 |
if( newLangCode != currLang ) |
|
292 |
{//we got a new supported lang |
|
293 |
iLog->Log(_L8("New lang is %d"),newLangCode) ; |
|
294 |
break; |
|
295 |
} |
|
296 |
i++; |
|
297 |
} |
|
298 |
||
299 |
CStatus *ipData = CStatus::NewL(newLangCode); |
|
300 |
TRAPD(leaveCode2, CoreObj->SetInfoL(KEntity,KKey,ipData)); |
|
301 |
delete ipData; |
|
302 |
if(KErrNone == leaveCode2) |
|
303 |
{ |
|
304 |
CSysData *sysData3 = NULL; |
|
305 |
TRAPD(leaveCode3, CoreObj->GetInfoL(KEntity,KKey,sysData3)); |
|
306 |
if(KErrNone == leaveCode3) |
|
307 |
{ |
|
308 |
TInt retType = sysData3->DataType() ; |
|
309 |
TInt lang = -1; |
|
310 |
if(expDataType == retType) |
|
311 |
{ |
|
312 |
CStatus *status = (CStatus*)sysData3 ; |
|
313 |
lang = status->Status(); |
|
314 |
if( lang == newLangCode ) |
|
315 |
{ |
|
316 |
returnCode = KErrNone; |
|
317 |
} |
|
318 |
else |
|
319 |
{ |
|
320 |
returnCode = KErrGeneral; |
|
321 |
iLog->Log(_L8("Failed.. Curr lang is @retType %d"),retType) ; |
|
322 |
} |
|
323 |
} |
|
324 |
else |
|
325 |
{ |
|
326 |
returnCode = KErrGeneral ; |
|
327 |
iLog->Log(_L8("Failed.. Get Info @retType %d"),retType) ; |
|
328 |
} |
|
329 |
} |
|
330 |
else |
|
331 |
{ |
|
332 |
returnCode = KErrGeneral ; |
|
333 |
iLog->Log(_L8("Failed..Get Lang @TrapD %d"),leaveCode3) ; |
|
334 |
} |
|
335 |
if( sysData3 != NULL ) |
|
336 |
{ |
|
337 |
delete sysData3; |
|
338 |
sysData3 = NULL; |
|
339 |
} |
|
340 |
} |
|
341 |
else |
|
342 |
{ |
|
343 |
returnCode = KErrGeneral ; |
|
344 |
iLog->Log(_L8("Failed..Set Lang @TrapD %d"),leaveCode2) ; |
|
345 |
} |
|
346 |
} |
|
347 |
else |
|
348 |
{ |
|
349 |
returnCode = KErrGeneral ; |
|
350 |
iLog->Log(_L8("Failed.. @retType %d"),retType) ; |
|
351 |
} |
|
352 |
||
353 |
if(sysData) |
|
354 |
{ |
|
355 |
delete sysData ; |
|
356 |
sysData = NULL; |
|
357 |
} |
|
358 |
||
359 |
} |
|
360 |
else |
|
361 |
{ |
|
362 |
returnCode = KErrGeneral ; |
|
363 |
iLog->Log(_L8("Failed.. get current lang@2 TRAPD %d"),leaveCode1) ; |
|
364 |
} |
|
365 |
//lang count more than 1 |
|
366 |
} |
|
367 |
else |
|
368 |
{ |
|
369 |
iLog->Log(_L8("There is only one lang")); |
|
370 |
} |
|
371 |
} |
|
372 |
else |
|
373 |
{ |
|
374 |
returnCode = KErrGeneral ; |
|
375 |
iLog->Log(_L8("Failed.. Get list of languages @retType %d"),retType) ; |
|
376 |
||
377 |
} |
|
378 |
||
379 |
if(langListData) |
|
380 |
{ |
|
381 |
delete langListData ; |
|
382 |
langListData = NULL; |
|
383 |
} |
|
384 |
//Get list of languages passed.. |
|
385 |
} |
|
386 |
else |
|
387 |
{ |
|
388 |
iLog->Log(_L8("LeaveCode : %d"),leaveCode) ; |
|
389 |
iLog->Log(_L8("Failed getting lsit of languages.. @TRAPD %d"),leaveCode); |
|
390 |
returnCode = KErrGeneral ; |
|
391 |
} |
|
392 |
||
393 |
//set lang back to English |
|
394 |
CStatus *defData = CStatus::NewL(engLang) ; |
|
395 |
CoreObj->SetInfoL(KEntity,KKey,defData) ; |
|
396 |
delete defData ; |
|
397 |
||
398 |
delete CoreObj ; |
|
399 |
||
400 |
||
401 |
__UHEAP_MARKEND ; |
|
402 |
return returnCode ; |
|
403 |
||
404 |
} |
|
405 |
||
406 |
||
407 |
// ----------------------------------------------------------------------------- |
|
408 |
// Ctsysgeneral::SetAndGetPridictiveText |
|
409 |
// Test method for setting and getting PridictiveText |
|
410 |
// ----------------------------------------------------------------------------- |
|
411 |
// |
|
412 |
TInt Ctsysgeneral::SetAndGetPridictiveText( CStifItemParser& aItem ) |
|
413 |
{ |
|
414 |
||
415 |
__UHEAP_MARK; |
|
416 |
||
417 |
_LIT(KEntity,"General") ; |
|
418 |
_LIT(KKey,"PredictiveText") ; |
|
419 |
||
420 |
TInt returnCode = KErrNone ; |
|
421 |
TInt expState = 0 ; |
|
422 |
TInt expDataType = 0 ; |
|
423 |
TInt defValue = 0 ; |
|
424 |
aItem.GetNextInt (expState) ; |
|
425 |
||
426 |
||
427 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
428 |
||
429 |
if( NULL == CoreObj) |
|
430 |
{ |
|
431 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
432 |
return KErrGeneral ; |
|
433 |
} |
|
434 |
iLog->Log(_L8("PridictiveText : %d"),expState) ; |
|
435 |
||
436 |
CStatus *ipData = CStatus::NewL(expState) ; |
|
437 |
||
438 |
TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
439 |
||
440 |
||
441 |
if(KErrNone == leaveCode) |
|
442 |
{ |
|
443 |
||
444 |
CSysData *sysData ; |
|
445 |
||
446 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; |
|
447 |
||
448 |
if(KErrNone == leaveCode) |
|
449 |
{ |
|
450 |
||
451 |
TInt retType = sysData->DataType() ; |
|
452 |
||
453 |
if(expDataType == retType) |
|
454 |
{ |
|
455 |
||
456 |
CStatus *status = (CStatus*)sysData ; |
|
457 |
TInt retStatus = status->Status() ; |
|
458 |
||
459 |
if(expState != retStatus) |
|
460 |
{ |
|
461 |
returnCode = KErrGeneral ; |
|
462 |
iLog->Log(_L8("Failed.. @retStatus")) ; |
|
463 |
} |
|
464 |
else |
|
465 |
{ |
|
466 |
iLog->Log(_L8("Passed..")) ; |
|
467 |
} |
|
468 |
} |
|
469 |
||
470 |
else |
|
471 |
{ |
|
472 |
returnCode = KErrGeneral ; |
|
473 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
474 |
} |
|
475 |
||
476 |
delete sysData ; |
|
477 |
||
478 |
} |
|
479 |
else |
|
480 |
{ |
|
481 |
returnCode = KErrGeneral ; |
|
482 |
iLog->Log(_L8("Failed.. @2 TRAPD")) ; |
|
483 |
} |
|
484 |
||
485 |
} |
|
486 |
else |
|
487 |
{ |
|
488 |
returnCode = KErrGeneral ; |
|
489 |
iLog->Log(_L8("Failed.. @TRAPD leavecode: %d"),leaveCode) ; |
|
490 |
} |
|
491 |
||
492 |
CStatus *defData = CStatus::NewL(defValue) ; |
|
493 |
||
494 |
CoreObj->SetInfoL(KEntity,KKey,defData) ; |
|
495 |
||
496 |
delete defData ; |
|
497 |
delete ipData ; |
|
498 |
delete CoreObj ; |
|
499 |
||
500 |
__UHEAP_MARKEND ; |
|
501 |
return returnCode ; |
|
502 |
||
503 |
} |
|
504 |
||
505 |
||
506 |
// ----------------------------------------------------------------------------- |
|
507 |
// Ctsysgeneral::SetAndGetVibraActive |
|
508 |
// Test method for setting and getting VibraActive |
|
509 |
// ----------------------------------------------------------------------------- |
|
510 |
// |
|
511 |
TInt Ctsysgeneral::SetAndGetVibraActive( CStifItemParser& aItem ) |
|
512 |
{ |
|
513 |
||
514 |
__UHEAP_MARK; |
|
515 |
||
516 |
_LIT(KEntity,"General") ; |
|
517 |
_LIT(KKey,"VibraActive") ; |
|
518 |
||
519 |
TInt returnCode = KErrNone ; |
|
520 |
TInt expState = 0 ; |
|
521 |
TInt expDataType = 0 ; |
|
522 |
TInt defValue = 0 ; |
|
523 |
aItem.GetNextInt (expState) ; |
|
524 |
||
525 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
526 |
||
527 |
if( NULL == CoreObj) |
|
528 |
{ |
|
529 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
530 |
return KErrGeneral ; |
|
531 |
} |
|
532 |
||
533 |
||
534 |
CStatus *ipData = CStatus::NewL(expState) ; |
|
535 |
||
536 |
TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
537 |
||
538 |
if(KErrNone == leaveCode) |
|
539 |
{ |
|
540 |
||
541 |
CSysData *sysData ; |
|
542 |
||
543 |
iLog->Log(_L8("VibraActive : %d"),expState) ; |
|
544 |
||
545 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; |
|
546 |
if(KErrNone == leaveCode) |
|
547 |
{ |
|
548 |
||
549 |
TInt retType = sysData->DataType() ; |
|
550 |
||
551 |
if(expDataType == retType) |
|
552 |
{ |
|
553 |
||
554 |
CStatus *status = (CStatus*)sysData ; |
|
555 |
TInt retStatus = status->Status() ; |
|
556 |
||
557 |
if(expState != retStatus) |
|
558 |
{ |
|
559 |
returnCode = KErrGeneral ; |
|
560 |
iLog->Log(_L8("Failed.. @retStatus")) ; |
|
561 |
} |
|
562 |
else |
|
563 |
{ |
|
564 |
iLog->Log(_L8("Passed..")) ; |
|
565 |
} |
|
566 |
} |
|
567 |
||
568 |
else |
|
569 |
{ |
|
570 |
returnCode = KErrGeneral ; |
|
571 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
572 |
} |
|
573 |
||
574 |
delete sysData ; |
|
575 |
||
576 |
} |
|
577 |
else |
|
578 |
{ |
|
579 |
returnCode = KErrGeneral ; |
|
580 |
iLog->Log(_L8("Failed.. @2TRAPD")) ; |
|
581 |
} |
|
582 |
} |
|
583 |
else |
|
584 |
{ |
|
585 |
returnCode = KErrGeneral ; |
|
586 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
587 |
} |
|
588 |
||
589 |
CStatus *defData = CStatus::NewL(defValue) ; |
|
590 |
||
591 |
CoreObj->SetInfoL(KEntity,KKey,defData) ; |
|
592 |
||
593 |
delete defData ; |
|
594 |
delete ipData ; |
|
595 |
delete CoreObj ; |
|
596 |
||
597 |
__UHEAP_MARKEND ; |
|
598 |
||
599 |
return returnCode ; |
|
600 |
||
601 |
} |
|
602 |
||
603 |
||
604 |
||
605 |
// ----------------------------------------------------------------------------- |
|
606 |
// Ctsysgeneral::GetActiveUSBMode |
|
607 |
// Test method for getting ActiveUSBMode |
|
608 |
// ----------------------------------------------------------------------------- |
|
609 |
// |
|
610 |
TInt Ctsysgeneral::GetActiveUSBMode( CStifItemParser& /*aItem*/ ) |
|
611 |
{ |
|
612 |
||
613 |
__UHEAP_MARK; |
|
614 |
||
615 |
_LIT(KEntity,"General") ; |
|
616 |
_LIT(KKey,"ActiveUSBMode") ; |
|
617 |
_LIT(KexpMode, "PC Suite") ; |
|
618 |
TInt expDataType = 12 ; |
|
619 |
TInt returnCode = KErrNone ; |
|
620 |
TPtrC expDev(KexpMode) ; |
|
621 |
// aItem.GetNextString(expDev) ; |
|
622 |
||
623 |
#if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
624 |
||
625 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
626 |
||
627 |
if( NULL == CoreObj) |
|
628 |
{ |
|
629 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
630 |
return KErrGeneral ; |
|
631 |
} |
|
632 |
||
633 |
||
634 |
CSysData *sysData ; |
|
635 |
||
636 |
||
637 |
||
638 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; |
|
639 |
if(KErrNone == leaveCode) |
|
640 |
{ |
|
641 |
||
642 |
TInt retType = sysData->DataType() ; |
|
643 |
||
644 |
if(expDataType == retType) |
|
645 |
{ |
|
646 |
||
647 |
CStringData *retData = (CStringData*)sysData ; |
|
648 |
TPtrC retDev ; |
|
649 |
||
650 |
retData->StringData(retDev) ; |
|
651 |
TBuf<50> retDevice(retDev) ; |
|
652 |
iLog->Log(_L8("retPath")) ; |
|
653 |
iLog->Log(retDevice) ; |
|
654 |
iLog->Log(_L8("Passed..")) ; |
|
655 |
||
656 |
/* |
|
657 |
if(expDev.Compare(retDev)) |
|
658 |
{ |
|
659 |
returnCode = KErrGeneral ; |
|
660 |
iLog->Log(_L8("Failed.. @retPath")) ; |
|
661 |
} |
|
662 |
else |
|
663 |
{ |
|
664 |
||
665 |
iLog->Log(_L8("Passed..")) ; |
|
666 |
} |
|
667 |
*/ |
|
668 |
} |
|
669 |
||
670 |
else |
|
671 |
{ |
|
672 |
returnCode = KErrGeneral ; |
|
673 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
674 |
} |
|
675 |
||
676 |
delete sysData ; |
|
677 |
||
678 |
} |
|
679 |
else |
|
680 |
{ |
|
681 |
returnCode = KErrGeneral ; |
|
682 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
683 |
} |
|
684 |
delete CoreObj ; |
|
685 |
||
686 |
#endif |
|
687 |
||
688 |
__UHEAP_MARKEND ; |
|
689 |
||
690 |
return returnCode ; |
|
691 |
||
692 |
} |
|
693 |
||
694 |
||
695 |
||
696 |
// ----------------------------------------------------------------------------- |
|
697 |
// Ctsysgeneral::GetAvblUSBMode |
|
698 |
// Test method for getting available USBMode |
|
699 |
// ----------------------------------------------------------------------------- |
|
700 |
// |
|
701 |
TInt Ctsysgeneral::GetAvblUSBMode( CStifItemParser& aItem ) |
|
702 |
{ |
|
703 |
||
704 |
__UHEAP_MARK; |
|
705 |
||
706 |
_LIT(KEntity,"General") ; |
|
707 |
_LIT(KKey,"AvailableUSBModes") ; |
|
708 |
||
709 |
TInt expDataType = 11 ; |
|
710 |
TInt returnCode = KErrNone ; |
|
711 |
TPtrC expDev ; |
|
712 |
aItem.GetNextString(expDev) ; |
|
713 |
||
714 |
#if ( !(defined(__WINS__) || defined(__WINSCW__)) ) |
|
715 |
||
716 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
717 |
||
718 |
if( NULL == CoreObj) |
|
719 |
{ |
|
720 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
721 |
return KErrGeneral ; |
|
722 |
} |
|
723 |
||
724 |
||
725 |
CSysData *sysData ; |
|
726 |
||
727 |
||
728 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; |
|
729 |
if(KErrNone == leaveCode) |
|
730 |
{ |
|
731 |
||
732 |
TInt retType = sysData->DataType() ; |
|
733 |
||
734 |
if(expDataType == retType) |
|
735 |
{ |
|
736 |
||
737 |
CStringList *retData = (CStringList*)sysData ; |
|
738 |
TInt listCount ; |
|
739 |
listCount = retData->Count() ; |
|
740 |
||
741 |
if(listCount) |
|
742 |
{ |
|
743 |
||
744 |
for(TInt i=0; i<listCount; i++) |
|
745 |
{ |
|
746 |
||
747 |
TPtrC retDev ; |
|
748 |
retData->At(i,retDev) ; |
|
749 |
TBuf<50> retDevice(retDev) ; |
|
750 |
iLog->Log(_L8("Available USB modes")) ; |
|
751 |
iLog->Log(retDevice) ; |
|
752 |
||
753 |
} |
|
754 |
} |
|
755 |
||
756 |
else |
|
757 |
{ |
|
758 |
returnCode = KErrGeneral ; |
|
759 |
iLog->Log(_L8("empty list")) ; |
|
760 |
} |
|
761 |
} |
|
762 |
||
763 |
else |
|
764 |
{ |
|
765 |
returnCode = KErrGeneral ; |
|
766 |
iLog->Log(_L8("Failed.. @retType")) ; |
|
767 |
} |
|
768 |
||
769 |
delete sysData ; |
|
770 |
||
771 |
} |
|
772 |
else |
|
773 |
{ |
|
774 |
returnCode = KErrGeneral ; |
|
775 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
776 |
} |
|
777 |
delete CoreObj ; |
|
778 |
||
779 |
#endif |
|
780 |
||
781 |
__UHEAP_MARKEND ; |
|
782 |
return returnCode ; |
|
783 |
||
784 |
} |
|
785 |
||
786 |
||
787 |
||
788 |
||
789 |
// ----------------------------------------------------------------------------- |
|
790 |
// Ctsysgeneral::AsyncAccStatus |
|
791 |
// Test method for getting connected accessories |
|
792 |
// ----------------------------------------------------------------------------- |
|
793 |
// |
|
794 |
TInt Ctsysgeneral::AsyncGetinfoStatus( CStifItemParser& /*aItem*/ ) |
|
795 |
{ |
|
796 |
||
797 |
__UHEAP_MARK; |
|
798 |
||
799 |
TInt returnCode = KErrNone ; |
|
800 |
||
801 |
returnCode = TestAsyncStatus(iLog) ; |
|
802 |
||
803 |
__UHEAP_MARKEND ; |
|
804 |
return returnCode ; |
|
805 |
||
806 |
} |
|
807 |
||
808 |
||
809 |
// ----------------------------------------------------------------------------- |
|
810 |
// Ctsysgeneral::NotifyIpAndPredText |
|
811 |
// Test method for getting notification for Input and predecitive text changes |
|
812 |
// ----------------------------------------------------------------------------- |
|
813 |
// |
|
814 |
TInt Ctsysgeneral::NotifyIpAndPredText( CStifItemParser& /*aItem*/ ) |
|
815 |
{ |
|
816 |
||
817 |
__UHEAP_MARK; |
|
818 |
||
819 |
TInt returnCode = KErrNone ; |
|
820 |
||
821 |
returnCode = TestIpAndPredTextNot(iLog) ; |
|
822 |
||
823 |
__UHEAP_MARKEND ; |
|
824 |
return returnCode ; |
|
825 |
||
826 |
} |
|
827 |
||
828 |
||
829 |
// ----------------------------------------------------------------------------- |
|
830 |
// Ctsysgeneral::SetWrongKey |
|
831 |
// Test method for setting Wrong Key |
|
832 |
// ----------------------------------------------------------------------------- |
|
833 |
// |
|
834 |
TInt Ctsysgeneral::SetWrongKey( CStifItemParser& /*aItem*/ ) |
|
835 |
{ |
|
836 |
||
837 |
__UHEAP_MARK; |
|
838 |
||
839 |
_LIT(KEntity,"General") ; |
|
840 |
_LIT(KKey,"DisplayLanguagee") ; |
|
841 |
TInt expState = 1 ; |
|
842 |
TInt returnCode = KErrNone ; |
|
843 |
||
844 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
845 |
||
846 |
if( NULL == CoreObj) |
|
847 |
{ |
|
848 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
849 |
return KErrGeneral ; |
|
850 |
} |
|
851 |
||
852 |
CStatus *ipData = CStatus::NewL(expState) ; |
|
853 |
||
854 |
TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
855 |
||
856 |
||
857 |
if(KErrNotFound != leaveCode) |
|
858 |
{ |
|
859 |
returnCode = KErrGeneral ; |
|
860 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
861 |
} |
|
862 |
else |
|
863 |
{ |
|
864 |
iLog->Log(_L8("Passed..")) ; |
|
865 |
} |
|
866 |
||
867 |
delete ipData ; |
|
868 |
delete CoreObj ; |
|
869 |
||
870 |
||
871 |
__UHEAP_MARKEND ; |
|
872 |
return returnCode ; |
|
873 |
||
874 |
} |
|
875 |
||
876 |
||
877 |
// ----------------------------------------------------------------------------- |
|
878 |
// Ctsysgeneral::SetWrongEntity |
|
879 |
// Test method for setting Wrong Entity |
|
880 |
// ----------------------------------------------------------------------------- |
|
881 |
// |
|
882 |
TInt Ctsysgeneral::SetWrongEntity( CStifItemParser& /*aItem*/ ) |
|
883 |
{ |
|
884 |
||
885 |
__UHEAP_MARK; |
|
886 |
||
887 |
_LIT(KEntity,"Genral") ; |
|
888 |
_LIT(KKey,"DisplayLanguagee") ; |
|
889 |
TInt expState = 1 ; |
|
890 |
TInt returnCode = KErrNone ; |
|
891 |
||
892 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
893 |
||
894 |
if( NULL == CoreObj) |
|
895 |
{ |
|
896 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
897 |
return KErrGeneral ; |
|
898 |
} |
|
899 |
||
900 |
CStatus *ipData = CStatus::NewL(expState) ; |
|
901 |
||
902 |
TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
903 |
||
904 |
||
905 |
if(KErrNotFound != leaveCode) |
|
906 |
{ |
|
907 |
returnCode = KErrGeneral ; |
|
908 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
909 |
} |
|
910 |
else |
|
911 |
{ |
|
912 |
iLog->Log(_L8("Passed..")) ; |
|
913 |
} |
|
914 |
||
915 |
delete ipData ; |
|
916 |
delete CoreObj ; |
|
917 |
||
918 |
||
919 |
__UHEAP_MARKEND ; |
|
920 |
return returnCode ; |
|
921 |
||
922 |
} |
|
923 |
||
924 |
||
925 |
||
926 |
// ----------------------------------------------------------------------------- |
|
927 |
// Ctsysgeneral::GetWrongKey |
|
928 |
// Test method for Getinfo with wrong key valye |
|
929 |
// ----------------------------------------------------------------------------- |
|
930 |
// |
|
931 |
TInt Ctsysgeneral::GetWrongKey( CStifItemParser& /*aItem*/ ) |
|
932 |
{ |
|
933 |
||
934 |
__UHEAP_MARK; |
|
935 |
||
936 |
_LIT(KEntity,"General") ; |
|
937 |
_LIT(KKey,"ActiveUSBModde") ; |
|
938 |
||
939 |
TInt returnCode = KErrNone ; |
|
940 |
||
941 |
CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
942 |
||
943 |
if( NULL == CoreObj) |
|
944 |
{ |
|
945 |
iLog->Log(_L8("Failed.. @Core")) ; |
|
946 |
return KErrGeneral ; |
|
947 |
} |
|
948 |
||
949 |
||
950 |
CSysData *sysData ; |
|
951 |
||
952 |
TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; |
|
953 |
||
954 |
if(KErrNotFound != leaveCode) |
|
955 |
{ |
|
956 |
returnCode = KErrGeneral ; |
|
957 |
iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
958 |
} |
|
959 |
else |
|
960 |
{ |
|
961 |
iLog->Log(_L8("Passed..")) ; |
|
962 |
} |
|
963 |
||
964 |
delete CoreObj ; |
|
965 |
||
966 |
__UHEAP_MARKEND ; |
|
967 |
return returnCode ; |
|
968 |
||
969 |
} |
|
970 |
||
971 |
// ----------------------------------------------------------------------------- |
|
972 |
// Ctsysgeneral::?member_function |
|
973 |
// ?implementation_description |
|
974 |
// (other items were commented in a header). |
|
975 |
// ----------------------------------------------------------------------------- |
|
976 |
// |
|
977 |
/* |
|
978 |
TInt Ctsysgeneral::?member_function( |
|
979 |
CItemParser& aItem ) |
|
980 |
{ |
|
981 |
||
982 |
?code |
|
983 |
||
984 |
} |
|
985 |
*/ |
|
986 |
||
987 |
// ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
988 |
// None |
|
989 |
||
990 |
// End of File |