|
1 /* |
|
2 * Copyright (c) 2005-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 the License "Symbian Foundation License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "T_DataWindow.h" |
|
19 #include "T_GraphicsUtil.h" |
|
20 #include <coemain.h> |
|
21 |
|
22 /*@{*/ |
|
23 _LIT(KDataClassname, "RWindow"); |
|
24 |
|
25 //Commands |
|
26 _LIT(KCmdnew, "new"); |
|
27 _LIT(KCmdDestructor, "~"); |
|
28 _LIT(KCmdConstruct, "Construct"); |
|
29 _LIT(KCmdBeginRedraw, "BeginRedraw"); |
|
30 _LIT(KCmdEndRedraw, "EndRedraw"); |
|
31 _LIT(KCmdInvalidate, "Invalidate"); |
|
32 _LIT(KCmdGetInvalidRegion, "GetInvalidRegion"); |
|
33 _LIT(KCmdSetBackgroundColor, "SetBackgroundColor"); |
|
34 _LIT(KCmdSetSize, "SetSize"); |
|
35 _LIT(KCmdSetExtent, "SetExtent"); |
|
36 _LIT(KCmdHandleTransparencyUpdate, "HandleTransparencyUpdate"); |
|
37 _LIT(KCmdSetTransparencyFactor, "SetTransparencyFactor"); |
|
38 _LIT(KCmdSetTransparencyBitmap, "SetTransparencyBitmap"); |
|
39 _LIT(KCmdSetTransparencyWsBitmap, "SetTransparencyWsBitmap"); |
|
40 _LIT(KCmdSetNonTransparent, "SetNonTransparent"); |
|
41 _LIT(KCmdEnableRedrawStore, "EnableRedrawStore"); |
|
42 _LIT(KCmdSetTransparencyAlphaChannel, "SetTransparencyAlphaChannel"); |
|
43 _LIT(KCmdSetTransparentRegion, "SetTransparentRegion"); |
|
44 _LIT(KCmdSetTransparencyPolicy, "SetTransparencyPolicy"); |
|
45 _LIT(KCmdIsRedrawStoreEnabled, "IsRedrawStoreEnabled"); |
|
46 _LIT(KCmdEnableOSB, "EnableOSB"); |
|
47 _LIT(KCmdSave, "Save"); |
|
48 |
|
49 // Fields |
|
50 _LIT(KFldColor, "color"); |
|
51 _LIT(KFldEnabled, "enabled"); |
|
52 _LIT(KFldExpected, "expected"); |
|
53 _LIT(KFldFlag, "flag"); |
|
54 _LIT(KFldHandle, "handle"); |
|
55 _LIT(KFldParent, "parent"); |
|
56 _LIT(KFldPoint, "point"); |
|
57 _LIT(KFldPolicy, "policy"); |
|
58 _LIT(KFldRect, "rect"); |
|
59 _LIT(KFldRegion, "region"); |
|
60 _LIT(KFldSize, "size"); |
|
61 _LIT(KFldTransparencyBitmap, "transparencybitmap"); |
|
62 _LIT(KFldTransparencyFactor, "transparencyfactor"); |
|
63 _LIT(KFldWs, "ws"); |
|
64 |
|
65 /// Logging |
|
66 _LIT(KLogError, "Error=%d"); |
|
67 _LIT(KLogMissingParameter, "Missing parameter '%S'"); |
|
68 _LIT(KLogMissingExpectedValue, "Missing expected value '%S'"); |
|
69 _LIT(KLogNotExpectedValueInt, "'%S' is not as expected=%d, actual=%d"); |
|
70 |
|
71 /*@}*/ |
|
72 |
|
73 ////////////////////////////////////////////////////////////////////// |
|
74 // Construction/Destruction |
|
75 ////////////////////////////////////////////////////////////////////// |
|
76 |
|
77 CT_DataWindow* CT_DataWindow::NewL() |
|
78 { |
|
79 CT_DataWindow* ret=new (ELeave) CT_DataWindow(); |
|
80 CleanupStack::PushL(ret); |
|
81 ret->ConstructL(); |
|
82 CleanupStack::Pop(ret); |
|
83 return ret; |
|
84 } |
|
85 |
|
86 CT_DataWindow::CT_DataWindow() |
|
87 : CT_DataDrawableWindow() |
|
88 , iWindow(NULL) |
|
89 { |
|
90 } |
|
91 |
|
92 void CT_DataWindow::ConstructL() |
|
93 { |
|
94 } |
|
95 |
|
96 CT_DataWindow::~CT_DataWindow() |
|
97 { |
|
98 DestroyData(); |
|
99 } |
|
100 |
|
101 void CT_DataWindow::SetObjectL(TAny* aAny) |
|
102 { |
|
103 DestroyData(); |
|
104 iWindow = static_cast<RWindow*> (aAny); |
|
105 } |
|
106 |
|
107 void CT_DataWindow::DisownObjectL() |
|
108 { |
|
109 iWindow = NULL; |
|
110 } |
|
111 |
|
112 void CT_DataWindow::DestroyData() |
|
113 { |
|
114 delete iWindow; |
|
115 iWindow=NULL; |
|
116 } |
|
117 |
|
118 RDrawableWindow* CT_DataWindow::GetDrawableWindow() const |
|
119 { |
|
120 return iWindow; |
|
121 } |
|
122 |
|
123 /** |
|
124 * Process a command read from the ini file |
|
125 * |
|
126 * @param aCommand the command to process |
|
127 * @param aSection the entry in the ini file requiring the command to be processed |
|
128 * @param aAsyncErrorIndex index of command. used for async calls |
|
129 * |
|
130 * @return ETrue if the command is processed |
|
131 */ |
|
132 TBool CT_DataWindow::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) |
|
133 { |
|
134 TBool ret = ETrue; |
|
135 |
|
136 if ( aCommand==KCmdDestructor ) |
|
137 { |
|
138 DestroyData(); |
|
139 } |
|
140 else if ( aCommand==KCmdnew || aCommand==KDataClassname ) |
|
141 { |
|
142 DoCmdnewL(aSection); |
|
143 } |
|
144 else if ( aCommand==KCmdConstruct ) |
|
145 { |
|
146 DoCmdConstructL(aSection); |
|
147 } |
|
148 else if ( aCommand==KCmdBeginRedraw ) |
|
149 { |
|
150 DoCmdBeginRedraw(aSection); |
|
151 } |
|
152 else if ( aCommand==KCmdEndRedraw ) |
|
153 { |
|
154 DoCmdEndRedraw(); |
|
155 } |
|
156 else if ( aCommand==KCmdInvalidate ) |
|
157 { |
|
158 DoCmdInvalidate(aSection); |
|
159 } |
|
160 else if ( aCommand==KCmdGetInvalidRegion ) |
|
161 { |
|
162 DoCmdGetInvalidRegionL(aSection); |
|
163 } |
|
164 else if ( aCommand==KCmdSetBackgroundColor ) |
|
165 { |
|
166 DoCmdSetBackgroundColor(aSection); |
|
167 } |
|
168 else if ( aCommand==KCmdSetSize ) |
|
169 { |
|
170 DoCmdSetSize(aSection); |
|
171 } |
|
172 else if ( aCommand==KCmdSetExtent ) |
|
173 { |
|
174 DoCmdSetExtent(aSection); |
|
175 } |
|
176 else if ( aCommand==KCmdHandleTransparencyUpdate ) |
|
177 { |
|
178 DoCmdHandleTransparencyUpdate(); |
|
179 } |
|
180 else if ( aCommand==KCmdSetTransparencyFactor ) |
|
181 { |
|
182 DoCmdSetTransparencyFactor(aSection); |
|
183 } |
|
184 else if ( aCommand==KCmdSetTransparencyBitmap ) |
|
185 { |
|
186 DoCmdSetTransparencyBitmapL(aSection); |
|
187 } |
|
188 else if ( aCommand==KCmdSetTransparencyWsBitmap ) |
|
189 { |
|
190 DoCmdSetTransparencyWsBitmapL(aSection); |
|
191 } |
|
192 else if ( aCommand==KCmdSetNonTransparent ) |
|
193 { |
|
194 DoCmdSetNonTransparent(); |
|
195 } |
|
196 else if ( aCommand==KCmdEnableRedrawStore ) |
|
197 { |
|
198 DoCmdEnableRedrawStore(aSection); |
|
199 } |
|
200 else if ( aCommand==KCmdSetTransparencyAlphaChannel ) |
|
201 { |
|
202 DoCmdSetTransparencyAlphaChannel(); |
|
203 } |
|
204 else if ( aCommand==KCmdSetTransparentRegion ) |
|
205 { |
|
206 DoCmdSetTransparentRegionL(aSection); |
|
207 } |
|
208 else if ( aCommand==KCmdSetTransparencyPolicy ) |
|
209 { |
|
210 DoCmdSetTransparencyPolicy(aSection); |
|
211 } |
|
212 else if ( aCommand==KCmdIsRedrawStoreEnabled ) |
|
213 { |
|
214 DoCmdIsRedrawStoreEnabled(aSection); |
|
215 } |
|
216 else if ( aCommand==KCmdEnableOSB ) |
|
217 { |
|
218 DoCmdEnableOSB(aSection); |
|
219 } |
|
220 else if ( aCommand==KCmdSave ) |
|
221 { |
|
222 DoCmdSave(); |
|
223 } |
|
224 else |
|
225 { |
|
226 ret=CT_DataDrawableWindow::DoCommandL(aCommand, aSection, aAsyncErrorIndex); |
|
227 } |
|
228 |
|
229 return ret; |
|
230 } |
|
231 |
|
232 |
|
233 void CT_DataWindow::DoCmdnewL(const TDesC& aSection) |
|
234 { |
|
235 DestroyData(); |
|
236 |
|
237 // Get test data for command input parameter(s) |
|
238 TPtrC wsName; |
|
239 RWsSession* ws=NULL; |
|
240 if ( GetStringFromConfig(aSection, KFldWs, wsName) ) |
|
241 { |
|
242 ws = static_cast<RWsSession*>(GetDataObjectL(wsName)); |
|
243 } |
|
244 |
|
245 TInt err=KErrNone; |
|
246 if ( ws!=NULL ) |
|
247 { |
|
248 // Execute command and log parameters |
|
249 INFO_PRINTF1(_L("execute new RWindow(RWsSession)")); |
|
250 TRAP( err, iWindow = new (ELeave) RWindow(*ws)); |
|
251 } |
|
252 else |
|
253 { |
|
254 // Execute command and log parameters |
|
255 INFO_PRINTF1(_L("execute new RWindow()")); |
|
256 TRAP( err, iWindow = new (ELeave) RWindow()); |
|
257 } |
|
258 |
|
259 if ( err!=KErrNone ) |
|
260 { |
|
261 ERR_PRINTF2(KLogError, err); |
|
262 SetError(err); |
|
263 } |
|
264 } |
|
265 |
|
266 |
|
267 void CT_DataWindow::DoCmdConstructL(const TDesC& aSection) |
|
268 { |
|
269 TBool dataOk=ETrue; |
|
270 |
|
271 // Get test data for command input parameter(s) |
|
272 TPtrC parentName; |
|
273 RWindowTreeNode* parent=NULL; |
|
274 if ( GetStringFromConfig(aSection, KFldParent, parentName) ) |
|
275 { |
|
276 parent = static_cast<RWindowTreeNode*>(GetDataObjectL(parentName)); |
|
277 } |
|
278 if ( parent==NULL ) |
|
279 { |
|
280 dataOk=EFalse; |
|
281 ERR_PRINTF2(KLogMissingParameter, &KFldParent); |
|
282 SetBlockResult(EFail); |
|
283 } |
|
284 |
|
285 TInt datHandle; |
|
286 if ( !GetIntFromConfig(aSection, KFldHandle, datHandle) ) |
|
287 { |
|
288 dataOk=EFalse; |
|
289 ERR_PRINTF2(KLogMissingParameter, &KFldHandle); |
|
290 SetBlockResult(EFail); |
|
291 } |
|
292 |
|
293 if ( dataOk ) |
|
294 { |
|
295 // Execute command and log parameters |
|
296 INFO_PRINTF1(_L("execute Construct(RWindowTreeNode, TUint32)")); |
|
297 TInt returnCode = iWindow->Construct(*parent, datHandle); |
|
298 |
|
299 // Check the command return code, if !=KErrNone then stop this command |
|
300 if ( returnCode!=KErrNone ) |
|
301 { |
|
302 ERR_PRINTF2(KLogError, returnCode); |
|
303 SetError(returnCode); |
|
304 } |
|
305 |
|
306 // No command output parameter to display and check |
|
307 } |
|
308 } |
|
309 |
|
310 |
|
311 void CT_DataWindow::DoCmdBeginRedraw(const TDesC& aSection) |
|
312 { |
|
313 // Get test data for command input parameter(s) |
|
314 TRect datRect; |
|
315 |
|
316 if ( GetRectFromConfig(aSection, KFldRect, datRect) ) |
|
317 { |
|
318 // Execute command and log parameters |
|
319 INFO_PRINTF1(_L("execute BeginRedraw(TRect)")); |
|
320 iWindow->BeginRedraw(datRect); |
|
321 } |
|
322 else |
|
323 { |
|
324 // Execute command and log parameters |
|
325 INFO_PRINTF1(_L("execute BeginRedraw()")); |
|
326 iWindow->BeginRedraw(); |
|
327 } |
|
328 |
|
329 // No command return value and output parameter to display and check |
|
330 } |
|
331 |
|
332 |
|
333 void CT_DataWindow::DoCmdEndRedraw() |
|
334 { |
|
335 // No command input parameter to process |
|
336 |
|
337 // Execute command and log parameters |
|
338 INFO_PRINTF1(_L("execute EndRedraw()")); |
|
339 iWindow->EndRedraw(); |
|
340 |
|
341 // No command return value and output parameter to display and check |
|
342 } |
|
343 |
|
344 |
|
345 void CT_DataWindow::DoCmdInvalidate(const TDesC& aSection) |
|
346 { |
|
347 // Get test data for command input parameter(s) |
|
348 TRect datRect; |
|
349 |
|
350 if ( GetRectFromConfig(aSection, KFldRect, datRect) ) |
|
351 { |
|
352 // Execute command and log parameters |
|
353 INFO_PRINTF1(_L("execute Invalidate(TRect)")); |
|
354 iWindow->Invalidate(datRect); |
|
355 } |
|
356 else |
|
357 { |
|
358 // Execute command and log parameters |
|
359 INFO_PRINTF1(_L("execute Invalidate()")); |
|
360 iWindow->Invalidate(); |
|
361 } |
|
362 |
|
363 // No command return value and output parameter to display and check |
|
364 } |
|
365 |
|
366 |
|
367 void CT_DataWindow::DoCmdGetInvalidRegionL(const TDesC& aSection) |
|
368 { |
|
369 RRegion region(1); |
|
370 CleanupClosePushL(region); |
|
371 |
|
372 // No command input parameter to process |
|
373 |
|
374 // Execute command and log parameters |
|
375 INFO_PRINTF1(_L("execute GetInvalidRegion(RRegion)")); |
|
376 iWindow->GetInvalidRegion(region); |
|
377 |
|
378 // Diaplay command return value, check if it matches the expected value |
|
379 LogRegion(_L("GetInvalidRegion()"), region); |
|
380 |
|
381 RRegion expectedRegion(1); |
|
382 CleanupClosePushL(expectedRegion); |
|
383 if ( GetRegionFromConfig(aSection, KFldExpected, expectedRegion) ) |
|
384 { |
|
385 region.SubRegion(expectedRegion); |
|
386 if ( !region.IsEmpty() ) |
|
387 { |
|
388 ERR_PRINTF1(_L("Region not as expected")); |
|
389 LogRegion(_L("Region mismatch"), region); |
|
390 SetBlockResult(EFail); |
|
391 } |
|
392 } |
|
393 |
|
394 CleanupStack::PopAndDestroy(2, ®ion); |
|
395 } |
|
396 |
|
397 |
|
398 void CT_DataWindow::DoCmdSetBackgroundColor(const TDesC& aSection) |
|
399 { |
|
400 // Get test data for command input parameter(s) |
|
401 TRgb datColor; |
|
402 |
|
403 if ( GetRgbFromConfig(aSection, KFldColor, datColor) ) |
|
404 { |
|
405 // Execute command and log parameters |
|
406 INFO_PRINTF1(_L("execute SetBackgroundColor(TRgb)")); |
|
407 iWindow->SetBackgroundColor(datColor); |
|
408 } |
|
409 else |
|
410 { |
|
411 // Execute command and log parameters |
|
412 INFO_PRINTF1(_L("execute SetBackgroundColor()")); |
|
413 iWindow->SetBackgroundColor(); |
|
414 } |
|
415 |
|
416 // No command return value and output parameter to display and check |
|
417 } |
|
418 |
|
419 |
|
420 void CT_DataWindow::DoCmdSetSize(const TDesC& aSection) |
|
421 { |
|
422 // Get test data for command input parameter(s) |
|
423 TSize datSize; |
|
424 if ( !GetSizeFromConfig(aSection, KFldSize, datSize) ) |
|
425 { |
|
426 ERR_PRINTF2(KLogMissingParameter, &KFldSize); |
|
427 SetBlockResult(EFail); |
|
428 } |
|
429 else |
|
430 { |
|
431 // Execute command and log parameters |
|
432 INFO_PRINTF1(_L("execute SetSize(TSize)")); |
|
433 iWindow->SetSize(datSize); |
|
434 |
|
435 // No command return value and output parameter to display and check |
|
436 } |
|
437 } |
|
438 |
|
439 |
|
440 void CT_DataWindow::DoCmdSetExtent(const TDesC& aSection) |
|
441 { |
|
442 TBool dataOk=ETrue; |
|
443 |
|
444 // Get test data for command input parameter(s) |
|
445 TPoint datPoint; |
|
446 if ( !GetPointFromConfig(aSection, KFldPoint, datPoint) ) |
|
447 { |
|
448 dataOk=EFalse; |
|
449 ERR_PRINTF2(KLogMissingParameter, &KFldPoint); |
|
450 SetBlockResult(EFail); |
|
451 } |
|
452 |
|
453 TSize datSize; |
|
454 if ( !GetSizeFromConfig(aSection, KFldSize, datSize) ) |
|
455 { |
|
456 dataOk=EFalse; |
|
457 ERR_PRINTF2(KLogMissingParameter, &KFldSize); |
|
458 SetBlockResult(EFail); |
|
459 } |
|
460 |
|
461 if ( dataOk ) |
|
462 { |
|
463 // Execute command and log parameters |
|
464 INFO_PRINTF1(_L("execute SetExtent(TPoint, TSize)")); |
|
465 iWindow->SetExtent(datPoint, datSize); |
|
466 |
|
467 // No command return value and output parameter to display and check |
|
468 } |
|
469 } |
|
470 |
|
471 |
|
472 void CT_DataWindow::DoCmdHandleTransparencyUpdate() |
|
473 { |
|
474 // No command input parameter to process |
|
475 |
|
476 // Execute command and log parameters |
|
477 INFO_PRINTF1(_L("execute HandleTransparencyUpdate()")); |
|
478 iWindow->HandleTransparencyUpdate(); |
|
479 |
|
480 // No command return value and output parameter to display and check |
|
481 } |
|
482 |
|
483 |
|
484 void CT_DataWindow::DoCmdSetTransparencyFactor(const TDesC& aSection) |
|
485 { |
|
486 // Get test data for command input parameter(s) |
|
487 TRgb datTransparencyFactor; |
|
488 |
|
489 if ( !GetRgbFromConfig(aSection, KFldTransparencyFactor, datTransparencyFactor) ) |
|
490 { |
|
491 ERR_PRINTF2(KLogMissingParameter, &KFldTransparencyFactor); |
|
492 SetBlockResult(EFail); |
|
493 } |
|
494 else |
|
495 { |
|
496 // Execute command and log parameters |
|
497 INFO_PRINTF1(_L("execute SetTransparencyFactor(TRgb)")); |
|
498 TInt returnCode = iWindow->SetTransparencyFactor(datTransparencyFactor); |
|
499 |
|
500 // Check the command return code, if !=KErrNone then stop this command |
|
501 if ( returnCode!=KErrNone ) |
|
502 { |
|
503 ERR_PRINTF2(KLogError, returnCode); |
|
504 SetError(returnCode); |
|
505 } |
|
506 |
|
507 // No command output parameter to display and check |
|
508 } |
|
509 } |
|
510 |
|
511 |
|
512 void CT_DataWindow::DoCmdSetTransparencyBitmapL(const TDesC& aSection) |
|
513 { |
|
514 // Get test data for command input parameter(s) |
|
515 CFbsBitmap* transparencyBitmap = NULL; |
|
516 |
|
517 if ( !CT_GraphicsUtil::GetFbsBitmapL(*this, aSection, KFldTransparencyBitmap, transparencyBitmap) ) |
|
518 { |
|
519 ERR_PRINTF2(KLogMissingParameter, &KFldTransparencyBitmap); |
|
520 SetBlockResult(EFail); |
|
521 } |
|
522 else |
|
523 { |
|
524 // Execute command and log parameters |
|
525 INFO_PRINTF1(_L("execute SetTransparencyBitmap(CFbsBitmap)")); |
|
526 TInt returnCode = iWindow->SetTransparencyBitmap(*transparencyBitmap); |
|
527 |
|
528 // Check the command return code, if !=KErrNone then stop this command |
|
529 if ( returnCode!=KErrNone ) |
|
530 { |
|
531 ERR_PRINTF2(KLogError, returnCode); |
|
532 SetError(returnCode); |
|
533 } |
|
534 |
|
535 // No command output parameter to display and check |
|
536 } |
|
537 } |
|
538 |
|
539 |
|
540 void CT_DataWindow::DoCmdSetTransparencyWsBitmapL(const TDesC& aSection) |
|
541 { |
|
542 // Get test data for command input parameter(s) |
|
543 CWsBitmap* transparencyBitmap = NULL; |
|
544 |
|
545 if ( !CT_GraphicsUtil::GetWsBitmapL(*this, aSection, KFldTransparencyBitmap, transparencyBitmap) ) |
|
546 { |
|
547 ERR_PRINTF2(KLogMissingParameter, &KFldTransparencyBitmap); |
|
548 SetBlockResult(EFail); |
|
549 } |
|
550 else |
|
551 { |
|
552 // Execute command and log parameters |
|
553 INFO_PRINTF1(_L("execute SetTransparencyWsBitmap(CWsBitmap)")); |
|
554 TInt returnCode = iWindow->SetTransparencyWsBitmap(*transparencyBitmap); |
|
555 |
|
556 // Check the command return code, if !=KErrNone then stop this command |
|
557 if ( returnCode!=KErrNone ) |
|
558 { |
|
559 ERR_PRINTF2(KLogError, returnCode); |
|
560 SetError(returnCode); |
|
561 } |
|
562 |
|
563 // No command output parameter to display and check |
|
564 } |
|
565 } |
|
566 |
|
567 |
|
568 void CT_DataWindow::DoCmdSetNonTransparent() |
|
569 { |
|
570 // No command input parameter to process |
|
571 |
|
572 // Execute command and log parameters |
|
573 INFO_PRINTF1(_L("execute SetNonTransparent()")); |
|
574 iWindow->SetNonTransparent(); |
|
575 |
|
576 // No command return value and output parameter to display and check |
|
577 } |
|
578 |
|
579 |
|
580 void CT_DataWindow::DoCmdEnableRedrawStore(const TDesC& aSection) |
|
581 { |
|
582 // Get test data for command input parameter(s) |
|
583 TBool datEnabled; |
|
584 |
|
585 if ( !GetBoolFromConfig(aSection, KFldEnabled, datEnabled) ) |
|
586 { |
|
587 ERR_PRINTF2(KLogMissingParameter, &KFldEnabled); |
|
588 SetBlockResult(EFail); |
|
589 } |
|
590 else |
|
591 { |
|
592 // Execute command and log parameters |
|
593 INFO_PRINTF1(_L("execute EnableRedrawStore(TBool)")); |
|
594 iWindow->EnableRedrawStore(datEnabled); |
|
595 |
|
596 // No command return value and output parameter to display and check |
|
597 } |
|
598 } |
|
599 |
|
600 |
|
601 void CT_DataWindow::DoCmdSetTransparencyAlphaChannel() |
|
602 { |
|
603 // No command input parameter to process |
|
604 |
|
605 // Execute command and log parameters |
|
606 INFO_PRINTF1(_L("execute SetTransparencyAlphaChannel()")); |
|
607 TInt returnCode = iWindow->SetTransparencyAlphaChannel(); |
|
608 |
|
609 // Check the command return code, if !=KErrNone then stop this command |
|
610 if ( returnCode!=KErrNone ) |
|
611 { |
|
612 ERR_PRINTF2(KLogError, returnCode); |
|
613 SetError(returnCode); |
|
614 } |
|
615 |
|
616 // No command output parameter to display and check |
|
617 } |
|
618 |
|
619 |
|
620 void CT_DataWindow::DoCmdSetTransparentRegionL(const TDesC& aSection) |
|
621 { |
|
622 // Get test data for command input parameter(s) |
|
623 RRegion region(1); |
|
624 CleanupClosePushL(region); |
|
625 |
|
626 if ( !GetRegionFromConfig(aSection, KFldRegion, region) ) |
|
627 { |
|
628 ERR_PRINTF2(KLogMissingParameter, &KFldRegion); |
|
629 SetBlockResult(EFail); |
|
630 } |
|
631 else |
|
632 { |
|
633 // Execute command and log parameters |
|
634 INFO_PRINTF1(_L("execute SetTransparentRegion(TRegion)")); |
|
635 TInt returnCode = iWindow->SetTransparentRegion(region); |
|
636 |
|
637 // Check the command return code, if !=KErrNone then stop this command |
|
638 if ( returnCode!=KErrNone ) |
|
639 { |
|
640 ERR_PRINTF2(KLogError, returnCode); |
|
641 SetError(returnCode); |
|
642 } |
|
643 |
|
644 // No command output parameter to display and check |
|
645 } |
|
646 |
|
647 CleanupStack::PopAndDestroy(®ion); |
|
648 } |
|
649 |
|
650 |
|
651 void CT_DataWindow::DoCmdSetTransparencyPolicy(const TDesC& aSection) |
|
652 { |
|
653 // Get test data for command input parameter(s) |
|
654 TWsTransparencyPolicy datPolicy; |
|
655 |
|
656 if ( !CT_GraphicsUtil::ReadWsTransparencyPolicy(*this, aSection, KFldPolicy, datPolicy) ) |
|
657 { |
|
658 ERR_PRINTF2(KLogMissingParameter, &KFldPolicy); |
|
659 SetBlockResult(EFail); |
|
660 } |
|
661 else |
|
662 { |
|
663 // Execute command and log parameters |
|
664 INFO_PRINTF1(_L("execute SetTransparencyPolicy(TWsTransparencyPolicy)")); |
|
665 TInt returnCode = iWindow->SetTransparencyPolicy(datPolicy); |
|
666 |
|
667 // Check the command return code, if !=KErrNone then stop this command |
|
668 if ( returnCode!=KErrNone ) |
|
669 { |
|
670 ERR_PRINTF2(KLogError, returnCode); |
|
671 SetError(returnCode); |
|
672 } |
|
673 |
|
674 // No command output parameter to display and check |
|
675 } |
|
676 } |
|
677 |
|
678 |
|
679 void CT_DataWindow::DoCmdIsRedrawStoreEnabled(const TDesC& aSection) |
|
680 { |
|
681 // No command input parameter to process |
|
682 |
|
683 // Execute command and log parameters |
|
684 INFO_PRINTF1(_L("execute IsRedrawStoreEnabled()")); |
|
685 TBool actualResult = iWindow->IsRedrawStoreEnabled(); |
|
686 |
|
687 // Diaplay command return value, check if it matches the expected value |
|
688 TBool expectResult; |
|
689 if ( !GetBoolFromConfig(aSection, KFldExpected, expectResult) ) |
|
690 { |
|
691 ERR_PRINTF2(KLogMissingExpectedValue, &KFldExpected()); |
|
692 SetBlockResult(EFail); |
|
693 } |
|
694 else if ( actualResult != expectResult ) |
|
695 { |
|
696 ERR_PRINTF4(KLogNotExpectedValueInt, &KFldExpected, expectResult, actualResult); |
|
697 SetBlockResult(EFail); |
|
698 } |
|
699 |
|
700 // No command output parameter to display and check |
|
701 } |
|
702 |
|
703 |
|
704 void CT_DataWindow::DoCmdEnableOSB(const TDesC& aSection) |
|
705 { |
|
706 // Get test data for command input parameter(s) |
|
707 TBool datFlag; |
|
708 |
|
709 if ( !GetBoolFromConfig(aSection, KFldFlag, datFlag) ) |
|
710 { |
|
711 ERR_PRINTF2(KLogMissingParameter, &KFldFlag); |
|
712 SetBlockResult(EFail); |
|
713 } |
|
714 else |
|
715 { |
|
716 // Execute command and log parameters |
|
717 INFO_PRINTF1(_L("execute EnableOSB(TBool)")); |
|
718 iWindow->EnableOSB(datFlag); |
|
719 |
|
720 // No command return value and output parameter to display and check |
|
721 } |
|
722 } |
|
723 |
|
724 |
|
725 void CT_DataWindow::DoCmdSave() |
|
726 { |
|
727 RWsSession iWs; |
|
728 CWsScreenDevice* iDeviceScreen; |
|
729 CFbsBitmap* iBitmap=new(ELeave)CFbsBitmap(); |
|
730 |
|
731 User::LeaveIfError(iWs.Connect()); |
|
732 iDeviceScreen = new (ELeave) CWsScreenDevice(iWs); // make device for this session |
|
733 User::LeaveIfError(iDeviceScreen->Construct()); // and complete its construction |
|
734 |
|
735 //Create a bitmap from specified rect |
|
736 iBitmap->Create(iDeviceScreen->SizeInPixels(),EColor16M); |
|
737 iDeviceScreen->CopyScreenToBitmap(iBitmap); |
|
738 iBitmap->Save(_L("c:\\logs\\testexecute\\screen.mbm")); //Save as an mbm |
|
739 |
|
740 //Get rid of everything allocated |
|
741 if (iDeviceScreen) |
|
742 delete iDeviceScreen; |
|
743 if (iBitmap) |
|
744 delete iBitmap; |
|
745 // finish with window server |
|
746 iWs.Close(); |
|
747 } |