lafagnosticuifoundation/cone/tef/TMENU0STEP.CPP
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     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 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @internalComponent - Internal Symbian test code  
       
    19 */
       
    20 
       
    21 
       
    22 #include <coeaui.h>
       
    23 #include <coemain.h>
       
    24 #include <coecntrl.h>
       
    25 #include <e32keys.h>
       
    26 #include <basched.h>
       
    27 #include "TMenu0Step.h"
       
    28 
       
    29 
       
    30 
       
    31 //
       
    32 // class CTestMenu
       
    33 //
       
    34 
       
    35 /** The method is an override from CCoeControl.\n
       
    36 	The function is called to handle key events.\n
       
    37 	The only thing that is handled is if the control key\n
       
    38 	was pressed together with another key.\n
       
    39 */
       
    40 TKeyResponse CTestMenu::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
    41     {
       
    42 	if (aType==EEventKey)
       
    43 		{
       
    44 	    TInt modifiers=aKeyEvent.iModifiers;
       
    45 	    TInt code=aKeyEvent.iCode;
       
    46 	    if ((modifiers&EAllStdModifiers)==EModifierCtrl)
       
    47 	        {
       
    48 	        iObserver->MenuSelectionMadeL(code);
       
    49 	        return(EKeyWasConsumed);
       
    50 	        }
       
    51 		}
       
    52     return(EKeyWasNotConsumed);
       
    53     }
       
    54     
       
    55 //
       
    56 // class CMessageControl
       
    57 //
       
    58 
       
    59 /**
       
    60   Second phase constructor for CMessageControl.\n
       
    61   Creates a control's window.\n
       
    62   The created window is the child of the application's window group.\n
       
    63   Sets a Font and display a message.\n
       
    64  */
       
    65 void CMessageControl::ConstructL()
       
    66     {
       
    67     CreateWindowL();
       
    68     SetExtent(TPoint(20,20),TSize(600,200));
       
    69     TFontSpec spec(_L("Arial"),220);
       
    70     SetFontL(spec);
       
    71     ActivateL();
       
    72     }
       
    73 
       
    74 /**
       
    75   Destructor for the CMessageControl class.\n
       
    76   Calls the ReleaseScreenFont API of CCoeEnv to free all resources used by the font.\n
       
    77   
       
    78  */
       
    79 CMessageControl::~CMessageControl()
       
    80     {
       
    81     iCoeEnv->ReleaseScreenFont(iFont);
       
    82     }
       
    83 
       
    84 /**
       
    85   Auxiliary Function to a set a new font.\n
       
    86  */
       
    87 void CMessageControl::SetFontL(const TFontSpec& aFontSpec)
       
    88     {
       
    89     CFbsFont* font=iCoeEnv->CreateScreenFontL(aFontSpec);
       
    90     iCoeEnv->ReleaseScreenFont(iFont); // after previous line succeeds
       
    91     iFont=font;
       
    92     iFontSpec=aFontSpec;
       
    93     }
       
    94 
       
    95 /**
       
    96   Auxiliary Function to change the font style.\n
       
    97  */
       
    98 void CMessageControl::ToggleFontStyleL(TMessageControlFontStyle aStyleElement)
       
    99     {
       
   100     TFontSpec spec=iFontSpec;
       
   101     TBool doSet=EFalse;
       
   102     switch (aStyleElement)
       
   103         {
       
   104     case EStyleElementBold:
       
   105         spec.iFontStyle.SetStrokeWeight(spec.iFontStyle.StrokeWeight()? EStrokeWeightNormal: EStrokeWeightBold);
       
   106         doSet=ETrue;
       
   107         break;
       
   108     case EStyleElementItalic:
       
   109         spec.iFontStyle.SetPosture(spec.iFontStyle.Posture()? EPostureUpright: EPostureItalic);
       
   110         doSet=ETrue;
       
   111         break;
       
   112     case EStyleElementUnderline:
       
   113         iFontUnderline=(iFontUnderline? EUnderlineOff: EUnderlineOn);
       
   114         break;
       
   115     case EStyleElementStrikethrough:
       
   116         iFontStrikethrough=(iFontStrikethrough? EStrikethroughOff: EStrikethroughOn);
       
   117         }
       
   118     if (doSet)
       
   119         SetFontL(spec); // otherwise change effective at Draw time
       
   120     }
       
   121 
       
   122 /**
       
   123   Auxiliary Function to handle Pointer events.\n
       
   124   Just logs that a pointer events has happend and redraws the window.\n
       
   125  */
       
   126 void CMessageControl::HandlePointerEventL(const TPointerEvent& aPointerEvent)
       
   127     {
       
   128     iMessage.Format(_L("Pointer event %d at (%d,%d)"),aPointerEvent.iType,aPointerEvent.iPosition.iX,aPointerEvent.iPosition.iY);
       
   129     DrawMessageNow();
       
   130     }
       
   131 
       
   132 /**
       
   133   Responds to focus change.\n
       
   134   This function is called whenever a control gains or loses focus\n
       
   135   as a result of a call to SetFocus().\n
       
   136  */
       
   137 void CMessageControl::FocusChanged(TDrawNow aDrawNow)
       
   138 	{
       
   139     if (aDrawNow)
       
   140         {
       
   141         ActivateGc();
       
   142         DrawBorder();
       
   143         DeactivateGc();
       
   144         }
       
   145     }
       
   146 
       
   147 /**
       
   148   Draws a border around the window CMessageControl owns.\n
       
   149  */
       
   150 void CMessageControl::DrawBorder() const
       
   151 	{
       
   152     CWindowGc& gc=SystemGc();
       
   153     TRect rect=Rect();
       
   154     gc.DrawRect(rect);
       
   155     if (!IsFocused())
       
   156         gc.SetPenColor(KRgbWhite);
       
   157     rect.Shrink(1,1);
       
   158     gc.DrawRect(rect);
       
   159     rect.Shrink(1,1);
       
   160     gc.DrawRect(rect);
       
   161 	}
       
   162 
       
   163 /**
       
   164   Draws border and display a message in the window CMessageControl owns.\n
       
   165  */
       
   166 void CMessageControl::Draw(const TRect& /*aRect*/) const
       
   167     {
       
   168     DrawBorder();
       
   169     DrawMessage();
       
   170     }
       
   171 
       
   172 /**
       
   173   Displays a message stored in iMessage centered both vertically and horisontally.\n
       
   174  */
       
   175 void CMessageControl::DrawMessage() const
       
   176     {
       
   177     TRect rect=Rect();
       
   178     rect.Shrink(3,3);
       
   179     TInt ascent=(rect.iBr.iY-rect.iTl.iY-iFont->HeightInPixels())/2 + iFont->AscentInPixels();
       
   180     CWindowGc& gc=SystemGc();
       
   181     gc.SetPenColor(KRgbBlack);
       
   182 	gc.UseFont(iFont);
       
   183     if (iFontUnderline)
       
   184         gc.SetUnderlineStyle(iFontUnderline);
       
   185     if (iFontStrikethrough)
       
   186         gc.SetStrikethroughStyle(iFontStrikethrough);
       
   187     gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   188     gc.DrawText(iMessage,rect,ascent,CGraphicsContext::ECenter);
       
   189     }
       
   190 
       
   191 /**
       
   192   Displays a message stored in iMessage, centered both vertically and horisontally.\n
       
   193   Draw the message as soon as possible.\n
       
   194  */
       
   195 void CMessageControl::DrawMessageNow() const
       
   196     {
       
   197 	ActivateGc();
       
   198 	DrawMessage();
       
   199 	DeactivateGc();
       
   200     }
       
   201 
       
   202 /**
       
   203   Changed the message displayed in the window.\n
       
   204  */
       
   205 void CMessageControl::SetMessage(const TDesC& aMessage)
       
   206     {
       
   207     iMessage=aMessage;
       
   208     DrawMessageNow();
       
   209     }
       
   210 
       
   211 /**
       
   212   The method is an override from CCoeControl.\n
       
   213   The function is called to handle the key events. It handles the following key events.\n
       
   214   1. Shift + KeyLeft Arrow Key Event.\n
       
   215   2. Shift + KeyRight Arrow Key Event.\n
       
   216   3. Shift + KeyDown Arrow Key Event.\n
       
   217   4. Shift + KeyUp Arrow Key Event.\n 
       
   218  */
       
   219 TKeyResponse CMessageControl::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
       
   220     {
       
   221     if (aType!=EEventKey)
       
   222 	    return(EKeyWasConsumed);
       
   223 	TInt modifiers=aKeyEvent.iModifiers;
       
   224 	TInt code=aKeyEvent.iCode;
       
   225 	iMessage.Format(_L("Key 0x%x, modifier 0x%x"),code,modifiers);
       
   226 	DrawMessageNow();
       
   227 	if ((modifiers&EAllStdModifiers)==(EModifierShift))
       
   228        {
       
   229         TPoint pos=Position();
       
   230         switch (code)
       
   231             {
       
   232 			case EKeyLeftArrow:
       
   233 				pos.iX--;
       
   234 				break;
       
   235 			case EKeyRightArrow:
       
   236 				pos.iX++;
       
   237 				break;
       
   238 			case EKeyUpArrow:
       
   239 				pos.iY--;
       
   240 				break;
       
   241 			case EKeyDownArrow:
       
   242 				pos.iY++;
       
   243 				break;
       
   244 			default:
       
   245 				break;
       
   246             }
       
   247 		if (pos != Position())
       
   248 			{
       
   249 			SetPosition(pos);
       
   250 			}
       
   251         }
       
   252     return(EKeyWasConsumed);
       
   253     }
       
   254 
       
   255 //
       
   256 // class CTestMenu0AppUi
       
   257 //
       
   258 
       
   259 /**
       
   260   Constructor of CTestMenu0AppUi.\n
       
   261   Initializes the base constructor CTestCoeAppUi.\n
       
   262  */
       
   263 CTestMenu0AppUi::CTestMenu0AppUi(CTmsTestStep* aStep) :
       
   264 	CTestCoeAppUi(aStep)
       
   265 	{}
       
   266 
       
   267 
       
   268 /**
       
   269   Destructor of CTestMenu0AppUi.\n
       
   270   Removes the two controls from Cone's control stack and deletes them.\n
       
   271  */
       
   272 CTestMenu0AppUi::~CTestMenu0AppUi()
       
   273     {
       
   274 	RemoveFromStack(iMessageControl);
       
   275     delete(iMessageControl);
       
   276 	RemoveFromStack(iMenu);
       
   277     delete(iMenu);
       
   278     }
       
   279 
       
   280 /**
       
   281   @SYMTestCaseID UIF-TMenu0Step-ToggleBoldL
       
   282  
       
   283   @SYMPREQ PREQ0000
       
   284  
       
   285   @SYMTestPriority High
       
   286  
       
   287   @SYMTestStatus Implemented
       
   288   
       
   289   @SYMTestActions Tests that it is possible to toggle text to bold.
       
   290   
       
   291   SYMTestExpectedResult The font toggles to bold.
       
   292  
       
   293   @SYMTestType CIT 
       
   294  
       
   295  */
       
   296 void CTestMenu0AppUi::ToggleBoldL()
       
   297     {
       
   298     iMessageControl->ToggleFontStyleL(EStyleElementBold);
       
   299     }
       
   300     
       
   301 /**
       
   302   @SYMTestCaseID UIF-TMenu0Step-ToggleItalicL
       
   303  
       
   304   @SYMPREQ PREQ0000
       
   305  
       
   306   @SYMTestPriority High
       
   307  
       
   308   @SYMTestStatus Implemented
       
   309   
       
   310   @SYMTestActions Tests that it is possible to toggle text to Italic.
       
   311   
       
   312   @SYMTestExpectedResults The font toggles to Italic.
       
   313  
       
   314   @SYMTestType CIT 
       
   315  
       
   316  */
       
   317 void CTestMenu0AppUi::ToggleItalicL()
       
   318     {
       
   319     iMessageControl->ToggleFontStyleL(EStyleElementItalic);
       
   320     }
       
   321     
       
   322 /**
       
   323   @SYMTestCaseID UIF-TMenu0Step-ToggleUnderlineL
       
   324  
       
   325   @SYMPREQ PREQ0000
       
   326  
       
   327   @SYMTestPriority High
       
   328  
       
   329   @SYMTestStatus Implemented
       
   330   
       
   331   @SYMTestActions Test that it is possible to make text underlined.
       
   332   
       
   333   @SYMTestExpectedResults The font is underlined.
       
   334  
       
   335   @SYMTestType CIT 
       
   336  
       
   337  */
       
   338 void CTestMenu0AppUi::ToggleUnderlineL()
       
   339     {
       
   340     iMessageControl->ToggleFontStyleL(EStyleElementUnderline);
       
   341     }
       
   342     
       
   343 /**
       
   344   @SYMTestCaseID UIF-TMenu0Step-ToggleStrikethroughL
       
   345  
       
   346   @SYMPREQ PREQ0000
       
   347  
       
   348   @SYMTestPriority High
       
   349  
       
   350   @SYMTestStatus Implemented
       
   351   
       
   352   @SYMTestActions Test that it is possible to make text striked through.
       
   353   
       
   354   @SYMTestExpectedResults The font becomes striked through.
       
   355  
       
   356   @SYMTestType CIT 
       
   357  
       
   358  */
       
   359 void CTestMenu0AppUi::ToggleStrikethroughL()
       
   360     {
       
   361     iMessageControl->ToggleFontStyleL(EStyleElementStrikethrough);
       
   362     }
       
   363     
       
   364 /**
       
   365   Sends a text message to all windows in the window group TMenu1GroupName.\n
       
   366   Leaves if it failes.\n
       
   367  */
       
   368 void CTestMenu0AppUi::SendMessageL(const TDesC8& aTextMsg)
       
   369 	{
       
   370 	RWsSession& wsSession=iCoeEnv->WsSession();
       
   371 	TInt wgId=wsSession.FindWindowGroupIdentifier(0,TMenu1GroupName,0);
       
   372 	if (wgId>0)
       
   373 		User::LeaveIfError(wsSession.SendMessageToWindowGroup(wgId,KNullUid,aTextMsg));
       
   374 	else
       
   375 		iMessageControl->SetMessage(_L("TMenu1 is not running"));
       
   376 	}
       
   377 
       
   378 /**
       
   379   Handles application specific events.\n
       
   380   In this case whether it was possible or not to add/remove a window.\n
       
   381   A message about the number of windows in the group is also handled.\n
       
   382  
       
   383  */
       
   384 void CTestMenu0AppUi::HandleApplicationSpecificEventL(TInt aType,const TWsEvent& aEvent)
       
   385 	{
       
   386 	switch (aType)
       
   387 		{
       
   388 		case EReplyWindowAdded:
       
   389 			iMessageControl->SetMessage(_L("Window added"));
       
   390 			return;
       
   391 		case EReplyFailedToAddWindow:
       
   392 			iMessageControl->SetMessage(_L("Failed to add window"));
       
   393 			return;
       
   394 		case EReplyWindowRemoved:
       
   395 			iMessageControl->SetMessage(_L("Window removed"));
       
   396 			return;
       
   397 		case EReplyNoWindowToRemove:
       
   398 			iMessageControl->SetMessage(_L("No window to remove"));
       
   399 			return;
       
   400 		case EReplyWindowsCounted:
       
   401     		TBuf<40> message;
       
   402     		message.Format(_L("Number of windows: %d"),*(TInt*)aEvent.EventData());
       
   403     		iMessageControl->SetMessage(message);
       
   404 			break;
       
   405 		}
       
   406 	}
       
   407 
       
   408 /**
       
   409   Sends an event to all windows in window group TMenu1GroupName\n
       
   410  
       
   411  */
       
   412 void CTestMenu0AppUi::SendAsiMessageL(TMenuAsiEventSend aEvent)
       
   413 	{
       
   414 	RWsSession& wsSession=iCoeEnv->WsSession();
       
   415 	TInt wgId=wsSession.FindWindowGroupIdentifier(0,TMenu1GroupName);
       
   416 	if (wgId<=0)
       
   417 		{
       
   418 		iMessageControl->SetMessage(_L("TMenu1 is not running"));
       
   419 		return;
       
   420 		}
       
   421 	TWsEvent wsEvent;
       
   422 	wsEvent.SetType(aEvent);
       
   423 	*(TInt*)wsEvent.EventData()=iCoeEnv->RootWin().Identifier();
       
   424 	User::LeaveIfError(wsSession.SendEventToWindowGroup(wgId,wsEvent));
       
   425 	}
       
   426 
       
   427 /**
       
   428   Simulates different menu selections.\n
       
   429  
       
   430  */
       
   431 void CTestMenu0AppUi::MenuSelectionMadeL(TInt aSelection)
       
   432     {
       
   433     switch (aSelection)
       
   434         {
       
   435 		case CTRL('a'):
       
   436 			{
       
   437 			INFO_PRINTF1(_L("Test 1: SendAsiMessageL(ESendAddWindow)"));
       
   438 			TRAPD(ret, SendAsiMessageL(ESendAddWindow));
       
   439 			TEST(ret == KErrNone);
       
   440 			return;
       
   441 			}
       
   442 		case CTRL('b'):
       
   443 			{
       
   444 			INFO_PRINTF1(_L("Test 2: ToggleBoldL"));
       
   445 			TRAPD(ret, ToggleBoldL());
       
   446 			TEST(ret == KErrNone);
       
   447 			break;
       
   448 	        }
       
   449 		case CTRL('c'):
       
   450 			{
       
   451 			INFO_PRINTF1(_L("Test 3: SendAsiMessageL(ESendCountWindows)"));
       
   452 			TRAPD(ret, SendAsiMessageL(ESendCountWindows));
       
   453 			TEST(ret == KErrNone);
       
   454 			return;
       
   455 	        }
       
   456 		case CTRL('i'):
       
   457 			{
       
   458 			INFO_PRINTF1(_L("Test 4: ToggleItalicL()"));
       
   459 			TRAPD(ret, ToggleItalicL());
       
   460 			TEST(ret == KErrNone);
       
   461 			break;
       
   462 	        }
       
   463 		case CTRL('m'):
       
   464 			{
       
   465 			INFO_PRINTF1(_L("Test 5: SendMessageL(_L8('Greetings from TMenu0'))"));
       
   466 			TRAPD(ret, SendMessageL(_L8("Greetings from TMenu0")));
       
   467 			TEST(ret == KErrNone);
       
   468 			return;
       
   469 	        }
       
   470 		case CTRL('o'):
       
   471 			{
       
   472 			INFO_PRINTF1(_L("Test 6: iCoeEnv->BringOwnerToFront()"));
       
   473 			TRAPD(ret, iCoeEnv->BringOwnerToFront());
       
   474 			TEST(ret == KErrNone);
       
   475 			break;
       
   476 	        }
       
   477 		case CTRL('r'):
       
   478 			{
       
   479 			INFO_PRINTF1(_L("Test 7: SendAsiMessageL(ESendRemoveWindow)"));
       
   480 			TRAPD(ret, SendAsiMessageL(ESendRemoveWindow));
       
   481 			TEST(ret == KErrNone);
       
   482 			return;
       
   483 	        }
       
   484 		case CTRL('s'):
       
   485 			{
       
   486 			INFO_PRINTF1(_L("Test 8: ToggleStrikethroughL()"));
       
   487 			TRAPD(ret, ToggleStrikethroughL());
       
   488 			TEST(ret == KErrNone);
       
   489 			break;
       
   490 	        }
       
   491 		case CTRL('u'):
       
   492 			{
       
   493 			INFO_PRINTF1(_L("Test 9: ToggleUnderlineL()"));
       
   494 			TRAPD(ret, ToggleUnderlineL());
       
   495 			TEST(ret == KErrNone);
       
   496 			break;
       
   497 	        }
       
   498 		default:
       
   499 			break;
       
   500         }
       
   501     TBuf<40> message;
       
   502     message.Format(_L("Menu command Ctrl+%c chosen"),aSelection+'A'-1);
       
   503     iMessageControl->SetMessage(message);
       
   504     if (aSelection==CTRL('e'))
       
   505         {
       
   506 		iCoeEnv->Flush(200000);
       
   507         CBaActiveScheduler::Exit();
       
   508         }
       
   509     }
       
   510 
       
   511 /**
       
   512   The method is an override from CTestCoeAppUi.\n
       
   513   This function is called asynchronously by RunL function of the
       
   514   AutotestManager after previous test case is executed.\n
       
   515  
       
   516  */
       
   517 void CTestMenu0AppUi::RunTestStepL(TInt aNextStep)
       
   518 	{
       
   519 
       
   520 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   521 	
       
   522 
       
   523 	switch(aNextStep)
       
   524 		{
       
   525 	case 1:
       
   526 		MenuSelectionMadeL(CTRL('a'));
       
   527 		break;
       
   528 	case 2:
       
   529 		SetTestStepID(_L("UIF-TMenu0Step-ToggleBoldL"));
       
   530 		MenuSelectionMadeL(CTRL('b'));
       
   531 		RecordTestResultL();
       
   532 		break;
       
   533 	case 3:
       
   534 		MenuSelectionMadeL(CTRL('c'));
       
   535 		break;
       
   536 	case 4:
       
   537 		SetTestStepID(_L("UIF-TMenu0Step-ToggleItalicL"));
       
   538 		MenuSelectionMadeL(CTRL('i'));
       
   539 		RecordTestResultL();
       
   540 		break;
       
   541 	case 5:
       
   542 		MenuSelectionMadeL(CTRL('m'));
       
   543 		break;
       
   544 	case 6:
       
   545 		MenuSelectionMadeL(CTRL('o'));
       
   546 		break;
       
   547 	case 7:
       
   548 		MenuSelectionMadeL(CTRL('r'));
       
   549 		break;
       
   550 	case 8:
       
   551 		SetTestStepID(_L("UIF-TMenu0Step-ToggleStrikethroughL"));
       
   552 		MenuSelectionMadeL(CTRL('s'));
       
   553 		RecordTestResultL();
       
   554 		break;
       
   555 	case 9:
       
   556 		SetTestStepID(_L("UIF-TMenu0Step-ToggleUnderlineL"));
       
   557 		MenuSelectionMadeL(CTRL('u'));
       
   558 		RecordTestResultL();
       
   559 		CloseTMSGraphicsStep();
       
   560 		break;
       
   561 	case 10:
       
   562 		AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
       
   563 		break;
       
   564 		}
       
   565 	}
       
   566     
       
   567 
       
   568 /**
       
   569   Second phase constructor for CTestMenu0AppUi class.\n
       
   570   Calls the second phase constructor of base class CTestCoeAppUi.\n
       
   571   Creates a control to handle pointer and key events (iMessageControl).\n
       
   572   Creates a control to handle menu events (iMenu) which is added
       
   573   to Cone's control stack.\n
       
   574  */
       
   575 void CTestMenu0AppUi::ConstructL()
       
   576     {
       
   577     CTestCoeAppUi::ConstructL();
       
   578     iMessageControl=new(ELeave) CMessageControl;
       
   579     iMessageControl->ConstructL();
       
   580     AddToStackL(iMessageControl);
       
   581     iMenu=new(ELeave) CTestMenu(this);
       
   582     AddToStackL(iMenu,ECoeStackPriorityMenu,ECoeStackFlagRefusesFocus);
       
   583 
       
   584 	AutoTestManager().StartAutoTest();
       
   585     }
       
   586 
       
   587 //
       
   588 // Main
       
   589 //
       
   590 
       
   591 /**
       
   592   Completes the construction of the Control Environment(CCoeEnv object).\n
       
   593   Instantiates the CCone0TestAppUi class which serves as a AppUi class.\n
       
   594   Sets the CCone0TestAppUi object as the application's user interface object.\n
       
   595   Invokes the second phase constructor of the application's UI.\n
       
   596   
       
   597  */
       
   598 void CTMenu0Step::ConstructAppL(CCoeEnv* aCoe)
       
   599 	{ // runs inside a TRAP harness
       
   600 	aCoe->ConstructL();
       
   601 	CTestMenu0AppUi* appUi=new(ELeave) CTestMenu0AppUi(this);
       
   602 	aCoe->SetAppUi(appUi);
       
   603 	appUi->ConstructL();
       
   604 	}
       
   605 
       
   606 CTMenu0Step::~CTMenu0Step()
       
   607 	{
       
   608 	}
       
   609 
       
   610 CTMenu0Step::CTMenu0Step()
       
   611 	{
       
   612 	SetTestStepName(KTMenu0Step);
       
   613 	}
       
   614 
       
   615 TVerdict CTMenu0Step::doTestStepL()
       
   616 	{
       
   617 	INFO_PRINTF1(_L("Test Started"));
       
   618 
       
   619 	__UHEAP_MARK;
       
   620 
       
   621     CCoeEnv* coe=new CCoeEnv;
       
   622     TRAPD(err,ConstructAppL(coe));
       
   623     if (!err)
       
   624         coe->ExecuteD();
       
   625     
       
   626 	__UHEAP_MARKEND;
       
   627 
       
   628 	INFO_PRINTF1(_L("Test Finishes"));
       
   629 	return TestStepResult();
       
   630 	}
       
   631 
       
   632 
       
   633 
       
   634