lafagnosticuifoundation/cone/tef/TConeBackground.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 // Tests MCoeControlBackground interface.\n
       
    15 // Parent controls can elect to take responsibility for drawing the background for their child
       
    16 // controls.\n To achieve this, they should aggregate an object that implements this interface.\n
       
    17 // CCoeControl::SetBackground() accepts the object and sets it as the background drawer.\n
       
    18 // 
       
    19 //
       
    20 
       
    21 /**
       
    22  @file
       
    23  @internalComponent - Internal Symbian test code
       
    24 */
       
    25 
       
    26 #include <coeaui.h>
       
    27 #include <coemain.h>
       
    28 #include <coecntrl.h>
       
    29 #include <coedef.h>
       
    30 #include <coesndpy.h>
       
    31 #include <coefont.h>
       
    32 #include <gdi.h>
       
    33 #include <basched.h>
       
    34 #include <bassnd.h>
       
    35 #include <ecom/ecom.h>
       
    36 #include "TConeBackground.h"
       
    37 
       
    38 //! Text Displayed on the background of the control.\n
       
    39 _LIT(KConeBackgroundTestText, "Hello, world");
       
    40 
       
    41 //! A CCoeControl derived class.\n
       
    42 
       
    43 /**   The class is used as a control to test background drawing feature.\n */
       
    44 
       
    45 class CConeBackgroundTestControl : public CCoeControl
       
    46     {
       
    47 public:
       
    48 	static CConeBackgroundTestControl* NewL(const CCoeControl& aParent, const TRect& aRect);
       
    49 	CConeBackgroundTestControl();
       
    50 	~CConeBackgroundTestControl();
       
    51     void ConstructL(const CCoeControl& aParent, const TRect& aRect);
       
    52 private:
       
    53 	           // Inherited from CCoeControl
       
    54 	void Draw(const TRect& /*aRect*/) const;
       
    55 
       
    56 private:
       
    57 	HBufC*  iConeBackgroundTestText;
       
    58 	TCoeFont iFont;
       
    59     };
       
    60 
       
    61 
       
    62 //! A CBase and MCoeControlBackground derived class.\n
       
    63 
       
    64 /**  The class is used as a Dummy base class for the three background drawers */
       
    65 
       
    66 class CConeBackgroundTestDrawer : public CBase, public MCoeControlBackground
       
    67 	{
       
    68 	};
       
    69 
       
    70 //! A CConeBackgroundTestDrawer derived class.\n
       
    71 /**   First Background drawer class  */
       
    72 // Three Background drawer classes with different styles...
       
    73 class CConeBackgroundTestDrawer0 : public CConeBackgroundTestDrawer
       
    74 	{
       
    75 public:
       
    76 	static CConeBackgroundTestDrawer0* NewL();
       
    77 	void SetBgStyle(int aStyle);
       
    78 	
       
    79 private:
       
    80 	void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const;
       
    81 	
       
    82 private:
       
    83 	TInt iBgStyle;
       
    84 	};
       
    85 //! A CConeBackgroundTestDrawer derived class.\n
       
    86 /**   Second Background drawer class  */
       
    87 class CConeBackgroundTestDrawer1 : public CConeBackgroundTestDrawer
       
    88 	{
       
    89 public:
       
    90 	static CConeBackgroundTestDrawer1* NewL();
       
    91 	
       
    92 private:
       
    93 	void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const;
       
    94 	};
       
    95 //! A CConeBackgroundTestDrawer derived class.\n
       
    96 /**   Third Background drawer class  */
       
    97 class CConeBackgroundTestDrawer2 : public CConeBackgroundTestDrawer
       
    98 	{
       
    99 public:
       
   100 	static CConeBackgroundTestDrawer2* NewL();
       
   101 	
       
   102 public:
       
   103 	void Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const;
       
   104 	};
       
   105 //! A CoeControl Derived Class.\n
       
   106 /**    A parent control  that does not draw a background for component controls.\n */
       
   107 class CConeBackgroundTestParentWithNoBg : public CCoeControl
       
   108     {
       
   109 public:
       
   110 	static CConeBackgroundTestParentWithNoBg* NewL(const CCoeControl& aParent, const TRect& aRect);
       
   111 	~CConeBackgroundTestParentWithNoBg();
       
   112 	
       
   113 private:
       
   114     void ConstructL(const CCoeControl& aParent, const TRect& aRect);
       
   115  
       
   116 public:	// From CCoeControl
       
   117 	TInt CountComponentControls() const;
       
   118 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   119 
       
   120 private: // From CCoeControl
       
   121 	void Draw(const TRect& aRect) const;
       
   122 
       
   123 private:
       
   124 	CCoeControl* iChildControl1;
       
   125 	CCoeControl* iChildControl2;
       
   126     };
       
   127 
       
   128 //! A CoeControl Derived Class.\n
       
   129 /**    A parent control  that does draws a background for component controls.\n */
       
   130 class CConeBackgroundTestParentWithBg : public CCoeControl
       
   131     {
       
   132 public:
       
   133 	static CConeBackgroundTestParentWithBg* NewL(const CCoeControl& aParent, const TRect& aRect,
       
   134 									  CConeBackgroundTestDrawer* aDrawer, TBool aUseDummyCtrl = EFalse);
       
   135 	~CConeBackgroundTestParentWithBg();
       
   136 	
       
   137 	void SetSecondary(CCoeControl* aSecondary);
       
   138 	
       
   139 private:
       
   140 	CConeBackgroundTestParentWithBg(CConeBackgroundTestDrawer* aDrawer, TBool aUseDummyCtrl);
       
   141     void ConstructL(const CCoeControl& aParent, const TRect& aRect);
       
   142  
       
   143 public:	// From CCoeControl
       
   144 	TInt CountComponentControls() const;
       
   145 	CCoeControl* ComponentControl(TInt aIndex) const;
       
   146 
       
   147 private: // From CCoeControl
       
   148 	void Draw(const TRect& aRect) const;
       
   149 
       
   150 private:
       
   151 	TBool iUseDummyCtrl;
       
   152 	CCoeControl* iChildControl;
       
   153 	CCoeControl* iSecondary;
       
   154 	CConeBackgroundTestDrawer *iBgDrawer;
       
   155     };
       
   156     
       
   157 //! A CoeControl Derived Class.\n
       
   158 /**    A parent window owning control  that draws a background for component controls.\n */
       
   159 class CConeBackgroundTestParentWindowOwning : public CCoeControl
       
   160     {
       
   161 public:
       
   162     static CConeBackgroundTestParentWindowOwning* NewL(const CCoeControl& aParent, const TRect& aRect,
       
   163     	   CConeBackgroundTestDrawer* aDrawer);
       
   164     ~CConeBackgroundTestParentWindowOwning();
       
   165     	
       
   166 private:
       
   167     CConeBackgroundTestParentWindowOwning(CConeBackgroundTestDrawer* aDrawer);
       
   168     void ConstructL(const CCoeControl& aParent, const TRect& aRect);
       
   169      
       
   170 public:	// From CCoeControl
       
   171     TInt CountComponentControls() const;
       
   172     CCoeControl* ComponentControl(TInt aIndex) const;
       
   173 
       
   174 private: // From CCoeControl
       
   175     void Draw(const TRect& aRect) const;
       
   176 
       
   177 private:
       
   178     CCoeControl* iChildControl;
       
   179     CConeBackgroundTestDrawer *iBgDrawer;
       
   180     };
       
   181     
       
   182 //! A CCoeControl derived class.\n
       
   183 
       
   184 /**   The class is used as a non window owning control to test background drawing feature.\n */
       
   185 
       
   186 class CConeBackgroundTestNonWindowOwningControl : public CCoeControl
       
   187     {
       
   188 public:
       
   189 	static CConeBackgroundTestNonWindowOwningControl* NewL(const CCoeControl& aParent, const TRect& aRect);
       
   190 	CConeBackgroundTestNonWindowOwningControl();
       
   191 	~CConeBackgroundTestNonWindowOwningControl();
       
   192     void ConstructL(const CCoeControl& aParent, const TRect& aRect);
       
   193 private:
       
   194 	           // Inherited from CCoeControl
       
   195 	void Draw(const TRect& /*aRect*/) const;
       
   196     };    
       
   197         
       
   198 //! A CoeControl Derived Class.\n
       
   199 
       
   200 /**    View Class for TConeBackground Test Step.\n */
       
   201 
       
   202 class CConeBackgroundTestView : public CCoeControl
       
   203     {
       
   204 public:
       
   205 	static CConeBackgroundTestView* NewL();
       
   206 	CConeBackgroundTestView();
       
   207 	~CConeBackgroundTestView();
       
   208     void ConstructL();
       
   209     
       
   210     void Test1L();
       
   211     void Test2L();
       
   212     void Test3L();
       
   213     void Test4L();
       
   214 
       
   215     TInt CountComponentControls() const;
       
   216     CCoeControl* ComponentControl(TInt aIndex) const;
       
   217 
       
   218 private:
       
   219 	           // Inherited from CCoeControl
       
   220 	void Draw(const TRect& /*aRect*/) const;
       
   221 
       
   222 private:
       
   223 	CCoeControl* iControl;
       
   224 	CConeBackgroundTestDrawer0* iBgDrawer;
       
   225     };
       
   226 
       
   227 
       
   228 //
       
   229 //
       
   230 // CConeBackgroundTestControl
       
   231 //
       
   232 //
       
   233 /**  Constructor for CConeBackgroundTestControl class.\n
       
   234 	 Initializes the font for the control.\n
       
   235 */
       
   236 CConeBackgroundTestControl::CConeBackgroundTestControl():
       
   237 iFont(TCoeFont::NormalFont())
       
   238 	{
       
   239 	}
       
   240 /**  Static NewL function used to instantiate a CConeBackgroundTestControl object.\n
       
   241 	 Creates a CConeBackgroundTestControl object and invokes the second phase constructor.\n
       
   242 */
       
   243 CConeBackgroundTestControl* CConeBackgroundTestControl::NewL(const CCoeControl& aParent, const TRect& aRect)
       
   244 	{
       
   245 	CConeBackgroundTestControl* self = new(ELeave) CConeBackgroundTestControl();
       
   246 	CleanupStack::PushL(self);
       
   247 	self->ConstructL(aParent, aRect);
       
   248 	CleanupStack::Pop();
       
   249 	return self;
       
   250 	}
       
   251 /**
       
   252   Destructor for CConeBackgroundTestControl class.\n
       
   253 */ 
       
   254 CConeBackgroundTestControl::~CConeBackgroundTestControl()
       
   255 	{
       
   256 	delete iConeBackgroundTestText;
       
   257 	}
       
   258 /**
       
   259   Second phase constructor for CConeBackgroundTestControl class.\n
       
   260   Sets the container window to the argument aParent.\n
       
   261   Sets the control's extenti.e; dimensions to aRect.\n
       
   262 */ 
       
   263 void CConeBackgroundTestControl::ConstructL(const CCoeControl& aParent, const TRect& aRect)
       
   264     {
       
   265 //	iConeBackgroundTestText = iCoeEnv->AllocReadResourceL(R_ConeBackgroundTest_TEXT_ZOOM);
       
   266     SetContainerWindowL(aParent);
       
   267     SetRect(aRect);
       
   268 	iConeBackgroundTestText = KConeBackgroundTestText().AllocL();
       
   269 	}
       
   270 /**
       
   271   Draws the CConeBackgroundTestControl object.\n
       
   272   Gets a pointer to the Windows Graphic context.
       
   273   Sets the pen colour,pen style and brush style settings.\n
       
   274   Draws the control using DrawRect function of the Graphics context.\n
       
   275 */
       
   276 void CConeBackgroundTestControl::Draw(const TRect& /*aRect*/) const
       
   277 	{
       
   278 	CWindowGc& gc = SystemGc();
       
   279 	TRect      drawRect = Rect();
       
   280 	
       
   281 	drawRect.Shrink(2*drawRect.Width()/5, 2*drawRect.Width()/5);
       
   282 	
       
   283 	gc.SetPenStyle(CGraphicsContext::ENullPen);
       
   284 	gc.SetBrushColor(TRgb(0x000000));
       
   285 	gc.SetBrushStyle(CGraphicsContext::EDiamondCrossHatchBrush);
       
   286 	gc.DrawRect(drawRect);
       
   287 	}
       
   288 
       
   289 //
       
   290 //
       
   291 // CConeBackgroundTestDrawer0
       
   292 //
       
   293 //
       
   294 /**
       
   295   Instantiates a CConeBackgroundTestDrawer0 object.\n
       
   296 */
       
   297 CConeBackgroundTestDrawer0* CConeBackgroundTestDrawer0::NewL()
       
   298 	{
       
   299 	CConeBackgroundTestDrawer0* self = new (ELeave) CConeBackgroundTestDrawer0();
       
   300 	return self;
       
   301 	}
       
   302 /**
       
   303   Sets the iBgStyle, indicating background style for Drawing to aStyle.\n
       
   304 */
       
   305 void CConeBackgroundTestDrawer0::SetBgStyle(int aStyle)
       
   306 	{
       
   307 	if (aStyle >= 0 && aStyle < 4)
       
   308 		iBgStyle = aStyle;
       
   309 	}
       
   310 /**
       
   311   Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
       
   312   Sets the background style for Drawing.\n
       
   313   1. if aStyle is zero , the brush style is EVerticalHatchBrush.\n
       
   314   2. if aStyle is one , the brush style is EForwardDiagonalHatchBrush.\n
       
   315   3. if aStyle is two , the brush style is EHorizontalHatchBrush.\n
       
   316   4. if aStyle is three , the brush style is ERearwardDiagonalHatchBrush.\n
       
   317   Sets the brush colour to Red and paints the top left part of the control.\n
       
   318   Sets the brush colour and points the bottom right part of the control.\n
       
   319 */
       
   320 void CConeBackgroundTestDrawer0::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
       
   321 	{
       
   322 	aGc.SetPenStyle(CGraphicsContext::ENullPen);
       
   323 	aGc.SetBrushColor(TRgb(0xffffff));
       
   324 	aGc.Clear();
       
   325 
       
   326 	switch (iBgStyle)
       
   327 		{
       
   328 		case 0:
       
   329 			aGc.SetBrushStyle(CGraphicsContext::EVerticalHatchBrush);
       
   330 			break;
       
   331 			
       
   332 		case 1:
       
   333 			aGc.SetBrushStyle(CGraphicsContext::EForwardDiagonalHatchBrush);
       
   334 			break;
       
   335 			
       
   336 		case 2:
       
   337 			aGc.SetBrushStyle(CGraphicsContext::EHorizontalHatchBrush);
       
   338 			break;
       
   339 			
       
   340 		case 3:
       
   341 			aGc.SetBrushStyle(CGraphicsContext::ERearwardDiagonalHatchBrush);
       
   342 			break;
       
   343 		}
       
   344 
       
   345 	aGc.SetPenColor(TRgb(0xff0000));
       
   346 	aGc.DrawRect(aRect);
       
   347 	
       
   348 	TRect tlRect = aRect;
       
   349 	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
       
   350 	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
       
   351 	
       
   352 	aGc.SetBrushColor(TRgb(0xff00ff));
       
   353 	aGc.DrawRect(tlRect);
       
   354 	
       
   355 	TRect brRect = tlRect;
       
   356 	brRect.Move(tlRect.Width(), tlRect.Height());
       
   357 	aGc.SetBrushColor(TRgb(0x00ff00));
       
   358 	aGc.DrawRect(brRect);
       
   359 	}
       
   360 
       
   361 //
       
   362 //
       
   363 // CConeBackgroundTestDrawer1
       
   364 //
       
   365 //
       
   366 /**
       
   367   Instantiates a CConeBackgroundTestDrawer1 object.\n
       
   368   
       
   369   @return : Pointer to CConeBackgroundTestDrawer1 object.\n
       
   370 */
       
   371 CConeBackgroundTestDrawer1* CConeBackgroundTestDrawer1::NewL()
       
   372 	{
       
   373 	CConeBackgroundTestDrawer1* self = new (ELeave) CConeBackgroundTestDrawer1();
       
   374 	return self;
       
   375 	}
       
   376 /**
       
   377   Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
       
   378   Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
       
   379   Sets the brush colour to Red and paints the top left part of the control.\n
       
   380   Sets the brush colour and points the bottom right part of the control.\n
       
   381 */
       
   382 void CConeBackgroundTestDrawer1::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
       
   383 	{
       
   384 	
       
   385 	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   386 	aGc.SetPenStyle(CGraphicsContext::ENullPen);
       
   387 	
       
   388 	TRect tlRect = aRect;
       
   389 	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
       
   390 	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
       
   391 	
       
   392 	aGc.SetBrushColor(TRgb(0xff0000));
       
   393 	aGc.DrawRect(tlRect);
       
   394 	
       
   395 	TRect brRect = tlRect;
       
   396 	brRect.Move(tlRect.Width(), tlRect.Height());
       
   397 	aGc.SetBrushColor(TRgb(0x00ff00));
       
   398 	aGc.DrawRect(brRect);
       
   399 	}
       
   400 
       
   401 //
       
   402 //
       
   403 // CConeBackgroundTestDrawer2
       
   404 //
       
   405 //
       
   406 /**
       
   407   Instantiates a CConeBackgroundTestDrawer2 object.\n
       
   408   
       
   409   @return : Pointer to CConeBackgroundTestDrawer2 object.\n
       
   410 */
       
   411 CConeBackgroundTestDrawer2* CConeBackgroundTestDrawer2::NewL()
       
   412 	{
       
   413 	CConeBackgroundTestDrawer2* self = new (ELeave) CConeBackgroundTestDrawer2();
       
   414 	return self;
       
   415 	}
       
   416 /**
       
   417   Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
       
   418   Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
       
   419   Sets the brush colour to Blue and paints an ellipse on  the control.\n
       
   420 */
       
   421 void CConeBackgroundTestDrawer2::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
       
   422 	{
       
   423 	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
       
   424 	aGc.SetPenStyle(CGraphicsContext::ENullPen);
       
   425 	aGc.SetBrushColor(TRgb(0x0000ff));
       
   426 	aGc.DrawEllipse(aRect);
       
   427 	}
       
   428 
       
   429 //
       
   430 //
       
   431 // CConeBackgroundTestParentWithNoBg
       
   432 //
       
   433 //
       
   434 /**
       
   435   Creates a parent control with no support for background drawing.\n
       
   436   Calls second phase constructor of CConeBackgroundTestParentWithNoBg.\n
       
   437 */
       
   438 CConeBackgroundTestParentWithNoBg* CConeBackgroundTestParentWithNoBg::NewL(const CCoeControl& aParent, const TRect& aRect)
       
   439 	{
       
   440 	CConeBackgroundTestParentWithNoBg* self = new(ELeave) CConeBackgroundTestParentWithNoBg();
       
   441 	CleanupStack::PushL(self);
       
   442 	self->ConstructL(aParent, aRect);
       
   443 	CleanupStack::Pop();
       
   444 	return self;
       
   445 	}
       
   446 /**
       
   447   Destructor for CConeBackgroundTestParentWithNoBg class.\n
       
   448   Deletes the two child controls owned by the parent object.\n
       
   449 */
       
   450 CConeBackgroundTestParentWithNoBg::~CConeBackgroundTestParentWithNoBg()
       
   451 	{
       
   452 	delete iChildControl1;
       
   453 	delete iChildControl2;
       
   454 	}
       
   455 /**
       
   456   Returns the number of component controls contained by the parent control.\n
       
   457  
       
   458   @return 2.\n
       
   459 */
       
   460 TInt CConeBackgroundTestParentWithNoBg::CountComponentControls() const
       
   461 	{
       
   462 	return 2;
       
   463 	}
       
   464 /**
       
   465   Returns the component control at the index 'aIndex' .\n
       
   466   
       
   467   @return CCoeControl*, if aIndex is zero iChildControl1 is returned else iChildControl2.\n
       
   468 */	
       
   469 CCoeControl* CConeBackgroundTestParentWithNoBg::ComponentControl(TInt aIndex) const
       
   470 	{
       
   471 	return aIndex == 0 ? iChildControl1 : iChildControl2;
       
   472 	}
       
   473 /**
       
   474   Second phase constructor for CConeBackgroundTestParentWithNoBg class.\n
       
   475   Sets a container window for component control, if the container is a window-owning control.\n
       
   476   Creates two child controls, first one is placed at the top left while other is at the bottom right.\n
       
   477 */
       
   478 void CConeBackgroundTestParentWithNoBg::ConstructL(const CCoeControl& aParent, const TRect& aRect)
       
   479     {
       
   480     SetContainerWindowL(aParent);
       
   481     SetRect(aRect);
       
   482 	TRect tlRect = aRect;
       
   483 	tlRect.iBr.iX = (aRect.iBr.iX - aRect.iTl.iX)/2 + aRect.iTl.iX;
       
   484 	tlRect.iBr.iY = (aRect.iBr.iY - aRect.iTl.iY)/2 + aRect.iTl.iY;
       
   485 	iChildControl1 = CConeBackgroundTestControl::NewL(*this, tlRect);
       
   486 	TRect brRect = tlRect;
       
   487 	brRect.Move(tlRect.Width(), tlRect.Height());
       
   488 	iChildControl2 = CConeBackgroundTestControl::NewL(*this, brRect);
       
   489 	}
       
   490 /**
       
   491   Draw function for CConeBackgroundTestParentWithNoBg class.\n
       
   492 */
       
   493 void CConeBackgroundTestParentWithNoBg::Draw(const TRect& /*aRect*/) const
       
   494 	{
       
   495 	}
       
   496 
       
   497 //
       
   498 //
       
   499 // CConeBackgroundTestParentWithBg
       
   500 //
       
   501 //
       
   502 /**
       
   503   Constructor for CConeBackgroundTestParentWithBg class.\n
       
   504   Initializes the drawer class and Dummy control member variables.\n
       
   505 */
       
   506 CConeBackgroundTestParentWithBg::CConeBackgroundTestParentWithBg(CConeBackgroundTestDrawer* aDrawer, TBool aUseDummyCtrl) :
       
   507 	iUseDummyCtrl(aUseDummyCtrl),
       
   508 	iBgDrawer(aDrawer)
       
   509 	{
       
   510 	}
       
   511 /**
       
   512   Creates a parent control with support for background drawing.\n
       
   513   Calls second phase constructor of CConeBackgroundTestParentWithBg.\n
       
   514 */
       
   515 CConeBackgroundTestParentWithBg* CConeBackgroundTestParentWithBg::NewL(const CCoeControl& aParent, const TRect& aRect,
       
   516 												 CConeBackgroundTestDrawer* aDrawer, TBool aUseDummyCtrl)
       
   517 	{
       
   518 	CConeBackgroundTestParentWithBg* self = new(ELeave) CConeBackgroundTestParentWithBg(aDrawer, aUseDummyCtrl);
       
   519 	CleanupStack::PushL(self);
       
   520 	self->ConstructL(aParent, aRect);
       
   521 	CleanupStack::Pop();
       
   522 	return self;
       
   523 	}
       
   524 /**
       
   525   The control with background drawing is set as secondary control.\n
       
   526   This creates a scenario of both parent and child controls supporting background drawing.\n
       
   527 */	
       
   528 void CConeBackgroundTestParentWithBg::SetSecondary(CCoeControl* aSecondary)
       
   529 	{
       
   530 	delete iSecondary;
       
   531 	iSecondary = aSecondary;
       
   532 	}
       
   533 /**
       
   534   Destructor for CConeBackgroundTestParentWithBg class.\n
       
   535   Deletes the child control and drawer class owned by the parent object.\n
       
   536 */
       
   537 CConeBackgroundTestParentWithBg::~CConeBackgroundTestParentWithBg()
       
   538 	{
       
   539 	delete iChildControl;
       
   540 	delete iSecondary;
       
   541 	delete iBgDrawer;
       
   542 	}
       
   543 /**
       
   544   Returns the number of component controls contained by the parent control.\n
       
   545  
       
   546   @return if iSecondary then 2 else 1.\n
       
   547 */
       
   548 TInt CConeBackgroundTestParentWithBg::CountComponentControls() const
       
   549 	{
       
   550 	return iSecondary ? 2 : 1;
       
   551 	}
       
   552 /**
       
   553   Returns the component control at the index 'aIndex' .\n
       
   554   
       
   555   @return CCoeControl*, if aIndex is zero iChildControl1 is returned else iSecondary.\n
       
   556 */	
       
   557 CCoeControl* CConeBackgroundTestParentWithBg::ComponentControl(TInt aIndex) const
       
   558 	{
       
   559 	return aIndex ? iSecondary : iChildControl;
       
   560 	}
       
   561 /**
       
   562   Second phase constructor for CConeBackgroundTestParentWithBg class.\n
       
   563   Sets the control's container window.\n
       
   564   Sets the control's extent, specifying a TRect.\n
       
   565   if the dummycontrol is ETrue, then CConeBackgroundTestParentWithNoBg object is instantiated as child control,\n
       
   566   else CConeBackgroundTestControl object is used.\n
       
   567   iBgDrawer object is set as the object responsible for drawing control's background.\n
       
   568 */
       
   569 void CConeBackgroundTestParentWithBg::ConstructL(const CCoeControl& aParent, const TRect& aRect)
       
   570     {
       
   571     SetContainerWindowL(aParent);
       
   572     SetRect(aRect);
       
   573     if (iUseDummyCtrl)
       
   574     	iChildControl = CConeBackgroundTestParentWithNoBg::NewL(*this, aRect);
       
   575     else
       
   576 		iChildControl = CConeBackgroundTestControl::NewL(*this, aRect);
       
   577 
       
   578 	SetBackground(iBgDrawer);
       
   579 	}
       
   580 /**
       
   581   Draw function for CConeBackgroundTestParentWithBg Class.\n
       
   582   Does Nothing.\n
       
   583 */
       
   584 void CConeBackgroundTestParentWithBg::Draw(const TRect& /*aRect*/) const
       
   585 	{
       
   586 	}
       
   587 
       
   588 //
       
   589 //
       
   590 // CConeBackgroundTestParentWindowOwning
       
   591 //
       
   592 //
       
   593 
       
   594 CConeBackgroundTestParentWindowOwning::CConeBackgroundTestParentWindowOwning(CConeBackgroundTestDrawer* aDrawer) :
       
   595 	iBgDrawer(aDrawer)
       
   596 	{
       
   597 	}
       
   598 
       
   599 CConeBackgroundTestParentWindowOwning* CConeBackgroundTestParentWindowOwning::NewL(const CCoeControl& aParent, const TRect& aRect,
       
   600 												 CConeBackgroundTestDrawer* aDrawer)
       
   601 	{
       
   602 	CConeBackgroundTestParentWindowOwning* self = new(ELeave) CConeBackgroundTestParentWindowOwning(aDrawer);
       
   603 	CleanupStack::PushL(self);
       
   604 	self->ConstructL(aParent, aRect);
       
   605 	CleanupStack::Pop();
       
   606 	return self;
       
   607 	}
       
   608 
       
   609 CConeBackgroundTestParentWindowOwning::~CConeBackgroundTestParentWindowOwning()
       
   610 	{
       
   611 	delete iChildControl;
       
   612 	delete iBgDrawer;
       
   613 	}
       
   614 
       
   615 CCoeControl* CConeBackgroundTestParentWindowOwning::ComponentControl(TInt aIndex) const
       
   616 	{
       
   617 	if (!aIndex)
       
   618 		return iChildControl;
       
   619 	else
       
   620 		return NULL;
       
   621 	}
       
   622 	
       
   623 TInt CConeBackgroundTestParentWindowOwning::CountComponentControls() const
       
   624 	{
       
   625 	return 1;
       
   626 	}
       
   627 		
       
   628 void CConeBackgroundTestParentWindowOwning::ConstructL(const CCoeControl& aParent, const TRect& aRect)
       
   629     {
       
   630     CreateWindowL(&aParent);
       
   631     SetRect(aRect);
       
   632     iChildControl = CConeBackgroundTestNonWindowOwningControl::NewL(*this, aRect);
       
   633     SetBackground(iBgDrawer);
       
   634 	}
       
   635 
       
   636 void CConeBackgroundTestParentWindowOwning::Draw(const TRect& aRect) const
       
   637 	{
       
   638 	CWindowGc& aGc = SystemGc();
       
   639 	aGc.SetBrushStyle(CGraphicsContext::ERearwardDiagonalHatchBrush);
       
   640 	aGc.SetPenStyle(CGraphicsContext::ENullPen);
       
   641 	
       
   642 	TRect tlRect = aRect;
       
   643 	tlRect.iBr.iX = (tlRect.iBr.iX - tlRect.iTl.iX)/2 + tlRect.iTl.iX;
       
   644 	tlRect.iBr.iY = (tlRect.iBr.iY - tlRect.iTl.iY)/2 + tlRect.iTl.iY;
       
   645 	
       
   646 	aGc.SetBrushColor(TRgb(0xff0000)); //blue, to be changed or removed
       
   647 	aGc.DrawRect(tlRect);
       
   648 	
       
   649 	TRect brRect = tlRect;
       
   650 	brRect.Move(tlRect.Width(), tlRect.Height());
       
   651 	aGc.SetBrushColor(TRgb(0xffffff)); //white , to be changed or removed
       
   652 	aGc.DrawRect(brRect);
       
   653 	}
       
   654 
       
   655 //
       
   656 //
       
   657 // CConeBackgroundTestNonWindowOwningControl
       
   658 //
       
   659 //
       
   660 
       
   661 CConeBackgroundTestNonWindowOwningControl::CConeBackgroundTestNonWindowOwningControl()
       
   662 	{
       
   663 	}
       
   664 
       
   665 CConeBackgroundTestNonWindowOwningControl* CConeBackgroundTestNonWindowOwningControl::NewL(const CCoeControl& aParent, const TRect& aRect)
       
   666 	{
       
   667 	CConeBackgroundTestNonWindowOwningControl* self = new(ELeave) CConeBackgroundTestNonWindowOwningControl();
       
   668 	CleanupStack::PushL(self);
       
   669 	self->ConstructL(aParent, aRect);
       
   670 	CleanupStack::Pop();
       
   671 	return self;
       
   672 	}
       
   673 
       
   674 CConeBackgroundTestNonWindowOwningControl::~CConeBackgroundTestNonWindowOwningControl()
       
   675 	{
       
   676 	}
       
   677 
       
   678 void CConeBackgroundTestNonWindowOwningControl::ConstructL(const CCoeControl& aParent, const TRect& aRect)
       
   679     {
       
   680     SetContainerWindowL(aParent);
       
   681     SetRect(aRect);
       
   682 	}
       
   683 
       
   684 void CConeBackgroundTestNonWindowOwningControl::Draw(const TRect& /*aRect*/) const /*needs to be customised*/
       
   685 	{
       
   686 	CWindowGc& gc = SystemGc();
       
   687 	TRect      drawRect = Rect();
       
   688 	
       
   689 	drawRect.Shrink(2*drawRect.Width()/5, 2*drawRect.Width()/5);
       
   690 	
       
   691 	gc.SetPenStyle(CGraphicsContext::ENullPen);
       
   692 	gc.SetBrushStyle(CGraphicsContext::EDiamondCrossHatchBrush);
       
   693 	gc.SetBrushColor(TRgb(0x00ff00));
       
   694 	gc.DrawRect(drawRect);
       
   695 	}
       
   696 
       
   697 //
       
   698 //
       
   699 // CConeBackgroundTestView
       
   700 //
       
   701 //
       
   702 /**
       
   703   Constructor for CConeBackgroundTestView Class.\n
       
   704 */
       
   705 CConeBackgroundTestView::CConeBackgroundTestView()
       
   706 	{
       
   707 	}
       
   708 /**
       
   709   The static function is used to create a CConeBackgroundTestView object.\n
       
   710   Creates a new CConeBackgroundTestView object and calls the second phase constructor.\n
       
   711 */ 
       
   712 CConeBackgroundTestView* CConeBackgroundTestView::NewL()
       
   713 	{
       
   714 	CConeBackgroundTestView* self = new(ELeave) CConeBackgroundTestView();
       
   715 	CleanupStack::PushL(self);
       
   716 	self->ConstructL();
       
   717 	CleanupStack::Pop();
       
   718 	return self;
       
   719 	}
       
   720 
       
   721 /**
       
   722   Destructor for CConeBackgroundTestView Class.\n
       
   723   Deletes the child controls and the drawer object.\n
       
   724 */
       
   725 CConeBackgroundTestView::~CConeBackgroundTestView()
       
   726 	{
       
   727 	delete iControl;
       
   728 	delete iBgDrawer;
       
   729 	}
       
   730 /**
       
   731   Returns the number of component controls contained by the parent control.\n
       
   732  
       
   733   @return 1.\n
       
   734 */
       
   735     
       
   736 TInt CConeBackgroundTestView::CountComponentControls() const
       
   737 	{
       
   738 	return 1;
       
   739 	}
       
   740 /**
       
   741   Returns the component control at the index 'aIndex' .\n
       
   742   
       
   743   @return iControl.\n
       
   744 */
       
   745 CCoeControl* CConeBackgroundTestView::ComponentControl(TInt /*aIndex*/) const
       
   746 	{
       
   747 	return iControl;
       
   748 	}
       
   749 /**
       
   750   @SYMTestCaseID UIF-TConeBackground-Test1L
       
   751  
       
   752   @SYMPREQ
       
   753  
       
   754   @SYMTestCaseDesc 
       
   755  
       
   756   @SYMTestPriority High
       
   757  
       
   758   @SYMTestStatus Implemented
       
   759   
       
   760   @SYMTestActions : Sets the background brush style to EVerticalHatchBrush.\n
       
   761   Instantiates a parent control (CConeBackgroundTestParent) which has capability of background drawing.\n
       
   762   Activates the Parent control.\n
       
   763   Invokes the DrawNow function for the View class which calls Draw() on the control itself,\n
       
   764   and also on all its component controls.\n.
       
   765   
       
   766   @SYMTestExpectedResults : The draw should complete with out any error.\n
       
   767  
       
   768   @SYMTestType : CIT
       
   769 */
       
   770 void CConeBackgroundTestView::Test1L()
       
   771 	{
       
   772 	delete iControl;
       
   773 	iControl = 0;
       
   774 
       
   775 	iBgDrawer->SetBgStyle(1);
       
   776 	iControl = CConeBackgroundTestParentWithBg::NewL(*this, Rect(),
       
   777 				CConeBackgroundTestDrawer1::NewL(), ETrue);
       
   778 	
       
   779 	iControl->ActivateL();
       
   780 	DrawNow();
       
   781 	}
       
   782 /**
       
   783   @SYMTestCaseID UIF-TConeBackground-Test2L
       
   784  
       
   785   @SYMPREQ
       
   786  
       
   787   @SYMTestCaseDesc Tests MCoeControlBackground when both parent and child
       
   788   controls support background drawing.\n
       
   789  
       
   790   @SYMTestPriority High
       
   791  
       
   792   @SYMTestStatus Implemented
       
   793   
       
   794   @SYMTestActions : Sets the background brush style to EVerticalHatchBrush.\n
       
   795   Instantiates a parent control (CConeBackgroundTestParent) which has capability of background drawing.\n
       
   796   Activates the Parent control.\n
       
   797   Also instantiates a secondary control of class CConeBackgroundTestParentWithBg.\n
       
   798   This test enables testing of the MCoeControlBackground interface when both parent and child controls \n
       
   799   are background drawing supported controls.\n
       
   800   Invokes the DrawNow function for the View class which calls Draw() on the control itself,\n
       
   801   and also on all its component controls.\n
       
   802   
       
   803   @SYMTestExpectedResults : The draw should complete with out any error.\n
       
   804  
       
   805   @SYMTestType : CIT
       
   806 */
       
   807 void CConeBackgroundTestView::Test2L()
       
   808 	{
       
   809 	delete iControl;
       
   810 	iControl = 0;
       
   811 
       
   812 	iBgDrawer->SetBgStyle(2);
       
   813 	iControl = CConeBackgroundTestParentWithBg::NewL(*this, Rect(),
       
   814 				CConeBackgroundTestDrawer1::NewL(), EFalse);
       
   815 	TRect rect = Rect();
       
   816 	rect.Shrink(rect.Width()/8, rect.Height()/8);
       
   817 	CCoeControl* temp = CConeBackgroundTestParentWithBg::NewL(*iControl, rect, CConeBackgroundTestDrawer2::NewL());
       
   818 	static_cast<CConeBackgroundTestParentWithBg*>(iControl)->SetSecondary(temp);
       
   819 	iControl->ActivateL();
       
   820 	DrawNow();
       
   821 	}
       
   822 /**
       
   823   @SYMTestCaseID UIF-TConeBackground-Test3L
       
   824  
       
   825   @SYMPREQ
       
   826  
       
   827   @SYMTestCaseDesc Tests MCoeControlBackground when a parent control has two 
       
   828   child controls,one supporting background drawing and the other without that support.\n
       
   829  
       
   830   @SYMTestPriority High
       
   831  
       
   832   @SYMTestStatus Implemented
       
   833   
       
   834   @SYMTestActions : Sets the background brush style to EVerticalHatchBrush.\n
       
   835   Instantiates a parent control (CConeBackgroundTestParent) which has capability of background drawing.\n
       
   836   Activates the Parent control.\n
       
   837   Also instantiates a secondary control of class CConeBackgroundTestParentWithBg.\n
       
   838   Later a third control without background drawing is instantiated.\n
       
   839   Thus a scenario of parent control containing child controls with and without background drawing support
       
   840   is created and tested.\n
       
   841   Invokes the DrawNow function for the View class which calls Draw() on the control itself,\n
       
   842   and also on all its component controls.\n
       
   843   
       
   844   @SYMTestExpectedResults : The draw should complete with out any error.\n
       
   845  
       
   846   @SYMTestType : CIT
       
   847 */
       
   848 void CConeBackgroundTestView::Test3L()
       
   849 	{
       
   850 	delete iControl;
       
   851 	iControl = 0;
       
   852 
       
   853 	iBgDrawer->SetBgStyle(3);
       
   854 	iControl = CConeBackgroundTestParentWithBg::NewL(*this, Rect(),
       
   855 				CConeBackgroundTestDrawer1::NewL(), ETrue);
       
   856 	TRect rect = Rect();
       
   857 	rect.Shrink(rect.Width()/8, rect.Height()/8);
       
   858 	CCoeControl* temp = CConeBackgroundTestParentWithBg::NewL(*iControl, rect, CConeBackgroundTestDrawer2::NewL());
       
   859 	static_cast<CConeBackgroundTestParentWithBg*>(iControl)->SetSecondary(temp);
       
   860 	iControl->ActivateL();
       
   861 	DrawNow();
       
   862 	}
       
   863 
       
   864 /**
       
   865   @SYMTestCaseID UIF-TConeBackground-Test4L
       
   866  
       
   867   @SYMDEF PDEF112327
       
   868  
       
   869   @SYMTestCaseDesc Tests MCoeControlBackground, when a parent window owning control has one 
       
   870   child control not supporting background drawing and non window owning.\n
       
   871  
       
   872   @SYMTestPriority Critical
       
   873  
       
   874   @SYMTestStatus Implemented
       
   875   
       
   876   @SYMTestActions : Sets the background draw style.\n
       
   877   Instantiates a parent control (CConeBackgroundTestParent) which has capability of background drawing.\n
       
   878   After a new screen device has been instantiated,instantiates a second graphics context and assigns it to the child control.\n
       
   879   Thus a scenario of parent control and child control with different graphics context is created and tested.\n
       
   880   Activates the parent and child control\n
       
   881   Invokes the DrawNow function for the NonWindowOwningControl class which results in calling Draw() and DrawComponets() on the parent control itself.\n 
       
   882   
       
   883   @SYMTestType Manual
       
   884   @SYMTestExpectedResults : The background drawing should use the parent graphics context. \n
       
   885   All the test code does is to exercise the defect fix and thus the draw should complete without any error.\n
       
   886   */
       
   887 void CConeBackgroundTestView::Test4L()
       
   888 	{
       
   889 	delete iControl;
       
   890 	iControl = 0;
       
   891 	
       
   892 	iBgDrawer->SetBgStyle(1);
       
   893 	iControl = CConeBackgroundTestParentWindowOwning::NewL(*this, Rect(),
       
   894 				CConeBackgroundTestDrawer2::NewL());
       
   895 	
       
   896 	// create a new Gc
       
   897 	CWsScreenDevice* screenDevice = new (ELeave) CWsScreenDevice((iControl->ControlEnv())->WsSession()); 
       
   898 	CleanupStack::PushL(screenDevice);
       
   899 	User::LeaveIfError(screenDevice->Construct());
       
   900 	
       
   901 	CWindowGc* gc=new(ELeave) CWindowGc(screenDevice);
       
   902 	CleanupStack::PushL(gc);
       
   903 	User::LeaveIfError(gc->Construct());
       
   904 	
       
   905 	gc->Activate(Window());
       
   906 	(iControl->ComponentControl(0))->SetCustomGc(gc);
       
   907 	gc->Deactivate();
       
   908 	
       
   909 	TSize rectSize(90,200);
       
   910 	iControl->SetSize(rectSize);
       
   911 	(iControl->ComponentControl(0))->SetSize(rectSize);
       
   912 	
       
   913 	iControl->ActivateL();
       
   914 	(iControl->ComponentControl(0))->ActivateL();
       
   915 	(iControl->ComponentControl(0))->DrawNow(); 
       
   916 	
       
   917 	CleanupStack::PopAndDestroy(gc);
       
   918 	CleanupStack::PopAndDestroy(screenDevice);
       
   919 	}
       
   920 
       
   921 /**
       
   922   Second phase constructor for CConeBackgroundTestView Class.\n
       
   923   Creates a Window for the View.\n
       
   924   Creates a parent control with background support.\n
       
   925   The parent control is activated.\n
       
   926 */
       
   927 void CConeBackgroundTestView::ConstructL()
       
   928     {
       
   929 	CreateWindowL();
       
   930 	iControl = CConeBackgroundTestParentWithBg::NewL(*this, Rect(), CConeBackgroundTestDrawer1::NewL());
       
   931 
       
   932 	iBgDrawer = CConeBackgroundTestDrawer0::NewL();
       
   933 	SetBackground(iBgDrawer);
       
   934 	ActivateL();
       
   935 	}
       
   936 /**
       
   937   Draw function for CConeBackgroundTestView class.\n
       
   938   Does Nothing.\n
       
   939 */ 
       
   940 void CConeBackgroundTestView::Draw(const TRect& /*aRect*/) const
       
   941 	{
       
   942 	}
       
   943 
       
   944 //
       
   945 //
       
   946 // CConeBackgroundTestAppUi
       
   947 //
       
   948 //
       
   949 /**
       
   950   Constructor for CConeBackgroundTestAppUi class.\n
       
   951   Sets the Test step Name.\n
       
   952 */
       
   953 CConeBackgroundTestAppUi::CConeBackgroundTestAppUi(CTmsTestStep* aStep) :
       
   954 CTestCoeAppUi(aStep)
       
   955 {}
       
   956 /**
       
   957   Destructor for CConeBackgroundTestAppUi class.\n
       
   958   Deletes the view.\n
       
   959 */
       
   960 CConeBackgroundTestAppUi::~CConeBackgroundTestAppUi()
       
   961 	{
       
   962 	delete iView;
       
   963 	}
       
   964 
       
   965 /**
       
   966   Second phase constructor for the CConeBackgroundTestAppUi class.\n
       
   967   Invokes the base class CTestCoeAppUi ConstructL function.\n
       
   968   Creates a View.\n
       
   969   Starts the asynchronous execution of tests using Auto test manager.\n
       
   970 */ 
       
   971 void CConeBackgroundTestAppUi::ConstructL()
       
   972 	{
       
   973 	CTestCoeAppUi::ConstructL();
       
   974 	
       
   975 	iView = CConeBackgroundTestView::NewL();
       
   976 	
       
   977 	AutoTestManager().StartAutoTest();
       
   978 	}
       
   979 /**
       
   980   Auxilliary Function for all test cases.\n
       
   981   This function is iteratively called by the RunL function of the Autotestmanager
       
   982   asynchronously.\n
       
   983   Calls the following function\n
       
   984   1. CConeBackgroundTestView::Test1L() - Tests .\n
       
   985   2. CConeBackgroundTestView::Test2L().\n
       
   986   3. CConeBackgroundTestView::Test3L().\n
       
   987 */	
       
   988 void CConeBackgroundTestAppUi::RunTestStepL(TInt aStepNum)
       
   989 	{
       
   990 
       
   991 	User::After(TTimeIntervalMicroSeconds32(1000000));
       
   992 	
       
   993 	TInt err;
       
   994 
       
   995 	switch(aStepNum)
       
   996 		{
       
   997 		case 1:
       
   998 			SetTestStepID(_L("UIF-TConeBackground-Test1L"));
       
   999 			INFO_PRINTF1(_L("Parent control supports background drawing"));
       
  1000 			TRAP(err, iView->Test1L());
       
  1001 			TEST(err==KErrNone);
       
  1002 			RecordTestResultL();
       
  1003 			break;
       
  1004 		case 2:
       
  1005 			SetTestStepID(_L("UIF-TConeBackground-Test2L"));
       
  1006 			INFO_PRINTF1(_L("Parent control and child control support background drawing"));
       
  1007 			TRAP(err, iView->Test2L());
       
  1008 			TEST(err==KErrNone);
       
  1009 			RecordTestResultL();
       
  1010 			break;
       
  1011 		case 3:
       
  1012 			SetTestStepID(_L("UIF-TConeBackground-Test3L"));
       
  1013 			INFO_PRINTF1(_L("Parent control contains child controls with and without background drawing support"));
       
  1014 			TRAP(err, iView->Test3L());
       
  1015 			TEST(err==KErrNone);
       
  1016 			RecordTestResultL();
       
  1017 			break;
       
  1018 		case 4:
       
  1019 			SetTestStepID(_L("UIF-TConeBackground-Test4L"));
       
  1020 			INFO_PRINTF1(_L("Parent control contains child control with different Graphics Context."));
       
  1021 			TRAP(err, iView->Test4L());
       
  1022 			TEST(err==KErrNone);
       
  1023 			RecordTestResultL();
       
  1024 			CloseTMSGraphicsStep();
       
  1025 			break;
       
  1026 		case 5:
       
  1027 			AutoTestManager().FinishAllTestCases(CAutoTestManager::EPass);
       
  1028 			break;
       
  1029 		}
       
  1030 	}
       
  1031 
       
  1032 //
       
  1033 //
       
  1034 // CConeBackgroundTestStep
       
  1035 //
       
  1036 //
       
  1037 /**
       
  1038   Completes the construction of the Control Environment(CCoeEnv object).\n
       
  1039   Instantiates the CCone6TestAppUi class which serves as a AppUi class.\n
       
  1040   Sets the CCone6TestAppUi object as the application's user interface object.\n
       
  1041   Invokes the second phase constructor of the application's UI.\n
       
  1042 */
       
  1043 void CTConeBackgroundStep::ConstructAppL(CCoeEnv* aCoe)
       
  1044 	{ // runs inside a TRAP harness
       
  1045 	aCoe->ConstructL();
       
  1046 	CConeBackgroundTestAppUi* appUi= new (ELeave) CConeBackgroundTestAppUi(this);
       
  1047 	aCoe->SetAppUi(appUi);
       
  1048 	appUi->ConstructL();
       
  1049 	}
       
  1050 /**
       
  1051   Constructor for CTConeBackgroundStep class.\n
       
  1052   Sets the test step name.\n
       
  1053 */
       
  1054 CTConeBackgroundStep::CTConeBackgroundStep()
       
  1055 	{
       
  1056 	SetTestStepName(KTBackgroundStep);
       
  1057 	}
       
  1058 /**
       
  1059   Destructor for CTConeBackgroundStep class.\n
       
  1060 */
       
  1061 CTConeBackgroundStep::~CTConeBackgroundStep()
       
  1062 {}
       
  1063 
       
  1064 /**
       
  1065   Entry function for CTConeBackGround Test Step.\n
       
  1066   Sets up the control environment.\n
       
  1067   Constructs and Launches the CTCone5 Test application.\n
       
  1068 */
       
  1069 TVerdict CTConeBackgroundStep::doTestStepL() // main function called by E32
       
  1070 	{
       
  1071 	INFO_PRINTF1(_L("Test Started"));
       
  1072 	
       
  1073 	PreallocateHALBuffer();
       
  1074 
       
  1075 	__UHEAP_MARK;
       
  1076 
       
  1077 	CCoeEnv* coe=new(ELeave) CCoeEnv;
       
  1078 	TRAPD(err,ConstructAppL(coe));
       
  1079 
       
  1080 	if (!err)
       
  1081 		coe->ExecuteD();
       
  1082 	else
       
  1083 		{
       
  1084 		SetTestStepResult(EFail);
       
  1085 		delete coe;
       
  1086 		}
       
  1087 
       
  1088 	REComSession::FinalClose();	
       
  1089 
       
  1090 	__UHEAP_MARKEND;
       
  1091 
       
  1092 	INFO_PRINTF1(_L("Test Finished"));
       
  1093 	return TestStepResult();
       
  1094 	}
       
  1095 
       
  1096 
       
  1097 
       
  1098 
       
  1099 
       
  1100