os/graphics/windowing/windowserver/test/tauto/TREDRAW.CPP
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     1 // Copyright (c) 1996-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 // Window redraw/validate/invalidate tests
    15 // 
    16 //
    17 
    18 /**
    19  @file
    20  @test
    21  @internalComponent - Internal Symbian test code
    22 */
    23 
    24 #include "TREDRAW.H"
    25 
    26 LOCAL_D TSize FullScreenModeSize;
    27 
    28 const TRgb KRed = TRgb(255,0,0);
    29 const TRgb KBlack = TRgb(0,0,0);
    30 const TRgb KWhite = TRgb(255,255,255);
    31 const TRgb KTransBisque = TRgb(255,228,196,128);
    32 const TRgb KTransLightSalmon = TRgb(255,160,122,128);
    33 const TRgb KLightSteelBlue = TRgb(176,196,222);
    34 const TRgb KCadetBlue = TRgb(95,158,160);
    35 
    36 TInt CTRedrawOrderWindow::iRedrawNumber=0;
    37 
    38 #define InvalidRegionLogging
    39 #if defined(InvalidRegionLogging)
    40 #define BLOG_MESSAGE(p) (const_cast<CTRedrawTest*>(&iGraphicsTest))->LogMessage(((TText8*)__FILE__), __LINE__,(p))
    41 #endif
    42 
    43 //
    44 //  //
    45 //
    46 
    47 CTCheckDefectWin* CTCheckDefectWin::NewL(TPoint aPos,TSize aWinSize)
    48 	{
    49 	CTCheckDefectWin* win=new(ELeave) CTCheckDefectWin;
    50 	win->ConstructExtLD(*TheClient->iGroup,aPos,aWinSize);
    51 	win->BaseWin()->SetRequiredDisplayMode(EColor256);
    52 	win->AssignGC(*TheClient->iGc);
    53 	win->BaseWin()->SetShadowDisabled(ETrue);
    54 	win->BaseWin()->SetShadowHeight(0);
    55 	TheClient->Flush();
    56 	return win;
    57 	}
    58 
    59 CRedrawWindow::CRedrawWindow(CTRedrawTest *aTest) : CTWin(), iTest(aTest)
    60 	{
    61 	}
    62 
    63 CRedrawWindow::~CRedrawWindow()
    64 	{
    65 	iInvalid.Close();
    66 	}
    67 
    68 void CRedrawWindow::Draw()
    69 	{
    70 	ReceivedDrawRequest();
    71 	DrawPattern(iTest->WinContent());
    72 	}
    73 
    74 void CRedrawWindow::ReceivedDrawRequest()
    75 	{
    76 	iDrawRequests++;
    77 	}
    78 
    79 TInt CRedrawWindow::DrawRequests() const
    80 	{
    81 	return iDrawRequests;
    82 	}
    83 
    84 void CRedrawWindow::DrawPattern(TInt aPattern)
    85 	{
    86 	iGc->Clear();
    87 	TPoint drawBase(-10,-20);
    88 	TSize drawSize(iSize.iWidth-2*drawBase.iX,iSize.iHeight-2*drawBase.iY);
    89 	TPoint offset=drawBase+iOffset;
    90 	switch(aPattern)
    91 		{
    92 		case EDrawGraphPaperlHatched:
    93 			{
    94 			iGc->DrawRect(TRect(drawBase,drawBase+drawSize));
    95 			iGc->SetPenColor(TRgb(85,85,85));
    96 			iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
    97 			TInt xpos;
    98 			for(xpos=0;xpos<drawSize.iWidth;xpos+=15)
    99 				iGc->DrawLine(TPoint(xpos,0)+offset,TPoint(xpos,drawSize.iHeight)+offset);
   100 			TInt ypos;
   101 			for(ypos=0;ypos<drawSize.iHeight;ypos+=15)
   102 				iGc->DrawLine(TPoint(0,ypos)+offset,TPoint(drawSize.iWidth,ypos)+offset);
   103 			break;
   104 			}
   105 		case EDrawSlantingHatched:
   106 			{
   107 			iGc->SetPenColor(TRgb(255,255,255));
   108 			iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
   109 			for(TInt xpos=0;xpos<drawSize.iWidth;xpos+=16)
   110 				{
   111 				iGc->DrawLine(TPoint(xpos,0)+offset,TPoint(drawSize.iWidth,xpos*drawSize.iHeight/drawSize.iWidth)+offset);
   112 				iGc->DrawLine(TPoint(xpos,0)+offset,TPoint(0,drawSize.iHeight-xpos*drawSize.iHeight/drawSize.iWidth)+offset);
   113 				iGc->DrawLine(TPoint(xpos,drawSize.iHeight)+offset,TPoint(drawSize.iWidth,drawSize.iHeight-xpos*drawSize.iHeight/drawSize.iWidth)+offset);
   114 				iGc->DrawLine(TPoint(xpos,drawSize.iHeight)+offset,TPoint(0,xpos*drawSize.iHeight/drawSize.iWidth)+offset);
   115 				}
   116 			}
   117 			break;
   118 		case EDrawCenteredRectangle:
   119 			{
   120 			TRect rect(5,iSize.iHeight/4,iSize.iWidth-5,iSize.iHeight/2);
   121 			iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
   122 			iGc->SetPenColor(TRgb(255,255,255));
   123 			iGc->DrawRect(rect);
   124 			}
   125 			break;
   126 		default:
   127 			// Other pattern values requested are ignored
   128 			break;
   129 		}
   130 	}
   131 
   132 void CRedrawWindow::Reset()
   133 	{
   134 	iOffset=TPoint(0,0);
   135 	iWin.Invalidate();
   136 	iInvalid.Clear();
   137 	}
   138 
   139 /**
   140  * Calculate the window region minus the region covered by the child
   141  * window; this is the "visible region"
   142  */
   143 void CRedrawWindow::VisibleRegion(RRegion &aRegion)
   144 	{
   145 	aRegion.Clear();
   146 	aRegion.AddRect(TRect(Size()));
   147 	TRect child;
   148 	child.iTl=Child()->BaseWin()->InquireOffset(iWin);
   149 	child.iBr=child.iTl+Child()->Size();
   150 	aRegion.SubRect(child);
   151 	}
   152 
   153 
   154 void CRedrawWindow::ValidateAndClear()
   155 	{
   156 	Win()->Invalidate();
   157 	Win()->BeginRedraw();
   158 	iGc->Activate(*Win());
   159 	iGc->Clear();
   160 	iGc->Deactivate();
   161 	Win()->EndRedraw();
   162 	}
   163 
   164 void CRedrawWindow::ActivateAndDraw(TInt aPattern, TRegion *aRegion)
   165 	{
   166 	iGc->Activate(*Win());
   167 	if (aRegion)
   168 		iGc->SetClippingRegion(*aRegion);
   169 	DrawPattern(aPattern);
   170 	iGc->Deactivate();
   171 	}
   172 
   173 CReferenceComparisonRedrawWindow::CReferenceComparisonRedrawWindow(CTRedrawTest *aTest) : CRedrawWindow(aTest)
   174 	{}
   175 
   176 /**
   177  * Prepare the invalid region.
   178  * 
   179  * Update the invalid region with a rectangle where such a rectangle is minus
   180  * any area covered by a child window.
   181  * 
   182  * @param aRect Rectangle to be added to the invalid region
   183  */
   184 void CReferenceComparisonRedrawWindow::PrepareInvalidation(const TRect &aRect)
   185 	{
   186 	RRegion clipped_visible;
   187 	VisibleRegion(clipped_visible);
   188 	clipped_visible.ClipRect(aRect);
   189 	iInvalid.Union(clipped_visible);
   190 	clipped_visible.Close();
   191 	iInvalid.Tidy();
   192 	}
   193 
   194 /**
   195  * Mop up all pending invalid regions and simulate a Draw().
   196  * 
   197  * Normally, we would rely on WServ to call this window's Draw() method
   198  * to obtain drawing operations to cover the currently invalid regions
   199  * of the window.
   200  * 
   201  * This method does that task by marking all invalid regions as clean and
   202  * then performs the drawing required in the invalid portions of the screen.
   203  * 
   204  * The purpose of this is to then allow a comparison to be made against a
   205  * different window which does rely on the WServ framework calling back
   206  * to do a Draw().
   207  * 
   208  * @post the window has no outstanding invalid regions
   209  */
   210 void CReferenceComparisonRedrawWindow::PerformInvalidation()
   211 	{
   212 	for(TInt index=0;index<iInvalid.Count();index++)
   213 		{
   214 		iWin.Invalidate(iInvalid[index]);
   215 		iWin.BeginRedraw(iInvalid[index]);
   216 		iWin.EndRedraw();
   217 		}
   218 	iWin.BeginRedraw(iInvalid.BoundingRect());
   219 	iGc->Activate(iWin);
   220 	iGc->SetClippingRegion(iInvalid);
   221 	DrawPattern(iTest->WinContent());
   222 	iGc->Deactivate();
   223 	iWin.EndRedraw();
   224 	}
   225 
   226 CRedrawWindow2::CRedrawWindow2(CTRedrawTest *aTest) : CRedrawWindow(aTest)
   227 	{
   228 	}
   229 
   230 void CRedrawWindow2::Draw()
   231 	{
   232 	ReceivedDrawRequest();
   233 	if (iClipped)
   234 		iGc->SetClippingRegion(iInvalid);
   235 	DrawPattern(iTest->WinContent());
   236 	if (iClipped)
   237 		iGc->CancelClippingRegion();
   238 	}
   239 
   240 /**
   241  * Prepare the invalid region.
   242  * @param aRect rectangle to be added to the invalid region
   243  */
   244 void CRedrawWindow2::PrepareInvalidation(const TRect &aRect)
   245 	{
   246 	iInvalid.Clear();
   247 	iInvalid.AddRect(aRect);
   248 	}
   249 
   250 /**
   251  * Perform invalidation by setting the window's invalid region.
   252  * 
   253  * The purpose of this method is to stimulate a call from WServ to the
   254  * Draw() method of this class.
   255  */
   256 void CRedrawWindow2::PerformInvalidation()
   257 	{
   258 	iWin.Invalidate(iInvalid.BoundingRect());
   259 	}
   260 
   261 void CRedrawWindow2::Reset()
   262 	{
   263 	CRedrawWindow::Reset();
   264 	iClipped=EFalse;
   265 	}
   266 
   267 CRedrawWindow3::CRedrawWindow3(CTRedrawTest *aTest) : CRedrawWindow(aTest)
   268 	{
   269 	}
   270 
   271 void CRedrawWindow3::Draw()
   272 	{
   273 	ReceivedDrawRequest();
   274 	iGc->Clear();
   275 	iGc->SetPenStyle(CGraphicsContext::ENullPen);
   276 	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   277 	iGc->SetBrushColor(TRgb(0,255,255));
   278 	iGc->DrawRect(TRect(TPoint(0,0),TSize(50,50)));
   279 	}
   280 
   281 void CRedrawWindow3::PrepareInvalidation(const TRect &aRect)
   282 	{
   283 	iInvalid.Clear();
   284 	iInvalid.AddRect(aRect);
   285 	}
   286 
   287 void CRedrawWindow3::PerformInvalidation()
   288 	{
   289 	iWin.Invalidate(iInvalid.BoundingRect());
   290 	}
   291 
   292 void CRedrawWindow3::SetUp1L(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
   293 	{
   294 	ConstructL(*parent);
   295 	SetExtL(pos,size);
   296 	AssignGC(aGc);
   297 	}
   298 
   299 void CRedrawWindow3::Redraw(const TRect &aRect)
   300 	{
   301 	if(!isActive)
   302 		{//make an empty redraw
   303 		iWin.BeginRedraw(aRect);
   304 		iWin.EndRedraw();
   305 		}
   306 	else
   307 		{
   308 		CTWin::Redraw(aRect);
   309 		}	
   310 	}
   311 
   312 void CRedrawWindow3::Activate()
   313 	{
   314 	isActive = ETrue;
   315 	Win()->Activate();
   316 	}
   317 
   318 //
   319 
   320 CTRedrawOrderWindow::CTRedrawOrderWindow(TInt aOrder, CTRedrawTest *aTest) : iTest(aTest), iOrder(aOrder)
   321 	{}
   322 
   323 CTRedrawOrderWindow* CTRedrawOrderWindow::NewLC(TInt aOrder,CTWinBase* aParent,const TPoint& aPos,const TSize& aSize,CTRedrawTest* aTest)
   324 	{
   325 	CTRedrawOrderWindow* self=new(ELeave) CTRedrawOrderWindow(aOrder,aTest);
   326 	CleanupStack::PushL(self);
   327 	self->SetUpL(aPos,aSize,aParent,*TheGc);
   328 	return self;
   329 	}
   330 
   331 void CTRedrawOrderWindow::Draw()
   332 	{
   333 	iGc->SetBrushColor(TRgb::Gray16(iOrder*2));
   334 	iGc->Clear();
   335 	}
   336 
   337 void CTRedrawOrderWindow::ResetRedrawNumber()
   338 	{
   339 	iRedrawNumber=0;
   340 	}
   341 
   342 void CTRedrawOrderWindow::Redraw(const TRect &aRect)
   343 	{
   344 	if (++iRedrawNumber!=iOrder)
   345 		iTest->Failed(iOrder);
   346 	CTWin::Redraw(aRect);
   347 	}
   348 
   349 //
   350 
   351 TInt DestructCallback(TAny *aParam)
   352 	{
   353 	((CTRedrawTest *)aParam)->doDestruct();
   354 	return(0);
   355 	}
   356 
   357 CTRedrawTest::CTRedrawTest(CTestStep* aStep):
   358 	CTWsGraphicsBase(aStep)//, iInvalidRegionChecker(*this)
   359 	{}
   360 
   361 void CTRedrawTest::doDestruct()
   362 	{
   363 	BaseWin->SetVisible(ETrue);
   364 	TestWin->SetVisible(ETrue);
   365 	delete iBaseRedrawWin;
   366 	delete iTestRedrawWin;
   367 	delete iBaseChildWin;
   368 	delete iTestChildWin;
   369 	}
   370 
   371 CTRedrawTest::~CTRedrawTest()
   372 	{
   373 	TCallBack callBack(DestructCallback,this);
   374 	TheClient->SetRedrawCancelFunction(callBack);
   375 	delete iInvalidRegionChecker;	
   376 	}
   377 
   378 void CTRedrawTest::ConstructL()
   379 	{
   380 #if defined(InvalidRegionLogging)
   381 	LOG_MESSAGE(_L("  CTRedrawTest::ConstructL()"));
   382 	LOG_MESSAGE4(_L("  Ex Wins 0x%08x, 0x%08x, 0x%08x"), BaseWin, TestWin, &(TheClient->StdLogWindow()));
   383 #endif
   384 	
   385 	iInvalidRegionChecker = new(ELeave)CInvalidRegionChecker(*this);
   386 	User::LeaveIfError(iInvalidRegionChecker->AddExcludedWindow(BaseWin));
   387 	User::LeaveIfError(iInvalidRegionChecker->AddExcludedWindow(TestWin));
   388 	User::LeaveIfError(iInvalidRegionChecker->AddExcludedWindow(&(TheClient->StdLogWindow())));
   389 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);	
   390 	
   391 	iWinContent=0;
   392 	BaseWin->SetVisible(EFalse);
   393 	TestWin->SetVisible(EFalse);
   394 	FullScreenModeSize=TheClient->iGroup->Size();
   395 	TInt winWidth=(FullScreenModeSize.iWidth/3)-10;
   396 	TInt winHeight=FullScreenModeSize.iHeight-10;
   397 	iBaseRedrawWin=new(ELeave) CReferenceComparisonRedrawWindow(this);
   398 	iBaseRedrawWin->SetUpL(TPoint(FullScreenModeSize.iWidth/3+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
   399 	iTestRedrawWin=new(ELeave) CRedrawWindow2(this);
   400 	iTestRedrawWin->SetUpL(TPoint(FullScreenModeSize.iWidth/3*2+5,5),TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
   401 	iBaseChildWin=new(ELeave) CBlankWindow();
   402 	iBaseChildWin->SetUpL(TPoint(winWidth>>2,winHeight>>2),TSize(winWidth>>1,winHeight>>1),iBaseRedrawWin,*TheClient->iGc);
   403 	iTestChildWin=new(ELeave) CBlankWindow();
   404 	iTestChildWin->SetUpL(TPoint(winWidth>>2,winHeight>>2),TSize(winWidth>>1,winHeight>>1),iTestRedrawWin,*TheClient->iGc);
   405 
   406 #if defined(InvalidRegionLogging)
   407 	LOG_MESSAGE5(_L("  In Wins %08x, %08x, %08x, %08x"), iBaseRedrawWin, iBaseChildWin, iTestRedrawWin, iTestChildWin);
   408 #endif
   409 
   410 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
   411 
   412 #if defined(InvalidRegionLogging)
   413 	LOG_MESSAGE(_L("  Done"));
   414 #endif
   415 	}
   416 
   417 void CTRedrawTest::CheckRedrawWindows()
   418 	{
   419 	_LIT(KTest,"Redraw Test, SubTest %d ");
   420 	TBuf<64> buf;
   421 	buf.Format(KTest,iTest->iState);
   422 	CheckRect(iBaseRedrawWin,iTestRedrawWin,TRect(iBaseRedrawWin->Size()),buf);
   423 	}
   424 
   425 void CTRedrawTest::InvalidateTestWins(const TRect &aRect)
   426 	{
   427 	iBaseRedrawWin->PrepareInvalidation(aRect);
   428 	iTestRedrawWin->PrepareInvalidation(aRect);
   429 	iBaseRedrawWin->PerformInvalidation();
   430 	iTestRedrawWin->PerformInvalidation();
   431 	}
   432 
   433 inline TInt CTRedrawTest::WinContent()
   434 	{
   435 	return iWinContent;
   436 	}
   437 
   438 void CTRedrawTest::SetBackground(const TRgb &aRgb)
   439 	{
   440 	iBaseRedrawWin->iWin.SetBackgroundColor(aRgb);
   441 	iTestRedrawWin->iWin.SetBackgroundColor(aRgb);
   442 	}
   443 
   444 void CTRedrawTest::DumpRegion(const TRegion &aRegion)
   445 	{
   446 	_LIT(KLog,"RegionRect %d: (%d,%d,%d,%d)");
   447 	for (TInt ii=0;ii<aRegion.Count();++ii)
   448 		{
   449 		const TRect& rect=aRegion[ii];
   450 		LOG_MESSAGE6(KLog,ii,rect.iTl.iX,rect.iTl.iY,rect.iBr.iX,rect.iBr.iY);
   451 		}
   452 	}
   453 
   454 /**
   455  * Compare Regions to see if the region we think we have dirtied can be
   456  * completely covered by the WServ invalid region.
   457  * 
   458  * @param aDirtyRegion 			Region we have made dirty
   459  * @param aWservInvalidRegion	Region WServ thinks is dirty
   460  */
   461 void CTRedrawTest::CompareRegionsL(const TRegion &aDirtyRegion,const TRegion &aWservInvalidRegion)
   462 	{
   463 	_LIT(KDirty,"Dirty Region, %d Rects");
   464 	_LIT(KInvalid,"Invalid Region, %d Rects");
   465 	_LIT(KDiff,"Diff Region, %d Rects");
   466 	RRegion tmp;
   467 	TBool loggedRegions=EFalse;
   468 	tmp.Copy(aDirtyRegion);
   469 	tmp.SubRegion(aWservInvalidRegion);
   470 	if (tmp.CheckError())
   471 		User::Leave(KErrNoMemory);
   472 	TBool isEmpty=tmp.IsEmpty();
   473 	TEST(isEmpty);
   474 	if (!isEmpty)
   475 		{
   476 		_LIT(KLog,"DirtyRegion contains area not in WservInvalidRegion");
   477 		LOG_MESSAGE(KLog);
   478 		loggedRegions=ETrue;
   479 		LOG_MESSAGE2(KDirty,aDirtyRegion.Count());
   480 		DumpRegion(aDirtyRegion);
   481 		LOG_MESSAGE2(KInvalid,aWservInvalidRegion.Count());
   482 		DumpRegion(aWservInvalidRegion);
   483 		LOG_MESSAGE2(KDiff,tmp.Count());
   484 		DumpRegion(tmp);
   485 		}
   486 	tmp.Copy(aWservInvalidRegion);
   487 	tmp.SubRegion(aDirtyRegion);
   488 	if (tmp.CheckError())
   489 		User::Leave(KErrNoMemory);
   490 	isEmpty=tmp.IsEmpty();
   491 	//TEST(isEmpty);		//This test currently fails and a defect will be raises about it
   492 	if (!isEmpty)
   493 		{
   494 		_LIT(KLog,"WservInvalidRegion contains area not in DirtyRegion");
   495 		LOG_MESSAGE(KLog);
   496 		if (!loggedRegions)
   497 			{
   498 			LOG_MESSAGE2(KDirty,aDirtyRegion.Count());
   499 			DumpRegion(aDirtyRegion);
   500 			LOG_MESSAGE2(KInvalid,aWservInvalidRegion.Count());
   501 			DumpRegion(aWservInvalidRegion);
   502 			}
   503 		LOG_MESSAGE2(KDiff,tmp.Count());
   504 		DumpRegion(tmp);
   505 		}
   506 	tmp.Close();
   507 	}
   508 
   509 void CTRedrawTest::MoveInvalidAreaL()
   510 	{
   511 	TPoint old=iTestRedrawWin->iWin.Position();
   512 	TSize screenSize=TheClient->iGroup->Size();
   513 	iBaseRedrawWin->iWin.Invalidate();
   514 	iTestRedrawWin->iWin.Invalidate();
   515 	iTestRedrawWin->iWin.SetPosition(TPoint(10,10));
   516 	iTestRedrawWin->iWin.SetPosition(TPoint(0,0));
   517 	iTestRedrawWin->iWin.SetPosition(TPoint(-10,-10));
   518 	iTestRedrawWin->iWin.SetPosition(TPoint(screenSize.iWidth-10,screenSize.iHeight-10));
   519 	iTestRedrawWin->iWin.SetPosition(TPoint(screenSize.iWidth,screenSize.iHeight));
   520 	iTestRedrawWin->iWin.SetPosition(TPoint(screenSize.iWidth+10,screenSize.iHeight+10));
   521 	iTestRedrawWin->iWin.SetPosition(old);
   522 	RRegion baseInvalidRegion;
   523 	RRegion testInvalidRegion;
   524 	iBaseRedrawWin->iWin.GetInvalidRegion(baseInvalidRegion);
   525 	iTestRedrawWin->iWin.GetInvalidRegion(testInvalidRegion);
   526 	CompareRegionsL(baseInvalidRegion,testInvalidRegion);
   527 	baseInvalidRegion.Close();
   528 	testInvalidRegion.Close();
   529 	}
   530 
   531 void CTRedrawTest::GetInvalidRegionTestsL()
   532 	{
   533 	TSize stdWinSize(iTest->StdTestWindowSize());
   534 	CArrayFixFlat<TRect>* rectList=new(ELeave) CArrayFixFlat<TRect>(3);
   535 	rectList->AppendL(TRect(1,1,5,2));
   536 	rectList->AppendL(TRect(stdWinSize.iWidth>>1,stdWinSize.iHeight>>1,stdWinSize.iWidth,stdWinSize.iHeight));
   537 	rectList->AppendL(TRect(2,0,4,5));
   538 	TestGetInvalidRegionL(rectList);
   539 	rectList->Reset();
   540 	rectList->AppendL(TRect(-1000,-1,10000,5));
   541 	rectList->AppendL(TRect(0,0,stdWinSize.iWidth>>1,stdWinSize.iHeight>>1));
   542 	rectList->AppendL(TRect(2,100,2*stdWinSize.iWidth,105));
   543 	TestGetInvalidRegionL(rectList);
   544 	delete rectList;
   545 	}
   546 
   547 void CTRedrawTest::TestGetInvalidRegionL(const CArrayFixFlat<TRect> *aRectList)
   548 	{
   549 	RRegion invalidRegion;
   550 	RRegion region;
   551 	iTestRedrawWin->iWin.BeginRedraw();
   552 	iTestRedrawWin->iWin.EndRedraw();
   553 	for (TInt index=0;index<aRectList->Count();index++)
   554 		{
   555 		iTestRedrawWin->iWin.Invalidate((*aRectList)[index]);
   556 		region.AddRect((*aRectList)[index]);
   557 		}
   558 	//Currently WSERV includes areas under a child or other window in the invalid region
   559 	//This is arguable the incorrect thing to do
   560 	/*TRect subRect;
   561 	subRect.iTl=iTestChildWin->BaseWin()->InquireOffset(iTestRedrawWin->iWin);
   562 	subRect.SetSize(iTestChildWin->Size());
   563 	region.SubRect(subRect);*/
   564 	region.ClipRect(TRect(iTestRedrawWin->Size()));
   565 	iTestRedrawWin->iWin.GetInvalidRegion(invalidRegion);
   566 	CompareRegionsL(region,invalidRegion);
   567 	region.Close();
   568 	invalidRegion.Close();
   569 	}
   570 
   571 void CTRedrawTest::Failed(TInt aOrder)
   572 	{
   573 	_LIT(KLog,"Redraw Order Error, Window Drawn at Position %d should be drawn at Position %d");
   574 	LOG_MESSAGE3(KLog,CTRedrawOrderWindow::RedrawNumber(),aOrder);
   575 	if (iRedrawNo==0)
   576 		iRedrawNo=CTRedrawOrderWindow::RedrawNumber();
   577 	}
   578 
   579 void CTRedrawTest::CheckOrderL()
   580 	{
   581 	_LIT(KLog,"Fail in redraw order test, first position of error is %d");
   582 	iRedrawNo=0;
   583 	CTRedrawOrderWindow* order1;
   584 	CTRedrawOrderWindow* order2;
   585 	CTRedrawOrderWindow* order3;
   586 	CTRedrawOrderWindow* order4;
   587 	CTRedrawOrderWindow* order5;
   588 	CTRedrawOrderWindow* order6;
   589 	CTRedrawOrderWindow* order7;
   590 	order6=CTRedrawOrderWindow::NewLC(6,TheClient->iGroup,TPoint(100,10),TSize(40,40),this);
   591 	order7=CTRedrawOrderWindow::NewLC(7,order6,TPoint(0,0),TSize(20,20),this);
   592 	order1=CTRedrawOrderWindow::NewLC(1,TheClient->iGroup,TPoint(10,10),TSize(60,40),this);
   593 	order4=CTRedrawOrderWindow::NewLC(4,order1,TPoint(20,0),TSize(20,40),this);
   594 	order5=CTRedrawOrderWindow::NewLC(5,order4,TPoint(0,0),TSize(20,20),this);
   595 	order2=CTRedrawOrderWindow::NewLC(2,order1,TPoint(0,0),TSize(20,40),this);
   596 	order3=CTRedrawOrderWindow::NewLC(3,order2,TPoint(0,0),TSize(20,20),this);
   597 	TheClient->iWs.Finish();  // Fix for DEF133199 - Intermittant failure with windows out of order 
   598 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);	// Check order is correct after initial creation
   599 	TEST(order1!=NULL && order2!=NULL && order3!=NULL && order4!=NULL && order5!=NULL && order6!=NULL && order7!=NULL);	// redundant check to shut up the compiler
   600 	TEST(iRedrawNo==0);
   601 	if (iRedrawNo>0)
   602 		LOG_MESSAGE2(KLog,iRedrawNo);
   603 
   604 	CTRedrawOrderWindow::ResetRedrawNumber();
   605 	iRedrawNo=0;
   606 	CTUser::Splat(TheClient,TRect(0,0,200,60),TRgb(0,0,0));
   607 	TheClient->iWs.Flush();
   608 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);	// Check it's still correct on subsequent redraws
   609 	TEST(iRedrawNo==0);
   610 	if (iRedrawNo>0)
   611 		LOG_MESSAGE2(KLog,iRedrawNo);
   612 	CTRedrawOrderWindow::ResetRedrawNumber();
   613 	CleanupStack::PopAndDestroy(7,order6);
   614 	}
   615 
   616 // For reproducing INC049554
   617 void CTRedrawTest::CheckDefectINC049554L()
   618 	{
   619 	if(TransparencySupportedL() == KErrNotSupported) //the defect only happens when transparency enabled
   620 		return;
   621 	TSize screenSize=TheClient->iScreen->SizeInPixels();
   622 	TPoint winPos(screenSize.iWidth/3,0);
   623 	TSize winSize(screenSize.iWidth/3,screenSize.iHeight);
   624 	CTCheckDefectWin* lowerWin=CTCheckDefectWin::NewL(winPos,winSize);
   625 	CleanupStack::PushL(lowerWin);
   626 	lowerWin->Activate();
   627 	TheClient->Flush();
   628 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
   629 
   630 	winPos.iX+=screenSize.iWidth/12;
   631 
   632 	CTCheckDefectWin* upperWin=CTCheckDefectWin::NewL(winPos,winSize);
   633 	CleanupStack::PushL(upperWin);
   634 	upperWin->Activate();
   635 	TheClient->Flush();
   636 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
   637 
   638 	// Invalidate the lower win and while drawing its content, move top window
   639 	lowerWin->Invalidate();
   640 	lowerWin->Win()->BeginRedraw();
   641 	TheClient->iGc->Activate(*lowerWin->DrawableWin());
   642 	TheClient->iGc->SetPenStyle(CGraphicsContext::ENullPen);
   643 	TheClient->iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   644 	TheClient->iGc->SetBrushColor(TRgb(0,255,0));
   645 	TheClient->iGc->DrawRect(TRect(TPoint(0,0),TSize(50,50)));
   646 
   647 	winPos.iX+=screenSize.iWidth/12;
   648 	upperWin->SetExt(winPos,winSize);
   649 
   650 	TheClient->iGc->SetBrushColor(TRgb(255,0,0));
   651 	TheClient->iGc->DrawRect(TRect(TPoint(0,0),TSize(50,50)));
   652 	TheClient->iGc->Deactivate();
   653 	lowerWin->Win()->EndRedraw();
   654 
   655 	TheClient->Flush();
   656 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
   657 
   658 	CleanupStack::PopAndDestroy(upperWin);
   659 
   660 	// Create 2 transaprent windows, slightly over lapping the background window
   661 	winPos.iX=screenSize.iWidth/3;
   662 	TPoint winPosTop(winPos.iX-screenSize.iWidth/6,0);
   663 	TSize winSizeTop(screenSize.iWidth/3+screenSize.iWidth/6,screenSize.iHeight/2);
   664 
   665 	CTCheckDefectWin* leftWin=CTCheckDefectWin::NewL(winPosTop,winSizeTop);
   666 	CleanupStack::PushL(leftWin);
   667 	leftWin->Win()->SetTransparencyAlphaChannel();
   668 	leftWin->Win()->SetBackgroundColor(TRgb(0,0,0, 128));
   669 	leftWin->Activate();
   670 	TheClient->iWs.Finish();
   671 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
   672 
   673 	CTCheckDefectWin* rightWin=CTCheckDefectWin::NewL(winPos,winSizeTop);
   674 	CleanupStack::PushL(rightWin);
   675 	rightWin->Win()->SetTransparencyAlphaChannel();
   676 	rightWin->Win()->SetBackgroundColor(TRgb(0,0,0, 128));
   677 	rightWin->Activate();
   678 	TheClient->iWs.Finish();
   679 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
   680 
   681 	lowerWin->Invalidate();
   682 	lowerWin->Win()->BeginRedraw();
   683 	TheClient->iGc->Activate(*lowerWin->DrawableWin());
   684 	TheClient->iGc->SetPenStyle(CGraphicsContext::ENullPen);
   685 	TheClient->iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   686 	TheClient->iGc->SetBrushColor(TRgb(0,255,0));
   687 	TheClient->iGc->DrawRect(TRect(TPoint(0,0),TSize(50,50)));
   688 
   689 	TheClient->iGc->SetBrushColor(TRgb(255,0,0));
   690 	TheClient->iGc->DrawRect(TRect(TPoint(0,0),TSize(50,50)));
   691 	TheClient->iGc->Deactivate();
   692 	lowerWin->Win()->EndRedraw();
   693 
   694 	TheClient->iWs.Finish();
   695 	WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
   696 
   697 	CleanupStack::PopAndDestroy(3,lowerWin);
   698 	}
   699 
   700 
   701 TInt myKK=1;
   702 _LIT(KSnap,"c:\\TestRect%2i.mbm");
   703 _LIT(KSnapE,"c:\\TestRect%2iErr.mbm");
   704 void CTRedrawTest::TestRect()
   705 	{
   706 	
   707 	TBuf<50> snapshotFileName;
   708 	snapshotFileName.Zero();
   709 	CFbsBitmap *snapshot=new(ELeave) CFbsBitmap();
   710 	CleanupStack::PushL(snapshot);
   711 	User::LeaveIfError(snapshot->Create(TheClient->iScreen->SizeInPixels(),TheClient->iScreen->DisplayMode()));		
   712 
   713 	User::LeaveIfError(TheClient->iScreen->CopyScreenToBitmap(snapshot));
   714 	
   715 	TRect rect1=TRect(TPoint(),TSize(FullScreenModeSize.iWidth/2,FullScreenModeSize.iHeight));
   716 	TRect rect2=TRect(TPoint(FullScreenModeSize.iWidth/2,0),TSize(FullScreenModeSize.iWidth/2,FullScreenModeSize.iHeight));
   717 	TBool retVal = TheClient->iScreen->RectCompare(rect1,rect2);
   718 
   719 	RDebug::Printf("Picture %i !!!: Rect1: (%i,%i)->(%i,%i)  -  Rect2: (%i,%i)->(%i,%i)",myKK,
   720 			rect1.iTl.iX,rect1.iTl.iY,rect1.iBr.iX,rect1.iBr.iY,
   721 			rect2.iTl.iX,rect2.iTl.iY,rect2.iBr.iX,rect2.iBr.iY);	
   722 	
   723 	
   724 	if (retVal)
   725 		{
   726 		snapshotFileName.Format(KSnap,myKK);
   727 		}
   728 	else
   729 		{
   730 		snapshotFileName.Format(KSnapE,myKK);	
   731 		}
   732 	snapshot->Save(snapshotFileName);
   733 	CleanupStack::PopAndDestroy(snapshot);
   734 	myKK++;	
   735 		
   736 	
   737 
   738 	TEST(retVal);
   739 	if(!retVal)
   740 		INFO_PRINTF3(_L("TheClient->iScreen->RectCompare() return value  - Expected: %d, Actual: %d"), ETrue, retVal);
   741 	}
   742 
   743 void CTRedrawTest::ConstructAndSetBlankWinLC(RBlankWindow& aWindow, TSize aSize, TPoint aPoint/*=TPoint()*/,
   744 						   					TRgb aBackgroundColor/*=TRgb(0,0,0)*/)
   745 	{
   746 	User::LeaveIfError(aWindow.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
   747 	CleanupClosePushL(aWindow);
   748 	aWindow.SetExtent(aPoint, aSize);
   749 	aWindow.SetColor(aBackgroundColor);
   750 	aWindow.Activate();
   751 	}
   752 
   753 void CTRedrawTest::ConstructWindowLC(RWindow& aWindow, TSize aSize, TPoint aPoint/*=TPoint()*/,
   754 						   			 TRgb aBackgroundColor/*=TRgb(255,255,255)*/, TBool aTransparencyByAlpha/*=EFalse*/,
   755 						   			 TDisplayMode aDisplayMode/*=EColor64K*/)
   756 	{
   757 	User::LeaveIfError(aWindow.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
   758 	CleanupClosePushL(aWindow);
   759 	aWindow.SetExtent(aPoint,aSize);
   760 	aWindow.SetBackgroundColor(aBackgroundColor);
   761 	aWindow.SetRequiredDisplayMode(aDisplayMode);
   762 	if (aTransparencyByAlpha)
   763 		{
   764 		aWindow.SetTransparencyAlphaChannel();
   765 		}
   766 	aWindow.Activate();
   767 	}
   768 
   769 void CTRedrawTest::ActivateAndSetGc(CWindowGc& aGc, RWindow& aWindow, CGraphicsContext::TBrushStyle aBrushStyle/*=CGraphicsContext::ESolidBrush*/, TRgb aBrushColor/*=TRgb(0,0,0)*/,
   770 					  				CGraphicsContext::TPenStyle aPenStyle/*=CGraphicsContext::ENullPen*/, TRgb aPenColor/*=TRgb(0,0,0)*/)
   771 	{
   772 	aGc.Activate(aWindow);
   773 	aGc.Reset();
   774 	aGc.SetBrushStyle(aBrushStyle);
   775 	aGc.SetBrushColor(aBrushColor);
   776 	aGc.SetPenStyle(aPenStyle);
   777 	aGc.SetPenColor(aPenColor);
   778 	}
   779 
   780 void CTRedrawTest::DrawWin(CWindowGc& aGc, RWindow& aWin, TSize aWinSize, TRgb aRectColor1, TRgb aRectColor2, TInt aNewOrdinalPos/*=0*/, RWindow* aWinToMove/*=NULL*/, TBool aDrawAllPixels/*=EFalse*/)
   781 	{
   782 	const TUint startX = 10;
   783 	const TUint endX = aWinSize.iWidth - startX;
   784 	const TUint startY = 10;
   785 	const TUint sHeight = (aWinSize.iHeight >> 1) - startY;
   786 	ActivateAndSetGc(aGc,aWin);
   787 	aWin.BeginRedraw();
   788 	if(aDrawAllPixels)
   789 		{
   790 		aGc.SetBrushColor(KWhite);
   791 		aGc.DrawRect(TRect(aWinSize));
   792 		}
   793 	aGc.SetBrushColor(aRectColor1);
   794 	aGc.DrawRect(TRect(startX, startY, endX, sHeight));
   795 	if (aWinToMove)
   796 		{
   797 		aWinToMove->SetOrdinalPosition(aNewOrdinalPos);
   798 		TheClient->iWs.Finish();
   799 		}
   800 	aGc.SetBrushColor(aRectColor2);
   801 	aGc.DrawRect(TRect(startX, sHeight + startY, endX, aWinSize.iHeight - startY));
   802 	aWin.EndRedraw();
   803 	aGc.Deactivate();
   804 	}
   805 
   806 void CTRedrawTest::CheckOrdinalPositionDefectL()
   807 	{
   808 	if(TransparencySupportedL() == KErrNotSupported) //the defect only happens when transparency enabled
   809 		{
   810 		return;
   811 		}
   812 
   813 	const TRgb KTransWinColor = TRgb(0,0,255,128);
   814 	const TUint hWidth  = FullScreenModeSize.iWidth >> 1;
   815 	const TSize windowSize = TSize(hWidth,FullScreenModeSize.iHeight);
   816 	const TPoint rightWinStartPt = TPoint(hWidth,0);
   817 
   818 	// A Blank Window to clear the screen.
   819 	// It is required to clear all the pixels on the screen.
   820 	RBlankWindow clrWin(TheClient->iWs);
   821 	ConstructAndSetBlankWinLC(clrWin, FullScreenModeSize);
   822 
   823 	// Transparent window
   824 	RWindow winLeftT(TheClient->iWs);
   825  	ConstructWindowLC(winLeftT, windowSize, TPoint(), KTransWinColor,ETrue);
   826 
   827 	CWindowGc& gc = *(TheClient->iGc);
   828 	// Draw the Transparent Window (winLeftT) on the Left side
   829  	DrawWin(gc, winLeftT, windowSize, KTransBisque, KTransLightSalmon);
   830 	
   831 	// Invisible window
   832 	RWindow winRightI(TheClient->iWs);
   833 	User::LeaveIfError(winRightI.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
   834 	CleanupClosePushL(winRightI);
   835 	winRightI.SetExtent(rightWinStartPt, windowSize);
   836 	winRightI.SetVisible(EFalse);
   837 	winRightI.Activate();
   838 
   839 	// Transparent window
   840 	RWindow winRightT(TheClient->iWs);
   841  	ConstructWindowLC(winRightT, windowSize, rightWinStartPt, KTransWinColor,ETrue);
   842 
   843 	// Draw the Transparent Window (winRightT) on the Right side and change the
   844 	// Ordinal Position for Invisible Window (winRightI) to move it front
   845 	// to the Transparent Window.
   846 	// Invisible window is behind the Transparent Window
   847  
   848  	DrawWin(gc, winRightT, windowSize, KTransBisque, KTransLightSalmon, 0, &winRightI); // Move winRightI to Front of winRightT
   849 	TestRect();
   850 
   851 	CleanupStack::PopAndDestroy(4, &clrWin);
   852 	}
   853 
   854 // For reproducing PDEF099892
   855 void CTRedrawTest::CheckDefectPDEF099892L()
   856 	{
   857 	if(TransparencySupportedL() == KErrNotSupported) //the defect only happens when transparency enabled
   858 		{
   859 		return;
   860 		}
   861 
   862 	const TRgb KTransWinColor = TRgb(0,0,255,128);
   863 	const TUint hWidth  = FullScreenModeSize.iWidth >> 1;
   864 	const TUint hHeight = FullScreenModeSize.iHeight >> 1;
   865 	const TSize windowSize = TSize(hWidth,FullScreenModeSize.iHeight);
   866 	const TSize transWinSize = TSize(hWidth,hHeight + 10);
   867 	const TPoint rightWinStartPt = TPoint(hWidth,0);
   868 
   869 	// A Blank Window to clear the screen.
   870 	// It is required to clear all the pixels on the screen.
   871 	RBlankWindow clrWin(TheClient->iWs);
   872 	ConstructAndSetBlankWinLC(clrWin, FullScreenModeSize);
   873 
   874 	// Create an Opaque and a Transparent Window and Draw them on the
   875 	// Left Side of the Screen. Opaque Window is Behind the Transparent Window.
   876 	
   877 	// Opaque Window
   878 	RWindow winLeftOpq(TheClient->iWs);
   879 	ConstructWindowLC(winLeftOpq, windowSize, TPoint(), KRed);
   880 
   881 	// Transparent window
   882 	RWindow winLeftT(TheClient->iWs);
   883 	ConstructWindowLC(winLeftT, transWinSize, TPoint(), KTransWinColor, ETrue);
   884 
   885 	CWindowGc& gc = *(TheClient->iGc);
   886 	// Draw the transparent Window (winLeftT) on the Left side
   887  	DrawWin(gc, winLeftT, transWinSize, KTransBisque, KTransLightSalmon);
   888 
   889 	// Draw the Opaque Window (winLeftOpq) on the Left side
   890 	DrawWin(gc, winLeftOpq, windowSize, KLightSteelBlue, KCadetBlue, 0, NULL, ETrue);
   891 
   892 	// Create an Invisible, an Opaque and a Transparent Window and Draw them on the
   893 	// Right Side of the Screen. Invisible Window is Behind the Opaque Window and
   894 	// Opaque Window is Behind the Transparent Window.
   895 	// While drawing the Transparent Window, move the Invisible Window to the Front of Opaque Window.
   896 	// And while Drawing the Opaque Window move the Invisible Window again Behind the Opaque Window.
   897 
   898 	// Invisible window
   899 	RWindow winRightI(TheClient->iWs);
   900 	User::LeaveIfError(winRightI.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
   901 	CleanupClosePushL(winRightI);
   902 	winRightI.SetExtent(rightWinStartPt, windowSize);
   903 	winRightI.SetVisible(EFalse);
   904 	winRightI.Activate();
   905 
   906 	// Opaque Window
   907 	RWindow winRightOpq(TheClient->iWs);
   908 	ConstructWindowLC(winRightOpq, windowSize, rightWinStartPt, KRed);
   909 
   910 	// Transparent window
   911 	RWindow winRightT(TheClient->iWs);
   912 	ConstructWindowLC(winRightT, transWinSize, rightWinStartPt, KTransWinColor, ETrue);
   913 
   914 	// Draw the transparent Window (winRightT) on the Right side
   915  	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 1, &winRightI );
   916 
   917 	// Draw the Opaque Window (winRightOpq) on the Right side
   918 	DrawWin(gc, winRightOpq, windowSize, KLightSteelBlue, KCadetBlue, 2, &winRightI, ETrue);
   919 	
   920 	// Compare the Left and Right side Rectangles
   921 	TestRect();
   922 
   923 	CleanupStack::PopAndDestroy(6, &clrWin);
   924 	}
   925 
   926 void CTRedrawTest::CheckMMSDefectL(TBool aMoveBlankWindow)
   927 	{
   928 	if(TransparencySupportedL() == KErrNotSupported) //the defect only happens when transparency enabled
   929 		{
   930 		return;
   931 		}
   932 
   933 	const TRgb KTransWinColor = TRgb(0,0,255,128);
   934 	const TUint hWidth  = FullScreenModeSize.iWidth >> 1;
   935 	const TUint hHeight = FullScreenModeSize.iHeight >> 1;
   936 	const TSize windowSize = TSize(hWidth,FullScreenModeSize.iHeight);
   937 	const TSize transWinSize = TSize(hWidth - 20,hHeight + 10);
   938 	const TPoint rightWinStartPt = TPoint(hWidth,0);
   939 
   940 	// A Blank Window to clear the screen.
   941 	// It is required to clear all the pixels on the screen.
   942 	RBlankWindow clrWin(TheClient->iWs);
   943 	ConstructAndSetBlankWinLC(clrWin, FullScreenModeSize);
   944 
   945 	// Create an Opaque and a Transparent Window and Draw them on the
   946 	// Left Side of the Screen. Opaque Window is Behind the Transparent Window.
   947 
   948 	// Opaque Window
   949 	RWindow winLeftOpq(TheClient->iWs);
   950 	ConstructWindowLC(winLeftOpq, windowSize, TPoint(), KRed);
   951 	CWindowGc& gc = *(TheClient->iGc);
   952 	// Draw the Opaque Window (winLeftOpq) on the Left side
   953 	DrawWin(gc, winLeftOpq, windowSize, KLightSteelBlue, KCadetBlue, 0, NULL, ETrue);
   954 
   955 	// Another Window - A Blank Window
   956 	RBlankWindow winLeftBlank(TheClient->iWs);
   957 	ConstructAndSetBlankWinLC(winLeftBlank, TSize(100,100), TPoint(20,20), TRgb(128,128,128));
   958 
   959 	// Transparent window
   960 	RWindow winLeftT(TheClient->iWs);
   961 	ConstructWindowLC(winLeftT, transWinSize, TPoint(10, 10), KTransWinColor, ETrue);
   962 	// Draw the Transparent Window (winLeftT) on the Left side
   963  	DrawWin(gc, winLeftT, transWinSize, KTransBisque, KTransLightSalmon);
   964 
   965 	// Invisible window
   966 	RWindow winRightI(TheClient->iWs);
   967 	User::LeaveIfError(winRightI.Construct(*TheClient->iGroup->GroupWin(), ENullWsHandle));
   968 	CleanupClosePushL(winRightI);
   969 	winRightI.SetExtent(rightWinStartPt, windowSize);
   970 	winRightI.SetVisible(EFalse);
   971 	winRightI.Activate();
   972 
   973 	// Opaque Window
   974 	RWindow winRightOpq(TheClient->iWs);
   975 	ConstructWindowLC(winRightOpq, windowSize, rightWinStartPt, KRed);
   976 
   977 	// Draw the Opaque Window (winRightOpq) on the Right side
   978 	DrawWin(gc, winRightOpq, windowSize, KLightSteelBlue, KCadetBlue, 0, NULL, ETrue);
   979 
   980 	// Another Window - A Blank Window
   981 	RBlankWindow winRightBlank(TheClient->iWs);
   982 	ConstructAndSetBlankWinLC(winRightBlank, TSize(100,100), rightWinStartPt + TPoint(20,20), TRgb(128,128,128));
   983 
   984 	// Transparent window
   985 	RWindow winRightT(TheClient->iWs);
   986 	ConstructWindowLC(winRightT, transWinSize, rightWinStartPt + TPoint(10,10), KTransWinColor, ETrue);
   987 
   988 	if (aMoveBlankWindow)
   989 		{
   990 		winRightBlank.SetOrdinalPosition(0); // Move the Blank Window to the front of the Transparent Window
   991 		TheClient->iWs.Finish();
   992 		}
   993 	// Draw the transparent Window (winRightT) on the Right side
   994  	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 2, &winRightI);
   995 	if (aMoveBlankWindow)
   996 		{
   997 		winRightBlank.SetOrdinalPosition(1); // Move the Blank Window back to behind the Transparent Window
   998 		TheClient->iWs.Finish();
   999 		}
  1000 	TestRect();
  1001 
  1002  	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 0, &winRightI);
  1003 	TestRect(); // if aMoveBlankWindow is ETrue then this will test the Defect PDEF099892
  1004 
  1005 	// Rest of the lines are just to check other possibilities.
  1006 	// But,currently, they are not affecting the result.
  1007 	// i.e. the DrawWin() functions called after this line will draw the same thing
  1008 	// as it was drawn for the DrawWin() called just before this line.
  1009  	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 1, &winRightI);
  1010 	TestRect();
  1011 
  1012 	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 0, &winRightI);
  1013 	TestRect();
  1014 
  1015 	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 2, &winRightI);
  1016 	TestRect();
  1017 
  1018 	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 1, &winRightI);
  1019 	TestRect();
  1020 
  1021 	DrawWin(gc, winRightT, transWinSize, KTransBisque, KTransLightSalmon, 3, &winRightI);
  1022 	TestRect();
  1023 
  1024 	CleanupStack::PopAndDestroy(8, &clrWin);
  1025 	}
  1026 
  1027 /**
  1028 
  1029 The test window is receiving a draw request before it activates, 
  1030 doing an empty redraw, then activating itself, and drawing itself properly in 
  1031 response to the next redraw request.  
  1032 
  1033 Without the fix the next redraw request will not be received and it will be drawn blank. 
  1034 */
  1035 void CTRedrawTest::CheckDefectPDEF117784L()
  1036 	{
  1037 	TSize winSize = BaseWin->Size();
  1038 
  1039 	TInt winWidth=(FullScreenModeSize.iWidth/3)-10;
  1040 	TInt winHeight=FullScreenModeSize.iHeight-10;
  1041 	
  1042 	CRedrawWindow3* baseRedrawWin = new(ELeave) CRedrawWindow3(this);
  1043 	CleanupStack::PushL(baseRedrawWin);
  1044 	TPoint ptBase = TPoint(FullScreenModeSize.iWidth/3*2+5,5);
  1045 	baseRedrawWin->SetUp1L(ptBase,TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
  1046 	baseRedrawWin->SetVisible(ETrue);
  1047 	baseRedrawWin->Activate();
  1048 
  1049 	CRedrawWindow3* testRedrawWin = new(ELeave) CRedrawWindow3(this);
  1050 	CleanupStack::PushL(testRedrawWin);
  1051 	TPoint ptTest = TPoint(FullScreenModeSize.iWidth/3+5,5);
  1052 	testRedrawWin->SetUp1L(ptTest,TSize(winWidth,winHeight),TheClient->iGroup,*TheClient->iGc);
  1053 	testRedrawWin->SetVisible(ETrue);
  1054 	testRedrawWin->Activate();
  1055 	
  1056 	TheClient->iWs.Finish();
  1057 	User::LeaveIfError(iInvalidRegionChecker->AddExcludedWindow(testRedrawWin));
  1058 	TBool retVal = WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
  1059 	TEST(retVal == KErrNone);
  1060 	if(retVal != KErrNone)
  1061 	    {
  1062 	    ERR_PRINTF2(_L("CTRedrawTest::WaitForRedrawsToFinish failed with error: %d"), retVal);
  1063 	    }
  1064 	iInvalidRegionChecker->RemoveExcludedWindow(testRedrawWin);
  1065 
  1066 	TheClient->iWs.Finish();
  1067 	retVal = WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
  1068 	TEST(retVal == KErrNone);
  1069 	if(retVal != KErrNone)
  1070 	    {
  1071         ERR_PRINTF2(_L("CTRedrawTest::WaitForRedrawsToFinish failed with error: %d"), retVal);
  1072 	    }
  1073 	
  1074 	retVal = TheClient->iScreen->RectCompare(TRect(TPoint(ptBase),TSize(winWidth,winHeight)),TRect(TPoint(ptTest),TSize(winWidth,winHeight)));
  1075 	TEST(retVal);
  1076 	if(!retVal)
  1077 		{
  1078 		ERR_PRINTF1(_L("New activated window has lost redraw request"));
  1079 		}
  1080 
  1081 	CleanupStack::PopAndDestroy(2, baseRedrawWin);
  1082 	}
  1083 
  1084 CInvalidRegionChecker::CInvalidRegionChecker(const CTRedrawTest& aGraphicsTest)
  1085 	: iGraphicsTest(aGraphicsTest) 
  1086 	{}
  1087 
  1088 CInvalidRegionChecker::~CInvalidRegionChecker()
  1089 	{
  1090 	iExcludedWindowArray.Close();
  1091 	}
  1092 
  1093 TInt CInvalidRegionChecker::AddExcludedWindow(const CTWinBase* aExcludedWindow)
  1094 	{
  1095 	TInt error = KErrNone;
  1096 	const CTWinBase** emptySlot = NULL;
  1097 	for(TInt win=iExcludedWindowArray.Count()-1; win>=0; win--)
  1098 		{
  1099 		if(iExcludedWindowArray[win]==aExcludedWindow)
  1100 			{
  1101 			// window is already excluded, we don't want to add it twice
  1102 			return error;
  1103 			}
  1104 		if(!emptySlot && iExcludedWindowArray[win]==NULL)
  1105 			{
  1106 			emptySlot = &iExcludedWindowArray[win];
  1107 			}
  1108 		}
  1109 	
  1110 	if(emptySlot)
  1111 		{
  1112 		// re-use the emptyslot		
  1113 		*emptySlot=aExcludedWindow; // re-use the element
  1114 		}
  1115 	else
  1116 		{
  1117 		// no empty elements re-used, so add a new one
  1118 		error = iExcludedWindowArray.Append(aExcludedWindow);
  1119 		}
  1120 	return error;
  1121 	};
  1122 
  1123 void CInvalidRegionChecker::RemoveExcludedWindow(const CTWinBase* aExcludedWindow)
  1124 	{
  1125 	if(iExcludedWindowArray.Count())
  1126 		{
  1127 		for(TInt win=iExcludedWindowArray.Count()-1; win>=0; win--)
  1128 			{
  1129 			if(iExcludedWindowArray[win]==aExcludedWindow)
  1130 				{
  1131 				iExcludedWindowArray[win]=NULL; // Not worth deleting the array element, just mark it as NULL 
  1132 				return;
  1133 				}
  1134 			}
  1135 		}
  1136 	};
  1137 
  1138 TBool CInvalidRegionChecker::ExcludedWindow(const CTWinBase* aWin) const
  1139 	{
  1140 	for(TInt win=iExcludedWindowArray.Count()-1; win>=0; win--)
  1141 		{
  1142 		if(aWin == iExcludedWindowArray[win])
  1143 			{
  1144 #if defined(InvalidRegionLogging)
  1145 				{
  1146 				_LIT(KText, "  Excluded Window %08x");
  1147 				TLogMessageText buf;		
  1148 				buf.Format(KText, aWin);
  1149 				BLOG_MESSAGE(buf);
  1150 				}
  1151 #endif					
  1152 			return ETrue;
  1153 			}
  1154 		}
  1155 	return EFalse;
  1156 	}
  1157 
  1158 void CInvalidRegionChecker::ProcessWindow(const CTWinBase* aTWinBase)
  1159 	{
  1160 #if defined(InvalidRegionLogging)
  1161 			{
  1162 			_LIT(KText, "  ProcessWindow %08x %d - Child(%08x), Next(%08x), Prev(%08x)");
  1163 			TLogMessageText buf;		
  1164 			buf.Format(KText, aTWinBase, iInvalidRegionCount, aTWinBase->Child(), aTWinBase->NextSibling(), aTWinBase->PrevSibling());
  1165 			BLOG_MESSAGE(buf);
  1166 			}
  1167 #endif
  1168 
  1169 	if(aTWinBase && !ExcludedWindow(aTWinBase))
  1170 		{
  1171 		RRegion invalidRegion;
  1172 		static_cast<const CTWin *>(aTWinBase)->Win()->GetInvalidRegion(invalidRegion);
  1173 		iInvalidRegionCount += invalidRegion.Count();
  1174 
  1175 #if defined(InvalidRegionLogging)
  1176 		if(invalidRegion.Count())
  1177 			{
  1178 			_LIT(KText, "  IR Found for %08x %d");
  1179 			TLogMessageText buf;
  1180 			buf.Format(KText, aTWinBase, invalidRegion.Count());
  1181 			BLOG_MESSAGE(buf);
  1182 			}
  1183 #endif
  1184 		
  1185 		invalidRegion.Close();
  1186 		
  1187 		if(0==iInvalidRegionCount)
  1188 			{
  1189 			ProcessChildWindow(aTWinBase->Child());
  1190 			}
  1191 		}
  1192 	}
  1193 
  1194 void CInvalidRegionChecker::ProcessChildWindow(const CTWinBase* aTWinBase)
  1195 	{
  1196 	if(aTWinBase)
  1197 		{
  1198 		// get the first sibling window
  1199 		const CTWinBase *sibling=aTWinBase;
  1200 		const CTWinBase *prevSibling=sibling->PrevSibling();
  1201 		while(prevSibling)
  1202 			{
  1203 			sibling=prevSibling;			
  1204 			prevSibling=sibling->PrevSibling();
  1205 			}
  1206 		// process all siblings inc. self	
  1207 		while(sibling && (0==iInvalidRegionCount))
  1208 			{	
  1209 			ProcessWindow(sibling);
  1210 			sibling=sibling->NextSibling();
  1211 			}
  1212 		}
  1213 	}	
  1214 
  1215 
  1216 void CInvalidRegionChecker::ProcessWindowGroup(const CTWinBase* aTWinBase)
  1217 	{
  1218 	if(aTWinBase && !ExcludedWindow(aTWinBase))
  1219 		{
  1220 		ProcessChildWindow(aTWinBase->Child());
  1221 		}
  1222 	}
  1223 
  1224 TInt CInvalidRegionChecker::CheckInvalidRegions(const CTWindowGroup* aGroup)
  1225 	{
  1226 	iInvalidRegionCount=0;	
  1227 	ProcessWindowGroup(aGroup);	
  1228 #if defined(InvalidRegionLogging)
  1229 		{
  1230 		_LIT(KText, "  CheckInvalidRegions %d");
  1231 		TLogMessageText buf;
  1232 		buf.Format(KText, iInvalidRegionCount);
  1233 		BLOG_MESSAGE(buf);
  1234 		}
  1235 #endif	
  1236 	return iInvalidRegionCount;
  1237 	}
  1238 
  1239 TInt CTRedrawTest::WaitForRedrawsToFinish(TRedrawCheckType aRedrawCheckType)
  1240 	{
  1241 	TInt error=KErrNone;
  1242 #define EnableCheckInvalidRegions
  1243 #if defined(EnableCheckInvalidRegions)	
  1244 	if(aRedrawCheckType == ECheckRedrawActiveObjectAndInvalidRegions)
  1245 		{
  1246 		TInt regions = 0;
  1247 		TInt count = 0;
  1248 		//We do not want to cycle round forever or too long, a limit of 10 has
  1249 		//been added but this is arbitrary.  If CTClient::WaitForRedrawsToFinish
  1250 		//fails too many times then possibly something else us wrong.
  1251 		do
  1252 			{
  1253 			count++;
  1254 			error = TheClient->WaitForRedrawsToFinish();
  1255 			if(error != KErrNone)
  1256 			    {
  1257 			    RDebug::Printf("CTRedrawTest::WaitForRedrawsToFinish, error %d", error);
  1258 			    }
  1259 			regions = iInvalidRegionChecker->CheckInvalidRegions(TheClient->iGroup);
  1260 			if(regions)
  1261 				{
  1262 				// Give the server a chance to do the redraws because 
  1263 				// the Animation Scheduler is an idle priority AO
  1264 				const TUint KOneSecond = 1000000; // us
  1265 				User::After(KOneSecond>>2); // 0.25s
  1266 				}
  1267 			} while (0 < regions && 10 < count); 
  1268 		}
  1269 	else // ECheckRedrawActiveObjectOnly
  1270 #endif // CheckInvalidRegions
  1271 		{
  1272 		error = TheClient->WaitForRedrawsToFinish();
  1273 		}
  1274 	return error;
  1275 	}
  1276 
  1277 void CTRedrawTest::RunTestCaseL(TInt /*aCurTestCase*/)
  1278 	{
  1279 	_LIT(Redraw0,"Redraw1");
  1280 	_LIT(Redraw1,"Redraw2");
  1281 	_LIT(Redraw2,"GetInvalid");
  1282 	_LIT(Redraw3,"MoveInvalid");
  1283 	_LIT(Redraw4,"CheckOrder");
  1284 	_LIT(Redraw5,"Defect 49554");
  1285 	_LIT(Redraw6,"Check Ordinal Position");
  1286 	_LIT(Redraw7,"Defect 99892");
  1287 	_LIT(Redraw8,"Check MMS Defect 1");
  1288 	_LIT(Redraw9,"Check MMS Defect 2");
  1289 	_LIT(Redraw10,"Redraw inactive window");
  1290 	((CTRedrawTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
  1291 
  1292 	TInt testWindowDraws = -1;		// to prevent RVCT 546-D warning
  1293 	_LIT(KLog,"RunTestCase %d");
  1294 	if (++iTest->iState<6)
  1295 		LOG_MESSAGE2(KLog,iTest->iState);
  1296 	switch(iTest->iState)
  1297 		{
  1298 /**
  1299 @SYMTestCaseID		GRAPHICS-WSERV-0265
  1300 
  1301 @SYMDEF             DEF081259
  1302 
  1303 @SYMTestCaseDesc    Test invalidation a test window and check it
  1304 					redraws correctly
  1305 
  1306 @SYMTestPriority    High
  1307 
  1308 @SYMTestStatus      Implemented
  1309 
  1310 @SYMTestActions     Invalidate a test window causing it to redraw 
  1311 
  1312 @SYMTestExpectedResults The test window redraws correctly
  1313 */
  1314 	case 1:
  1315 		((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0265"));
  1316 		iTest->LogSubTest(Redraw0);
  1317 		SetBackground(TRgb::Gray256(128));
  1318 		iDrawRequestsFromTestWindow=iTestRedrawWin->DrawRequests();
  1319 		InvalidateTestWins(TRect(10,10,50,50));
  1320 		break;
  1321 	case 2:
  1322 		((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0265"));
  1323 		TheClient->iWs.Finish();
  1324 		WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
  1325 		testWindowDraws=iTestRedrawWin->DrawRequests();
  1326 		if (iDrawRequestsFromTestWindow+1!=testWindowDraws)
  1327 			{
  1328 			LOG_MESSAGE3(_L("wrong number of test window draw requests %d %d"),
  1329 					iDrawRequestsFromTestWindow,
  1330 					testWindowDraws);
  1331 			TEST(EFalse);
  1332 			}
  1333 		CheckRedrawWindows();
  1334 		++iWinContent;
  1335 		iTestRedrawWin->Reset();
  1336 		iBaseRedrawWin->Reset();
  1337 		TheClient->Flush();
  1338 		WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
  1339 		break;
  1340 /**
  1341 @SYMTestCaseID		GRAPHICS-WSERV-0266
  1342 
  1343 @SYMDEF             DEF081259
  1344 
  1345 @SYMTestCaseDesc    Test invalidation a test window and check it
  1346 					redraws correctly
  1347 
  1348 @SYMTestPriority    High
  1349 
  1350 @SYMTestStatus      Implemented
  1351 
  1352 @SYMTestActions     Invalidate a test window causing it to redraw 
  1353 
  1354 @SYMTestExpectedResults The test window redraws correctly
  1355 */
  1356 	case 3:
  1357 		((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0266"));
  1358 		iTest->LogSubTest(Redraw1);
  1359 		InvalidateTestWins(TRect(1,1,150,20));
  1360 		TheClient->iWs.Finish();
  1361 		WaitForRedrawsToFinish(ECheckRedrawActiveObjectAndInvalidRegions);
  1362 		break;
  1363 	case 4:
  1364 		((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0266"));
  1365 		CheckRedrawWindows();
  1366 		++iWinContent;
  1367 		iTestRedrawWin->Reset();
  1368 		iBaseRedrawWin->Reset();
  1369 		TheClient->iWs.Flush();
  1370 		break;
  1371 /**
  1372 @SYMTestCaseID		GRAPHICS-WSERV-0267
  1373 
  1374 @SYMDEF             DEF081259
  1375 
  1376 @SYMTestCaseDesc    Test invalidation a region of a test window and check it
  1377 					redraws correctly
  1378 
  1379 @SYMTestPriority    High
  1380 
  1381 @SYMTestStatus      Implemented
  1382 
  1383 @SYMTestActions     Invalidate a region of a test window causing it to redraw 
  1384 
  1385 @SYMTestExpectedResults The test window redraws correctly
  1386 */
  1387 		case 5:
  1388 			((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0267"));
  1389 			iTest->LogSubTest(Redraw2);
  1390 			GetInvalidRegionTestsL();
  1391 			break;
  1392 /**
  1393 @SYMTestCaseID		GRAPHICS-WSERV-0268
  1394 
  1395 @SYMDEF             DEF081259
  1396 
  1397 @SYMTestCaseDesc    Test moving an invalid  region of a test window and check it
  1398 					redraws correctly
  1399 
  1400 @SYMTestPriority    High
  1401 
  1402 @SYMTestStatus      Implemented
  1403 
  1404 @SYMTestActions     Move an invalid region of a test window causing it to redraw 
  1405 
  1406 @SYMTestExpectedResults The test window redraws correctly
  1407 */
  1408 		case 6:
  1409 			((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0268"));
  1410 			iTest->LogSubTest(Redraw3);
  1411 			MoveInvalidAreaL();
  1412 			break;
  1413 
  1414 /**
  1415 @SYMTestCaseID		GRAPHICS-WSERV-0270
  1416 
  1417 @SYMDEF             DEF081259
  1418 
  1419 @SYMTestCaseDesc    Test the order redraws occur in a test window 
  1420 
  1421 @SYMTestPriority    High
  1422 
  1423 @SYMTestStatus      Implemented
  1424 
  1425 @SYMTestActions     Set up a number of redraws for a test window and
  1426 					invalidate it
  1427 
  1428 @SYMTestExpectedResults The order the test window redraws occur is correct
  1429 */
  1430 
  1431 		case 7:
  1432 			((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0270"));
  1433 			iTest->LogSubTest(Redraw4);
  1434 			CheckOrderL();
  1435 			break;
  1436 /**
  1437 @SYMTestCaseID		GRAPHICS-WSERV-0271
  1438 
  1439 @SYMDEF             DEF081259
  1440 
  1441 @SYMTestCaseDesc    Test defect INC049554L does not occur
  1442 
  1443 @SYMTestPriority    High
  1444 
  1445 @SYMTestStatus      Implemented
  1446 
  1447 @SYMTestActions     Check that defect INC049554L does not occur when a test 
  1448 					window is redrawn
  1449 
  1450 @SYMTestExpectedResults Defect INC049554L does not occur
  1451 */
  1452 		case 8:
  1453 			((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0271"));
  1454 			iTest->LogSubTest(Redraw5);
  1455 			CheckDefectINC049554L();
  1456 			break;
  1457 /** 
  1458  @SYMTestCaseID GRAPHICS-WSERV-0359
  1459 
  1460   @SYMDEF  			PDEF099892
  1461 
  1462   @SYMTestCaseDesc Ensure that changing the Ordinal postion of an Invisible Window
  1463   				   does not affect the Transparent Window  or Opaque Window redrawing.
  1464 
  1465   @SYMTestPriority Medium
  1466 
  1467   @SYMTestStatus Implemented
  1468 
  1469   @SYMTestActions Create an Invisible Window
  1470                   Create a Transparent Window
  1471                   Inside the Begin and End Redraw for the Transparent Window,
  1472                   change the Ordinal Position for Invisible Window to move it
  1473                   front to the Transparent Window.
  1474 
  1475   @SYMTestExpectedResults Changing the Ordinal postion for Invisible Window should not
  1476 						  affect the Transparent Window redrawing.
  1477 */
  1478 		case 9:
  1479 			((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0359"));
  1480 			iTest->LogSubTest(Redraw6);
  1481 			CheckOrdinalPositionDefectL();
  1482 			break;
  1483 /** 
  1484  @SYMTestCaseID GRAPHICS-WSERV-0360
  1485 
  1486   @SYMDEF  			PDEF099892
  1487 
  1488   @SYMTestCaseDesc Ensure that changing the Ordinal postion of an Invisible window
  1489   				   does not affect the Transparent Window  or Opaque Window redrawing.
  1490 
  1491   @SYMTestPriority Medium
  1492 
  1493   @SYMTestStatus Implemented
  1494 
  1495   @SYMTestActions Create an Invisible Window
  1496   				  Create an Opaque Window
  1497                   Create a Transparent Window
  1498                   Invisible Window is Behind the Opaque Window
  1499 				  and Opaque Window is Behind the Transparent Window.
  1500                   While drawing the Transparent Window, move the Invisible Window
  1501                   to the Front of Opaque Window. And while Drawing the Opaque Window
  1502                   move the Invisible Window again Behind the Opaque Window.
  1503 
  1504   @SYMTestExpectedResults Changing the Ordinal postion for Invisible window should not
  1505 						  affect the Transparent Window  or Opaque Window redrawing.
  1506 */
  1507 		case 10:
  1508 			((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0360"));
  1509 			iTest->LogSubTest(Redraw7);
  1510 			CheckDefectPDEF099892L();
  1511 			break;
  1512 /** 
  1513  @SYMTestCaseID GRAPHICS-WSERV-0361
  1514 
  1515   @SYMDEF  			DEF101548
  1516 
  1517   @SYMTestCaseDesc Ensure that changing the Ordinal postion of an Invisible window
  1518   				   does not affect the Transparent Window redrawing.
  1519 
  1520   @SYMTestPriority Low
  1521 
  1522   @SYMTestStatus Implemented
  1523 
  1524   @SYMTestActions Create an Invisible Window
  1525   				  Create an Opaque Window
  1526   				  Create a Blank Window
  1527   				  Create a Transparent Window
  1528   				  Invisible Window is Behind the Opaque Window
  1529   				  Opaque Window is Behind the Blank Window
  1530   				  and Blank Window is Behind the Transparent Window.
  1531   				  While drawing the Transparent Window, move the Invisible Window
  1532   				  to the Front/Back to one or all the Other Windows.
  1533   				  Also move the Blank Window Front/Back to the Transparent Window for other scenario.
  1534 
  1535   @SYMTestExpectedResults Changing the Ordinal postion for Invisible window should not
  1536 						  affect the Transparent Window redrawing.
  1537 */
  1538 	case 11:
  1539 		((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0361"));
  1540 		iTest->LogSubTest(Redraw8);
  1541 		CheckMMSDefectL(EFalse);
  1542 	case 12:
  1543 		((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0361"));
  1544 		iTest->LogSubTest(Redraw9);
  1545 		CheckMMSDefectL(ETrue);// In this case we will move Blank Window Front/Back to the Transparent Window to Test Defect PDEF099892
  1546 		break;
  1547 	case 13:
  1548 		iTest->LogSubTest(Redraw10);
  1549 /**
  1550   @SYMTestCaseID GRAPHICS-WSERV-0362
  1551 
  1552   @SYMDEF	PDEF117784
  1553 	
  1554   @SYMTestCaseDesc Ensure that drawing request for non active window will not 
  1555 	impact following redrawings
  1556 
  1557   @SYMTestPriority High
  1558 
  1559   @SYMTestStatus Implemented
  1560   
  1561   
  1562   @SYMTestActions 	Create test window as in active
  1563   					Create base window in active mode.
  1564   				    
  1565 					The test window is receiving a draw request before it activates, 
  1566 					doing an empty redraw, 
  1567 					Activate test window
  1568 					Draw test window properly in response to the next redraw request.  
  1569 
  1570   @SYMTestExpectedResults The next redraw request will be received and it will be drawn correctly. 
  1571 */	
  1572 			((CTRedrawTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0362"));
  1573 			CheckDefectPDEF117784L();
  1574 			break;
  1575 		case 14:
  1576 			((CTRedrawTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  1577 			((CTRedrawTestStep*)iStep)->CloseTMSGraphicsStep();
  1578 			TestComplete();
  1579 			break;
  1580 		default:
  1581 			TEST(EFalse);
  1582 		}
  1583 	((CTRedrawTestStep*)iStep)->RecordTestResultL();
  1584 	}
  1585 
  1586 __WS_CONSTRUCT_STEP__(RedrawTest)