|
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 display functions |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 // INCLUDE FILES |
|
22 #include <e32svr.h> |
|
23 #include <StifParser.h> |
|
24 #include <Stiftestinterface.h> |
|
25 #include <EscapeUtils.h> |
|
26 |
|
27 #include "tsysdisplay.h" |
|
28 #include "tsysdisplaynot.h" |
|
29 |
|
30 // EXTERNAL DATA STRUCTURES |
|
31 //extern ?external_data; |
|
32 |
|
33 // EXTERNAL FUNCTION PROTOTYPES |
|
34 //extern ?external_function( ?arg_type,?arg_type ); |
|
35 |
|
36 // CONSTANTS |
|
37 //const ?type ?constant_var = ?constant; |
|
38 |
|
39 // MACROS |
|
40 //#define ?macro ?macro_def |
|
41 |
|
42 // LOCAL CONSTANTS AND MACROS |
|
43 //const ?type ?constant_var = ?constant; |
|
44 //#define ?macro_name ?macro_def |
|
45 |
|
46 // MODULE DATA STRUCTURES |
|
47 //enum ?declaration |
|
48 //typedef ?declaration |
|
49 |
|
50 // LOCAL FUNCTION PROTOTYPES |
|
51 //?type ?function_name( ?arg_type, ?arg_type ); |
|
52 |
|
53 // FORWARD DECLARATIONS |
|
54 //class ?FORWARD_CLASSNAME; |
|
55 |
|
56 // ============================= LOCAL FUNCTIONS =============================== |
|
57 |
|
58 // ----------------------------------------------------------------------------- |
|
59 // ?function_name ?description. |
|
60 // ?description |
|
61 // Returns: ?value_1: ?description |
|
62 // ?value_n: ?description_line1 |
|
63 // ?description_line2 |
|
64 // ----------------------------------------------------------------------------- |
|
65 // |
|
66 /* |
|
67 ?type ?function_name( |
|
68 ?arg_type arg, // ?description |
|
69 ?arg_type arg) // ?description |
|
70 { |
|
71 |
|
72 ?code // ?comment |
|
73 |
|
74 // ?comment |
|
75 ?code |
|
76 } |
|
77 */ |
|
78 |
|
79 // ============================ MEMBER FUNCTIONS =============================== |
|
80 |
|
81 // ----------------------------------------------------------------------------- |
|
82 // Ctsysdisplay::Delete |
|
83 // Delete here all resources allocated and opened from test methods. |
|
84 // Called from destructor. |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 void Ctsysdisplay::Delete() |
|
88 { |
|
89 |
|
90 } |
|
91 |
|
92 // ----------------------------------------------------------------------------- |
|
93 // Ctsysdisplay::RunMethodL |
|
94 // Run specified method. Contains also table of test mothods and their names. |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 TInt Ctsysdisplay::RunMethodL( |
|
98 CStifItemParser& aItem ) |
|
99 { |
|
100 |
|
101 static TStifFunctionInfo const KFunctions[] = |
|
102 { |
|
103 // Copy this line for every implemented function. |
|
104 // First string is the function name used in TestScripter script file. |
|
105 // Second is the actual implementation member function. |
|
106 ENTRY( "SetAndGetBrightness", Ctsysdisplay::SetAndGetBrightness ), |
|
107 ENTRY( "SetAndGetScreenSaverTO", Ctsysdisplay::SetAndGetScreenSaverTO ), |
|
108 ENTRY( "SetAndGetKeyLockTime", Ctsysdisplay::SetAndGetKeyLockTime ), |
|
109 ENTRY( "SetAndGetKeyLockStatus", Ctsysdisplay::SetAndGetKeyLockStatus ), |
|
110 ENTRY( "SetAndGetWallpaper", Ctsysdisplay::SetAndGetWallpaper ), |
|
111 ENTRY( "SetAndGetLightTimeOut", Ctsysdisplay::SetAndGetLightTimeOut ), |
|
112 ENTRY( "SetAndGetKeyGuardTime", Ctsysdisplay::SetAndGetKeyGuardTime ), |
|
113 ENTRY( "DisplayResolution", Ctsysdisplay::DisplayResolution ), |
|
114 ENTRY( "DisplayOrientation", Ctsysdisplay::DisplayOrientation ), |
|
115 ENTRY( "WrongKey", Ctsysdisplay::WrongKey ), |
|
116 ENTRY( "SetWrongDataType", Ctsysdisplay::SetWrongDataType ), |
|
117 ENTRY( "UserActGetAsync", Ctsysdisplay::UserActGetAsync ), |
|
118 ENTRY( "UserActNotWithWrongIp", Ctsysdisplay::UserActNotWithWrongIp ), |
|
119 ENTRY( "UserActNotWithWrongKey", Ctsysdisplay::UserActNotWithWrongKey ), |
|
120 }; |
|
121 |
|
122 const TInt count = sizeof( KFunctions ) / |
|
123 sizeof( TStifFunctionInfo ); |
|
124 |
|
125 return RunInternalL( KFunctions, count, aItem ); |
|
126 |
|
127 } |
|
128 |
|
129 // ----------------------------------------------------------------------------- |
|
130 // Ctsysdisplay::SetAndGetBrightness |
|
131 // Tests Set and Get brightness values |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 TInt Ctsysdisplay::SetAndGetBrightness( CStifItemParser& aItem ) |
|
135 { |
|
136 |
|
137 __UHEAP_MARK; |
|
138 |
|
139 _LIT(KEntity,"Display") ; |
|
140 _LIT(KKey,"Brightness") ; |
|
141 |
|
142 TInt returnCode = KErrNone ; |
|
143 TInt expDataType = 0 ; |
|
144 TInt expPercent = 0; |
|
145 TInt defPercent = 50 ; |
|
146 // #ifndef __WINSCW__ || __WINS__ |
|
147 aItem.GetNextInt( expPercent ) ; |
|
148 // #else |
|
149 // expPercent = 50 ; |
|
150 // #endif |
|
151 |
|
152 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
153 |
|
154 if( NULL == CoreObj) |
|
155 { |
|
156 iLog->Log(_L8("Failed.. @Core")) ; |
|
157 return KErrGeneral ; |
|
158 } |
|
159 |
|
160 CStatus *ipData = CStatus::NewL(expPercent) ; |
|
161 |
|
162 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
163 /* |
|
164 if(KErrNone == leaveCode) |
|
165 { |
|
166 |
|
167 CSysData *sysData ; |
|
168 |
|
169 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
170 |
|
171 if(KErrNone == leaveCode) |
|
172 { |
|
173 |
|
174 TInt retType = sysData->DataType() ; |
|
175 |
|
176 if(expDataType == retType) |
|
177 { |
|
178 |
|
179 CStatus *status = (CStatus*)sysData ; |
|
180 TInt retStatus = status->Status() ; |
|
181 iLog->Log(_L8("Brightness:%d"),retStatus) ; |
|
182 |
|
183 if(expPercent == retStatus) |
|
184 { |
|
185 iLog->Log(_L8("Passed..")) ; |
|
186 } |
|
187 else |
|
188 { |
|
189 returnCode = KErrGeneral ; |
|
190 iLog->Log(_L8("Failed.. @retStatus")) ; |
|
191 } |
|
192 |
|
193 } |
|
194 |
|
195 else |
|
196 { |
|
197 returnCode = KErrGeneral ; |
|
198 iLog->Log(_L8("Failed.. @retType")) ; |
|
199 } |
|
200 |
|
201 delete sysData ; |
|
202 |
|
203 } |
|
204 else |
|
205 { |
|
206 returnCode = KErrGeneral ; |
|
207 iLog->Log(_L8("Failed.. @2 TRAPD")) ; |
|
208 } |
|
209 |
|
210 } |
|
211 else if(KErrArgument == leaveCode) |
|
212 { |
|
213 returnCode = KErrNone; |
|
214 iLog->Log(_L8("Min or Max values out of bounds")) ; |
|
215 } |
|
216 else |
|
217 { |
|
218 returnCode = KErrGeneral ; |
|
219 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
220 } |
|
221 |
|
222 |
|
223 CStatus *defData = CStatus::NewL(defPercent) ; |
|
224 |
|
225 // CoreObj->SetInfoL(KEntity,KKey,defData) ; |
|
226 |
|
227 delete defData ; |
|
228 */ |
|
229 |
|
230 if(KErrNotFound == leaveCode) |
|
231 { |
|
232 iLog->Log(_L8("Passed..")) ; |
|
233 } |
|
234 else |
|
235 { |
|
236 returnCode = KErrGeneral ; |
|
237 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
238 } |
|
239 delete ipData ; |
|
240 delete CoreObj ; |
|
241 |
|
242 __UHEAP_MARKEND ; |
|
243 return returnCode ; |
|
244 |
|
245 |
|
246 } |
|
247 |
|
248 |
|
249 // ----------------------------------------------------------------------------- |
|
250 // Ctsysdisplay::SetAndGetScreenSaverTO |
|
251 // Tests Set and Get ScreenSaverTimeOut values |
|
252 // ----------------------------------------------------------------------------- |
|
253 // |
|
254 TInt Ctsysdisplay::SetAndGetScreenSaverTO( CStifItemParser& aItem ) |
|
255 { |
|
256 |
|
257 __UHEAP_MARK; |
|
258 |
|
259 _LIT(KEntity,"Display") ; |
|
260 _LIT(KKey,"ScreenSaverTimeOut") ; |
|
261 |
|
262 TInt returnCode = KErrNone ; |
|
263 TInt expDataType = 0 ; |
|
264 TInt expTimeOut = 0; |
|
265 TInt defTimeOut = 15 ; |
|
266 aItem.GetNextInt( expTimeOut ) ; |
|
267 |
|
268 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
269 |
|
270 if( NULL == CoreObj) |
|
271 { |
|
272 iLog->Log(_L8("Failed.. @Core")) ; |
|
273 return KErrGeneral ; |
|
274 } |
|
275 |
|
276 CStatus *ipData = CStatus::NewL(expTimeOut) ; |
|
277 |
|
278 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
279 /* |
|
280 if(KErrNone == leaveCode) |
|
281 { |
|
282 |
|
283 CSysData *sysData ; |
|
284 |
|
285 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
286 |
|
287 if(KErrNone == leaveCode) |
|
288 { |
|
289 |
|
290 TInt retType = sysData->DataType() ; |
|
291 |
|
292 if(expDataType == retType) |
|
293 { |
|
294 |
|
295 CStatus *status = (CStatus*)sysData ; |
|
296 TInt retStatus = status->Status() ; |
|
297 iLog->Log(_L8("ScreenSaverTimeOut:%d"),retStatus) ; |
|
298 |
|
299 if(expTimeOut == retStatus) |
|
300 { |
|
301 iLog->Log(_L8("Passed..")) ; |
|
302 } |
|
303 else |
|
304 { |
|
305 returnCode = KErrGeneral ; |
|
306 iLog->Log(_L8("Failed.. @retStatus")) ; |
|
307 } |
|
308 |
|
309 } |
|
310 |
|
311 else |
|
312 { |
|
313 returnCode = KErrGeneral ; |
|
314 iLog->Log(_L8("Failed.. @retType")) ; |
|
315 } |
|
316 |
|
317 delete sysData ; |
|
318 |
|
319 } |
|
320 else |
|
321 { |
|
322 returnCode = KErrGeneral ; |
|
323 iLog->Log(_L8("Failed.. @2 TRAPD")) ; |
|
324 } |
|
325 } |
|
326 else |
|
327 { |
|
328 returnCode = KErrGeneral ; |
|
329 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
330 } |
|
331 |
|
332 CStatus *defData = CStatus::NewL(defTimeOut) ; |
|
333 |
|
334 // CoreObj->SetInfoL(KEntity,KKey,defData) ; |
|
335 |
|
336 delete defData ; |
|
337 */ |
|
338 |
|
339 if(KErrNotFound == leaveCode) |
|
340 { |
|
341 iLog->Log(_L8("Passed..")) ; |
|
342 } |
|
343 else |
|
344 { |
|
345 returnCode = KErrGeneral ; |
|
346 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
347 } |
|
348 |
|
349 delete ipData ; |
|
350 delete CoreObj ; |
|
351 |
|
352 |
|
353 __UHEAP_MARKEND ; |
|
354 return returnCode ; |
|
355 |
|
356 |
|
357 } |
|
358 |
|
359 |
|
360 |
|
361 // ----------------------------------------------------------------------------- |
|
362 // Ctsysdisplay::SetAndGetKeyLockTime |
|
363 // Tests set and get KeylockTime values |
|
364 // ----------------------------------------------------------------------------- |
|
365 // |
|
366 TInt Ctsysdisplay::SetAndGetKeyLockTime( CStifItemParser& aItem ) |
|
367 { |
|
368 |
|
369 __UHEAP_MARK; |
|
370 |
|
371 _LIT(KEntity,"Display") ; |
|
372 _LIT(KKey,"AutoLockTime") ; |
|
373 |
|
374 TInt returnCode = KErrNone ; |
|
375 TInt expDataType = 0 ; |
|
376 TInt defValue = 0 ; |
|
377 TInt expTime = 0; |
|
378 aItem.GetNextInt ( expTime ) ; |
|
379 |
|
380 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
381 |
|
382 if( NULL == CoreObj) |
|
383 { |
|
384 iLog->Log(_L8("Failed.. @Core")) ; |
|
385 return KErrGeneral ; |
|
386 } |
|
387 |
|
388 CStatus *ipData = CStatus::NewL(expTime) ; |
|
389 |
|
390 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
391 /* |
|
392 if(KErrNone == leaveCode) |
|
393 { |
|
394 |
|
395 CSysData *sysData ; |
|
396 |
|
397 iLog->Log(_L8("expTime : %d"),expTime) ; |
|
398 |
|
399 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
400 |
|
401 if(KErrNone == leaveCode) |
|
402 { |
|
403 |
|
404 TInt retType = sysData->DataType() ; |
|
405 |
|
406 if(expDataType == retType) |
|
407 { |
|
408 |
|
409 CStatus *status = (CStatus*)sysData ; |
|
410 TInt retStatus = status->Status() ; |
|
411 iLog->Log(_L8("retStatus : %d"),retStatus) ; |
|
412 |
|
413 if(expTime == retStatus) |
|
414 { |
|
415 iLog->Log(_L8("Passed..")) ; |
|
416 } |
|
417 else |
|
418 { |
|
419 returnCode = KErrGeneral ; |
|
420 iLog->Log(_L8("Failed.. @retStatus")) ; |
|
421 } |
|
422 |
|
423 } |
|
424 |
|
425 else |
|
426 { |
|
427 returnCode = KErrGeneral ; |
|
428 iLog->Log(_L8("Failed.. @retType")) ; |
|
429 } |
|
430 |
|
431 delete sysData ; |
|
432 |
|
433 } |
|
434 else |
|
435 { |
|
436 returnCode = KErrGeneral ; |
|
437 iLog->Log(_L8("Failed.. @2 TRAPD")) ; |
|
438 } |
|
439 |
|
440 } |
|
441 |
|
442 else |
|
443 { |
|
444 returnCode = KErrGeneral ; |
|
445 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
446 } |
|
447 |
|
448 CStatus *defData = CStatus::NewL(defValue) ; |
|
449 |
|
450 CoreObj->SetInfoL(KEntity,KKey,defData) ; |
|
451 |
|
452 delete defData ; |
|
453 */ |
|
454 |
|
455 if(KErrNotFound == leaveCode) |
|
456 { |
|
457 iLog->Log(_L8("Passed..")) ; |
|
458 } |
|
459 else |
|
460 { |
|
461 returnCode = KErrGeneral ; |
|
462 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
463 } |
|
464 |
|
465 delete ipData ; |
|
466 delete CoreObj ; |
|
467 |
|
468 __UHEAP_MARKEND ; |
|
469 return returnCode ; |
|
470 |
|
471 |
|
472 } |
|
473 |
|
474 |
|
475 |
|
476 // ----------------------------------------------------------------------------- |
|
477 // Ctsysdisplay::SetAndGetKeyLockStatus |
|
478 // Tests set and get Keylock status values |
|
479 // ----------------------------------------------------------------------------- |
|
480 // |
|
481 TInt Ctsysdisplay::SetAndGetKeyLockStatus( CStifItemParser& aItem ) |
|
482 { |
|
483 |
|
484 __UHEAP_MARK; |
|
485 |
|
486 _LIT(KEntity,"Display") ; |
|
487 _LIT(KKey,"AutoLockStatus") ; |
|
488 |
|
489 TInt returnCode = KErrNone ; |
|
490 TInt expDataType = 0 ; |
|
491 TInt expState = 0; |
|
492 aItem.GetNextInt ( expState ) ; |
|
493 |
|
494 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
495 |
|
496 if( NULL == CoreObj) |
|
497 { |
|
498 iLog->Log(_L8("Failed.. @Core")) ; |
|
499 return KErrGeneral ; |
|
500 } |
|
501 |
|
502 /* CStatus *ipData = CStatus::NewL(expState) ; |
|
503 |
|
504 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
505 |
|
506 if(KErrNone == leaveCode) |
|
507 { |
|
508 */ |
|
509 CSysData *sysData ; |
|
510 |
|
511 iLog->Log(_L8("expState : %d"),expState) ; |
|
512 |
|
513 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
514 |
|
515 if(KErrNone == leaveCode) |
|
516 { |
|
517 |
|
518 TInt retType = sysData->DataType() ; |
|
519 |
|
520 if(expDataType == retType) |
|
521 { |
|
522 |
|
523 CStatus *status = (CStatus*)sysData ; |
|
524 TInt retStatus = status->Status() ; |
|
525 iLog->Log(_L8("retStatus : %d"),retStatus) ; |
|
526 |
|
527 if(expState == retStatus) |
|
528 { |
|
529 iLog->Log(_L8("Passed..")) ; |
|
530 } |
|
531 else |
|
532 { |
|
533 returnCode = KErrGeneral ; |
|
534 iLog->Log(_L8("Failed.. @retStatus")) ; |
|
535 } |
|
536 |
|
537 } |
|
538 |
|
539 else |
|
540 { |
|
541 returnCode = KErrGeneral ; |
|
542 iLog->Log(_L8("Failed.. @retType")) ; |
|
543 } |
|
544 |
|
545 delete sysData ; |
|
546 |
|
547 } |
|
548 else |
|
549 { |
|
550 returnCode = KErrGeneral ; |
|
551 iLog->Log(_L8("Failed.. @2 TRAPD")) ; |
|
552 } |
|
553 |
|
554 /* } |
|
555 else |
|
556 { |
|
557 returnCode = KErrGeneral ; |
|
558 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
559 } |
|
560 |
|
561 delete ipData ; |
|
562 */ |
|
563 delete CoreObj ; |
|
564 |
|
565 __UHEAP_MARKEND ; |
|
566 return returnCode ; |
|
567 |
|
568 |
|
569 } |
|
570 |
|
571 |
|
572 // ----------------------------------------------------------------------------- |
|
573 // Ctsysdisplay::SetAndGetWallpaper |
|
574 // Tests Wallpaper Path |
|
575 // ----------------------------------------------------------------------------- |
|
576 // |
|
577 TInt Ctsysdisplay::SetAndGetWallpaper( CStifItemParser& aItem ) |
|
578 { |
|
579 |
|
580 __UHEAP_MARK; |
|
581 |
|
582 _LIT(KEntity,"Display") ; |
|
583 _LIT(KKey,"Wallpaper") ; |
|
584 _LIT(KNoFile, "No") ; |
|
585 TInt returnCode = KErrNone ; |
|
586 // TInt expDataType = 12 ; |
|
587 // TInt fileLength = 50 ; |
|
588 TPtrC expPath ; |
|
589 // TPtrC8 eightRetPath ; |
|
590 |
|
591 aItem.GetNextString(expPath) ; |
|
592 |
|
593 // HBufC8* operName = EscapeUtils::ConvertFromUnicodeToUtf8L(expPath); |
|
594 // eightRetPath.Set(*operName) ; |
|
595 |
|
596 TBuf<500> fileName(expPath); |
|
597 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
598 |
|
599 if( NULL == CoreObj) |
|
600 { |
|
601 iLog->Log(_L("Failed.. @Core")) ; |
|
602 return KErrGeneral ; |
|
603 } |
|
604 |
|
605 iLog->Log(_L8("expPath:")) ; |
|
606 iLog->Log(fileName) ; |
|
607 |
|
608 CStringData *ipData ; |
|
609 |
|
610 if(!expPath.Compare(KNoFile)) |
|
611 { |
|
612 ipData = CStringData::NewL(KNullDesC) ; |
|
613 } |
|
614 else |
|
615 { |
|
616 ipData = CStringData::NewL(expPath) ; |
|
617 } |
|
618 |
|
619 |
|
620 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
621 |
|
622 if(KErrNone == leaveCode) |
|
623 { |
|
624 /* |
|
625 CSysData *sysData ; |
|
626 |
|
627 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
628 |
|
629 if(KErrNone == leaveCode) |
|
630 { |
|
631 |
|
632 TInt retType = sysData->DataType() ; |
|
633 |
|
634 if(expDataType == retType) |
|
635 { |
|
636 |
|
637 CStringData *retData = (CStringData*)sysData ; |
|
638 TPtrC retPath ; |
|
639 |
|
640 |
|
641 retData->StringData(retPath) ; |
|
642 TBuf<50> retFileName(retPath); |
|
643 |
|
644 if(expPath.Compare(KNoFile)) |
|
645 { |
|
646 iLog->Log(_L("retPath ")) ; |
|
647 iLog->Log(retFileName) ; |
|
648 if(expPath.Compare(retPath)) |
|
649 { |
|
650 returnCode = KErrGeneral ; |
|
651 iLog->Log(_L8("Failed.. @retPath")) ; |
|
652 } |
|
653 else |
|
654 { |
|
655 iLog->Log(_L8("Passed..")) ; |
|
656 } |
|
657 |
|
658 } |
|
659 |
|
660 else |
|
661 { |
|
662 if(retPath.Compare(KNullDesC)) |
|
663 { |
|
664 returnCode = KErrGeneral ; |
|
665 iLog->Log(_L8("Failed.. @retPath")) ; |
|
666 } |
|
667 else |
|
668 { |
|
669 iLog->Log(_L8("Passed..")) ; |
|
670 } |
|
671 |
|
672 } |
|
673 |
|
674 delete sysData ; |
|
675 |
|
676 } |
|
677 |
|
678 else |
|
679 { |
|
680 returnCode = KErrGeneral ; |
|
681 iLog->Log(_L8("Failed.. @2 retType")) ; |
|
682 } |
|
683 } |
|
684 else |
|
685 { |
|
686 returnCode = KErrGeneral ; |
|
687 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
688 } |
|
689 */ |
|
690 |
|
691 } |
|
692 |
|
693 else |
|
694 { |
|
695 returnCode = KErrGeneral ; |
|
696 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
697 } |
|
698 |
|
699 delete ipData ; |
|
700 delete CoreObj ; |
|
701 |
|
702 |
|
703 __UHEAP_MARKEND ; |
|
704 return returnCode ; |
|
705 |
|
706 |
|
707 } |
|
708 |
|
709 |
|
710 // ----------------------------------------------------------------------------- |
|
711 // Ctsysdisplay::SetAndGetLightTimeOut |
|
712 // Tests set and get LightTimeOut values |
|
713 // ----------------------------------------------------------------------------- |
|
714 // |
|
715 TInt Ctsysdisplay::SetAndGetLightTimeOut( CStifItemParser& aItem ) |
|
716 { |
|
717 |
|
718 __UHEAP_MARK; |
|
719 |
|
720 _LIT(KEntity,"Display") ; |
|
721 _LIT(KKey,"LightTimeOut") ; |
|
722 |
|
723 TInt returnCode = KErrNone ; |
|
724 TInt expDataType = 0 ; |
|
725 TInt expTimeOut = 0; |
|
726 aItem.GetNextInt ( expTimeOut ) ; |
|
727 |
|
728 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
729 |
|
730 if( NULL == CoreObj) |
|
731 { |
|
732 iLog->Log(_L8("Failed.. @Core")) ; |
|
733 return KErrGeneral ; |
|
734 } |
|
735 |
|
736 CStatus *ipData = CStatus::NewL(expTimeOut) ; |
|
737 |
|
738 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
739 /* |
|
740 if(KErrNone == leaveCode) |
|
741 { |
|
742 |
|
743 CSysData *sysData ; |
|
744 |
|
745 iLog->Log(_L8("expTimeOut : %d"),expTimeOut) ; |
|
746 |
|
747 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
748 |
|
749 if(KErrNone == leaveCode) |
|
750 { |
|
751 |
|
752 TInt retType = sysData->DataType() ; |
|
753 |
|
754 if(expDataType == retType) |
|
755 { |
|
756 |
|
757 CStatus *status = (CStatus*)sysData ; |
|
758 TInt retStatus = status->Status() ; |
|
759 |
|
760 if(expTimeOut == retStatus) |
|
761 { |
|
762 iLog->Log(_L8("retStatus : %d"),retStatus) ; |
|
763 iLog->Log(_L8("Passed..")) ; |
|
764 } |
|
765 else |
|
766 { |
|
767 returnCode = KErrGeneral ; |
|
768 iLog->Log(_L8("Failed.. @retStatus")) ; |
|
769 } |
|
770 |
|
771 } |
|
772 |
|
773 else |
|
774 { |
|
775 returnCode = KErrGeneral ; |
|
776 iLog->Log(_L8("Failed.. @retType")) ; |
|
777 } |
|
778 delete sysData ; |
|
779 } |
|
780 else |
|
781 { |
|
782 returnCode = KErrGeneral ; |
|
783 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
784 } |
|
785 |
|
786 } |
|
787 |
|
788 else |
|
789 { |
|
790 returnCode = KErrGeneral ; |
|
791 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
792 } |
|
793 */ |
|
794 |
|
795 if(KErrNotFound == leaveCode) |
|
796 { |
|
797 iLog->Log(_L8("Passed..")) ; |
|
798 } |
|
799 else |
|
800 { |
|
801 returnCode = KErrGeneral ; |
|
802 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
803 } |
|
804 |
|
805 delete ipData ; |
|
806 delete CoreObj ; |
|
807 |
|
808 |
|
809 __UHEAP_MARKEND ; |
|
810 return returnCode ; |
|
811 |
|
812 |
|
813 } |
|
814 |
|
815 |
|
816 |
|
817 |
|
818 // ----------------------------------------------------------------------------- |
|
819 // Ctsysdisplay::SetAndGetKeyGuardTime |
|
820 // Tests set and get KeyguardTime values |
|
821 // ----------------------------------------------------------------------------- |
|
822 // |
|
823 TInt Ctsysdisplay::SetAndGetKeyGuardTime( CStifItemParser& aItem ) |
|
824 { |
|
825 |
|
826 __UHEAP_MARK; |
|
827 |
|
828 _LIT(KEntity,"Display") ; |
|
829 _LIT(KKey,"KeyGuardTime") ; |
|
830 |
|
831 TInt returnCode = KErrNone ; |
|
832 TInt expDataType = 0 ; |
|
833 TInt defValue = 0 ; |
|
834 TInt expTime = 0; |
|
835 aItem.GetNextInt ( expTime ) ; |
|
836 |
|
837 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
838 |
|
839 if( NULL == CoreObj) |
|
840 { |
|
841 iLog->Log(_L8("Failed.. @Core")) ; |
|
842 return KErrGeneral ; |
|
843 } |
|
844 |
|
845 CStatus *ipData = CStatus::NewL(expTime) ; |
|
846 |
|
847 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
848 /* |
|
849 if(KErrNone == leaveCode) |
|
850 { |
|
851 |
|
852 CSysData *sysData ; |
|
853 |
|
854 iLog->Log(_L8("expTime : %d"),expTime) ; |
|
855 |
|
856 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
857 |
|
858 if(KErrNone == leaveCode) |
|
859 { |
|
860 |
|
861 TInt retType = sysData->DataType() ; |
|
862 |
|
863 if(expDataType == retType) |
|
864 { |
|
865 |
|
866 CStatus *status = (CStatus*)sysData ; |
|
867 TInt retStatus = status->Status() ; |
|
868 iLog->Log(_L8("retStatus : %d"),retStatus) ; |
|
869 |
|
870 if(expTime == retStatus) |
|
871 { |
|
872 iLog->Log(_L8("Passed..")) ; |
|
873 } |
|
874 else |
|
875 { |
|
876 returnCode = KErrGeneral ; |
|
877 iLog->Log(_L8("Failed.. @retStatus")) ; |
|
878 } |
|
879 |
|
880 } |
|
881 |
|
882 else |
|
883 { |
|
884 returnCode = KErrGeneral ; |
|
885 iLog->Log(_L8("Failed.. @retType")) ; |
|
886 } |
|
887 |
|
888 delete sysData ; |
|
889 |
|
890 } |
|
891 else |
|
892 { |
|
893 returnCode = KErrGeneral ; |
|
894 iLog->Log(_L8("Failed.. @2 TRAPD")) ; |
|
895 } |
|
896 |
|
897 } |
|
898 |
|
899 else |
|
900 { |
|
901 returnCode = KErrGeneral ; |
|
902 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
903 } |
|
904 |
|
905 CStatus *defData = CStatus::NewL(defValue) ; |
|
906 |
|
907 // CoreObj->SetInfoL(KEntity,KKey,defData) ; |
|
908 |
|
909 delete defData ; |
|
910 */ |
|
911 |
|
912 if(KErrNotFound == leaveCode) |
|
913 { |
|
914 iLog->Log(_L8("Passed..")) ; |
|
915 } |
|
916 else |
|
917 { |
|
918 returnCode = KErrGeneral ; |
|
919 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
920 } |
|
921 |
|
922 delete ipData ; |
|
923 delete CoreObj ; |
|
924 |
|
925 __UHEAP_MARKEND ; |
|
926 return returnCode ; |
|
927 |
|
928 |
|
929 } |
|
930 |
|
931 |
|
932 // ----------------------------------------------------------------------------- |
|
933 // Ctsysdisplay::DisplayResolution |
|
934 // Tests DisplayResolution values |
|
935 // ----------------------------------------------------------------------------- |
|
936 // |
|
937 TInt Ctsysdisplay::DisplayResolution( CStifItemParser& /*aItem*/ ) |
|
938 { |
|
939 |
|
940 __UHEAP_MARK; |
|
941 |
|
942 _LIT(KEntity,"Display") ; |
|
943 _LIT(KKey,"DisplayResolution") ; |
|
944 |
|
945 TInt returnCode = KErrNone ; |
|
946 TInt expDataType = 10 ; |
|
947 |
|
948 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
949 |
|
950 if( NULL == CoreObj) |
|
951 { |
|
952 iLog->Log(_L8("Failed.. @Core")) ; |
|
953 return KErrGeneral ; |
|
954 } |
|
955 |
|
956 // CSysAttribute *attrib = CSysAttribute::NewL(KEntity,KKey) ; |
|
957 // TSysRequest sysReq(attrib) ; |
|
958 CSysData *sysData ; |
|
959 |
|
960 //iLog->Log(_L8("expTimeOut : %d"),expTimeOut) ; |
|
961 |
|
962 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
963 |
|
964 if(KErrNone == leaveCode) |
|
965 { |
|
966 |
|
967 TInt retType = sysData->DataType() ; |
|
968 |
|
969 if(expDataType == retType) |
|
970 { |
|
971 |
|
972 CResolution *resol = (CResolution*)sysData ; |
|
973 TInt resolX = resol->XPixels() ; |
|
974 TInt resolY = resol->YPixels() ; |
|
975 if(resolX && resolY) |
|
976 { |
|
977 iLog->Log(_L8("X-Resolution : %d"),resolX) ; |
|
978 iLog->Log(_L8("Y-Resolution : %d"),resolY) ; |
|
979 iLog->Log(_L8("Passed..")) ; |
|
980 } |
|
981 else |
|
982 { |
|
983 returnCode = KErrGeneral ; |
|
984 iLog->Log(_L8("Failed.. @resolution")) ; |
|
985 } |
|
986 |
|
987 } |
|
988 |
|
989 else |
|
990 { |
|
991 returnCode = KErrGeneral ; |
|
992 iLog->Log(_L8("Failed.. @retType")) ; |
|
993 } |
|
994 |
|
995 delete sysData ; |
|
996 |
|
997 } |
|
998 else |
|
999 { |
|
1000 returnCode = KErrGeneral ; |
|
1001 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
1002 } |
|
1003 delete CoreObj ; |
|
1004 |
|
1005 // delete attrib ; |
|
1006 |
|
1007 __UHEAP_MARKEND ; |
|
1008 return returnCode ; |
|
1009 |
|
1010 |
|
1011 } |
|
1012 |
|
1013 |
|
1014 // ----------------------------------------------------------------------------- |
|
1015 // Ctsysdisplay::DisplayOrientation |
|
1016 // Tests DisplayOrientation values |
|
1017 // ----------------------------------------------------------------------------- |
|
1018 // |
|
1019 TInt Ctsysdisplay::DisplayOrientation( CStifItemParser& aItem ) |
|
1020 { |
|
1021 |
|
1022 __UHEAP_MARK; |
|
1023 |
|
1024 _LIT(KEntity,"Display") ; |
|
1025 _LIT(KKey,"DisplayOrientation") ; |
|
1026 |
|
1027 TInt returnCode = KErrNone ; |
|
1028 TInt expDataType = 0 ; |
|
1029 TInt expOrientation = 0; |
|
1030 aItem.GetNextInt ( expOrientation ) ; |
|
1031 |
|
1032 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
1033 |
|
1034 if( NULL == CoreObj) |
|
1035 { |
|
1036 iLog->Log(_L8("Failed.. @Core")) ; |
|
1037 return KErrGeneral ; |
|
1038 } |
|
1039 |
|
1040 // CSysAttribute *attrib = CSysAttribute::NewL(KEntity,KKey) ; |
|
1041 // TSysRequest sysReq(attrib) ; |
|
1042 CSysData *sysData ; |
|
1043 |
|
1044 iLog->Log(_L8("expOrientation : %d"),expOrientation) ; |
|
1045 |
|
1046 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData) ); |
|
1047 |
|
1048 if(KErrNone == leaveCode) |
|
1049 { |
|
1050 |
|
1051 TInt retType = sysData->DataType() ; |
|
1052 |
|
1053 if(expDataType == retType) |
|
1054 { |
|
1055 |
|
1056 CStatus *status = (CStatus*)sysData ; |
|
1057 TInt retStatus = status->Status() ; |
|
1058 iLog->Log(_L8("retStatus : %d"),retStatus) ; |
|
1059 iLog->Log(_L8("Passed..")) ; |
|
1060 } |
|
1061 |
|
1062 else |
|
1063 { |
|
1064 returnCode = KErrGeneral ; |
|
1065 iLog->Log(_L8("Failed.. @retType")) ; |
|
1066 } |
|
1067 |
|
1068 delete sysData ; |
|
1069 |
|
1070 } |
|
1071 else |
|
1072 { |
|
1073 returnCode = KErrGeneral ; |
|
1074 iLog->Log(_L8("Failed.. @TRAPD: %d"),leaveCode) ; |
|
1075 } |
|
1076 delete CoreObj ; |
|
1077 |
|
1078 // delete attrib ; |
|
1079 |
|
1080 __UHEAP_MARKEND ; |
|
1081 return returnCode ; |
|
1082 |
|
1083 |
|
1084 } |
|
1085 |
|
1086 |
|
1087 |
|
1088 // ----------------------------------------------------------------------------- |
|
1089 // Ctsysdisplay::WrongKey |
|
1090 // Tests WrongKey values |
|
1091 // ----------------------------------------------------------------------------- |
|
1092 // |
|
1093 TInt Ctsysdisplay::WrongKey( CStifItemParser&/* aItem */) |
|
1094 { |
|
1095 |
|
1096 __UHEAP_MARK; |
|
1097 |
|
1098 _LIT(KEntity,"Display") ; |
|
1099 _LIT(KKey,"WrongKey") ; |
|
1100 |
|
1101 TInt returnCode = KErrNone ; |
|
1102 |
|
1103 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
1104 |
|
1105 if( NULL == CoreObj) |
|
1106 { |
|
1107 iLog->Log(_L8("Failed.. @Core")) ; |
|
1108 return KErrGeneral ; |
|
1109 } |
|
1110 |
|
1111 CSysData *sysData ; |
|
1112 |
|
1113 TRAPD(leaveCode, CoreObj->GetInfoL(KEntity,KKey,sysData)) ; |
|
1114 |
|
1115 if(KErrNotFound == leaveCode) |
|
1116 { |
|
1117 iLog->Log(_L8("Passed..")) ; |
|
1118 } |
|
1119 else |
|
1120 { |
|
1121 returnCode = KErrGeneral ; |
|
1122 iLog->Log(_L8("Failed..")) ; |
|
1123 } |
|
1124 |
|
1125 delete CoreObj ; |
|
1126 |
|
1127 __UHEAP_MARKEND ; |
|
1128 return returnCode ; |
|
1129 |
|
1130 |
|
1131 } |
|
1132 |
|
1133 |
|
1134 // ----------------------------------------------------------------------------- |
|
1135 // Ctsysdisplay::SetWrongDataType |
|
1136 // Tests SetWrongDataType |
|
1137 // ----------------------------------------------------------------------------- |
|
1138 // |
|
1139 TInt Ctsysdisplay::SetWrongDataType( CStifItemParser& /*aItem*/ ) |
|
1140 { |
|
1141 |
|
1142 __UHEAP_MARK; |
|
1143 |
|
1144 _LIT(KEntity,"Display") ; |
|
1145 _LIT(KKey,"ScreenSaverTimeOut") ; |
|
1146 |
|
1147 TInt returnCode = KErrNone ; |
|
1148 |
|
1149 CSysInfoService *CoreObj = CSysInfoService :: NewL() ; |
|
1150 |
|
1151 if( NULL == CoreObj) |
|
1152 { |
|
1153 iLog->Log(_L8("Failed.. @Core")) ; |
|
1154 return KErrGeneral ; |
|
1155 } |
|
1156 |
|
1157 CStringData *ipData = CStringData::NewL(KEntity) ; |
|
1158 |
|
1159 TRAPD(leaveCode, CoreObj->SetInfoL(KEntity,KKey,ipData)) ; |
|
1160 |
|
1161 if(KErrArgument != leaveCode) |
|
1162 { |
|
1163 returnCode = KErrGeneral ; |
|
1164 iLog->Log(_L8("Failed.. @TRAPD")) ; |
|
1165 } |
|
1166 else |
|
1167 { |
|
1168 iLog->Log(_L8("Passed..")) ; |
|
1169 } |
|
1170 |
|
1171 delete ipData ; |
|
1172 delete CoreObj ; |
|
1173 |
|
1174 |
|
1175 __UHEAP_MARKEND ; |
|
1176 return returnCode ; |
|
1177 |
|
1178 |
|
1179 } |
|
1180 |
|
1181 |
|
1182 // ----------------------------------------------------------------------------- |
|
1183 // Ctsysdisplay::UserActGetAsync |
|
1184 // Example test method function. |
|
1185 // (other items were commented in a header). |
|
1186 // ----------------------------------------------------------------------------- |
|
1187 // |
|
1188 TInt Ctsysdisplay::UserActGetAsync( CStifItemParser& /*aItem*/ ) |
|
1189 { |
|
1190 TInt Err = KErrNone ; |
|
1191 TInt returnCode = KErrNone ; |
|
1192 |
|
1193 __UHEAP_MARK; |
|
1194 |
|
1195 CDisplayNot *test = CDisplayNot::NewL(iLog, 0); |
|
1196 test->Start(); |
|
1197 Err = test->Result(); |
|
1198 delete test; |
|
1199 |
|
1200 if(KErrNotSupported != Err) |
|
1201 returnCode = KErrGeneral ; |
|
1202 |
|
1203 __UHEAP_MARKEND; |
|
1204 return returnCode ; |
|
1205 |
|
1206 |
|
1207 } |
|
1208 |
|
1209 |
|
1210 // ----------------------------------------------------------------------------- |
|
1211 // Ctsysdisplay::UserActNotWithWrongIp |
|
1212 // Example test method function. |
|
1213 // (other items were commented in a header). |
|
1214 // ----------------------------------------------------------------------------- |
|
1215 // |
|
1216 TInt Ctsysdisplay::UserActNotWithWrongIp( CStifItemParser& /*aItem*/ ) |
|
1217 { |
|
1218 TInt Err = KErrNone ; |
|
1219 TInt returnCode = KErrNone ; |
|
1220 |
|
1221 __UHEAP_MARK; |
|
1222 |
|
1223 CDisplayNot *test = CDisplayNot::NewL(iLog, 1); |
|
1224 test->Start(); |
|
1225 Err = test->Result(); |
|
1226 delete test; |
|
1227 |
|
1228 if(KErrArgument != Err) |
|
1229 returnCode = KErrGeneral ; |
|
1230 |
|
1231 __UHEAP_MARKEND; |
|
1232 return returnCode ; |
|
1233 |
|
1234 |
|
1235 } |
|
1236 |
|
1237 // ----------------------------------------------------------------------------- |
|
1238 // Ctsysdisplay::UserActNotWithWrongKey |
|
1239 // Example test method function. |
|
1240 // (other items were commented in a header). |
|
1241 // ----------------------------------------------------------------------------- |
|
1242 // |
|
1243 TInt Ctsysdisplay::UserActNotWithWrongKey( CStifItemParser& /*aItem*/ ) |
|
1244 { |
|
1245 TInt Err = KErrNone ; |
|
1246 TInt returnCode = KErrNone ; |
|
1247 |
|
1248 __UHEAP_MARK; |
|
1249 |
|
1250 CDisplayNot *test = CDisplayNot::NewL(iLog, 2); |
|
1251 test->Start(); |
|
1252 Err = test->Result(); |
|
1253 delete test; |
|
1254 |
|
1255 if(KErrNotFound != Err) |
|
1256 returnCode = KErrGeneral ; |
|
1257 |
|
1258 __UHEAP_MARKEND; |
|
1259 return returnCode ; |
|
1260 |
|
1261 |
|
1262 } |
|
1263 // ----------------------------------------------------------------------------- |
|
1264 // Ctsysdisplay::?member_function |
|
1265 // ?implementation_description |
|
1266 // (other items were commented in a header). |
|
1267 // ----------------------------------------------------------------------------- |
|
1268 // |
|
1269 /* |
|
1270 TInt Ctsysdisplay::?member_function( |
|
1271 CItemParser& aItem ) |
|
1272 { |
|
1273 |
|
1274 ?code |
|
1275 |
|
1276 } |
|
1277 */ |
|
1278 |
|
1279 // ========================== OTHER EXPORTED FUNCTIONS ========================= |
|
1280 // None |
|
1281 |
|
1282 // End of File |