os/graphics/windowing/windowserver/test/tauto/TWINDOW.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TWINDOW.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2934 @@
     1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// General window tests
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @test
    1.24 + @internalComponent - Internal Symbian test code
    1.25 +*/
    1.26 +
    1.27 +#include "TWINDOW.H"
    1.28 +
    1.29 +const TInt ENumCornerInsets=6;
    1.30 +const TInt corner0[ENumCornerInsets]={0,0,0,0,0,0};
    1.31 +const TInt corner1[ENumCornerInsets]={1,0,0,0,0,0};
    1.32 +const TInt corner2[ENumCornerInsets]={2,1,0,0,0,0};
    1.33 +const TInt corner3[ENumCornerInsets]={3,1,1,0,0,0};
    1.34 +const TInt corner5[ENumCornerInsets]={5,3,2,1,1,0};
    1.35 +const TInt KBaseUserEvent=61750;		//0xF136 - a random number that is unlikely to be used by other applicaions for user event sending
    1.36 +
    1.37 +//
    1.38 +
    1.39 +CWinTestWindow::CWinTestWindow(TRgb aCol) : CBlankWindow(aCol)
    1.40 +	{
    1.41 +	}
    1.42 +
    1.43 +CWinTestWindow::~CWinTestWindow()
    1.44 +	{
    1.45 +	delete iChild;
    1.46 +	}
    1.47 +
    1.48 +void CWinTestWindow::ConstructL(TPoint pos,TSize size,CTWinBase *aParent, CWindowGc &aGc, TInt aDepth)
    1.49 +	{
    1.50 +	iWin=RWindow(TheClient->iWs);
    1.51 +	User::LeaveIfError(iWin.Construct(*(aParent->WinTreeNode()),ENullWsHandle));
    1.52 +	SetExt(pos,size);
    1.53 +	if (aDepth<3)
    1.54 +		{
    1.55 +		iChild=new(ELeave) CWinTestWindow(TRgb::Gray256(iCol.Gray256()+34));
    1.56 +		size.iWidth-=8;
    1.57 +		size.iHeight-=8;
    1.58 +		iChild->ConstructL(TPoint(4,4),size,this,aGc,aDepth+1);
    1.59 +		}
    1.60 +	Activate();
    1.61 +	AssignGC(aGc);
    1.62 +	}
    1.63 +
    1.64 +//
    1.65 +
    1.66 +CEvWindowGroup* CEvWindowGroup::NewLC(CTClient* aClient,CTWsGraphicsBase* aTest)
    1.67 +	{
    1.68 +	CEvWindowGroup* self=new(ELeave) CEvWindowGroup(aClient,aTest);
    1.69 +	CleanupStack::PushL(self);
    1.70 +	self->ConstructL();
    1.71 +	return self;
    1.72 +	}
    1.73 +
    1.74 +CEvWindowGroup::CEvWindowGroup(CTClient* aClient,CTWsGraphicsBase* aTest) : CTWindowGroup(aClient), iTest(aTest)
    1.75 +	{}
    1.76 +
    1.77 +void CEvWindowGroup::ConstructL()
    1.78 +	{
    1.79 +	CTWindowGroup::ConstructL();
    1.80 +	iGroupWin.EnableReceiptOfFocus(EFalse);
    1.81 +	}
    1.82 +
    1.83 +void CEvWindowGroup::SetExpectedEvent(TInt aType)
    1.84 +	{
    1.85 +	iTest->TEST(!iExpectingEvent);
    1.86 +	if (iExpectingEvent)
    1.87 +		{
    1.88 +		_LIT(KLog,"Setting expected event of type %d, when previouse event of type %d has not arrived (GpWinId=%d).");
    1.89 +		iTest->LOG_MESSAGE4(KLog,aType,iExpectedEvent,iGroupWin.Identifier());
    1.90 +		}
    1.91 +	iExpectedEvent=aType;
    1.92 +	iExpectingEvent=ETrue;
    1.93 +	}
    1.94 +
    1.95 +void CEvWindowGroup::SendEvent(TInt aType)
    1.96 +	{
    1.97 +	TWsEvent event;
    1.98 +	event.SetType(aType);
    1.99 +	iClient->iWs.SendEventToWindowGroup(iGroupWin.Identifier(),event);
   1.100 +	SetExpectedEvent(aType);
   1.101 +	iClient->Flush();
   1.102 +	}
   1.103 +
   1.104 +void CEvWindowGroup::UserEvent(TInt aEventType)
   1.105 +	{
   1.106 +	iTest->TEST(iExpectingEvent && iExpectedEvent==aEventType);
   1.107 +	if (!iExpectingEvent || iExpectedEvent!=aEventType)
   1.108 +		{
   1.109 +		TInt id=iGroupWin.Identifier();
   1.110 +		if (!iExpectingEvent)
   1.111 +			{
   1.112 +			_LIT(KLog,"Event of type %d recieved when not expecting an event (GpWinId=%d).");
   1.113 +			iTest->LOG_MESSAGE3(KLog,aEventType,id);
   1.114 +			}
   1.115 +		else
   1.116 +			{
   1.117 +			_LIT(KLog,"Event of type %d when expecting an event of type %d (GpWinId=%d).");
   1.118 +			iTest->LOG_MESSAGE4(KLog,aEventType,iExpectingEvent,id);
   1.119 +			}
   1.120 +		}
   1.121 +	iExpectingEvent=EFalse;
   1.122 +	}
   1.123 +
   1.124 +//
   1.125 +
   1.126 +CTWindowTest::CTWindowTest(CTestStep* aStep) : CTWsGraphicsBase(aStep)
   1.127 +	{}
   1.128 +
   1.129 +CTWindowTest::~CTWindowTest()
   1.130 +	{
   1.131 +	delete iWin;
   1.132 +	}
   1.133 +
   1.134 +void CTWindowTest::ConstructL()
   1.135 +	{}
   1.136 +
   1.137 +TInt CTWindowTest::MoveGroup(TAny* aParam)
   1.138 +	{
   1.139 +	RWsSession ws;
   1.140 +	TInt err=ws.Connect();
   1.141 +	if (err==KErrNone)
   1.142 +		{
   1.143 +		TInt command=static_cast<TWindowThreadParam*>(aParam)->iCommand;
   1.144 +		err=ws.SetWindowGroupOrdinalPosition(command&EIdMask,(command&EPosMask)>>EPosShift);
   1.145 +		ws.Finish();
   1.146 +		ws.Close();
   1.147 +		}
   1.148 +	return err;
   1.149 +	}
   1.150 +
   1.151 +void CTWindowTest::CreateTestWindowL()
   1.152 +	{
   1.153 +	iWin=new(ELeave) CWinTestWindow(TRgb(0,0,0));
   1.154 +	iWin->ConstructL(TPoint(1,1),TSize(TestWin->Size().iWidth/2,TestWin->Size().iHeight/2),TheClient->iGroup,*TheClient->iGc,0);
   1.155 +	}
   1.156 +
   1.157 +void CTWindowTest::DrawWindows(CWinTestWindow *aWin)
   1.158 +	{
   1.159 +	if (aWin->iChild)
   1.160 +		DrawWindows(aWin->iChild);
   1.161 +	aWin->Win()->BeginRedraw();
   1.162 +	TheGc->Activate(*aWin->Win());
   1.163 +	TheGc->DrawRect(TRect(aWin->Win()->Size()));
   1.164 +	TheGc->Deactivate();
   1.165 +	aWin->Win()->EndRedraw();
   1.166 +	TheClient->iWs.Flush();
   1.167 +	}
   1.168 +
   1.169 +void CTWindowTest::CheckAndDestroyWindows()
   1.170 +	{
   1.171 +	DrawWindows(iWin);
   1.172 +	delete iWin;
   1.173 +	iWin=NULL;
   1.174 +	}
   1.175 +
   1.176 +void CTWindowTest::DestroyWindowWithActiveGc()
   1.177 +	{
   1.178 +	iWin->Win()->BeginRedraw();
   1.179 +	TheGc->Activate(*iWin->Win());
   1.180 +	delete iWin;
   1.181 +	TheGc->Deactivate();
   1.182 +	iWin=NULL;
   1.183 +	}
   1.184 +
   1.185 +void CTWindowTest::DestroyWindowWithActiveGc2L()
   1.186 +	{
   1.187 +	iWin->Win()->BeginRedraw();
   1.188 +	TheGc->Activate(*iWin->Win());
   1.189 +	CWindowGc *gc1=new(ELeave) CWindowGc(TheClient->iScreen);
   1.190 +	CWindowGc *gc2=new(ELeave) CWindowGc(TheClient->iScreen);
   1.191 +	CWindowGc *gc3=new(ELeave) CWindowGc(TheClient->iScreen);
   1.192 +	gc1->Construct();
   1.193 +	gc2->Construct();
   1.194 +	gc3->Construct();
   1.195 +	gc1->Activate(*iWin->Win());
   1.196 +	gc2->Activate(*iWin->Win());
   1.197 +	gc3->Activate(*iWin->Win());
   1.198 +	delete iWin;
   1.199 +	TheGc->Deactivate();
   1.200 +	delete gc1;
   1.201 +	delete gc2;
   1.202 +	delete gc3;
   1.203 +	iWin=NULL;
   1.204 +	}
   1.205 +
   1.206 +LOCAL_C TInt DoPanicTest(TInt aInt, TAny *aScreenNumber)
   1.207 +	{
   1.208 +	RWsSession ws;
   1.209 +	User::LeaveIfError(ws.Connect());
   1.210 +	// use correct screen
   1.211 +	//
   1.212 +	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
   1.213 +	User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
   1.214 +
   1.215 +	RWindowGroup group(ws);
   1.216 +	group.Construct(888);
   1.217 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
   1.218 +
   1.219 +	RWindow redraw(ws);
   1.220 +	redraw.Construct(group,88);
   1.221 +
   1.222 +	RBackedUpWindow backedUp(ws);
   1.223 +	backedUp.Construct(group,EGray16,99);
   1.224 +
   1.225 +	RBlankWindow blank(ws);
   1.226 +	blank.Construct(group,111);
   1.227 +
   1.228 +	RWindowBase *base=NULL;
   1.229 +	TInt source=aInt/10000;
   1.230 +	TInt target=(aInt%10000)/100;
   1.231 +	TInt panic=aInt%100;
   1.232 +	switch(source)
   1.233 +		{
   1.234 +		case 0:
   1.235 +			base= &redraw;
   1.236 +			break;
   1.237 +		case 1:
   1.238 +			base= &backedUp;
   1.239 +			break;
   1.240 +		case 2:
   1.241 +			base= &blank;
   1.242 +			break;
   1.243 +		}
   1.244 +	switch(target)
   1.245 +		{
   1.246 +		case 0:
   1.247 +			{
   1.248 +			RWindow *win=(RWindow *)base;
   1.249 +			switch(panic)
   1.250 +				{
   1.251 +				case 0:
   1.252 +					win->BeginRedraw();
   1.253 +					break;
   1.254 +				case 1:
   1.255 +					ws.SetAutoFlush(ETrue);
   1.256 +					win->BeginRedraw(TRect(0,0,1,1));
   1.257 +					ws.SetAutoFlush(EFalse);
   1.258 +					break;
   1.259 +				case 2:
   1.260 +					ws.SetAutoFlush(ETrue);
   1.261 +					win->EndRedraw();
   1.262 +					ws.SetAutoFlush(EFalse);
   1.263 +					break;
   1.264 +				case 3:
   1.265 +					win->Invalidate();
   1.266 +					break;
   1.267 +				case 4:
   1.268 +					win->Invalidate(TRect(0,0,1,1));
   1.269 +					break;
   1.270 +				case 5:
   1.271 +					{
   1.272 +					RRegion region;
   1.273 +					win->GetInvalidRegion(region);
   1.274 +					}
   1.275 +					break;
   1.276 +				case 6:
   1.277 +					win->SetBackgroundColor(TRgb(0,0,0));
   1.278 +					break;
   1.279 +				case 7:
   1.280 +					return(EWsExitReasonFinished);
   1.281 +				}
   1.282 +			break;
   1.283 +			}
   1.284 +		case 1:
   1.285 +			{
   1.286 +			RBackedUpWindow *win=(RBackedUpWindow *)base;
   1.287 +			switch(panic)
   1.288 +				{
   1.289 +				case 0:
   1.290 +					win->BitmapHandle();
   1.291 +					break;
   1.292 +				case 1:
   1.293 +					win->UpdateScreen();
   1.294 +					break;
   1.295 +				case 2:
   1.296 +					win->UpdateScreen(TRegionFix<1>(TRect(10,10,20,20)));
   1.297 +					break;
   1.298 +				case 3:
   1.299 +					win->UpdateBackupBitmap();
   1.300 +					break;
   1.301 +				case 4:
   1.302 +					win->MaintainBackup();
   1.303 +					break;
   1.304 +				case 5:
   1.305 +					return(EWsExitReasonFinished);
   1.306 +				}
   1.307 +			break;
   1.308 +			}
   1.309 +		case 2:
   1.310 +			{
   1.311 +			RBlankWindow *win=(RBlankWindow *)base;
   1.312 +			switch(panic)
   1.313 +				{
   1.314 +				case 0:
   1.315 +					win->SetColor(TRgb(0));
   1.316 +					break;
   1.317 +				case 1:
   1.318 +					return(EWsExitReasonFinished);
   1.319 +				}
   1.320 +			break;
   1.321 +			}
   1.322 +		}
   1.323 +	ws.Flush();
   1.324 +	return(EWsExitReasonBad);	// Should never get here, but it's baaddd if it does
   1.325 +	}
   1.326 +
   1.327 +struct TWsLocalStructure
   1.328 +	{
   1.329 +	TInt xPos;
   1.330 +	TInt yPos;
   1.331 +	TInt Length;
   1.332 +	TAny *ptr;
   1.333 +	};
   1.334 +
   1.335 +LOCAL_C TInt DoPanicTest2(TInt aInt, TAny *aScreenNumber)
   1.336 +	{
   1.337 +	RWsSession ws;
   1.338 +	User::LeaveIfError(ws.Connect());
   1.339 +//
   1.340 +	CWsScreenDevice *screen=new(ELeave) CWsScreenDevice(ws);
   1.341 +	screen->Construct((TInt)aScreenNumber);
   1.342 +//
   1.343 +	RWindowGroup group(ws);
   1.344 +	group.Construct(999);
   1.345 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
   1.346 +
   1.347 +	RWindow win(ws);
   1.348 +	win.Construct(group,122);
   1.349 +	win.Activate();
   1.350 +
   1.351 +	switch(aInt)
   1.352 +		{
   1.353 +		case 0:
   1.354 +			{
   1.355 +			win.BeginRedraw();
   1.356 +			CWindowGc *gc;
   1.357 +			screen->CreateContext(gc);
   1.358 +			gc->Activate(win);
   1.359 +			CFbsFont *font;
   1.360 +			screen->GetNearestFontToDesignHeightInTwips((CFont *&)font,TFontSpec());
   1.361 +			gc->UseFont(font);
   1.362 +			TWsLocalStructure params;
   1.363 +			params.xPos=0;
   1.364 +			params.yPos=0;
   1.365 +			params.Length=1;
   1.366 +			TPckgC<TWsLocalStructure> pkg(params);
   1.367 +			TPtr8 ptr(NULL,10,10);
   1.368 +			ws.TestWriteReplyByProvidingRemoteReadAccess(gc->WsHandle(),EWsGcOpDrawTextPtr,pkg,ptr); // Bad source descriptor
   1.369 +			}
   1.370 +			break;
   1.371 +		case 1:
   1.372 +			{
   1.373 +			TPtr8 bad(NULL,0); // Bad descriptor
   1.374 +			ws.TestWriteReplyP(win.WsHandle(),EWsWinOpSize,NULL,0,&bad); // Bad descriptor
   1.375 +			}
   1.376 +			break;
   1.377 +		case 2:
   1.378 +			{
   1.379 +			TSize size;
   1.380 +			TPtr8 bad((TUint8 *)&size,4,4); // Short descriptor
   1.381 +			ws.TestWriteReplyP(win.WsHandle(),EWsWinOpSize,NULL,0,&bad); // Short descriptor
   1.382 +			}
   1.383 +			break;
   1.384 +		case 3:
   1.385 +			win.EnablePointerMoveBuffer();
   1.386 +			break;
   1.387 +		case 4:
   1.388 +			{
   1.389 +			RBackedUpWindow backup(ws);
   1.390 +			backup.Construct(group,EGray16,123);
   1.391 +			backup.Activate();
   1.392 +			backup.SetRequiredDisplayMode(EGray16);
   1.393 +			}
   1.394 +			break;
   1.395 +		default:
   1.396 +			return(EWsExitReasonFinished);
   1.397 +		}
   1.398 +	ws.Flush();
   1.399 +	return(EWsExitReasonBad);	// Should never get here, but it's baaddd if it does
   1.400 +	}
   1.401 +
   1.402 +LOCAL_C TInt CallWindowFuction(RWindowTreeNode* aWin,TInt aWinType,TInt aFunc,RWsSession aWs)
   1.403 +	{
   1.404 +	switch(aWinType)
   1.405 +		{
   1.406 +	case 0:		//Call functions from RWindowTreeNode
   1.407 +		{
   1.408 +		RWindowTreeNode* win=aWin;
   1.409 +		switch(aFunc)
   1.410 +			{
   1.411 +		case 0:
   1.412 +			win->OrdinalPosition();
   1.413 +			break;
   1.414 +		case 1:
   1.415 +			win->SetOrdinalPosition(1);
   1.416 +			break;
   1.417 +		case 2:
   1.418 +			win->SetOrdinalPosition(1,2);
   1.419 +			break;
   1.420 +		case 3:
   1.421 +			win->FullOrdinalPosition();
   1.422 +			break;
   1.423 +		case 4:
   1.424 +			win->Parent();
   1.425 +			break;
   1.426 +		case 5:
   1.427 +			win->PrevSibling();
   1.428 +			break;
   1.429 +		case 6:
   1.430 +			win->SetFaded(0,RWindowTreeNode::EFadeIncludeChildren);
   1.431 +			break;
   1.432 +		case 7:
   1.433 +			win->WindowGroupId();
   1.434 +			break;
   1.435 +		//The following can be called on a window with no parent without panicking
   1.436 +		case 8:
   1.437 +			win->ClearPointerCursor();
   1.438 +			break;
   1.439 +		case 9:
   1.440 +			win->ClientHandle();
   1.441 +			break;
   1.442 +		case 10:
   1.443 +			win->DisableErrorMessages();
   1.444 +			break;
   1.445 +		case 11:
   1.446 +			win->DisableFocusChangeEvents();
   1.447 +			break;
   1.448 +		case 12:
   1.449 +			win->DisableGroupChangeEvents();
   1.450 +			break;
   1.451 +		case 13:
   1.452 +			win->DisableGroupListChangeEvents();
   1.453 +			break;
   1.454 +		case 14:
   1.455 +			win->DisableModifierChangedEvents();
   1.456 +			break;
   1.457 +		case 15:
   1.458 +			win->DisableOnEvents();
   1.459 +			break;
   1.460 +		case 16:
   1.461 +			win->DisableVisibilityChangeEvents();
   1.462 +			break;
   1.463 +		case 17:
   1.464 +			win->EnableErrorMessages(EEventControlAlways);
   1.465 +			break;
   1.466 +		case 18:
   1.467 +			win->EnableFocusChangeEvents();
   1.468 +			break;
   1.469 +		case 19:
   1.470 +			win->EnableGroupChangeEvents();
   1.471 +			break;
   1.472 +		case 20:
   1.473 +			win->EnableGroupListChangeEvents();
   1.474 +			break;
   1.475 +		case 21:
   1.476 +			win->EnableModifierChangedEvents(0,EEventControlAlways);
   1.477 +			break;
   1.478 +		case 22:
   1.479 +			win->EnableVisibilityChangeEvents();
   1.480 +			break;
   1.481 +		case 23:
   1.482 +			win->NextSibling();
   1.483 +			break;
   1.484 +		case 24:
   1.485 +			win->OrdinalPriority();
   1.486 +			break;
   1.487 +		case 25:
   1.488 +			win->SetNonFading(0);
   1.489 +			break;
   1.490 +		case 26:
   1.491 +			win->SetPointerCursor(0);
   1.492 +			break;
   1.493 +		case 27:
   1.494 +			win->Child();
   1.495 +			break;
   1.496 +		case 28:
   1.497 +			return(EWsExitReasonFinished);
   1.498 +		default:;
   1.499 +			}
   1.500 +		}
   1.501 +		break;
   1.502 +	case 1:		//Call functions from RWindowGroup
   1.503 +		{
   1.504 +		RWindowGroup* win=(RWindowGroup*)aWin;
   1.505 +		switch(aFunc)
   1.506 +			{
   1.507 +		case 0:
   1.508 +			win->EnableReceiptOfFocus(ETrue);
   1.509 +			break;
   1.510 +		case 1:
   1.511 +			win->AutoForeground(ETrue);
   1.512 +			break;
   1.513 +		case 2:
   1.514 +			win->SetOrdinalPriorityAdjust(5);
   1.515 +			break;
   1.516 +		case 3:
   1.517 +			win->CaptureKey(20,0,0);
   1.518 +			break;
   1.519 +		case 4:
   1.520 +			win->CaptureKeyUpAndDowns(20,0,0);
   1.521 +			break;
   1.522 +		case 5:
   1.523 +		case 6:
   1.524 +			{
   1.525 +			RWindowGroup group(aWs);
   1.526 +			group.Construct(876);
   1.527 +			group.EnableReceiptOfFocus(EFalse);		// Stop auto group switching on close
   1.528 +			if (aFunc==5)
   1.529 +				win->CancelCaptureKey(group.CaptureKey(20,0,0));
   1.530 +			else
   1.531 +				win->CancelCaptureKeyUpAndDowns(group.CaptureKeyUpAndDowns(20,0,0));
   1.532 +			}
   1.533 +			break;
   1.534 +		case 7:
   1.535 +			win->AddPriorityKey(20,0,0);
   1.536 +			break;
   1.537 +		case 8:
   1.538 +			win->RemovePriorityKey(20,0,0);
   1.539 +			break;
   1.540 +		case 9:
   1.541 +		case 10:
   1.542 +			{
   1.543 +			RWindowGroup group(aWs);
   1.544 +			group.Construct(765);
   1.545 +			group.EnableReceiptOfFocus(EFalse);		// Stop auto group switching on close
   1.546 + 			RWindow window(aWs);
   1.547 +			window.Construct(group,79);
   1.548 +			if (aFunc==9)
   1.549 +				win->SetTextCursor(window,TPoint(45,46),TTextCursor());
   1.550 +			else
   1.551 +				win->SetTextCursor(window,TPoint(55,66),TTextCursor(),TRect(TSize(5,8)));
   1.552 +			}
   1.553 +			break;
   1.554 +		case 11:
   1.555 +			win->CancelTextCursor();
   1.556 +			break;
   1.557 +		case 12:
   1.558 +			win->SetOwningWindowGroup(456);
   1.559 +			break;
   1.560 +		case 13:
   1.561 +			win->DefaultOwningWindow();
   1.562 +			break;
   1.563 +		case 14:
   1.564 +			{
   1.565 +			TBufC<8> text(_L("abcdef"));
   1.566 +			win->SetName(text);
   1.567 +			}
   1.568 +			break;
   1.569 +		case 15:
   1.570 +			{
   1.571 +			TBuf<16> text;
   1.572 +			User::LeaveIfError(win->Name(text));
   1.573 +			}
   1.574 +			break;
   1.575 +		case 16:
   1.576 +			win->Identifier();
   1.577 +			break;
   1.578 +		case 17:
   1.579 +			win->DisableKeyClick(ETrue);
   1.580 +			break;
   1.581 +		case 18:
   1.582 +			/*{
   1.583 +			TPtr8 text(NULL,0);
   1.584 +			TUid uid;
   1.585 +			User::LeaveIfError(win->FetchMessage(uid,text));
   1.586 +			}*/
   1.587 +			win->Identifier();
   1.588 +			break;
   1.589 +		case 19:
   1.590 +			User::LeaveIfError(win->EnableScreenChangeEvents());
   1.591 +			break;
   1.592 +		case 20:
   1.593 +			win->EnableScreenChangeEvents();
   1.594 +			break;
   1.595 +		case 21:
   1.596 +			win->DisableScreenChangeEvents();
   1.597 +			break;
   1.598 +		case 22:
   1.599 +			win->SimulatePointerEvent(TRawEvent());
   1.600 +			break;
   1.601 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NGA
   1.602 +        case 23: 	
   1.603 +        	win->SimulateAdvancedPointerEvent(TRawEvent());
   1.604 +  	  		break;
   1.605 +        case 24:	
   1.606 +			return(EWsExitReasonFinished);
   1.607 +#else
   1.608 +		case 23:	
   1.609 +			return(EWsExitReasonFinished);
   1.610 +#endif			
   1.611 +		default:;
   1.612 +			}
   1.613 +		}
   1.614 +		break;
   1.615 +	case 2:					//Call functions from RWindowBase
   1.616 +		{
   1.617 +		RWindowBase* win=(RWindowBase*)aWin;
   1.618 +		switch(aFunc)
   1.619 +			{
   1.620 +		case 0:
   1.621 +			win->SetPosition(TPoint(7,8));
   1.622 +			break;
   1.623 +		case 1:
   1.624 +			User::LeaveIfError(win->SetSizeErr(TSize(21,22)));
   1.625 +			break;
   1.626 +		case 2:
   1.627 +			User::LeaveIfError(win->SetExtentErr(TPoint(8,9),TSize(21,22)));
   1.628 +			break;
   1.629 +		case 3:
   1.630 +			win->ClaimPointerGrab();
   1.631 +			break;
   1.632 +		case 4:
   1.633 +			win->SetVisible(ETrue);
   1.634 +			break;
   1.635 +		case 5:
   1.636 +			win->EnableBackup();
   1.637 +			break;
   1.638 +		case 6:
   1.639 +			win->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect());
   1.640 +			break;
   1.641 +		case 7:
   1.642 +			win->PasswordWindow(EPasswordCancel);
   1.643 +			break;
   1.644 +		case 8:
   1.645 +			win->FadeBehind(ETrue);
   1.646 +			break;
   1.647 +		//These can all be called on a window with no parent without panicking
   1.648 +		case 9:
   1.649 +			win->SetVisible(EFalse);
   1.650 +			break;
   1.651 +		case 10:
   1.652 +			{
   1.653 +			RWindowGroup group(aWs);
   1.654 +			group.Construct(567);
   1.655 +			group.EnableReceiptOfFocus(EFalse);		// Stop auto group switching on close
   1.656 + 			RWindow window(aWs);
   1.657 +			window.Construct(group,97);
   1.658 +			win->InquireOffset(window);
   1.659 +			}
   1.660 +			break;
   1.661 +		case 11:
   1.662 +			win->PointerFilter(0,0);
   1.663 +			break;
   1.664 +		case 12:
   1.665 +			win->SetPointerGrab(ETrue);
   1.666 +			break;
   1.667 +		case 13:
   1.668 +			win->SetPointerCapture(0);
   1.669 +			break;
   1.670 +		case 14:
   1.671 +			win->Size();
   1.672 +			break;
   1.673 +		case 15:
   1.674 +			win->Position();
   1.675 +			break;
   1.676 +		case 16:
   1.677 +			User::LeaveIfError(win->SetCornerType(EWindowCorner5,0));
   1.678 +			break;
   1.679 +		case 17:
   1.680 +			{
   1.681 +			TRegionFix<3> region;
   1.682 +			User::LeaveIfError(win->SetShape(region));
   1.683 +			}
   1.684 +			break;
   1.685 +		case 18:
   1.686 +			User::LeaveIfError(win->SetRequiredDisplayMode(EColor16));
   1.687 +			break;
   1.688 +		case 19:
   1.689 +			win->DisplayMode();
   1.690 +			break;
   1.691 +		case 20:
   1.692 +			win->CancelPointerRepeatEventRequest();
   1.693 +			break;
   1.694 +		case 21:
   1.695 +			win->AllocPointerMoveBuffer(10,0);
   1.696 +			break;
   1.697 +		case 22:
   1.698 +			win->FreePointerMoveBuffer();
   1.699 +			break;
   1.700 +		case 23:
   1.701 +			win->DisablePointerMoveBuffer();
   1.702 +			break;
   1.703 +		case 24:
   1.704 +			{
   1.705 +			TBuf8<16> buf;
   1.706 +			win->RetrievePointerMoveBuffer(buf);
   1.707 +			}
   1.708 +			break;
   1.709 +		case 25:
   1.710 +			win->DiscardPointerMoveBuffer();
   1.711 +			break;
   1.712 +		case 26:
   1.713 +			User::LeaveIfError(win->AddKeyRect(TRect(TSize(10,10)),20,ETrue));
   1.714 +			break;
   1.715 +		case 27:
   1.716 +			win->RemoveAllKeyRects();
   1.717 +			break;
   1.718 +		case 28:
   1.719 +			win->EnablePointerMoveBuffer();
   1.720 +			break;
   1.721 +		case 29:
   1.722 +			return(EWsExitReasonFinished);
   1.723 +		default:;
   1.724 +			}
   1.725 +		}
   1.726 +		break;
   1.727 +	case 3:					//Call functions from RDrawableWindow
   1.728 +		{
   1.729 +		RDrawableWindow* win=(RDrawableWindow*)aWin;
   1.730 +		switch(aFunc)
   1.731 +			{
   1.732 +		//The following can be called on a window with no parent without panicking
   1.733 +		case 0:
   1.734 +			win->Scroll(TPoint(7,8));
   1.735 +			break;
   1.736 +		case 1:
   1.737 +			win->Scroll(TRect(9,10,11,12),TPoint(13,14));
   1.738 +			break;
   1.739 +		case 2:
   1.740 +			win->Scroll(TPoint(15,16),TRect(17,18,19,20));
   1.741 +			break;
   1.742 +		case 3:
   1.743 +			win->Scroll(TRect(21,22,23,24),TPoint(25,26),TRect(27,28,29,30));
   1.744 +			break;
   1.745 +		case 4:
   1.746 +			return(EWsExitReasonFinished);
   1.747 +		default:;
   1.748 +			}
   1.749 +		}
   1.750 +		break;
   1.751 +	case 4:					//Call functions from RBlankWindow
   1.752 +		{
   1.753 +		RBlankWindow* win=(RBlankWindow*)aWin;
   1.754 +		switch(aFunc)
   1.755 +			{
   1.756 +		case 0:
   1.757 +			win->SetSize(TSize(7,8));
   1.758 +			break;
   1.759 +		case 1:
   1.760 +			win->SetExtent(TPoint(27,28),TSize(17,18));
   1.761 +			break;
   1.762 +		//The following function can be called on a window with no parent without panicking
   1.763 +		case 2:
   1.764 +			win->SetColor(TRgb::Gray4(2));
   1.765 +			break;
   1.766 +		case 3:
   1.767 +			return(EWsExitReasonFinished);
   1.768 +		default:;
   1.769 +			}
   1.770 +		}
   1.771 +		break;
   1.772 +	case 5:					//Call functions from RWindow
   1.773 +		{
   1.774 +		RWindow* win=(RWindow*)aWin;
   1.775 +		switch(aFunc)
   1.776 +			{
   1.777 +		case 0:
   1.778 +			win->BeginRedraw();
   1.779 +			break;
   1.780 +		case 1:
   1.781 +			aWs.SetAutoFlush(ETrue);
   1.782 +			win->BeginRedraw(TRect(31,32,43,44));
   1.783 +			aWs.SetAutoFlush(EFalse);
   1.784 +			break;
   1.785 +		case 2:
   1.786 +			win->SetSize(TSize(5,6));
   1.787 +			break;
   1.788 +		case 3:
   1.789 +			win->SetExtent(TPoint(25,26),TSize(15,16));
   1.790 +			break;
   1.791 +		//The following can be called on a window with no parent without panicking
   1.792 +		case 4:
   1.793 +			win->Invalidate();
   1.794 +			break;
   1.795 +		case 5:
   1.796 +			win->Invalidate(TRect(51,52,63,64));
   1.797 +			break;
   1.798 +		case 6:			//These ones don't panic
   1.799 +			aWs.SetAutoFlush(ETrue);
   1.800 +			win->EndRedraw();
   1.801 +			aWs.SetAutoFlush(EFalse);
   1.802 +			break;
   1.803 +		case 7:
   1.804 +			{
   1.805 +			RRegion region;
   1.806 +			win->GetInvalidRegion(region);
   1.807 +			}
   1.808 +			break;
   1.809 +		case 8:
   1.810 +			win->SetBackgroundColor(TRgb::Gray4(1));
   1.811 +			break;
   1.812 +		case 9:
   1.813 +			win->SetBackgroundColor();
   1.814 +			break;
   1.815 +		case 10:
   1.816 +			return(EWsExitReasonFinished);
   1.817 +		default:;
   1.818 +			}
   1.819 +		}
   1.820 +		break;
   1.821 +	case 6:					//Call functions from RBackedUpWindow
   1.822 +		{
   1.823 +		RBackedUpWindow* win=(RBackedUpWindow*)aWin;
   1.824 +		switch(aFunc)			//None of these functions panic
   1.825 +			{
   1.826 +		//The following can be called on a window with no parent without panicking
   1.827 +		case 0:
   1.828 +			win->BitmapHandle();
   1.829 +			break;
   1.830 +		case 1:
   1.831 +			win->UpdateBackupBitmap();
   1.832 +			break;
   1.833 +		case 2:
   1.834 +			win->MaintainBackup();
   1.835 +			break;
   1.836 +		case 3:
   1.837 +			win->UpdateScreen();
   1.838 +			break;
   1.839 +		case 4:
   1.840 +			win->UpdateScreen(TRegionFix<1>(TRect(1,1,22,22)));
   1.841 +			break;
   1.842 +		case 5:
   1.843 +			return(EWsExitReasonFinished);
   1.844 +		default:;
   1.845 +			}
   1.846 +		}
   1.847 +		break;
   1.848 +		}
   1.849 +	aWs.Flush();
   1.850 +	return(EWsExitReasonBad);	// Should never get here, but it's baaddd if it does
   1.851 +	}
   1.852 +
   1.853 +LOCAL_C TInt DoPanicTest3(TInt aInt, TAny *aScreenNumber)
   1.854 +	{
   1.855 +	TInt winType=aInt/CTWindowTest::EWinTypeFactor;
   1.856 +	TInt func=aInt%CTWindowTest::EWinTypeFactor;
   1.857 +	RWsSession ws;
   1.858 +	User::LeaveIfError(ws.Connect());
   1.859 +	// use correct screen
   1.860 +	//
   1.861 +	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
   1.862 +	User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
   1.863 +
   1.864 +	RWindowGroup group(ws);
   1.865 +	group.Construct(888);
   1.866 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
   1.867 + 	RWindow window(ws);
   1.868 +	window.Construct(group,789);
   1.869 +	RWindowTreeNode* win;
   1.870 +	if (winType==1)
   1.871 +		win=&window;
   1.872 +	else
   1.873 +		win=&group;
   1.874 +
   1.875 +	return CallWindowFuction(win,winType,func,ws);
   1.876 +	}
   1.877 +
   1.878 +//PanicTestNoPanic
   1.879 +//This function is called from DoPanicTest4 for window functions that should run without
   1.880 +//panicking the user thread if its parent has been deleted.
   1.881 +TInt PanicTestNoPanic(RWindowTreeNode* aWin,TInt aWinType,TInt aFunc,RWsSession aWs,const TInt* const aFuncToSkip)
   1.882 +	{
   1.883 +	TInt funcReturn;
   1.884 +	for(;;)
   1.885 +		{
   1.886 +		if (aFuncToSkip && *aFuncToSkip == aFunc)
   1.887 +			{
   1.888 +			aFunc++;
   1.889 +			}
   1.890 +		funcReturn = CallWindowFuction(aWin,aWinType,aFunc,aWs);
   1.891 +		if (funcReturn==EWsExitReasonBad)
   1.892 +			{
   1.893 +			aFunc++;
   1.894 +			}
   1.895 +		else if (funcReturn==EWsExitReasonFinished)
   1.896 +			{
   1.897 +			return EWsExitReasonFinished;
   1.898 +			}
   1.899 +		else
   1.900 +			{
   1.901 +			return EWsExitReasonBad;
   1.902 +			}
   1.903 +		}
   1.904 +	}
   1.905 +
   1.906 +LOCAL_C TInt DoPanicTest4(TInt aInt, TAny *aScreenNumber)
   1.907 +	{
   1.908 + 	TInt winType=aInt/CTWindowTest::EWinTypeFactor;
   1.909 +	TInt func=aInt%CTWindowTest::EWinTypeFactor;
   1.910 +	RWsSession ws;
   1.911 +	User::LeaveIfError(ws.Connect());
   1.912 +	// use correct screen
   1.913 +	//
   1.914 +	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
   1.915 +	User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
   1.916 +
   1.917 +	RWindowGroup group(ws);
   1.918 +	group.Construct(234);
   1.919 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
   1.920 + 	RWindow window(ws);
   1.921 +	window.Construct(group,897);
   1.922 +	RBackedUpWindow backedUp(ws);
   1.923 +	backedUp.Construct(group,EGray16,98);
   1.924 +	RBlankWindow blank(ws);
   1.925 +	blank.Construct(group,169);
   1.926 +	RWindowTreeNode* win=&window;
   1.927 +	switch (winType)
   1.928 +		{
   1.929 +	case 0:
   1.930 +		{
   1.931 +		if (func > 8)			//if a func 8+ had panicked, fail the test
   1.932 +			{
   1.933 +			return EWsExitReasonBad;
   1.934 +			}
   1.935 +		else if (func==8)
   1.936 +			{
   1.937 +			group.Close();
   1.938 +			return PanicTestNoPanic(win,winType,func,ws,NULL);
   1.939 +			}
   1.940 +		}
   1.941 +		break;
   1.942 +	case 2:
   1.943 +		{
   1.944 +		if (func>9)			//if a func 9+ had panicked, fail the test
   1.945 +			{
   1.946 +			return EWsExitReasonBad;
   1.947 +			}
   1.948 +		else if (func==9)	//set window visible so that SetVisible(EFalse) (func 9) would crash before fix
   1.949 +			{
   1.950 +			window.SetVisible(ETrue);
   1.951 +			ws.Flush();
   1.952 +			group.Close();
   1.953 +			TInt funcToSkip = 28;	//this call needs to have already successfully allocated a pointer cursor
   1.954 +			return PanicTestNoPanic(win,winType,func,ws,&funcToSkip);
   1.955 +			}
   1.956 +		}
   1.957 +		break;
   1.958 +	case 4:
   1.959 +		{
   1.960 +		win=&blank;
   1.961 +		if (func>2)			//if a func 2+ had panicked, fail the test
   1.962 +			{
   1.963 +			return EWsExitReasonBad;
   1.964 +			}
   1.965 +		else if (func==2)
   1.966 +			{
   1.967 +			group.Close();
   1.968 +			return PanicTestNoPanic(win,winType,func,ws,NULL);
   1.969 +			}
   1.970 +		}
   1.971 +		break;
   1.972 +	case 5:
   1.973 +		{
   1.974 +		if (func>6)			//if a func 4+ had panicked, fail the test
   1.975 +			{
   1.976 +			return EWsExitReasonBad;
   1.977 +			}
   1.978 +		else if (func==4 || func==5)
   1.979 +			{
   1.980 +			if (CallWindowFuction(win,winType,func,ws)==EWsExitReasonBad)
   1.981 +				{
   1.982 +				func = 1;
   1.983 +				}
   1.984 +			else
   1.985 +				{
   1.986 +				return EWsExitReasonBad;
   1.987 +				}
   1.988 +			}
   1.989 +		else if (func==6)
   1.990 +			{
   1.991 +			group.Close();
   1.992 +			TInt funcToSkip = 6;	//Skip the call to EndRedraw in CallWindowFunction, it is not safe to call it on Window casts.
   1.993 +			return PanicTestNoPanic(win,winType,func,ws,&funcToSkip);
   1.994 +			}
   1.995 +		}
   1.996 +		break;
   1.997 +	case 6:
   1.998 +		{
   1.999 +		win=&backedUp;
  1.1000 +		if (func>0)
  1.1001 +			return EWsExitReasonBad;
  1.1002 +		else		//if (func==0)
  1.1003 +			{
  1.1004 +			TInt end=2;
  1.1005 +			while (func==0)
  1.1006 +				{
  1.1007 +				group.Close();
  1.1008 +				while (CallWindowFuction(win,winType,func,ws)==EWsExitReasonBad && ++func<end)
  1.1009 +					{}
  1.1010 +				if (func==end && end==2)
  1.1011 +					{
  1.1012 +					func=0;
  1.1013 +					end=4;
  1.1014 +					}
  1.1015 +				}
  1.1016 +			if (func==end)
  1.1017 +				return EWsExitReasonFinished;
  1.1018 +			else
  1.1019 +				return EWsExitReasonBad;
  1.1020 +			}
  1.1021 +		}
  1.1022 +		/*break;*/
  1.1023 +	default:;
  1.1024 +		}
  1.1025 +	group.Close();
  1.1026 +	return CallWindowFuction(win,winType,func,ws);
  1.1027 +	}
  1.1028 +
  1.1029 +LOCAL_C TInt DoPanicTest5(TInt aTest, TAny *aScreenNumber)
  1.1030 +	{
  1.1031 +	RWsSession ws;
  1.1032 +	User::LeaveIfError(ws.Connect());
  1.1033 +
  1.1034 +	CWsScreenDevice *scrDev=new(ELeave) CWsScreenDevice(ws);
  1.1035 +	scrDev->Construct((TInt)aScreenNumber);
  1.1036 +
  1.1037 +	RWindowGroup group(ws);
  1.1038 +	group.Construct(235);
  1.1039 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
  1.1040 + 	RWindow window(ws);
  1.1041 +	window.Construct(group,896);
  1.1042 +	CWindowGc *gc=new(ELeave) CWindowGc(scrDev);
  1.1043 +	gc->Construct();
  1.1044 +	gc->Activate(window);
  1.1045 +	group.Close();
  1.1046 +	switch (aTest)
  1.1047 +		{
  1.1048 +	case 0:
  1.1049 +		gc->Deactivate();
  1.1050 +		gc->Activate(window);
  1.1051 +		break;
  1.1052 +	case 1:
  1.1053 +		gc->DrawLine(TPoint(0,0),TPoint(10,10));
  1.1054 +		break;
  1.1055 +	default:
  1.1056 +		return(EWsExitReasonFinished);
  1.1057 +		}
  1.1058 +	ws.Flush();
  1.1059 +	return(EWsExitReasonBad);	// Should never get here, but it's baaddd if it does
  1.1060 +	}
  1.1061 +
  1.1062 +#if defined(_DEBUG)
  1.1063 +LOCAL_C TInt DoPanicTest6(TInt /*aInt*/, TAny *aScreenNumber)
  1.1064 +	{
  1.1065 +	RWsSession ws;
  1.1066 +	User::LeaveIfError(ws.Connect());
  1.1067 +	RWindowGroup group1(ws);
  1.1068 +	CWsScreenDevice* screen=new(ELeave) CWsScreenDevice(ws);
  1.1069 +	User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
  1.1070 +	group1.Construct(123456,ETrue,screen);
  1.1071 +	RWindowGroup group2(ws);
  1.1072 +	group2.Construct(123456,ETrue,screen);	// Should panic client here
  1.1073 +	return(EWsExitReasonBad);	// Should never get here
  1.1074 +	}
  1.1075 +#endif
  1.1076 +
  1.1077 +void CTWindowTest::TestInvalidFunctionsL()
  1.1078 +//
  1.1079 +// This code casts windows to be different types and then sends messages for the 'cast' that
  1.1080 +// should not be sent to the original type of window. These should all result in panics
  1.1081 +//
  1.1082 +	{
  1.1083 +	static TClientPanic PanicCode[]={EWservPanicDescriptor,EWservPanicDescriptor,EWservPanicDescriptor,
  1.1084 +									 EWservPanicNoPointerBuffer,EWservPanicBackupDisplayMode,
  1.1085 +									 EWservPanicNoFont};	// Dummy end value to catch out overflowing the array
  1.1086 +	INFO_PRINTF1(_L("AUTO  Test Invalid Functions "));
  1.1087 +	INFO_PRINTF1(_L(" Opcode Panics"));
  1.1088 +
  1.1089 +	for (TInt source=0;source<3;source++)
  1.1090 +		for (TInt target=0;target<3;target++)
  1.1091 +			if (source!=target)
  1.1092 +				for (TInt panic=0;;panic++)
  1.1093 +					{
  1.1094 +					TBool testFinished=EFalse;
  1.1095 +					TEST(iTest->TestWsPanicL(DoPanicTest,EWservPanicOpcode,source*10000+target*100+panic,(TAny*)iTest->iScreenNumber,&testFinished));
  1.1096 +					if (testFinished)
  1.1097 +						break;
  1.1098 +					}
  1.1099 +	_LIT(KSet,"Various Different Panics");
  1.1100 +	INFO_PRINTF1(KSet);
  1.1101 +	RDebug::Print(KPlatsecBegin);
  1.1102 +	for(TInt index=0;;index++)
  1.1103 +		{
  1.1104 +		TBool testFinished=EFalse;
  1.1105 +		TEST(iTest->TestWsPanicL(DoPanicTest2,PanicCode[index],index,(TAny*)iTest->iScreenNumber,&testFinished));
  1.1106 +		if (testFinished)
  1.1107 +			break;
  1.1108 +		}
  1.1109 +	RDebug::Print(KPlatsecEnd);
  1.1110 +	iTest->CloseAllPanicWindows();
  1.1111 +	}
  1.1112 +
  1.1113 +void CTWindowTest::ShadowAutoClearTest()
  1.1114 +	{
  1.1115 +	RWindowGroup group(TheClient->iWs);
  1.1116 +	group.Construct(1111);
  1.1117 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
  1.1118 +
  1.1119 +	RWindow background(TheClient->iWs);
  1.1120 +	background.Construct(group,133);
  1.1121 +	background.SetBackgroundColor();
  1.1122 +	background.Activate();
  1.1123 +
  1.1124 +	background.BeginRedraw();
  1.1125 +	TheClient->iGc->Activate(background);
  1.1126 +	TheClient->iGc->SetBrushColor(TRgb::Gray4(1));
  1.1127 +	TheClient->iGc->Clear();
  1.1128 +	background.EndRedraw();
  1.1129 +//
  1.1130 +	RBlankWindow tab2(TheClient->iWs);
  1.1131 +	tab2.Construct(group,144);
  1.1132 +	tab2.SetExtent(TPoint(10,00),TSize(200,10));
  1.1133 +	tab2.SetColor(TRgb::Gray256(170));
  1.1134 +	tab2.SetShadowHeight(1);
  1.1135 +	tab2.Activate();
  1.1136 +	RBlankWindow tab1(TheClient->iWs);
  1.1137 +	tab1.Construct(group,155);
  1.1138 +	tab1.SetExtent(TPoint(70,00),TSize(10,10));
  1.1139 +	tab1.SetColor(TRgb::Gray256(170));
  1.1140 +	tab1.SetShadowHeight(1);
  1.1141 +	tab1.Activate();
  1.1142 +	RBlankWindow blank(TheClient->iWs);
  1.1143 +	blank.Construct(group,156);
  1.1144 +	blank.SetExtent(TPoint(50,10),TSize(100,100));
  1.1145 +	blank.SetColor(TRgb::Gray256(170));
  1.1146 +	blank.SetShadowHeight(0);
  1.1147 +	blank.Activate();
  1.1148 +//
  1.1149 +	tab1.Close();
  1.1150 +	tab1.Construct(group,166);
  1.1151 +	tab1.SetExtent(TPoint(50,00),TSize(10,10));
  1.1152 +	tab1.SetColor(TRgb::Gray256(170));
  1.1153 +	tab1.SetShadowHeight(1);
  1.1154 +	tab1.Activate();
  1.1155 +	blank.Close();
  1.1156 +	RBlankWindow blank2(TheClient->iWs);
  1.1157 +	blank2.Construct(group,177);
  1.1158 +	blank2.SetColor(TRgb::Gray256(255));
  1.1159 +	blank2.SetExtent(TPoint(10,10),TSize(100,120));
  1.1160 +	blank2.SetShadowHeight(2);
  1.1161 +	blank2.Activate();
  1.1162 +	TheClient->iWs.Flush();
  1.1163 +//
  1.1164 +	background.BeginRedraw();
  1.1165 +	TheClient->iGc->SetBrushColor(TRgb::Gray4(1));
  1.1166 +	TheClient->iGc->Clear();
  1.1167 +	background.EndRedraw();
  1.1168 +//
  1.1169 +	tab1.Close();
  1.1170 +	tab2.Close();
  1.1171 +	blank2.Close();
  1.1172 +	background.BeginRedraw();
  1.1173 +	TheClient->iGc->Clear();
  1.1174 +	TheClient->iGc->Deactivate();
  1.1175 +	background.EndRedraw();
  1.1176 +	TheClient->iWs.Finish();
  1.1177 +	TSize size=TheClient->iScreen->SizeInPixels();
  1.1178 +	TBool rectCompare = TheClient->iScreen->RectCompare(TRect(0,0,size.iWidth>>1,size.iHeight),TRect(size.iWidth>>1,0,(size.iWidth>>1)<<1,size.iHeight));	
  1.1179 +	TEST(rectCompare);
  1.1180 +	if(!rectCompare)
  1.1181 +		INFO_PRINTF3(_L("TheClient->iScreen->RectCompare return value - Expected: %d, Actual: %d"), ETrue, rectCompare);
  1.1182 +	background.Close();
  1.1183 +	group.Close();
  1.1184 +	}
  1.1185 +
  1.1186 +void CTWindowTest::ClearRedraw(RWindow &aWindow, TRgb aRgb)
  1.1187 +	{
  1.1188 +	aWindow.BeginRedraw();
  1.1189 +	TheClient->iGc->Activate(aWindow);
  1.1190 +	TheClient->iGc->SetBrushColor(aRgb);
  1.1191 +	TheClient->iGc->Clear();
  1.1192 +	TheClient->iGc->Deactivate();
  1.1193 +	aWindow.EndRedraw();
  1.1194 +	}
  1.1195 +
  1.1196 +void CTWindowTest::CheckCorner(TCorner aCorner, const TInt *aInsetList)
  1.1197 +	{
  1.1198 +	TRect rect(TPoint(1,1),iBlankWin2->Size());
  1.1199 +	TPoint pos;
  1.1200 +	TInt direction;
  1.1201 +	if (aCorner==ECornerTL || aCorner==ECornerTR)
  1.1202 +		{
  1.1203 +		pos.iY=rect.iTl.iY;
  1.1204 +		direction=1;
  1.1205 +		}
  1.1206 +	else
  1.1207 +		{
  1.1208 +		pos.iY=rect.iBr.iY-1;
  1.1209 +		direction= -1;
  1.1210 +		}
  1.1211 +	if (aCorner==ECornerTL || aCorner==ECornerBL)
  1.1212 +		pos.iX=rect.iTl.iX;
  1.1213 +	else
  1.1214 +		pos.iX=rect.iBr.iX-8;
  1.1215 +	TRgb rgbBuf[8];
  1.1216 +	TPtr8 desc((TUint8 *)rgbBuf,sizeof(rgbBuf));
  1.1217 +	for(TInt count=0;count<ENumCornerInsets;count++,pos.iY+=direction)
  1.1218 +		{
  1.1219 +		iScreenDev->GetScanLine(desc,pos,8,EColor16MA);
  1.1220 +		if (aCorner==ECornerTR || aCorner==ECornerBR)
  1.1221 +			{
  1.1222 +			for(TInt loop=0;loop<4;loop++)
  1.1223 +				{
  1.1224 +				TRgb tmp=rgbBuf[loop];
  1.1225 +				rgbBuf[loop]=rgbBuf[8-1-loop];
  1.1226 +				rgbBuf[8-1-loop]=tmp;
  1.1227 +				}
  1.1228 +			}
  1.1229 +		// We can't compare rgb value from original source against screen value in EColor64K mode as
  1.1230 +		// the color component might be truncated (EColor64K is 16-bit using format RGB565),
  1.1231 +		// ie R or B components might be reduced from 8-bit to 5-bit and G from 8-bit to 6-bit
  1.1232 +		//
  1.1233 +		// For example: RGB value of Gray4(1) is 0x555555, it is drawn to screen in RGB565 as 0x52AA,
  1.1234 +		// when it's converted back to RGB for comparison, the value becomes 0x525552
  1.1235 +		TRgb col1=TRgb::Gray4(1);
  1.1236 +		TRgb col2=TRgb::Gray4(3);
  1.1237 +		if (iScreenDev->DisplayMode()==EColor64K)
  1.1238 +			{
  1.1239 +			col1=TRgb::Color64K(col1.Color64K());
  1.1240 +			col2=TRgb::Color64K(col2.Color64K());
  1.1241 +			}
  1.1242 +		TInt loop2=0;
  1.1243 +		for(;loop2<aInsetList[count];loop2++)
  1.1244 +			{	
  1.1245 +			TEST(rgbBuf[loop2]==col1);				
  1.1246 +			}
  1.1247 +		for(;loop2<8;loop2++)
  1.1248 +			{		
  1.1249 +			TEST(rgbBuf[loop2]==col2);
  1.1250 +			}
  1.1251 +		}
  1.1252 +	}
  1.1253 +
  1.1254 +void CTWindowTest::doCornerTest(TCornerType aCornerType, TInt aFlags)
  1.1255 +	{
  1.1256 +	const TInt *corners=corner0;
  1.1257 +	switch(aCornerType)
  1.1258 +		{
  1.1259 +		case EWindowCorner1:
  1.1260 +			corners=corner1;
  1.1261 +			break;
  1.1262 +		case EWindowCorner2:
  1.1263 +			corners=corner2;
  1.1264 +			break;
  1.1265 +		case EWindowCorner3:
  1.1266 +			corners=corner3;
  1.1267 +			break;
  1.1268 +		case EWindowCorner5:
  1.1269 +			corners=corner5;
  1.1270 +			break;
  1.1271 +		default:
  1.1272 +			break;
  1.1273 +		}
  1.1274 +	iBlankWin2->BaseWin()->SetCornerType(aCornerType,aFlags);
  1.1275 +	if (!(aFlags&EWindowCornerNotTL))
  1.1276 +		CheckCorner(ECornerTL, corners);
  1.1277 +	if (!(aFlags&EWindowCornerNotTR))
  1.1278 +		CheckCorner(ECornerTR, corners);
  1.1279 +	if (!(aFlags&EWindowCornerNotBL))
  1.1280 +		CheckCorner(ECornerBL, corners);
  1.1281 +	if (!(aFlags&EWindowCornerNotBR))
  1.1282 +		CheckCorner(ECornerBR, corners);
  1.1283 +//
  1.1284 +	if (aFlags&EWindowCornerNotTL)
  1.1285 +		CheckCorner(ECornerTL, corner0);
  1.1286 +	if (aFlags&EWindowCornerNotTR)
  1.1287 +		CheckCorner(ECornerTR, corner0);
  1.1288 +	if (aFlags&EWindowCornerNotBL)
  1.1289 +		CheckCorner(ECornerBL, corner0);
  1.1290 +	if (aFlags&EWindowCornerNotBR)
  1.1291 +		CheckCorner(ECornerBR, corner0);
  1.1292 +	}
  1.1293 +
  1.1294 +void CTWindowTest::doCornerTestsL()
  1.1295 +	{
  1.1296 +	iScreenDev=new(ELeave) CWsScreenDevice(TheClient->iWs);
  1.1297 +	User::LeaveIfError(iScreenDev->Construct(iTest->iScreenNumber));
  1.1298 +	iBlankWin1=new(ELeave) CTBlankWindow();
  1.1299 +	iBlankWin1->SetUpL(TPoint(1,1),TSize(100,50),TheClient->iGroup,*TheClient->iGc);
  1.1300 +	iBlankWin1->SetColor(TRgb::Gray4(1));
  1.1301 +	iBlankWin2=new(ELeave) CTBlankWindow();
  1.1302 +	iBlankWin2->SetUpL(TPoint(1,1),iBlankWin1->Size(),TheClient->iGroup,*TheClient->iGc);
  1.1303 +	iBlankWin2->SetColor(TRgb::Gray4(3));
  1.1304 +	iBlankWin2->BaseWin()->SetShadowHeight(0);
  1.1305 +	doCornerTest(EWindowCornerSquare,0);
  1.1306 +	doCornerTest(EWindowCornerSquare,EWindowCornerNotBL);
  1.1307 +	doCornerTest(EWindowCorner1,0);	// 0 + all corners missing
  1.1308 +	doCornerTest(EWindowCorner1,EWindowCornerNotTL|EWindowCornerNotTR|EWindowCornerNotBL|EWindowCornerNotBR);
  1.1309 +	doCornerTest(EWindowCorner2,0);	// 0 + all sets of 3 corners missing
  1.1310 +	doCornerTest(EWindowCorner2,EWindowCornerNotTR|EWindowCornerNotBL|EWindowCornerNotBR);
  1.1311 +	doCornerTest(EWindowCorner2,EWindowCornerNotTL|EWindowCornerNotBL|EWindowCornerNotBR);
  1.1312 +	doCornerTest(EWindowCorner2,EWindowCornerNotTL|EWindowCornerNotTR|EWindowCornerNotBR);
  1.1313 +	doCornerTest(EWindowCorner2,EWindowCornerNotTL|EWindowCornerNotTR|EWindowCornerNotBL);
  1.1314 +	doCornerTest(EWindowCorner3,0);	// 0 + all 4 individual corners missing
  1.1315 +	doCornerTest(EWindowCorner3,EWindowCornerNotTL);
  1.1316 +	doCornerTest(EWindowCorner3,EWindowCornerNotTR);
  1.1317 +	doCornerTest(EWindowCorner3,EWindowCornerNotBL);
  1.1318 +	doCornerTest(EWindowCorner3,EWindowCornerNotBR);
  1.1319 +	doCornerTest(EWindowCorner5,0);	// 0 + all pairs of corners missing
  1.1320 +	doCornerTest(EWindowCorner5,EWindowCornerNotTL|EWindowCornerNotTR);
  1.1321 +	doCornerTest(EWindowCorner5,EWindowCornerNotTL|EWindowCornerNotBL);
  1.1322 +	doCornerTest(EWindowCorner5,EWindowCornerNotTL|EWindowCornerNotBR);
  1.1323 +	doCornerTest(EWindowCorner5,EWindowCornerNotTR|EWindowCornerNotBL);
  1.1324 +	doCornerTest(EWindowCorner5,EWindowCornerNotTR|EWindowCornerNotBR);
  1.1325 +	doCornerTest(EWindowCorner5,EWindowCornerNotBL|EWindowCornerNotBR);
  1.1326 +	}
  1.1327 +
  1.1328 +void CTWindowTest::CornerTests()
  1.1329 +	{
  1.1330 +	TRAP_IGNORE(doCornerTestsL());
  1.1331 +	delete iBlankWin2;
  1.1332 +	delete iBlankWin1;
  1.1333 +	delete iScreenDev;
  1.1334 +	}
  1.1335 +
  1.1336 +LOCAL_C void doMegaTreeThread(TInt aScreenNumber)
  1.1337 +	{
  1.1338 +	CTrapCleanup::New();
  1.1339 +	RWsSession ws;
  1.1340 +	ws.Connect();
  1.1341 +	CWsScreenDevice *scrDev=new(ELeave) CWsScreenDevice(ws);
  1.1342 +	scrDev->Construct(aScreenNumber);
  1.1343 +	RWindowGroup group(ws);
  1.1344 +	group.Construct(1);
  1.1345 +	group.EnableReceiptOfFocus(EFalse);
  1.1346 +	RWindow parent(ws);
  1.1347 +	parent.Construct(group,123);
  1.1348 +	parent.Activate();
  1.1349 +	CWindowGc *gc=new(ELeave) CWindowGc(scrDev);
  1.1350 +	gc->Construct();
  1.1351 +	TSize max(parent.Size());
  1.1352 +	RWindow prev=parent;
  1.1353 +	TBool horiz=EFalse;
  1.1354 +	TInt color=0;
  1.1355 +	for(TInt count=0;count<100;count++)
  1.1356 +		{
  1.1357 +		RWindow win(ws);
  1.1358 +		if (win.Construct(prev,ENullWsHandle)!=KErrNone)
  1.1359 +			break;
  1.1360 +		win.SetExtent(horiz?TPoint(1,0):TPoint(0,1),max);
  1.1361 +		win.SetBackgroundColor(TRgb::Gray4(color));
  1.1362 +		color=(color+1)%4;
  1.1363 +		win.Activate();
  1.1364 +		win.BeginRedraw();
  1.1365 +		gc->Activate(win);
  1.1366 +		gc->Clear();
  1.1367 +		gc->Deactivate();
  1.1368 +		win.EndRedraw();
  1.1369 +		prev=win;
  1.1370 +		horiz=!horiz;
  1.1371 +		}
  1.1372 +	parent.SetVisible(EFalse);
  1.1373 +	parent.SetVisible(ETrue);
  1.1374 +	parent.SetPosition(TPoint(-1,-1));
  1.1375 +	parent.SetPosition(TPoint(0,0));
  1.1376 +	parent.Close();
  1.1377 +	ws.Close();
  1.1378 +	}
  1.1379 +
  1.1380 +LOCAL_C TInt MegaTreeThread(TAny *aScreenNumber)
  1.1381 +	{
  1.1382 +	TRAPD(err,doMegaTreeThread((TInt)aScreenNumber));
  1.1383 +	return(err);
  1.1384 +	}
  1.1385 +
  1.1386 +void CTWindowTest::CreateMegaTree()
  1.1387 +	{
  1.1388 +	const TUint KThreadHeapSize=0x2000;
  1.1389 +	RThread thread;
  1.1390 +	if (thread.Create(_L("MegaTree"),MegaTreeThread,KDefaultStackSize,KThreadHeapSize,KThreadHeapSize,(TAny*)iTest->iScreenNumber,EOwnerThread)==KErrNone)
  1.1391 +		{
  1.1392 +		TRequestStatus stat;
  1.1393 +		thread.Logon(stat);
  1.1394 +		thread.Resume();
  1.1395 +		User::WaitForRequest(stat);		
  1.1396 +		TEST(stat==KErrNone);
  1.1397 +		}
  1.1398 +	thread.Close();
  1.1399 +	}
  1.1400 +
  1.1401 +void CTWindowTest::TiledWindowTestL()
  1.1402 +	{
  1.1403 +	RWindow parent(TheClient->iWs);
  1.1404 +	User::LeaveIfError(parent.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
  1.1405 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&parent));
  1.1406 +	parent.SetExtent(TPoint(10,10),TSize(50,50));
  1.1407 +	parent.Activate();
  1.1408 +//
  1.1409 +	RWindow child1(TheClient->iWs);
  1.1410 +	User::LeaveIfError(child1.Construct(parent,ENullWsHandle));
  1.1411 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child1));
  1.1412 +	child1.SetExtent(TPoint(0,0),TSize(50,20));
  1.1413 +	child1.Activate();
  1.1414 +//
  1.1415 +	RWindow child2(TheClient->iWs);
  1.1416 +	User::LeaveIfError(child2.Construct(parent,ENullWsHandle));
  1.1417 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child2));
  1.1418 +	child2.SetExtent(TPoint(0,20),TSize(50,30));
  1.1419 +	child2.Activate();
  1.1420 +//
  1.1421 +	child1.BeginRedraw();
  1.1422 +	TSize rect1Size(25,20);
  1.1423 +	TheGc->Activate(child1);
  1.1424 +	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
  1.1425 +	TheGc->DrawRect(TRect(rect1Size));
  1.1426 +	TheGc->DrawRect(TRect(TPoint(rect1Size.iWidth,0),rect1Size));
  1.1427 +	TheGc->Deactivate();
  1.1428 +	child1.EndRedraw();
  1.1429 +//
  1.1430 +	child2.BeginRedraw();
  1.1431 +	TSize rect2Size(25,30);
  1.1432 +	TheGc->Activate(child2);
  1.1433 +	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
  1.1434 +	TheGc->DrawRect(TRect(rect2Size));
  1.1435 +	TheGc->DrawRect(TRect(TPoint(rect2Size.iWidth,0),rect2Size));
  1.1436 +	TheGc->Deactivate();
  1.1437 +	child2.EndRedraw();
  1.1438 +//
  1.1439 +// Left and right halves should be identical
  1.1440 +//
  1.1441 +	TBool rectCompare = !TheClient->iScreen->RectCompare(TRect(10,10,35,60),TRect(35,10,70,60));	
  1.1442 +	TEST(rectCompare);
  1.1443 +	if(!rectCompare)
  1.1444 +		INFO_PRINTF3(_L("TheClient->iScreen->RectCompare return value - Expected: %d, Actual: %d"), ETrue, rectCompare);
  1.1445 +//
  1.1446 +	CleanupStack::PopAndDestroy(3);
  1.1447 +	}
  1.1448 +
  1.1449 +void CTWindowTest::TiledWindowTest2L()
  1.1450 +	{
  1.1451 +	TSize size(200,240);		//Parent Windows
  1.1452 +	TSize childSize(TSize(size.iWidth/2,size.iHeight/2));		//Child Windows
  1.1453 +	TSize dialogueSize(50,50);
  1.1454 +
  1.1455 +	TheClient->iWs.SetAutoFlush(ETrue);
  1.1456 +	RBlankWindow parent1(TheClient->iWs);
  1.1457 +	User::LeaveIfError(parent1.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
  1.1458 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&parent1));
  1.1459 +	parent1.SetExtent(TPoint(240,0),size);
  1.1460 +	parent1.SetColor(TRgb::Gray4(2));
  1.1461 +	parent1.Activate();
  1.1462 +
  1.1463 +	TheClient->iWs.SetAutoFlush(ETrue);
  1.1464 +	RBlankWindow parent2(TheClient->iWs);
  1.1465 +	User::LeaveIfError(parent2.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
  1.1466 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&parent2));
  1.1467 +	parent2.SetExtent(TPoint(440,0),size);
  1.1468 +	parent2.SetColor(TRgb::Gray4(2));
  1.1469 +	parent2.Activate();
  1.1470 +
  1.1471 +	TheClient->iWs.SetAutoFlush(ETrue);
  1.1472 +	RBlankWindow child1(TheClient->iWs);
  1.1473 +	User::LeaveIfError(child1.Construct(parent1,ENullWsHandle));
  1.1474 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child1));
  1.1475 +	child1.SetExtent(TPoint(0,0),childSize);
  1.1476 +	child1.SetColor(TRgb::Gray4(2));
  1.1477 +	child1.Activate();
  1.1478 +
  1.1479 +	TheClient->iWs.SetAutoFlush(ETrue);
  1.1480 +	RBlankWindow child2(TheClient->iWs);
  1.1481 +	User::LeaveIfError(child2.Construct(parent1,ENullWsHandle));
  1.1482 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child2));
  1.1483 +	child2.SetExtent(TPoint(0,childSize.iHeight),childSize);
  1.1484 +	child2.SetColor(TRgb::Gray4(2));
  1.1485 +	child2.Activate();
  1.1486 +
  1.1487 +	TheClient->iWs.SetAutoFlush(ETrue);
  1.1488 +	RBlankWindow child3(TheClient->iWs);
  1.1489 +	User::LeaveIfError(child3.Construct(parent1,ENullWsHandle));
  1.1490 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&child3));
  1.1491 +	child3.SetExtent(TPoint(childSize.iWidth,0),TSize(childSize.iWidth,size.iHeight));
  1.1492 +	child3.SetColor(TRgb::Gray4(2));
  1.1493 +	child3.Activate();
  1.1494 +
  1.1495 +	TPoint dialoguePos(375,93);
  1.1496 +	TheClient->iWs.SetAutoFlush(ETrue);
  1.1497 +	RBlankWindow dialog1(TheClient->iWs);
  1.1498 +	User::LeaveIfError(dialog1.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
  1.1499 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&dialog1));
  1.1500 +	dialog1.SetExtent(dialoguePos,dialogueSize);
  1.1501 +	dialog1.SetColor(TRgb::Gray4(3));
  1.1502 +	dialog1.SetShadowHeight(4);
  1.1503 +	dialog1.Activate();
  1.1504 +
  1.1505 +	TheClient->iWs.SetAutoFlush(ETrue);
  1.1506 +	RBlankWindow dialog2(TheClient->iWs);
  1.1507 +	User::LeaveIfError(dialog2.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
  1.1508 +	CleanupStack::PushL(TCleanupItem(CleanUpWindow,&dialog2));
  1.1509 +	dialog2.SetExtent(TPoint(dialoguePos.iX+size.iWidth,dialoguePos.iY),dialogueSize);
  1.1510 +	dialog2.SetColor(TRgb::Gray4(3));
  1.1511 +	dialog2.SetShadowHeight(0);
  1.1512 +	dialog2.Activate();
  1.1513 +
  1.1514 +	TInt ii;
  1.1515 +	for (ii=400;ii>374;ii-=25)
  1.1516 +		dialog1.SetPosition(TPoint(ii,93));
  1.1517 +	TheClient->iWs.SetAutoFlush(EFalse);
  1.1518 +	CleanupStack::PopAndDestroy(7);
  1.1519 +	}
  1.1520 +
  1.1521 +void CTWindowTest::ColorTestL()
  1.1522 +	{
  1.1523 +	if (iTest->MaxGrays() == 0)
  1.1524 +		return;
  1.1525 +
  1.1526 +	_LIT(KSet,"AUTO  Color Test ");
  1.1527 +	INFO_PRINTF1(KSet);
  1.1528 +	RWindow window(TheClient->iWs);
  1.1529 +	User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
  1.1530 +	PushWindowL(&window);
  1.1531 +	window.SetExtent(TPoint(10,10),TSize(50,50));
  1.1532 +	window.Activate();
  1.1533 +	TInt colorMode,mode;
  1.1534 +	TInt currentMode=TheClient->iScreen->DisplayMode();	
  1.1535 +	TEST(currentMode==EGray4 || currentMode==EColor16 || currentMode==EColor256 || currentMode == EColor64K);
  1.1536 +	if(currentMode!=EGray4 && currentMode!=EColor16 && currentMode!=EColor256 && currentMode != EColor64K)
  1.1537 +		INFO_PRINTF5(_L("TheClient->iScreen->DisplayMode() return value - Expected: %d or %d or %d, Actual: %d"), EGray4, EColor16, EColor256, currentMode);
  1.1538 +	INFO_PRINTF1(_L(" Done Setup"));
  1.1539 +	for(colorMode=EGray4;colorMode<EColorLast;colorMode++)
  1.1540 +		{
  1.1541 +		INFO_PRINTF1(_L(" Loop 1"));
  1.1542 +		if (colorMode==ERgb || (colorMode==EGray256 && TDisplayModeUtils::IsDisplayModeColor(REINTERPRET_CAST(TDisplayMode&,currentMode))) ||  (colorMode==EGray256 && TDisplayModeUtils::IsDisplayModeColor(REINTERPRET_CAST(TDisplayMode&,currentMode))) )
  1.1543 +			continue;
  1.1544 +		User::LeaveIfError(window.SetRequiredDisplayMode((TDisplayMode&)colorMode));
  1.1545 +		mode=window.DisplayMode();
  1.1546 +		if (!(mode==currentMode || mode==colorMode))
  1.1547 +			{
  1.1548 +			_LIT(KModes," Failed in Loop1  SetTo=%d, Actual=%d, Current=%d");
  1.1549 +			TBuf<64> log;
  1.1550 +			log.Format(KModes,colorMode,mode,currentMode);
  1.1551 +			INFO_PRINTF1(log);
  1.1552 +			}
  1.1553 +		if (mode>ERgb && colorMode==EColor64K)
  1.1554 +			break;	
  1.1555 +		TEST(mode==currentMode || mode==colorMode );
  1.1556 +		if (mode!=currentMode && mode!=colorMode)
  1.1557 +			INFO_PRINTF4(_L("window.DisplayMode() return value - Expected: %d or %d, Actual: %d"), currentMode, colorMode, mode);
  1.1558 +		INFO_PRINTF1(_L(" Loop 2"));
  1.1559 +		if (mode>currentMode)
  1.1560 +			currentMode=mode;
  1.1561 +		if (colorMode==EColor16)
  1.1562 +			window.SetSize(TSize(40,60));
  1.1563 +		else if (colorMode==EColor4K)
  1.1564 +			window.SetSize(TSize(60,40));
  1.1565 +		mode=TheClient->iScreen->DisplayMode();
  1.1566 +		if(TDisplayModeUtils::NumDisplayModeColors(STATIC_CAST(TDisplayMode,currentMode))==16777216)
  1.1567 +			{
  1.1568 +			TEST(mode==CFbsDevice::DisplayMode16M());
  1.1569 +			if (mode!=CFbsDevice::DisplayMode16M())
  1.1570 +				INFO_PRINTF3(_L("window.DisplayMode() return value - Expected: %d, Actual: %d"), CFbsDevice::DisplayMode16M(), mode);
  1.1571 +			}
  1.1572 +		else
  1.1573 +			{		
  1.1574 +			TEST(currentMode==mode || currentMode==colorMode);
  1.1575 +			if (currentMode!=mode && currentMode!=colorMode)
  1.1576 +				INFO_PRINTF3(_L("TheClient->iScreen->DisplayMode() return value  return value - Expected: %d , Actual: %d"), currentMode, mode);
  1.1577 +			}
  1.1578 +		}
  1.1579 +	INFO_PRINTF1(_L(" Done First Loop"));
  1.1580 +	TInt color,gray;
  1.1581 +	TDisplayMode defMode=TheClient->iWs.GetDefModeMaxNumColors(color,gray);
  1.1582 +	TInt screenNo =TheClient->iScreen->GetScreenNumber();
  1.1583 +	TDisplayMode defModeForScreen=TheClient->iWs.GetDefModeMaxNumColors(screenNo,color,gray); 
  1.1584 +	TEST(defMode==defModeForScreen);
  1.1585 +	if (defMode!=defModeForScreen)
  1.1586 +		INFO_PRINTF3(_L("TheClient->iScreen->DisplayMode() return value  return value - Expected: %d , Actual: %d"), defMode, defModeForScreen);
  1.1587 +	if (color==16777216 && gray==256)
  1.1588 +		{		
  1.1589 +		TEST(defMode==EGray4 || defMode==EColor256 || defMode==EColor64K);		//WINS
  1.1590 +		if (defMode!=EGray4 && defMode!=EColor256 && defMode != EColor64K)
  1.1591 +			INFO_PRINTF4(_L("TheClient->iWs.GetDefModeMaxNumColors(color,gray) return value  return value - Expected: %d or %d, Actual: %d"), EGray4, EColor256, defMode);
  1.1592 +		}
  1.1593 +	else
  1.1594 +		{
  1.1595 +		if (color==0 && gray==16)
  1.1596 +			{		
  1.1597 +			TEST(defMode==EGray4);		//S5 family
  1.1598 +			if (defMode!=EGray4)
  1.1599 +				INFO_PRINTF3(_L("TheClient->iScreen->DisplayMode() return value  return value - Expected: %d , Actual: %d"), EGray4, defMode);
  1.1600 +			}
  1.1601 +		else
  1.1602 +			{
  1.1603 +			TLogMessageText buf;
  1.1604 +			_LIT(KColorSettings,"##Data  Most Colors=%d, Most Greys=%d, DefMode=%d");
  1.1605 +			buf.Format(KColorSettings,color,gray,defMode);
  1.1606 +			TheClient->iWs.LogMessage(buf);
  1.1607 +			TheClient->iWs.Flush();		
  1.1608 +			TEST(defMode==EGray4 || defMode==EColor256);
  1.1609 +			if (defMode!=EGray4 && defMode!=EColor256)
  1.1610 +				INFO_PRINTF4(_L("TheClient->iWs.GetDefModeMaxNumColors(color,gray) return value  return value - Expected: %d or %d, Actual: %d"), EGray4, EColor256, defMode);
  1.1611 +			}
  1.1612 +		}
  1.1613 +	CArrayFixFlat<TInt> *colorModes=new(ELeave) CArrayFixFlat<TInt>(1);
  1.1614 +	CleanupStack::PushL(colorModes);
  1.1615 +	User::LeaveIfError(TheClient->iWs.GetColorModeList(screenNo,colorModes));
  1.1616 +	TDisplayMode mostColor=ENone;
  1.1617 +	TDisplayMode lastGray=ENone;
  1.1618 +	TDisplayMode dispMode;
  1.1619 +	TInt ii;
  1.1620 +	TInt colorModes16M = 0;
  1.1621 +	INFO_PRINTF1(_L(" Done Setup 2"));
  1.1622 +	for (ii=0;ii<colorModes->Count();ii++)
  1.1623 +		{
  1.1624 +		dispMode=(TDisplayMode)(*colorModes)[ii];	
  1.1625 +		TEST(dispMode!=ERgb);
  1.1626 +		if (dispMode==ERgb)
  1.1627 +			INFO_PRINTF3(_L("(TDisplayMode)(*colorModes)[i] return value - Not Expected: %d , Actual: %d"), ERgb, dispMode);	
  1.1628 +		TEST(dispMode!=ENone);
  1.1629 +		if (dispMode==ENone)
  1.1630 +			INFO_PRINTF3(_L("(TDisplayMode)(*colorModes)[i] return value - Not Expected: %d , Actual: %d"), ENone, dispMode);
  1.1631 +		if (dispMode<=EGray256)
  1.1632 +			lastGray=dispMode;
  1.1633 +		else
  1.1634 +			mostColor=dispMode;
  1.1635 +		if(dispMode == EColor16M || dispMode == EColor16MU || dispMode == EColor16MA)
  1.1636 +			colorModes16M++;
  1.1637 +		}	
  1.1638 +	TEST(mostColor!=ERgb);
  1.1639 +	if (mostColor==ERgb)
  1.1640 +		INFO_PRINTF3(_L("mostColor - Not Expected: %d , Actual: %d"), ERgb, mostColor);	
  1.1641 +	TEST(colorModes16M <= 1);
  1.1642 +	if (colorModes16M > 1)
  1.1643 +		INFO_PRINTF3(_L("Number of times color Modes 16M - less than or equal to: %d , Actual: %d"), 1, colorModes16M);
  1.1644 +#if defined(__WINS__)	
  1.1645 +	TEST(colorModes16M == 1);
  1.1646 +	if (colorModes16M != 1)
  1.1647 +		INFO_PRINTF3(_L("Number of times color Modes 16M on wins - equal to: %d , Actual: %d"), 1, colorModes16M);
  1.1648 +#endif
  1.1649 +	TInt retVal;
  1.1650 +	if (color==0)
  1.1651 +		{
  1.1652 +		TEST(mostColor==ENone);
  1.1653 +		if (mostColor!=ENone)
  1.1654 +			INFO_PRINTF3(_L("Most color - equal to: %d , Actual: %d"), ENone ,mostColor);
  1.1655 +		}
  1.1656 +	else
  1.1657 +		{
  1.1658 +		retVal = TDisplayModeUtils::NumDisplayModeColors(mostColor);		
  1.1659 +		TEST(color==retVal);
  1.1660 +		if (color!=retVal)
  1.1661 +			INFO_PRINTF3(_L("TDisplayModeUtils::NumDisplayModeColors(mostColor) return value - equal to: %d , Actual: %d"), TDisplayModeUtils::NumDisplayModeColors(mostColor), retVal);
  1.1662 +		}
  1.1663 +	if (gray==0)
  1.1664 +		{		
  1.1665 +		TEST(lastGray==ENone);
  1.1666 +		if (lastGray!=ENone)
  1.1667 +			INFO_PRINTF3(_L("LastGray - equal to: %d , Actual: %d"), ENone, lastGray);
  1.1668 +		}
  1.1669 +	else
  1.1670 +		{
  1.1671 +		retVal = TDisplayModeUtils::NumDisplayModeColors(lastGray);	
  1.1672 +		TEST(gray==retVal);	
  1.1673 +		if(gray!=retVal)
  1.1674 +			INFO_PRINTF3(_L("Gray - equal to: %d , Actual: %d"), retVal, gray);
  1.1675 +		}
  1.1676 +	retVal = TDisplayModeUtils::NumDisplayModeColors(ENone);	
  1.1677 +	TEST(retVal==0);
  1.1678 +	if (retVal!=0)
  1.1679 +		INFO_PRINTF3(_L("TDisplayModeUtils::NumDisplayModeColors(ENone) return value - equal to: %d , Actual: %d"), 0, retVal);	
  1.1680 +	CleanupStack::PopAndDestroy(2);		//window and mode-array
  1.1681 +	}
  1.1682 +
  1.1683 +void CTWindowTest::TestInvalidFunctions2L()
  1.1684 +//
  1.1685 +// This code casts windows to group windows and vice-versa and then sends messages for the 'cast' that
  1.1686 +// should not be sent to the original type of window. These should all result in panics
  1.1687 +//
  1.1688 +	{
  1.1689 +	for (TInt winType=1;winType<7;++winType)		//Skip type 0 (RWindowTreeNode)
  1.1690 +		for (TInt panic=0;;panic++)
  1.1691 +			{
  1.1692 +			TBool testFinished=EFalse;
  1.1693 +			TEST(iTest->TestWsPanicL(DoPanicTest3,EWservPanicOpcode,EWinTypeFactor*winType+panic,(TAny*)iTest->iScreenNumber,&testFinished));
  1.1694 +			if (testFinished)
  1.1695 +				break;
  1.1696 +			}
  1.1697 +	iTest->CloseAllPanicWindows();
  1.1698 +	}
  1.1699 +
  1.1700 +void CTWindowTest::TestDeletedParentPanics1L()
  1.1701 +	{
  1.1702 +	for (TInt winType=0;winType<7;++winType)
  1.1703 +		{
  1.1704 +		if (winType==1)		//Skip type 1 (RWindowGroup)
  1.1705 +			++winType;
  1.1706 +		for (TInt panic=0;;panic++)
  1.1707 +			{
  1.1708 +			TBool testFinished=EFalse;
  1.1709 +			TEST(iTest->TestWsPanicL(DoPanicTest4,EWservPanicParentDeleted,EWinTypeFactor*winType+panic,(TAny*)iTest->iScreenNumber,&testFinished));
  1.1710 +			if (testFinished)
  1.1711 +				break;
  1.1712 +			}
  1.1713 +		}
  1.1714 +	iTest->CloseAllPanicWindows();
  1.1715 +	}
  1.1716 +
  1.1717 +void CTWindowTest::TestDeletedParentPanics2L()
  1.1718 +	{
  1.1719 +	for (TInt panic=0;;panic++)
  1.1720 +		{
  1.1721 +		TBool testFinished=EFalse;
  1.1722 +		TEST(iTest->TestWsPanicL(DoPanicTest5,EWservPanicParentDeleted,panic,(TAny*)iTest->iScreenNumber,&testFinished));
  1.1723 +		if (testFinished)
  1.1724 +			break;
  1.1725 +		}
  1.1726 +	iTest->CloseAllPanicWindows();
  1.1727 +	}
  1.1728 +
  1.1729 +void CTWindowTest::Bug1L()
  1.1730 +//
  1.1731 +// Test a defect found with WSERV 099 that caused a full Eikon ROM to crash before even the splach screen appeared
  1.1732 +//
  1.1733 +	{
  1.1734 +	RWsSession ws;
  1.1735 +	User::LeaveIfError(ws.Connect());
  1.1736 +	// use correct screen
  1.1737 +	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
  1.1738 +	CleanupStack::PushL(screen);
  1.1739 +	User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
  1.1740 +
  1.1741 +	RWindowGroup group(ws);
  1.1742 +	group.Construct(344);
  1.1743 +	group.EnableReceiptOfFocus(EFalse);		//Not done by Eikon, but needed to stop shell window comming to front.
  1.1744 +	RBlankWindow blank(ws);
  1.1745 +	blank.Construct(group,345);
  1.1746 +	blank.SetOrdinalPosition(0,1000);
  1.1747 +	blank.Activate();
  1.1748 +	RWindow window(ws);
  1.1749 +	window.Construct(group,346);
  1.1750 +
  1.1751 +	//Must delete this window to tidy up
  1.1752 +	window.Close();
  1.1753 +	blank.Close();
  1.1754 +	group.Close();
  1.1755 +
  1.1756 +	CleanupStack::PopAndDestroy(screen);
  1.1757 +	ws.Close();
  1.1758 +	}
  1.1759 +
  1.1760 +void CTWindowTest::TestWindowDelete()
  1.1761 +	{
  1.1762 +	TInt handles = 344;
  1.1763 +	TInt err = KErrNone;
  1.1764 +	TInt loop = 0;
  1.1765 +	TInt allocFailRate = 0;
  1.1766 +	
  1.1767 +	RWindowGroup group(TheClient->iWs);
  1.1768 +	RWindow parent1(TheClient->iWs);
  1.1769 +	RWindow child1(TheClient->iWs);
  1.1770 +	RWindow testWindow(TheClient->iWs);
  1.1771 +	
  1.1772 +	while (loop < 5)
  1.1773 +		{
  1.1774 +		err = group.Construct(++handles, EFalse);		
  1.1775 +		if (err == KErrNone)
  1.1776 +			{
  1.1777 +			TheClient->iWs.HeapSetFail(RHeap::EDeterministic, allocFailRate);
  1.1778 +
  1.1779 +			//Create parent 1
  1.1780 +			err = parent1.Construct(group,++handles);
  1.1781 +			if (err == KErrNone)
  1.1782 +				{
  1.1783 +				parent1.SetExtent(TPoint(10,10),TSize(50,50));
  1.1784 +				parent1.Activate();
  1.1785 +				}			
  1.1786 +			}
  1.1787 +		//Create child 1
  1.1788 +		if (err == KErrNone)
  1.1789 +			{
  1.1790 +			err = child1.Construct(parent1,++handles);
  1.1791 +			if (err == KErrNone)
  1.1792 +				{
  1.1793 +				child1.SetExtent(TPoint(),TSize(50,20));
  1.1794 +				child1.Activate();
  1.1795 +				}
  1.1796 +			//Only delete the parent 1, but not the child 1
  1.1797 +			parent1.Close();	
  1.1798 +			}
  1.1799 +		
  1.1800 +		if (err == KErrNone) 
  1.1801 +			{			
  1.1802 +			//Create testWindow
  1.1803 +			err = testWindow.Construct(group,++handles);
  1.1804 +			if (err == KErrNone)
  1.1805 +				{
  1.1806 +				testWindow.SetExtent(TPoint(0,20),TSize(50,30));
  1.1807 +				testWindow.Activate();
  1.1808 +				}
  1.1809 +			}
  1.1810 +		TheClient->iWs.HeapSetFail(RAllocator::ENone, 0);
  1.1811 +			
  1.1812 +		child1.Close();
  1.1813 +		testWindow.Close();
  1.1814 +		group.Close();
  1.1815 +		++allocFailRate;
  1.1816 +		loop = (err == KErrNone) ? loop + 1 : 0; 
  1.1817 +		}
  1.1818 +	}
  1.1819 +void CTWindowTest::Bug2L()
  1.1820 +//
  1.1821 +// Test a defect ...
  1.1822 +//
  1.1823 +	{
  1.1824 +	TSize offset(20,20);
  1.1825 +	TRect screen(TheClient->iScreen->SizeInPixels()-offset);
  1.1826 +	TRgb color;
  1.1827 +	RWsSession ws1;
  1.1828 +	User::LeaveIfError(ws1.Connect());
  1.1829 +	ws1.SetAutoFlush(ETrue);
  1.1830 +
  1.1831 +	// use correct screen
  1.1832 +	//
  1.1833 +	CWsScreenDevice* scr1 = new (ELeave) CWsScreenDevice(ws1);
  1.1834 +	CleanupStack::PushL(scr1);
  1.1835 +	User::LeaveIfError(scr1->Construct(iTest->iScreenNumber));
  1.1836 +
  1.1837 +	RWsSession ws2;
  1.1838 +	User::LeaveIfError(ws2.Connect());
  1.1839 +	ws2.SetAutoFlush(ETrue);
  1.1840 +
  1.1841 +	// use correct screen
  1.1842 +	//
  1.1843 +	CWsScreenDevice* scr2 = new (ELeave) CWsScreenDevice(ws2);
  1.1844 +	CleanupStack::PushL(scr2);
  1.1845 +	User::LeaveIfError(scr2->Construct(iTest->iScreenNumber));
  1.1846 +
  1.1847 +	RWindowGroup group1a(ws1);
  1.1848 +	group1a.Construct(344);
  1.1849 +	group1a.EnableReceiptOfFocus(EFalse);
  1.1850 +	group1a.SetOrdinalPosition(0,5);
  1.1851 +	RBlankWindow blank1a(ws1);
  1.1852 +	blank1a.Construct(group1a,345);
  1.1853 +	color=TRgb::Gray4(0);
  1.1854 +	blank1a.SetColor(color);
  1.1855 +	blank1a.SetExtent(screen.iTl,screen.Size());
  1.1856 +	blank1a.EnableBackup();
  1.1857 +	blank1a.Activate();
  1.1858 +
  1.1859 +	RWindowGroup group2(ws2);
  1.1860 +	group2.Construct(342);
  1.1861 +	group2.EnableReceiptOfFocus(EFalse);
  1.1862 +	group2.SetOrdinalPosition(0,5);
  1.1863 +	RBlankWindow blank2(ws2);
  1.1864 +	blank2.Construct(group2,347);
  1.1865 +	color=TRgb::Gray4(1);
  1.1866 +	blank2.SetColor(color);
  1.1867 +	blank2.SetExtent(screen.iTl+TSize(20,0),screen.Size());
  1.1868 +	blank2.EnableBackup();
  1.1869 +	blank2.Activate();
  1.1870 +
  1.1871 +	RWindowGroup group1b(ws1);
  1.1872 +	group1b.Construct(343);
  1.1873 +	//group1b.EnableReceiptOfFocus(EFalse);
  1.1874 +	group1b.SetOrdinalPosition(0,5);
  1.1875 +	RBlankWindow blank1b(ws1);
  1.1876 +	blank1b.Construct(group1b,346);
  1.1877 +	color=TRgb::Gray4(2);
  1.1878 +	blank1b.SetColor(color);
  1.1879 +	blank1b.SetExtent(screen.iTl+offset,screen.Size());
  1.1880 +	blank1b.EnableBackup();
  1.1881 +	blank1b.Activate();
  1.1882 +
  1.1883 +	group1b.Close();
  1.1884 +	blank1a.Close();
  1.1885 +	blank1b.Close();
  1.1886 +	blank2.Close();
  1.1887 +	group1a.Close();
  1.1888 +	group2.Close();
  1.1889 +
  1.1890 +	CleanupStack::PopAndDestroy(2,scr1);
  1.1891 +	ws1.Close();
  1.1892 +	ws2.Close();
  1.1893 +	}
  1.1894 +
  1.1895 +void CTWindowTest::Bug3L()
  1.1896 +//
  1.1897 +// Actiate then make visible and backup behind window caused panic.
  1.1898 +//
  1.1899 +	{
  1.1900 +	TSize offset(20,20);
  1.1901 +	TRect screen(TheClient->iScreen->SizeInPixels()-offset);
  1.1902 +	TRgb color;
  1.1903 +	RWsSession ws;
  1.1904 +	User::LeaveIfError(ws.Connect());
  1.1905 +	ws.SetAutoFlush(ETrue);
  1.1906 +
  1.1907 +	// use correct screen
  1.1908 +	//
  1.1909 +	CWsScreenDevice* scr = new (ELeave) CWsScreenDevice(ws);
  1.1910 +	CleanupStack::PushL(scr);
  1.1911 +	User::LeaveIfError(scr->Construct(iTest->iScreenNumber));
  1.1912 +
  1.1913 +	RWindowGroup group(ws);
  1.1914 +	group.Construct(348);
  1.1915 +	group.EnableReceiptOfFocus(EFalse);
  1.1916 +	RBlankWindow blank1(ws);
  1.1917 +	blank1.Construct(group,341);
  1.1918 +	color=TRgb::Gray4(1);
  1.1919 +	blank1.SetColor(color);
  1.1920 +	blank1.SetExtent(screen.iTl,screen.Size());
  1.1921 +	blank1.EnableBackup();
  1.1922 +	blank1.SetVisible(EFalse);
  1.1923 +	blank1.Activate();
  1.1924 +	blank1.SetVisible(ETrue);
  1.1925 +	RBlankWindow blank2(ws);
  1.1926 +	blank2.Construct(group,342);
  1.1927 +	color=TRgb::Gray4(2);
  1.1928 +	blank2.SetColor(color);
  1.1929 +	blank2.SetExtent(screen.iTl,screen.Size());
  1.1930 +	blank2.EnableBackup();
  1.1931 +	blank2.SetVisible(EFalse);
  1.1932 +	blank2.SetVisible(ETrue);
  1.1933 +	blank2.Activate();
  1.1934 +	group.Close();
  1.1935 +	blank1.Close();
  1.1936 +	blank2.Close();
  1.1937 +
  1.1938 +	CleanupStack::PopAndDestroy(scr);
  1.1939 +	ws.Close();
  1.1940 +	}
  1.1941 +
  1.1942 +void CTWindowTest::ErrorCodesL()
  1.1943 +	{
  1.1944 +	RWsSession ws;
  1.1945 +	User::LeaveIfError(ws.Connect());
  1.1946 +	// use correct screen
  1.1947 +	//
  1.1948 +	CWsScreenDevice* scr = new (ELeave) CWsScreenDevice(ws);
  1.1949 +	CleanupStack::PushL(scr);
  1.1950 +	User::LeaveIfError(scr->Construct(iTest->iScreenNumber));
  1.1951 +
  1.1952 +
  1.1953 +	RWindowGroup group(ws);
  1.1954 +	group.Construct(349);
  1.1955 +	group.EnableReceiptOfFocus(EFalse);
  1.1956 +	RWindow window(TheClient->iWs);
  1.1957 +	User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),ENullWsHandle));
  1.1958 +	TInt retVal = window.MoveToGroup(22222);		
  1.1959 +	TEST(retVal==KErrNotFound);
  1.1960 +	if (retVal!=KErrNotFound)
  1.1961 +		INFO_PRINTF3(_L("window.MoveToGroup(22222) return value - equal to: %d , Actual: %d"), KErrNotFound, retVal);
  1.1962 +	retVal = window.MoveToGroup(group.Identifier());	
  1.1963 +	TEST(retVal==KErrNotFound);
  1.1964 +	if (retVal!=KErrNotFound)
  1.1965 +		INFO_PRINTF3(_L("window.MoveToGroup(group.Identifier()) return value - equal to: %d , Actual: %d"), KErrNotFound, retVal);
  1.1966 +	window.Close();
  1.1967 +	group.Close();
  1.1968 +
  1.1969 +	CleanupStack::PopAndDestroy(scr);
  1.1970 +	ws.Close();
  1.1971 +	}
  1.1972 +
  1.1973 +void CTWindowTest::BackColorBugL()
  1.1974 +//
  1.1975 +// Test a defect with window being drawn with the wrong background color when they are moved on the screen
  1.1976 +//
  1.1977 +	{
  1.1978 +	TSize scrSize(TheClient->iScreen->SizeInPixels());
  1.1979 +	TSize checkSize(12,10);			//X-Size needs to be multiple of 4 due to BITGDI change/defect
  1.1980 +	CBlankWindow* win;
  1.1981 +	win=new(ELeave) CBlankWindow(TRgb(16,16,240));
  1.1982 +	CleanupStack::PushL(win);
  1.1983 +	win->SetUpL(TPoint(5,5),scrSize-TSize(10,10),TheClient->iGroup,*TheClient->iGc);
  1.1984 +	TInt mode=win->BaseWin()->SetRequiredDisplayMode(EColor256);
  1.1985 +	const TDisplayMode actualMode=reinterpret_cast<TDisplayMode&>(mode);
  1.1986 +	if (!TDisplayModeUtils::IsDisplayModeColor(actualMode) || TDisplayModeUtils::NumDisplayModeColors(actualMode)<256)
  1.1987 +		{
  1.1988 +		CleanupStack::PopAndDestroy(win);
  1.1989 +		return;
  1.1990 +		}
  1.1991 +	win->RealDraw(ETrue);
  1.1992 +	win->Win()->SetBackgroundColor(TRgb(64,224,64));
  1.1993 +	CBlankWindow* win3;
  1.1994 +	win3=new(ELeave) CBlankWindow(TRgb::Gray16(8));
  1.1995 +	CleanupStack::PushL(win3);
  1.1996 +	win3->SetUpL(TPoint(12,12),checkSize,TheClient->iGroup,*TheClient->iGc);
  1.1997 +	win3->BaseWin()->SetRequiredDisplayMode(EColor256);
  1.1998 +	CBlankWindow* win2;
  1.1999 +	win2=new(ELeave) CBlankWindow(TRgb(240,16,16));
  1.2000 +	CleanupStack::PushL(win2);
  1.2001 +	win2->SetUpL(TPoint(10,scrSize.iHeight/2),TSize(scrSize.iWidth/3,scrSize.iHeight/2-10),TheClient->iGroup,*TheClient->iGc);
  1.2002 +	win2->BaseWin()->SetRequiredDisplayMode(EColor256);
  1.2003 +	win2->RealDraw(EFalse);
  1.2004 +
  1.2005 +	win2->Win()->SetBackgroundColor(TRgb::Gray16(8));
  1.2006 +	win2->SetExt(TPoint(scrSize.iWidth/4,30),TSize(scrSize.iWidth/2,2*scrSize.iHeight/3));
  1.2007 +	TheClient->iWs.Finish();
  1.2008 +	TheClient->WaitForRedrawsToFinish();
  1.2009 +	if (!CheckRect(win2,win3,TRect(checkSize)))
  1.2010 +		{
  1.2011 +		_LIT(KLog,"After window is moved and resizes it doesn't matches the other window");
  1.2012 +		LOG_MESSAGE(KLog);
  1.2013 +		//Code to save a screen shot useful if this test fails
  1.2014 +		/*_LIT(KTest,"E:\\logs\\testexecute\\Window%d");
  1.2015 +		TBuf<64> buf;
  1.2016 +		buf.Format(KTest,iTest->iState);
  1.2017 +		TInt err=iTest->SaveScreen(buf);
  1.2018 +		_LIT(KLogSave,"Saved screenshot to file %S, (err=%d)");
  1.2019 +		LOG_MESSAGE3(KLogSave,&buf,err);*/
  1.2020 +		}
  1.2021 +	TheClient->WaitForRedrawsToFinish();
  1.2022 +	CleanupStack::PopAndDestroy(3,win);
  1.2023 +	}
  1.2024 +
  1.2025 +void CTWindowTest::FocusChangedL()
  1.2026 +//
  1.2027 +// Test that the focus change is available when the redraw is
  1.2028 +// it should be available before, but it isn't always possible to test that
  1.2029 +//
  1.2030 +	{
  1.2031 +	_LIT(KThreadName,"MoveGroup");
  1.2032 +	_LIT(KEventWaiting,"Event Waiting when none expected.");
  1.2033 +	TInt command;
  1.2034 +	iThreadParam.iScreenNumber=iTest->iScreenNumber;
  1.2035 +	iFirstFunction=TThreadStartUp(CTWindowTest::MoveGroup,&iThreadParam);
  1.2036 +	TRequestStatus status;
  1.2037 +	TSize scrSize(TheClient->iScreen->SizeInPixels());
  1.2038 +	CTWindowGroup* group1=new(ELeave) CTWindowGroup(TheClient);
  1.2039 +	group1->ConstructL();
  1.2040 +	CleanupStack::PushL(group1);
  1.2041 +	TInt winId1=group1->GroupWin()->Identifier();
  1.2042 +	CBlankWindow* win1=new(ELeave) CBlankWindow(TRgb::Gray4(1));
  1.2043 +	CleanupStack::PushL(win1);
  1.2044 +	win1->SetUpL(TPoint(1,1),TSize(2*scrSize.iWidth/3,2*scrSize.iHeight/3),group1,*TheClient->iGc);
  1.2045 +	win1->RealDraw(ETrue);
  1.2046 +	win1->Win()->SetBackgroundColor(TRgb::Gray4(3));
  1.2047 +	CTWindowGroup* group2=new(ELeave) CTWindowGroup(TheClient);
  1.2048 +	group2->ConstructL();
  1.2049 +	CleanupStack::PushL(group2);
  1.2050 +	TInt winId2=group2->GroupWin()->Identifier();
  1.2051 +	CBlankWindow* win2=new(ELeave) CBlankWindow(TRgb::Gray4(2));
  1.2052 +	CleanupStack::PushL(win2);
  1.2053 +	win2->SetUpL(TPoint(scrSize.iWidth/3-5,scrSize.iHeight/3-5),TSize(2*scrSize.iWidth/3,2*scrSize.iHeight/3),group2,*TheClient->iGc);
  1.2054 +	win2->RealDraw(ETrue);
  1.2055 +	win2->Win()->SetBackgroundColor(TRgb::Gray4(0));
  1.2056 +
  1.2057 +	TheClient->WaitForRedrawsToFinish();
  1.2058 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2059 +	command=winId1;
  1.2060 +	iThreadParam.iCommand=command;
  1.2061 +	TBool noEventWaiting=!TheClient->IsEventWaiting();
  1.2062 +	TEST(noEventWaiting);
  1.2063 +	if (!noEventWaiting)
  1.2064 +		LOG_MESSAGE(KEventWaiting);
  1.2065 +	_LIT(KTest1,"FocusChangedL: 1st test completed");
  1.2066 +	LOG_MESSAGE(KTest1);
  1.2067 +	CProcess* iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
  1.2068 +	User::WaitForRequest(status);
  1.2069 +	delete iMoveGroup;
  1.2070 +	TEST(TheClient->WaitForEvent());
  1.2071 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2072 +
  1.2073 +	command=winId2;
  1.2074 +	iThreadParam.iCommand=command;
  1.2075 +	TheClient->WaitForRedrawsToFinish();
  1.2076 +	noEventWaiting=!TheClient->IsEventWaiting();
  1.2077 +	TEST(noEventWaiting);
  1.2078 +	if (!noEventWaiting)
  1.2079 +		LOG_MESSAGE(KEventWaiting);
  1.2080 +	_LIT(KTest2,"FocusChangedL: 2nd test completed");
  1.2081 +	LOG_MESSAGE(KTest2);
  1.2082 +	iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
  1.2083 +	User::WaitForRequest(status);
  1.2084 +	delete iMoveGroup;
  1.2085 +	TEST(TheClient->WaitForEvent());
  1.2086 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2087 +
  1.2088 +	command=winId2|(1<<EPosShift);
  1.2089 +	iThreadParam.iCommand=command;
  1.2090 +	TheClient->WaitForRedrawsToFinish();
  1.2091 +	noEventWaiting=!TheClient->IsEventWaiting();
  1.2092 +	TEST(noEventWaiting);
  1.2093 +	if (!noEventWaiting)
  1.2094 +		LOG_MESSAGE(KEventWaiting);
  1.2095 +	_LIT(KTest3,"FocusChangedL: 3rd test completed");
  1.2096 +	LOG_MESSAGE(KTest3);
  1.2097 +	iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
  1.2098 +	User::WaitForRequest(status);
  1.2099 +	delete iMoveGroup;
  1.2100 +	TEST(TheClient->WaitForEvent());
  1.2101 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2102 +
  1.2103 +	command=winId1|(1<<EPosShift);
  1.2104 +	iThreadParam.iCommand=command;
  1.2105 +	TheClient->WaitForRedrawsToFinish();
  1.2106 +	noEventWaiting=!TheClient->IsEventWaiting();
  1.2107 +	TEST(noEventWaiting);
  1.2108 +	if (!noEventWaiting)
  1.2109 +		LOG_MESSAGE(KEventWaiting);
  1.2110 +	_LIT(KTest4,"FocusChangedL: 4th test completed");
  1.2111 +	LOG_MESSAGE(KTest4);
  1.2112 +	iMoveGroup=CProcess::NewSimpleThreadL(KThreadName,&iFirstFunction,&status);
  1.2113 +	User::WaitForRequest(status);
  1.2114 +	delete iMoveGroup;
  1.2115 +	TEST(TheClient->WaitForEvent());
  1.2116 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2117 +
  1.2118 +	TheClient->WaitForRedrawsToFinish();
  1.2119 +	noEventWaiting=!TheClient->IsEventWaiting();
  1.2120 +	TEST(noEventWaiting);
  1.2121 +	if (!noEventWaiting)
  1.2122 +		LOG_MESSAGE(KEventWaiting);
  1.2123 +	_LIT(KTest5,"FocusChangedL: 5th and last test completed");
  1.2124 +	LOG_MESSAGE(KTest5);
  1.2125 +	CleanupStack::PopAndDestroy(2,group2);
  1.2126 +	TheClient->Flush();
  1.2127 +	TEST(TheClient->WaitForEvent());
  1.2128 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2129 +	CleanupStack::PopAndDestroy(2,group1);
  1.2130 +	}
  1.2131 +
  1.2132 +#define ALT_PRI 78
  1.2133 +void CTWindowTest::EventsToAllL()
  1.2134 +	{
  1.2135 +	CTClient* client1=new(ELeave) CTClient;
  1.2136 +	CleanupStack::PushL(client1);
  1.2137 +	client1->SetScreenNumber(iTest->iScreenNumber);
  1.2138 +	client1->ConstructL();
  1.2139 +	CTClient* client2=new(ELeave) CTClient;
  1.2140 +	CleanupStack::PushL(client2);
  1.2141 +	client2->SetScreenNumber(iTest->iScreenNumber);
  1.2142 +	client2->ConstructL();
  1.2143 +	CEvWindowGroup* group1a=CEvWindowGroup::NewLC(client1,this);
  1.2144 +	CEvWindowGroup* group1b=CEvWindowGroup::NewLC(client1,this);
  1.2145 +	CEvWindowGroup* group2a=CEvWindowGroup::NewLC(client2,this);
  1.2146 +	CEvWindowGroup* group2b=CEvWindowGroup::NewLC(client2,this);
  1.2147 +	/*_LIT(KLog,"Window Group Id's: %d,%d,%d,%d");
  1.2148 +	LOG_MESSAGE5(KLog,group1a->GroupWin()->Identifier(),group1b->GroupWin()->Identifier(),group2a->GroupWin()->Identifier(),group2b->GroupWin()->Identifier());*/
  1.2149 +	group1a->SendEvent(KBaseUserEvent+1);
  1.2150 +	group2b->SendEvent(KBaseUserEvent+2);
  1.2151 +	client1->WaitForAllEventProcessingToFinish();
  1.2152 +	client2->WaitForAllEventProcessingToFinish();
  1.2153 +	TWsEvent event;
  1.2154 +	// Assigned random value because before PREQ1226, TWsevent's data wasn't zero initialised.
  1.2155 +	// In techview, following function
  1.2156 +	// void CEikServAppUi::HandleSystemEventL(const TWsEvent& aEvent)
  1.2157 +	// was relaying on TWsevent's data not be zero 
  1.2158 +	*(event.Int()) = 0XCCCCCCCC;
  1.2159 +	event.SetType(KBaseUserEvent+3);
  1.2160 +	group1a->SetExpectedEvent(KBaseUserEvent+3);
  1.2161 +	group1b->SetExpectedEvent(KBaseUserEvent+3);
  1.2162 +	group2a->SetExpectedEvent(KBaseUserEvent+3);
  1.2163 +	group2b->SetExpectedEvent(KBaseUserEvent+3);
  1.2164 +	TheClient->iWs.SendEventToAllWindowGroups(event);
  1.2165 +	client1->WaitForAllEventProcessingToFinish();
  1.2166 +	client2->WaitForAllEventProcessingToFinish();
  1.2167 +	event.SetType(KBaseUserEvent+4);
  1.2168 +	group1a->SetExpectedEvent(KBaseUserEvent+4);
  1.2169 +	group1b->SetExpectedEvent(KBaseUserEvent+4);
  1.2170 +	group2a->SetExpectedEvent(KBaseUserEvent+4);
  1.2171 +	group2b->SetExpectedEvent(KBaseUserEvent+4);
  1.2172 +	TheClient->iWs.SendEventToAllWindowGroups(event);
  1.2173 +	client1->WaitForAllEventProcessingToFinish();
  1.2174 +	client2->WaitForAllEventProcessingToFinish();
  1.2175 +	event.SetType(KBaseUserEvent+5);
  1.2176 +	//group1a->SetExpectedEvent(KBaseUserEvent+5);
  1.2177 +	group1b->SetExpectedEvent(KBaseUserEvent+5);
  1.2178 +	//group2a->SetExpectedEvent(KBaseUserEvent+5);
  1.2179 +	group2b->SetExpectedEvent(KBaseUserEvent+5);
  1.2180 +	TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
  1.2181 +	client1->WaitForAllEventProcessingToFinish();
  1.2182 +	client2->WaitForAllEventProcessingToFinish();
  1.2183 +	group1a->WinTreeNode()->SetOrdinalPosition(0);
  1.2184 +	client1->Flush();
  1.2185 +	event.SetType(KBaseUserEvent+6);
  1.2186 +	group1a->SetExpectedEvent(KBaseUserEvent+6);
  1.2187 +	group2b->SetExpectedEvent(KBaseUserEvent+6);
  1.2188 +	TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
  1.2189 +	client1->WaitForAllEventProcessingToFinish();
  1.2190 +	client2->WaitForAllEventProcessingToFinish();
  1.2191 +	group2b->WinTreeNode()->SetOrdinalPosition(6);
  1.2192 +	client2->Flush();
  1.2193 +	event.SetType(KBaseUserEvent+7);
  1.2194 +	group1a->SetExpectedEvent(KBaseUserEvent+7);
  1.2195 +	group2a->SetExpectedEvent(KBaseUserEvent+7);
  1.2196 +	TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
  1.2197 +	client1->WaitForAllEventProcessingToFinish();
  1.2198 +	client2->WaitForAllEventProcessingToFinish();
  1.2199 +	event.SetType(KBaseUserEvent+8);
  1.2200 +	group1a->SetExpectedEvent(KBaseUserEvent+8);
  1.2201 +	group1b->SetExpectedEvent(KBaseUserEvent+8);
  1.2202 +	group2a->SetExpectedEvent(KBaseUserEvent+8);
  1.2203 +	group2b->SetExpectedEvent(KBaseUserEvent+8);
  1.2204 +	TheClient->iWs.SendEventToAllWindowGroups(0,event);
  1.2205 +	group1a->WinTreeNode()->SetOrdinalPosition(0,ALT_PRI);
  1.2206 +	client1->Flush();
  1.2207 +	client1->WaitForAllEventProcessingToFinish();
  1.2208 +	client2->WaitForAllEventProcessingToFinish();
  1.2209 +	event.SetType(KBaseUserEvent+9);
  1.2210 +	group1a->SetExpectedEvent(KBaseUserEvent+9);
  1.2211 +	TheClient->iWs.SendEventToAllWindowGroups(ALT_PRI,event);
  1.2212 +	client1->WaitForAllEventProcessingToFinish();
  1.2213 +	client2->WaitForAllEventProcessingToFinish();
  1.2214 +	group2b->WinTreeNode()->SetOrdinalPosition(0,ALT_PRI);
  1.2215 +	client2->Flush();
  1.2216 +	client1->WaitForAllEventProcessingToFinish();
  1.2217 +	client2->WaitForAllEventProcessingToFinish();
  1.2218 +	event.SetType(KBaseUserEvent+10);
  1.2219 +	group1a->SetExpectedEvent(KBaseUserEvent+10);
  1.2220 +	group2b->SetExpectedEvent(KBaseUserEvent+10);
  1.2221 +	TheClient->iWs.SendEventToAllWindowGroups(ALT_PRI,event);
  1.2222 +	client1->WaitForAllEventProcessingToFinish();
  1.2223 +	client2->WaitForAllEventProcessingToFinish();
  1.2224 +	event.SetType(KBaseUserEvent+11);
  1.2225 +	group1b->SetExpectedEvent(KBaseUserEvent+11);
  1.2226 +	group2a->SetExpectedEvent(KBaseUserEvent+11);
  1.2227 +	TheClient->iWs.SendEventToAllWindowGroups(0,event);
  1.2228 +	client1->WaitForAllEventProcessingToFinish();
  1.2229 +	client2->WaitForAllEventProcessingToFinish();
  1.2230 +	event.SetType(KBaseUserEvent);
  1.2231 +	group1a->SetExpectedEvent(KBaseUserEvent);
  1.2232 +	group1b->SetExpectedEvent(KBaseUserEvent);
  1.2233 +	group2a->SetExpectedEvent(KBaseUserEvent);
  1.2234 +	group2b->SetExpectedEvent(KBaseUserEvent);
  1.2235 +	TheClient->iWs.SendEventToAllWindowGroups(event);
  1.2236 +	client1->WaitForAllEventProcessingToFinish();
  1.2237 +	client2->WaitForAllEventProcessingToFinish();
  1.2238 +	CleanupStack::PopAndDestroy(6,client1);
  1.2239 +	}
  1.2240 +
  1.2241 +void DestroyWindow(TAny* aWindow)
  1.2242 +	{
  1.2243 +	static_cast<RWindowTreeNode*>(aWindow)->Destroy();
  1.2244 +	}
  1.2245 +
  1.2246 +void CTWindowTest::GroupIdL()
  1.2247 +	{
  1.2248 +	const TInt numWindows=10;
  1.2249 +	RWindowGroup group(TheClient->iWs);
  1.2250 +	CleanupClosePushL(group);
  1.2251 +	User::LeaveIfError(group.Construct(ENullWsHandle));
  1.2252 +	TInt id=group.Identifier();
  1.2253 +	RWindowTreeNode* prevWindow=&group;
  1.2254 +	TInt ii;
  1.2255 +	for (ii=0;ii<numWindows;++ii)
  1.2256 +		{
  1.2257 +		RBlankWindow* window=new(ELeave) RBlankWindow(TheClient->iWs);
  1.2258 +		CleanupStack::PushL(TCleanupItem(&DestroyWindow,window));
  1.2259 +		User::LeaveIfError(window->Construct(*prevWindow,ENullWsHandle));
  1.2260 +		TInt retVal = window->WindowGroupId();		
  1.2261 +		TEST(retVal==id);
  1.2262 +		if (retVal!=id)
  1.2263 +			INFO_PRINTF3(_L("window->WindowGroupId() return value  - equal to: %d , Actual: %d"), id, retVal);
  1.2264 +		prevWindow=window;
  1.2265 +		}
  1.2266 +	CleanupStack::PopAndDestroy(numWindows+1);
  1.2267 +	}
  1.2268 +
  1.2269 +/**
  1.2270 +@SYMTestCaseID		GRAPHICS-WSERV-0495
  1.2271 +
  1.2272 +@SYMDEF				PDEF131541
  1.2273 +
  1.2274 +@SYMTestCaseDesc	Sending Events using one of the functions SendEventToWindowGroup, SendEventToAllWindowGroups (x2) 
  1.2275 +					and SendEventToOneWindowGroupsPerClient when an event queue is full returns an error
  1.2276 +
  1.2277 +@SYMTestPriority	Low
  1.2278 +
  1.2279 +@SYMTestStatus		Implemented
  1.2280 +
  1.2281 +@SYMTestActions		Call the functions repeatly many times and check that an error gets returned eventually
  1.2282 +
  1.2283 +@SYMTestExpectedResults		Functions return the error KErrNoMemory
  1.2284 +*/
  1.2285 +const TInt numTest=75;		//Must be at least 33
  1.2286 +void CTWindowTest::SaturateSendEvent()
  1.2287 +	{
  1.2288 +	const TInt id=TheClient->iGroup->GroupWin()->Identifier();
  1.2289 +	TWsEvent event;
  1.2290 +	event.SetType(KBaseUserEvent);
  1.2291 +	TInt ii;
  1.2292 +
  1.2293 +	TInt err=KErrNone;
  1.2294 +	for (ii=0; ii<=numTest && err==KErrNone;)
  1.2295 +		{
  1.2296 +		++ii;
  1.2297 +		err=TheClient->iWs.SendEventToWindowGroup(id,event);
  1.2298 +		}
  1.2299 +	TEST(err==KErrNoMemory);
  1.2300 +	if (err!=KErrNoMemory)
  1.2301 +		{
  1.2302 +		_LIT(KLog,"After %d/%d iterations SendEventToWindowGroup returned the error %d");
  1.2303 +		LOG_MESSAGE4(KLog,ii,numTest,err);
  1.2304 +		}
  1.2305 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2306 +
  1.2307 +	err=KErrNone;
  1.2308 +	for (ii=0; ii<=numTest && err==KErrNone;)
  1.2309 +		{
  1.2310 +		++ii;
  1.2311 +		err=TheClient->iWs.SendEventToAllWindowGroups(event);
  1.2312 +		}
  1.2313 +	TEST(err==KErrNoMemory);
  1.2314 +	if (err!=KErrNoMemory)
  1.2315 +		{
  1.2316 +		_LIT(KLog,"After %d/%d iterations SendEventToAllWindowGroups returned the error %d");
  1.2317 +		LOG_MESSAGE4(KLog,ii,numTest,err);
  1.2318 +		}
  1.2319 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2320 +	User::After(1000000);		//1sec, give other sessions a chance to respond to the events
  1.2321 +
  1.2322 +	err=KErrNone;
  1.2323 +	for (ii=0; ii<=numTest && err==KErrNone;)
  1.2324 +		{
  1.2325 +		++ii;
  1.2326 +		err=TheClient->iWs.SendEventToAllWindowGroups(0,event);
  1.2327 +		}
  1.2328 +	TEST(err==KErrNoMemory);
  1.2329 +	if (err!=KErrNoMemory)
  1.2330 +		{
  1.2331 +		_LIT(KLog,"After %d/%d iterations SendEventToAllWindowGroups_Priority0 returned the error %d");
  1.2332 +		LOG_MESSAGE4(KLog,ii,numTest,err);
  1.2333 +		}
  1.2334 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2335 +	User::After(1000000);		//1sec, give other sessions a chance to respond to the events
  1.2336 +
  1.2337 +	err=KErrNone;
  1.2338 +	for (ii=0; ii<=numTest && err==KErrNone;)
  1.2339 +		{
  1.2340 +		++ii;
  1.2341 +		err=TheClient->iWs.SendEventToOneWindowGroupsPerClient(event);
  1.2342 +		}
  1.2343 +	TEST(err==KErrNoMemory);
  1.2344 +	if (err!=KErrNoMemory)
  1.2345 +		{
  1.2346 +		_LIT(KLog,"After %d/%d iterations SendEventToOneWindowGroupsPerClient returned the error %d");
  1.2347 +		LOG_MESSAGE4(KLog,ii,numTest,err);
  1.2348 +		}
  1.2349 +	TheClient->WaitForAllEventProcessingToFinish();
  1.2350 +	User::After(1000000);		//1sec, give other sessions a chance to respond to the events
  1.2351 +	}
  1.2352 +
  1.2353 +void CTWindowTest::TestNotSupportedFunctionality()
  1.2354 +    {
  1.2355 +    TInt err = KErrNone;
  1.2356 +    TSize windowSize = TSize(10,10);
  1.2357 +    TSize testSize = TSize();
  1.2358 +    
  1.2359 +    RWindowGroup group(TheClient->iWs);
  1.2360 +    RWindow window(TheClient->iWs);
  1.2361 +
  1.2362 +    err = group.Construct((TUint32)&group, EFalse);
  1.2363 +    TEST(err==KErrNone);
  1.2364 +    err = window.Construct(group,(TUint32)&window);
  1.2365 +    TEST(err==KErrNone);
  1.2366 +    
  1.2367 +    window.SetExtent(TPoint(0,0),windowSize);
  1.2368 +    window.Activate();
  1.2369 +    
  1.2370 +    testSize = window.Size();
  1.2371 +    TEST((testSize.iWidth==windowSize.iWidth) && (testSize.iHeight==windowSize.iHeight));
  1.2372 +    
  1.2373 +    testSize = window.Size();
  1.2374 +    TEST((testSize.iWidth==windowSize.iWidth) && (testSize.iHeight==windowSize.iHeight));
  1.2375 +    
  1.2376 +    window.Close();
  1.2377 +    group.Close();  
  1.2378 +    }
  1.2379 +
  1.2380 +void CTWindowTest::RunTestCaseL(TInt /*aCurTestCase*/)
  1.2381 +	{
  1.2382 +	_LIT(KTest1,"Window");
  1.2383 +	_LIT(KTest2,"DestroyWindowWithActiveGc");
  1.2384 +	_LIT(KTest3,"Shadow/NoAutoClear");
  1.2385 +	_LIT(KTest4,"Corner Tests");
  1.2386 +	_LIT(KTest5,"Invalid Window Functions");
  1.2387 +	_LIT(KTest7,"Mega-Tree");
  1.2388 +	_LIT(KTest8,"Tiled Window One");
  1.2389 +	_LIT(KTest9,"Tiled Window Two");
  1.2390 +	_LIT(KTest10,"Color Test");
  1.2391 +	_LIT(KTest11,"Invalid Window Functions2");
  1.2392 +	_LIT(KTest12,"Defect 1");
  1.2393 +	_LIT(KTest13,"Defect 2");
  1.2394 +	_LIT(KTest14,"Parent Deleted 1");
  1.2395 +	_LIT(KTest15,"Parent Deleted 2");
  1.2396 +	_LIT(KTest16,"Defect 3");
  1.2397 +	_LIT(KTest17,"Background Color");
  1.2398 +	_LIT(KTest18,"Focus Changed");
  1.2399 +	_LIT(KTest21,"Events To All");
  1.2400 +	_LIT(KTest22,"Error Codes");
  1.2401 +	_LIT(KTest23,"Group Id");
  1.2402 +	_LIT(KTest24,"DeleteParentWindowOnly");
  1.2403 +#if defined(_DEBUG)
  1.2404 +	_LIT(KTest25,"DuplicateWindowHandles");
  1.2405 +#else
  1.2406 +	_LIT(KTest25skipped,"DuplicateWindowHandles skipped");
  1.2407 +#endif
  1.2408 +
  1.2409 +	((CTWindowTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  1.2410 +
  1.2411 +	_LIT(KTest26,"Saturate SendEvent");
  1.2412 +	_LIT(KTest27,"Not Supported Functionality");
  1.2413 +
  1.2414 +	switch(++iTest->iState)
  1.2415 +		{
  1.2416 +/**
  1.2417 +@SYMTestCaseID		GRAPHICS-WSERV-0029
  1.2418 +
  1.2419 +@SYMDEF  			DEF081259
  1.2420 +
  1.2421 +@SYMTestCaseDesc    Test window can be created and destroyed correctly
  1.2422 +
  1.2423 +@SYMTestPriority    High
  1.2424 +
  1.2425 +@SYMTestStatus      Implemented
  1.2426 +
  1.2427 +@SYMTestActions     Creates and destroys a window
  1.2428 +
  1.2429 +@SYMTestExpectedResults Window is created and destroyed without error
  1.2430 +*/
  1.2431 +		case 1:
  1.2432 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0029"));
  1.2433 +			iTest->LogSubTest(KTest1);
  1.2434 +			CreateTestWindowL();
  1.2435 +			CheckAndDestroyWindows();
  1.2436 +			//iState=17;
  1.2437 +			break;
  1.2438 +/**
  1.2439 +@SYMTestCaseID		GRAPHICS-WSERV-0030
  1.2440 +
  1.2441 +@SYMDEF  			DEF081259
  1.2442 +
  1.2443 +@SYMTestCaseDesc    Creates and destroys window with an active gc
  1.2444 +
  1.2445 +@SYMTestPriority    High
  1.2446 +
  1.2447 +@SYMTestStatus      Implemented
  1.2448 +
  1.2449 +@SYMTestActions     Create and destroy a window with an active gc
  1.2450 +
  1.2451 +@SYMTestExpectedResults Window is created and destroyed without error
  1.2452 +*/
  1.2453 +		case 2:
  1.2454 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0030"));
  1.2455 +			iTest->LogSubTest(KTest2);
  1.2456 +			CreateTestWindowL();
  1.2457 +			DestroyWindowWithActiveGc();
  1.2458 +			CreateTestWindowL();
  1.2459 +			DestroyWindowWithActiveGc2L();
  1.2460 +			break;
  1.2461 +/**
  1.2462 +@SYMTestCaseID		GRAPHICS-WSERV-0031
  1.2463 +
  1.2464 +@SYMDEF  			DEF081259
  1.2465 +
  1.2466 +@SYMTestCaseDesc    Test that shadow is not automatically cleared when
  1.2467 +					drawing a window
  1.2468 +
  1.2469 +@SYMTestPriority    High
  1.2470 +
  1.2471 +@SYMTestStatus      Implemented
  1.2472 +
  1.2473 +@SYMTestActions     Draw windows and check that the shadow is not automatically
  1.2474 +					cleared
  1.2475 +
  1.2476 +@SYMTestExpectedResults Screen comparison returns that the shadow was not cleared
  1.2477 +*/
  1.2478 +		case 3:
  1.2479 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0031"));
  1.2480 +			//window shadowing is no longer supported. keep the test to make sure clients can still call the methods
  1.2481 +			iTest->LogSubTest(KTest3);
  1.2482 +			ShadowAutoClearTest();
  1.2483 +			break;
  1.2484 +/**
  1.2485 +@SYMTestCaseID		GRAPHICS-WSERV-0032
  1.2486 +
  1.2487 +@SYMDEF  			DEF081259
  1.2488 +
  1.2489 +@SYMTestCaseDesc    Test the drawing of different types of corner of
  1.2490 +					a window
  1.2491 +
  1.2492 +@SYMTestPriority    High
  1.2493 +
  1.2494 +@SYMTestStatus      Implemented
  1.2495 +
  1.2496 +@SYMTestActions     Draw a window with different types of corner
  1.2497 +
  1.2498 +@SYMTestExpectedResults The window is drawn correctly for each corner type
  1.2499 +*/
  1.2500 +		case 4:
  1.2501 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0032"));
  1.2502 +			iTest->LogSubTest(KTest4);
  1.2503 +			CornerTests();
  1.2504 +			break;
  1.2505 +/**
  1.2506 +@SYMTestCaseID		GRAPHICS-WSERV-0033
  1.2507 +
  1.2508 +@SYMDEF  			DEF081259
  1.2509 +
  1.2510 +@SYMTestCaseDesc    Test for panics when window is sent wrong requests
  1.2511 +
  1.2512 +@SYMTestPriority    High
  1.2513 +
  1.2514 +@SYMTestStatus      Implemented
  1.2515 +
  1.2516 +@SYMTestActions     Send wrong requests to windows and deal with panic
  1.2517 +
  1.2518 +@SYMTestExpectedResults The windows panic as expected
  1.2519 +*/
  1.2520 +		case 5:
  1.2521 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0033"));
  1.2522 +			iTest->LogSubTest(KTest5);
  1.2523 +			TestInvalidFunctionsL();
  1.2524 +			break;
  1.2525 +/**
  1.2526 +@SYMTestCaseID		GRAPHICS-WSERV-0035
  1.2527 +
  1.2528 +@SYMDEF  			DEF081259
  1.2529 +
  1.2530 +@SYMTestCaseDesc    Draw 100 windows from a thread
  1.2531 +
  1.2532 +@SYMTestPriority    High
  1.2533 +
  1.2534 +@SYMTestStatus      Implemented
  1.2535 +
  1.2536 +@SYMTestActions     Draw 100 windows from the same thread
  1.2537 +
  1.2538 +@SYMTestExpectedResults The windows are all drawn without error
  1.2539 +*/
  1.2540 +		case 6:
  1.2541 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0035"));
  1.2542 +			iTest->LogSubTest(KTest7);
  1.2543 +			CreateMegaTree();
  1.2544 +			break;
  1.2545 +/**
  1.2546 +@SYMTestCaseID		GRAPHICS-WSERV-0036
  1.2547 +
  1.2548 +@SYMDEF  			DEF081259
  1.2549 +
  1.2550 +@SYMTestCaseDesc    Check that windows can be drawn in a tiled format
  1.2551 +
  1.2552 +@SYMTestPriority    High
  1.2553 +
  1.2554 +@SYMTestStatus      Implemented
  1.2555 +
  1.2556 +@SYMTestActions     Draw two windows in a tiled format and check they
  1.2557 +					are identical
  1.2558 +
  1.2559 +@SYMTestExpectedResults The tiled windows are identical
  1.2560 +*/
  1.2561 +		case 7:
  1.2562 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0036"));
  1.2563 +
  1.2564 +			iTest->LogSubTest(KTest8);
  1.2565 +			TiledWindowTestL();
  1.2566 +			break;
  1.2567 +/**
  1.2568 +@SYMTestCaseID		GRAPHICS-WSERV-0037
  1.2569 +
  1.2570 +@SYMDEF  			DEF081259
  1.2571 +
  1.2572 +@SYMTestCaseDesc    Check that windows and dialogs can be drawn in a
  1.2573 +					tiled format
  1.2574 +
  1.2575 +@SYMTestPriority    High
  1.2576 +
  1.2577 +@SYMTestStatus      Implemented
  1.2578 +
  1.2579 +@SYMTestActions     Draw windows and dialogs in a tiled format
  1.2580 +
  1.2581 +@SYMTestExpectedResults The windows and dialogs are drawn correctly
  1.2582 +*/
  1.2583 +		case 8:
  1.2584 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0037"));
  1.2585 +			iTest->LogSubTest(KTest9);
  1.2586 +			TiledWindowTest2L();
  1.2587 +			break;
  1.2588 +/**
  1.2589 +@SYMTestCaseID		GRAPHICS-WSERV-0038
  1.2590 +
  1.2591 +@SYMDEF  			DEF081259
  1.2592 +
  1.2593 +@SYMTestCaseDesc    Check drawing into a window with different
  1.2594 +					colour set ups
  1.2595 +
  1.2596 +@SYMTestPriority    High
  1.2597 +
  1.2598 +@SYMTestStatus      Implemented
  1.2599 +
  1.2600 +@SYMTestActions     Draw in a window using different colour
  1.2601 +					configurations
  1.2602 +
  1.2603 +@SYMTestExpectedResults The different colours are drawn correctly
  1.2604 +*/
  1.2605 +		case 9:
  1.2606 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0038"));
  1.2607 +			iTest->LogSubTest(KTest10);
  1.2608 +			ColorTestL();
  1.2609 +			break;
  1.2610 +/**
  1.2611 +@SYMTestCaseID		GRAPHICS-WSERV-0039
  1.2612 +
  1.2613 +@SYMDEF  			DEF081259
  1.2614 +
  1.2615 +@SYMTestCaseDesc    Test for panics when window is sent wrong requests
  1.2616 +
  1.2617 +@SYMTestPriority    High
  1.2618 +
  1.2619 +@SYMTestStatus      Implemented
  1.2620 +
  1.2621 +@SYMTestActions     Send wrong requests to windows and deal with panic
  1.2622 +
  1.2623 +@SYMTestExpectedResults The windows panic as expected
  1.2624 +*/
  1.2625 +		case 10:
  1.2626 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0039"));
  1.2627 +			iTest->LogSubTest(KTest11);
  1.2628 +			TestInvalidFunctions2L();
  1.2629 +			break;
  1.2630 +/**
  1.2631 +@SYMTestCaseID		GRAPHICS-WSERV-0040
  1.2632 +
  1.2633 +@SYMDEF  			DEF081259
  1.2634 +
  1.2635 +@SYMTestCaseDesc    Test for a defect that causes ROM to crash
  1.2636 +
  1.2637 +@SYMTestPriority    High
  1.2638 +
  1.2639 +@SYMTestStatus      Implemented
  1.2640 +
  1.2641 +@SYMTestActions     Test a defect is not present which causes the ROM
  1.2642 +					to crash
  1.2643 +
  1.2644 +@SYMTestExpectedResults The defect is not present
  1.2645 +*/
  1.2646 +		case 11:
  1.2647 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0040"));
  1.2648 +			iTest->LogSubTest(KTest12);
  1.2649 +			Bug1L();
  1.2650 +			break;
  1.2651 +/**
  1.2652 +@SYMTestCaseID		GRAPHICS-WSERV-0041
  1.2653 +
  1.2654 +@SYMDEF  			DEF081259
  1.2655 +
  1.2656 +@SYMTestCaseDesc    Test a previous defect has not returned
  1.2657 +
  1.2658 +@SYMTestPriority    High
  1.2659 +
  1.2660 +@SYMTestStatus      Implemented
  1.2661 +
  1.2662 +@SYMTestActions     Exercise the code the defect was discovered in
  1.2663 +
  1.2664 +@SYMTestExpectedResults The defect is not present
  1.2665 +*/
  1.2666 +		case 12:
  1.2667 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0041"));
  1.2668 +			iTest->LogSubTest(KTest13);
  1.2669 +			Bug2L();
  1.2670 +			break;
  1.2671 +/**
  1.2672 +@SYMTestCaseID		GRAPHICS-WSERV-0042
  1.2673 +
  1.2674 +@SYMDEF  			DEF081259
  1.2675 +					DEF115543
  1.2676 +
  1.2677 +@SYMTestCaseDesc    Test that when a parent window is deleted a panic
  1.2678 +					occurs
  1.2679 +
  1.2680 +@SYMTestPriority    High
  1.2681 +
  1.2682 +@SYMTestStatus      Implemented
  1.2683 +
  1.2684 +@SYMTestActions     Delete a parent window and check for a panic
  1.2685 +					NOTE: DEF115543 has corrected GRAPHICS-WSERV-0042, and added a lot
  1.2686 +					more window functions.
  1.2687 +
  1.2688 +@SYMTestExpectedResults All functions either:
  1.2689 +					Panic the owner thread with EWservPanicParentDeleted or
  1.2690 +					Get performed without accessing any NULL iParent pointers in the WSERV thread
  1.2691 +*/
  1.2692 +		case 13:
  1.2693 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0042"));
  1.2694 +			iTest->LogSubTest(KTest14);
  1.2695 +			TestDeletedParentPanics1L();
  1.2696 +			break;
  1.2697 +/**
  1.2698 +@SYMTestCaseID		GRAPHICS-WSERV-0043
  1.2699 +
  1.2700 +@SYMDEF  			DEF081259
  1.2701 +
  1.2702 +@SYMTestCaseDesc    Test that when a parent window is deleted a panic
  1.2703 +					occurs
  1.2704 +
  1.2705 +@SYMTestPriority    High
  1.2706 +
  1.2707 +@SYMTestStatus      Implemented
  1.2708 +
  1.2709 +@SYMTestActions     Delete a parent window and check for a panic
  1.2710 +
  1.2711 +@SYMTestExpectedResults The panic occurs as expected
  1.2712 +*/
  1.2713 +		case 14:
  1.2714 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0043"));
  1.2715 +			iTest->LogSubTest(KTest15);
  1.2716 +			TestDeletedParentPanics2L();
  1.2717 +			break;
  1.2718 +/**
  1.2719 +@SYMTestCaseID		GRAPHICS-WSERV-0044
  1.2720 +
  1.2721 +@SYMDEF  			DEF081259
  1.2722 +
  1.2723 +@SYMTestCaseDesc    Check that activate then make visible and backup
  1.2724 +					behind a window does not panic.
  1.2725 +
  1.2726 +@SYMTestPriority    High
  1.2727 +
  1.2728 +@SYMTestStatus      Implemented
  1.2729 +
  1.2730 +@SYMTestActions     Activate then make visible and backup
  1.2731 +					behind a window
  1.2732 +
  1.2733 +@SYMTestExpectedResults No panic occurs
  1.2734 +*/
  1.2735 +		case 15:
  1.2736 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0044"));
  1.2737 +			iTest->LogSubTest(KTest16);
  1.2738 +			Bug3L();
  1.2739 +			break;
  1.2740 +/**
  1.2741 +@SYMTestCaseID		GRAPHICS-WSERV-0045
  1.2742 +
  1.2743 +@SYMDEF  			DEF081259
  1.2744 +
  1.2745 +@SYMTestCaseDesc    Test window being drawn with the correct background
  1.2746 +					color when they are moved on the screen
  1.2747 +
  1.2748 +@SYMTestPriority    High
  1.2749 +
  1.2750 +@SYMTestStatus      Implemented
  1.2751 +
  1.2752 +@SYMTestActions     Move window on the screen and check it is drawn with
  1.2753 +					the correct background colour
  1.2754 +
  1.2755 +@SYMTestExpectedResults The background coloour is correct
  1.2756 +*/
  1.2757 +		case 16:
  1.2758 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0045"));
  1.2759 +			iTest->LogSubTest(KTest17);
  1.2760 +			BackColorBugL();
  1.2761 +			break;
  1.2762 +/**
  1.2763 +@SYMTestCaseID		GRAPHICS-WSERV-0046
  1.2764 +
  1.2765 +@SYMDEF  			DEF081259
  1.2766 +
  1.2767 +@SYMTestCaseDesc    Test that the focus change is available after redraw
  1.2768 +
  1.2769 +@SYMTestPriority    High
  1.2770 +
  1.2771 +@SYMTestStatus      Implemented
  1.2772 +
  1.2773 +@SYMTestActions     Redraw and check the focus change is available
  1.2774 +
  1.2775 +@SYMTestExpectedResults The focus change is available
  1.2776 +*/
  1.2777 +		case 17:
  1.2778 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0046"));
  1.2779 +			iTest->LogSubTest(KTest18);
  1.2780 +			FocusChangedL();
  1.2781 +			break;
  1.2782 +/**
  1.2783 +@SYMTestCaseID		GRAPHICS-WSERV-0048
  1.2784 +
  1.2785 +@SYMDEF  			DEF081259
  1.2786 +
  1.2787 +@SYMTestCaseDesc    Test that events can be sent to a number of window
  1.2788 +					groups simultaneously
  1.2789 +
  1.2790 +@SYMTestPriority    High
  1.2791 +
  1.2792 +@SYMTestStatus      Implemented
  1.2793 +
  1.2794 +@SYMTestActions     Send events to a number of window groups and check
  1.2795 +					that they all receive them
  1.2796 +
  1.2797 +@SYMTestExpectedResults The events and sent to the window groups correctly
  1.2798 +*/
  1.2799 +		case 18:
  1.2800 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0048"));
  1.2801 +			iTest->LogSubTest(KTest21);
  1.2802 +			EventsToAllL();
  1.2803 +			break;
  1.2804 +/**
  1.2805 +@SYMTestCaseID		GRAPHICS-WSERV-0049
  1.2806 +
  1.2807 +@SYMDEF  			DEF081259
  1.2808 +
  1.2809 +@SYMTestCaseDesc    Test error code when incorrectly moving a window to
  1.2810 +					a group.
  1.2811 +
  1.2812 +@SYMTestPriority    High
  1.2813 +
  1.2814 +@SYMTestStatus      Implemented
  1.2815 +
  1.2816 +@SYMTestActions     Try to move a window to a group and check the error
  1.2817 +					codes
  1.2818 +
  1.2819 +@SYMTestExpectedResults The correct error codes are returned
  1.2820 +*/
  1.2821 +		case 19:
  1.2822 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0049"));
  1.2823 +			iTest->LogSubTest(KTest22);
  1.2824 +			ErrorCodesL();
  1.2825 +/**
  1.2826 +@SYMTestCaseID		GRAPHICS-WSERV-0050
  1.2827 +
  1.2828 +@SYMDEF  			DEF081259
  1.2829 +
  1.2830 +@SYMTestCaseDesc    Check that the correct group id is assigned to a
  1.2831 +					chain of windows
  1.2832 +
  1.2833 +@SYMTestPriority    High
  1.2834 +
  1.2835 +@SYMTestStatus      Implemented
  1.2836 +
  1.2837 +@SYMTestActions     Create a chain of windows in the same group and check
  1.2838 +					the all have the same group id
  1.2839 +
  1.2840 +@SYMTestExpectedResults The windows all have the same group id
  1.2841 +*/
  1.2842 +		case 20:
  1.2843 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0050"));
  1.2844 +			iTest->LogSubTest(KTest23);
  1.2845 +			GroupIdL();
  1.2846 +			break;
  1.2847 +			
  1.2848 +/**
  1.2849 +@SYMTestCaseID		GRAPHICS-WSERV-0461
  1.2850 +
  1.2851 +@SYMDEF  			PDEF114190
  1.2852 +
  1.2853 +@SYMTestCaseDesc    Test window redraw queue cleanup when window is deleted in low memory conditions
  1.2854 +
  1.2855 +@SYMTestPriority    High
  1.2856 +
  1.2857 +@SYMTestStatus      Implemented
  1.2858 +
  1.2859 +@SYMTestActions     Have a loop which increases the number of allocations in the server thread before failure;
  1.2860 +					Within the loop:
  1.2861 +					1) Create a parent window and a child window of the parent; 
  1.2862 +					2) Delete the parent window only, but not the child window; 
  1.2863 +					3) Create a testWindow. This new window gets added to the redraw queue which will force it 
  1.2864 +					reordering. This would crash WSERV due to this defect because the orphaned window (which is 
  1.2865 +					the previous child window) is still in the redraw queue
  1.2866 +					4) Delete all the windows involved;
  1.2867 +
  1.2868 +@SYMTestExpectedResults		The window redraw queue should be cleaned up when the first window is deleted;
  1.2869 +							WSERV should not crash. The test should pass. 
  1.2870 +*/		
  1.2871 +		case 21:
  1.2872 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0461"));
  1.2873 +			iTest->LogSubTest(KTest24);
  1.2874 +			TestWindowDelete();
  1.2875 +			break;
  1.2876 +			
  1.2877 +/**
  1.2878 +@SYMTestCaseID		GRAPHICS-WSERV-0463
  1.2879 +
  1.2880 +@SYMDEF				DEF115601
  1.2881 +
  1.2882 +@SYMTestCaseDesc    Two RWindowGroup objects using same window client handle cause Emulator crash
  1.2883 +
  1.2884 +@SYMTestPriority    Medium
  1.2885 +
  1.2886 +@SYMTestStatus      Implemented
  1.2887 +
  1.2888 +@SYMTestActions     Create two window groups with the same handle.
  1.2889 +
  1.2890 +@SYMTestExpectedResults		WSERV should panic the client thread with the code EWservPanicDuplicateHandle
  1.2891 +							and then destroy the window groups without crashing WSERV
  1.2892 +*/
  1.2893 +		case 22:
  1.2894 +#if defined(_DEBUG)
  1.2895 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0463"));
  1.2896 +			iTest->LogSubTest(KTest25);
  1.2897 +			TEST(iTest->TestWsPanicL(DoPanicTest6,EWservPanicDuplicateHandle,0,(TAny*)iTest->iScreenNumber,NULL));
  1.2898 +			iTest->CloseAllPanicWindows();
  1.2899 +#else
  1.2900 +			iTest->LogSubTest(KTest25skipped);	//Client side panic will only occur in debug builds of WServ
  1.2901 +#endif
  1.2902 +			break;
  1.2903 +		case 23:
  1.2904 +			((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0495"));
  1.2905 +			iTest->LogSubTest(KTest26);
  1.2906 +			SaturateSendEvent();
  1.2907 +			break;
  1.2908 +/**
  1.2909 +@SYMTestCaseID      GRAPHICS-WSERV-0655
  1.2910 +
  1.2911 +@SYMDEF             ou1cimx1#329309
  1.2912 +
  1.2913 +@SYMTestCaseDesc    Fix native orientation functionality not supported
  1.2914 +
  1.2915 +@SYMTestPriority    Medium
  1.2916 +
  1.2917 +@SYMTestStatus      Implemented
  1.2918 +
  1.2919 +@SYMTestActions     Call fucntions related to fix native orientation on a window
  1.2920 +
  1.2921 +@SYMTestExpectedResults     Fix native orientation functionality not supported
  1.2922 +			*/			
  1.2923 +        case 24:
  1.2924 +            ((CTWindowTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0655"));
  1.2925 +            iTest->LogSubTest(KTest27);
  1.2926 +            TestNotSupportedFunctionality();
  1.2927 +            break;			
  1.2928 +		default:
  1.2929 +            		((CTWindowTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  1.2930 +			((CTWindowTestStep*)iStep)->CloseTMSGraphicsStep();
  1.2931 +			TestComplete();
  1.2932 +			break;
  1.2933 +		}
  1.2934 +	((CTWindowTestStep*)iStep)->RecordTestResultL();
  1.2935 +	}
  1.2936 +
  1.2937 +__WS_CONSTRUCT_STEP__(WindowTest)