commonuisupport/uikon/test/tcolours/tcolscm/TCOLSCM.CPP
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 // Copyright (c) 2007-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 // Acts as a very simple run-time colour scheme changer application.
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20  @test
       
    21  @internalComponent - Internal Symbian test code
       
    22 */
       
    23 
       
    24 #include <s32file.h>
       
    25 #include <gdi.h>
       
    26 #include <gulutil.h>
       
    27 
       
    28 #include <eikenv.h>
       
    29 #include <techview/eikdialg.h>
       
    30 #include <eikappui.h>
       
    31 #include <eikapp.h>
       
    32 #include <eikdoc.h>
       
    33 #include <eikdebug.h>
       
    34 #include <techview/eikchlst.h>
       
    35 #include <eikrutil.h>
       
    36 #include <eikpanic.h>
       
    37 #include <eiksvdef.h>
       
    38 #include <ecom/ecom.h>
       
    39 
       
    40 #include <techview/eikon.hrh>
       
    41 #include <techview/eikon.rsg>
       
    42 #include <eikspane.h>
       
    43 #include <spaneinit.rsg>
       
    44 
       
    45 #include "TCOLSCM.HRH"
       
    46 #include <tcolscm.rsg>
       
    47 
       
    48 #include "Tcolscm.h"
       
    49 
       
    50 
       
    51 // globals 
       
    52 _LIT(KTColscmResourceFilePath, "z:\\system\\test\\colours\\tcolscm\\tcolscm.rsc");
       
    53 const TUid KUidTColscm={651};
       
    54 
       
    55 GLDEF_C void Panic(TEikPanic aPanic)
       
    56 	{
       
    57 	User::Panic(_L("TCOLSCM"), aPanic);
       
    58 	}
       
    59 
       
    60 
       
    61 //!***************************** CColorSchemeDlg. 
       
    62 /**
       
    63  Dialog for the colour scheme control.
       
    64 */
       
    65 
       
    66 CColorSchemeDlg::CColorSchemeDlg(TInt& aChoice)
       
    67 	: iChoice(aChoice) 
       
    68 	{
       
    69 	}
       
    70 
       
    71 /**
       
    72    This method is an override from CEikDialog. It is used to perform pre-layout dialog initialisation. 
       
    73  */
       
    74 void CColorSchemeDlg::PreLayoutDynInitL()
       
    75 	{
       
    76 	}
       
    77 
       
    78 /**
       
    79    This method is an override from CEikDialog. It handles a dialog button press for OK button.  
       
    80  */
       
    81 TBool CColorSchemeDlg::OkToExitL(TInt aControlId)
       
    82     {
       
    83 	if (aControlId==EEikBidOk)
       
    84 		{
       
    85 		iChoice=STATIC_CAST(CEikChoiceList*,Control(EAppChoiceListId))->CurrentItem();
       
    86 		}
       
    87 	return(ETrue);
       
    88     }
       
    89 
       
    90 
       
    91 
       
    92 //!*****************************  CColorSchemeControl. 
       
    93 /**
       
    94  The class represents colour scheme control on which tests are performed.
       
    95 */
       
    96 
       
    97 /**
       
    98    The method creates the controls window and sets it ready to be drawn.
       
    99  */
       
   100 void CColorSchemeControl::ConstructL(const TRect& aRect)
       
   101     {
       
   102     CreateWindowL();
       
   103     Window().SetShadowDisabled(ETrue);
       
   104     SetRect(aRect);
       
   105     ActivateL();
       
   106 
       
   107 	iLogicalNames = new(ELeave) CDesCArrayFlat(5);
       
   108 	InitNameArrayL();
       
   109     }
       
   110 
       
   111 /**
       
   112    The method is called by CColorSchemeControl::ConstructL() to initialize the descriptor array,iLogicalNames.
       
   113  */
       
   114 void CColorSchemeControl::InitNameArrayL()
       
   115     {
       
   116 	iLogicalNames->AppendL(_L("WindowBackground"));
       
   117 	iLogicalNames->AppendL(_L("WindowText"));
       
   118 	iLogicalNames->AppendL(_L("ControlBackground"));
       
   119 	iLogicalNames->AppendL(_L("ControlText"));
       
   120 	iLogicalNames->AppendL(_L("ControlSurroundBackground"));
       
   121 	iLogicalNames->AppendL(_L("ControlSurroundText"));
       
   122 	iLogicalNames->AppendL(_L("ControlHighlightBackground"));
       
   123 	iLogicalNames->AppendL(_L("ControlHighlightText"));
       
   124 	iLogicalNames->AppendL(_L("ControlDimmedBackground"));
       
   125 	iLogicalNames->AppendL(_L("ControlDimmedText"));
       
   126 	iLogicalNames->AppendL(_L("ControlDimmedHighlightBackground"));
       
   127 	iLogicalNames->AppendL(_L("ControlDimmedHighlightText"));
       
   128 	iLogicalNames->AppendL(_L("DialogBackground"));
       
   129 	iLogicalNames->AppendL(_L("DialogText"));
       
   130 	iLogicalNames->AppendL(_L("DialogTitle"));
       
   131 	iLogicalNames->AppendL(_L("DialogTitlePressed"));
       
   132 	iLogicalNames->AppendL(_L("DialogTitleText"));
       
   133 	iLogicalNames->AppendL(_L("DialogTitleTextPressed"));
       
   134 	iLogicalNames->AppendL(_L("MenubarBackground"));
       
   135 	iLogicalNames->AppendL(_L("MenubarText"));
       
   136 	iLogicalNames->AppendL(_L("MenubarTitleBackground"));
       
   137 	iLogicalNames->AppendL(_L("MenubarTitleText"));
       
   138 	iLogicalNames->AppendL(_L("MenuPaneBackground"));
       
   139 	iLogicalNames->AppendL(_L("MenuPaneText"));
       
   140 	iLogicalNames->AppendL(_L("MenuPaneHighlight"));
       
   141 	iLogicalNames->AppendL(_L("MenuPaneTextHighlight"));
       
   142 	iLogicalNames->AppendL(_L("MenuPaneDimmedHighlight"));
       
   143 	iLogicalNames->AppendL(_L("MenuPaneDimmedText"));
       
   144 	iLogicalNames->AppendL(_L("MenuPaneDimmedTextHighlight"));
       
   145 	iLogicalNames->AppendL(_L("ButtonFaceClear"));
       
   146 	iLogicalNames->AppendL(_L("ButtonFaceSet"));
       
   147 	iLogicalNames->AppendL(_L("ButtonFaceSetPressed"));
       
   148 	iLogicalNames->AppendL(_L("ButtonFaceClearPressed"));
       
   149 	iLogicalNames->AppendL(_L("ButtonText"));
       
   150 	iLogicalNames->AppendL(_L("ButtonTextPressed"));
       
   151 	iLogicalNames->AppendL(_L("ButtonTextDimmed"));
       
   152 	iLogicalNames->AppendL(_L("MsgWinForeground"));
       
   153 	iLogicalNames->AppendL(_L("MsgWinBackground"));
       
   154 	iLogicalNames->AppendL(_L("ScrollBarBorder"));
       
   155 	iLogicalNames->AppendL(_L("ScrollBarShaft"));
       
   156 	iLogicalNames->AppendL(_L("ScrollBarShaftDimmed"));
       
   157 	iLogicalNames->AppendL(_L("ScrollBarShaftPressed"));
       
   158 	iLogicalNames->AppendL(_L("ScrollBarNoShaftOrThumb"));
       
   159 	iLogicalNames->AppendL(_L("ScrollButtonIcon"));
       
   160 	iLogicalNames->AppendL(_L("ScrollButtonIconPressed"));
       
   161 	iLogicalNames->AppendL(_L("ScrollButtonIconDimmed"));
       
   162 	iLogicalNames->AppendL(_L("ScrollButtonThumbBackground"));
       
   163 	iLogicalNames->AppendL(_L("ScrollButtonThumbBackgroundPressed"));
       
   164 	iLogicalNames->AppendL(_L("ScrollThumbDimmed"));
       
   165 	iLogicalNames->AppendL(_L("ScrollThumbEdge"));
       
   166 	iLogicalNames->AppendL(_L("ToolbarBackground"));
       
   167 	iLogicalNames->AppendL(_L("ToolbarText"));
       
   168 	iLogicalNames->AppendL(_L("StatuspaneBackground"));
       
   169 	iLogicalNames->AppendL(_L("StatuspaneText"));
       
   170 	iLogicalNames->AppendL(_L("LabelText"));
       
   171 	iLogicalNames->AppendL(_L("LabelTextEmphasis"));	
       
   172 	iLogicalNames->AppendL(_L("LabelDimmedText"));
       
   173 	iLogicalNames->AppendL(_L("LabelHighlightPartialEmphasis"));
       
   174 	iLogicalNames->AppendL(_L("LabelHighlightFullEmphasis"));
       
   175 	}
       
   176 
       
   177 const TInt KXStart = 10;
       
   178 const TInt KYStart = 10;
       
   179 const TInt KYTextStart = 20;
       
   180 const TInt KWidth = 10;
       
   181 const TInt KHeight = 18;
       
   182 const TInt KXSpacing = 5;
       
   183 const TInt KYSpacing = 5;
       
   184 const TInt KXTextWidth = 80;
       
   185 
       
   186 
       
   187 /**
       
   188    The method is an override from CCoeControl. The method gets the physical
       
   189    (TRgb) colour which corresponds to the logical colour specified from the
       
   190    application's colour list and sets it as controls background colour.
       
   191  */
       
   192 void CColorSchemeControl::Draw(const TRect& /*aRect*/) const
       
   193 	{
       
   194 	// Tests whether custom color arrays in the list have been merged correctly
       
   195 	ASSERT(iEikonEnv->ColorList().Color(KUidTColscm, EExtraSystemBackground)==KRgbRed);
       
   196 	ASSERT(iEikonEnv->ColorList().Color(KUidTColscm, EExtraSystemText)==KRgbGreen);
       
   197 	//
       
   198 
       
   199 	CWindowGc& gc = SystemGc();
       
   200 	gc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   201 	gc.SetBrushColor(iEikonEnv->ControlColor(EColorWindowBackground,*this));
       
   202 	gc.SetPenColor(KRgbBlack);
       
   203 	gc.DrawRect(Rect());
       
   204 
       
   205 	gc.UseFont(iEikonEnv->AnnotationFont());
       
   206 
       
   207 	TInt yPos = KYStart;
       
   208 	TInt xPos = KXStart;
       
   209 
       
   210 	TInt yTextPos = KYTextStart;
       
   211 	
       
   212 	const TInt yInc = KHeight+KYSpacing;
       
   213 	const TInt xInc = KWidth+KXSpacing;
       
   214 
       
   215 	TInt count = 0;
       
   216 	for(TInt jj=0;jj<6;jj++)
       
   217 		{
       
   218 		for(TInt ii=0;ii<10;ii++)
       
   219 			{
       
   220 			if(count>EEikColorLabelHighlightFullEmphasis) break;
       
   221 					
       
   222 			TRect rect(TPoint(xPos,yPos),TSize(KWidth,KHeight));
       
   223 			gc.SetBrushColor(iEikonEnv->ControlColor(STATIC_CAST(TLogicalColor,count),*this));
       
   224 			gc.DrawRect(rect);
       
   225 				
       
   226 			xPos+=xInc;
       
   227 			TRAPD(err,
       
   228 				HBufC* text=HBufC::NewLC(1024);
       
   229 				TPtr textPointer=text->Des();
       
   230 				textPointer.Format((*iLogicalNames)[count]);
       
   231 				TextUtils::ClipToFit(textPointer, *(iEikonEnv->AnnotationFont()), KXTextWidth);
       
   232 				gc.DrawText(textPointer,TPoint(xPos,yTextPos));
       
   233 				CleanupStack::PopAndDestroy(); // text
       
   234 				);
       
   235  		
       
   236 		   	__ASSERT_ALWAYS(!err,User::Panic(_L("tcolscm"),err));
       
   237 			yTextPos+=yInc;
       
   238 			yPos+=yInc;
       
   239 			xPos-=xInc;
       
   240 
       
   241 			count++;
       
   242 			}
       
   243 		xPos+=xInc+KXTextWidth+KXSpacing;
       
   244 		yTextPos=KYTextStart;
       
   245 		yPos=KYStart;
       
   246 		}
       
   247 	}
       
   248 
       
   249 /**
       
   250    The method is an override from CCoeControl. The method handles key events of the control.
       
   251  */
       
   252 TKeyResponse CColorSchemeControl::OfferKeyEventL(const TKeyEvent& /*aKeyEvent*/,TEventCode /*aType*/)
       
   253 	{
       
   254 	return EKeyWasNotConsumed;
       
   255 	}
       
   256 
       
   257 CColorSchemeControl::~CColorSchemeControl()
       
   258 	{
       
   259 	delete iLogicalNames;
       
   260 	}
       
   261 
       
   262 
       
   263 //!*****************************  CBlankerWin. 
       
   264 /**
       
   265  Empty Control
       
   266 */
       
   267 
       
   268 /**
       
   269    The method is an override from CCoeControl. The method draws an empty control.
       
   270  */
       
   271 void CBlankerWin::Draw(const TRect& /*aRect*/) const
       
   272 	{
       
   273 	}
       
   274 
       
   275 /**
       
   276    The method creates an empty control and sets its extend to fit the entire screen.  
       
   277  */	
       
   278 void CBlankerWin::ConstructL()
       
   279     {
       
   280     CreateWindowL();
       
   281     SetExtentToWholeScreen();
       
   282     ActivateL();
       
   283     DrawNow();
       
   284     iCoeEnv->Flush(300000);
       
   285     }
       
   286 
       
   287 
       
   288 
       
   289 //!*****************************  A CTColorSchemeAppUi test class. 
       
   290 /**
       
   291  The class performs tests to change colour scheme.
       
   292 */
       
   293 CTColorSchemeAppUi::CTColorSchemeAppUi(CTmsTestStep* aStep) :
       
   294 	CTestAppUi(aStep,KTColscmResourceFilePath)
       
   295 	{
       
   296 	}
       
   297 
       
   298 
       
   299 /**
       
   300    The method initiates the creation of a control that acts as a runtime
       
   301    colour scheme changer and sets active object with lowest priority for
       
   302    running test in auto mode. It also initializes a colour array by reading
       
   303    a list of available colours from a resource definition.  
       
   304  */
       
   305 void CTColorSchemeAppUi::ConstructL()
       
   306     {
       
   307 	CTestAppUi::ConstructL();
       
   308 
       
   309 	ReadCustomColorResourceL();
       
   310 
       
   311 	iColorSchemeControl=new(ELeave) CColorSchemeControl();
       
   312     iColorSchemeControl->ConstructL(ClientRect());
       
   313 	AddToStackL(iColorSchemeControl);
       
   314 
       
   315 	AutoTestManager().StartAutoTest();
       
   316     }
       
   317 
       
   318 
       
   319 CTColorSchemeAppUi::~CTColorSchemeAppUi()
       
   320     {
       
   321 	RemoveFromStack(iColorSchemeControl);
       
   322 	delete iColorSchemeControl;
       
   323     }
       
   324 
       
   325 
       
   326 /**
       
   327    The method is an override from CTestAppUi. The method initiates all tests
       
   328    which refresh background with different colors by calling CTColorSchemeAppUi::HandleCommandL().
       
   329  */
       
   330 void CTColorSchemeAppUi::RunTestStepL(TInt aNextStep)
       
   331 	{
       
   332 	switch(aNextStep)
       
   333 		{
       
   334 	case 1:
       
   335 		SetTestStepID(_L("UIF-TCOLSCM-HandleCommandL"));
       
   336 		INFO_PRINTF1(_L("Draw color background DEFAULT"));
       
   337 		HandleCommandL(EAppCmdShowDlg);
       
   338 		iChoice++;
       
   339 		break;
       
   340 	case 2:
       
   341 		INFO_PRINTF1(_L("Draw color background GRAY"));
       
   342 		HandleCommandL(EAppCmdShowDlg);
       
   343 		iChoice++;
       
   344 		break;
       
   345 	case 3:
       
   346 		INFO_PRINTF1(_L("Draw color background LILAC"));
       
   347 		HandleCommandL(EAppCmdShowDlg);
       
   348 		iChoice++;
       
   349 		break;
       
   350 	case 4:
       
   351 		INFO_PRINTF1(_L("Draw color background MARAM_GRASS"));
       
   352 		HandleCommandL(EAppCmdShowDlg);
       
   353 		iChoice++;
       
   354 		break;
       
   355 	case 5:
       
   356 		INFO_PRINTF1(_L("Draw color background SKY_BLUE"));
       
   357 		HandleCommandL(EAppCmdShowDlg);
       
   358 		iChoice++;
       
   359 		break;
       
   360 	case 6:
       
   361 		INFO_PRINTF1(_L("Draw color background BEACH_SAND"));
       
   362 		HandleCommandL(EAppCmdShowDlg);
       
   363 		iChoice++;
       
   364 		break;
       
   365 	case 7:
       
   366 		INFO_PRINTF1(_L("Draw color background BLUE_SLATE"));
       
   367 		HandleCommandL(EAppCmdShowDlg);
       
   368 		iChoice++;
       
   369 		break;
       
   370 	case 8:
       
   371 		INFO_PRINTF1(_L("Draw color background SKY_BLUE"));
       
   372 		HandleCommandL(EAppCmdShowDlg);
       
   373 		iChoice++;
       
   374 		break;
       
   375 	case 9:
       
   376 		INFO_PRINTF1(_L("Draw color background CUSTOM COLOR 1"));
       
   377 		HandleCommandL(EAppCmdShowDlg);
       
   378 		iChoice++;
       
   379 		break;
       
   380 	case 10:
       
   381 		INFO_PRINTF1(_L("Draw color background CUSTOM COLOR 2"));
       
   382 		HandleCommandL(EAppCmdShowDlg);
       
   383 		iChoice++;
       
   384 		break;
       
   385 	case 11:
       
   386 		HandleCommandL(EAppCmdToggleSpane);
       
   387 		iChoice = 0;
       
   388 		INFO_PRINTF1(_L("End of Test."));
       
   389 		RecordTestResultL();
       
   390 		CloseTMSGraphicsStep();
       
   391 		CTestAppUi::AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
       
   392 		break;
       
   393 	default:
       
   394 		break;
       
   395 		}
       
   396 	}
       
   397 
       
   398 /**
       
   399    The method creates a colour array by calling EikResourceUtils::CreateColorArrayLC()
       
   400    to read a list of available colours from a resource definition. The method
       
   401    sets a mapping in application colour list between logical colours which
       
   402    specify the colour scheme and physical colours by calling CEikonEnv::SetColor().
       
   403    The method then updates the system color list with application colour list
       
   404    by calling ColorUtils::UpdateSystemColorListL().
       
   405  */
       
   406 void CTColorSchemeAppUi::StorePrefsL()
       
   407 	{	
       
   408 	CColorArray* colorArray=EikResourceUtils::CreateColorArrayLC(iResId,iEikonEnv);
       
   409 	for (TInt ii=EColorWindowBackground;ii<=EEikColorLabelHighlightFullEmphasis;ii++)
       
   410 		{
       
   411 		iEikonEnv->SetColor(((TLogicalColor)ii),colorArray->Color(ii));
       
   412 		}
       
   413 	ColorUtils::UpdateSystemColorListL(iEikonEnv->FsSession(),iEikonEnv->ColorList());
       
   414 	CleanupStack::PopAndDestroy(colorArray);
       
   415 	}
       
   416 
       
   417 
       
   418 /**
       
   419    @SYMTestCaseID UIF-TCOLSCM-HandleCommandL
       
   420   
       
   421    @SYMPREQ
       
   422   
       
   423    @SYMTestCaseDesc Tests refreshing the background color of the control.
       
   424   
       
   425    @SYMTestPriority High
       
   426   
       
   427    @SYMTestStatus Implemented
       
   428    
       
   429    @SYMTestActions The method performs the following:\n
       
   430    1) Test changing background color of the control
       
   431    2) Toggle between making the Status Pane visible and invisible.
       
   432   
       
   433    @SYMTestExpectedResults Each of the tests should display the sprite as
       
   434    expected for the values assigned to parameters of methods covered by the
       
   435    test.\n
       
   436  */
       
   437 void CTColorSchemeAppUi::HandleCommandL(TInt aCommand)
       
   438     {
       
   439     switch (aCommand)
       
   440         {
       
   441     case EEikCmdExit:
       
   442         Exit();
       
   443         break;
       
   444 	case EAppCmdToggleSpane:
       
   445 		ToggleStatusPane();
       
   446 		break;
       
   447 	case EAppCmdShowDlg:
       
   448 		HandleColorChangesL();
       
   449 		break;
       
   450         }
       
   451     }
       
   452 
       
   453 
       
   454 /**
       
   455   The method changes the background of the control.The method calls
       
   456   StorePrefsL() to set the application colour list as the system colour list
       
   457   and accesses the windows server to change the background colour. In order
       
   458   to change the colour a windows server event to change colour scheme is
       
   459   created and the event is send to all windows group of all applications.
       
   460 */
       
   461 void CTColorSchemeAppUi::HandleColorChangesL()
       
   462     {
       
   463 	switch(iChoice)
       
   464 		{
       
   465 	case 0:
       
   466 		iResId=R_COLOR_SCHEME_ER5;
       
   467 		break;
       
   468 	case 1:
       
   469 		iResId=R_COLOR_SCHEME_GRAY;
       
   470 		break;
       
   471 	case 2:
       
   472 		iResId=R_COLOR_SCHEME_LILAC;
       
   473 		break;
       
   474 	case 3:
       
   475 		iResId=R_COLOR_SCHEME_MARAM_GRASS;
       
   476 		break;
       
   477 	case 4:
       
   478 		iResId=R_COLOR_SCHEME_SKY_BLUE;
       
   479 		break;
       
   480 	case 5:
       
   481 		iResId=R_COLOR_SCHEME_BEACH_SAND;
       
   482 		break;
       
   483 	case 6:
       
   484 		iResId=R_COLOR_SCHEME_BLUE_SLATE;
       
   485 		break;
       
   486 	case 7:
       
   487 		iResId=R_COLOR_SCHEME_SKY_BLUE;
       
   488 		break;
       
   489 		}
       
   490 
       
   491 	StorePrefsL();
       
   492 
       
   493 	iEikonEnv->WsSession().SetAutoFlush(ETrue);
       
   494 
       
   495 	CArrayFixFlat<TInt> *windowList = new(ELeave) CArrayFixFlat<TInt>(5);
       
   496 	CleanupStack::PushL(windowList);
       
   497 	iEikonEnv->WsSession().WindowGroupList(windowList);
       
   498 
       
   499 	TInt count=windowList->Count();
       
   500 	for(int ii=0;ii<count;ii++)
       
   501 		{
       
   502 		TWsEvent event;
       
   503 		event.SetType(KUidValueEikColorSchemeChangeEvent);
       
   504 		TInt winId=(*windowList)[ii];
       
   505 		iEikonEnv->WsSession().SendEventToWindowGroup(winId,event);
       
   506 		}
       
   507 	
       
   508 	CleanupStack::PopAndDestroy(windowList);
       
   509 
       
   510 	iEikonEnv->WsSession().SetAutoFlush(EFalse);
       
   511 	
       
   512 	CBlankerWin* win=new(ELeave) CBlankerWin;
       
   513 	CleanupStack::PushL(win);
       
   514 	win->ConstructL();
       
   515 	CleanupStack::PopAndDestroy(win);
       
   516 	}
       
   517 
       
   518 
       
   519 /**
       
   520    The method initializes a colour array by calling
       
   521    EikResourceUtils::CreateColorArrayLC() to read a list of available
       
   522    colours from a resource definition. The color array thus created is added
       
   523    to application's colour list by calling CColorList::AddColorArrayL().
       
   524  */
       
   525 void CTColorSchemeAppUi::ReadCustomColorResourceL()
       
   526 	{
       
   527 	CColorArray* colors=EikResourceUtils::CreateColorArrayLC(R_CUSTOM_EXTRA_COLORS,iEikonEnv);
       
   528 	iEikonEnv->ColorList().AddColorArrayL(KUidTColscm,colors); // takes ownership
       
   529 	CleanupStack::Pop(colors);
       
   530 	}
       
   531 
       
   532 
       
   533 /**
       
   534    The method alternatively makes the status pane appear, disappear and refreshes the screen.   
       
   535  */
       
   536 void CTColorSchemeAppUi::ToggleStatusPane()
       
   537 	{
       
   538 	if( iEikonEnv->AppUiFactory()->StatusPane() )
       
   539 		{
       
   540 		iEikonEnv->AppUiFactory()->StatusPane()->MakeVisible( !iEikonEnv->AppUiFactory()->StatusPane()->IsVisible() );
       
   541 		iColorSchemeControl->SetRect( ClientRect() );
       
   542 		iColorSchemeControl->DrawNow();
       
   543 		}
       
   544 	}
       
   545 
       
   546 
       
   547 
       
   548 //!*****************************  A CTestColscmStep test class. 
       
   549 /**
       
   550  The class creates & sets the application's user interface object.
       
   551 */
       
   552 
       
   553 CTestColscmStep::CTestColscmStep()
       
   554 	{
       
   555 	SetTestStepName(KTestColscmStep);
       
   556 	}
       
   557 
       
   558 
       
   559 CTestColscmStep::~CTestColscmStep()
       
   560 	{
       
   561 	}
       
   562 
       
   563 
       
   564 /**
       
   565    The method creates & sets the application's user interface object. 
       
   566  */
       
   567 void CTestColscmStep::ConstructAppL(CEikonEnv* aCoe)
       
   568     { // runs inside a TRAP harness
       
   569 	aCoe->ConstructL();
       
   570 	CTestAppUi* appUi= new (ELeave) CTColorSchemeAppUi(this);
       
   571     aCoe->SetAppUi(appUi);
       
   572     appUi->ConstructL();
       
   573     }
       
   574 
       
   575 TVerdict CTestColscmStep::doTestStepL()
       
   576 	{
       
   577 	INFO_PRINTF1(_L("Test Colscm step started...."));
       
   578 
       
   579 	PreallocateHALBuffer();
       
   580 	__UHEAP_MARK;
       
   581 
       
   582 	CEikonEnv* coe=new(ELeave) CEikonEnv;
       
   583 	TRAPD(err,ConstructAppL(coe));
       
   584 	TEST(err==KErrNone);
       
   585 	if (!err)
       
   586 		{
       
   587 		coe->ExecuteD();
       
   588 		}
       
   589 
       
   590 	REComSession::FinalClose();	
       
   591 	__UHEAP_MARKEND;
       
   592 
       
   593 	INFO_PRINTF1(_L("...Test Colscm step finished!!!"));
       
   594 	return TestStepResult();
       
   595 	}
       
   596