|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Tests message windows provided by CEIkonEnv.\n |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @internalComponent - Internal Symbian test code |
|
21 */ |
|
22 |
|
23 |
|
24 #include <e32keys.h> |
|
25 #include <basched.h> |
|
26 #include <coecntrl.h> |
|
27 #include <eikdef.h> |
|
28 #include <eikenv.h> |
|
29 #include <eikappui.h> |
|
30 #include <techview/eikon.hrh> |
|
31 #include <eikapp.h> |
|
32 #include <eikdoc.h> |
|
33 #include <tmsg.rsg> |
|
34 #include "TMSG.HRH" |
|
35 #include <techview/eiktbar.h> |
|
36 #include <ecom/ecom.h> |
|
37 |
|
38 _LIT(resourceFileName, "z:\\system\\test\\tmsg\\tmsg.rsc"); |
|
39 |
|
40 const TInt KStartDelay=3000000; |
|
41 |
|
42 #include "Tmsg.h" |
|
43 |
|
44 |
|
45 enum TTMsgPanic |
|
46 { |
|
47 ETMsgPanicBadCommand |
|
48 }; |
|
49 |
|
50 LOCAL_C void Panic(TTMsgPanic aPanic) |
|
51 { |
|
52 User::Panic(_L("TMsg"), aPanic); |
|
53 } |
|
54 |
|
55 // |
|
56 // CTstContainer |
|
57 // |
|
58 //! A CTstContainer test control class. |
|
59 /** |
|
60 The class represents the test container control. |
|
61 */ |
|
62 class CTstContainer : public CCoeControl |
|
63 { |
|
64 public: |
|
65 CTstContainer( CTmsTestStep* aStep ); |
|
66 void ConstructL(const TRect& aRect); |
|
67 ~CTstContainer(); |
|
68 void HandleCommandL(TInt aCommand); |
|
69 /* //framework |
|
70 void CycleThroughEikonEnvInfoMsgs() const; |
|
71 void CycleThroughEikonEnvBusyMsgsL() const;*/ |
|
72 private: |
|
73 // framework |
|
74 virtual TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType); |
|
75 virtual void HandlePointerEventL(const TPointerEvent& aPointerEvent); |
|
76 virtual void Draw(const TRect& aRect) const; |
|
77 void CycleThroughEikonEnvInfoMsgs() const; |
|
78 void CycleThroughEikonEnvBusyMsgsL() const; |
|
79 static TInt SimulateEnterKeyEvent(TAny* aAny); |
|
80 private: |
|
81 enum |
|
82 { |
|
83 EBusyDuration=5*1000000 |
|
84 }; |
|
85 private: |
|
86 CFont* iFont; |
|
87 TBuf<64> iText; |
|
88 TInt iCounter; |
|
89 CPeriodic* iKeyPressTimer; |
|
90 CTmsTestStep* iStep; |
|
91 }; |
|
92 |
|
93 CTstContainer::CTstContainer( CTmsTestStep* aStep ) |
|
94 : iStep( aStep ) |
|
95 /** |
|
96 Constructor |
|
97 */ |
|
98 { |
|
99 __DECLARE_NAME(_S("CTstContainer")); |
|
100 } |
|
101 |
|
102 /** |
|
103 Auxiliary function for all Test Cases |
|
104 |
|
105 This method is the second phase constructor for CTstContainer. |
|
106 It is used to construct information message & busy message window. |
|
107 |
|
108 */ |
|
109 void CTstContainer::ConstructL(const TRect& aRect) |
|
110 { |
|
111 CreateWindowL(); |
|
112 EnableDragEvents(); |
|
113 Window().SetBackgroundColor(TRgb(170, 170, 170)); |
|
114 CWsScreenDevice& screenDevice=*iCoeEnv->ScreenDevice(); |
|
115 TFontSpec fontSpec(_L("Arial"), screenDevice.VerticalPixelsToTwips(20)); |
|
116 User::LeaveIfError(screenDevice.GetNearestFontInTwips(iFont, fontSpec)); |
|
117 iKeyPressTimer=CPeriodic::NewL(EPriorityLow); |
|
118 iText=_L("Type or drag pointer to show event-handling"); |
|
119 SetRect(aRect); |
|
120 ActivateL(); |
|
121 } |
|
122 |
|
123 CTstContainer::~CTstContainer() |
|
124 /** |
|
125 Destructor |
|
126 */ |
|
127 { |
|
128 iCoeEnv->ScreenDevice()->ReleaseFont(iFont); |
|
129 delete iKeyPressTimer; |
|
130 } |
|
131 |
|
132 |
|
133 /** |
|
134 @SYMTestCaseID UIF-TMSG-HandleCommandL |
|
135 |
|
136 @SYMPREQ |
|
137 |
|
138 @SYMTestCaseDesc Tests information message window & busy message window. |
|
139 |
|
140 @SYMTestPriority High |
|
141 |
|
142 @SYMTestStatus Implemented |
|
143 |
|
144 @SYMTestActions The method performs following:\n |
|
145 (1) Test displaying Information Message at\n |
|
146 (i) Bottom right corner of the screen.\n |
|
147 (ii)Top right corner of the screen.\n |
|
148 (2) Test Cancelling an Information Message Window.\n |
|
149 (3) Test Busy Message Window for the following:\n |
|
150 (i) Display a Busy Message Window\n |
|
151 (ii) Display two Busy Message Window at the same corner of the screen.\n |
|
152 (iii)Display two Busy Message Window at the different corners of |
|
153 the screen.\n |
|
154 (iv) Display Busy Message Window by specifying initial delay.\n\n |
|
155 (4) Test Information Message & Busy Message Window provided by CEikonEnv.\n |
|
156 (5) Test Information window with a one or two-line message read from |
|
157 the passed resources. |
|
158 (6) Test Query Dialog window with a one or two-line message read from |
|
159 the passed resources.\n |
|
160 |
|
161 @SYMTestExpectedResults All the Information & Busy Messages should be displayed as expected. |
|
162 |
|
163 */ |
|
164 void CTstContainer::HandleCommandL(TInt aCommand) |
|
165 { |
|
166 TBuf<128> buffer; |
|
167 |
|
168 switch (aCommand) |
|
169 { |
|
170 case ETMsgCmdDisplayInfoMsgAtBottom: |
|
171 buffer.Format(_L("Info-msg, bottom-right, %d"), iCounter); |
|
172 iEikonEnv->InfoMsgWithAlignment(EHRightVBottom, buffer); |
|
173 break; |
|
174 case ETMsgCmdDisplayInfoMsgAtTop: |
|
175 buffer.Format(_L("Info-msg, top-right, %d"), iCounter); |
|
176 iEikonEnv->InfoMsgWithAlignment(EHRightVTop, buffer); |
|
177 break; |
|
178 case ETMsgCmdCancelInfoMsg: |
|
179 iEikonEnv->InfoMsgCancel(); |
|
180 break; |
|
181 case ETMsgCmdDisplaySingleBusyMsg: |
|
182 buffer.Format(_L("Single busy-msg, bottom-left, %d"), iCounter); |
|
183 iEikonEnv->BusyMsgL(buffer, TGulAlignment(EHLeftVBottom)); |
|
184 User::After(EBusyDuration); |
|
185 iEikonEnv->BusyMsgCancel(); |
|
186 break; |
|
187 case ETMsgCmdDisplayTwoBusyMsgsInSameCorner: |
|
188 buffer.Format(_L("First of 2 busy-msgs, bottom-left, %d"), iCounter); |
|
189 iEikonEnv->BusyMsgL(buffer, TGulAlignment(EHLeftVBottom)); |
|
190 User::After(EBusyDuration); |
|
191 buffer.Format(_L("Second of 2 busy-msgs, bottom-left, %d"), iCounter); |
|
192 iEikonEnv->BusyMsgL(buffer, TGulAlignment(EHLeftVBottom)); |
|
193 User::After(EBusyDuration); |
|
194 iEikonEnv->BusyMsgCancel(); |
|
195 break; |
|
196 case ETMsgCmdDisplayTwoBusyMsgsInDifferentCorners: |
|
197 buffer.Format(_L("First of 2 busy-msgs, bottom-left, %d"), iCounter); |
|
198 iEikonEnv->BusyMsgL(buffer, TGulAlignment(EHLeftVBottom)); |
|
199 User::After(EBusyDuration); |
|
200 buffer.Format(_L("Second of 2 busy-msgs, top-left, %d"), iCounter); |
|
201 iEikonEnv->BusyMsgL(buffer, TGulAlignment(EHLeftVTop)); |
|
202 User::After(EBusyDuration); |
|
203 iEikonEnv->BusyMsgCancel(); |
|
204 break; |
|
205 case ETMsgCmdDisplaySingleBusyMsgWithInitialDelayOfTenSeconds: |
|
206 buffer.Format(_L("Single busy-msg (init delay = 10), bottom-left, %d"), iCounter); |
|
207 iEikonEnv->BusyMsgL(buffer, EHLeftVBottom, 10*1000000); |
|
208 User::After(EBusyDuration + 10*1000000); |
|
209 iEikonEnv->BusyMsgCancel(); |
|
210 break; |
|
211 case ETMsgCmdDisplayInfoMsgAtTopWithDurationOfTenSeconds: |
|
212 buffer.Format(_L("Info-msg (duration = 10), top-right, %d"), iCounter); |
|
213 iEikonEnv->InfoMsgWithAlignmentAndDuration(EHRightVTop, buffer, 10*1000000); |
|
214 break; |
|
215 case ETMsgCmdCycleThroughEikonEnvInfoMsgs: |
|
216 CycleThroughEikonEnvInfoMsgs(); |
|
217 break; |
|
218 case ETMsgCmdCycleThroughEikonEnvBusyMsgs: |
|
219 CycleThroughEikonEnvBusyMsgsL(); |
|
220 break; |
|
221 case ETMsgCmdCancelBusyMsg: |
|
222 iEikonEnv->BusyMsgCancel(); |
|
223 break; |
|
224 case ETMsgCmdInfoWin: |
|
225 { |
|
226 TInt keyValue=EKeyEnter; |
|
227 TCallBack callBack(SimulateEnterKeyEvent,&keyValue); |
|
228 // |
|
229 iKeyPressTimer->Start(KStartDelay,KStartDelay,callBack); |
|
230 iEikonEnv->InfoWinL(R_TMSG_TBUF_INFOWINMSG_RESOURCEID); |
|
231 iKeyPressTimer->Cancel(); |
|
232 // |
|
233 iKeyPressTimer->Start(KStartDelay,KStartDelay,callBack); |
|
234 iEikonEnv->InfoWinL(R_TMSG_TBUF_INFOWINMSG_RESOURCEID,R_TMSG_TBUF_INFOWINMSG_RESOURCEID); |
|
235 iKeyPressTimer->Cancel(); |
|
236 } |
|
237 break; |
|
238 case ETMsgCmdQueryWin: |
|
239 { |
|
240 TInt keyValue=EKeyEscape; |
|
241 TCallBack callBack(SimulateEnterKeyEvent,&keyValue); |
|
242 // |
|
243 iKeyPressTimer->Start(KStartDelay,KStartDelay,callBack); |
|
244 iEikonEnv->QueryWinL(R_TMSG_TBUF_QUERYWINMSG_RESOURCEID); |
|
245 iKeyPressTimer->Cancel(); |
|
246 // |
|
247 iKeyPressTimer->Start(KStartDelay,KStartDelay,callBack); |
|
248 iEikonEnv->QueryWinL(R_TMSG_TBUF_QUERYWINMSG_RESOURCEID,R_TMSG_TBUF_QUERYWINMSG_RESOURCEID); |
|
249 iKeyPressTimer->Cancel(); |
|
250 } |
|
251 break; |
|
252 case EEikCmdExit: |
|
253 CBaActiveScheduler::Exit(); |
|
254 break; |
|
255 default: |
|
256 Panic(ETMsgPanicBadCommand); |
|
257 break; |
|
258 } |
|
259 ++iCounter; |
|
260 } |
|
261 |
|
262 /** |
|
263 Auxiliary function for TestCaseID CTstContainer::HandleCommandL() |
|
264 |
|
265 This method prepares a key press event and sends a simulated raw key |
|
266 event to the window server. The method is used by HandleCommandL() |
|
267 to simulate ENTER key event. |
|
268 |
|
269 */ |
|
270 TInt CTstContainer::SimulateEnterKeyEvent(TAny* aAny) |
|
271 { |
|
272 TWsEvent theEvent; |
|
273 TKeyEvent *theKey = theEvent.Key(); |
|
274 theKey->iScanCode = *(TInt*)aAny; |
|
275 theKey->iModifiers= 0; |
|
276 theKey->iRepeats=0; |
|
277 theKey->iCode = EKeyEscape; |
|
278 |
|
279 RWsSession ws; |
|
280 TInt theRes = ws.Connect(); |
|
281 |
|
282 if(theRes == KErrNone) |
|
283 { |
|
284 CCoeEnv* env = CCoeEnv::Static(); |
|
285 RWindowGroup& winGroup = env->RootWin(); |
|
286 theEvent.SetTimeNow(); |
|
287 TInt theId = winGroup.Identifier(); |
|
288 |
|
289 theEvent.SetType(EEventKeyDown); |
|
290 theEvent.SetTimeNow(); |
|
291 ws.SendEventToWindowGroup(theId, theEvent); |
|
292 |
|
293 theEvent.SetType(EEventKey); |
|
294 theEvent.SetTimeNow(); |
|
295 ws.SendEventToWindowGroup(theId, theEvent); |
|
296 |
|
297 theEvent.SetType(EEventKeyUp); |
|
298 theEvent.SetTimeNow(); |
|
299 ws.SendEventToWindowGroup(theId, theEvent); |
|
300 |
|
301 ws.Close(); |
|
302 } |
|
303 return KErrNone; |
|
304 } |
|
305 |
|
306 /** |
|
307 @SYMTestCaseID UIF-TMSG-CycleThroughEikonEnvInfoMsgs |
|
308 |
|
309 @SYMPREQ |
|
310 |
|
311 @SYMTestCaseDesc Tests information message window provided by CEikonEnv. |
|
312 |
|
313 @SYMTestPriority High |
|
314 |
|
315 @SYMTestStatus Implemented |
|
316 |
|
317 @SYMTestActions The method tests displaying Information Messages provided |
|
318 by CEikonEnv.The API's tested are as listed.\n |
|
319 void CEikonEnv::InfoMsg(const TDesC& aDes)\n |
|
320 void CEikonEnv::InfoMsg(TInt aResourceId,...)\n |
|
321 void CEikonEnv::InfoMsg(TInt aResourceId,VA_LIST aList)\n |
|
322 void CEikonEnv::InfoMsgWithAlignment(TGulAlignment aCorner,const TDesC& aDes)\n |
|
323 void CEikonEnv::InfoMsgWithAlignment(TGulAlignment aCorner,TInt aResourceId,...)\n |
|
324 void CEikonEnv::InfoMsgWithAlignment(TGulAlignment aCorner,TInt aResourceId,VA_LIST aList)\n |
|
325 void CEikonEnv::InfoMsgWithDuration(const TDesC& aDes, TTimeIntervalMicroSeconds32 aDuration)\n |
|
326 void CEikonEnv::InfoMsgWithDuration(TInt aResourceId, TTimeIntervalMicroSeconds32 aDuration,...)\n |
|
327 void CEikonEnv::InfoMsgWithDuration(TInt aResourceId, TTimeIntervalMicroSeconds32 aDuration, VA_LIST aList)\n |
|
328 void CEikonEnv::InfoMsgWithAlignmentAndDuration(TGulAlignment aCorner,const TDesC& aDes, TTimeIntervalMicroSeconds32 aDuration)\n |
|
329 void CEikonEnv::InfoMsgWithAlignmentAndDuration(TGulAlignment aCorner,TInt aResourceId, TTimeIntervalMicroSeconds32 aDuration,...)\n |
|
330 void CEikonEnv::InfoMsgWithAlignmentAndDuration(TGulAlignment aCorner,TInt aResourceId, TTimeIntervalMicroSeconds32 aDuration,VA_LIST aList)\n |
|
331 |
|
332 @SYMTestExpectedResults All the Information Message Window should be displayed as expected. |
|
333 |
|
334 */ |
|
335 void CTstContainer::CycleThroughEikonEnvInfoMsgs() const |
|
336 { |
|
337 iEikonEnv->InfoMsgWithAlignment(EHLeftVBottom,_L("(aAlignment,aText) botLeft")); |
|
338 User::After(45*100000); // info message defaults to 2.5 seconds, so allow another second |
|
339 iEikonEnv->InfoMsg(_L("(aText)")); |
|
340 User::After(45*100000); |
|
341 iEikonEnv->InfoMsg(R_TMSG_TBUF_RESOURCEID); |
|
342 User::After(45*100000); |
|
343 iEikonEnv->InfoMsg(R_TMSG_TBUF_RESOURCEID_VLIST,12,23); |
|
344 User::After(45*100000); |
|
345 iEikonEnv->InfoMsgWithAlignment(EHLeftVBottom,R_TMSG_TBUF_CORNER_RESOURCEID); |
|
346 User::After(45*100000); |
|
347 iEikonEnv->InfoMsgWithAlignment(EHLeftVBottom,R_TMSG_TBUF_CORNER_RESOURCEID_VLIST,34,45); |
|
348 User::After(45*100000); |
|
349 iEikonEnv->InfoMsgWithDuration(_L("(aText,aDuration) d = 8"),8*1000000); |
|
350 User::After(100*100000); |
|
351 iEikonEnv->InfoMsgWithDuration(R_TMSG_TBUF_RESOURCEID_DURATION,8*1000000); |
|
352 User::After(100*100000); |
|
353 iEikonEnv->InfoMsgWithDuration(R_TMSG_TBUF_RESOURCEID_DURATION_VLIST,8*1000000,56,67); |
|
354 User::After(100*100000); |
|
355 iEikonEnv->InfoMsgWithAlignmentAndDuration(EHLeftVBottom,_L("(aAlignment,aText,aDuration) botLeft,d = 8"), 8*1000000); |
|
356 User::After(100*100000); |
|
357 iEikonEnv->InfoMsgWithAlignmentAndDuration(EHLeftVBottom,R_TMSG_TBUF_CORNER_RESOURCEID_DURATION, 8*1000000); |
|
358 User::After(100*100000); |
|
359 iEikonEnv->InfoMsgWithAlignmentAndDuration(EHLeftVBottom,R_TMSG_TBUF_CORNER_RESOURCEID_DURATION_VLIST, 8*1000000,78,89); |
|
360 User::After(100*100000); |
|
361 } |
|
362 |
|
363 |
|
364 /** |
|
365 @SYMTestCaseID UIF-TMSG-CycleThroughEikonEnvBusyMsgsL |
|
366 |
|
367 @SYMPREQ |
|
368 |
|
369 @SYMTestCaseDesc Tests Busy Message Window provided by CEikonEnv. |
|
370 |
|
371 @SYMTestPriority High |
|
372 |
|
373 @SYMTestStatus Implemented |
|
374 |
|
375 @SYMTestActions The method tests displaying Busy Messages provided |
|
376 by CEikonEnv.The API's tested are as listed.\n |
|
377 void CEikonEnv::BusyMsgL(const TDesC& aDes)\n |
|
378 void CEikonEnv::BusyMsgL(const TDesC& aDes,TGulAlignment aCorner)\n |
|
379 void CEikonEnv::BusyMsgL(TInt aResourceId)\n |
|
380 void CEikonEnv::BusyMsgL(const TDesC& aDes,TTimeIntervalMicroSeconds32 aInitialDelay)\n |
|
381 void CEikonEnv::BusyMsgL(const TDesC& aDes,TGulAlignment aCorner,TTimeIntervalMicroSeconds32 aInitialDelay)\n |
|
382 void CEikonEnv::BusyMsgL(TInt aResourceId,TTimeIntervalMicroSeconds32 aInitialDelay)\n |
|
383 void CEikonEnv::BusyMsgCancel()\n |
|
384 |
|
385 @SYMTestExpectedResults All the Busy Message Window should be displayed as expected. |
|
386 |
|
387 */ |
|
388 void CTstContainer::CycleThroughEikonEnvBusyMsgsL() const |
|
389 { |
|
390 iEikonEnv->BusyMsgL(_L("(aText)")); |
|
391 User::After(70*100000); |
|
392 iEikonEnv->BusyMsgCancel(); |
|
393 iEikonEnv->BusyMsgL(_L("(aAlignment,aText) botLeft"),TGulAlignment(EHLeftVBottom)); |
|
394 User::After(70*100000); |
|
395 iEikonEnv->BusyMsgCancel(); |
|
396 iEikonEnv->BusyMsgL(R_TMSG_TBUF_BUSYMSG_RESOURCEID); |
|
397 User::After(70*100000); |
|
398 iEikonEnv->BusyMsgCancel(); |
|
399 iEikonEnv->BusyMsgL(_L("(aText,aInitialDelay) d = 3"),3*1000000); |
|
400 User::After(100*100000); |
|
401 iEikonEnv->BusyMsgCancel(); |
|
402 iEikonEnv->BusyMsgL(_L("(aText,aAlignment,aInitialDelay) botLeft,d = 3"),EHLeftVBottom,3*1000000); |
|
403 User::After(100*100000); |
|
404 iEikonEnv->BusyMsgCancel(); |
|
405 iEikonEnv->BusyMsgL(R_TMSG_TBUF_BUSYMSG_RESOURCEID_INITIALDELAY,3*1000000); |
|
406 User::After(100*100000); |
|
407 iEikonEnv->BusyMsgCancel(); |
|
408 } |
|
409 |
|
410 |
|
411 /** |
|
412 Auxiliary function for all Test Cases. |
|
413 |
|
414 This method is an override from CCoeControl.When a key event occurs, the |
|
415 control framework calls this function for each control on the control stack, |
|
416 until one of them can process the key event (and returns EKeyWasConsumed). |
|
417 |
|
418 */ |
|
419 TKeyResponse CTstContainer::OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType) |
|
420 { |
|
421 iText.Format(_L("Key event: type %d, code %d"), aType, aKeyEvent.iCode); |
|
422 DrawNow(); |
|
423 return EKeyWasConsumed; |
|
424 } |
|
425 |
|
426 |
|
427 /** |
|
428 Auxiliary function for all Test Cases. |
|
429 |
|
430 This method is an override from CCoeControl.This function gets called |
|
431 whenever a pointer event occurs in the Container control. |
|
432 |
|
433 */ |
|
434 void CTstContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) |
|
435 { |
|
436 iText.Format(_L("Pointer event: type %d, position (%d, %d)"), aPointerEvent.iType, aPointerEvent.iPosition.iX, aPointerEvent.iPosition.iY); |
|
437 DrawNow(); |
|
438 } |
|
439 |
|
440 |
|
441 /** |
|
442 Auxiliary function for all Test Cases. |
|
443 |
|
444 This method is an override from CCoeControl. It draws the container control. |
|
445 |
|
446 */ |
|
447 void CTstContainer::Draw(const TRect&) const |
|
448 { |
|
449 CWindowGc& gc=SystemGc(); |
|
450 TRect rect=Rect(); |
|
451 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
452 gc.SetBrushColor(KRgbYellow); |
|
453 gc.DrawRect(rect); |
|
454 gc.SetBrushStyle(CGraphicsContext::ENullBrush); |
|
455 gc.UseFont(iFont); |
|
456 gc.DrawText(iText, rect, iSize.iHeight/2, CGraphicsContext::ECenter); |
|
457 } |
|
458 |
|
459 // |
|
460 // CTstAppUi |
|
461 // |
|
462 |
|
463 //! A CTstAppUi test class. |
|
464 /** |
|
465 The class handles work with resources. |
|
466 */ |
|
467 class CTstAppUi : public CTestAppUi |
|
468 { |
|
469 public: |
|
470 CTstAppUi(CTmsTestStep *aStep) : |
|
471 CTestAppUi(aStep, |
|
472 resourceFileName)//, R_TMSG_HOTKEYS, 0, R_TMSG_TOOLBAR) |
|
473 /** |
|
474 Constructor |
|
475 */ |
|
476 {} |
|
477 |
|
478 void ConstructL(); |
|
479 virtual ~CTstAppUi(); |
|
480 //private: // framework |
|
481 void RunTestStepL(TInt aNumStep); |
|
482 virtual void HandleCommandL(TInt aCommand); |
|
483 private: |
|
484 |
|
485 CTstContainer* iContainer; |
|
486 |
|
487 TInt iMsgState; |
|
488 }; |
|
489 |
|
490 |
|
491 /** |
|
492 Auxiliary function for all Test Cases |
|
493 |
|
494 The method creates a container and sets active object with lowest |
|
495 priority for running test in auto mode. |
|
496 |
|
497 */ |
|
498 void CTstAppUi::ConstructL() |
|
499 { |
|
500 //BaseConstructL(); |
|
501 CTestAppUi::ConstructL(); |
|
502 |
|
503 TRect boundingRect=ClientRect(); // |
|
504 |
|
505 ReduceRect(boundingRect); |
|
506 iContainer=new(ELeave) CTstContainer( iStep ); |
|
507 iContainer->ConstructL(boundingRect); |
|
508 AddToStackL(iContainer); |
|
509 |
|
510 AutoTestManager().StartAutoTest(); |
|
511 |
|
512 } |
|
513 |
|
514 |
|
515 CTstAppUi::~CTstAppUi() |
|
516 /** |
|
517 Destructor |
|
518 */ |
|
519 { |
|
520 RemoveFromStack(iContainer); |
|
521 delete iContainer; |
|
522 } |
|
523 |
|
524 |
|
525 /** |
|
526 Auxiliary function for all Test Cases |
|
527 |
|
528 This method is called by CTstAppUi::RunTestStepL() to initiate the tests. |
|
529 |
|
530 */ |
|
531 void CTstAppUi::HandleCommandL(TInt aCommand) |
|
532 { |
|
533 iContainer->HandleCommandL(aCommand); |
|
534 } |
|
535 |
|
536 |
|
537 /** |
|
538 Auxiliary function for all Test Cases |
|
539 |
|
540 The method is an override from CTestAppUi. The method initiates all tests |
|
541 to be performed by calling CTstAppUi::HandleCommandL(). |
|
542 |
|
543 */ |
|
544 void CTstAppUi::RunTestStepL(TInt aNumStep) |
|
545 { |
|
546 TInt theMessageState = EEikCmdExit; |
|
547 switch(aNumStep) |
|
548 { |
|
549 case 1: |
|
550 INFO_PRINTF1(_L("Display info message at bottom")); |
|
551 theMessageState = ETMsgCmdDisplayInfoMsgAtBottom; |
|
552 break; |
|
553 case 2: |
|
554 INFO_PRINTF1(_L("Display info message at top")); |
|
555 theMessageState = ETMsgCmdDisplayInfoMsgAtTop; |
|
556 break; |
|
557 case 3: |
|
558 INFO_PRINTF1(_L("Cancel info message")); |
|
559 theMessageState = ETMsgCmdCancelInfoMsg; |
|
560 break; |
|
561 case 4: |
|
562 INFO_PRINTF1(_L("Display single busy message")); |
|
563 theMessageState = ETMsgCmdDisplaySingleBusyMsg; |
|
564 break; |
|
565 case 5: |
|
566 INFO_PRINTF1(_L("Display two busy messages in the same corner")); |
|
567 theMessageState = ETMsgCmdDisplayTwoBusyMsgsInSameCorner; |
|
568 break; |
|
569 case 6: |
|
570 INFO_PRINTF1(_L("Display two busy messages in different corners")); |
|
571 theMessageState = ETMsgCmdDisplayTwoBusyMsgsInDifferentCorners; |
|
572 break; |
|
573 case 7: |
|
574 INFO_PRINTF1(_L("Display single message with initial delay of ten seconds")); |
|
575 theMessageState = ETMsgCmdDisplaySingleBusyMsgWithInitialDelayOfTenSeconds; |
|
576 break; |
|
577 case 8: |
|
578 INFO_PRINTF1(_L("Display message at top with duration of ten seconds")); |
|
579 theMessageState = ETMsgCmdDisplayInfoMsgAtTopWithDurationOfTenSeconds; |
|
580 break; |
|
581 case 9: |
|
582 INFO_PRINTF1(_L("Cycle through EikonEnv info messages")); |
|
583 iStep->SetTestStepID(_L("UIF-TMSG-CycleThroughEikonEnvInfoMsgs")); |
|
584 theMessageState = ETMsgCmdCycleThroughEikonEnvInfoMsgs; |
|
585 iStep->RecordTestResultL(); |
|
586 break; |
|
587 case 10: |
|
588 INFO_PRINTF1(_L("Cycle through EikonEnv busy messages")); |
|
589 iStep->SetTestStepID(_L("UIF-TMSG-CycleThroughEikonEnvBusyMsgsL")); |
|
590 theMessageState = ETMsgCmdCycleThroughEikonEnvBusyMsgs; |
|
591 iStep->RecordTestResultL(); |
|
592 iStep->CloseTMSGraphicsStep(); |
|
593 break; |
|
594 case 11: |
|
595 INFO_PRINTF1(_L("Cancel busy message")); |
|
596 theMessageState = ETMsgCmdCancelBusyMsg; |
|
597 break; |
|
598 case 12: |
|
599 INFO_PRINTF1(_L("InfoWin messages")); |
|
600 theMessageState = ETMsgCmdInfoWin; |
|
601 INFO_PRINTF1(_L("InfoWin messages completed!")); |
|
602 break; |
|
603 case 13: |
|
604 INFO_PRINTF1(_L("QueryWin messages")); |
|
605 theMessageState = ETMsgCmdQueryWin; |
|
606 INFO_PRINTF1(_L("QueryWin messages completed!")); |
|
607 break; |
|
608 case 14: |
|
609 AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass); |
|
610 return; |
|
611 } |
|
612 |
|
613 |
|
614 HandleCommandL(theMessageState); |
|
615 } |
|
616 |
|
617 //---------- |
|
618 CTestMsgStep::CTestMsgStep() |
|
619 /** |
|
620 Constructor |
|
621 */ |
|
622 { |
|
623 SetTestStepName(KTestMsgStep); |
|
624 } |
|
625 |
|
626 CTestMsgStep::~CTestMsgStep() |
|
627 /** |
|
628 Destructor |
|
629 */ |
|
630 { |
|
631 } |
|
632 |
|
633 /** |
|
634 Auxiliary function for all Test Cases |
|
635 |
|
636 The method creates & sets the application's user interface object. |
|
637 |
|
638 */ |
|
639 void CTestMsgStep::ConstructAppL(CEikonEnv* aCoe) |
|
640 { // runs inside a TRAP harness |
|
641 aCoe->ConstructL(); |
|
642 CTstAppUi* appUi=new(ELeave) CTstAppUi(this); |
|
643 aCoe->SetAppUi(appUi); |
|
644 appUi->ConstructL(); |
|
645 } |
|
646 |
|
647 /** |
|
648 Auxiliary function for all Test Cases |
|
649 |
|
650 The method creates & sets the application's user interface object to |
|
651 launch the application which will initiate the tests. |
|
652 |
|
653 */ |
|
654 TVerdict CTestMsgStep::doTestStepL() // main function called by E32 |
|
655 { |
|
656 PreallocateHALBuffer(); |
|
657 __UHEAP_MARK; |
|
658 |
|
659 CEikonEnv* coe=new CEikonEnv; |
|
660 TRAPD(err,ConstructAppL(coe)); |
|
661 |
|
662 if (!err) |
|
663 coe->ExecuteD(); |
|
664 |
|
665 REComSession::FinalClose(); |
|
666 __UHEAP_MARKEND; |
|
667 |
|
668 return TestStepResult(); |
|
669 } |
|
670 |