os/graphics/windowing/windowserver/test/tauto/TEvent.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/TEvent.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,7811 @@
     1.4 +// Copyright (c) 1996-2010 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 +// Test window server events
    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 +#ifndef __INIPARSER_H__
    1.28 +#define __INIPARSER_H__
    1.29 +#endif // __INIPARSER_H__
    1.30 +
    1.31 +#include "PARSEINIDATA.H"
    1.32 +#include "TEVENT.H"
    1.33 +#include "W32CLICK.H"
    1.34 +#include <w32debug.h>
    1.35 +#include <hal.h>
    1.36 +
    1.37 +#define FAIL_LOGGING on
    1.38 +//#define DETAILED
    1.39 +#define LOGGING 1	//Uncomment this when there is a fail so that you get more logging
    1.40 +
    1.41 +_LIT(KKeyClickPluginDll, "click.dll");
    1.42 +
    1.43 +const TInt KLongKeyCaptureLowPriority = 1;
    1.44 +const TInt KLongKeyCaptureHighPriority = 2;
    1.45 +
    1.46 +CTQueueClient::CTQueueClient(CTEventTest *aTest) : iTest(aTest)
    1.47 +	{
    1.48 +	}
    1.49 +
    1.50 +CTQueueClient::~CTQueueClient()
    1.51 +	{
    1.52 +	CloseEventTestGroupOnSecondScreen();
    1.53 +	iGroup->GroupWin()->EnableReceiptOfFocus(EFalse);
    1.54 +	delete iChildWin;
    1.55 +	delete iWin;
    1.56 +
    1.57 +	}
    1.58 +
    1.59 +void CTQueueClient::ConstructL(TBool aCreateChild)
    1.60 +	{
    1.61 +	CTClient::ConstructL();
    1.62 +	iGroup=new(ELeave) CTQueueWindowGroup(this);
    1.63 +	iGroup->ConstructL();
    1.64 +	iWin=new(ELeave) CTBackedUpWin(EGray4);
    1.65 +	iWin->ConstructExtLD(*iGroup,TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight));
    1.66 +	iWin->Activate();
    1.67 +	if (aCreateChild)
    1.68 +		{
    1.69 +		iChildWin=new(ELeave) CTBackedUpWin(EGray4);
    1.70 +		iChildWin->ConstructExtLD(*iWin,ChildTopLeft(),ChildSize());
    1.71 +		iChildWin->Activate();
    1.72 +		}
    1.73 +	iWs.Flush();
    1.74 +	}
    1.75 +
    1.76 +void CTQueueClient::ConstructEventHandlerL()
    1.77 +	{
    1.78 +	iEventHandler=new(ELeave) CTQueueTestEvent(&iWs, iTest);
    1.79 +	((CTQueueTestEvent *)iEventHandler)->ConstructL();
    1.80 +	}
    1.81 +
    1.82 +TInt CTQueueClient::WindowGroupIdentifier()
    1.83 +	{
    1.84 +	return(iGroup->GroupWin()->Identifier());
    1.85 +	}
    1.86 +
    1.87 +CTWinBase* CTQueueClient::GetHandle(TPoint& aPos)
    1.88 +	{
    1.89 +	if (iCapturing)
    1.90 +		return iChildWin;
    1.91 +	if (iChildWin && TRect(ChildTopLeft(),ChildSize()).Contains(aPos))
    1.92 +	//if (iChildWin && TRect(TPoint(),ChildSize()).Contains(aPos))
    1.93 +		{
    1.94 +		aPos-=ChildTopLeft();
    1.95 +		if (iChildCapturing)
    1.96 +			iCapturing=ETrue;
    1.97 +		return iChildWin;
    1.98 +		}
    1.99 +	return iWin;
   1.100 +	}
   1.101 +
   1.102 +void CTQueueClient::AddExpectedEvent(TWsEvent &aEvent)
   1.103 +	{
   1.104 +#if defined(DETAILED)
   1.105 +	_LIT(KLog,"   Adding Event Type=%d");
   1.106 +	TLogMessageText buf;
   1.107 +	buf.Format(KLog,aEvent.Type());
   1.108 +	LogMessage(buf);
   1.109 +#endif
   1.110 +	((CTQueueTestEvent *)iEventHandler)->AddExpectedEvent(aEvent);
   1.111 +	}
   1.112 +
   1.113 +void CTQueueClient::SetChildCapture(TInt aCaptureFlags)
   1.114 +	{
   1.115 +	if (!iChildWin)
   1.116 +		return;
   1.117 +	iChildWin->BaseWin()->SetPointerCapture(aCaptureFlags);
   1.118 +	if (aCaptureFlags|RWindowBase::TCaptureFlagEnabled)
   1.119 +		iChildCapturing=ETrue;
   1.120 +	}
   1.121 +//
   1.122 +
   1.123 +CTQueueTestEvent::CTQueueTestEvent(RWsSession *aWs, CTEventTest *aTest) : CTEvent(aWs)
   1.124 +	{
   1.125 +	iTest = aTest;
   1.126 +	iCheckTimeStamp = EFalse;
   1.127 +	iLastEventError = EFalse;
   1.128 +	}
   1.129 +
   1.130 +void CTQueueTestEvent::ConstructL()
   1.131 +	{
   1.132 +	CTEventBase::Construct();
   1.133 +	iEventBuffer.SetLengthL(EEventBufferSize);
   1.134 +	iRedrawType=iTest->TestBase()->RedrawStoreTypeL();
   1.135 +	}
   1.136 +
   1.137 +void CTQueueTestEvent::TestL(TInt aTest)
   1.138 +	{
   1.139 +	if (!aTest)
   1.140 +		{
   1.141 +		iTest->Failed();
   1.142 +		User::Leave(ETestFailed);
   1.143 +		}
   1.144 +	}
   1.145 +
   1.146 +//#define FAIL_LOGGING yes
   1.147 +void CTQueueTestEvent::doRunL()
   1.148 +	{
   1.149 +	TWsEvent wsEvent;
   1.150 +	iWs->GetEvent(wsEvent);
   1.151 +	TWsEvent expectedEvent;
   1.152 +
   1.153 +#if defined(FAIL_LOGGING)
   1.154 +	TInt eType,wsHan,eHan,wsKeyCode,eKeyCode,wsKeyRepeat,eKeyRepeat,wsKeyScan,eKeyScan;
   1.155 +	TLogMessageText buf;
   1.156 +	_LIT(KStartString,"AUTO  EventTestFail ");
   1.157 +#endif
   1.158 +	TInt wsType=wsEvent.Type();
   1.159 +	if (wsEvent.Type()==EEventNull)
   1.160 +		TestL(wsEvent.Handle()==0);
   1.161 +	else
   1.162 +		{
   1.163 +		TInt count=iEventBuffer.Count();
   1.164 +		if (count==0 && wsType==EEventFocusGained)
   1.165 +			goto End;
   1.166 +		if (iLastEventError
   1.167 +			&& (iRedrawType==EPartialRedraw_FullRedrawSupport || iRedrawType==EPartialRedraw_PreserveStoredCmds)
   1.168 +			&& wsEvent.Type()==EEventErrorMessage /*&& expectedEvent.Type()!=EEventErrorMessage*/)		//Should really check if the next expected event is an error but there is no way to do this without removing it from the buffer
   1.169 +			{
   1.170 +		#if defined(DETAILED)
   1.171 +			_LIT(KLog,"Skip Duplicate Error Message");
   1.172 +			iTest->LOG_MESSAGE(KLog);
   1.173 +		#endif
   1.174 +			return;		//Ignore repeated error events
   1.175 +			}
   1.176 +		do	{
   1.177 +			TestL(iEventBuffer.Remove(&expectedEvent));	//Loop needed for REL Build with DEB WSERV and W32
   1.178 +		#if defined(DETAILED)
   1.179 +			_LIT(KLog,"Skip event while waiting for error message");
   1.180 +			if (expectedEvent.Type()==EEventErrorMessage && wsEvent.Type()!=expectedEvent.Type())
   1.181 +				iTest->LOG_MESSAGE(KLog);
   1.182 +		#endif
   1.183 +			} while (expectedEvent.Type()==EEventErrorMessage && wsEvent.Type()!=expectedEvent.Type());
   1.184 +		++iEventCount;		//iEventSet
   1.185 +	#if defined(FAIL_LOGGING)
   1.186 +		wsType=wsEvent.Type(),eType=expectedEvent.Type(),wsHan=wsEvent.Handle(),eHan=expectedEvent.Handle();
   1.187 +		if (wsType!=eType)
   1.188 +			{
   1.189 +			_LIT(KEventDiff,"Count=%d  Events Differ Exp=%d  Act=%d");
   1.190 +			buf.Copy(KStartString);
   1.191 +			buf.AppendFormat(KEventDiff,iEventCount,eType,wsType);
   1.192 +			iTest->LOG_MESSAGE(buf);
   1.193 +			}
   1.194 +		else
   1.195 +			{
   1.196 +		#if defined(DETAILED)
   1.197 +			_LIT(KLog," Count=%d  Event Type=%d");
   1.198 +			iTest->LOG_MESSAGE3(KLog,iEventCount,wsType);
   1.199 +		#endif
   1.200 +			}
   1.201 +		if (wsHan!=eHan)
   1.202 +			{
   1.203 +			_LIT(KHandlesDiff,"Count=%d  Handles Differ");
   1.204 +			buf.Copy(KStartString);
   1.205 +			buf.AppendFormat(KHandlesDiff,iEventCount);
   1.206 +			iTest->LOG_MESSAGE(buf);
   1.207 +			}
   1.208 +	#endif
   1.209 +		TestL(wsEvent.Type()==expectedEvent.Type() && wsEvent.Handle()==expectedEvent.Handle());
   1.210 +		}		
   1.211 +	iLastEventError=(wsEvent.Type()==EEventErrorMessage);
   1.212 +
   1.213 +	switch(wsEvent.Type())
   1.214 +		{
   1.215 +		case EEventKey:
   1.216 +		#if defined(FAIL_LOGGING)
   1.217 +			wsKeyCode=wsEvent.Key()->iCode,eKeyCode=expectedEvent.Key()->iCode;
   1.218 +			if (wsKeyCode!=eKeyCode)
   1.219 +				{
   1.220 +				_LIT(KKeysDiff,"Count=%d  Key Code Exp=%d (%c)  Act=%d (%c)");
   1.221 +				buf.Copy(KStartString);
   1.222 +				buf.AppendFormat(KKeysDiff,iEventCount,eKeyCode,eKeyCode,wsKeyCode,wsKeyCode);
   1.223 +				iTest->LOG_MESSAGE(buf);
   1.224 +				}
   1.225 +			wsKeyRepeat=wsEvent.Key()->iRepeats,eKeyRepeat=expectedEvent.Key()->iRepeats;
   1.226 +			if ((wsKeyRepeat>0)!=(eKeyRepeat>0) || wsKeyRepeat<eKeyRepeat)
   1.227 +				{
   1.228 +				_LIT(KKeysRepDiff,"Count=%d  Key Repeat Exp=%d  Act=%d");
   1.229 +				buf.Copy(KStartString);
   1.230 +				buf.AppendFormat(KKeysRepDiff,iEventCount,eKeyRepeat,wsKeyRepeat);
   1.231 +				iTest->LOG_MESSAGE(buf);
   1.232 +				}
   1.233 +		#endif
   1.234 +			TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode &&
   1.235 +				wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats &&
   1.236 +				(wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0));
   1.237 +			// Fall Through
   1.238 +		case EEventKeyDown:
   1.239 +		case EEventKeyUp:
   1.240 +			{
   1.241 +			TUint wsModifiers = wsEvent.Key()->iModifiers;
   1.242 +			TUint eModifiers = expectedEvent.Key()->iModifiers;
   1.243 +		#if defined(FAIL_LOGGING)
   1.244 +			wsKeyScan=wsEvent.Key()->iScanCode,eKeyScan=expectedEvent.Key()->iScanCode;
   1.245 +			if (wsKeyScan!=eKeyScan)
   1.246 +				{
   1.247 +				_LIT(KScanDiff,"Count=%d  Scan Code Exp=%d (%c)  Act=%d (%c)");
   1.248 +				buf.Copy(KStartString);
   1.249 +				buf.AppendFormat(KScanDiff,iEventCount,eKeyScan,eKeyScan,wsKeyScan,wsKeyScan);
   1.250 +				iTest->LOG_MESSAGE(buf);
   1.251 +				}
   1.252 +
   1.253 +			if (eModifiers != KModifiersIgnore && wsModifiers != eModifiers)
   1.254 +				{
   1.255 +				_LIT(KModDiff,"Count=%d  Modifiers Exp=0x%x  Act=0x%x");
   1.256 +				buf.Copy(KStartString);
   1.257 +				buf.AppendFormat(KModDiff, iEventCount, eModifiers, wsModifiers);
   1.258 +				iTest->LOG_MESSAGE(buf);
   1.259 +				}
   1.260 +		#endif
   1.261 +			TestL(wsEvent.Key()->iScanCode == expectedEvent.Key()->iScanCode &&
   1.262 +				(eModifiers == KModifiersIgnore || wsModifiers == eModifiers));
   1.263 +			}
   1.264 +			break;
   1.265 +		case EEventModifiersChanged:
   1.266 +			{
   1.267 +			TBool changeModifiersOK=(wsEvent.ModifiersChanged()->iChangedModifiers
   1.268 +																==expectedEvent.ModifiersChanged()->iChangedModifiers);
   1.269 +			TBool modifiersOK=((wsEvent.ModifiersChanged()->iModifiers&wsEvent.ModifiersChanged()->iChangedModifiers)==
   1.270 +						(expectedEvent.ModifiersChanged()->iModifiers&wsEvent.ModifiersChanged()->iChangedModifiers));
   1.271 +		#if defined(FAIL_LOGGING)
   1.272 +			if (!changeModifiersOK || !modifiersOK)
   1.273 +				{
   1.274 +				_LIT(KModDiff,"Count=%d  Modifiers");
   1.275 +				buf.Copy(KStartString);
   1.276 +				buf.AppendFormat(KModDiff,iEventCount);
   1.277 +				iTest->LOG_MESSAGE(buf);
   1.278 +				}
   1.279 +		#endif
   1.280 +			TestL(changeModifiersOK);
   1.281 +			TestL(modifiersOK);
   1.282 +			}
   1.283 +			break;
   1.284 +		case EEventPointer:
   1.285 +		case EEventDragDrop:
   1.286 +			{
   1.287 +		#if defined(FAIL_LOGGING)
   1.288 +			TInt expectedType=expectedEvent.Pointer()->iType, actualType=wsEvent.Pointer()->iType;
   1.289 +			TPoint expectedPos=expectedEvent.Pointer()->iPosition, actualPos=wsEvent.Pointer()->iPosition;
   1.290 +			if (actualType!=expectedType)
   1.291 +				{
   1.292 +				_LIT(KPointerDiff,"Count=%d  Pointer Type Exp=%d  Act=%d");
   1.293 +				buf.Copy(KStartString);
   1.294 +				buf.AppendFormat(KPointerDiff,iEventCount,expectedType,actualType);
   1.295 +				iTest->LOG_MESSAGE(buf);
   1.296 +				}
   1.297 +			if (actualPos!=expectedPos)
   1.298 +				{
   1.299 +				_LIT(KPointerPosDiff,"Count=%d  Pointer Pos E=(%d,%d)  A=(%d,%d)");
   1.300 +				buf.Copy(KStartString);
   1.301 +				buf.AppendFormat(KPointerPosDiff,iEventCount,expectedPos.iX,expectedPos.iY
   1.302 +																,actualPos.iX,actualPos.iY);
   1.303 +				iTest->LOG_MESSAGE(buf);
   1.304 +				}
   1.305 +		#endif
   1.306 +			TestL(wsEvent.Pointer()->iType==expectedEvent.Pointer()->iType);
   1.307 +			TestL(wsEvent.Pointer()->iPosition==expectedEvent.Pointer()->iPosition);
   1.308 +			TInt count=iEventBuffer.Count();count++;			//Dummy line to help in debugging.
   1.309 +			}
   1.310 +			break;
   1.311 +		case EEventWindowVisibilityChanged:
   1.312 +			{
   1.313 +		#if defined(FAIL_LOGGING)
   1.314 +			TUint expectedFlags=expectedEvent.VisibilityChanged()->iFlags;
   1.315 +			TUint actualFlags=wsEvent.VisibilityChanged()->iFlags;
   1.316 +			if (actualFlags!=expectedFlags)
   1.317 +				{
   1.318 +				_LIT(KVisibilityDiff,"Count=%d  Visibility Flags Exp=%d  Act=%d");
   1.319 +				buf.Copy(KStartString);
   1.320 +				buf.AppendFormat(KVisibilityDiff,iEventCount,expectedFlags,actualFlags);
   1.321 +				iTest->LOG_MESSAGE(buf);
   1.322 +				}
   1.323 +		#endif
   1.324 +			TestL(wsEvent.VisibilityChanged()->iFlags==expectedEvent.VisibilityChanged()->iFlags);
   1.325 +			TInt count=iEventBuffer.Count();count++;			//Dummy line to help in debugging.
   1.326 +			}
   1.327 +			break;
   1.328 +		case EEventMessageReady:
   1.329 +			{
   1.330 +			const SEventMessageReady message = *(SEventMessageReady*)wsEvent.EventData();
   1.331 +			TestL(message.iMessageUid== TUid::Uid(123));
   1.332 +			}
   1.333 +			break;
   1.334 +		default:;
   1.335 +		}
   1.336 +	if(iCheckTimeStamp)
   1.337 +		{
   1.338 +		const TInt KOffset=100000; //0.1secs
   1.339 +		TInt64 offset = expectedEvent.Time().Int64() - wsEvent.Time().Int64();
   1.340 +		#if defined(FAIL_LOGGING)
   1.341 +			if(Abs(offset)<KOffset)
   1.342 +				{
   1.343 +				_LIT(KTimeStampDiff,"Count=%d  Offset=%d, ExpectedTime=%d, WServEventTime=%d");
   1.344 +				buf.Copy(KStartString);
   1.345 +				buf.AppendFormat(KTimeStampDiff,iEventCount,offset,expectedEvent.Time().Int64(),wsEvent.Time().Int64());
   1.346 +				iTest->LOG_MESSAGE(buf);
   1.347 +				}
   1.348 +		#endif
   1.349 +		TestL(Abs(offset)<KOffset);
   1.350 +		}
   1.351 +	End:
   1.352 +	if (iEventBuffer.Count()==0)
   1.353 +	    {
   1.354 +		TRAPD(err, iTest->NextSetOfEventsL());		//Not allowed to leave
   1.355 +		if(err != KErrNone)
   1.356 +		    {
   1.357 +            buf.Copy(KStartString);
   1.358 +            buf.AppendFormat(_L("Subtest does not follow rules set by TEvent test framework, leave code: %d"), err);
   1.359 +            iTest->TEST(EFalse);
   1.360 +            iTest->LOG_MESSAGE(buf);
   1.361 +            User::Leave(err);
   1.362 +		    }
   1.363 +	    }
   1.364 +	
   1.365 +	}
   1.366 +
   1.367 +void CTQueueTestEvent::AddExpectedEvent(TWsEvent &aEvent)
   1.368 +	{
   1.369 +	if(iCheckTimeStamp)
   1.370 +		{
   1.371 +		static_cast<TWsQTEvent&>(aEvent).Time().UniversalTime();
   1.372 +		}
   1.373 +	iEventBuffer.Add(&aEvent);
   1.374 +	}
   1.375 +
   1.376 +TInt CTQueueTestEvent::EventsLeft()
   1.377 +	{
   1.378 +	return iEventBuffer.Count();
   1.379 +	}
   1.380 +//
   1.381 +
   1.382 +CTQueueWindowGroup::CTQueueWindowGroup(CTClient *aClient) : CTWindowGroup(aClient)
   1.383 +	{}
   1.384 +
   1.385 +void CTQueueWindowGroup::ConstructL()
   1.386 +	{
   1.387 +	CTWindowGroup::ConstructL();
   1.388 +	User::LeaveIfError(iGroupWin.EnableOnEvents(EEventControlAlways));
   1.389 +	User::LeaveIfError(iGroupWin.EnableGroupChangeEvents());
   1.390 +	}
   1.391 +
   1.392 +//
   1.393 +
   1.394 +/**
   1.395 + Closes and deletes anim DLL.
   1.396 + @param aAnimDll Pointer to the anim Dll to be closed and deleted
   1.397 + */
   1.398 +LOCAL_C void DestroyAnimDll(TAny* aAnimDll)
   1.399 +	{
   1.400 +	(static_cast<RAnimDll*>(aAnimDll))->Destroy();
   1.401 +	}
   1.402 +
   1.403 +/**
   1.404 + Destroys an REventAnimBase derived anim
   1.405 + @param aAnim REventAnimBase derived client-side handle to anim
   1.406 + */
   1.407 +LOCAL_C void DestroyAnim(TAny* aAnim)
   1.408 +	{
   1.409 +	(static_cast<REventAnimBase*>(aAnim))->Destroy();
   1.410 +	}
   1.411 +
   1.412 +/**
   1.413 + Loads the DLL containing the test anims and pushes it onto the cleanup stack.
   1.414 + This function leaves if the operation was unsuccessful.
   1.415 + @return A pointer to the DLL containing test anims
   1.416 + */
   1.417 +RAnimDll* REventAnimBase::LoadL()
   1.418 +	{
   1.419 +	RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs);
   1.420 +	CleanupStack::PushL(TCleanupItem(DestroyAnimDll,animDll));
   1.421 +	User::LeaveIfError(animDll->Load(KAnimDLLName));
   1.422 +	CleanupStack::Pop(animDll);
   1.423 +	return animDll;
   1.424 +	}
   1.425 +
   1.426 +/**
   1.427 + Closes the client-side handle to the anim, destroys the DLL and deletes itself.
   1.428 + */
   1.429 +void REventAnimBase::Destroy()
   1.430 +	{
   1.431 +	Close();
   1.432 +	delete this;
   1.433 +	}
   1.434 +
   1.435 +/**
   1.436 + Resets server-side state of anim
   1.437 + */
   1.438 +void REventAnimBase::Reset()
   1.439 +	{
   1.440 +	CommandReply(EADllReset);
   1.441 +	}
   1.442 +
   1.443 +/**
   1.444 + @return Under non-error conditions, returns 0.
   1.445 + Under error conditions, returns the number of events received
   1.446 + since the first unexpected event was sent.
   1.447 + */
   1.448 +TInt REventAnimBase::ErrorCode()
   1.449 +	{
   1.450 +	return CommandReply(EADllErrorCode);
   1.451 +	}
   1.452 +
   1.453 +/**
   1.454 + @return The number of events received by the anim since it was last reset.
   1.455 + */
   1.456 +TInt REventAnimBase::NumberOfEventsReceived()
   1.457 +	{
   1.458 +	return CommandReply(EADllNumberOfEventsReceived);
   1.459 +	}
   1.460 +
   1.461 +/**
   1.462 + Adds an expected event to the list of events expected by the anim.
   1.463 + @param aEat Indicates if event is expected to be eaten (ETrue 'indicates expected to be eaten')
   1.464 + @param aEvent The expected event
   1.465 + @return KErrNone if succcessful, othewise error code.
   1.466 + */
   1.467 +TInt REventAnimBase::AddExpectedEvent(TBool aEat, const TRawEvent& aEvent)
   1.468 +	{
   1.469 +	TAnimRawEvent event;
   1.470 +	event.iRawEvent=aEvent;
   1.471 +	event.iEat=aEat;
   1.472 +	return AddExpectedEvent(event);
   1.473 +	}
   1.474 +
   1.475 +/**
   1.476 + Adds an expected event to the list of events expected by the anim.
   1.477 + @param aEvent The expected event
   1.478 + @return KErrNone if succcessful, othewise error code.
   1.479 + */
   1.480 +TInt REventAnimBase::AddExpectedEvent(const TAnimRawEvent& aEvent)
   1.481 +	{
   1.482 +	TPckgBuf<TAnimRawEvent> param;
   1.483 +	param()=aEvent;
   1.484 +	return CommandReply(EADllAddExpectedEvent,param);
   1.485 +	}
   1.486 +
   1.487 +//
   1.488 +
   1.489 +/**
   1.490 + Loads the DLL containing the event test anim and creates an anim for event tests
   1.491 + @param aWin the base window to which the anim is associated (this anim is a Window anim)
   1.492 + @return A pointer to the new REventAnim
   1.493 + */
   1.494 +REventAnim* REventAnim::NewL(RWindowBase* aWin, RAnimDll* aDll, REventAnimBase::EAnimationType aType/*=EEventAnim*/)
   1.495 +	{
   1.496 +	REventAnim* self=new(ELeave) REventAnim(aDll);
   1.497 +	CleanupStack::PushL(TCleanupItem(DestroyAnim,self));
   1.498 +	User::LeaveIfError(self->Construct(*aWin,(aType == EEventAnim ? EAnimTypeEventTest : EAnimTypeEventPostingTest), TPtrC8()));
   1.499 +	CleanupStack::Pop(self);
   1.500 +	return self;
   1.501 +	}
   1.502 +
   1.503 +/**
   1.504 + Checks if the anim has received the correct events, and resets the sever-side state of the anim
   1.505 + @return positive value if events did not match expected showing the first event that didn't match.
   1.506 +         negative value if there were the wrong number of events showing the number of events there were
   1.507 +         0 if correct number of events and they all match
   1.508 + */
   1.509 +TInt REventAnim::TestFail(TInt aNoEvents)
   1.510 +	{
   1.511 +	TInt events=CommandReply(EADllErrorCode);
   1.512 +	if (events>0)
   1.513 +		return events;
   1.514 +	events=CommandReply(EADllNoEventsAndReset);
   1.515 +	if (events==aNoEvents)
   1.516 +		return 0;
   1.517 +	return -events;
   1.518 +	}
   1.519 +
   1.520 +//
   1.521 +/**
   1.522 + Loads the DLL containing the event test anim and creates an anim for event handler removal tests
   1.523 + @param aWin the base window to which the anim is associated (this anim is a Window anim)
   1.524 + @return A pointer to the new REventAnim
   1.525 + */
   1.526 +RRemovableAnim* RRemovableAnim::NewLC(RWindowBase* aWin, RAnimDll* aDll)
   1.527 +	{
   1.528 +	RRemovableAnim* self=new(ELeave) RRemovableAnim(aDll);
   1.529 +	CleanupStack::PushL(TCleanupItem(DestroyAnim,self));
   1.530 +	User::LeaveIfError(self->Construct(*aWin,EAnimTypeRemovableAnim,TPtrC8()));
   1.531 +	return self;
   1.532 +	}
   1.533 +
   1.534 +/**
   1.535 + Sets the lifetime of the anim. This anim will remove itself from the
   1.536 + event handler list after receiving this number of events.
   1.537 + @return The lifetime of the anim
   1.538 + */
   1.539 +TInt RRemovableAnim::SetEventHandlerLifetime(TInt aEventCount)
   1.540 +	{
   1.541 +	TPckgBuf<TInt> param;
   1.542 +	param()=aEventCount;
   1.543 +	return CommandReply(EADllSetEventHandlerLifetime, param);
   1.544 +	}
   1.545 +
   1.546 +/**
   1.547 + Retrieves the lifetime of the anim. This anim will remove itself from the
   1.548 + event handler list after receiving this number of events.
   1.549 + @return The lifetime of the anim
   1.550 + */
   1.551 +TInt RRemovableAnim::EventHandlerLifetime()
   1.552 +	{
   1.553 +	return CommandReply(EADllEventHandlerLifetime);
   1.554 +	}
   1.555 +/**
   1.556 + Adds the anim to the list of event handlers.
   1.557 + This anim should receive any subsequent events.
   1.558 + @return KErrNone on successful addition.
   1.559 + */
   1.560 +TInt RRemovableAnim::AddToEventHandlers()
   1.561 +	{
   1.562 +	return CommandReply(EADllAddToEventHandlers);
   1.563 +	}
   1.564 +
   1.565 +/**
   1.566 + Removes the anim from the list of event handlers.
   1.567 + This anim should not receive any subsequent events.
   1.568 + @return KErrNone on successful removal.
   1.569 + */
   1.570 +TInt RRemovableAnim::RemoveFromEventHandlers()
   1.571 +	{
   1.572 +	return CommandReply(EADllRemoveFromEventHandlers);
   1.573 +	}
   1.574 +
   1.575 +/**
   1.576 + Tests if the anim has received the correct number of events, and that
   1.577 + the events received are all the correct events.
   1.578 + @param aNoEvents The total expected number of events since it was last reset/constructed.
   1.579 + @return ETrue if the anim has received the expected events.
   1.580 + */
   1.581 +TBool RRemovableAnim::TestPassed()
   1.582 +	{
   1.583 +	return CommandReply(EADllTestPassed);
   1.584 +	}
   1.585 +
   1.586 +//
   1.587 +
   1.588 +CTEventTest::CTEventTest(CTestStep* aStep) : CTWsGraphicsBase(aStep)
   1.589 +	{
   1.590 +	INFO_PRINTF1(_L("Testing Event functions"));
   1.591 +	}
   1.592 +
   1.593 +CTEventTest::~CTEventTest()
   1.594 +	{
   1.595 +	delete iBlankWin;
   1.596 +	iBackingWindow.Close();
   1.597 +	delete iVisWins1;
   1.598 +	delete iVisWins2;
   1.599 +	delete iVisWins3;
   1.600 +	delete iTransWin;
   1.601 +	delete iQueueClient;
   1.602 +	if (iAnim)
   1.603 +		iAnim->Destroy();
   1.604 +	delete iEventTestGroup2;		//Just in case it doesn't get deleted normally
   1.605 +	delete iEventTestGroup3;		//Just in case it doesn't get deleted normally
   1.606 +	delete iEventTestGroup4;        //Just in case it doesn't get deleted normally
   1.607 +	if (iPtrPluginLoaded)
   1.608 +	    {
   1.609 +	    iClick.Unload();
   1.610 +	    }
   1.611 +	iClick.Close();
   1.612 +	if (iTurnBackOnCapsLock)
   1.613 +		{
   1.614 +		TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOnModifier);
   1.615 +		}
   1.616 +	if (iRemovableAnims)
   1.617 +		{
   1.618 +		EventHandlerRemoval_DestroyAllAnims();
   1.619 +		iRemovableAnims->Close();
   1.620 +		delete iRemovableAnims;
   1.621 +		}
   1.622 +	if (iAnimDll)
   1.623 +		{
   1.624 +		iAnimDll->Destroy();
   1.625 +		}
   1.626 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	
   1.627 +#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
   1.628 +	if (!iSurfaceId.IsNull())
   1.629 +	    {
   1.630 +	    iSurfaceManager.CloseSurface(iSurfaceId);
   1.631 +	    }
   1.632 +	iSurfaceManager.Close();
   1.633 +	if(iTimeOutCallback)
   1.634 +	    {
   1.635 +	    iTimeOutCallback->Cancel();
   1.636 +	    delete iTimeOutCallback;
   1.637 +	    }
   1.638 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
   1.639 +#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
   1.640 +	}
   1.641 +
   1.642 +void CTEventTest::ConstructL()
   1.643 +	{
   1.644 +    _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini");
   1.645 +    CIniData* iniData = CIniData::NewL(KWsIniFile, ' ');
   1.646 +    _LIT( KWsiniYShifting, "YSHIFTING");
   1.647 +    iniData->FindVar(KWsiniYShifting, iYOffset);
   1.648 +    delete iniData;
   1.649 +	TheClient->iScreen->SetAppScreenMode(0);
   1.650 +	TheClient->iScreen->SetScreenMode(0);						// in mode 0 TheClient->iScreen->SizeInPixels() 
   1.651 +	iPhysicalScreenSize = TheClient->iScreen->SizeInPixels();	// is equal to physical screen size
   1.652 +	BaseWin->Invalidate();
   1.653 +	BaseWin->Win()->BeginRedraw();
   1.654 +	TheGc->Activate(*BaseWin->Win());
   1.655 +	TheGc->SetBrushColor(TRgb::Gray16(12));
   1.656 +	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.657 +	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
   1.658 +	TheGc->DrawRect(TRect(BaseWin->Win()->Size()));
   1.659 +	TheGc->Deactivate();
   1.660 +	BaseWin->Win()->EndRedraw();
   1.661 +	TheGc->Activate(*TestWin->Win());
   1.662 +	TheGc->SetBrushColor(TRgb::Gray16(4));
   1.663 +	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
   1.664 +	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
   1.665 +	TheGc->DrawRect(TRect(TestWin->Win()->Size()));
   1.666 +	TheGc->Deactivate();
   1.667 +	iBackingWindow=RBlankWindow(TheClient->iWs);
   1.668 +	iBackingWindow.Construct(*TheClient->iGroup->WinTreeNode(),ENullWsHandle);
   1.669 +	iBackingWindow.SetColor(TRgb(0,0xDD,0xDD));
   1.670 +	iBackingWindow.SetOrdinalPosition(-1,-25);
   1.671 +	iBackingWindow.Activate();
   1.672 +	iBlankWin=new(ELeave) CTBlankWindow();
   1.673 +	iBlankWin->ConstructL(*TheClient->iGroup);
   1.674 +	User::LeaveIfError(iBlankWin->BaseWin()->SetRequiredDisplayMode(EColor256));
   1.675 +	iBlankWin->SetExt(TPoint(),iPhysicalScreenSize);
   1.676 +	iBlankWin->SetVisible(EFalse);
   1.677 +	iBlankWin->Activate();
   1.678 +	CArrayFixFlat<TInt> *rotations=new(ELeave) CArrayFixFlat<TInt>(1);
   1.679 +	iNumScrModes=TheClient->iScreen->NumScreenModes();
   1.680 +	TInt modes=Min(2,iNumScrModes);
   1.681 +	TInt mode;
   1.682 +	TInt rot;
   1.683 +	CleanupStack::PushL(rotations);
   1.684 +	for (mode=0;mode<modes;++mode)
   1.685 +		{
   1.686 +		User::LeaveIfError(TheClient->iScreen->GetRotationsList(mode,rotations));
   1.687 +		for (rot=rotations->Count()-1;rot>=0;--rot)
   1.688 +			{
   1.689 +			iScreenModeTests|=(1<<(*rotations)[rot]);
   1.690 +			}
   1.691 +		}
   1.692 +	if (CheckScalingSupportedOrNot())
   1.693 +		iScreenModeTests|=EDoScale;
   1.694 +
   1.695 +	iClick=RSoundPlugIn(TheClient->iWs);
   1.696 +	User::LeaveIfError(iClick.Construct(TUid::Uid(CLICK_THIRD_UID)));
   1.697 +    TBool ptrPluginLoadable = EFalse;
   1.698 +    iClick.IsLoaded(ptrPluginLoadable);
   1.699 +    if (ptrPluginLoadable)
   1.700 +        {
   1.701 +        User::LeaveIfError(iClick.Load(KKeyClickPluginDll));
   1.702 +        iPtrPluginLoaded = ETrue;
   1.703 +        }
   1.704 +	CleanupStack::PopAndDestroy();
   1.705 +	if (TheClient->iWs.GetModifierState()&EModifierCapsLock)
   1.706 +		{
   1.707 +		iTurnBackOnCapsLock=ETrue;
   1.708 +		TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOffModifier);
   1.709 +		}
   1.710 +	iAnimDll = REventAnimBase::LoadL();
   1.711 +	TInt mods=TheClient->iWs.GetModifierState();
   1.712 +	if (mods&EModifierCapsLock)
   1.713 +		iTest->SimulateKeyDownUp(EStdKeyCapsLock);
   1.714 +	if (mods&EModifierNumLock)
   1.715 +		iTest->SimulateKeyDownUp(EStdKeyNumLock);
   1.716 +	//Make sure all the keys we test are in the up state
   1.717 +	iTest->SimulateKeyDownUp(EStdKeyLeftShift);
   1.718 +	iTest->SimulateKeyDownUp(EStdKeyRightShift);
   1.719 +	iTest->SimulateKeyDownUp(EStdKeyLeftFunc);
   1.720 +	iTest->SimulateKeyDownUp(EStdKeyLeftCtrl);
   1.721 +	iTest->SimulateKeyDownUp(EStdKeyRightCtrl);
   1.722 +	mods=TheClient->iWs.GetModifierState();
   1.723 +	_LIT(KLog,"Initial Modifiers state 0x%x (ideally should be zero)");
   1.724 +	LOG_MESSAGE2(KLog,mods);
   1.725 +	iTest->DelayIfFullRomL();
   1.726 +
   1.727 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
   1.728 +	// 2d or 3d pointer?
   1.729 +	if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone)
   1.730 +		{
   1.731 +		iIs3DPointer=EFalse;
   1.732 +		}
   1.733 +#endif
   1.734 +	TheClient->iWs.GetKeyboardRepeatRate(iKeyBoardRepeatInitialDelay, iKeyBoardRepeatNextDelay);
   1.735 +	}
   1.736 +
   1.737 +void CTEventTest::Failed()
   1.738 +	{
   1.739 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	
   1.740 +#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
   1.741 +   if(iTimeOutCallback)
   1.742 +        {
   1.743 +        iTimeOutCallback->Cancel();
   1.744 +        iTimeOutCallback->Deque();
   1.745 +        delete iTimeOutCallback;
   1.746 +        iTimeOutCallback = NULL;
   1.747 +        }
   1.748 +    TEST(EFalse);
   1.749 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
   1.750 +#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
   1.751 +	CActiveScheduler::Stop();
   1.752 +	iFailed=ETrue;
   1.753 +	}
   1.754 +
   1.755 +void CTEventTest::CheckTimeInterval(const TTimeIntervalMicroSeconds32 &aTime,TInt aCheckTime)
   1.756 +	{
   1.757 +	TEST(aTime.Int()==aCheckTime);
   1.758 +	if (aTime.Int()!=aCheckTime)
   1.759 +		INFO_PRINTF3(_L("aTime.Int()==aCheckTime - Expected: %d, Actual: %d"), aCheckTime, aTime.Int());
   1.760 +	}
   1.761 +
   1.762 +void CTEventTest::KeyRepeatRate(TInt aInitialRepeat, TInt aRepeat)
   1.763 +	{
   1.764 +	TheClient->iWs.SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32(aInitialRepeat), TTimeIntervalMicroSeconds32(aRepeat));
   1.765 +	TTimeIntervalMicroSeconds32 initialTime;
   1.766 +	TTimeIntervalMicroSeconds32 time;
   1.767 +	TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
   1.768 +	CheckTimeInterval(initialTime,aInitialRepeat);
   1.769 +	CheckTimeInterval(time,aRepeat);
   1.770 +	}
   1.771 +
   1.772 +void CTEventTest::DoubleClickSettings(TInt aInterval, TInt aDistance)
   1.773 +	{
   1.774 +	TheClient->iWs.SetDoubleClick(TTimeIntervalMicroSeconds32(aInterval), aDistance);
   1.775 +	TTimeIntervalMicroSeconds32 interval;
   1.776 +	TInt distance;
   1.777 +	TheClient->iWs.GetDoubleClickSettings(interval, distance);
   1.778 +	CheckTimeInterval(interval,aInterval);
   1.779 +	TEST(aDistance==distance);
   1.780 +	if (aDistance!=distance)
   1.781 +		INFO_PRINTF3(_L("aDistance==distance - Expected: %d, Actual: %d"), distance, aDistance);
   1.782 +	}
   1.783 +
   1.784 +TInt EventCancelFunc(TAny* aClient)
   1.785 +	{
   1.786 +	TWsQTEvent event;
   1.787 +	event.SetType(EEventModifiersChanged);
   1.788 +	((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0;
   1.789 +	((TModifiersChangedEvent *)event.EventData())->iModifiers=0;
   1.790 +	TheClient->iWs.SendEventToWindowGroup(TheClient->iGroup->GroupWin()->Identifier(),event);
   1.791 +//
   1.792 +	TRequestStatus status;
   1.793 +	((CTClient *)aClient)->iWs.EventReady(&status);
   1.794 +	((CTClient *)aClient)->iWs.EventReadyCancel();
   1.795 +	User::WaitForRequest(status);
   1.796 +	return(KErrNone);
   1.797 +	}
   1.798 +
   1.799 +void CTEventTest::General()
   1.800 +	{
   1.801 +	TWsQTEvent event;
   1.802 +	event.SetType(EEventModifiersChanged);
   1.803 +	((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0;
   1.804 +	((TModifiersChangedEvent *)event.EventData())->iModifiers=0;
   1.805 +	TheClient->iWs.SendEventToWindowGroup(TheClient->iGroup->GroupWin()->Identifier(),event);
   1.806 +	TCallBack callBack(EventCancelFunc,TheClient);
   1.807 +	TheClient->SetCancelFunction(callBack);
   1.808 +//
   1.809 +	TTimeIntervalMicroSeconds32 oldInitialTime;
   1.810 +	TTimeIntervalMicroSeconds32 oldTime;
   1.811 +	TheClient->iWs.GetKeyboardRepeatRate(oldInitialTime,oldTime);
   1.812 +//
   1.813 +	KeyRepeatRate(EKeyboardInitialRepeat1, EKeyboardRepeat1);
   1.814 +	KeyRepeatRate(EKeyboardInitialRepeat2, EKeyboardRepeat2);
   1.815 +	KeyRepeatRate(EKeyboardInitialRepeat3+200, EKeyboardRepeat3); // Max initial repeat with normal keyboard repeat value
   1.816 +	KeyRepeatRate(EKeyboardInitialRepeat3, EKeyboardRepeat7+200); // Max key and initial repeat
   1.817 +	KeyRepeatRateNegTest(EKeyboardInitialRepeat4, EKeyboardRepeat4); // -ve initial repeat
   1.818 +	KeyRepeatRateNegTest(EKeyboardInitialRepeat2, EKeyboardRepeat6); // -ve keyboard repeat
   1.819 +	#if defined __WINS__ || defined __WINSCW__
   1.820 +	KeyRepeatRateNegTest(EKeyboardInitialRepeat3+400, EKeyboardRepeat5); // More than max initial repeat
   1.821 +	#endif//defined __WINS__ || defined __WINSCW__
   1.822 +	DoubleClickSettings(EDoubleClickTime1,EDoubleClickGap1);
   1.823 +	DoubleClickSettings(EDoubleClickTime2,EDoubleClickGap2);
   1.824 +	TheClient->iWs.SetKeyboardRepeatRate(oldInitialTime,oldTime);
   1.825 +//
   1.826 +	}
   1.827 +
   1.828 +#define UNIQUE_PRIORITY 123
   1.829 +void CTEventTest::General2()
   1.830 +	{
   1.831 +	RWindowGroup& group=*TheClient->iGroup->GroupWin();
   1.832 +	TInt priority=group.OrdinalPriority();
   1.833 +	TInt position=group.OrdinalPosition();
   1.834 +	TInt priorityGain=TheClient->iWs.GetWindowGroupOrdinalPriority(group.Identifier())-priority;
   1.835 +	group.SetOrdinalPosition(0,UNIQUE_PRIORITY);
   1.836 +	TWsQTEvent event;
   1.837 +	event.SetType(EEventModifiersChanged);
   1.838 +	((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0;
   1.839 +	((TModifiersChangedEvent *)event.EventData())->iModifiers=0;
   1.840 +	TheClient->iWs.SendEventToAllWindowGroups(UNIQUE_PRIORITY+priorityGain,event);
   1.841 +	TCallBack callBack(EventCancelFunc,TheClient);
   1.842 +	TheClient->SetCancelFunction(callBack);
   1.843 +	group.SetOrdinalPosition(position,priority);
   1.844 +	}
   1.845 +
   1.846 +void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
   1.847 +	{
   1.848 +	TPckgBuf<TWsEvent> evtPkg;
   1.849 +	TWsEvent& event=evtPkg();
   1.850 +	if (aEventCode==EEventKey && aCode==0)
   1.851 +		aCode=aScanCode;
   1.852 +	event.SetType(aEventCode);
   1.853 +	event.SetHandle((TInt)iQueueClient->iGroup);
   1.854 +	event.Key()->iCode=aCode;
   1.855 +	event.Key()->iScanCode=aScanCode;
   1.856 +	event.Key()->iModifiers=aModifiers;
   1.857 +	event.Key()->iRepeats=aRepeats;
   1.858 +	iQueueClient->AddExpectedEvent(event);
   1.859 +	if (iAddToClick)
   1.860 +		{
   1.861 +		if (aModifiers == KModifiersIgnore)
   1.862 +			{
   1.863 +			// Key click tests assume zero modifiers in click event by default
   1.864 +			event.Key()->iModifiers = 0;
   1.865 +			}
   1.866 +		iClick.CommandReply(EClickEventAdd,evtPkg);
   1.867 +		}
   1.868 +	}
   1.869 +
   1.870 +void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
   1.871 +	{
   1.872 +	__ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital));
   1.873 +	// EModiferAutorepeatable can be present in EEventKey but is never valid
   1.874 +	// in EEventKeyDown and EEventKeyUp. 
   1.875 +	TUint modifiersDownUp = (aModifiers == KModifiersIgnore) ?
   1.876 +		aModifiers : aModifiers & ~EModifierAutorepeatable;
   1.877 +
   1.878 +	AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,modifiersDownUp);
   1.879 +	AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers);
   1.880 +	AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,modifiersDownUp);
   1.881 +	}
   1.882 +
   1.883 +void CTEventTest::AddExpectedEvent(TInt aEventCode, CTWinBase* aWin)
   1.884 +	{
   1.885 +	TWsQTEvent event;
   1.886 +	event.iType=aEventCode;
   1.887 +	event.iHandle=REINTERPRET_CAST(TInt,aWin);
   1.888 +	iQueueClient->AddExpectedEvent(event);
   1.889 +	}
   1.890 +
   1.891 +void CTEventTest::AddExpectedEvent(TInt aEventCode, RWindowGroup* aWindow)
   1.892 +	{
   1.893 +	TWsQTEvent event;
   1.894 +	event.iType=aEventCode;
   1.895 +	event.iHandle=(TUint32)aWindow;
   1.896 +	iQueueClient->AddExpectedEvent(event);
   1.897 +	}
   1.898 +
   1.899 +void CTEventTest::AddExpectedEvent(TInt aEventCode)
   1.900 +	{
   1.901 +	AddExpectedEvent(aEventCode,iQueueClient->iGroup);
   1.902 +	}
   1.903 +
   1.904 +void CTEventTest::AddExpectedErrorMessage(TWsErrorMessage::TErrorCategory aCategory, TInt aError)
   1.905 +	{
   1.906 +	TWsQTEvent event;
   1.907 +	event.iType=EEventErrorMessage;
   1.908 +	event.iHandle=(TInt)iQueueClient->iGroup;
   1.909 +	event.ErrorMessage()->iErrorCategory=aCategory;
   1.910 +	event.ErrorMessage()->iError=aError;
   1.911 +	iQueueClient->AddExpectedEvent(event);
   1.912 +	}
   1.913 +
   1.914 +void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos)
   1.915 +	{
   1.916 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
   1.917 +	TAdvancedPointerEvent& ptrEvent=*aEvent.Pointer();
   1.918 +	aEvent.SetType(EEventPointer);
   1.919 +	ptrEvent.iParentPosition=aPos;
   1.920 +	// SetHandle must be done after iParentPosition is set, but before iPosition is set.
   1.921 +	aEvent.SetHandle(reinterpret_cast<TInt>(iQueueClient->GetHandle(aPos)));	
   1.922 +	const TPoint3D point3D(aPos.iX, aPos.iY, 0);
   1.923 +	const TInt pointerEventModifiers=0;
   1.924 +	const TUint8 pointerNumber=0;
   1.925 +	aEvent.InitAdvancedPointerEvent(aType,pointerEventModifiers,point3D,pointerNumber);
   1.926 +#else	
   1.927 +	TPointerEvent& ptrEvent=*aEvent.Pointer();
   1.928 +	aEvent.SetType(EEventPointer);
   1.929 +	ptrEvent.iParentPosition=aPos;		//Must be done before next line
   1.930 +	aEvent.SetHandle(REINTERPRET_CAST(TInt,iQueueClient->GetHandle(aPos)));
   1.931 +	ptrEvent.iType=aType;
   1.932 +	ptrEvent.iModifiers=0;
   1.933 +	ptrEvent.iPosition=aPos;
   1.934 +#endif
   1.935 +	}
   1.936 +
   1.937 +void CTEventTest::CalculatePointerCaptureEvent(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TInt aHandle)
   1.938 +	{
   1.939 +	TPointerEvent& ptrEvent=*aEvent.Pointer();
   1.940 +	aEvent.SetType(EEventPointer);
   1.941 +	ptrEvent.iParentPosition=aPos;		//Must be done before next line
   1.942 +	if(iVisWins1 && iVisWins2)
   1.943 +		{
   1.944 +		if (TRect(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()).Contains(aPos) &&
   1.945 +			!TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos))
   1.946 +			{
   1.947 +			aPos-=iQueueClient->ChildTopLeft();	//Pointer is on the first window
   1.948 +			aEvent.SetHandle((TInt)iVisWins1);
   1.949 +			}
   1.950 +		else if (TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos))
   1.951 +			{
   1.952 +			aPos-=(iQueueClient->ChildTopLeft()+TPoint(15,15));	//Pointer is on the second window
   1.953 +			aEvent.SetHandle((TInt)iVisWins2);
   1.954 +			}
   1.955 +		else if (TRect(TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight)).Contains(aPos))
   1.956 +			{
   1.957 +			aPos-=TPoint(EWinPositionX,EWinPositionY);	//Pointer is on the parent window
   1.958 +			aEvent.SetHandle((TInt)iQueueClient->iWin);
   1.959 +			}
   1.960 +		else
   1.961 +			{
   1.962 +			aEvent.SetHandle((TInt)0);		//Pointer is not in the same window group
   1.963 +			}
   1.964 +		}
   1.965 +	ptrEvent.iType=aType;
   1.966 +	ptrEvent.iModifiers=0;
   1.967 +	if(aHandle!=0 && aHandle!=aEvent.Handle())
   1.968 +		{
   1.969 +		aEvent.SetHandle(aHandle);
   1.970 +		ptrEvent.iPosition=ptrEvent.iParentPosition-(iQueueClient->ChildTopLeft()+TPoint(15,15));
   1.971 +		}
   1.972 +	else
   1.973 +		{
   1.974 +		ptrEvent.iPosition=aPos;
   1.975 +		}
   1.976 +	}
   1.977 +
   1.978 +void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aHandle)
   1.979 +	{
   1.980 +	TPckgBuf<TWsQTEvent> evtPkg;
   1.981 +	CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aHandle);
   1.982 +	iQueueClient->AddExpectedEvent(evtPkg());
   1.983 +	}
   1.984 +
   1.985 +void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos)
   1.986 +	{
   1.987 +	TPckgBuf<TWsQTEvent> evtPkg;
   1.988 +	CalculatePointerEvent(evtPkg(),aType,aPos);
   1.989 +	iQueueClient->AddExpectedEvent(evtPkg());
   1.990 +	if (iAddToClick)
   1.991 +		{
   1.992 +		evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY);
   1.993 +		iClick.CommandReply(EClickEventAdd,evtPkg);
   1.994 +		}
   1.995 +	}
   1.996 +
   1.997 +void CTEventTest::AddExpectedPointerClick(TPointerEvent::TType aType, TPoint aPos)
   1.998 +	{
   1.999 +	TPckgBuf<TWsQTEvent> evtPkg;
  1.1000 +	CalculatePointerEvent(evtPkg(),aType,aPos);
  1.1001 +	evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY);
  1.1002 +	iClick.CommandReply(EClickEventAdd,evtPkg);
  1.1003 +	}
  1.1004 +
  1.1005 +void CTEventTest::AddExpectedPointerDownUp(TPoint aPos)
  1.1006 +	{
  1.1007 +	AddExpectedPointer(TPointerEvent::EButton1Down,aPos);
  1.1008 +	AddExpectedPointer(TPointerEvent::EButton1Up,aPos);
  1.1009 +	}
  1.1010 +
  1.1011 +void CTEventTest::AddExpectedPointerScr(TPointerEvent::TType aType, TPoint aPos)
  1.1012 +	{
  1.1013 +	AddExpectedPointer(aType,TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY));
  1.1014 +	}
  1.1015 +
  1.1016 +void CTEventTest::AddExpectedPointerDownUpScr(TPoint aPos)
  1.1017 +	{
  1.1018 +	AddExpectedPointerDownUp(TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY));
  1.1019 +	}
  1.1020 +
  1.1021 +void CTEventTest::AddExpectedModifiersChanged(TInt aChangedModifiers, TInt aModifiers)
  1.1022 +	{
  1.1023 +	TWsQTEvent event;
  1.1024 +	event.iType=EEventModifiersChanged;
  1.1025 +	event.iHandle=(TInt)iQueueClient->iGroup;
  1.1026 +	event.ModifiersChanged()->iChangedModifiers=aChangedModifiers;
  1.1027 +	event.ModifiersChanged()->iModifiers=aModifiers;
  1.1028 +	iQueueClient->AddExpectedEvent(event);
  1.1029 +	}
  1.1030 +
  1.1031 +void CTEventTest::AddExpectedEnterExit(TInt aEventCode, TPoint aPos)
  1.1032 +	{
  1.1033 +	AddExpectedEvent(aEventCode,iQueueClient->GetHandle(aPos));
  1.1034 +	}
  1.1035 +
  1.1036 +void CTEventTest::AddExpectedKeyAnim(TRawEvent::TType aEventCode, TInt aScanCode, TBool aEat)
  1.1037 +	{
  1.1038 +	TAnimRawEvent event;
  1.1039 +	event.iRawEvent.Set(aEventCode,aScanCode);
  1.1040 +	event.iEat=aEat;
  1.1041 +	TInt retVal = iAnim->AddEvent(event);
  1.1042 +	TEST(retVal==KErrNone);
  1.1043 +	if (retVal!=KErrNone)
  1.1044 +		INFO_PRINTF3(_L("iAnim->AddEvent(event) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1045 +
  1.1046 +	if (!aEat)
  1.1047 +		AddExpectedKey((aEventCode==TRawEvent::EKeyDown ? EEventKeyDown:EEventKeyUp),aScanCode);
  1.1048 +	}
  1.1049 +
  1.1050 +void CTEventTest::AddExpectedPointerAnim(TRawEvent::TType aEventCode, TPoint aPoint, TBool aEat/*=ETrue*/)
  1.1051 +	{
  1.1052 +	TAnimRawEvent event;
  1.1053 +	event.iRawEvent.Set(aEventCode,aPoint.iX,aPoint.iY);
  1.1054 +	event.iEat=aEat;
  1.1055 +
  1.1056 +	TInt retVal = iAnim->AddEvent(event);
  1.1057 +	TEST(retVal==KErrNone);
  1.1058 +	if (retVal!=KErrNone)
  1.1059 +		INFO_PRINTF3(_L("iAnim->AddEvent(event) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1060 +
  1.1061 +	if (!aEat)
  1.1062 +		AddExpectedPointer((aEventCode==TRawEvent::EButton1Down ? TPointerEvent::EButton1Down:TPointerEvent::EButton1Up)
  1.1063 +																			,aPoint-TPoint(EWinPositionX,EWinPositionY));
  1.1064 +	}
  1.1065 +
  1.1066 +void CTEventTest::AddExpectedVisibilityChange(TUint aFlags)
  1.1067 +	{
  1.1068 +	TWsQTEvent event;
  1.1069 +	event.iType=EEventWindowVisibilityChanged;
  1.1070 +	event.iHandle=(TInt)iVisWins1;
  1.1071 +	event.VisibilityChanged()->iFlags=aFlags;
  1.1072 +	iQueueClient->AddExpectedEvent(event);
  1.1073 +	}
  1.1074 +
  1.1075 +void CTEventTest::AddExpectedVisibilityChange(TUint aFlags, CTBlankWindow* aWindow)
  1.1076 +    {
  1.1077 +    TWsQTEvent event;
  1.1078 +    event.iType=EEventWindowVisibilityChanged;
  1.1079 +    event.iHandle=(TInt)aWindow;
  1.1080 +    event.VisibilityChanged()->iFlags=aFlags;
  1.1081 +    iQueueClient->AddExpectedEvent(event);
  1.1082 +    }
  1.1083 +
  1.1084 +void CTEventTest::SimulatePointerWin(TRawEvent::TType aType, TInt aX, TInt aY)
  1.1085 +	{
  1.1086 +	SimulatePointer(aType,EWinPositionX+aX,EWinPositionY+aY+iYOffset);
  1.1087 +	}
  1.1088 +
  1.1089 +void CTEventTest::SimulatePointerDownUpWin(TInt aX, TInt aY)
  1.1090 +	{
  1.1091 +	iTest->SimulatePointerDownUp(EWinPositionX+aX,EWinPositionY+aY+iYOffset);
  1.1092 +	}
  1.1093 +
  1.1094 +void CTEventTest::SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY)
  1.1095 +    {
  1.1096 +    iTest->SimulatePointer(aType,aX,aY+iYOffset);
  1.1097 +    }
  1.1098 +
  1.1099 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
  1.1100 +void CTEventTest::SimulateButton1DownWithSimulatedMove(TInt aX, TInt aY)
  1.1101 +	{
  1.1102 +	if(iIs3DPointer)
  1.1103 +		{
  1.1104 +		// With advanced pointer events we can have an XYInputType of Pointer coupled with 3DPointer
  1.1105 +		// which now makes MovesAvailable return ETrue rahter than EFalse, which in turn stops the simulated
  1.1106 +		// Emove from being generated.
  1.1107 +		// So...
  1.1108 +		// If MovesAvailable() returns ETrue, then this move will be used, and the WServ simulated move wont be generated
  1.1109 +		// If MovesAvailable() returns EFalse, then this move will be filtered out, and the WServ simulated move will be generated		
  1.1110 +		SimulatePointer(TRawEvent::EPointerMove,aX,aY);
  1.1111 +		}
  1.1112 +	// then the original button down event
  1.1113 +	SimulatePointer(TRawEvent::EButton1Down,aX,aY);	
  1.1114 +	}
  1.1115 +#endif
  1.1116 +
  1.1117 +void CTEventTest::NextSetOfEventsL()
  1.1118 +	{
  1.1119 +	iQueueClient->ResetCount(iEventSet);
  1.1120 +	switch (iTest->iState)
  1.1121 +		{
  1.1122 +	case 1:
  1.1123 +		QueuePurge_NextSetOfEventsL();
  1.1124 +		break;
  1.1125 +	case 2:
  1.1126 +		SendEventTest_NextSetOfEvents();
  1.1127 +		break;
  1.1128 +	case 4:
  1.1129 +		InvisibleWindow_NextSetOfEvents();
  1.1130 +		break;
  1.1131 +	case 5:
  1.1132 +		JavaAdditions_NextSetOfEvents();
  1.1133 +		break;
  1.1134 +	case 6:
  1.1135 +		WinCap_NextSetOfEvents();
  1.1136 +		break;
  1.1137 +	case 7:
  1.1138 +		XyInputType_NextSetOfEvents();
  1.1139 +		break;
  1.1140 +	case 8:
  1.1141 +		MovingPointerCursor_NextSetOfEventsL();
  1.1142 +		break;
  1.1143 +	case 9:
  1.1144 +		RotatedMode_NextSetOfEventsL();
  1.1145 +		break;
  1.1146 +	case 10:
  1.1147 +		AnimEvent_NextSetOfEventsL();
  1.1148 +		break;
  1.1149 +	case 11:
  1.1150 +		FocusChanged_NextSetOfEventsL();
  1.1151 +		break;
  1.1152 +	case 12:
  1.1153 +		StopEvents_NextSetOfEventsL();
  1.1154 +		break;
  1.1155 +	case 13:
  1.1156 +		VirtualKeyboard_NextSetOfEventsL();
  1.1157 +		break;
  1.1158 +	case 14:
  1.1159 +		KeyClicks_NextSetOfEvents();
  1.1160 +		break;
  1.1161 +	case 15:
  1.1162 +		CaptureLong_NextSetOfEventsL();
  1.1163 +		break;
  1.1164 +	case 16:
  1.1165 +		Password_NextSetOfEvents();
  1.1166 +		break;
  1.1167 +	case 17:
  1.1168 +		GroupListChanged_NextSetOfEventsL();
  1.1169 +		break;
  1.1170 +	case 18:
  1.1171 +		RepeatableKeysL();
  1.1172 +		break;
  1.1173 +	case 19:
  1.1174 +		ScreenScaling_NextSetOfEventsL();
  1.1175 +		break;
  1.1176 +	case 20:
  1.1177 +		VisibilityChanged_NextSetOfEventsL();
  1.1178 +		break;
  1.1179 +	case 21:
  1.1180 +		CheckTimeStamp_NextSetOfEventsL();
  1.1181 +		break;
  1.1182 +	case 22:
  1.1183 +		PointerCapture_NextSetOfEventsL();
  1.1184 +		break;
  1.1185 +	case 23:
  1.1186 +		EventHandlerRemoval_NextSetOfEventsL();
  1.1187 +		break;	
  1.1188 +	// Note that case 24 (which is KTest24) does not use NextSetOfEventsL()	
  1.1189 +	case 25:
  1.1190 +		MismatchedCapture_NextSetOfEventsL();
  1.1191 +		break;
  1.1192 +	case 26:
  1.1193 +		PointerBufferPurge_NextSetOfEventsL();		
  1.1194 +		break;	
  1.1195 +	case 27:
  1.1196 +	    RawEventRepeatTest_NextSetOfEventsL();
  1.1197 +	    break;
  1.1198 +
  1.1199 +#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 	    
  1.1200 +    case 28:
  1.1201 +        KeyEventTranslation_NextSetOfEventsL();
  1.1202 +        break;
  1.1203 +    case 29:
  1.1204 +        KeyEventBlocking_NextSetOfEventsL();
  1.1205 +        break;
  1.1206 +    case 30:
  1.1207 +        KeyEventAppRestriction_NextSetOfEventsL();
  1.1208 +        break;
  1.1209 +    case 31:
  1.1210 +        KeyEventAppPriority_NextSetOfEventsL();
  1.1211 +        break;
  1.1212 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	    
  1.1213 +    case 32:
  1.1214 +        SurfaceVisibilityChanged1_NextSetOfEventsL();
  1.1215 +        break;
  1.1216 +    case 33:
  1.1217 +        SurfaceVisibilityChanged2_NextSetOfEventsL();
  1.1218 +        break;
  1.1219 +    case 34:
  1.1220 +        SurfaceVisibilityChanged3_NextSetOfEventsL();
  1.1221 +        break;
  1.1222 +#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  1.1223 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1.1224 +        
  1.1225 +	default:
  1.1226 +		AutoPanic(EAutoPanicWrongTest);
  1.1227 +		}
  1.1228 +	}
  1.1229 +
  1.1230 +void CTEventTest::TriggerOomMessage(TTimeIntervalMinutes aPeriod)
  1.1231 +	{
  1.1232 +	TTime time;
  1.1233 +	if (aPeriod.Int()!=0) // adjust time to affect Oom message triggering
  1.1234 +		{
  1.1235 +		time.HomeTime();
  1.1236 +		User::SetHomeTime(time+aPeriod);
  1.1237 +		}
  1.1238 +	RBlankWindow win(TheClient->iWs);
  1.1239 +	win.Construct(*(TheClient->iGroup->WinTreeNode()),1);
  1.1240 +	win.SetColor(TRgb::Gray4(1));
  1.1241 +	win.SetExtent(TPoint(10,10),TheClient->iGroup->Size()-TSize(20,20));
  1.1242 +	TheClient->iWs.HeapSetFail(RHeap::EDeterministic,1);
  1.1243 +	win.Activate();
  1.1244 +	TheClient->iWs.Flush();
  1.1245 +	TheClient->iWs.HeapSetFail(RHeap::ENone,0);
  1.1246 +	if (aPeriod.Int()!=0)
  1.1247 +		{
  1.1248 +		time.HomeTime();
  1.1249 +		User::SetHomeTime(time-aPeriod);
  1.1250 +		}
  1.1251 +	win.Close();
  1.1252 +	}
  1.1253 +
  1.1254 +TBool CTEventTest::SetClickType(TClickOutputModes aType)
  1.1255 +	{
  1.1256 +	TPckgBuf<TInt> intPkg;
  1.1257 +	intPkg()=aType;
  1.1258 +	TInt err=iClick.CommandReply(EClickCommandSetOutput,intPkg);
  1.1259 +	if (err!=KErrNone)
  1.1260 +		Failed();
  1.1261 +	return err;
  1.1262 +	}
  1.1263 +
  1.1264 +void CTEventTest::CreateEventTestGroup()
  1.1265 +	{
  1.1266 +	iEventTestGroup=RWindowGroup(TheClient->iWs);
  1.1267 +	iEventTestGroup.Construct(123, EFalse);
  1.1268 +	iEventTestGroup.SetName(_L("Fred"));
  1.1269 +	}
  1.1270 +
  1.1271 +void CTQueueClient::CreateEventTestGroupOnSecondScreenL()
  1.1272 +	{
  1.1273 +	const TInt KSndScreenNo=1;
  1.1274 +	iSndScreen=new(ELeave) CWsScreenDevice(iWs);
  1.1275 +	User::LeaveIfError(iSndScreen->Construct(KSndScreenNo));
  1.1276 +	iWinGp1 = new(ELeave) RWindowGroup(iWs);
  1.1277 +	User::LeaveIfError(iWinGp1->Construct((TUint32)iWinGp1,ETrue,iSndScreen));
  1.1278 +	iWinGp2 = new (ELeave) RWindowGroup(iWs);
  1.1279 +	User::LeaveIfError(iWinGp2->Construct((TUint32)iWinGp2,ETrue,iSndScreen));
  1.1280 +	}
  1.1281 +
  1.1282 +void CTQueueClient::CloseEventTestGroupOnSecondScreen()
  1.1283 +	{
  1.1284 +	if(iWinGp1)
  1.1285 +		{
  1.1286 +		iWinGp1->Close();
  1.1287 +		delete iWinGp1;
  1.1288 +		iWinGp1=NULL;
  1.1289 +		}
  1.1290 +	if(iWinGp2)
  1.1291 +		{
  1.1292 +		iWinGp2->Close();
  1.1293 +		delete iWinGp2;
  1.1294 +		iWinGp2=NULL;
  1.1295 +		}
  1.1296 +	if(iSndScreen)
  1.1297 +		{
  1.1298 +		delete iSndScreen;
  1.1299 +		iSndScreen = NULL;
  1.1300 +		}
  1.1301 +	}
  1.1302 +
  1.1303 +void CTEventTest::CloseEventTestGroup()
  1.1304 +	{
  1.1305 +	iEventTestGroup.Close();
  1.1306 +	}
  1.1307 +
  1.1308 +void CTEventTest::CreateAndCloseEventTestGroup()
  1.1309 +//
  1.1310 +// Create and close a window group to test sending of group changed messages
  1.1311 +//
  1.1312 +	{
  1.1313 +	CreateEventTestGroup();
  1.1314 +	CloseEventTestGroup();
  1.1315 +	}
  1.1316 +
  1.1317 +void CTEventTest::QueuePurge_NextSetOfEventsL()
  1.1318 +	{
  1.1319 +#if defined(LOGGING)
  1.1320 +	TLogMessageText logMessageText;
  1.1321 +	_LIT(KSet,"QueuePurge SetOfEvents: %d of 11");
  1.1322 +	logMessageText.Format(KSet,iEventSet);
  1.1323 +	TheClient->LogMessage(logMessageText);
  1.1324 +#endif
  1.1325 +	iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
  1.1326 +	iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
  1.1327 +	switch(iEventSet++)
  1.1328 +		{
  1.1329 +		case 0:
  1.1330 +			iTest->SimulateKey(TRawEvent::EKeyDown,32);
  1.1331 +			iTest->SimulateKey(TRawEvent::EKeyUp,32);
  1.1332 +			CreateAndCloseEventTestGroup();
  1.1333 +			SimulatePointer(TRawEvent::EButton1Down,10,20);
  1.1334 +			SimulatePointer(TRawEvent::EButton1Up,20,30);
  1.1335 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1336 +			CreateAndCloseEventTestGroup();
  1.1337 +		//
  1.1338 +			AddExpectedEvent(EEventFocusGained);
  1.1339 +			AddExpectedKey(EEventKeyDown,32);
  1.1340 +			AddExpectedKey(EEventKeyUp,32);
  1.1341 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.1342 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,20-EWinPositionY));
  1.1343 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,30-EWinPositionY));
  1.1344 +			AddExpectedEvent(EEventSwitchOn);
  1.1345 +			break;
  1.1346 +		case 1:
  1.1347 +			{
  1.1348 +			for(TInt count=0;count<100;count++)
  1.1349 +				{
  1.1350 +				iTest->SimulateKey(TRawEvent::EKeyDown,'A'+(count%26));
  1.1351 +				iTest->SimulateKey(TRawEvent::EKeyUp,'A'+(count%26));
  1.1352 +				}
  1.1353 +			for(TInt count2=0;count2<EMaxEventQueueSize/3;count2++)
  1.1354 +				{
  1.1355 +				AddExpectedKey(EEventKeyDown,'A'+(count2%26));
  1.1356 +				AddExpectedKey(EEventKey,'A'+(count2%26),'a'+(count2%26));
  1.1357 +				AddExpectedKey(EEventKeyUp,'A'+(count2%26));
  1.1358 +				}
  1.1359 +			AddExpectedKey(EEventKeyDown,'A'+(99%26));
  1.1360 +			AddExpectedKey(EEventKeyUp,'A'+(99%26));
  1.1361 +			}
  1.1362 +			break;
  1.1363 +		case 2:
  1.1364 +			{
  1.1365 +			User::LeaveIfError(iQueueClient->iGroup->GroupWin()->EnableModifierChangedEvents(0xFFFFFFFF, EEventControlOnlyWhenVisible));
  1.1366 +			for(TInt count=0;count<20;count++)
  1.1367 +				{
  1.1368 +				iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1369 +				iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1370 +				iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift);
  1.1371 +				iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift);
  1.1372 +				iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift);
  1.1373 +				iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1374 +				iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
  1.1375 +				}
  1.1376 +			for(TInt count2=0;count2<60;count2++)
  1.1377 +				iTest->SimulateKey(TRawEvent::EKeyDown,'A');
  1.1378 +			AddExpectedEvent(EEventSwitchOn);
  1.1379 +			AddExpectedModifiersChanged(EModifierLeftShift|EModifierRightShift|EModifierShift,0);
  1.1380 +			for(TInt count3=0;count3<EMaxEventQueueSize-2;count3++)
  1.1381 +				AddExpectedKey(EEventKeyDown,'A');
  1.1382 +			iQueueClient->iGroup->GroupWin()->DisableModifierChangedEvents();
  1.1383 +			}
  1.1384 +			break;
  1.1385 +		case 3:
  1.1386 +			{
  1.1387 +			SimulatePointer(TRawEvent::EButton1Up,10,20);
  1.1388 +			SimulatePointer(TRawEvent::EButton2Up,11,22);
  1.1389 +			SimulatePointer(TRawEvent::EButton1Down,12,23);
  1.1390 +			SimulatePointer(TRawEvent::EPointerMove,13,24);
  1.1391 +			SimulatePointer(TRawEvent::EButton3Down,15,25);
  1.1392 +			SimulatePointer(TRawEvent::EButton1Up,14,24);
  1.1393 +			for(TInt count2=0;count2<60;count2++)
  1.1394 +				iTest->SimulateKey(TRawEvent::EKeyDown,'A');
  1.1395 +			SimulatePointer(TRawEvent::EButton3Up,15,25); // Should get stripped by unmatched purged down handling code
  1.1396 +			iTest->SimulateKey(TRawEvent::EKeyUp,'A');	// To stop repeats
  1.1397 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY));
  1.1398 +			AddExpectedPointer(TPointerEvent::EButton2Up, TPoint(11-EWinPositionX,22-EWinPositionY));
  1.1399 +			for(TInt count3=0;count3<EMaxEventQueueSize-2;count3++)
  1.1400 +				AddExpectedKey(EEventKeyDown,'A');
  1.1401 +			}
  1.1402 +			break;
  1.1403 +		case 4:
  1.1404 +			{
  1.1405 +			SimulatePointer(TRawEvent::EButton1Up,10,20);
  1.1406 +			SimulatePointer(TRawEvent::EButton2Up,11,22);
  1.1407 +			iTest->SimulateKey(TRawEvent::EKeyDown,'B');
  1.1408 +			SimulatePointer(TRawEvent::EButton1Down,12,23);
  1.1409 +			SimulatePointer(TRawEvent::EPointerMove,13,24);
  1.1410 +			iTest->SimulateKey(TRawEvent::EKeyUp,'B');
  1.1411 +			SimulatePointer(TRawEvent::EButton3Down,15,25);
  1.1412 +			SimulatePointer(TRawEvent::EButton1Up,14,24);
  1.1413 +			iQueueClient->iWs.PurgePointerEvents();
  1.1414 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1415 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY));
  1.1416 +			AddExpectedPointer(TPointerEvent::EButton2Up, TPoint(11-EWinPositionX,22-EWinPositionY));
  1.1417 +			AddExpectedKey(EEventKeyDown,'B');
  1.1418 +			AddExpectedKey(EEventKey,'B','b');
  1.1419 +			AddExpectedKey(EEventKeyUp,'B');
  1.1420 +//			AddExpectedPointer(TPointerEvent::EButton3Down, TPoint(15-EWinPositionX,25-EWinPositionY));
  1.1421 +			AddExpectedEvent(EEventSwitchOn);	// To check pointer events purged okay
  1.1422 +			}
  1.1423 +			break;
  1.1424 +		case 5:
  1.1425 +			CreateEventTestGroup();
  1.1426 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.1427 +			break;
  1.1428 +		case 6:
  1.1429 +			CloseEventTestGroup();
  1.1430 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.1431 +			break;
  1.1432 +		case 7:
  1.1433 +			iQueueClient->iGroup->GroupWin()->DisableGroupChangeEvents();
  1.1434 +			CreateAndCloseEventTestGroup();
  1.1435 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1436 +			AddExpectedEvent(EEventSwitchOn);
  1.1437 +			break;
  1.1438 +		case 8:
  1.1439 +			SimulatePointer(TRawEvent::EButton1Down,12,23);
  1.1440 +			iQueueClient->iWs.PurgePointerEvents();
  1.1441 +			SimulatePointer(TRawEvent::EButton1Up,13,24);
  1.1442 +			SimulatePointer(TRawEvent::EButton2Down,12,23);
  1.1443 +			iQueueClient->iWs.PurgePointerEvents();
  1.1444 +			SimulatePointer(TRawEvent::EButton2Up,13,24);
  1.1445 +			SimulatePointer(TRawEvent::EButton3Down,12,23);
  1.1446 +			iQueueClient->iWs.PurgePointerEvents();
  1.1447 +			SimulatePointer(TRawEvent::EButton3Up,13,24);
  1.1448 +//
  1.1449 +			SendEvent(EEventUser);
  1.1450 +			AddExpectedEvent(EEventUser);
  1.1451 +			break;
  1.1452 +		case 9:
  1.1453 +			{
  1.1454 +			for(TInt count5=0;count5<500;count5++)
  1.1455 +				{
  1.1456 +				RWindowGroup group(TheClient->iWs);
  1.1457 +				group.Construct(ENullWsHandle);
  1.1458 +				group.EnableReceiptOfFocus(EFalse);
  1.1459 +				group.Close();
  1.1460 +				SimulatePointer(TRawEvent::EButton1Up,10,20);
  1.1461 +				}
  1.1462 +			for(TInt count4=0;count4<EMaxEventQueueSize;count4++)
  1.1463 +				AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY));
  1.1464 +			}
  1.1465 +			break;
  1.1466 +		case 10:
  1.1467 +			{
  1.1468 +			RWindowGroup *group=iQueueClient->iGroup->GroupWin();
  1.1469 +			User::LeaveIfError(group->EnableOnEvents(EEventControlOnlyWithKeyboardFocus));
  1.1470 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1471 +			SimulatePointer(TRawEvent::EButton3Down,EWinPositionX,EWinPositionY);
  1.1472 +			AddExpectedEvent(EEventSwitchOn);
  1.1473 +			AddExpectedPointer(TPointerEvent::EButton3Down, TPoint(0,0));
  1.1474 +//
  1.1475 +			group->SetOrdinalPosition(-1);
  1.1476 +			TheClient->iWs.Finish();
  1.1477 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);	// Shouldn't get it as in background this time
  1.1478 +			AddExpectedEvent(EEventFocusLost);
  1.1479 +			group->SetOrdinalPosition(0);
  1.1480 +			TheClient->iWs.Finish();
  1.1481 +			AddExpectedEvent(EEventFocusGained);
  1.1482 +//
  1.1483 +			User::LeaveIfError(group->EnableOnEvents(EEventControlOnlyWhenVisible));
  1.1484 +			User::LeaveIfError(group->EnableModifierChangedEvents(EModifierShift, EEventControlOnlyWhenVisible));
  1.1485 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);	// Should get this as window still visible
  1.1486 +			AddExpectedEvent(EEventSwitchOn);
  1.1487 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift);	// Should get modifier changed event as window still visible
  1.1488 +			AddExpectedModifiersChanged(EModifierShift,EModifierShift);
  1.1489 +			AddExpectedKey(EEventKeyDown,EStdKeyLeftShift);
  1.1490 +			SimulatePointer(TRawEvent::EButton1Down,EWinPositionX,EWinPositionY);
  1.1491 +			SimulatePointer(TRawEvent::EButton1Up,EWinPositionX,EWinPositionY);
  1.1492 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(0,0));
  1.1493 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(0,0));
  1.1494 +			iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight));
  1.1495 +			TheClient->iWs.Finish();
  1.1496 +// The following two events shouldn't cause an on or mod changed event as the window is now hidden
  1.1497 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.1498 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
  1.1499 +			AddExpectedKey(EEventKeyUp,EStdKeyLeftShift);
  1.1500 +//
  1.1501 +			iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY));
  1.1502 +			TheClient->iWs.Finish();
  1.1503 +			}
  1.1504 +			break;
  1.1505 +		case 11:
  1.1506 +			{
  1.1507 +			RWindowGroup *group=iQueueClient->iGroup->GroupWin();
  1.1508 +			SendEvent(EEventUser);
  1.1509 +			AddExpectedEvent(EEventUser);
  1.1510 +
  1.1511 +			if(iTest->IsFullRomL())
  1.1512 +				break;
  1.1513 +//
  1.1514 +// Test focus only messages when with and without focus
  1.1515 +//
  1.1516 +			User::LeaveIfError(group->EnableErrorMessages(EEventControlOnlyWithKeyboardFocus));
  1.1517 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1518 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1519 +			SendEvent(EEventUser);
  1.1520 +			AddExpectedEvent(EEventUser);
  1.1521 +			group->SetOrdinalPosition(1);
  1.1522 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1523 +			AddExpectedEvent(EEventFocusLost);
  1.1524 +			group->SetOrdinalPosition(0);
  1.1525 +			AddExpectedEvent(EEventFocusGained);
  1.1526 +			SendEvent(EEventUser+1);
  1.1527 +			AddExpectedEvent(EEventUser+1);
  1.1528 +//
  1.1529 +// Test focus only messages when with visible and invisible
  1.1530 +//
  1.1531 +			User::LeaveIfError(group->EnableErrorMessages(EEventControlOnlyWhenVisible));
  1.1532 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1533 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1534 +			iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight));
  1.1535 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1536 +			SendEvent(EEventUser+2);
  1.1537 +			AddExpectedEvent(EEventUser+2);
  1.1538 +			iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY));
  1.1539 +//
  1.1540 +// Check always mode sends an event
  1.1541 +//
  1.1542 +			User::LeaveIfError(group->EnableErrorMessages(EEventControlAlways));
  1.1543 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1544 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1545 +//
  1.1546 +			iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight));
  1.1547 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1548 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1549 +			iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY));
  1.1550 +//
  1.1551 +			group->SetOrdinalPosition(1);
  1.1552 +			AddExpectedEvent(EEventFocusLost);
  1.1553 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1554 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1555 +			group->SetOrdinalPosition(0);
  1.1556 +			AddExpectedEvent(EEventFocusGained);
  1.1557 +//
  1.1558 +// Check timing of OOM messages
  1.1559 +//
  1.1560 +			TriggerOomMessage(TTimeIntervalMinutes(3));
  1.1561 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1562 +			TriggerOomMessage(TTimeIntervalMinutes(0));
  1.1563 +			User::After(TTimeIntervalMicroSeconds32(1100000));	// 1.1 second
  1.1564 +			TriggerOomMessage(TTimeIntervalMinutes(0));
  1.1565 +			SendEvent(EEventUser+3);
  1.1566 +			AddExpectedEvent(EEventUser+3);
  1.1567 +			TriggerOomMessage(TTimeIntervalMinutes(3));	// Forward by a 2 minutes plus the 1.1 from previous test should trigger an OOM event
  1.1568 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1569 +			SendEvent(EEventUser+4);
  1.1570 +			AddExpectedEvent(EEventUser+4);
  1.1571 +			TriggerOomMessage(TTimeIntervalMinutes(-1)); // Clock going backwards should trigger an event
  1.1572 +			AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
  1.1573 +			User::After(TTimeIntervalMicroSeconds32(800000));	// 8/10ths of a second
  1.1574 +			TriggerOomMessage(TTimeIntervalMinutes(0));	// Shouldn't trigger an event
  1.1575 +			SendEvent(EEventUser+5);
  1.1576 +			AddExpectedEvent(EEventUser+5);
  1.1577 +			}
  1.1578 +			break;
  1.1579 +		default:
  1.1580 +			TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,ETrue);
  1.1581 +			TRAPD(err, EventQueueExpansionTestL());
  1.1582 +			if (err!=KErrNone)
  1.1583 +				{
  1.1584 +				iFailed=ETrue;
  1.1585 +				}
  1.1586 +			TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,EFalse);
  1.1587 +			CActiveScheduler::Stop();
  1.1588 +			break;
  1.1589 +		}
  1.1590 +	TheClient->iWs.SetAutoFlush(iTheClientFlush);
  1.1591 +	iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
  1.1592 +	}
  1.1593 +
  1.1594 +// Used for testing PDEF112243.
  1.1595 +// Create RWsSession/RWindowGroup/RBlankWindow in a loop. In case of odd loop, 
  1.1596 +// close the session which causes the previous window to gain focus. Also go 
  1.1597 +// on adding events to the previous session. Along with some change in product
  1.1598 +// code and this test code we get some space/memory before globaleventqueue, 
  1.1599 +// which is the problem faced by licensee for this defect.
  1.1600 +void CTEventTest::EventQueueExpansionTestL()
  1.1601 +	{
  1.1602 +	const TInt numClients = 5;
  1.1603 +	TInt cliHanGrpWin = 777;
  1.1604 +	TInt cliHanBlkWin = 888;
  1.1605 +	TInt pushed=0;
  1.1606 +	RWsSession wsSession[numClients];
  1.1607 +	RWindowGroup groupWin[numClients];
  1.1608 +	RBlankWindow blankWin[numClients];
  1.1609 +	
  1.1610 +	for (TInt i = 0; i < numClients; i++)
  1.1611 +		{
  1.1612 +		User::LeaveIfError(wsSession[i].Connect());
  1.1613 +		CleanupClosePushL(wsSession[i]);
  1.1614 +		
  1.1615 +		groupWin[i] = RWindowGroup(wsSession[i]);
  1.1616 +		User::LeaveIfError(groupWin[i].Construct(cliHanGrpWin++));
  1.1617 +		CleanupClosePushL(groupWin[i]);
  1.1618 +		groupWin[i].DefaultOwningWindow();
  1.1619 +		
  1.1620 +		blankWin[i] = RBlankWindow(wsSession[i]);
  1.1621 +		User::LeaveIfError(blankWin[i].Construct(groupWin[i], cliHanBlkWin++));
  1.1622 +		if (i%2 == 0)
  1.1623 +			{
  1.1624 +			CleanupClosePushL(blankWin[i]);
  1.1625 +			pushed++;
  1.1626 +			}
  1.1627 +		blankWin[i].Activate();
  1.1628 +		
  1.1629 +		if (i%2 == 1)
  1.1630 +			{
  1.1631 +			CleanupStack::Pop(2, &wsSession[i]);
  1.1632 +			wsSession[i].Close();
  1.1633 +			
  1.1634 +			TRawEvent rawEvent;
  1.1635 +			for (TInt count=0; count < 40; count++)
  1.1636 +				{
  1.1637 +				rawEvent.Set(TRawEvent::EKeyDown,'A'+(i%26));
  1.1638 +				wsSession[i-1].SimulateRawEvent(rawEvent);
  1.1639 +
  1.1640 +				rawEvent.Set(TRawEvent::EKeyUp,'A'+(i%26));
  1.1641 +				wsSession[i-1].SimulateRawEvent(rawEvent);
  1.1642 +				}
  1.1643 +			}
  1.1644 +		}
  1.1645 +	CleanupStack::PopAndDestroy(pushed*3, &wsSession[0]);
  1.1646 +	}
  1.1647 +
  1.1648 +void CTEventTest::doSendEvent(TWsEvent &aEvent)
  1.1649 +	{
  1.1650 +	iQueueClient->iWs.SendEventToWindowGroup(iQueueClient->WindowGroupIdentifier(),aEvent);
  1.1651 +	}
  1.1652 +
  1.1653 +void CTEventTest::SendKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt iRepeats/*=0*/)
  1.1654 +	{
  1.1655 +	TWsEvent event;
  1.1656 +	if (aEventCode==EEventKey && aCode==0)
  1.1657 +		aCode=aScanCode;
  1.1658 +	event.SetType(aEventCode);
  1.1659 +	event.Key()->iCode=aCode;
  1.1660 +	event.Key()->iScanCode=aScanCode;
  1.1661 +	event.Key()->iModifiers=0;
  1.1662 +	event.Key()->iRepeats=iRepeats;
  1.1663 +	doSendEvent(event);
  1.1664 +	}
  1.1665 +
  1.1666 +void CTEventTest::SendEvent(TInt aEventCode)
  1.1667 +	{
  1.1668 +	TWsQTEvent event;
  1.1669 +	event.SetType(aEventCode);
  1.1670 +	doSendEvent(event);
  1.1671 +	}
  1.1672 +
  1.1673 +void CTEventTest::SimulateAndCheck(TPoint aOrigin,TSize aScale,TInt aXOffset,TInt aYOffset,TPointerEvent::TType aEventType,TRect aPointerCursorArea)
  1.1674 +	{
  1.1675 +	TPoint ptCheck=PhysicalToLogical(TPoint(aOrigin.iX+aXOffset,aOrigin.iY+aYOffset)-aOrigin,aScale);
  1.1676 +	if (ptCheck.iX < aPointerCursorArea.iTl.iX)
  1.1677 +		{
  1.1678 +		ptCheck.iX=aPointerCursorArea.iTl.iX;
  1.1679 +		}
  1.1680 +	else if (ptCheck.iX > aPointerCursorArea.iBr.iX)
  1.1681 +		{
  1.1682 +		ptCheck.iX=aPointerCursorArea.iBr.iX;
  1.1683 +		}
  1.1684 +	if (ptCheck.iY < aPointerCursorArea.iTl.iY)
  1.1685 +		{
  1.1686 +		ptCheck.iY=aPointerCursorArea.iTl.iY;
  1.1687 +		}
  1.1688 +	else if (ptCheck.iY > aPointerCursorArea.iBr.iY)
  1.1689 +		{
  1.1690 +		ptCheck.iY=aPointerCursorArea.iBr.iY;
  1.1691 +		}
  1.1692 +	AddExpectedPointer(aEventType,TPoint(ptCheck.iX-EWinPositionX,ptCheck.iY-EWinPositionY));
  1.1693 +	}
  1.1694 +
  1.1695 +void CTEventTest::CheckPointerCursorInDifferentScreenMode(TSizeMode aMode,TPoint aOrigin)
  1.1696 +	{
  1.1697 +	aMode.iOrigin=aOrigin;
  1.1698 +	iQueueClient->iScreen->SetCurrentScreenModeAttributes(aMode);
  1.1699 +	iQueueClient->iScreen->SetAppScreenMode(iCurrentMode);		//This makes the App pick up the new mode parameters
  1.1700 +	TheClient->iScreen->SetAppScreenMode(iCurrentMode);			//Ditto
  1.1701 +	iQueueClient->iScreen->SetScreenMode(iCurrentMode);			//This causes all the windows to be updated
  1.1702 +
  1.1703 +	//.. Tests the general pointer cursor area setting and getting
  1.1704 +	RWsSession& ws=iQueueClient->iWs;
  1.1705 +	TRect rect=ws.PointerCursorArea(iCurrentMode); //ws.PointerCursorArea() by default gets first screen mode's pointer cursor area so use other overloaded function
  1.1706 +	TPoint origin=iQueueClient->iScreen->GetScreenModeOrigin(iCurrentMode);
  1.1707 +	TSize scale=iQueueClient->iScreen->GetScreenModeScale(iCurrentMode);
  1.1708 +	TSize fullScreenModeSize=iQueueClient->iScreen->SizeInPixels();
  1.1709 +	TRect rect1(PhysicalToLogical(TPoint(),scale),PhysicalToLogical(fullScreenModeSize.AsPoint()-origin,scale));
  1.1710 +	TRect rect2=rect1;
  1.1711 +	rect2.Shrink(20,20);
  1.1712 +	ws.SetPointerCursorArea(iCurrentMode,rect1);
  1.1713 +	TEST(ws.PointerCursorArea(iCurrentMode)==rect1);
  1.1714 +	ws.SetPointerCursorArea(iCurrentMode,rect2);
  1.1715 +	TEST(ws.PointerCursorArea(iCurrentMode)==rect2);
  1.1716 +	ws.SetPointerCursorArea(iCurrentMode,rect);
  1.1717 +	TEST(ws.PointerCursorArea(iCurrentMode)==rect);
  1.1718 +
  1.1719 +	//.. Test events are restricted to correct pointer cursor area
  1.1720 +	TRect rectPointerCursorArea(10,10,51,51);
  1.1721 +	iQueueClient->iWs.SetPointerCursorArea(iCurrentMode,rectPointerCursorArea);
  1.1722 +	TPoint screenModeOrigin=iQueueClient->iScreen->GetDefaultScreenModeOrigin();
  1.1723 +
  1.1724 +	SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+5,screenModeOrigin.iY+5);
  1.1725 +	SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+25,screenModeOrigin.iY+25);
  1.1726 +	SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+50,screenModeOrigin.iY+50);
  1.1727 +	SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+75,screenModeOrigin.iY+75);
  1.1728 +
  1.1729 +	SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+10,screenModeOrigin.iY+15);
  1.1730 +	SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+20,screenModeOrigin.iY+5);
  1.1731 +	SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+35,screenModeOrigin.iY+40);
  1.1732 +	SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+45,screenModeOrigin.iY+70);
  1.1733 +
  1.1734 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,5,5,TPointerEvent::EButton1Down,rectPointerCursorArea);
  1.1735 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,25,25,TPointerEvent::EButton1Up,rectPointerCursorArea);
  1.1736 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,50,50,TPointerEvent::EButton1Down,rectPointerCursorArea);
  1.1737 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,75,75,TPointerEvent::EButton1Up,rectPointerCursorArea);
  1.1738 +
  1.1739 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,10,15,TPointerEvent::EButton1Down,rectPointerCursorArea);
  1.1740 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,20,5,TPointerEvent::EButton1Up,rectPointerCursorArea);
  1.1741 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,35,40,TPointerEvent::EButton1Down,rectPointerCursorArea);
  1.1742 +	SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,45,70,TPointerEvent::EButton1Up,rectPointerCursorArea);
  1.1743 +	}
  1.1744 +
  1.1745 +void CTEventTest::SendEventTest_NextSetOfEvents()
  1.1746 +	{
  1.1747 +	TTimeIntervalMicroSeconds32 initialTime,time;
  1.1748 +	TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
  1.1749 +	switch(iEventSet++)
  1.1750 +		{
  1.1751 +		case 0:
  1.1752 +			SendKey(EEventKeyDown,1);
  1.1753 +			SendKey(EEventKeyDown,2);
  1.1754 +			SendEvent(EEventUser);
  1.1755 +			SendKey(EEventKeyUp,1);
  1.1756 +			SendKey(EEventKeyUp,2);
  1.1757 +			SendEvent(EEventUser+1);
  1.1758 +			SendEvent(EEventUser+2);
  1.1759 +//
  1.1760 +			AddExpectedEvent(EEventFocusGained);
  1.1761 +			AddExpectedKey(EEventKeyDown,1);
  1.1762 +			AddExpectedKey(EEventKeyDown,2);
  1.1763 +			AddExpectedEvent(EEventUser);
  1.1764 +			AddExpectedKey(EEventKeyUp,1);
  1.1765 +			AddExpectedKey(EEventKeyUp,2);
  1.1766 +			AddExpectedEvent(EEventUser+1);
  1.1767 +			AddExpectedEvent(EEventUser+2);
  1.1768 +			break;
  1.1769 +		case 1:
  1.1770 +	#if defined(SCREEN_MODE_TESTING)
  1.1771 +			if (iNumScrModes>1)
  1.1772 +				{
  1.1773 +				iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents();
  1.1774 +
  1.1775 +				if (SetClickType(EClickCheck))
  1.1776 +					return;
  1.1777 +				iAddToClick=ETrue;
  1.1778 +
  1.1779 +				iQueueClient->iScreen->SetScreenMode(1);
  1.1780 +
  1.1781 +				iAddToClick=EFalse;
  1.1782 +				SetClickType(EClickNone);
  1.1783 +
  1.1784 +				AddExpectedEvent(EEventScreenDeviceChanged);
  1.1785 +				SendEvent(EEventUser);
  1.1786 +				AddExpectedEvent(EEventUser);
  1.1787 +				iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents();
  1.1788 +				if (iQueueClient->iScreen->ScreenModeEnforcement()==ESizeEnforcementPixelsAndRotation)
  1.1789 +					AddExpectedEvent(EEventFocusLost);
  1.1790 +				}
  1.1791 +	#endif
  1.1792 +			SendEvent(EEventUser+1);
  1.1793 +			AddExpectedEvent(EEventUser+1);
  1.1794 +			break;
  1.1795 +		case 2:
  1.1796 +	#if defined(SCREEN_MODE_TESTING)
  1.1797 +			if (iNumScrModes>1)
  1.1798 +				{
  1.1799 +				iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents();
  1.1800 +
  1.1801 +				if (SetClickType(EClickCheck))
  1.1802 +					return;
  1.1803 +				iAddToClick=ETrue;
  1.1804 +
  1.1805 +				iQueueClient->iScreen->SetScreenMode(0);
  1.1806 +				iQueueClient->iScreen->SetScreenMode(1);
  1.1807 +				iQueueClient->iScreen->SetScreenMode(0);
  1.1808 +
  1.1809 +				iAddToClick=EFalse;
  1.1810 +				SetClickType(EClickNone);
  1.1811 +
  1.1812 +				AddExpectedEvent(EEventScreenDeviceChanged);	// Only one event should get queued
  1.1813 +				if (iQueueClient->iScreen->ScreenModeEnforcement()==ESizeEnforcementPixelsAndRotation)
  1.1814 +					AddExpectedEvent(EEventFocusGained);
  1.1815 +				SendEvent(EEventUser+2);
  1.1816 +				AddExpectedEvent(EEventUser+2);
  1.1817 +				iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents();
  1.1818 +				}
  1.1819 +	#endif
  1.1820 +			SendEvent(EEventUser+3);
  1.1821 +			AddExpectedEvent(EEventUser+3);
  1.1822 +			break;
  1.1823 +		case 3:
  1.1824 +	#if defined(SCREEN_MODE_TESTING)
  1.1825 +			if (iNumScrModes>1)
  1.1826 +				{
  1.1827 +				iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents();
  1.1828 +				iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents();
  1.1829 +
  1.1830 +				if (SetClickType(EClickCheck))
  1.1831 +					return;
  1.1832 +				iAddToClick=ETrue;
  1.1833 +
  1.1834 +				iQueueClient->iScreen->SetScreenMode(0);
  1.1835 +
  1.1836 +				iAddToClick=EFalse;
  1.1837 +				SetClickType(EClickNone);
  1.1838 +
  1.1839 +				SendEvent(EEventUser+1);
  1.1840 +				AddExpectedEvent(EEventUser+1);
  1.1841 +				}
  1.1842 +	#endif
  1.1843 +			SendEvent(EEventUser+4);
  1.1844 +			AddExpectedEvent(EEventUser+4);
  1.1845 +			break;
  1.1846 +		case 4:
  1.1847 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.1848 +			TheClient->iWs.Flush();
  1.1849 +			User::After(initialTime.Int()+time.Int()/3);
  1.1850 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.1851 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.1852 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.1853 +			AddExpectedKey(EEventKey,EStdKeySpace,' ',1);
  1.1854 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.1855 +			break;
  1.1856 +		case 5:			//To test sending a key event with iRepeats!=0
  1.1857 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.1858 +			TheClient->iWs.Flush();
  1.1859 +			User::After(initialTime.Int()+time.Int()/3);
  1.1860 +			SendKey(EEventKey,EStdKeyHome,EKeyHome,0);
  1.1861 +			User::After(initialTime.Int()+time.Int()/3);
  1.1862 +			SendKey(EEventKey,EStdKeyEnd,EKeyEnd,12345);
  1.1863 +			User::After(initialTime.Int()+time.Int()/3);
  1.1864 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.1865 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.1866 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.1867 +			AddExpectedKey(EEventKey,EStdKeySpace,' ',1);
  1.1868 +			AddExpectedKey(EEventKey,EStdKeyHome,EKeyHome);
  1.1869 +			AddExpectedKey(EEventKey,EStdKeySpace,' ',1);
  1.1870 +			AddExpectedKey(EEventKey,EStdKeyEnd,EKeyEnd,1);
  1.1871 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.1872 +			break;
  1.1873 +		default:
  1.1874 +			CActiveScheduler::Stop();
  1.1875 +			break;
  1.1876 +		}
  1.1877 +	TheClient->iWs.Flush();
  1.1878 +	}
  1.1879 +
  1.1880 +void CTEventTest::InvisibleWindow_NextSetOfEvents()
  1.1881 +	{
  1.1882 +	switch(iEventSet++)
  1.1883 +		{
  1.1884 +		case 0:
  1.1885 +			SimulatePointer(TRawEvent::EButton1Down,45,30);
  1.1886 +			SimulatePointer(TRawEvent::EButton1Up,45,30);
  1.1887 +			SimulatePointer(TRawEvent::EButton1Down,20,10);
  1.1888 +			SimulatePointer(TRawEvent::EButton1Up,20,10);
  1.1889 +			TheClient->iWs.Flush();
  1.1890 +			iQueueClient->iChildWin->BaseWin()->SetVisible(EFalse);
  1.1891 +			iQueueClient->iChildWin->BaseWin()->SetVisible(ETrue);
  1.1892 +			iQueueClient->iWs.Flush();
  1.1893 +			SimulatePointer(TRawEvent::EButton1Down,46,31);
  1.1894 +			SimulatePointer(TRawEvent::EButton1Up,46,31);
  1.1895 +			AddExpectedEvent(EEventFocusGained);
  1.1896 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,10-EWinPositionY));
  1.1897 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,10-EWinPositionY));
  1.1898 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.1899 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.1900 +			break;
  1.1901 +		case 1:
  1.1902 +			SimulatePointer(TRawEvent::EButton1Down,21,11);
  1.1903 +			SimulatePointer(TRawEvent::EButton1Up,21,11);
  1.1904 +			SimulatePointer(TRawEvent::EButton1Down,44,30);
  1.1905 +			SimulatePointer(TRawEvent::EButton1Up,44,30);
  1.1906 +			TheClient->iWs.Flush();
  1.1907 +			iQueueClient->iWin->BaseWin()->SetVisible(EFalse);
  1.1908 +			iQueueClient->iWin->BaseWin()->SetVisible(ETrue);
  1.1909 +			iQueueClient->iWs.Flush();
  1.1910 +			SimulatePointer(TRawEvent::EButton1Down,19,12);
  1.1911 +			SimulatePointer(TRawEvent::EButton1Up,19,12);
  1.1912 +			SimulatePointer(TRawEvent::EButton1Down,47,32);
  1.1913 +			SimulatePointer(TRawEvent::EButton1Up,47,32);
  1.1914 +			/*AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(44-EWinPositionX,30-EWinPositionY));
  1.1915 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(44-EWinPositionX,30-EWinPositionY));*/
  1.1916 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(19-EWinPositionX,12-EWinPositionY));
  1.1917 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(19-EWinPositionX,12-EWinPositionY));
  1.1918 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(47-EWinPositionX,32-EWinPositionY));
  1.1919 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY));
  1.1920 +			break;
  1.1921 +		default:
  1.1922 +			CActiveScheduler::Stop();
  1.1923 +			break;
  1.1924 +		}
  1.1925 +	TheClient->iWs.Flush();
  1.1926 +	}
  1.1927 +
  1.1928 +#define TOP16A 0xAAAA0000
  1.1929 +#define TOP16B 0x55550000
  1.1930 +void CTEventTest::JavaAdditions_NextSetOfEvents()
  1.1931 +	{
  1.1932 +	switch(iEventSet++)
  1.1933 +		{
  1.1934 +		case 0:
  1.1935 +			SimulatePointer(TRawEvent::EButton1Down,45,30);
  1.1936 +			SimulatePointer(TRawEvent::EButton1Up,45,30);
  1.1937 +			TheClient->iWs.Flush();
  1.1938 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove);
  1.1939 +			iQueueClient->iWs.Flush();
  1.1940 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
  1.1941 +			SimulateButton1DownWithSimulatedMove(46,31);
  1.1942 +#else
  1.1943 +			SimulatePointer(TRawEvent::EButton1Down,46,31);
  1.1944 +#endif			
  1.1945 +			SimulatePointer(TRawEvent::EButton1Up,46,31);
  1.1946 +			TheClient->iWs.Flush();
  1.1947 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,0);
  1.1948 +			iQueueClient->iWs.Flush();			
  1.1949 +			SimulatePointer(TRawEvent::EButton1Down,20,10);
  1.1950 +			SimulatePointer(TRawEvent::EButton1Up,20,10);
  1.1951 +			TheClient->iWs.Flush();
  1.1952 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove);
  1.1953 +			iQueueClient->iWs.Flush();
  1.1954 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
  1.1955 +			SimulateButton1DownWithSimulatedMove(21,11);
  1.1956 +#else	
  1.1957 +			SimulatePointer(TRawEvent::EButton1Down,21,11);			
  1.1958 +#endif
  1.1959 +			SimulatePointer(TRawEvent::EButton1Up,21,11);
  1.1960 +			TheClient->iWs.Flush();
  1.1961 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerMoveEvents);
  1.1962 +			iQueueClient->iWs.Flush();				
  1.1963 +			SimulatePointer(TRawEvent::EButton1Down,22,12);
  1.1964 +			SimulatePointer(TRawEvent::EButton1Up,22,12);
  1.1965 +			TheClient->iWs.Flush();
  1.1966 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove);
  1.1967 +			iQueueClient->iWs.Flush();
  1.1968 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
  1.1969 +			SimulateButton1DownWithSimulatedMove(23,13);
  1.1970 +#else			
  1.1971 +			SimulatePointer(TRawEvent::EButton1Down,23,13);
  1.1972 +#endif
  1.1973 +			SimulatePointer(TRawEvent::EButton1Up,23,13);
  1.1974 +			TheClient->iWs.Flush();
  1.1975 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerFilterMove);
  1.1976 +			iQueueClient->iWs.Flush();		
  1.1977 +			SimulatePointer(TRawEvent::EButton1Down,24,14);
  1.1978 +			SimulatePointer(TRawEvent::EButton1Up,24,14);
  1.1979 +			AddExpectedEvent(EEventFocusGained);
  1.1980 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(45-EWinPositionX,30-EWinPositionY));
  1.1981 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(45-EWinPositionX,30-EWinPositionY));
  1.1982 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.1983 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.1984 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.1985 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,10-EWinPositionY));
  1.1986 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,10-EWinPositionY));
  1.1987 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(21-EWinPositionX,11-EWinPositionY));
  1.1988 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(21-EWinPositionX,11-EWinPositionY));
  1.1989 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(21-EWinPositionX,11-EWinPositionY));
  1.1990 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(22-EWinPositionX,12-EWinPositionY));
  1.1991 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(22-EWinPositionX,12-EWinPositionY));
  1.1992 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(23-EWinPositionX,13-EWinPositionY));
  1.1993 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(23-EWinPositionX,13-EWinPositionY));
  1.1994 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(23-EWinPositionX,13-EWinPositionY));
  1.1995 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,14-EWinPositionY));
  1.1996 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,14-EWinPositionY));
  1.1997 +			break;
  1.1998 +		#if defined(__WINS__)
  1.1999 +		case 1:
  1.2000 +			{
  1.2001 +			RWindowGroup *group=iQueueClient->iGroup->GroupWin();
  1.2002 +			group->SetOrdinalPosition(0);
  1.2003 +			iTest->SimulateKey(TRawEvent::EKeyDown,'2'|TOP16A);
  1.2004 +			iTest->SimulateKey(TRawEvent::EKeyUp,'2');
  1.2005 +			TheClient->iWs.Flush();
  1.2006 +			iQueueClient->iWs.SetRemoveKeyCode(EFalse);
  1.2007 +			iQueueClient->iWs.Flush();
  1.2008 +			iTest->SimulateKey(TRawEvent::EKeyDown,'3'|TOP16B);
  1.2009 +			iTest->SimulateKey(TRawEvent::EKeyUp,'3');
  1.2010 +			TheClient->iWs.Flush();
  1.2011 +			iQueueClient->iWs.SetRemoveKeyCode(ETrue);
  1.2012 +			iQueueClient->iWs.Flush();
  1.2013 +			iTest->SimulateKey(TRawEvent::EKeyDown,'4'|TOP16B);
  1.2014 +			iTest->SimulateKey(TRawEvent::EKeyUp,'4');
  1.2015 +			AddExpectedKey(EEventKeyDown,'2');
  1.2016 +			AddExpectedKey(EEventKey,'2',TOP16A>>16);
  1.2017 +			AddExpectedKey(EEventKeyUp,'2');
  1.2018 +			AddExpectedKey(EEventKeyDown,'3'|TOP16B);
  1.2019 +			AddExpectedKey(EEventKey,'3',TOP16B>>16);
  1.2020 +			AddExpectedKey(EEventKeyUp,'3');
  1.2021 +			AddExpectedKey(EEventKeyDown,'4');
  1.2022 +			AddExpectedKey(EEventKey,'4',TOP16B>>16);
  1.2023 +			AddExpectedKey(EEventKeyUp,'4');
  1.2024 +			break;
  1.2025 +			}
  1.2026 +		#endif
  1.2027 +		default:
  1.2028 +			CActiveScheduler::Stop();
  1.2029 +			break;
  1.2030 +		}
  1.2031 +	TheClient->iWs.Flush();
  1.2032 +	}
  1.2033 +
  1.2034 +void CTEventTest::WinCap_NextSetOfEvents()
  1.2035 +	{
  1.2036 +	switch(iEventSet++)
  1.2037 +		{
  1.2038 +		case 0:
  1.2039 +			//iQueueClient->SetChildCapture(RWindowBase::TCaptureEnabled);
  1.2040 +			SimulatePointer(TRawEvent::EButton1Down,35,27);
  1.2041 +			SimulatePointer(TRawEvent::EButton1Up,25,12);
  1.2042 +
  1.2043 +
  1.2044 +			AddExpectedEvent(EEventFocusGained);
  1.2045 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(35-EWinPositionX,27-EWinPositionY));
  1.2046 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,12-EWinPositionY));
  1.2047 +			break;
  1.2048 +
  1.2049 +
  1.2050 +		default:
  1.2051 +			CActiveScheduler::Stop();
  1.2052 +			break;
  1.2053 +		}
  1.2054 +	TheClient->iWs.Flush();
  1.2055 +	}
  1.2056 +
  1.2057 +void CTEventTest::XyInputType_NextSetOfEvents()
  1.2058 +	{
  1.2059 +	switch(iEventSet++)
  1.2060 +		{
  1.2061 +		case 0:
  1.2062 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents|EPointerFilterDrag,EPointerGenerateSimulatedMove);
  1.2063 +			iQueueClient->iWs.Flush();
  1.2064 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
  1.2065 +			SimulateButton1DownWithSimulatedMove(46,31);
  1.2066 +#else			
  1.2067 +			SimulatePointer(TRawEvent::EButton1Down,46,31);
  1.2068 +#endif
  1.2069 +			SimulatePointer(TRawEvent::EButton1Up,46,31);
  1.2070 +			AddExpectedEvent(EEventFocusGained);
  1.2071 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.2072 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.2073 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.2074 +			break;		//Must do something
  1.2075 +		case 1:
  1.2076 +			{
  1.2077 +			// check if RWindowGroup::SimulatePointerEvent is working (DEF131563)
  1.2078 +			RWindowGroup& group = *iQueueClient->iGroup->GroupWin();
  1.2079 +			TRawEvent event;
  1.2080 +			event.Set(TRawEvent::EButton1Down, 10, 10);
  1.2081 +			group.SimulatePointerEvent(event);
  1.2082 +			event.Set(TRawEvent::EButton1Up, 10, 10);
  1.2083 +			group.SimulatePointerEvent(event);
  1.2084 +			if(!iIs3DPointer)
  1.2085 +				{
  1.2086 +				// simulated move will be generated
  1.2087 +				AddExpectedPointer(TPointerEvent::EMove, TPoint(10 - EWinPositionX, 10 - EWinPositionY));
  1.2088 +				}
  1.2089 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10 - EWinPositionX, 10 - EWinPositionY));
  1.2090 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10 - EWinPositionX, 10 - EWinPositionY));
  1.2091 +			}
  1.2092 +			break;
  1.2093 +		#if defined(__WINS__)
  1.2094 +		case 2:
  1.2095 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
  1.2096 +			SimulateButton1DownWithSimulatedMove(45,32);
  1.2097 +#else		
  1.2098 +			SimulatePointer(TRawEvent::EButton1Down,45,32);
  1.2099 +#endif
  1.2100 +			SimulatePointer(TRawEvent::EButton1Up,45,32);
  1.2101 +			TheClient->iWs.SimulateXyInputType(EXYInputNone);
  1.2102 +			SimulatePointer(TRawEvent::EButton1Down,44,32);
  1.2103 +			SimulatePointer(TRawEvent::EPointerMove,43,32);
  1.2104 +			SimulatePointer(TRawEvent::EButton1Up,43,31);
  1.2105 +			SimulatePointer(TRawEvent::EButton2Down,44,33);
  1.2106 +			SimulatePointer(TRawEvent::EButton2Up,44,33);
  1.2107 +			SimulatePointer(TRawEvent::EButton3Down,43,32);
  1.2108 +			SimulatePointer(TRawEvent::EButton3Up,43,32);
  1.2109 +			SimulatePointer(TRawEvent::EPointerSwitchOn,48,32);
  1.2110 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2111 +#if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
  1.2112 +			SimulateButton1DownWithSimulatedMove(47,32);
  1.2113 +#else				
  1.2114 +			SimulatePointer(TRawEvent::EButton1Down,47,32);
  1.2115 +#endif
  1.2116 +			SimulatePointer(TRawEvent::EButton1Up,47,32);
  1.2117 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(45-EWinPositionX,32-EWinPositionY));
  1.2118 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(45-EWinPositionX,32-EWinPositionY));
  1.2119 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(45-EWinPositionX,32-EWinPositionY));
  1.2120 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(47-EWinPositionX,32-EWinPositionY));
  1.2121 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(47-EWinPositionX,32-EWinPositionY));
  1.2122 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY));
  1.2123 +			break;
  1.2124 +		case 3:
  1.2125 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerGenerateSimulatedMove,0);
  1.2126 +			iQueueClient->iWs.Flush();
  1.2127 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2128 +			SimulatePointer(TRawEvent::EButton1Down,49,32);
  1.2129 +			SimulatePointer(TRawEvent::EPointerMove,50,30);
  1.2130 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.2131 +			SimulatePointer(TRawEvent::EButton1Down,51,32);
  1.2132 +			SimulatePointer(TRawEvent::EPointerMove,52,30);
  1.2133 +			SimulatePointer(TRawEvent::EButton1Up,52,30);
  1.2134 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2135 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(49-EWinPositionX,32-EWinPositionY));
  1.2136 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(50-EWinPositionX,30-EWinPositionY));
  1.2137 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,30-EWinPositionY));
  1.2138 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(51-EWinPositionX,32-EWinPositionY));
  1.2139 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(52-EWinPositionX,30-EWinPositionY));
  1.2140 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(52-EWinPositionX,30-EWinPositionY));
  1.2141 +			break;
  1.2142 +		case 4:
  1.2143 +			SimulatePointer(TRawEvent::EButton1Down,49,31);
  1.2144 +			SimulatePointer(TRawEvent::EButton1Up,49,31);
  1.2145 +			TheClient->iWs.SimulateXyInputType(EXYInputMouse);
  1.2146 +			SimulatePointer(TRawEvent::EPointerMove,50,31);
  1.2147 +			SimulatePointer(TRawEvent::EButton1Down,50,31);
  1.2148 +			SimulatePointer(TRawEvent::EPointerMove,50,30);
  1.2149 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.2150 +			SimulatePointer(TRawEvent::EPointerMove,51,31);
  1.2151 +			SimulatePointer(TRawEvent::EButton1Down,51,31);
  1.2152 +			SimulatePointer(TRawEvent::EPointerMove,51,30);
  1.2153 +			SimulatePointer(TRawEvent::EButton1Up,51,30);
  1.2154 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2155 +			SimulatePointer(TRawEvent::EButton1Down,52,31);
  1.2156 +			SimulatePointer(TRawEvent::EButton1Up,52,31);
  1.2157 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(49-EWinPositionX,31-EWinPositionY));
  1.2158 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(49-EWinPositionX,31-EWinPositionY));
  1.2159 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(50-EWinPositionX,31-EWinPositionY));
  1.2160 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,31-EWinPositionY));
  1.2161 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(50-EWinPositionX,30-EWinPositionY));
  1.2162 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,30-EWinPositionY));
  1.2163 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(51-EWinPositionX,31-EWinPositionY));
  1.2164 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(51-EWinPositionX,31-EWinPositionY));
  1.2165 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(51-EWinPositionX,30-EWinPositionY));
  1.2166 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(51-EWinPositionX,30-EWinPositionY));
  1.2167 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(52-EWinPositionX,31-EWinPositionY));
  1.2168 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(52-EWinPositionX,31-EWinPositionY));
  1.2169 +			break;
  1.2170 +		case 5:
  1.2171 +			SimulatePointer(TRawEvent::EButton1Down,69,31);
  1.2172 +			SimulatePointer(TRawEvent::EButton1Up,69,31);
  1.2173 +			TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse);
  1.2174 +			SimulatePointer(TRawEvent::EPointerMove,-5,-5);
  1.2175 +			SimulatePointer(TRawEvent::EButton1Down,7,8);
  1.2176 +			SimulatePointer(TRawEvent::EPointerMove,10,-3);
  1.2177 +			SimulatePointer(TRawEvent::EButton1Up,-7,-8);
  1.2178 +			SimulatePointer(TRawEvent::EPointerMove,-4,9);
  1.2179 +			SimulatePointer(TRawEvent::EButton1Down,123,456);
  1.2180 +			SimulatePointer(TRawEvent::EPointerMove,15,13);
  1.2181 +			SimulatePointer(TRawEvent::EButton1Up,-2345,-6789);
  1.2182 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2183 +			SimulatePointer(TRawEvent::EButton1Down,62,31);
  1.2184 +			SimulatePointer(TRawEvent::EButton1Up,62,31);
  1.2185 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(69-EWinPositionX,31-EWinPositionY));
  1.2186 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(69-EWinPositionX,31-EWinPositionY));
  1.2187 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(64-EWinPositionX,26-EWinPositionY));
  1.2188 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(64-EWinPositionX,26-EWinPositionY));
  1.2189 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(74-EWinPositionX,23-EWinPositionY));
  1.2190 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(74-EWinPositionX,23-EWinPositionY));
  1.2191 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(70-EWinPositionX,32-EWinPositionY));
  1.2192 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(70-EWinPositionX,32-EWinPositionY));
  1.2193 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(85-EWinPositionX,45-EWinPositionY));
  1.2194 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(85-EWinPositionX,45-EWinPositionY));
  1.2195 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(62-EWinPositionX,31-EWinPositionY));
  1.2196 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(62-EWinPositionX,31-EWinPositionY));
  1.2197 +			break;
  1.2198 +		#endif
  1.2199 +		default:
  1.2200 +			CActiveScheduler::Stop();
  1.2201 +			break;
  1.2202 +		}
  1.2203 +	TheClient->iWs.Flush();
  1.2204 +	}
  1.2205 +
  1.2206 +void CTEventTest::MovingPointerCursor_NextSetOfEventsL()
  1.2207 +	{
  1.2208 +	switch(iEventSet++)
  1.2209 +		{
  1.2210 +		case 0:
  1.2211 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
  1.2212 +			iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
  1.2213 +			iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
  1.2214 +			iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse);
  1.2215 +			iQueueClient->iWs.Flush();
  1.2216 +			//AddExpectedEvent(EEventFocusGained);
  1.2217 +			break;
  1.2218 +		#if defined(__WINS__)
  1.2219 +		case 1:
  1.2220 +			TheClient->iWs.SimulateXyInputType(EXYInputMouse);
  1.2221 +			iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
  1.2222 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
  1.2223 +			iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
  1.2224 +			iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse);
  1.2225 +			iQueueClient->iWs.Flush();
  1.2226 +			SimulatePointer(TRawEvent::EPointerMove,46,31);
  1.2227 +			SimulatePointer(TRawEvent::EButton1Down,46,31);
  1.2228 +			SimulatePointer(TRawEvent::EPointerMove,47,32);
  1.2229 +			SimulatePointer(TRawEvent::EButton1Up,47,32);
  1.2230 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.2231 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY));
  1.2232 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(47-EWinPositionX,32-EWinPositionY));
  1.2233 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY));
  1.2234 +			break;
  1.2235 +		case 2:
  1.2236 +			TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse);
  1.2237 +			TheClient->iWs.SetPointerCursorPosition(TPoint(62,24));
  1.2238 +			SimulatePointer(TRawEvent::EPointerMove,-5,-5);
  1.2239 +			TheClient->iWs.SetPointerCursorPosition(TPoint(60,20));
  1.2240 +			SimulatePointer(TRawEvent::EPointerMove,6,7);
  1.2241 +			SimulatePointer(TRawEvent::EButton1Down,27,38);
  1.2242 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2243 +			TheClient->iWs.SetPointerCursorPosition(TPoint(55,25));
  1.2244 +			SimulatePointer(TRawEvent::EPointerMove,4,-13);
  1.2245 +			TheClient->iWs.SetPointerCursorPosition(TPoint(58,20));
  1.2246 +			SimulatePointer(TRawEvent::EButton1Up,45,-678);
  1.2247 +			TheClient->iWs.Flush();
  1.2248 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,0);
  1.2249 +			iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,0);
  1.2250 +			iQueueClient->iWs.Flush();
  1.2251 +			TheClient->iWs.SetPointerCursorPosition(TPoint(80,45));
  1.2252 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2253 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(57-EWinPositionX,19-EWinPositionY));
  1.2254 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(66-EWinPositionX,27-EWinPositionY));
  1.2255 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(66-EWinPositionX,27-EWinPositionY));
  1.2256 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(66-EWinPositionX,27-EWinPositionY));
  1.2257 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(59-EWinPositionX,12-EWinPositionY));
  1.2258 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(58-EWinPositionX,20-EWinPositionY));
  1.2259 +			AddExpectedEnterExit(EEventPointerEnter, TPoint(58-EWinPositionX,20-EWinPositionY));
  1.2260 +			AddExpectedEnterExit(EEventPointerExit, TPoint(58-EWinPositionX,20-EWinPositionY));
  1.2261 +			AddExpectedEnterExit(EEventPointerEnter, TPoint(80-EWinPositionX,45-EWinPositionY));
  1.2262 +			break;
  1.2263 +		case 3:
  1.2264 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,EPointerFilterEnterExit);
  1.2265 +			iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,EPointerFilterEnterExit);
  1.2266 +			iQueueClient->iWs.Flush();
  1.2267 +			TheClient->iWs.SetPointerCursorArea(TRect(0,0,70,240));
  1.2268 +			TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse);
  1.2269 +			TheClient->iWs.SetPointerCursorPosition(TPoint(65,30));
  1.2270 +			SimulatePointer(TRawEvent::EPointerMove,20,0);
  1.2271 +			TheClient->iWs.SetPointerCursorPosition(TPoint(75,32));
  1.2272 +			SimulatePointer(TRawEvent::EPointerMove,-1,20);
  1.2273 +			SimulatePointer(TRawEvent::EButton1Down,29,37);
  1.2274 +			SimulatePointer(TRawEvent::EPointerMove,25,-13);
  1.2275 +			SimulatePointer(TRawEvent::EButton1Up,47,-648);
  1.2276 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2277 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(69-EWinPositionX,30-EWinPositionY));
  1.2278 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(68-EWinPositionX,52-EWinPositionY));
  1.2279 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(68-EWinPositionX,52-EWinPositionY));
  1.2280 +			AddExpectedPointer(TPointerEvent::EDrag, TPoint(69-EWinPositionX,39-EWinPositionY));
  1.2281 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(69-EWinPositionX,39-EWinPositionY));
  1.2282 +			break;
  1.2283 +		case 4:
  1.2284 +			TheClient->iWs.SetPointerCursorArea(TRect(EWinPositionX+2,EWinPositionY+2,EWinPositionX+99,EWinPositionY+49));
  1.2285 +			TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse);
  1.2286 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2287 +			SimulatePointer(TRawEvent::EPointerMove,0,-34);
  1.2288 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2289 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2290 +			SimulatePointer(TRawEvent::EPointerMove,-77,-35);
  1.2291 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2292 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2293 +			SimulatePointer(TRawEvent::EPointerMove,-78,0);
  1.2294 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2295 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2296 +			SimulatePointer(TRawEvent::EPointerMove,-79,36);
  1.2297 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2298 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2299 +			SimulatePointer(TRawEvent::EPointerMove,0,37);
  1.2300 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2301 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2302 +			SimulatePointer(TRawEvent::EPointerMove,80,38);
  1.2303 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2304 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2305 +			SimulatePointer(TRawEvent::EPointerMove,81,0);
  1.2306 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,30));
  1.2307 +			SimulatePointer(TRawEvent::EPointerMove,0,0);
  1.2308 +			SimulatePointer(TRawEvent::EPointerMove,82,-39);
  1.2309 +			TheClient->iWs.SetPointerCursorPosition(TPoint(2,2));
  1.2310 +			SimulatePointer(TRawEvent::EPointerMove,30,30);
  1.2311 +			TheClient->iWs.SetPointerCursorPosition(TPoint(1,30));
  1.2312 +			SimulatePointer(TRawEvent::EPointerMove,1,0);
  1.2313 +			TheClient->iWs.SetPointerCursorPosition(TPoint(2,88));
  1.2314 +			SimulatePointer(TRawEvent::EPointerMove,30,-30);
  1.2315 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,88));
  1.2316 +			SimulatePointer(TRawEvent::EPointerMove,0,-1);
  1.2317 +			TheClient->iWs.SetPointerCursorPosition(TPoint(123,88));
  1.2318 +			SimulatePointer(TRawEvent::EPointerMove,-30,-30);
  1.2319 +			TheClient->iWs.SetPointerCursorPosition(TPoint(123,30));
  1.2320 +			SimulatePointer(TRawEvent::EPointerMove,-1,0);
  1.2321 +			TheClient->iWs.SetPointerCursorPosition(TPoint(123,2));
  1.2322 +			SimulatePointer(TRawEvent::EPointerMove,-30,30);
  1.2323 +			TheClient->iWs.SetPointerCursorPosition(TPoint(56,1));
  1.2324 +			SimulatePointer(TRawEvent::EPointerMove,0,1);
  1.2325 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2326 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,2));
  1.2327 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY));
  1.2328 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(2,2));
  1.2329 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY));
  1.2330 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(2,30-EWinPositionY));
  1.2331 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY));
  1.2332 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(2,48));
  1.2333 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY));
  1.2334 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,48));
  1.2335 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY));
  1.2336 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(98,48));
  1.2337 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY));
  1.2338 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(98,30-EWinPositionY));
  1.2339 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY));
  1.2340 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(98,2));
  1.2341 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(32,32));
  1.2342 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(3,30-EWinPositionY));
  1.2343 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(32,18));
  1.2344 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,47));
  1.2345 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(68,18));
  1.2346 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(97,30-EWinPositionY));
  1.2347 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(68,32));
  1.2348 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,3));
  1.2349 +			break;
  1.2350 +		case 5:
  1.2351 +			TheClient->iWs.SetPointerCursorArea(TRect(0,0,EWinPositionX+100,EWinPositionY+50));
  1.2352 +			TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse);
  1.2353 +			TheClient->iWs.SetPointerCursorPosition(TPoint(57,31));
  1.2354 +			TheClient->iWs.SetPointerCursorArea(TRect(0,35,EWinPositionX+100,EWinPositionY+50));
  1.2355 +			SimulatePointer(TRawEvent::EPointerMove,1,0);
  1.2356 +			TheClient->iWs.SetPointerCursorPosition(TPoint(10,55));
  1.2357 +			TheClient->iWs.SetPointerCursorArea(TRect(15,0,EWinPositionX+100,50));
  1.2358 +			SimulatePointer(TRawEvent::EPointerMove,1,1);
  1.2359 +			TheClient->iWs.SetPointerCursorPosition(TPoint(57,31));
  1.2360 +			TheClient->iWs.SetPointerCursorArea(TRect(0,0,50,EWinPositionY+50));
  1.2361 +			SimulatePointer(TRawEvent::EPointerMove,0,1);
  1.2362 +			TheClient->iWs.SetPointerCursorPosition(TPoint(10,10));
  1.2363 +			TheClient->iWs.SetPointerCursorArea(TRect(15,15,EWinPositionX+100,EWinPositionY+50));
  1.2364 +			SimulatePointer(TRawEvent::EPointerMove,1,-1);
  1.2365 +			TheClient->iWs.SetPointerCursorPosition(TPoint(57,31));
  1.2366 +			TheClient->iWs.SetPointerCursorArea(TRect(0,0,EWinPositionX+100,30));
  1.2367 +			SimulatePointer(TRawEvent::EPointerMove,-1,0);
  1.2368 +			TheClient->iWs.SetPointerCursorPosition(TPoint(100,10));
  1.2369 +			TheClient->iWs.SetPointerCursorArea(TRect(0,15,95,EWinPositionY+50));
  1.2370 +			SimulatePointer(TRawEvent::EPointerMove,-1,-1);
  1.2371 +			TheClient->iWs.SetPointerCursorPosition(TPoint(57,31));
  1.2372 +			TheClient->iWs.SetPointerCursorArea(TRect(60,0,EWinPositionX+100,EWinPositionY+50));
  1.2373 +			SimulatePointer(TRawEvent::EPointerMove,0,-1);
  1.2374 +			TheClient->iWs.SetPointerCursorPosition(TPoint(100,55));
  1.2375 +			TheClient->iWs.SetPointerCursorArea(TRect(0,0,95,50));
  1.2376 +			SimulatePointer(TRawEvent::EPointerMove,1,-1);
  1.2377 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2378 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(58-EWinPositionX,35-EWinPositionY));
  1.2379 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(16-EWinPositionX,49-EWinPositionY));
  1.2380 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(49-EWinPositionX,32-EWinPositionY));
  1.2381 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(16-EWinPositionX,15-EWinPositionY));
  1.2382 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,29-EWinPositionY));
  1.2383 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(93-EWinPositionX,15-EWinPositionY));
  1.2384 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(60-EWinPositionX,30-EWinPositionY));
  1.2385 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(94-EWinPositionX,48-EWinPositionY));
  1.2386 +			break;
  1.2387 +		#endif
  1.2388 +		default:
  1.2389 +			TheClient->iWs.SetPointerCursorArea(TRect(0,0,95,50));
  1.2390 +			CActiveScheduler::Stop();
  1.2391 +			break;
  1.2392 +		}
  1.2393 +	TheClient->iWs.Flush();
  1.2394 +	}
  1.2395 +
  1.2396 +void CTEventTest::RotatedMode_NextSetOfEventsL()
  1.2397 +	{
  1.2398 +#if defined(LOGGING)
  1.2399 +	TLogMessageText logMessageText;
  1.2400 +	_LIT(KSet,"RotatedMode SetOfEvents: %d  Max=4");
  1.2401 +	logMessageText.Format(KSet,iEventSet);
  1.2402 +	INFO_PRINTF1(logMessageText);
  1.2403 +#endif
  1.2404 +	switch(iEventSet++)
  1.2405 +		{
  1.2406 +		case 0:
  1.2407 +			{
  1.2408 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
  1.2409 +			iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
  1.2410 +			iQueueClient->iWs.Flush();
  1.2411 +			TheClient->iWs.SetPointerCursorArea(TRect(10,10,51,51));
  1.2412 +			SimulatePointer(TRawEvent::EButton1Down,5,5);
  1.2413 +			SimulatePointer(TRawEvent::EButton1Up,25,5);
  1.2414 +			SimulatePointer(TRawEvent::EButton1Down,55,5);
  1.2415 +			SimulatePointer(TRawEvent::EButton1Up,55,35);
  1.2416 +			SimulatePointer(TRawEvent::EButton1Down,55,55);
  1.2417 +			SimulatePointer(TRawEvent::EButton1Up,25,55);
  1.2418 +			SimulatePointer(TRawEvent::EButton1Down,5,55);
  1.2419 +			SimulatePointer(TRawEvent::EButton1Up,5,35);
  1.2420 +			AddExpectedEvent(EEventFocusGained);
  1.2421 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,10-EWinPositionY));
  1.2422 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(25-EWinPositionX,10-EWinPositionY));
  1.2423 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,10-EWinPositionY));
  1.2424 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,35-EWinPositionY));
  1.2425 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,50-EWinPositionY));
  1.2426 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(25-EWinPositionX,50-EWinPositionY));
  1.2427 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,50-EWinPositionY));
  1.2428 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,35-EWinPositionY));
  1.2429 +			}
  1.2430 +			break;
  1.2431 +		case 1:
  1.2432 +			{
  1.2433 +			TInt enforc=TheClient->iScreen->ScreenModeEnforcement();
  1.2434 +			iBlankWin->SetVisible(ETrue);
  1.2435 +		#if defined(LOGGING)
  1.2436 +			_LIT(KSet1,"AUTO  Rotating Events :1st ");
  1.2437 +			INFO_PRINTF1(KSet1);
  1.2438 +		#endif
  1.2439 +			INFO_PRINTF1(_L(" Set of Events"));
  1.2440 +			if (iScreenModeTests&EDoRot90)
  1.2441 +				{
  1.2442 +				TheClient->iScreen->SetScreenMode(1);
  1.2443 +				TheClient->iWs.Flush();
  1.2444 +				iTest->DelayIfFullRomL();
  1.2445 +				INFO_PRINTF1(_L(" Screen mode 1."));
  1.2446 +				TPoint screenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin();
  1.2447 +			#if defined(__WINS__)
  1.2448 +				iTest->SimulatePointer(TRawEvent::EButton1Down,20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.2449 +				iTest->SimulatePointer(TRawEvent::EButton1Up,20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.2450 +			#else
  1.2451 +				// simulate pointer at (20,20) on rotated screen by providing physical coordinates
  1.2452 +				iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.2453 +				iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.2454 +			#endif
  1.2455 +				INFO_PRINTF1(_L(" Sent Up and Down 90"));
  1.2456 +				}
  1.2457 +			if (iScreenModeTests&EDoRot180)
  1.2458 +				{
  1.2459 +				TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180);
  1.2460 +				TheClient->iScreen->SetScreenMode(0);
  1.2461 +				INFO_PRINTF1(_L(" Screen mode 0"));
  1.2462 +				TheClient->iWs.Flush();
  1.2463 +				iTest->DelayIfFullRomL();
  1.2464 +				INFO_PRINTF1(_L(" Upside Down"));
  1.2465 +			#if defined(__WINS__)
  1.2466 +				iTest->SimulatePointer(TRawEvent::EButton1Down,22,22);
  1.2467 +				iTest->SimulatePointer(TRawEvent::EButton1Up,22,22);
  1.2468 +			#else
  1.2469 +				// simulate pointer at (22,22) on rotated screen by providing physical coordinates
  1.2470 +				iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22);
  1.2471 +				iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22);
  1.2472 +			#endif
  1.2473 +				INFO_PRINTF1(_L(" Sent Up and Down 180"));
  1.2474 +				}
  1.2475 +			TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal);
  1.2476 +			TheClient->iScreen->SetScreenMode(0);
  1.2477 +			TheClient->iWs.Flush();
  1.2478 +			iTest->DelayIfFullRomL();
  1.2479 +			INFO_PRINTF1(_L(" Normal Screen mode"));
  1.2480 +			if (iScreenModeTests&EDoRot0)
  1.2481 +				{
  1.2482 +				SimulatePointer(TRawEvent::EButton1Down,24,24);
  1.2483 +				SimulatePointer(TRawEvent::EButton1Up,24,24);
  1.2484 +				}
  1.2485 +			if (iScreenModeTests&EDoRot90)
  1.2486 +				{
  1.2487 +				if (enforc>ESizeEnforcementNone)
  1.2488 +					{
  1.2489 +					AddExpectedEvent(EEventFocusLost);
  1.2490 +					AddExpectedEvent(EEventFocusGained);
  1.2491 +					}
  1.2492 +				else
  1.2493 +					{
  1.2494 +                    AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset));
  1.2495 +                    AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset));
  1.2496 +                    }
  1.2497 +				}
  1.2498 +			if (iScreenModeTests&EDoRot180)
  1.2499 +				{
  1.2500 +                AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset));
  1.2501 +                AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset));
  1.2502 +				}
  1.2503 +			if (iScreenModeTests&EDoRot0)
  1.2504 +				{
  1.2505 +				AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,24-EWinPositionY));
  1.2506 +				AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,24-EWinPositionY));
  1.2507 +				}
  1.2508 +			INFO_PRINTF1(_L(" Added Expected"));
  1.2509 +			User::After(EPointerCursorUpdateGap);
  1.2510 +			iBlankWin->SetVisible(EFalse);
  1.2511 +			}
  1.2512 +			break;
  1.2513 +	#if defined(__WINS__)
  1.2514 +		case 2:
  1.2515 +			{
  1.2516 +			TInt enforc=TheClient->iScreen->ScreenModeEnforcement();
  1.2517 +			//INFO_PRINTF1("AUTO  Rotating Events ");
  1.2518 +			//INFO_PRINTF1(" :2nd Set of Events");
  1.2519 +			TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse);
  1.2520 +			TheClient->iWs.SetPointerCursorPosition(TPoint(24+EWinPositionX,24+EWinPositionY));
  1.2521 +			if (iScreenModeTests&EDoRot90)
  1.2522 +				{
  1.2523 +				TheClient->iScreen->SetScreenMode(1);
  1.2524 +				TheClient->iWs.Flush();
  1.2525 +				iTest->DelayIfFullRomL();
  1.2526 +				SimulatePointer(TRawEvent::EPointerMove,1,2);
  1.2527 +				SimulatePointer(TRawEvent::EButton1Down,56,89);
  1.2528 +				SimulatePointer(TRawEvent::EPointerMove,2,-1);
  1.2529 +				SimulatePointer(TRawEvent::EButton1Up,234,456);
  1.2530 +				}
  1.2531 +			else
  1.2532 +				TheClient->iWs.SetPointerCursorPosition(TPoint(27+EWinPositionX,25+EWinPositionY));
  1.2533 +			if (iScreenModeTests&EDoRot180)
  1.2534 +				{
  1.2535 +				TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180);
  1.2536 +				TheClient->iScreen->SetScreenMode(0);
  1.2537 +				TheClient->iWs.Flush();
  1.2538 +				iTest->DelayIfFullRomL();
  1.2539 +				SimulatePointer(TRawEvent::EPointerMove,-3,4);
  1.2540 +				SimulatePointer(TRawEvent::EButton1Down,156,289);
  1.2541 +				SimulatePointer(TRawEvent::EPointerMove,-4,-3);
  1.2542 +				SimulatePointer(TRawEvent::EButton1Up,2234,3456);
  1.2543 +				}
  1.2544 +			else
  1.2545 +				TheClient->iWs.SetPointerCursorPosition(TPoint(20+EWinPositionX,26+EWinPositionY));
  1.2546 +			TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal);
  1.2547 +			TheClient->iScreen->SetScreenMode(0);
  1.2548 +			TheClient->iWs.Flush();
  1.2549 +			iTest->DelayIfFullRomL();
  1.2550 +			if (iScreenModeTests&EDoRot0)
  1.2551 +				{
  1.2552 +				SimulatePointer(TRawEvent::EButton1Down,24,24);
  1.2553 +				SimulatePointer(TRawEvent::EButton1Up,24,24);
  1.2554 +				}
  1.2555 +			TheClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2556 +			TheClient->iWs.Flush();
  1.2557 +			if (iScreenModeTests&EDoRot90)
  1.2558 +				{
  1.2559 +				if (enforc>ESizeEnforcementNone)
  1.2560 +					{
  1.2561 +					AddExpectedEvent(EEventFocusLost);
  1.2562 +					AddExpectedEvent(EEventFocusGained);
  1.2563 +					}
  1.2564 +				else
  1.2565 +					{
  1.2566 +					AddExpectedPointer(TPointerEvent::EMove, TPoint(25,26));
  1.2567 +					AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25,26));
  1.2568 +					AddExpectedPointer(TPointerEvent::EDrag, TPoint(27,25));
  1.2569 +					AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(27,25));
  1.2570 +					}
  1.2571 +				}
  1.2572 +			if (iScreenModeTests&EDoRot180)
  1.2573 +				{
  1.2574 +				AddExpectedPointer(TPointerEvent::EMove, TPoint(24,29));
  1.2575 +				AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24,29));
  1.2576 +				AddExpectedPointer(TPointerEvent::EDrag, TPoint(20,26));
  1.2577 +				AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20,26));
  1.2578 +				}
  1.2579 +			if (iScreenModeTests&EDoRot0)
  1.2580 +				{
  1.2581 +				AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20,26));
  1.2582 +				AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20,26));
  1.2583 +				}
  1.2584 +			}
  1.2585 +			break;
  1.2586 +		case 3:
  1.2587 +			{
  1.2588 +		#if defined(LOGGING)
  1.2589 +			_LIT(KSet2,"AUTO  Rotating Events ");
  1.2590 +			INFO_PRINTF1(KSet2);
  1.2591 +		#endif
  1.2592 +			INFO_PRINTF1(_L(" :3rd Set of Events"));
  1.2593 +			if (iScreenModeTests&EDoScale)
  1.2594 +				{
  1.2595 +				INFO_PRINTF1(_L(" :Screen Scalling Supported"));
  1.2596 +				iBlankWin->SetVisible(ETrue);
  1.2597 +				iCurrentMode=iNumScrModes;
  1.2598 +				--iCurrentMode;
  1.2599 +				iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
  1.2600 +				iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
  1.2601 +				iQueueClient->iScreen->SetScreenMode(iCurrentMode);
  1.2602 +				TheClient->iScreen->SetAppScreenMode(iCurrentMode);
  1.2603 +				iQueueClient->iScreen->SetAppScreenMode(iCurrentMode);
  1.2604 +				iSizeMode=iQueueClient->iScreen->GetCurrentScreenModeAttributes();
  1.2605 +				TSizeMode testMode=iSizeMode;
  1.2606 +				for (TInt xScale=2;xScale<4;xScale++)
  1.2607 +					{
  1.2608 +				INFO_PRINTF1(_L(" :New X-Scale Value"));
  1.2609 +					for (TInt yScale=2;yScale<4;yScale++)
  1.2610 +						{
  1.2611 +						INFO_PRINTF1(_L(" :New Y-Scale Value"));
  1.2612 +						testMode.iScreenScale.SetSize(xScale,yScale);
  1.2613 +						CheckPointerCursorInDifferentScreenMode(testMode,TPoint(20,30));
  1.2614 +						}
  1.2615 +					}
  1.2616 +				User::After(EPointerCursorUpdateGap);
  1.2617 +				iBlankWin->SetVisible(EFalse);
  1.2618 +				break;
  1.2619 +				}
  1.2620 +			}
  1.2621 +		case 4:
  1.2622 +			{
  1.2623 +			if (iScreenModeTests&EDoScale)
  1.2624 +				{
  1.2625 +				TSizeMode testMode=iSizeMode;
  1.2626 +				iBlankWin->SetVisible(ETrue);
  1.2627 +				for (TInt xScale=2;xScale<4;xScale++)
  1.2628 +					{
  1.2629 +					for (TInt yScale=2;yScale<4;yScale++)
  1.2630 +						{
  1.2631 +						testMode.iScreenScale.SetSize(xScale,yScale);
  1.2632 +						CheckPointerCursorInDifferentScreenMode(testMode,TPoint(30,20));
  1.2633 +						}
  1.2634 +					}
  1.2635 +				User::After(EPointerCursorUpdateGap);
  1.2636 +				iBlankWin->SetVisible(EFalse);
  1.2637 +				break;
  1.2638 +				}
  1.2639 +			}
  1.2640 +	#endif
  1.2641 +		default:
  1.2642 +		#if defined(__WINS__)
  1.2643 +			if (iScreenModeTests&EDoScale)
  1.2644 +				{
  1.2645 +				iQueueClient->iScreen->SetScreenMode(iCurrentMode);
  1.2646 +				iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode);
  1.2647 +				iQueueClient->iScreen->SetAppScreenMode(0);
  1.2648 +				TheClient->iScreen->SetAppScreenMode(0);
  1.2649 +				iQueueClient->iScreen->SetScreenMode(0);
  1.2650 +				iBlankWin->SetVisible(EFalse);
  1.2651 +				TheClient->iWs.SetAutoFlush(iTheClientFlush);
  1.2652 +				iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
  1.2653 +				}
  1.2654 +		#endif
  1.2655 +			User::After(500000);		//0.5secs, to allow other screen devices to respond to the flip events
  1.2656 +			CActiveScheduler::Stop();
  1.2657 +			break;
  1.2658 +		}
  1.2659 +	TheClient->iWs.Flush();
  1.2660 +	}
  1.2661 +
  1.2662 +
  1.2663 +void CTEventTest::ScreenScaling_NextSetOfEventsL()
  1.2664 +	{
  1.2665 +#if defined(LOGGING)
  1.2666 +	TLogMessageText logMessageText;
  1.2667 +	_LIT(KSet,"ScreenScaling SetOfEvents: %d (Last=3)");
  1.2668 +	logMessageText.Format(KSet,iEventSet);
  1.2669 +	INFO_PRINTF1(logMessageText);
  1.2670 +#endif
  1.2671 +	if(! (iScreenModeTests & EDoScale))
  1.2672 +		{
  1.2673 +		User::After(500000);
  1.2674 +		CActiveScheduler::Stop();
  1.2675 +		return;
  1.2676 +		}
  1.2677 +	switch(iEventSet++)
  1.2678 +		{
  1.2679 +		case 0:
  1.2680 +			{
  1.2681 +			iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
  1.2682 +			iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
  1.2683 +			iBlankWin->SetVisible(ETrue);
  1.2684 +
  1.2685 +			TInt mode = TheClient->iScreen->CurrentScreenMode();
  1.2686 +
  1.2687 +			iSizeMode = iQueueClient->iScreen->GetCurrentScreenModeAttributes();
  1.2688 +
  1.2689 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
  1.2690 +			iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
  1.2691 +
  1.2692 +			TSizeMode szMode2 = iSizeMode;
  1.2693 +
  1.2694 +			szMode2.iScreenScale.SetSize(2,2);
  1.2695 +
  1.2696 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2697 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2698 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2699 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2700 +
  1.2701 +			TPoint theScreenOrigin(iQueueClient->iScreen->GetScreenModeOrigin(mode));
  1.2702 +
  1.2703 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2704 +				20+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2705 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2706 +				20+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2707 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode);
  1.2708 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2709 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2710 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2711 +
  1.2712 +			AddExpectedEvent(EEventFocusGained);
  1.2713 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,10-EWinPositionY));
  1.2714 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,10-EWinPositionY));
  1.2715 +
  1.2716 +			break;
  1.2717 +			}
  1.2718 +		case 1:
  1.2719 +			{
  1.2720 +			TSizeMode szMode2 = iSizeMode;
  1.2721 +			TInt mode = TheClient->iScreen->CurrentScreenMode();
  1.2722 +
  1.2723 +			szMode2.iScreenScale.SetSize(2,2);
  1.2724 +			szMode2.iOrigin.SetXY(20,20);
  1.2725 +
  1.2726 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2727 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2728 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2729 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2730 +
  1.2731 +			TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2732 +
  1.2733 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2734 +				30+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2735 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2736 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2737 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2738 +				40+theScreenOrigin.iX, 60+theScreenOrigin.iY);
  1.2739 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2740 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2741 +
  1.2742 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(15-EWinPositionX,15-EWinPositionY));
  1.2743 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(13-EWinPositionX,10-EWinPositionY));
  1.2744 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,30-EWinPositionY));
  1.2745 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(13-EWinPositionX,10-EWinPositionY));
  1.2746 +
  1.2747 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode);
  1.2748 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2749 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2750 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2751 +
  1.2752 +			theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2753 +
  1.2754 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2755 +				30+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2756 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2757 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2758 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2759 +				40+theScreenOrigin.iX, 50+theScreenOrigin.iY);
  1.2760 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2761 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2762 +
  1.2763 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(30-EWinPositionX,30-EWinPositionY));
  1.2764 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY));
  1.2765 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(40-EWinPositionX,50-EWinPositionY));
  1.2766 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY));
  1.2767 +			break;
  1.2768 +			}
  1.2769 +		case 2:
  1.2770 +			{
  1.2771 +			TInt mode = TheClient->iScreen->CurrentScreenMode();
  1.2772 +			TRect	theRect = TheClient->iWs.PointerCursorArea();
  1.2773 +
  1.2774 +			TSizeMode szMode2 = iSizeMode;
  1.2775 +
  1.2776 +			//-----------  scaling 2X2
  1.2777 +			szMode2.iScreenScale.SetSize(2,2);
  1.2778 +
  1.2779 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2780 +			iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52));
  1.2781 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2782 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2783 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2784 +
  1.2785 +
  1.2786 +			TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2787 +
  1.2788 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2789 +				20+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2790 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2791 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2792 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2793 +				50+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2794 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2795 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2796 +
  1.2797 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2798 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2799 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,15-EWinPositionY));
  1.2800 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2801 +			//------------------------  scaling 1X2
  1.2802 +			szMode2.iScreenScale.SetSize(1,2);
  1.2803 +
  1.2804 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2805 +			iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52));
  1.2806 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2807 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2808 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2809 +
  1.2810 +			theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2811 +
  1.2812 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2813 +				20+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2814 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2815 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2816 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2817 +				50+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2818 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2819 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2820 +
  1.2821 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2822 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,10-EWinPositionY));
  1.2823 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,15-EWinPositionY));
  1.2824 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,10-EWinPositionY));
  1.2825 +			//------------------------  scaling 2X1
  1.2826 +			szMode2.iScreenScale.SetSize(2,1);
  1.2827 +
  1.2828 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2829 +			iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52));
  1.2830 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2831 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2832 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2833 +
  1.2834 +			theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2835 +
  1.2836 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2837 +				20+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2838 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2839 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2840 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2841 +				50+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2842 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2843 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2844 +
  1.2845 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,20-EWinPositionY));
  1.2846 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY));
  1.2847 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,30-EWinPositionY));
  1.2848 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY));
  1.2849 +			//------------------------  scaling 3X1
  1.2850 +
  1.2851 +			szMode2.iScreenScale.SetSize(3,1);
  1.2852 +
  1.2853 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2854 +			iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52));
  1.2855 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2856 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2857 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2858 +
  1.2859 +			theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2860 +
  1.2861 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2862 +				21+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2863 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2864 +				30+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2865 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2866 +				75+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2867 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2868 +				30+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2869 +
  1.2870 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,20-EWinPositionY));
  1.2871 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY));
  1.2872 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,30-EWinPositionY));
  1.2873 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY));
  1.2874 +			//------------------------  scaling 3X2
  1.2875 +
  1.2876 +			szMode2.iScreenScale.SetSize(3,2);
  1.2877 +
  1.2878 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2879 +			iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52));
  1.2880 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2881 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2882 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2883 +
  1.2884 +			theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2885 +
  1.2886 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2887 +				21+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2888 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2889 +				30+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2890 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2891 +				75+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2892 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2893 +				30+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2894 +
  1.2895 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2896 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2897 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,15-EWinPositionY));
  1.2898 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2899 +			//------------------------  scaling 3X3
  1.2900 +			szMode2.iScreenScale.SetSize(3,3);
  1.2901 +
  1.2902 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
  1.2903 +			iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52));
  1.2904 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2905 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2906 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2907 +
  1.2908 +			theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2909 +
  1.2910 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2911 +				21+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2912 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2913 +				30+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2914 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2915 +				75+theScreenOrigin.iX, 33+theScreenOrigin.iY);
  1.2916 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2917 +				30+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2918 +
  1.2919 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2920 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2921 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,11-EWinPositionY));
  1.2922 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY));
  1.2923 +			//------------------------
  1.2924 +			iQueueClient->iWs.SetPointerCursorArea(mode, theRect);
  1.2925 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode);
  1.2926 +			TheClient->iScreen->SetAppScreenMode(mode);
  1.2927 +			iQueueClient->iScreen->SetAppScreenMode(mode);
  1.2928 +			iQueueClient->iScreen->SetScreenMode(mode);
  1.2929 +			break;
  1.2930 +			}
  1.2931 +		case 3:
  1.2932 +			{
  1.2933 +			iQueueClient->iWs.SetAutoFlush(ETrue);
  1.2934 +			TInt theCurMode = iQueueClient->iScreen->CurrentScreenMode();
  1.2935 +			TPoint theScreenOrigin;
  1.2936 +			if (iNumScrModes>2)
  1.2937 +				{
  1.2938 +				TheClient->iScreen->SetAppScreenMode(2);
  1.2939 +				iQueueClient->iScreen->SetAppScreenMode(2);
  1.2940 +				TheClient->iScreen->SetScreenMode(2);
  1.2941 +
  1.2942 +				theScreenOrigin=iQueueClient->iScreen->GetDefaultScreenModeOrigin();
  1.2943 +				SimulatePointer(TRawEvent::EButton1Down,
  1.2944 +					30+theScreenOrigin.iX,30+theScreenOrigin.iY);
  1.2945 +				SimulatePointer(TRawEvent::EButton1Up,
  1.2946 +					26+theScreenOrigin.iX,20+theScreenOrigin.iY);
  1.2947 +				SimulatePointer(TRawEvent::EButton1Down,
  1.2948 +					40+theScreenOrigin.iX,60+theScreenOrigin.iY);
  1.2949 +				SimulatePointer(TRawEvent::EButton1Up,
  1.2950 +					26+theScreenOrigin.iX,20+theScreenOrigin.iY);
  1.2951 +
  1.2952 +				AddExpectedPointer(TPointerEvent::EButton1Down,
  1.2953 +					TPoint(15-EWinPositionX,15-EWinPositionY));
  1.2954 +				AddExpectedPointer(TPointerEvent::EButton1Up,
  1.2955 +					TPoint(13-EWinPositionX,10-EWinPositionY));
  1.2956 +				AddExpectedPointer(TPointerEvent::EButton1Down,
  1.2957 +					TPoint(20-EWinPositionX,30-EWinPositionY));
  1.2958 +				AddExpectedPointer(TPointerEvent::EButton1Up,
  1.2959 +					TPoint(13-EWinPositionX,10-EWinPositionY));
  1.2960 +				}
  1.2961 +
  1.2962 +			TheClient->iScreen->SetAppScreenMode(0);
  1.2963 +			iQueueClient->iScreen->SetAppScreenMode(0);
  1.2964 +			iQueueClient->iScreen->SetScreenMode(0);
  1.2965 +			iTest->DelayIfFullRomL();
  1.2966 +
  1.2967 +			theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
  1.2968 +
  1.2969 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2970 +				30+theScreenOrigin.iX, 30+theScreenOrigin.iY);
  1.2971 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2972 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2973 +			SimulatePointer(TRawEvent::EButton1Down,
  1.2974 +				40+theScreenOrigin.iX, 50+theScreenOrigin.iY);
  1.2975 +			SimulatePointer(TRawEvent::EButton1Up,
  1.2976 +				26+theScreenOrigin.iX, 20+theScreenOrigin.iY);
  1.2977 +
  1.2978 +		#if defined(__WINS__)
  1.2979 +			iQueueClient->iWs.SimulateXyInputType(EXYInputDeltaMouse);
  1.2980 +			iQueueClient->iWs.SetPointerCursorPosition(TPoint(24+theScreenOrigin.iX,24+theScreenOrigin.iY));
  1.2981 +			SimulatePointer(TRawEvent::EPointerMove,1,2);
  1.2982 +			iQueueClient->iWs.SimulateXyInputType(EXYInputPointer);
  1.2983 +		#endif
  1.2984 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(30-EWinPositionX,30-EWinPositionY));
  1.2985 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY));
  1.2986 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(40-EWinPositionX,50-EWinPositionY));
  1.2987 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY));
  1.2988 +
  1.2989 +		#if defined(__WINS__)
  1.2990 +			AddExpectedPointer(TPointerEvent::EMove, TPoint(25-EWinPositionX,26-EWinPositionY));
  1.2991 +		#endif
  1.2992 +
  1.2993 +			iQueueClient->iScreen->SetAppScreenMode(theCurMode);
  1.2994 +			TheClient->iScreen->SetScreenMode(theCurMode);
  1.2995 +			break;
  1.2996 +			}
  1.2997 +		default:
  1.2998 +			User::After(EPointerCursorUpdateGap);
  1.2999 +			iBlankWin->SetVisible(EFalse);
  1.3000 +			TheClient->iWs.SetAutoFlush(iTheClientFlush);
  1.3001 +			iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
  1.3002 +			iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode);
  1.3003 +			User::After(500000);		//0.5secs, to allow other screen devices to respond to the flip events
  1.3004 +			CActiveScheduler::Stop();
  1.3005 +			break;
  1.3006 +		}
  1.3007 +	}
  1.3008 +
  1.3009 +void CTEventTest::AnimEvent_NextSetOfEventsL()
  1.3010 +	{
  1.3011 +#if defined(LOGGING)
  1.3012 +	TLogMessageText logMessageText;
  1.3013 +	_LIT(KSet,"AnimEvent SetOfEvents: %d  (Max=4)");
  1.3014 +	logMessageText.Format(KSet,iEventSet);
  1.3015 +	INFO_PRINTF1(logMessageText);
  1.3016 +#endif
  1.3017 +	switch(iEventSet++)
  1.3018 +		{
  1.3019 +		case 0:
  1.3020 +			iAnim=REventAnim::NewL(iQueueClient->iWin->BaseWin(), iAnimDll);
  1.3021 +			AddExpectedEvent(EEventFocusGained);
  1.3022 +			AddExpectedKeyAnim(TRawEvent::EKeyDown,32,ETrue);
  1.3023 +			AddExpectedKeyAnim(TRawEvent::EKeyUp,32,ETrue);
  1.3024 +			AddExpectedKeyAnim(TRawEvent::EKeyDown,33,EFalse);
  1.3025 +			AddExpectedKeyAnim(TRawEvent::EKeyUp,33,EFalse);
  1.3026 +			iTest->SimulateKey(TRawEvent::EKeyDown,32);
  1.3027 +			iTest->SimulateKey(TRawEvent::EKeyUp,32);
  1.3028 +			iTest->SimulateKey(TRawEvent::EKeyDown,33);
  1.3029 +			iTest->SimulateKey(TRawEvent::EKeyUp,33);
  1.3030 +			TheClient->iWs.Flush();
  1.3031 +			if (iAnim->TestFail(4))
  1.3032 +				Failed();
  1.3033 +			break;
  1.3034 +		case 1:
  1.3035 +			iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
  1.3036 +			iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
  1.3037 +			iQueueClient->iWs.Flush();
  1.3038 +			TheClient->iWs.SetPointerCursorArea(TRect(10,10,51,51));
  1.3039 +			AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(10,10));
  1.3040 +			AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(25,10));
  1.3041 +			AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(50,10));
  1.3042 +			AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(50,35));
  1.3043 +			AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(50,50));
  1.3044 +			AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(25,50));
  1.3045 +			AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(10,50));
  1.3046 +			AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(10,35));
  1.3047 +			AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(30,30),EFalse);
  1.3048 +			AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(30,30),EFalse);
  1.3049 +			SimulatePointer(TRawEvent::EButton1Down,5,5);
  1.3050 +			SimulatePointer(TRawEvent::EButton1Up,25,5);
  1.3051 +			SimulatePointer(TRawEvent::EButton1Down,55,5);
  1.3052 +			SimulatePointer(TRawEvent::EButton1Up,55,35);
  1.3053 +			SimulatePointer(TRawEvent::EButton1Down,55,55);
  1.3054 +			SimulatePointer(TRawEvent::EButton1Up,25,55);
  1.3055 +			SimulatePointer(TRawEvent::EButton1Down,5,55);
  1.3056 +			SimulatePointer(TRawEvent::EButton1Up,5,35);
  1.3057 +			SimulatePointer(TRawEvent::EButton1Down,30,30);
  1.3058 +			SimulatePointer(TRawEvent::EButton1Up,30,30);
  1.3059 +			TheClient->iWs.Flush();
  1.3060 +			if (iAnim->TestFail(10))
  1.3061 +				Failed();
  1.3062 +			break;
  1.3063 +		case 2:
  1.3064 +			{
  1.3065 +		#if defined(LOGGING)
  1.3066 +			_LIT(KLog," :2nd Set of Events  Modes=0x%x");
  1.3067 +			logMessageText.Format(KLog,iScreenModeTests);
  1.3068 +			INFO_PRINTF1(logMessageText);
  1.3069 +		#endif
  1.3070 +			TInt enforc=TheClient->iScreen->ScreenModeEnforcement();
  1.3071 +			iBlankWin->SetVisible(ETrue);
  1.3072 +			TInt expectedEvents=0;
  1.3073 +			if (iScreenModeTests&EDoRot90 && enforc==ESizeEnforcementNone)
  1.3074 +				{
  1.3075 +				INFO_PRINTF1(_L(" :Rotation 90"));
  1.3076 +				TheClient->iScreen->SetScreenMode(1);
  1.3077 +				TheClient->iWs.Flush();
  1.3078 +				iTest->DelayIfFullRomL();
  1.3079 +                AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(20,20-iYOffset));
  1.3080 +                AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(20,20-iYOffset));
  1.3081 +				expectedEvents+=2;
  1.3082 +				TPoint screenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin();
  1.3083 +			#if defined(__WINS__)
  1.3084 +				iTest->SimulatePointer(TRawEvent::EButton1Down,20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.3085 +				iTest->SimulatePointer(TRawEvent::EButton1Up,20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.3086 +			#else
  1.3087 +				// simulate pointer at (20,20) on rotated screen by providing physical coordinates
  1.3088 +				iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.3089 +				iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY);
  1.3090 +			#endif
  1.3091 +				}
  1.3092 +			if (iScreenModeTests&EDoRot180)
  1.3093 +				{
  1.3094 +				INFO_PRINTF1(_L(" :Rotation 180"));
  1.3095 +				TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180);
  1.3096 +				TheClient->iScreen->SetScreenMode(0);
  1.3097 +				TheClient->iWs.Flush();
  1.3098 +				iTest->DelayIfFullRomL();
  1.3099 +                AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(22,22-iYOffset));
  1.3100 +                AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(22,22-iYOffset));
  1.3101 +               
  1.3102 +				expectedEvents+=2;
  1.3103 +			#if defined(__WINS__)
  1.3104 +				iTest->SimulatePointer(TRawEvent::EButton1Down,22,22);
  1.3105 +				iTest->SimulatePointer(TRawEvent::EButton1Up,22,22);
  1.3106 +			#else
  1.3107 +				// simulate pointer at (22,22) on rotated screen by providing physical coordinates
  1.3108 +				iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22);
  1.3109 +				iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22);
  1.3110 +			#endif
  1.3111 +				}
  1.3112 +			TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal);
  1.3113 +			TheClient->iScreen->SetScreenMode(0);
  1.3114 +			TheClient->iWs.Flush();
  1.3115 +			iTest->DelayIfFullRomL();
  1.3116 +			if (iScreenModeTests&EDoRot0)
  1.3117 +				{
  1.3118 +				INFO_PRINTF1(_L(" :Rotation 0"));
  1.3119 +				AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(24,24),EFalse);
  1.3120 +				AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(24,24),EFalse);
  1.3121 +				expectedEvents+=2;
  1.3122 +				SimulatePointer(TRawEvent::EButton1Down,24,24);
  1.3123 +				SimulatePointer(TRawEvent::EButton1Up,24,24);
  1.3124 +				}
  1.3125 +		#if defined(LOGGING)
  1.3126 +			_LIT(KNumEvents," :Expected Number of Events=%d  Actual=%d");
  1.3127 +			logMessageText.Format(KNumEvents,expectedEvents,iAnim->GetNumEvents());
  1.3128 +			INFO_PRINTF1(logMessageText);
  1.3129 +			_LIT(KError," :Error Value %d ('0'=OK)");
  1.3130 +			logMessageText.Format(KError,iAnim->GetError());
  1.3131 +			INFO_PRINTF1(logMessageText);
  1.3132 +		#endif
  1.3133 +			if (iAnim->TestFail(expectedEvents))
  1.3134 +				Failed();
  1.3135 +			User::After(EPointerCursorUpdateGap);
  1.3136 +			iBlankWin->SetVisible(EFalse);
  1.3137 +			INFO_PRINTF1(_L(" :Finished 2nd Set"));
  1.3138 +			}
  1.3139 +			break;
  1.3140 +		case 3:
  1.3141 +			iAnim->Destroy(); iAnim=NULL;
  1.3142 +			// Create an EventPostingAnim, key down & key up events are simulated.
  1.3143 +			// The event posting anim sees the key events in turn, and creates duplicates.
  1.3144 +			// Test checks that each simulated event is received twice. 
  1.3145 +			TRAPD(err, iAnim=REventAnim::NewL(iQueueClient->iWin->BaseWin(), iAnimDll, REventAnimBase::EEventPostingAnim));
  1.3146 +			if (err!=KErrNone)
  1.3147 +				{
  1.3148 +				Failed();
  1.3149 +				return;
  1.3150 +				}
  1.3151 +			AddExpectedKeyAnim(TRawEvent::EKeyDown,32,ETrue);
  1.3152 +			AddExpectedKeyAnim(TRawEvent::EKeyDown,32,EFalse);
  1.3153 +			AddExpectedKeyAnim(TRawEvent::EKeyUp,32,ETrue);
  1.3154 +			AddExpectedKeyAnim(TRawEvent::EKeyUp,32,EFalse);
  1.3155 +			
  1.3156 +			iTest->SimulateKey(TRawEvent::EKeyDown,32);
  1.3157 +			iTest->SimulateKey(TRawEvent::EKeyUp,32);
  1.3158 +			break;
  1.3159 +		case 4:
  1.3160 +			// Simulate a key down event, which calls anim's offer raw event
  1.3161 +			// which inturn calls post key event with old and new API
  1.3162 +			// Test checks the repeat count for old and new API are as expected.
  1.3163 +			AddExpectedKeyAnim(TRawEvent::EKeyDown,45,ETrue);
  1.3164 +			
  1.3165 +			TKeyEvent event;
  1.3166 +			event.iCode='J';
  1.3167 +			event.iScanCode=0;
  1.3168 +			event.iModifiers=0;
  1.3169 +			event.iRepeats=0;
  1.3170 +			AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers);
  1.3171 +			event.iRepeats=2;
  1.3172 +			AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers);
  1.3173 +			
  1.3174 +			iTest->SimulateKey(TRawEvent::EKeyDown,45);
  1.3175 +			break;
  1.3176 +		default:
  1.3177 +			iAnim->Destroy();
  1.3178 +			iAnim=NULL;
  1.3179 +			CActiveScheduler::Stop();
  1.3180 +			break;
  1.3181 +		}
  1.3182 +	TheClient->iWs.Flush();
  1.3183 +	}
  1.3184 +
  1.3185 +void CTEventTest::FocusChanged_NextSetOfEventsL()
  1.3186 +	{
  1.3187 +#if defined(LOGGING)
  1.3188 +	TLogMessageText logMessageText;
  1.3189 +	_LIT(KSet,"FocusChanged SetOfEvents: %d ");
  1.3190 +	logMessageText.Format(KSet,iEventSet);
  1.3191 +	INFO_PRINTF1(logMessageText);
  1.3192 +#endif
  1.3193 +	switch(iEventSet++)
  1.3194 +		{
  1.3195 +		case 0:
  1.3196 +			{
  1.3197 +			_LIT(AutoFocusTest,"FocusEvents");
  1.3198 +			iQueueClient->EnableFocusChangeEvents();
  1.3199 +			iEventTestGroup2=new(ELeave) CTWindowGroup(TheClient);
  1.3200 +			iEventTestGroup2->ConstructL();
  1.3201 +			iEventTestGroup2->GroupWin()->SetName(AutoFocusTest);
  1.3202 +			AddExpectedEvent(EEventFocusGained);
  1.3203 +			AddExpectedEvent(EEventFocusLost);
  1.3204 +			AddExpectedEvent(EEventFocusGroupChanged);
  1.3205 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.3206 +			}
  1.3207 +			break;
  1.3208 +		case 1:
  1.3209 +			iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(EFalse);
  1.3210 +			AddExpectedEvent(EEventFocusGained);
  1.3211 +			AddExpectedEvent(EEventFocusGroupChanged);
  1.3212 +			break;
  1.3213 +		case 2:
  1.3214 +			iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(ETrue);
  1.3215 +			AddExpectedEvent(EEventFocusLost);
  1.3216 +			AddExpectedEvent(EEventFocusGroupChanged);
  1.3217 +			break;
  1.3218 +		case 3:
  1.3219 +			iEventTestGroup2->GroupWin()->SetOrdinalPosition(999);
  1.3220 +			AddExpectedEvent(EEventFocusGained);
  1.3221 +			AddExpectedEvent(EEventFocusGroupChanged);
  1.3222 +			break;
  1.3223 +		case 4:
  1.3224 +			iEventTestGroup2->GroupWin()->SetOrdinalPosition(0);
  1.3225 +			AddExpectedEvent(EEventFocusLost);
  1.3226 +			AddExpectedEvent(EEventFocusGroupChanged);
  1.3227 +			break;
  1.3228 +		case 5:
  1.3229 +			delete iEventTestGroup2;
  1.3230 +			iEventTestGroup2=NULL;
  1.3231 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.3232 +			AddExpectedEvent(EEventFocusGroupChanged);
  1.3233 +			break;
  1.3234 +		default:
  1.3235 +			CActiveScheduler::Stop();
  1.3236 +			break;
  1.3237 +		}
  1.3238 +	TheClient->iWs.Flush();
  1.3239 +	}
  1.3240 +
  1.3241 +	
  1.3242 +void CTEventTest::StopEvents_NextSetOfEventsL()
  1.3243 +	{
  1.3244 +	// we are not running tests 0,1,2 as they currently fail
  1.3245 +	if(iEventSet==0)
  1.3246 +		{
  1.3247 +		iEventSet=3;
  1.3248 +		AddExpectedEvent(EEventFocusGained);
  1.3249 +		}
  1.3250 +	TInt retVal	= KErrNone;
  1.3251 +				
  1.3252 +	switch(iEventSet++)
  1.3253 +		{
  1.3254 +		case 0: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(....
  1.3255 +			iQueueClient->iWs.Flush();
  1.3256 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()));
  1.3257 +			iTest->SimulateEvent(TRawEvent::ESwitchOff);
  1.3258 +			TheClient->iWs.Flush();
  1.3259 +			retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode());
  1.3260 +			TEST(retVal==KErrAlreadyExists);
  1.3261 +			if (retVal!=KErrAlreadyExists)
  1.3262 +				INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal);
  1.3263 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse,iQueueClient->iGroup->WinTreeNode()));
  1.3264 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()));
  1.3265 +			iTest->SimulateEvent(TRawEvent::ESwitchOff);
  1.3266 +			TheClient->iWs.Flush();
  1.3267 +			retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode());
  1.3268 +			TEST(retVal==KErrAlreadyExists);
  1.3269 +			if (retVal!=KErrAlreadyExists)
  1.3270 +				INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal);
  1.3271 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse));
  1.3272 +			AddExpectedEvent(EEventFocusGained);
  1.3273 +			AddExpectedEvent(EEventSwitchOff);
  1.3274 +			AddExpectedEvent(EEventSwitchOff);
  1.3275 +			break;
  1.3276 +			
  1.3277 +		case 1: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(....
  1.3278 +			{
  1.3279 +			TKeyEvent event; 
  1.3280 +			iQueueClient->iWs.Flush();
  1.3281 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()));
  1.3282 +			event.iCode=EKeyOff;
  1.3283 +			event.iScanCode=EKeyOff;
  1.3284 +			event.iModifiers=0;
  1.3285 +			event.iRepeats=0;
  1.3286 +			TheClient->iWs.SimulateKeyEvent(event);
  1.3287 +			TheClient->iWs.Flush();
  1.3288 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse));
  1.3289 +			AddExpectedEvent(EEventKeySwitchOff);
  1.3290 +			}
  1.3291 +			break;
  1.3292 +		
  1.3293 +		case 2: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(....
  1.3294 +			{
  1.3295 +			TKeyEvent event;
  1.3296 +			event.iCode=EKeyOff;
  1.3297 +			event.iScanCode=EKeyOff;
  1.3298 +			event.iModifiers=0;
  1.3299 +			event.iRepeats=0;
  1.3300 +			iQueueClient->iWs.Flush();
  1.3301 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()));
  1.3302 +			iTest->SimulateEvent(TRawEvent::ESwitchOff);
  1.3303 +			TheClient->iWs.SimulateKeyEvent(event);
  1.3304 +			iTest->SimulateEvent(TRawEvent::ECaseClose);
  1.3305 +			TheClient->iWs.Flush();
  1.3306 +			retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode());
  1.3307 +			TEST(retVal==KErrAlreadyExists);
  1.3308 +			if (retVal!=KErrAlreadyExists)
  1.3309 +				INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal);
  1.3310 +			iTest->SimulateEvent(TRawEvent::ESwitchOff);
  1.3311 +			iTest->SimulateEvent(TRawEvent::ECaseClose);
  1.3312 +			TheClient->iWs.SimulateKeyEvent(event);
  1.3313 +			TheClient->iWs.Flush();
  1.3314 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse,iQueueClient->iGroup->WinTreeNode()));
  1.3315 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()));
  1.3316 +			iTest->SimulateEvent(TRawEvent::ECaseClose);
  1.3317 +			iTest->SimulateEvent(TRawEvent::ESwitchOff);
  1.3318 +			TheClient->iWs.SimulateKeyEvent(event);
  1.3319 +			TheClient->iWs.Flush();
  1.3320 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse));
  1.3321 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iChildWin->WinTreeNode()));
  1.3322 +			iTest->SimulateEvent(TRawEvent::ESwitchOff);
  1.3323 +			TheClient->iWs.SimulateKeyEvent(event);
  1.3324 +			iTest->SimulateEvent(TRawEvent::ECaseClose);
  1.3325 +			TheClient->iWs.Flush();
  1.3326 +			User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse));
  1.3327 +			AddExpectedEvent(EEventSwitchOff);
  1.3328 +			AddExpectedEvent(EEventKeySwitchOff);
  1.3329 +			AddExpectedEvent(EEventCaseClosed);
  1.3330 +			AddExpectedEvent(EEventSwitchOff);
  1.3331 +			AddExpectedEvent(EEventCaseClosed);
  1.3332 +			AddExpectedEvent(EEventKeySwitchOff);
  1.3333 +			AddExpectedEvent(EEventCaseClosed,iQueueClient->iWin);
  1.3334 +			AddExpectedEvent(EEventSwitchOff,iQueueClient->iWin);
  1.3335 +			AddExpectedEvent(EEventKeySwitchOff,iQueueClient->iWin);
  1.3336 +			AddExpectedEvent(EEventSwitchOff,iQueueClient->iChildWin);
  1.3337 +			AddExpectedEvent(EEventKeySwitchOff,iQueueClient->iChildWin);
  1.3338 +			AddExpectedEvent(EEventCaseClosed,iQueueClient->iChildWin);
  1.3339 +			}
  1.3340 +			break;
  1.3341 +			
  1.3342 +		case 3: 
  1.3343 +			iQueueClient->iWs.Flush();
  1.3344 +			//User::LeaveIfError(iQueueClient->iGroup->WinTreeNode()->EnableOnEvents(EEventControlAlways));
  1.3345 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.3346 +			iTest->SimulateEvent(TRawEvent::ECaseOpen);
  1.3347 +			TheClient->iWs.Flush();
  1.3348 +			User::LeaveIfError(iQueueClient->iWin->WinTreeNode()->EnableOnEvents(EEventControlAlways));
  1.3349 +			iTest->SimulateEvent(TRawEvent::ECaseOpen);
  1.3350 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.3351 +			TheClient->iWs.Flush();
  1.3352 +			iQueueClient->iWin->WinTreeNode()->DisableOnEvents();
  1.3353 +			AddExpectedEvent(EEventSwitchOn);
  1.3354 +			//AddExpectedEvent(EEventSwitchOn);
  1.3355 +			AddExpectedEvent(EEventCaseOpened);
  1.3356 +			AddExpectedEvent(EEventCaseOpened,iQueueClient->iWin);
  1.3357 +			AddExpectedEvent(EEventCaseOpened);
  1.3358 +			AddExpectedEvent(EEventSwitchOn,iQueueClient->iWin);
  1.3359 +			AddExpectedEvent(EEventSwitchOn);
  1.3360 +			break;
  1.3361 +			
  1.3362 +		case 4:
  1.3363 +			iQueueClient->iWs.Flush();
  1.3364 +			// switch off the device
  1.3365 +			iTest->SimulateEvent(TRawEvent::ESwitchOff);
  1.3366 +			// switch it back on. 
  1.3367 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.3368 +			TheClient->iWs.Flush();	
  1.3369 +			// TRawEvent::ESwitchOff never actually comes back. The tests will hang if we look for one
  1.3370 +			AddExpectedEvent(EEventSwitchOn);
  1.3371 +			break;
  1.3372 +			
  1.3373 +		case 5:
  1.3374 +			{
  1.3375 +			TKeyEvent event; 
  1.3376 +			iQueueClient->iWs.Flush();
  1.3377 +			event.iCode=EKeyOff;
  1.3378 +			event.iScanCode=EKeyOff;
  1.3379 +			event.iModifiers=0;
  1.3380 +			event.iRepeats=0;
  1.3381 +			// switch off the device - this one seems to send it to standby rather than off
  1.3382 +			TheClient->iWs.SimulateKeyEvent(event);
  1.3383 +			// switch it back on or no further tests will complete
  1.3384 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.3385 +			TheClient->iWs.Flush();	
  1.3386 +			// again we would expect EEventKeySwitchOff but it doesn't come back. The tests will hang if we look for one
  1.3387 +			AddExpectedEvent(EEventSwitchOn);
  1.3388 +			}
  1.3389 +			break;
  1.3390 +		
  1.3391 +		case 6:
  1.3392 +			iQueueClient->iWs.Flush();
  1.3393 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.3394 +			iTest->SimulateEvent(TRawEvent::ECaseOpen);
  1.3395 +			TheClient->iWs.Flush();
  1.3396 +			User::LeaveIfError(iQueueClient->iWin->WinTreeNode()->EnableOnEvents(EEventControlAlways));
  1.3397 +			iTest->SimulateEvent(TRawEvent::ECaseOpen);
  1.3398 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.3399 +			TheClient->iWs.Flush();
  1.3400 +			iQueueClient->iWin->WinTreeNode()->DisableOnEvents();
  1.3401 +			AddExpectedEvent(EEventSwitchOn);
  1.3402 +			AddExpectedEvent(EEventCaseOpened);
  1.3403 +			AddExpectedEvent(EEventCaseOpened,iQueueClient->iWin);
  1.3404 +			AddExpectedEvent(EEventCaseOpened);
  1.3405 +			AddExpectedEvent(EEventSwitchOn,iQueueClient->iWin);
  1.3406 +			AddExpectedEvent(EEventSwitchOn);
  1.3407 +			break;
  1.3408 +					
  1.3409 +		default:
  1.3410 +			CActiveScheduler::Stop();
  1.3411 +			break;
  1.3412 +		}
  1.3413 +	TheClient->iWs.Flush();
  1.3414 +	}
  1.3415 +	
  1.3416 +void CTEventTest::VirtualKeyboard_NextSetOfEventsL()
  1.3417 +	{
  1.3418 +	const TInt noVirtualKeys=10;
  1.3419 +	const TInt keyWidth=2*EWinWidth/noVirtualKeys/3;
  1.3420 +	const TInt keyHeight=EWinHeight/2;
  1.3421 +	const TInt keySpacing=EWinWidth/noVirtualKeys;
  1.3422 +	const TInt baseChar='1';
  1.3423 +	TInt startX=1;
  1.3424 +	TInt ii;
  1.3425 +	switch(iEventSet++)
  1.3426 +		{
  1.3427 +		case 0:
  1.3428 +			iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
  1.3429 +			for (ii=0;ii<noVirtualKeys;++ii)
  1.3430 +				{
  1.3431 +				iQueueClient->iWin->BaseWin()->AddKeyRect(TRect(startX,1,startX+keyWidth,keyHeight),baseChar+ii,EFalse);
  1.3432 +				startX+=keySpacing;
  1.3433 +				}
  1.3434 +			iQueueClient->iWs.Flush();
  1.3435 +			iTest->SimulatePointerDownUp(EWinPositionX+1,EWinPositionY+1+iYOffset);
  1.3436 +			//TheClient->iWs.Flush();
  1.3437 +			AddExpectedEvent(EEventFocusGained);
  1.3438 +			AddExpectedKeyDownUp(baseChar);
  1.3439 +			break;
  1.3440 +		case 1:
  1.3441 +			startX=3;
  1.3442 +			for (ii=0;ii<noVirtualKeys-2;++ii)		//Can't do all 10 as this will overflow the event buffer
  1.3443 +				{
  1.3444 +				iTest->SimulatePointerDownUp(startX+EWinPositionX+1,EWinPositionY+keyHeight-1+iYOffset);
  1.3445 +				AddExpectedKeyDownUp(baseChar+ii);
  1.3446 +				startX+=keySpacing;
  1.3447 +				}
  1.3448 +			break;
  1.3449 +		case 2:
  1.3450 +			SimulatePointerDownUpWin(keySpacing+1,1);
  1.3451 +			//SimulatePointerDownUp(EWinPositionX+keySpacing+1,EWinPositionY+1);
  1.3452 +			iTest->SimulatePointerDownUp(EWinPositionX+keyWidth,EWinPositionY+1+iYOffset);
  1.3453 +			iTest->SimulatePointerDownUp(EWinPositionX+1,EWinPositionY+keyHeight-1+iYOffset);
  1.3454 +			iTest->SimulatePointerDownUp(EWinPositionX+keyWidth,EWinPositionY+keyHeight-1+iYOffset);
  1.3455 +			AddExpectedKeyDownUp(baseChar+1);
  1.3456 +			AddExpectedKeyDownUp(baseChar);
  1.3457 +			AddExpectedKeyDownUp(baseChar);
  1.3458 +			AddExpectedKeyDownUp(baseChar);
  1.3459 +			break;
  1.3460 +		case 3:
  1.3461 +			SimulatePointerDownUpWin(keySpacing+3,4);
  1.3462 +			SimulatePointerDownUpWin(0,0);		//No Pointer event get through even if there are gaps
  1.3463 +			SimulatePointerDownUpWin(1,0);
  1.3464 +			SimulatePointerDownUpWin(0,1);
  1.3465 +			SimulatePointerDownUpWin(keyWidth+1,0);
  1.3466 +			SimulatePointerDownUpWin(keyWidth,0);
  1.3467 +			SimulatePointerDownUpWin(keyWidth+1,1);
  1.3468 +			SimulatePointerDownUpWin(0,keyHeight);
  1.3469 +			SimulatePointerDownUpWin(1,keyHeight);
  1.3470 +			SimulatePointerDownUpWin(0,keyHeight-1);
  1.3471 +			SimulatePointerDownUpWin(keyWidth+1,keyHeight);
  1.3472 +			SimulatePointerDownUpWin(keyWidth,keyHeight);
  1.3473 +			SimulatePointerDownUpWin(keyWidth+1,keyHeight-1);
  1.3474 +			SimulatePointerDownUpWin(2*keySpacing+3,4);
  1.3475 +			AddExpectedKeyDownUp(baseChar+1);
  1.3476 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+0));		//No Pointer event get through even if there are gaps
  1.3477 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+1,EWinPositionY+0));
  1.3478 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+1));
  1.3479 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+0));
  1.3480 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth,EWinPositionY+0));
  1.3481 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+1));
  1.3482 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+keyHeight));
  1.3483 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+1,EWinPositionY+keyHeight));
  1.3484 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+keyHeight-1));
  1.3485 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+keyHeight));
  1.3486 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth,EWinPositionY+keyHeight));
  1.3487 +			AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+keyHeight-1));
  1.3488 +			AddExpectedKeyDownUp(baseChar+2);
  1.3489 +			break;
  1.3490 +		case 4:
  1.3491 +			SimulatePointerWin(TRawEvent::EButton1Down,keySpacing+2,6);
  1.3492 +			SimulatePointerWin(TRawEvent::EButton1Up,2*keySpacing+1,5);
  1.3493 +			SimulatePointerWin(TRawEvent::EButton1Down,2*keySpacing+2,7);
  1.3494 +			SimulatePointer(TRawEvent::EButton1Up,0,0);
  1.3495 +			AddExpectedKeyDownUp(baseChar+1);
  1.3496 +			AddExpectedKeyDownUp(baseChar+2);
  1.3497 +			break;
  1.3498 +		default:
  1.3499 +			CActiveScheduler::Stop();
  1.3500 +			break;
  1.3501 +		}
  1.3502 +	TheClient->iWs.Flush();
  1.3503 +	}
  1.3504 +
  1.3505 +TInt CTEventTest::ClickCommandReply(TInt aCommand,TInt aData)
  1.3506 +	{
  1.3507 +	TPckgBuf<TInt> intPkg;
  1.3508 +	intPkg()=aData;
  1.3509 +	return iClick.CommandReply(aCommand,intPkg);
  1.3510 +	}
  1.3511 +
  1.3512 +TInt CTEventTest::CreateGroupWindow(RWindowGroup& aWinGp,TClients aClient,TInt& aWinGpId)
  1.3513 +	{
  1.3514 +	ClickCommandReply(EClickCreateGroupWin,aClient);
  1.3515 +	TInt err=aWinGp.Construct(ENullWsHandle,EFalse);
  1.3516 +	if (!err)
  1.3517 +		{
  1.3518 +		aWinGpId=aWinGp.Identifier();
  1.3519 +		ClickCommandReply(EClickCheckGpWinId,aWinGpId);
  1.3520 +		}
  1.3521 +	return err;
  1.3522 +	}
  1.3523 +
  1.3524 +void CTEventTest::CloseGroupWindow(RWindowGroup& aWinGp,TInt aWinGpId)
  1.3525 +	{
  1.3526 +	ClickCommandReply(EClickCloseGroupWin,aWinGpId);
  1.3527 +	aWinGp.Close();
  1.3528 +	}
  1.3529 +
  1.3530 +void CTEventTest::CloseWindow(RWindowBase& aWin,TInt aHandle,TInt aWinGpId)
  1.3531 +	{
  1.3532 +	TPckgBuf<TWindowCloseData> winClose;
  1.3533 +	winClose().iClientHandle=aHandle;
  1.3534 +	winClose().iWindowGroupId=aWinGpId;
  1.3535 +	iClick.CommandReply(EClickCloseWin,winClose);
  1.3536 +	aWin.Close();
  1.3537 +	}
  1.3538 +
  1.3539 +/**
  1.3540 +@SYMTestCaseID		GRAPHICS-WSERV-0447
  1.3541 +
  1.3542 +@SYMCR				CR1164
  1.3543 +
  1.3544 +@SYMTestCaseDesc	Tests that Key Click Plug-in gets new event Information
  1.3545 +
  1.3546 +@SYMTestPriority	High
  1.3547 +
  1.3548 +@SYMTestStatus		Implemented
  1.3549 +
  1.3550 +@SYMTestActions		Do things that cause the new events to be sent into plug-in.
  1.3551 +Creating destroying windows, pointer events.  Provide test plug-in with information it needs to check events.
  1.3552 +
  1.3553 +@SYMTestExpectedResults When Test Plug-in is querried to see if events match what was expected it says that they were.
  1.3554 +*/
  1.3555 +void CTEventTest::KeyClicks_NextSetOfEvents()
  1.3556 +	{
  1.3557 +#if defined(LOGGING)
  1.3558 +	TLogMessageText logMessageText;
  1.3559 +	_LIT(KSet,"KeyClicks SetOfEvents: %d (last=13)");
  1.3560 +	logMessageText.Format(KSet,iEventSet);
  1.3561 +	INFO_PRINTF1(logMessageText);
  1.3562 +#endif
  1.3563 +	TInt events=-1;
  1.3564 +	switch(iEventSet++)
  1.3565 +		{
  1.3566 +		case 0:
  1.3567 +			if (SetClickType(EClickCheck))
  1.3568 +				return;
  1.3569 +			iAddToClick=ETrue;
  1.3570 +			iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
  1.3571 +			iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse);
  1.3572 +			AddExpectedEvent(EEventFocusGained);
  1.3573 +			AddExpectedKeyDownUp(EStdKeySpace,EKeySpace);
  1.3574 +			iQueueClient->iWs.Flush();
  1.3575 +			iTest->SimulateKeyDownUp(EStdKeySpace);		//3 events
  1.3576 +			events=3;
  1.3577 +			break;
  1.3578 +		case 1:
  1.3579 +			AddExpectedKeyDownUp(EStdKeyEnter,EKeyEnter);
  1.3580 +			AddExpectedKeyDownUp('0');
  1.3581 +			AddExpectedKeyDownUp('A','a');
  1.3582 +			AddExpectedKeyDownUp('X','x');
  1.3583 +			AddExpectedKey(EEventKeyDown,EStdKeyLeftShift,0,0,EModifierLeftShift|EModifierShift);
  1.3584 +			AddExpectedKey(EEventKeyUp,EStdKeyLeftShift);
  1.3585 +			iQueueClient->iWs.Flush();
  1.3586 +			iTest->SimulateKeyDownUp(EStdKeyEnter);		//3 events
  1.3587 +			iTest->SimulateKeyDownUp('0');		//3 events
  1.3588 +			iTest->SimulateKeyDownUp('A');		//3 events
  1.3589 +			iTest->SimulateKeyDownUp('X');		//3 events
  1.3590 +			iTest->SimulateKeyDownUp(EStdKeyLeftShift);		//2 events
  1.3591 +			events=14;
  1.3592 +			break;
  1.3593 +		case 2:
  1.3594 +			AddExpectedKey(EEventKeyDown,EStdKeyRightShift,0,0,EModifierRightShift|EModifierShift);
  1.3595 +			AddExpectedKeyDownUp('B','B',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable);
  1.3596 +			AddExpectedKeyDownUp('W','W',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable);
  1.3597 +			AddExpectedKey(EEventKeyUp,EStdKeyRightShift);
  1.3598 +			iQueueClient->iWs.Flush();
  1.3599 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift);		//1 event
  1.3600 +			iTest->SimulateKeyDownUp('B');		//3 events
  1.3601 +			iTest->SimulateKeyDownUp('W');		//3 events
  1.3602 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift);		//1 event
  1.3603 +			events=8;
  1.3604 +			break;
  1.3605 +		case 3:
  1.3606 +			AddExpectedKey(EEventKeyDown,'C');
  1.3607 +			AddExpectedKey(EEventKey,'C','c');
  1.3608 +			AddExpectedKey(EEventKeyDown,'V');
  1.3609 +			AddExpectedKey(EEventKey,'V','v');
  1.3610 +			AddExpectedKey(EEventKeyUp,'C');
  1.3611 +			AddExpectedKey(EEventKeyUp,'V');
  1.3612 +			iQueueClient->iWs.Flush();
  1.3613 +			iTest->SimulateKey(TRawEvent::EKeyDown,'C');		//2 events
  1.3614 +			iTest->SimulateKey(TRawEvent::EKeyDown,'V');		//2 events
  1.3615 +			iTest->SimulateKey(TRawEvent::EKeyUp,'C');		//1 event
  1.3616 +			iTest->SimulateKey(TRawEvent::EKeyUp,'V');		//1 event
  1.3617 +			events=6;
  1.3618 +			break;
  1.3619 +		case 4:
  1.3620 +			{
  1.3621 +			AddExpectedKey(EEventKeyDown,'D');
  1.3622 +			AddExpectedKey(EEventKey,'D','d');
  1.3623 +			AddExpectedKey(EEventKey,'D','d',1);
  1.3624 +			AddExpectedKey(EEventKeyUp,'D');
  1.3625 +			iQueueClient->iWs.Flush();
  1.3626 +			iTest->SimulateKey(TRawEvent::EKeyDown,'D');		//2 events
  1.3627 +			TTimeIntervalMicroSeconds32 initialTime,time;
  1.3628 +			TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
  1.3629 +			User::After(initialTime.Int()+time.Int()/4);		//1 event
  1.3630 +			iTest->SimulateKey(TRawEvent::EKeyUp,'D');		//1 event
  1.3631 +			events=4;
  1.3632 +			}
  1.3633 +			break;
  1.3634 +		case 5:
  1.3635 +			AddExpectedPointerDownUpScr(TPoint(40,25));
  1.3636 +			AddExpectedPointerDownUpScr(TPoint(95,30));
  1.3637 +			AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(20-EWinPositionX,50-EWinPositionY));
  1.3638 +			AddExpectedPointer(TPointerEvent::EDrag,TPoint(45-EWinPositionX,42-EWinPositionY));
  1.3639 +			AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(45-EWinPositionX,42-EWinPositionY));
  1.3640 +			AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(98-EWinPositionX,15-EWinPositionY));
  1.3641 +			AddExpectedPointerClick(TPointerEvent::EDrag,TPoint(68-EWinPositionX,39-EWinPositionY));
  1.3642 +			AddExpectedPointer(TPointerEvent::EDrag,TPoint(41-EWinPositionX,42-EWinPositionY));
  1.3643 +			AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(50-EWinPositionX,58-EWinPositionY));
  1.3644 +			iQueueClient->iWs.Flush();
  1.3645 +			iTest->SimulatePointerDownUp(40,25+iYOffset);		//2 events
  1.3646 +			iTest->SimulatePointerDownUp(95,30+iYOffset);		//2 events
  1.3647 +			SimulatePointer(TRawEvent::EButton1Down,20,50);		//1 event
  1.3648 +			SimulatePointer(TRawEvent::EPointerMove,45,42);		//1 event
  1.3649 +			SimulatePointer(TRawEvent::EButton1Up,45,42);		//1 event
  1.3650 +			SimulatePointer(TRawEvent::EButton1Down,98,15);		//1 event
  1.3651 +			SimulatePointer(TRawEvent::EPointerMove,68,39);		//1 event
  1.3652 +			SimulatePointer(TRawEvent::EPointerMove,41,42);		//1 event
  1.3653 +			SimulatePointer(TRawEvent::EButton1Up,50,58);		//1 event
  1.3654 +			events=11;
  1.3655 +			break;
  1.3656 +		case 6:
  1.3657 +			AddExpectedKey(EEventKeyDown,'E');
  1.3658 +			AddExpectedKey(EEventKey,'E','e');
  1.3659 +			AddExpectedPointerDownUpScr(TPoint(41,24));
  1.3660 +			AddExpectedKey(EEventKeyUp,'E');
  1.3661 +			AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(23-EWinPositionX,52-EWinPositionY));
  1.3662 +			AddExpectedKeyDownUp('1');
  1.3663 +			AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(44-EWinPositionX,45-EWinPositionY));
  1.3664 +			AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(33-EWinPositionX,53-EWinPositionY));
  1.3665 +			AddExpectedKey(EEventKeyDown,'F');
  1.3666 +			AddExpectedKey(EEventKey,'F','f');
  1.3667 +			AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(34-EWinPositionX,47-EWinPositionY));
  1.3668 +			AddExpectedKey(EEventKeyUp,'F');
  1.3669 +			iQueueClient->iWs.Flush();
  1.3670 +			iTest->SimulateKey(TRawEvent::EKeyDown,'E');		//2 events
  1.3671 +			iTest->SimulatePointerDownUp(41,24+iYOffset);		//2 events
  1.3672 +			iTest->SimulateKey(TRawEvent::EKeyUp,'E');		//1 event
  1.3673 +			SimulatePointer(TRawEvent::EButton1Down,23,52);		//1 event
  1.3674 +			iTest->SimulateKeyDownUp('1');		//3 events
  1.3675 +			SimulatePointer(TRawEvent::EButton1Up,44,45);		//1 event
  1.3676 +			SimulatePointer(TRawEvent::EButton1Down,33,53);		//1 event
  1.3677 +			iTest->SimulateKey(TRawEvent::EKeyDown,'F');		//2 events
  1.3678 +			SimulatePointer(TRawEvent::EButton1Up,34,47);		//1 event
  1.3679 +			iTest->SimulateKey(TRawEvent::EKeyUp,'F');		//1 event
  1.3680 +			events=15;
  1.3681 +			break;
  1.3682 +		case 7:
  1.3683 +			AddExpectedKeyDownUp('2');
  1.3684 +			iAddToClick=EFalse;
  1.3685 +			AddExpectedKeyDownUp('G','g');
  1.3686 +			iAddToClick=ETrue;
  1.3687 +			AddExpectedPointerDownUpScr(TPoint(42,26));
  1.3688 +			AddExpectedKeyDownUp('U','u');
  1.3689 +			iQueueClient->iWs.Flush();
  1.3690 +			iTest->SimulateKeyDownUp('2');		//3 events
  1.3691 +			TheClient->iWs.Flush();
  1.3692 +			iQueueClient->iGroup->GroupWin()->DisableKeyClick(ETrue);
  1.3693 +			iQueueClient->iWs.Flush();
  1.3694 +			iTest->SimulateKeyDownUp('G');
  1.3695 +			iTest->SimulatePointerDownUp(42,26+iYOffset);		//2 events
  1.3696 +			TheClient->iWs.Flush();
  1.3697 +			iQueueClient->iGroup->GroupWin()->DisableKeyClick(EFalse);
  1.3698 +			iQueueClient->iWs.Flush();
  1.3699 +			iTest->SimulateKeyDownUp('U');		//3 events
  1.3700 +			events=8;
  1.3701 +			break;
  1.3702 +		case 8:
  1.3703 +			{
  1.3704 +			TPckgBuf<TPointerEventInfo> pointerEventInfo;
  1.3705 +			pointerEventInfo().iClientHandle=reinterpret_cast<TInt>(iQueueClient->iChildWin);
  1.3706 +			pointerEventInfo().iWinGpId=iQueueClient->iGroup->GroupWin()->Identifier();
  1.3707 +			pointerEventInfo().iWinOrigin=iQueueClient->ChildTopLeft();
  1.3708 +			pointerEventInfo().iParentOrigin.SetXY(EWinPositionX,EWinPositionY);
  1.3709 +			iClick.CommandReply(EClickPointerEvent,pointerEventInfo);
  1.3710 +			AddExpectedKeyDownUp('3');
  1.3711 +			AddExpectedPointerDownUpScr(TPoint(43,26));
  1.3712 +			AddExpectedKeyDownUp('H','h');
  1.3713 +			iAddToClick=EFalse;
  1.3714 +			AddExpectedPointerDownUpScr(TPoint(43,27));
  1.3715 +			AddExpectedKeyDownUp('4');
  1.3716 +			AddExpectedPointerDownUpScr(TPoint(42,27));
  1.3717 +			AddExpectedKeyDownUp('I','i');
  1.3718 +			iAddToClick=ETrue;
  1.3719 +			AddExpectedPointerDownUpScr(TPoint(44,27));
  1.3720 +			AddExpectedKeyDownUp('5');
  1.3721 +			AddExpectedPointerDownUpScr(TPoint(44,26));
  1.3722 +			iQueueClient->iWs.Flush();
  1.3723 +			iTest->SimulateKeyDownUp('3');		//3 events
  1.3724 +			iTest->SimulatePointerDownUp(43,26+iYOffset);		//2 events
  1.3725 +			iClick.SetPenClick(EFalse);
  1.3726 +			iTest->SimulateKeyDownUp('H');		//3 events
  1.3727 +			iTest->SimulatePointerDownUp(43,27+iYOffset);
  1.3728 +			iClick.SetKeyClick(EFalse);
  1.3729 +			iTest->SimulateKeyDownUp('4');
  1.3730 +			iTest->SimulatePointerDownUp(42,27+iYOffset);
  1.3731 +			iClick.SetPenClick(ETrue);
  1.3732 +			iTest->SimulateKeyDownUp('I');
  1.3733 +			iTest->SimulatePointerDownUp(44,27+iYOffset);		//2 events
  1.3734 +			iClick.SetKeyClick(ETrue);
  1.3735 +			iTest->SimulateKeyDownUp('5');		//3 events
  1.3736 +			iTest->SimulatePointerDownUp(44,26+iYOffset);		//2 events
  1.3737 +			pointerEventInfo().iClientHandle=0;
  1.3738 +			pointerEventInfo().iWinGpId=0;
  1.3739 +			iClick.CommandReply(EClickPointerEvent,pointerEventInfo);
  1.3740 +			events=15;
  1.3741 +			}
  1.3742 +			break;
  1.3743 +		case 9:
  1.3744 +			{
  1.3745 +			RWindowGroup winGp(iQueueClient->iWs);
  1.3746 +			TInt winGpId;
  1.3747 +			TInt ii;
  1.3748 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.3749 +			for (ii=0;ii<2;++ii)	//events x2
  1.3750 +				{
  1.3751 +				if (CreateGroupWindow(winGp,EQueueClient,winGpId))		//1 event
  1.3752 +					Failed();
  1.3753 +				CloseGroupWindow(winGp,winGpId);		//1 event
  1.3754 +				iQueueClient->iWs.Flush();
  1.3755 +				}
  1.3756 +			events=4;
  1.3757 +			}
  1.3758 +			break;
  1.3759 +		case 10:
  1.3760 +			{
  1.3761 +			RWindowGroup winGp(TheClient->iWs);
  1.3762 +			RWindowGroup winGp1(iQueueClient->iWs);
  1.3763 +			RWindowGroup winGp2(iQueueClient->iWs);
  1.3764 +			TInt winGpId;
  1.3765 +			TInt winGpId1;
  1.3766 +			TInt winGpId2;
  1.3767 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.3768 +			if (CreateGroupWindow(winGp,ETheClient,winGpId))		//1 event
  1.3769 +				Failed();
  1.3770 +			CloseGroupWindow(winGp,winGpId);		//1 event
  1.3771 +			TheClient->iWs.Flush();
  1.3772 +			if (CreateGroupWindow(winGp1,EQueueClient,winGpId1))		//1 event
  1.3773 +				Failed();
  1.3774 +			if (CreateGroupWindow(winGp2,EQueueClient,winGpId2))		//1 event
  1.3775 +				Failed();
  1.3776 +			if (CreateGroupWindow(winGp,ETheClient,winGpId))		//1 event
  1.3777 +				Failed();
  1.3778 +			CloseGroupWindow(winGp2,winGpId2);		//1 event
  1.3779 +			iQueueClient->iWs.Flush();
  1.3780 +			CloseGroupWindow(winGp,winGpId);		//1 event
  1.3781 +			TheClient->iWs.Flush();
  1.3782 +			CloseGroupWindow(winGp1,winGpId1);		//1 event
  1.3783 +			iQueueClient->iWs.Flush();
  1.3784 +			events=8;
  1.3785 +			}
  1.3786 +			break;
  1.3787 +		case 11:
  1.3788 +			{
  1.3789 +			RWindowGroup winGp(iQueueClient->iWs);
  1.3790 +			TInt winGpId;
  1.3791 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.3792 +			if (CreateGroupWindow(winGp,EQueueClient,winGpId))		//1 event
  1.3793 +				Failed();
  1.3794 +			RWindow win(iQueueClient->iWs);
  1.3795 +			const TInt handle=79;
  1.3796 +			if (win.Construct(winGp,handle))
  1.3797 +				Failed();
  1.3798 +			win.Activate();
  1.3799 +			CloseWindow(win,handle,winGpId);		//1 event
  1.3800 +			iQueueClient->iWs.Flush();
  1.3801 +			CloseGroupWindow(winGp,winGpId);		//1 event
  1.3802 +			iQueueClient->iWs.Flush();
  1.3803 +			events=3;
  1.3804 +			}
  1.3805 +			break;
  1.3806 +		case 12:
  1.3807 +			{
  1.3808 +			RWindowGroup winGp1(iQueueClient->iWs);
  1.3809 +			RWindowGroup winGp2(TheClient->iWs);
  1.3810 +			TInt winGpId1;
  1.3811 +			TInt winGpId2;
  1.3812 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.3813 +			if (CreateGroupWindow(winGp2,ETheClient,winGpId2))		//1 event
  1.3814 +				Failed();
  1.3815 +			if (CreateGroupWindow(winGp1,EQueueClient,winGpId1))		//1 event
  1.3816 +				Failed();
  1.3817 +			RWindow win1(iQueueClient->iWs);
  1.3818 +			RWindow win2(iQueueClient->iWs);
  1.3819 +			RWindow win(TheClient->iWs);
  1.3820 +			const TInt handle1a=80;
  1.3821 +			const TInt handle1b=81;
  1.3822 +			const TInt handle2a=82;
  1.3823 +			const TInt handle2b=83;
  1.3824 +			const TInt handle=84;
  1.3825 +			if (win1.Construct(winGp1,handle1a))
  1.3826 +				Failed();
  1.3827 +			win1.Activate();
  1.3828 +			if (win2.Construct(win1,handle2a))
  1.3829 +				Failed();
  1.3830 +			win2.Activate();
  1.3831 +			if (win.Construct(winGp2,handle))
  1.3832 +				Failed();
  1.3833 +			win.Activate();
  1.3834 +			CloseWindow(win2,handle2a,winGpId1);		//1 event
  1.3835 +			iQueueClient->iWs.Flush();
  1.3836 +			if (win2.Construct(winGp1,handle2b))
  1.3837 +				Failed();
  1.3838 +			win2.Activate();
  1.3839 +			CloseWindow(win1,handle1a,winGpId1);		//1 event
  1.3840 +			iQueueClient->iWs.Flush();
  1.3841 +			CloseWindow(win,handle,winGpId2);		//1 event
  1.3842 +			TheClient->iWs.Flush();
  1.3843 +			if (win1.Construct(win2,handle1b))
  1.3844 +				Failed();
  1.3845 +			win1.Activate();
  1.3846 +			CloseWindow(win1,handle1b,winGpId1);		//1 event
  1.3847 +			iQueueClient->iWs.Flush();
  1.3848 +			CloseGroupWindow(winGp2,winGpId2);		//1 event
  1.3849 +			TheClient->iWs.Flush();
  1.3850 +			CloseWindow(win2,handle2b,winGpId1);		//1 event
  1.3851 +			iQueueClient->iWs.Flush();
  1.3852 +			CloseGroupWindow(winGp1,winGpId1);		//1 event
  1.3853 +			iQueueClient->iWs.Flush();
  1.3854 +			events=9;
  1.3855 +			}
  1.3856 +			break;
  1.3857 +		case 13:
  1.3858 +			{
  1.3859 +			TPckgBuf<TPointerEventInfo> pointerEventInfo;
  1.3860 +			pointerEventInfo().iClientHandle=reinterpret_cast<TInt>(iQueueClient->iWin);
  1.3861 +			pointerEventInfo().iWinGpId=iQueueClient->iGroup->GroupWin()->Identifier();
  1.3862 +			pointerEventInfo().iWinOrigin.SetXY(EWinPositionX,EWinPositionY);
  1.3863 +			pointerEventInfo().iParentOrigin.SetXY(0,0);
  1.3864 +			iClick.CommandReply(EClickPointerEvent,pointerEventInfo);
  1.3865 +			AddExpectedPointerDownUpScr(TPoint(43,18));
  1.3866 +			AddExpectedPointerDownUpScr(TPoint(43,17));
  1.3867 +			AddExpectedPointerDownUpScr(TPoint(42,52));
  1.3868 +			AddExpectedPointerDownUpScr(TPoint(24,27));
  1.3869 +			AddExpectedPointerDownUpScr(TPoint(94,26));
  1.3870 +			iQueueClient->iWs.Flush();
  1.3871 +			iTest->SimulatePointerDownUp(43,18+iYOffset);		//2 events
  1.3872 +			iTest->SimulatePointerDownUp(43,17+iYOffset);		//2 events
  1.3873 +			iTest->SimulatePointerDownUp(42,52+iYOffset);		//2 events
  1.3874 +			iTest->SimulatePointerDownUp(24,27+iYOffset);		//2 events
  1.3875 +			iTest->SimulatePointerDownUp(94,26+iYOffset);		//2 events
  1.3876 +			pointerEventInfo().iClientHandle=0;
  1.3877 +			pointerEventInfo().iWinGpId=0;
  1.3878 +			iClick.CommandReply(EClickPointerEvent,pointerEventInfo);
  1.3879 +			events=10;
  1.3880 +			}
  1.3881 +			break;
  1.3882 +		default:
  1.3883 +			iAddToClick=EFalse;
  1.3884 +			if (!SetClickType(EClickNone))
  1.3885 +				CActiveScheduler::Stop();
  1.3886 +			return;
  1.3887 +		}
  1.3888 +	TInt failedAt=iClick.CommandReply(EClickFailed,TPtrC8(NULL,0));
  1.3889 +	TInt eventsDone=iClick.CommandReply(EClickEvents,TPtrC8(NULL,0));
  1.3890 +	if (failedAt!=0 || eventsDone!=events)		//iEventSet (already incremented)
  1.3891 +		{
  1.3892 +	#if defined(LOGGING)
  1.3893 +		_LIT(KeyClickFailed,"KeyClick Failed EventSet=%d FailedAt=%d TotalEvents=%d EventsDone=%d");
  1.3894 +		logMessageText.Format(KeyClickFailed,iEventSet-1,failedAt,events,eventsDone);
  1.3895 +		INFO_PRINTF1(logMessageText);
  1.3896 +	#endif
  1.3897 +		Failed();
  1.3898 +		}
  1.3899 +	iClick.CommandReply(EClickReset,TPtrC8(NULL,0));
  1.3900 +	}
  1.3901 +
  1.3902 +void CTEventTest::CaptureLong_NextSetOfEventsL()
  1.3903 +	{
  1.3904 +	#if defined(LOGGING)
  1.3905 +		TLogMessageText logMessageText;
  1.3906 +		_LIT(KSet,"CaptureLong SetOfEvents: %d of 23");
  1.3907 +		logMessageText.Format(KSet,iEventSet);
  1.3908 +		INFO_PRINTF1(logMessageText);
  1.3909 +	#endif
  1.3910 +
  1.3911 +	switch(iEventSet++)
  1.3912 +		{
  1.3913 +		case 0:
  1.3914 +			iQueueClient->iWs.Flush();
  1.3915 +			iTest->SimulateKeyDownUp('A');
  1.3916 +			AddExpectedEvent(EEventFocusGained);
  1.3917 +			AddExpectedKeyDownUp('A','a');
  1.3918 +			break;
  1.3919 +		case 1:
  1.3920 +			// Test CaptureLongKey() with modifier value EModifierShift and flag value ELongCaptureNormal
  1.3921 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',EModifierShift,EModifierShift,2,ELongCaptureNormal);
  1.3922 +			iQueueClient->iWs.Flush();
  1.3923 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift);
  1.3924 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.3925 +			TheClient->iWs.Flush();
  1.3926 +			DelayForRepeatEvents(1, 3);
  1.3927 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.3928 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
  1.3929 +			AddExpectedKey(EEventKeyDown,EStdKeyLeftShift);
  1.3930 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.3931 +			AddExpectedKey(EEventKey,EStdKeySpace,' ',0,EModifierLeftShift|EModifierShift|EModifierAutorepeatable);
  1.3932 +			AddExpectedKey(EEventKey,EStdKeySpace,'a',1,EModifierLongKey|EModifierLeftShift|EModifierShift|EModifierAutorepeatable);
  1.3933 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.3934 +			AddExpectedKey(EEventKeyUp,EStdKeyLeftShift);
  1.3935 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.3936 +			break;
  1.3937 +		case 2:	
  1.3938 +			// Test CaptureLongKey() with modifier value EModifierFunc and flag value ELongCaptureWaitShort
  1.3939 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc,EModifierFunc,2,ELongCaptureWaitShort);
  1.3940 +			iQueueClient->iWs.Flush();
  1.3941 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
  1.3942 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter);
  1.3943 +			TheClient->iWs.Flush();
  1.3944 +			DelayForRepeatEvents(1, 3);
  1.3945 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter);
  1.3946 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
  1.3947 +			iTest->SimulateKeyDownUp(EStdKeySpace);
  1.3948 +			AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc);
  1.3949 +			AddExpectedKey(EEventKeyDown,EStdKeyEnter);
  1.3950 +			AddExpectedKey(EEventKey,EStdKeyEnter,'a',1,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierAutorepeatable);
  1.3951 +			AddExpectedKey(EEventKeyUp,EStdKeyEnter);
  1.3952 +			AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc);
  1.3953 +			AddExpectedKeyDownUp(EStdKeySpace,' ');
  1.3954 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.3955 +			break;
  1.3956 +		case 3:
  1.3957 +			// Test CaptureLongKey() with modifier values EModifierFunc|EModifierAlt and flag values ELongCaptureNormal|ELongCaptureRepeatEvents)
  1.3958 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc|EModifierAlt,EModifierFunc|EModifierAlt,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  1.3959 +			iQueueClient->iWs.Flush();
  1.3960 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
  1.3961 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftAlt);
  1.3962 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter);
  1.3963 +			TheClient->iWs.Flush();
  1.3964 +			DelayForRepeatEvents(5, 1);
  1.3965 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter);
  1.3966 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftAlt);
  1.3967 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
  1.3968 +			AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc);
  1.3969 +			AddExpectedKey(EEventKeyDown,EStdKeyLeftAlt);
  1.3970 +			AddExpectedKey(EEventKeyDown,EStdKeyEnter);
  1.3971 +			AddExpectedKey(EEventKey,EStdKeyEnter,EKeyEnter,0,EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable);
  1.3972 +			AddExpectedKey(EEventKey,EStdKeyEnter,'a',2,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable);
  1.3973 +			AddExpectedKey(EEventKeyUp,EStdKeyEnter);
  1.3974 +			AddExpectedKey(EEventKeyUp,EStdKeyLeftAlt);
  1.3975 +			AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc);
  1.3976 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.3977 +			break;
  1.3978 +		case 4:
  1.3979 +			iQueueClient->iWs.Flush();
  1.3980 +			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  1.3981 +			TheClient->iWs.Flush();
  1.3982 +			DelayForRepeatEvents(3, 1);
  1.3983 +			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  1.3984 +			TheClient->iWs.Flush();
  1.3985 +			DelayForRepeatEvents(2, 1);
  1.3986 +			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  1.3987 +			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  1.3988 +			AddExpectedKey(EEventKeyDown,'Z');
  1.3989 +			AddExpectedKey(EEventKey,'Z','z');
  1.3990 +			AddExpectedKey(EEventKey,'Z','z',1);
  1.3991 +			AddExpectedKey(EEventKeyDown,'Y');
  1.3992 +			AddExpectedKey(EEventKey,'Y','y');
  1.3993 +			AddExpectedKey(EEventKey,'Y','y',1);
  1.3994 +			AddExpectedKey(EEventKeyUp,'Z');
  1.3995 +			AddExpectedKey(EEventKeyUp,'Y');
  1.3996 +			break;
  1.3997 +		case 5:
  1.3998 +			iQueueClient->iWs.Flush();
  1.3999 +			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  1.4000 +			TheClient->iWs.Flush();
  1.4001 +			DelayForRepeatEvents(3, 1);
  1.4002 +			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  1.4003 +			TheClient->iWs.Flush();
  1.4004 +			DelayForRepeatEvents(5, 2);
  1.4005 +			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  1.4006 +			TheClient->iWs.Flush();
  1.4007 +			DelayForRepeatEvents(2, 1);
  1.4008 +			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  1.4009 +			AddExpectedKey(EEventKeyDown,'Z');
  1.4010 +			AddExpectedKey(EEventKey,'Z','z');
  1.4011 +			AddExpectedKey(EEventKey,'Z','z',1);
  1.4012 +			AddExpectedKey(EEventKeyDown,'Y');
  1.4013 +			AddExpectedKey(EEventKey,'Y','y');
  1.4014 +			AddExpectedKey(EEventKey,'Y','y',1);
  1.4015 +			AddExpectedKey(EEventKeyUp,'Y');
  1.4016 +			AddExpectedKey(EEventKey,'Z','z',1);
  1.4017 +			AddExpectedKey(EEventKeyUp,'Z');
  1.4018 +			break;
  1.4019 +		case 6:
  1.4020 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal);
  1.4021 +			iQueueClient->iWs.Flush();
  1.4022 +			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  1.4023 +			TheClient->iWs.Flush();
  1.4024 +			DelayForRepeatEvents(3, 1);
  1.4025 +			iTest->SimulateKeyDownUp(EStdKeySpace);
  1.4026 +			TheClient->iWs.Flush();
  1.4027 +			if(!iTest->IsFullRomL())
  1.4028 +				{
  1.4029 +				DelayForRepeatEvents(2, 1);
  1.4030 +				}
  1.4031 +			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  1.4032 +			AddExpectedKey(EEventKeyDown,'X');
  1.4033 +			AddExpectedKey(EEventKey,'X','x');
  1.4034 +			AddExpectedKey(EEventKey,'X','x',1);
  1.4035 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.4036 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.4037 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.4038 +			if(!iTest->IsFullRomL())
  1.4039 +				{
  1.4040 +				AddExpectedKey(EEventKey,'X','x',1);
  1.4041 +				}
  1.4042 +			AddExpectedKey(EEventKeyUp,'X');
  1.4043 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4044 +			break;
  1.4045 +		case 7:
  1.4046 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  1.4047 +			iQueueClient->iWs.Flush();
  1.4048 +			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  1.4049 +			TheClient->iWs.Flush();
  1.4050 +			DelayForRepeatEvents(5, 1);
  1.4051 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.4052 +			TheClient->iWs.Flush();
  1.4053 +			DelayForRepeatEvents(1, 3);
  1.4054 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.4055 +			TheClient->iWs.Flush();
  1.4056 +			User::ResetInactivityTime();
  1.4057 +			DelayForRepeatEvents(4, 1);
  1.4058 +			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  1.4059 +			AddExpectedKey(EEventKeyDown,'X');
  1.4060 +			AddExpectedKey(EEventKey,'X','x');
  1.4061 +			AddExpectedKey(EEventKey,'X','x',1);
  1.4062 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.4063 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.4064 +			AddExpectedKey(EEventKey,EStdKeySpace,'b',1);
  1.4065 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.4066 +			AddExpectedKey(EEventKey,'X','x',1);
  1.4067 +			AddExpectedKey(EEventKeyUp,'X');
  1.4068 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4069 +			break;
  1.4070 +		case 8:
  1.4071 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','c',0,0,2,ELongCaptureRepeatEvents);
  1.4072 +			iQueueClient->iWs.Flush();
  1.4073 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.4074 +			TheClient->iWs.Flush();
  1.4075 +			DelayForRepeatEvents(5, 1);
  1.4076 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.4077 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.4078 +			AddExpectedKey(EEventKey,EStdKeySpace,'c',1);
  1.4079 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.4080 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4081 +			break;
  1.4082 +		case 9:
  1.4083 +			{
  1.4084 +			TInt captureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEscape,'e',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  1.4085 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','d',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  1.4086 +			iQueueClient->iWs.Flush();
  1.4087 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.4088 +			TheClient->iWs.Flush();
  1.4089 +			DelayForRepeatEvents(5, 2);
  1.4090 +			iTest->SimulateKeyDownUp(EStdKeyEscape);
  1.4091 +			TheClient->iWs.Flush();
  1.4092 +			DelayForRepeatEvents(3, 1);
  1.4093 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.4094 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.4095 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.4096 +			AddExpectedKey(EEventKey,EStdKeySpace,'d',1);
  1.4097 +			AddExpectedKey(EEventKeyDown,EStdKeyEscape);
  1.4098 +			AddExpectedKey(EEventKey,EStdKeyEscape,EKeyEscape);
  1.4099 +			AddExpectedKey(EEventKeyUp,EStdKeyEscape);
  1.4100 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.4101 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4102 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(captureKey);
  1.4103 +			}
  1.4104 +			break;
  1.4105 +		case 10:
  1.4106 +			//Cancel a long capture key event whilst a repeat is underway
  1.4107 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  1.4108 +			iQueueClient->iWs.Flush();
  1.4109 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.4110 +			TheClient->iWs.Flush();
  1.4111 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4112 +			DelayForRepeatEvents(5, 1);
  1.4113 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.4114 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.4115 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.4116 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.4117 +			break;
  1.4118 +		case 11:
  1.4119 +			// Cancel a key up/down capture whilst a repeat is underway.
  1.4120 +			// This should have no effect since only key press events are
  1.4121 +			// repeated.
  1.4122 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns('X',0,0);
  1.4123 +			iQueueClient->iWs.Flush();
  1.4124 +			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  1.4125 +			TheClient->iWs.Flush();
  1.4126 +			iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
  1.4127 +			DelayForRepeatEvents(5, 1);
  1.4128 +			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  1.4129 +			AddExpectedKey(EEventKeyDown,'X');
  1.4130 +			AddExpectedKey(EEventKey,'X','x');
  1.4131 +			AddExpectedKey(EEventKey,'X','x',2);
  1.4132 +			AddExpectedKey(EEventKeyUp,'X');
  1.4133 +			break;
  1.4134 +		case 12:
  1.4135 +			//Cancel a capture key event whilst a repeat is underway
  1.4136 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('y',0,0);
  1.4137 +			iQueueClient->iWs.Flush();
  1.4138 +			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  1.4139 +			TheClient->iWs.Flush();
  1.4140 +			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  1.4141 +			DelayForRepeatEvents(5, 1);
  1.4142 +			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  1.4143 +			AddExpectedKey(EEventKeyDown,'Y');
  1.4144 +			AddExpectedKey(EEventKey,'Y','y');
  1.4145 +			AddExpectedKey(EEventKeyUp,'Y');
  1.4146 +			break;
  1.4147 +		case 13:
  1.4148 +			//Variation on case 12 i.e. change in the timing of the CancelCaptureKey call
  1.4149 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('z',0,0);
  1.4150 +			iQueueClient->iWs.Flush();
  1.4151 +			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  1.4152 +			TheClient->iWs.Flush();
  1.4153 +			DelayForRepeatEvents(5, 2);
  1.4154 +			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  1.4155 +			DelayForRepeatEvents(5, 2);
  1.4156 +			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  1.4157 +			AddExpectedKey(EEventKeyDown,'Z');
  1.4158 +			AddExpectedKey(EEventKey,'Z','z');
  1.4159 +			AddExpectedKey(EEventKey,'Z','z',2);
  1.4160 +			AddExpectedKey(EEventKeyUp,'Z');
  1.4161 +			break;
  1.4162 +		case 14:
  1.4163 +			{
  1.4164 +	    	// Cancel long capture key event when normal capture key is scheduled for different
  1.4165 +	    	// window group.
  1.4166 +			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal);
  1.4167 +			TInt shortCaptKey = TheClient->iGroup->GroupWin()->CaptureKey(' ',0,0);
  1.4168 +
  1.4169 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.4170 +			TheClient->iWs.Flush();
  1.4171 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4172 +			DelayForRepeatEvents(1, 3);
  1.4173 +
  1.4174 +			TheClient->iGroup->GroupWin()->CancelCaptureKey(shortCaptKey);
  1.4175 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.4176 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.4177 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.4178 +			}
  1.4179 +			break;
  1.4180 +		case 15:
  1.4181 +			// @SYMPREQ 417-61800: Check that long key events are marked with
  1.4182 +			// EModifierLongKey and short events are not.
  1.4183 +			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, 0, ELongCaptureNormal);
  1.4184 +			iQueueClient->iWs.Flush();
  1.4185 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'M');
  1.4186 +			TheClient->iWs.Flush();
  1.4187 +			DelayForRepeatEvents(1, 3);
  1.4188 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'M');
  1.4189 +			AddExpectedKey(EEventKeyDown, 'M', 0, 0, 0);
  1.4190 +			AddExpectedKey(EEventKey, 'M', 'm', 0, EModifierAutorepeatable);
  1.4191 +			AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable);
  1.4192 +			AddExpectedKey(EEventKeyUp, 'M', 0, 0, 0);
  1.4193 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4194 +			break;
  1.4195 +		case 16:
  1.4196 +			CheckLongkeyCaptureWithPriority(ELongkeyCaptureDiffPriority);
  1.4197 +			break;
  1.4198 +		case 17:
  1.4199 +			CheckLongkeyCaptureWithPriority(ELongkeyCaptureSamePriority);
  1.4200 +			break;
  1.4201 +		case 18:
  1.4202 +			// Test CaptureLongKey() with flag value ELongCaptureWaitShort
  1.4203 +			// when key is not held down long enough to generate a long event.
  1.4204 +			// Verify that short event is delivered when the key is released.
  1.4205 +			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('p', 'p', 0, 0, 0, ELongCaptureWaitShort);
  1.4206 +			iQueueClient->iWs.Flush();
  1.4207 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'P');
  1.4208 +			TheClient->iWs.Flush();
  1.4209 +			User::After(iKeyBoardRepeatInitialDelay.Int() / 2);
  1.4210 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'P');
  1.4211 +			TheClient->iWs.Flush();
  1.4212 +			iTest->SimulateKeyDownUp(EStdKeySpace);
  1.4213 +			AddExpectedKey(EEventKeyDown, 'P');
  1.4214 +			AddExpectedKey(EEventKey, 'P', 'p', 0, EModifierAutorepeatable);
  1.4215 +			AddExpectedKey(EEventKeyUp, 'P');
  1.4216 +			AddExpectedKeyDownUp(EStdKeySpace, ' ');
  1.4217 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4218 +			break;
  1.4219 +		case 19:
  1.4220 +			{
  1.4221 +			// Cancel a capture key event whilst a repeat is underway for a
  1.4222 +			// different capture. This should not cancel repeating.
  1.4223 +			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('q', 0, 0);
  1.4224 +			TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureKey('r', 0, 0);
  1.4225 +			iQueueClient->iWs.Flush();
  1.4226 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'Q');
  1.4227 +			TheClient->iWs.Flush();
  1.4228 +			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(captureKey2);
  1.4229 +			DelayForRepeatEvents(5, 1);
  1.4230 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'Q');
  1.4231 +			AddExpectedKey(EEventKeyDown, 'Q');
  1.4232 +			AddExpectedKey(EEventKey, 'Q', 'q', 0, EModifierAutorepeatable);
  1.4233 +			AddExpectedKey(EEventKey, 'Q', 'q', 2, EModifierAutorepeatable);
  1.4234 +			AddExpectedKey(EEventKeyUp, 'Q');
  1.4235 +			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  1.4236 +			}
  1.4237 +			break;
  1.4238 +		case 20:
  1.4239 +			{
  1.4240 +			// Cancel a long capture key event whilst a repeat is underway for
  1.4241 +			// a different capture. This should not cancel repeating.
  1.4242 +			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('s', 's', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents);
  1.4243 +			TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureLongKey('t', 't', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents);
  1.4244 +			iQueueClient->iWs.Flush();
  1.4245 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'S');
  1.4246 +			TheClient->iWs.Flush();
  1.4247 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(captureKey2);
  1.4248 +			DelayForRepeatEvents(5, 1);
  1.4249 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'S');
  1.4250 +			AddExpectedKey(EEventKeyDown, 'S');
  1.4251 +			AddExpectedKey(EEventKey, 'S', 's', 0, EModifierAutorepeatable);
  1.4252 +			AddExpectedKey(EEventKey, 'S', 's', 2, EModifierLongKey | EModifierAutorepeatable);
  1.4253 +			AddExpectedKey(EEventKeyUp, 'S');
  1.4254 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4255 +			}
  1.4256 +			break;
  1.4257 +		case 21:
  1.4258 +			{
  1.4259 +			// Test CaptureLongKey() with a user specified initial repeat time.
  1.4260 +			// Simulate holding down the key for a period shorter than the
  1.4261 +			// specified delay. Verify that a long key event is NOT generated.
  1.4262 +			// (Note that the period is longer than the default initial repeat
  1.4263 +			// time, thus proving that CaptureLongKey() has honoured the delay
  1.4264 +			// argument.)
  1.4265 +			TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() * 4);
  1.4266 +			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'u', 'u', 0, 0, 0, ELongCaptureNormal);
  1.4267 +			iQueueClient->iWs.Flush();
  1.4268 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'U');
  1.4269 +			TheClient->iWs.Flush();
  1.4270 +			User::After(delay.Int() / 2);
  1.4271 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'U');
  1.4272 +			TheClient->iWs.Flush();
  1.4273 +			iTest->SimulateKeyDownUp(EStdKeySpace);
  1.4274 +			AddExpectedKey(EEventKeyDown, 'U');
  1.4275 +			AddExpectedKey(EEventKey, 'U', 'u', 0, EModifierAutorepeatable);
  1.4276 +			AddExpectedKey(EEventKeyUp, 'U');
  1.4277 +			AddExpectedKeyDownUp(EStdKeySpace, ' ');
  1.4278 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4279 +			}
  1.4280 +			break;
  1.4281 +		case 22:
  1.4282 +			{
  1.4283 +			// Test CaptureLongKey() with a user specified initial repeat time.
  1.4284 +			// Simulate holding down the key for a period longer than the
  1.4285 +			// specified delay. Verify that a long key event is generated.
  1.4286 +			// (Note that the period is shorter than the default initial repeat
  1.4287 +			// time, thus proving that CaptureLongKey() has honoured the delay
  1.4288 +			// argument.)
  1.4289 +			TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() / 4);
  1.4290 +			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'v', 'v', 0, 0, 0, ELongCaptureNormal);
  1.4291 +			iQueueClient->iWs.Flush();
  1.4292 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'V');
  1.4293 +			TheClient->iWs.Flush();
  1.4294 +			User::After(delay.Int() * 2);
  1.4295 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'V');
  1.4296 +			TheClient->iWs.Flush();
  1.4297 +			iTest->SimulateKeyDownUp(EStdKeySpace);
  1.4298 +			AddExpectedKey(EEventKeyDown, 'V');
  1.4299 +			AddExpectedKey(EEventKey, 'V', 'v', 0, EModifierAutorepeatable);
  1.4300 +			AddExpectedKey(EEventKey, 'V', 'v', 1, EModifierLongKey | EModifierAutorepeatable);
  1.4301 +			AddExpectedKey(EEventKeyUp, 'V');
  1.4302 +			AddExpectedKeyDownUp(EStdKeySpace, ' ');
  1.4303 +			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4304 +			}
  1.4305 +			break;
  1.4306 +		default:
  1.4307 +			CActiveScheduler::Stop();
  1.4308 +			break;
  1.4309 +		}
  1.4310 +	TheClient->iWs.Flush();
  1.4311 +	}
  1.4312 +
  1.4313 +/** Function used for checking CaptureLongKey() works fine with different priorities.
  1.4314 +
  1.4315 +If two window groups have requested capture of the same key with different priorities, 
  1.4316 +then the event should be delivered to the group that specified higher priority 
  1.4317 +(even if it is in the background).
  1.4318 +
  1.4319 +If two window groups have requested capture of the same key with same priorities,
  1.4320 +then the event should be delivered to the group that requested capture most recently.
  1.4321 +
  1.4322 +@param aTestType Enum value specifying test with same priority or with different priority
  1.4323 +*/
  1.4324 +void CTEventTest::CheckLongkeyCaptureWithPriority(TLongkeyCapPriorityTests aTestType)
  1.4325 +	{
  1.4326 +	TInt ordinalPriority = TheClient->iGroup->GroupWin()->OrdinalPriority();
  1.4327 +	TInt ordinalPosition = TheClient->iGroup->GroupWin()->OrdinalPosition();
  1.4328 +	// Bring other window group to foreground and request capture with lower/same priority
  1.4329 +	// And request capture from iQueueClient group window with higher priority
  1.4330 +	TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, 10);
  1.4331 +	TInt capKeyFrontWin = TheClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, (aTestType == ELongkeyCaptureDiffPriority ? KLongKeyCaptureLowPriority : KLongKeyCaptureHighPriority), ELongCaptureNormal);
  1.4332 +	iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, KLongKeyCaptureHighPriority, ELongCaptureNormal);
  1.4333 +	iQueueClient->iWs.Flush();
  1.4334 +	iTest->SimulateKey(TRawEvent::EKeyDown, 'M');
  1.4335 +	TheClient->iWs.Flush();
  1.4336 +	DelayForRepeatEvents(1, 3);
  1.4337 +	iTest->SimulateKey(TRawEvent::EKeyUp, 'M');
  1.4338 +	AddExpectedEvent(EEventFocusLost);
  1.4339 +	//Note: Button down/up events along with immediate key events are not delivered to iQueueCLient's window group
  1.4340 +	//as they are sent to foreground/focused window group
  1.4341 +	AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable);
  1.4342 +	iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.4343 +	TheClient->iGroup->GroupWin()->CancelCaptureLongKey(capKeyFrontWin);
  1.4344 +	TheClient->iGroup->GroupWin()->SetOrdinalPosition(ordinalPosition, ordinalPriority);
  1.4345 +	AddExpectedEvent(EEventFocusGained);
  1.4346 +	}
  1.4347 +
  1.4348 +/** Function used for delaying current thread so that repeat events can be generated.
  1.4349 +
  1.4350 +It uses iKeyBoardRepeatInitialDelay and iKeyBoardRepeatNextDelay variables to get the desired delay.
  1.4351 +The idea is to wait for initial delay + some extra value so that first repeat is generated.
  1.4352 +For more than one repeat events, wait will be initial delay + next delay + some extra value, and so on.
  1.4353 +
  1.4354 +The extra value is taken as fraction of iKeyBoardRepeatNextDelay.
  1.4355 +
  1.4356 +@param aNumeratorFracVal Numerator value of the fraction.
  1.4357 +@param aDenominatorFracVal Denominator value of the fraction.
  1.4358 +*/
  1.4359 +void CTEventTest::DelayForRepeatEvents(TInt aNumeratorFracVal, TInt aDenominatorFracVal)
  1.4360 +	{
  1.4361 +	if (!aNumeratorFracVal || !aDenominatorFracVal)
  1.4362 +		return;
  1.4363 +	User::After(iKeyBoardRepeatInitialDelay.Int() + (iKeyBoardRepeatNextDelay.Int()*aNumeratorFracVal/aDenominatorFracVal));
  1.4364 +	}
  1.4365 +
  1.4366 +#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
  1.4367 +void CTEventTest::KeyEventTranslation_NextSetOfEventsL()
  1.4368 +	{
  1.4369 +	TTimeIntervalMicroSeconds32 initialTime;
  1.4370 +	TTimeIntervalMicroSeconds32 time;
  1.4371 +	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
  1.4372 +
  1.4373 +	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
  1.4374 +
  1.4375 +	#if defined(LOGGING)
  1.4376 +		TLogMessageText logMessageText;
  1.4377 +		_LIT(KSet,"KeyEventTranslation SetOfEvents: %d of 5");
  1.4378 +		logMessageText.Format(KSet,iEventSet);
  1.4379 +		INFO_PRINTF1(logMessageText);
  1.4380 +	#endif
  1.4381 +
  1.4382 +	switch (iEventSet++)
  1.4383 +		{
  1.4384 +		case 0:
  1.4385 +			iQueueClient->iWs.Flush();
  1.4386 +			iTest->SimulateKeyDownUp('A');
  1.4387 +			AddExpectedEvent(EEventFocusGained);
  1.4388 +			AddExpectedKeyDownUp('A','a');
  1.4389 +			break;
  1.4390 +		case 1:
  1.4391 +			// Test key event translation using CaptureKey()
  1.4392 +			iCaptureKey = wg->CaptureKey(EKeyDevice0, 0, 0);
  1.4393 +			TEST(iCaptureKey >= 0);
  1.4394 +			iQueueClient->iWs.Flush();
  1.4395 +			iTest->SimulateKeyDownUp(EStdKeyDevice1);
  1.4396 +			TheClient->iWs.Flush();
  1.4397 +			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
  1.4398 +			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 0);
  1.4399 +			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
  1.4400 +			wg->CancelCaptureKey(iCaptureKey);
  1.4401 +			break;
  1.4402 +		case 2:
  1.4403 +			// Test key event translation using CaptureKeyUpAndDowns()
  1.4404 +			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice0, 0, 0);
  1.4405 +			TEST(iCaptureKey >= 0);
  1.4406 +			iQueueClient->iWs.Flush();
  1.4407 +			iTest->SimulateKeyDownUp(EStdKeyDevice1);
  1.4408 +			TheClient->iWs.Flush();
  1.4409 +			AddExpectedKey(EEventKeyDown, EStdKeyDevice0, 0, 0);
  1.4410 +			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0);
  1.4411 +			AddExpectedKey(EEventKeyUp, EStdKeyDevice0, 0, 0);
  1.4412 +			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
  1.4413 +			break;
  1.4414 +		case 3:
  1.4415 +			// Test key event translation using CaptureLongKey()
  1.4416 +			iCaptureKey = wg->CaptureLongKey(EKeyDevice0, EKeyDevice0, 0, 0, 0, ELongCaptureNormal);
  1.4417 +			TEST(iCaptureKey >= 0);
  1.4418 +			iQueueClient->iWs.Flush();
  1.4419 +
  1.4420 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice1);
  1.4421 +			TheClient->iWs.Flush();
  1.4422 +			User::After(initialTime.Int() + time.Int() / 3);
  1.4423 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice1);
  1.4424 +			TheClient->iWs.Flush();
  1.4425 +
  1.4426 +			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
  1.4427 +			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0, EModifierAutorepeatable);
  1.4428 +			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 1, EModifierLongKey | EModifierAutorepeatable);
  1.4429 +			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
  1.4430 +
  1.4431 +			wg->CancelCaptureLongKey(iCaptureKey);
  1.4432 +			break;
  1.4433 +		case 4:
  1.4434 +			// Negative test: check that the capture key code listed in the
  1.4435 +			// translation table of the Key Routing Plug-in is not translated
  1.4436 +			// in the absence of any capture request for the mapped key.
  1.4437 +			iTest->SimulateKeyDownUp(EStdKeyDevice1);
  1.4438 +			TheClient->iWs.Flush();
  1.4439 +			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
  1.4440 +			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0);
  1.4441 +			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
  1.4442 +			break;
  1.4443 +		default:
  1.4444 +			CActiveScheduler::Stop();
  1.4445 +			break;
  1.4446 +		}
  1.4447 +
  1.4448 +	TheClient->iWs.Flush();
  1.4449 +	}
  1.4450 +
  1.4451 +void CTEventTest::KeyEventBlocking_NextSetOfEventsL()
  1.4452 +	{
  1.4453 +	TTimeIntervalMicroSeconds32 initialTime;
  1.4454 +	TTimeIntervalMicroSeconds32 time;
  1.4455 +	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
  1.4456 +
  1.4457 +	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
  1.4458 +
  1.4459 +	#if defined(LOGGING)
  1.4460 +		TLogMessageText logMessageText;
  1.4461 +		_LIT(KSet,"KeyEventBlocking SetOfEvents: %d of 5");
  1.4462 +		logMessageText.Format(KSet,iEventSet);
  1.4463 +		INFO_PRINTF1(logMessageText);
  1.4464 +	#endif
  1.4465 +
  1.4466 +	switch (iEventSet++)
  1.4467 +		{
  1.4468 +		case 0:
  1.4469 +			iQueueClient->iWs.Flush();
  1.4470 +			iTest->SimulateKeyDownUp('A');
  1.4471 +			AddExpectedEvent(EEventFocusGained);
  1.4472 +			AddExpectedKeyDownUp('A','a');
  1.4473 +			break;
  1.4474 +		case 1:
  1.4475 +			// Simulate pressing a blocked key (Device3) while no
  1.4476 +			// key capture is in effect.
  1.4477 +			iTest->SimulateKeyDownUp(EStdKeyDevice3);
  1.4478 +			iTest->SimulateKeyDownUp('B');
  1.4479 +			TheClient->iWs.Flush();
  1.4480 +			AddExpectedKeyDownUp('B','b');
  1.4481 +			break;
  1.4482 +		case 2:
  1.4483 +			// Use RWindowGroup::CaptureKey() to capture EKeyDevice3
  1.4484 +			// and simulate pressing the blocked key again.
  1.4485 +			iCaptureKey = wg->CaptureKey(EKeyDevice3, 0, 0);
  1.4486 +			TEST(iCaptureKey >= 0);
  1.4487 +			iQueueClient->iWs.Flush();
  1.4488 +			iTest->SimulateKeyDownUp(EStdKeyDevice3);
  1.4489 +			iTest->SimulateKeyDownUp('B');
  1.4490 +			TheClient->iWs.Flush();
  1.4491 +			AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 0);
  1.4492 +			AddExpectedKeyDownUp('B','b');
  1.4493 +			wg->CancelCaptureKey(iCaptureKey);
  1.4494 +			break;
  1.4495 +		case 3:
  1.4496 +			// Repeat using CaptureKeyUpAndDowns()
  1.4497 +			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice3, 0, 0);
  1.4498 +			TEST(iCaptureKey >= 0);
  1.4499 +			iQueueClient->iWs.Flush();
  1.4500 +			iTest->SimulateKeyDownUp(EStdKeyDevice3);
  1.4501 +			iTest->SimulateKeyDownUp('B');
  1.4502 +			TheClient->iWs.Flush();
  1.4503 +			AddExpectedKey(EEventKeyDown, EStdKeyDevice3, 0, 0);
  1.4504 +			AddExpectedKey(EEventKeyUp, EStdKeyDevice3, 0, 0);
  1.4505 +			AddExpectedKeyDownUp('B','b');
  1.4506 +			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
  1.4507 +			break;
  1.4508 +		case 4:
  1.4509 +			// Repeat using CaptureLongKey()
  1.4510 +			iCaptureKey = wg->CaptureLongKey(EKeyDevice3, EKeyDevice3, 0, 0, 0, ELongCaptureNormal);
  1.4511 +			TEST(iCaptureKey >= 0);
  1.4512 +			iQueueClient->iWs.Flush();
  1.4513 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice3);
  1.4514 +			TheClient->iWs.Flush();
  1.4515 +			User::After(initialTime.Int() + time.Int() / 3);
  1.4516 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice3);
  1.4517 +			iTest->SimulateKeyDownUp('B');
  1.4518 +			TheClient->iWs.Flush();
  1.4519 +			AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 1, EModifierLongKey | EModifierAutorepeatable);
  1.4520 +			AddExpectedKeyDownUp('B','b');
  1.4521 +			wg->CancelCaptureLongKey(iCaptureKey);
  1.4522 +			break;
  1.4523 +		default:
  1.4524 +			CActiveScheduler::Stop();
  1.4525 +			break;
  1.4526 +		}
  1.4527 +
  1.4528 +	TheClient->iWs.Flush();
  1.4529 +	}
  1.4530 +
  1.4531 +void CTEventTest::KeyEventAppRestriction_NextSetOfEventsL()
  1.4532 +	{
  1.4533 +	TTimeIntervalMicroSeconds32 initialTime;
  1.4534 +	TTimeIntervalMicroSeconds32 time;
  1.4535 +	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
  1.4536 +
  1.4537 +	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
  1.4538 +
  1.4539 +	#if defined(LOGGING)
  1.4540 +		TLogMessageText logMessageText;
  1.4541 +		_LIT(KSet,"KeyEventAppRestriction SetOfEvents: %d of 4");
  1.4542 +		logMessageText.Format(KSet,iEventSet);
  1.4543 +		INFO_PRINTF1(logMessageText);
  1.4544 +	#endif
  1.4545 +
  1.4546 +	switch (iEventSet++)
  1.4547 +		{
  1.4548 +		case 0:
  1.4549 +			// Make window group non-focusable so that it receives only
  1.4550 +			// keys that are captured and not those that are default-routed.
  1.4551 +			wg->EnableReceiptOfFocus(EFalse);
  1.4552 +			iQueueClient->iWs.Flush();
  1.4553 +			AddExpectedEvent(EEventFocusGained);
  1.4554 +			AddExpectedEvent(EEventFocusLost);
  1.4555 +			break;
  1.4556 +		case 1:
  1.4557 +			// Using RWindowGroup::CaptureKey(), attempt to capture a key
  1.4558 +			// that is restricted by UID to another application.
  1.4559 +			iCaptureKey = wg->CaptureKey(EKeyF20, 0, 0);
  1.4560 +			TEST(iCaptureKey == KErrPermissionDenied);
  1.4561 +			// Now capture a key that is restricted to the current
  1.4562 +			// application's UID and simulate pressing the restricted key.
  1.4563 +			iCaptureKey = wg->CaptureKey(EKeyF21, 0, 0);
  1.4564 +			TEST(iCaptureKey >= 0);
  1.4565 +			iQueueClient->iWs.Flush();
  1.4566 +			// Can't use SimulateKeyDownUp() here due to its check that scan
  1.4567 +			// codes are not in the range corresponding to lower case letters
  1.4568 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
  1.4569 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
  1.4570 +			TheClient->iWs.Flush();
  1.4571 +			AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 0);
  1.4572 +			wg->CancelCaptureKey(iCaptureKey);
  1.4573 +			break;
  1.4574 +		case 2:
  1.4575 +			// Repeat using CaptureKeyUpAndDowns()
  1.4576 +			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF20, 0, 0);
  1.4577 +			TEST(iCaptureKey == KErrPermissionDenied);
  1.4578 +			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF21, 0, 0);
  1.4579 +			TEST(iCaptureKey >= 0);
  1.4580 +			iQueueClient->iWs.Flush();
  1.4581 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
  1.4582 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
  1.4583 +			TheClient->iWs.Flush();
  1.4584 +			AddExpectedKey(EEventKeyDown, EStdKeyF21, 0, 0);
  1.4585 +			AddExpectedKey(EEventKeyUp, EStdKeyF21, 0, 0);
  1.4586 +			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
  1.4587 +			break;
  1.4588 +		case 3:
  1.4589 +			// Repeat using CaptureLongKey()
  1.4590 +			iCaptureKey = wg->CaptureLongKey(EKeyF20, EKeyF20, 0, 0, 0, ELongCaptureNormal);
  1.4591 +			TEST(iCaptureKey == KErrPermissionDenied);
  1.4592 +			iCaptureKey = wg->CaptureLongKey(EKeyF21, EKeyF21, 0, 0, 0, ELongCaptureNormal);
  1.4593 +			TEST(iCaptureKey >= 0);
  1.4594 +			iQueueClient->iWs.Flush();
  1.4595 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
  1.4596 +			TheClient->iWs.Flush();
  1.4597 +			User::After(initialTime.Int() + time.Int() / 3);
  1.4598 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
  1.4599 +			TheClient->iWs.Flush();
  1.4600 +			AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 1, EModifierLongKey | EModifierAutorepeatable);
  1.4601 +			wg->CancelCaptureLongKey(iCaptureKey);
  1.4602 +			break;
  1.4603 +		default:
  1.4604 +			CActiveScheduler::Stop();
  1.4605 +			break;
  1.4606 +		}
  1.4607 +
  1.4608 +	TheClient->iWs.Flush();
  1.4609 +	}
  1.4610 +
  1.4611 +void CTEventTest::KeyEventAppPriority_NextSetOfEventsL()
  1.4612 +	{
  1.4613 +	TTimeIntervalMicroSeconds32 initialTime;
  1.4614 +	TTimeIntervalMicroSeconds32 time;
  1.4615 +	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
  1.4616 +
  1.4617 +	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
  1.4618 +	TInt handle1 = 0;
  1.4619 +	TInt handle2 = 0;
  1.4620 +	TInt handle3 = 0;
  1.4621 +	TInt handle4 = 0;
  1.4622 +	TInt handle5 = 0;
  1.4623 +	TInt handle6 = 0;
  1.4624 +
  1.4625 +	#if defined(LOGGING)
  1.4626 +		TLogMessageText logMessageText;
  1.4627 +		_LIT(KSet,"KeyEventAppPriority SetOfEvents: %d of 5");
  1.4628 +		logMessageText.Format(KSet,iEventSet);
  1.4629 +		INFO_PRINTF1(logMessageText);
  1.4630 +	#endif
  1.4631 +
  1.4632 +	switch (iEventSet++)
  1.4633 +		{
  1.4634 +		case 0:
  1.4635 +			SpawnCaptureAppL(iCaptureApp1);
  1.4636 +			iQueueClient->iWs.Flush();
  1.4637 +			AddExpectedEvent(EEventFocusGained);
  1.4638 +			AddExpectedEvent(EEventFocusLost);
  1.4639 +			break;
  1.4640 +		case 1:
  1.4641 +			// Use RWindowGroup::CaptureKey() to capture EKeyF22
  1.4642 +			// and EKeyF23 with priority 0. Simulate pressing both
  1.4643 +			// keys. Since the current application has precedence by UID
  1.4644 +			// for capture of EKeyF22, it should receive that key
  1.4645 +			// but should not receive EKeyF23.
  1.4646 +			handle1 = wg->CaptureKey(EKeyF22, 0, 0);
  1.4647 +			handle2 = wg->CaptureKey(EKeyF23, 0, 0);
  1.4648 +			TEST(handle1 >= 0);
  1.4649 +			TEST(handle2 >= 0);
  1.4650 +			iQueueClient->iWs.Flush();
  1.4651 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
  1.4652 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
  1.4653 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
  1.4654 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
  1.4655 +			TheClient->iWs.Flush();
  1.4656 +			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0);
  1.4657 +			wg->CancelCaptureKey(handle1);
  1.4658 +			wg->CancelCaptureKey(handle2);
  1.4659 +			break;
  1.4660 +		case 2:
  1.4661 +			// Repeat using CaptureKeyUpAndDowns()
  1.4662 +			handle1 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0);
  1.4663 +			handle2 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0);
  1.4664 +			TEST(handle1 >= 0);
  1.4665 +			TEST(handle2 >= 0);
  1.4666 +			iQueueClient->iWs.Flush();
  1.4667 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
  1.4668 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
  1.4669 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
  1.4670 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
  1.4671 +			TheClient->iWs.Flush();
  1.4672 +			AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0);
  1.4673 +			AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0);
  1.4674 +			wg->CancelCaptureKeyUpAndDowns(handle1);
  1.4675 +			wg->CancelCaptureKeyUpAndDowns(handle2);
  1.4676 +			break;
  1.4677 +		case 3:
  1.4678 +			// Repeat using CaptureLongKey()
  1.4679 +			handle1 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal);
  1.4680 +			handle2 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal);
  1.4681 +			TEST(handle1 >= 0);
  1.4682 +			TEST(handle2 >= 0);
  1.4683 +			iQueueClient->iWs.Flush();
  1.4684 +
  1.4685 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
  1.4686 +			TheClient->iWs.Flush();
  1.4687 +			User::After(initialTime.Int() + time.Int() / 3);
  1.4688 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
  1.4689 +
  1.4690 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
  1.4691 +			TheClient->iWs.Flush();
  1.4692 +			User::After(initialTime.Int() + time.Int() / 3);
  1.4693 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
  1.4694 +			TheClient->iWs.Flush();
  1.4695 +
  1.4696 +			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable);
  1.4697 +			wg->CancelCaptureLongKey(handle1);
  1.4698 +			wg->CancelCaptureLongKey(handle2);
  1.4699 +			break;
  1.4700 +		case 4:
  1.4701 +			// Repeat with additional capture requests for improved code
  1.4702 +			// coverage. (Also verifies that UID-based precedence works even
  1.4703 +			// when another app makes the most recent capture request.)
  1.4704 +			// Spawn a second capture app so that requests occur in the
  1.4705 +			// following order:
  1.4706 +			// 1. CaptureApp1, priority 1 (outstanding)
  1.4707 +			// 2. Current App, priority 0, precedence by UID
  1.4708 +			// 3. CaptureApp2, priority 1
  1.4709 +			// Note that all three capture types are tested together here.
  1.4710 +			handle1 = wg->CaptureKey(EKeyF22, 0, 0);
  1.4711 +			handle2 = wg->CaptureKey(EKeyF23, 0, 0);
  1.4712 +			handle3 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0);
  1.4713 +			handle4 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0);
  1.4714 +			handle5 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal);
  1.4715 +			handle6 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal);
  1.4716 +			TEST(handle1 >= 0);
  1.4717 +			TEST(handle2 >= 0);
  1.4718 +			TEST(handle3 >= 0);
  1.4719 +			TEST(handle4 >= 0);
  1.4720 +			TEST(handle5 >= 0);
  1.4721 +			TEST(handle6 >= 0);
  1.4722 +			iQueueClient->iWs.Flush();
  1.4723 +
  1.4724 +			SpawnCaptureAppL(iCaptureApp2);
  1.4725 +
  1.4726 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
  1.4727 +			TheClient->iWs.Flush();
  1.4728 +			User::After(initialTime.Int() + time.Int() / 3);
  1.4729 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
  1.4730 +
  1.4731 +			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
  1.4732 +			TheClient->iWs.Flush();
  1.4733 +			User::After(initialTime.Int() + time.Int() / 3);
  1.4734 +			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
  1.4735 +			TheClient->iWs.Flush();
  1.4736 +
  1.4737 +			AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0);
  1.4738 +			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0);
  1.4739 +			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable);
  1.4740 +			AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0);
  1.4741 +			wg->CancelCaptureKey(handle1);
  1.4742 +			wg->CancelCaptureKey(handle2);
  1.4743 +			wg->CancelCaptureKeyUpAndDowns(handle3);
  1.4744 +			wg->CancelCaptureKeyUpAndDowns(handle4);
  1.4745 +			wg->CancelCaptureLongKey(handle5);
  1.4746 +			wg->CancelCaptureLongKey(handle6);
  1.4747 +			break;
  1.4748 +		default:
  1.4749 +			iCaptureApp1.Kill(KErrNone);
  1.4750 +			iCaptureApp2.Kill(KErrNone);
  1.4751 +			iCaptureApp1.Close();
  1.4752 +			iCaptureApp2.Close();
  1.4753 +			CActiveScheduler::Stop();
  1.4754 +			break;
  1.4755 +		}
  1.4756 +
  1.4757 +	TheClient->iWs.Flush();
  1.4758 +	}
  1.4759 +
  1.4760 +/**
  1.4761 +Spawn another application that will capture the keys EKeyF22 and
  1.4762 +EKeyF23 with high priority.
  1.4763 +
  1.4764 +@param aProcess		Process to create
  1.4765 +*/
  1.4766 +void CTEventTest::SpawnCaptureAppL(RProcess& aProcess)
  1.4767 +	{
  1.4768 +	_LIT(KCaptureApp, "tevent_captureapp.exe");
  1.4769 +	TInt error = aProcess.Create(KCaptureApp, KNullDesC);
  1.4770 +	if (error != KErrNone)
  1.4771 +		{
  1.4772 +#if defined(LOGGING)
  1.4773 +		TLogMessageText logMessageText;
  1.4774 +		_LIT(KLog, "Cannot create capture app - error %d");
  1.4775 +		logMessageText.Format(KLog, error);
  1.4776 +		INFO_PRINTF1(logMessageText);
  1.4777 +#endif
  1.4778 +		User::Leave(error);
  1.4779 +		}
  1.4780 +
  1.4781 +	// Make rendezvous request to capture app
  1.4782 +	TRequestStatus status;
  1.4783 +	aProcess.Rendezvous(status);
  1.4784 +	aProcess.Resume();
  1.4785 +
  1.4786 +	// Wait for capture app to make its capture requests
  1.4787 +	User::WaitForRequest(status);
  1.4788 +	TEST(status.Int() == KErrNone);
  1.4789 +	}
  1.4790 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
  1.4791 +
  1.4792 +#define PASSWORD_START_OF_DAY 4
  1.4793 +void CTEventTest::Password_NextSetOfEvents()
  1.4794 +	{
  1.4795 +	switch(iEventSet++)
  1.4796 +		{
  1.4797 +		case 0:
  1.4798 +			iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordAlwaysTriggerNow);
  1.4799 +			iQueueClient->iWs.PasswordEntered();
  1.4800 +			iTest->SimulateKeyDownUp('2');
  1.4801 +			iQueueClient->iWs.Flush();
  1.4802 +			AddExpectedEvent(EEventFocusGained);
  1.4803 +			AddExpectedEvent(EEventPassword);
  1.4804 +			AddExpectedKeyDownUp('2');
  1.4805 +			break;
  1.4806 +		case 1:
  1.4807 +			iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADayTriggerNow);
  1.4808 +			iQueueClient->iWs.PasswordEntered();
  1.4809 +			iTest->SimulateKeyDownUp('3');
  1.4810 +			iQueueClient->iWs.Flush();
  1.4811 +			AddExpectedEvent(EEventPassword);
  1.4812 +			AddExpectedKeyDownUp('3');
  1.4813 +			break;
  1.4814 +		case 2:
  1.4815 +			{
  1.4816 +			TTime time;
  1.4817 +			time.HomeTime();
  1.4818 +			TInt day=time.DayNoInMonth();
  1.4819 +			if (day==0)
  1.4820 +				day=5;
  1.4821 +			time-=TTimeIntervalDays(day);
  1.4822 +			time+=TTimeIntervalHours(PASSWORD_START_OF_DAY);
  1.4823 +			User::SetHomeTime(time);
  1.4824 +			iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADayTriggerNow);
  1.4825 +			iQueueClient->iWs.PasswordEntered();
  1.4826 +			iTest->SimulateKeyDownUp('3');
  1.4827 +			iQueueClient->iWs.Flush();
  1.4828 +			AddExpectedEvent(EEventPassword);
  1.4829 +			AddExpectedKeyDownUp('3');
  1.4830 +			time+=TTimeIntervalDays(day);
  1.4831 +			time-=TTimeIntervalHours(PASSWORD_START_OF_DAY);
  1.4832 +			User::SetHomeTime(time);
  1.4833 +			}
  1.4834 +			break;
  1.4835 +		case 3:
  1.4836 +			{
  1.4837 +			TTime time;
  1.4838 +			time.HomeTime();
  1.4839 +			TInt day=time.DayNoInMonth();
  1.4840 +			time-=TTimeIntervalDays(day);
  1.4841 +			time+=TTimeIntervalHours(PASSWORD_START_OF_DAY);
  1.4842 +			User::SetHomeTime(time);
  1.4843 +			iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADay);
  1.4844 +			iQueueClient->iWs.PasswordEntered();
  1.4845 +			iTest->SimulateEvent(TRawEvent::ESwitchOn);
  1.4846 +			iTest->SimulateKeyDownUp('3');
  1.4847 +			iQueueClient->iWs.Flush();
  1.4848 +			AddExpectedEvent(EEventPassword);
  1.4849 +			AddExpectedEvent(EEventSwitchOn);
  1.4850 +			AddExpectedKeyDownUp('3');
  1.4851 +			time+=TTimeIntervalDays(day);
  1.4852 +			time-=TTimeIntervalHours(PASSWORD_START_OF_DAY);
  1.4853 +			User::SetHomeTime(time);
  1.4854 +			}
  1.4855 +			break;
  1.4856 +		default:
  1.4857 +			CActiveScheduler::Stop();
  1.4858 +			break;
  1.4859 +		}
  1.4860 +	TheClient->iWs.Flush();
  1.4861 +	}
  1.4862 +
  1.4863 +void CTEventTest::GroupListChanged_NextSetOfEventsL()
  1.4864 +	{
  1.4865 +	_LIT(WindowGroup1,"WindowGroupName1");
  1.4866 +	_LIT(WindowGroup2,"WindowGroupName2");
  1.4867 +	switch(iEventSet++)
  1.4868 +		{
  1.4869 +		case 0:
  1.4870 +			{
  1.4871 +			_LIT(TestGroup3,"GroupListEvents3");
  1.4872 +			iQueueClient->EnableGroupListChangeEvents();
  1.4873 +			iEventTestGroup3=new(ELeave) CTWindowGroup(TheClient);
  1.4874 +			iEventTestGroup3->ConstructL();
  1.4875 +			iEventTestGroup3->GroupWin()->SetName(TestGroup3);
  1.4876 +			AddExpectedEvent(EEventFocusGained);
  1.4877 +			AddExpectedEvent(EEventFocusLost);
  1.4878 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4879 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4880 +			}
  1.4881 +			break;
  1.4882 +		case 1:
  1.4883 +			{
  1.4884 +			_LIT(TestGroup4,"GroupListEvents4");
  1.4885 +			iEventTestGroup4=new(ELeave) CTWindowGroup(TheClient);
  1.4886 +			iEventTestGroup4->ConstructL();
  1.4887 +			iEventTestGroup4->GroupWin()->SetName(TestGroup4);
  1.4888 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4889 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4890 +			}
  1.4891 +			break;
  1.4892 +		case 2:
  1.4893 +			iEventTestGroup3->GroupWin()->SetOrdinalPosition(0);
  1.4894 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4895 +			break;
  1.4896 +		case 3:
  1.4897 +			iEventTestGroup3->GroupWin()->SetOrdinalPosition(999);
  1.4898 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4899 +			break;
  1.4900 +		case 4:
  1.4901 +			iEventTestGroup4->GroupWin()->SetOrdinalPosition(999);
  1.4902 +			AddExpectedEvent(EEventFocusGained);
  1.4903 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4904 +            // Testcase for defect INC135635
  1.4905 +			// Since iWin has OrdinalPosition Zero (the front) clicking on it won't generate an 
  1.4906 +			// EEventWindowGroupListChanged event as there is no change in the order of the windows
  1.4907 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,11-EWinPositionY));
  1.4908 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,11-EWinPositionY));
  1.4909 +			SimulatePointer(TRawEvent::EButton1Down,20,11);
  1.4910 +			SimulatePointer(TRawEvent::EButton1Up,20,11);
  1.4911 +			break;
  1.4912 +		case 5:
  1.4913 +			iEventTestGroup3->GroupWin()->SetOrdinalPosition(999);
  1.4914 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4915 +			break;
  1.4916 +		case 6:
  1.4917 +			iEventTestGroup3->GroupWin()->SetOrdinalPosition(99);
  1.4918 +			SimulatePointer(TRawEvent::EButton1Down,20,11);
  1.4919 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup1);
  1.4920 +			AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,11-EWinPositionY));
  1.4921 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4922 +			break;
  1.4923 +		case 7:
  1.4924 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup2);
  1.4925 +			SimulatePointer(TRawEvent::EButton1Up,10,20);
  1.4926 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4927 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY));
  1.4928 +			break;
  1.4929 +		case 8:
  1.4930 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup1);
  1.4931 +			SimulatePointer(TRawEvent::EButton2Down,20,30);
  1.4932 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4933 +			AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(20-EWinPositionX,30-EWinPositionY));
  1.4934 +			break;
  1.4935 +		case 9:
  1.4936 +			SimulatePointer(TRawEvent::EButton1Up,15,15);
  1.4937 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup2);
  1.4938 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,15-EWinPositionY));
  1.4939 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4940 +			break;
  1.4941 +		case 10:
  1.4942 +			SimulatePointer(TRawEvent::EButton2Down,25,20);
  1.4943 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup2);
  1.4944 +			SimulatePointer(TRawEvent::EButton1Up,15,20);
  1.4945 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup1);
  1.4946 +			AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(25-EWinPositionX,20-EWinPositionY));
  1.4947 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,20-EWinPositionY));
  1.4948 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4949 +			break;
  1.4950 +		case 11:
  1.4951 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup1);
  1.4952 +			SimulatePointer(TRawEvent::EButton2Down,12,12);
  1.4953 +			iEventTestGroup3->GroupWin()->SetName(WindowGroup2);
  1.4954 +			SimulatePointer(TRawEvent::EButton1Up,12,12);
  1.4955 +			AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(12-EWinPositionX,12-EWinPositionY));
  1.4956 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4957 +			AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(12-EWinPositionX,12-EWinPositionY));
  1.4958 +			break;
  1.4959 +		case 12:
  1.4960 +			delete iEventTestGroup3;
  1.4961 +			iEventTestGroup3=NULL;
  1.4962 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4963 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4964 +			break;
  1.4965 +		case 13:
  1.4966 +			delete iEventTestGroup4;
  1.4967 +			iEventTestGroup4=NULL;
  1.4968 +			AddExpectedEvent(EEventWindowGroupsChanged);
  1.4969 +			AddExpectedEvent(EEventWindowGroupListChanged);
  1.4970 +			break;
  1.4971 +		default:
  1.4972 +			CActiveScheduler::Stop();
  1.4973 +			break;
  1.4974 +		}
  1.4975 +	TheClient->iWs.Flush();
  1.4976 +	}
  1.4977 +
  1.4978 +TInt CTEventTest::KeyRepeatTime() const
  1.4979 +	{
  1.4980 +	TTimeIntervalMicroSeconds32 initialTime;
  1.4981 +	TTimeIntervalMicroSeconds32 time;
  1.4982 +	TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
  1.4983 +	return(initialTime.Int());
  1.4984 +	}
  1.4985 +
  1.4986 +void CTEventTest::RepeatableKeysL()
  1.4987 +	{
  1.4988 +	// repeatable key event
  1.4989 +	TKeyEvent repKeyEvent; 
  1.4990 +	repKeyEvent.iCode='J';
  1.4991 +	repKeyEvent.iScanCode=0;
  1.4992 +	repKeyEvent.iModifiers=EModifierAutorepeatable;
  1.4993 +	repKeyEvent.iRepeats=0;
  1.4994 +	
  1.4995 +	// non-repeatable key event
  1.4996 +	TKeyEvent keyEvent; 
  1.4997 +	keyEvent.iCode='J';
  1.4998 +	keyEvent.iScanCode=0;
  1.4999 +	keyEvent.iModifiers=0;
  1.5000 +	keyEvent.iRepeats=0;
  1.5001 +	
  1.5002 +	switch(iEventSet++)
  1.5003 +		{
  1.5004 +		case 0:
  1.5005 +			{
  1.5006 +			TheClient->iWs.SimulateKeyEvent(repKeyEvent);	// Create a repeatable key event
  1.5007 +			TheClient->iWs.SimulateKeyEvent(repKeyEvent);	// Create a repeatable key event
  1.5008 +			TheClient->iWs.SimulateKeyEvent(keyEvent);		// Create a non-repeatable key event
  1.5009 +			TheClient->iWs.Flush();							// Send events
  1.5010 +			AddExpectedEvent(EEventFocusGained);			// Always get a focus gain at start
  1.5011 +			AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above
  1.5012 +			AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above
  1.5013 +			AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above
  1.5014 +			break;
  1.5015 +			}
  1.5016 +		case 1:
  1.5017 +			{
  1.5018 +			TheClient->iWs.SimulateKeyEvent(repKeyEvent);	// Create a repeatable key event
  1.5019 +			TheClient->iWs.SimulateKeyEvent(keyEvent);		// Create a non-repeatable key event
  1.5020 +			TheClient->iWs.Flush();
  1.5021 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'A');	// Create a raw event
  1.5022 +			TheClient->iWs.Flush();
  1.5023 +			User::After(KeyRepeatTime()*3/2);
  1.5024 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'A');		// Create a raw event
  1.5025 +			TheClient->iWs.Flush();
  1.5026 +			AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above
  1.5027 +			AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above
  1.5028 +			AddExpectedKey(EEventKeyDown, 'A');
  1.5029 +			AddExpectedKey(EEventKey,'A','a');
  1.5030 +			AddExpectedKey(EEventKey,'A','a',1);
  1.5031 +			AddExpectedKey(EEventKeyUp, 'A');
  1.5032 +			break;
  1.5033 +			}
  1.5034 +		case 2:
  1.5035 +			{
  1.5036 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'A');	// Create a raw event
  1.5037 +			TheClient->iWs.Flush();
  1.5038 +			User::After(KeyRepeatTime()*3/2);
  1.5039 +			TheClient->iWs.SimulateKeyEvent(repKeyEvent);	// Create a repeatable key event
  1.5040 +			TheClient->iWs.SimulateKeyEvent(keyEvent);		// Create a non-repeatable key event
  1.5041 +			TheClient->iWs.Flush();							// Send event
  1.5042 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'A');		// Create a raw event
  1.5043 +			TheClient->iWs.Flush();
  1.5044 +			AddExpectedKey(EEventKeyDown, 'A');
  1.5045 +			AddExpectedKey(EEventKey,'A','a');
  1.5046 +			AddExpectedKey(EEventKey,'A','a',1);
  1.5047 +			AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above
  1.5048 +			AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above
  1.5049 +			AddExpectedKey(EEventKeyUp, 'A');
  1.5050 +			break;
  1.5051 +			}
  1.5052 +		default:
  1.5053 +			CActiveScheduler::Stop();
  1.5054 +			break;
  1.5055 +		}
  1.5056 +	TheClient->iWs.Flush();
  1.5057 +	}
  1.5058 +
  1.5059 +CTBlankWindow* CTEventTest::NewBlueForgroundWindowL()
  1.5060 +	{
  1.5061 +	CTBlankWindow* window;
  1.5062 +	window=new (ELeave) CTBlankWindow;
  1.5063 +	CleanupStack::PushL(window);
  1.5064 +	window->ConstructL(*iQueueClient->iGroup);
  1.5065 +	User::LeaveIfError(window->BaseWin()->SetRequiredDisplayMode(EColor256));
  1.5066 +	CleanupStack::Pop(window);
  1.5067 +
  1.5068 +	window->SetColor(KRgbBlue);
  1.5069 +	window->SetExt(TPoint(40, 40), TSize(40,40));
  1.5070 +	window->BaseWin()->SetOrdinalPosition(0);
  1.5071 +	return window;
  1.5072 +	}
  1.5073 +
  1.5074 +CTBlankWindow* CTEventTest::NewBlueForgroundWindow()
  1.5075 +	{
  1.5076 +	CTBlankWindow* window = NULL;
  1.5077 +	TRAPD(err, window=NewBlueForgroundWindowL());
  1.5078 +	if (err != KErrNone)
  1.5079 +		Failed();
  1.5080 +	return window;
  1.5081 +	}
  1.5082 +
  1.5083 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  1.5084 +#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1.5085 +static void CreateSurfaceAttributes(RSurfaceManager::TSurfaceCreationAttributesBuf& aBuffer , const TSize& aSize)
  1.5086 +    {
  1.5087 +    RSurfaceManager::TSurfaceCreationAttributes& b = aBuffer();
  1.5088 +                
  1.5089 +    b.iSize.iWidth = aSize.iWidth;
  1.5090 +    b.iSize.iHeight = aSize.iHeight;
  1.5091 +    b.iBuffers = 1;              // number of buffers in the surface
  1.5092 +    b.iPixelFormat = EUidPixelFormatARGB_8888;
  1.5093 +    b.iStride = aSize.iWidth * 4;        // Number of bytes between start of one line and start of next
  1.5094 +    b.iOffsetToFirstBuffer = 0; // way of reserving space before the surface pixel data
  1.5095 +    b.iAlignment = 4;           // alignment, 1,2,4,8 byte aligned
  1.5096 +    b.iContiguous = EFalse;
  1.5097 +    b.iMappable = ETrue;
  1.5098 +    }
  1.5099 +
  1.5100 +static const TInt KFullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible;
  1.5101 +
  1.5102 +void CTEventTest::SurfaceVisibilityChanged1_NextSetOfEventsL()
  1.5103 +    {    
  1.5104 +    switch(iEventSet++)
  1.5105 +        {
  1.5106 +        case 0:
  1.5107 +            {
  1.5108 +            //Setup
  1.5109 +            LOG_MESSAGE(_L("case 0"));
  1.5110 +            TInt err = iSurfaceManager.Open();
  1.5111 +            if (err != KErrNone)
  1.5112 +                {
  1.5113 +                RDebug::Printf("RSurfaceManager::Open() failed", err);
  1.5114 +                User::Leave(err);
  1.5115 +                }
  1.5116 +            
  1.5117 +            iVisWins1=NewBlueForgroundWindowL();
  1.5118 +            iVisWins1->Activate();
  1.5119 +            iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5120 +
  1.5121 +            AddExpectedEvent(EEventFocusGained);
  1.5122 +            AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
  1.5123 +            break;
  1.5124 +            }
  1.5125 +        case 1:
  1.5126 +            {
  1.5127 +            LOG_MESSAGE(_L("case 1"));
  1.5128 +            iVisWins2=NewBlueForgroundWindowL(); // will cover iVisWins1
  1.5129 +            iVisWins2->BlankWin()->SetColor();  //remove colour to ensure window does not draw to UI layer
  1.5130 +            iVisWins2->Activate();
  1.5131 +            
  1.5132 +            AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1);
  1.5133 +            break;
  1.5134 +            }
  1.5135 +        case 2:
  1.5136 +            {
  1.5137 +            // This case contains the actual test GRAPHICS-WSERV-2669-0015
  1.5138 +            LOG_MESSAGE(_L("case 2"));
  1.5139 +            RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf;
  1.5140 +            CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size());
  1.5141 +            
  1.5142 +            iSurfaceId = TSurfaceId::CreateNullId();
  1.5143 +            TInt err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId);
  1.5144 +            if (err != KErrNone)
  1.5145 +                {
  1.5146 +                RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err);
  1.5147 +                TEST(EFalse);
  1.5148 +                }
  1.5149 +         
  1.5150 +            err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId);
  1.5151 +            if (err != KErrNone)
  1.5152 +                {
  1.5153 +                RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err);
  1.5154 +                TEST(EFalse);
  1.5155 +                }
  1.5156 +            
  1.5157 +            iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //iVisWins1 will become visible
  1.5158 +            
  1.5159 +            AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
  1.5160 +            break;
  1.5161 +            }
  1.5162 +        default:
  1.5163 +            LOG_MESSAGE(_L("default"));
  1.5164 +            if (!iSurfaceId.IsNull())
  1.5165 +                {
  1.5166 +                iSurfaceManager.CloseSurface(iSurfaceId);
  1.5167 +                iSurfaceId = TSurfaceId::CreateNullId();
  1.5168 +                }
  1.5169 +            iSurfaceManager.Close();
  1.5170 +            delete iVisWins1;
  1.5171 +            iVisWins1 = NULL;
  1.5172 +            delete iVisWins2;
  1.5173 +            iVisWins2 = NULL;
  1.5174 +            CActiveScheduler::Stop();
  1.5175 +            break;
  1.5176 +        }
  1.5177 +    TheClient->iWs.Flush();
  1.5178 +    }
  1.5179 +
  1.5180 +void CTEventTest::SurfaceVisibilityChanged2_NextSetOfEventsL()
  1.5181 +    {
  1.5182 +    switch (iEventSet++)
  1.5183 +        {
  1.5184 +        case 0:
  1.5185 +            {
  1.5186 +            //Win1 - bottom window
  1.5187 +            //Win2 - middle window with semi-transparent background surface, which totally obscures win1
  1.5188 +            LOG_MESSAGE(_L("case 0"));
  1.5189 +            TInt err = iSurfaceManager.Open();
  1.5190 +            if (err != KErrNone)
  1.5191 +                {
  1.5192 +                RDebug::Printf("RSurfaceManager::Open() failed", err);
  1.5193 +                User::Leave(err);
  1.5194 +                }
  1.5195 +            
  1.5196 +            iVisWins1 = NewBlueForgroundWindowL();
  1.5197 +            iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5198 +
  1.5199 +            iVisWins2 = NewBlueForgroundWindowL();
  1.5200 +            iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer
  1.5201 +            iVisWins2->BaseWin()->EnableVisibilityChangeEvents();
  1.5202 +            
  1.5203 +            iVisWins1->Activate(); //obscured
  1.5204 +            iVisWins2->Activate(); //visible
  1.5205 +            
  1.5206 +            // Create surface for background window    
  1.5207 +            RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf;
  1.5208 +            CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size());
  1.5209 +
  1.5210 +            iSurfaceId = TSurfaceId::CreateNullId();
  1.5211 +            err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId);
  1.5212 +            if (err != KErrNone)
  1.5213 +                {
  1.5214 +                RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err);
  1.5215 +                TEST(EFalse);
  1.5216 +                }
  1.5217 +
  1.5218 +            err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId);
  1.5219 +            if (err != KErrNone)
  1.5220 +                {
  1.5221 +                RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err);
  1.5222 +                TEST(EFalse);
  1.5223 +                }
  1.5224 +
  1.5225 +            iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //win1 and win2 both visible
  1.5226 +
  1.5227 +            AddExpectedEvent(EEventFocusGained);
  1.5228 +            AddExpectedVisibilityChange(KFullyVisible, iVisWins2);
  1.5229 +            AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
  1.5230 +            break;
  1.5231 +            }
  1.5232 +        case 1:
  1.5233 +            {
  1.5234 +            //Win3 - opaque top window which obscures win2 and win1
  1.5235 +            LOG_MESSAGE(_L("case 1"));
  1.5236 +            iVisWins3 = NewBlueForgroundWindowL();
  1.5237 +            iVisWins3->SetColor(KRgbRed);
  1.5238 +            iVisWins3->Activate();
  1.5239 +
  1.5240 +            AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins2);
  1.5241 +            AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1);
  1.5242 +            break;
  1.5243 +            }
  1.5244 +        case 2:
  1.5245 +            {
  1.5246 +            //This case contains the actual test GRAPHICS-WSERV-2669-0016
  1.5247 +            LOG_MESSAGE(_L("case 2"));
  1.5248 +            delete iVisWins3;
  1.5249 +            iVisWins3 = NULL;
  1.5250 +
  1.5251 +            AddExpectedVisibilityChange(KFullyVisible, iVisWins2);
  1.5252 +            AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
  1.5253 +            break;
  1.5254 +            }
  1.5255 +        default:
  1.5256 +            LOG_MESSAGE(_L("default"));
  1.5257 +            if (!iSurfaceId.IsNull())
  1.5258 +                {
  1.5259 +                iSurfaceManager.CloseSurface(iSurfaceId);
  1.5260 +                iSurfaceId = TSurfaceId::CreateNullId();
  1.5261 +                }
  1.5262 +            iSurfaceManager.Close();
  1.5263 +            delete iVisWins1;
  1.5264 +            iVisWins1 = NULL;
  1.5265 +            delete iVisWins2;
  1.5266 +            iVisWins2 = NULL;
  1.5267 +            delete iVisWins3;
  1.5268 +            iVisWins3 = NULL;
  1.5269 +            CActiveScheduler::Stop();
  1.5270 +            return;
  1.5271 +        }
  1.5272 +    TheClient->iWs.Flush();
  1.5273 +    }
  1.5274 +
  1.5275 +TInt CTEventTest::GenerateAnEvent(TAny* aEventTest)
  1.5276 +    {
  1.5277 +    CTEventTest* self = static_cast<CTEventTest*>(aEventTest);
  1.5278 +    self->LogMessage(((TText8*)__FILE__), __LINE__,_L("Negative test passed OK - no event was generated."));
  1.5279 +    //Now we must generate an event to get CTQueueTestEvent out of its wait loop 
  1.5280 +    self->SimulateRepeatEvent(32);
  1.5281 +    self->AddExpectedKey(EEventKey, 32);
  1.5282 +    return KErrNone;
  1.5283 +    }
  1.5284 +
  1.5285 +void CTEventTest::SurfaceVisibilityChanged3_NextSetOfEventsL()
  1.5286 +    {
  1.5287 +    switch (iEventSet++)
  1.5288 +        {
  1.5289 +        case 0:
  1.5290 +            {
  1.5291 +            //Win1 - Bottom window
  1.5292 +            //Win2 - Top window with semi-transparent background surface. Does not overlap win1.
  1.5293 +            LOG_MESSAGE(_L("case 0"));
  1.5294 +            TInt err = iSurfaceManager.Open();
  1.5295 +            if (err != KErrNone)
  1.5296 +                {
  1.5297 +                RDebug::Printf("RSurfaceManager::Open() failed", err);
  1.5298 +                User::Leave(err);
  1.5299 +                }
  1.5300 +            iTimeOutCallback = CPeriodic::NewL(CActive::EPriorityIdle);
  1.5301 +            
  1.5302 +            iVisWins1 = NewBlueForgroundWindowL();
  1.5303 +            iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5304 +
  1.5305 +            iVisWins2 = NewBlueForgroundWindowL();
  1.5306 +            iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer
  1.5307 +            TPoint newPos(iVisWins1->Position() + iVisWins1->Size());
  1.5308 +            iVisWins2->SetPos(newPos); //to not overlap win1 
  1.5309 +            
  1.5310 +            iVisWins1->Activate(); //upper left
  1.5311 +            iVisWins2->Activate(); //lower right
  1.5312 +            
  1.5313 +            // Create surface for background window    
  1.5314 +            RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf;
  1.5315 +            CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size());
  1.5316 +
  1.5317 +            iSurfaceId = TSurfaceId::CreateNullId();
  1.5318 +            err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId);
  1.5319 +            if (err != KErrNone)
  1.5320 +                {
  1.5321 +                RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err);
  1.5322 +                TEST(EFalse);
  1.5323 +                }
  1.5324 +
  1.5325 +            err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId);
  1.5326 +            if (err != KErrNone)
  1.5327 +                {
  1.5328 +                RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err);
  1.5329 +                TEST(EFalse);
  1.5330 +                }
  1.5331 +
  1.5332 +            iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue);
  1.5333 +
  1.5334 +            AddExpectedEvent(EEventFocusGained);
  1.5335 +            AddExpectedVisibilityChange(KFullyVisible, iVisWins1);            
  1.5336 +            break;
  1.5337 +            }
  1.5338 +        case 1:
  1.5339 +            {
  1.5340 +            //This case contains the actual test GRAPHICS-WSERV-2669-0017
  1.5341 +            LOG_MESSAGE(_L("case 1"));
  1.5342 +            iVisWins2->SetPos(iVisWins1->Position()); //Win2 now overlaps Win1, but because Win2 has 
  1.5343 +                                                      //a transparent surface Win1 is still fully visible
  1.5344 +
  1.5345 +            //Because we don't expect any events we need to generate one to avoid waiting forever.
  1.5346 +            TCallBack timeout(GenerateAnEvent, this);
  1.5347 +            iTimeOutCallback->Start(1000000, 10000000, timeout);
  1.5348 +            break;
  1.5349 +            }
  1.5350 +        default:            
  1.5351 +            LOG_MESSAGE(_L("default"));
  1.5352 +            iTimeOutCallback->Cancel();
  1.5353 +            delete iTimeOutCallback;
  1.5354 +            iTimeOutCallback = NULL;
  1.5355 +            if (!iSurfaceId.IsNull())
  1.5356 +                {
  1.5357 +                iSurfaceManager.CloseSurface(iSurfaceId);
  1.5358 +                iSurfaceId = TSurfaceId::CreateNullId();
  1.5359 +                }
  1.5360 +            iSurfaceManager.Close();
  1.5361 +            delete iVisWins1;
  1.5362 +            iVisWins1 = NULL;
  1.5363 +            delete iVisWins2;
  1.5364 +            iVisWins2 = NULL;
  1.5365 +            CActiveScheduler::Stop();
  1.5366 +            return;
  1.5367 +        }
  1.5368 +    TheClient->iWs.Flush();
  1.5369 +    }
  1.5370 +#endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1.5371 +#endif //SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  1.5372 +
  1.5373 +void CTEventTest::VisibilityChanged_NextSetOfEventsL()
  1.5374 +	{
  1.5375 +	const TInt fullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible;
  1.5376 +
  1.5377 +	switch(iEventSet++)
  1.5378 +		{
  1.5379 +		case 0: //only this case can leave
  1.5380 +			{
  1.5381 +			iQueueClient->iWin->BackedUpWin()->MaintainBackup();
  1.5382 +			iVisWins1=NewBlueForgroundWindowL();
  1.5383 +			iVisWins2=NewBlueForgroundWindowL();
  1.5384 +
  1.5385 +			iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5386 +			iVisWins1->Activate();
  1.5387 +			iVisWins2->SetColor(KRgbGreen);
  1.5388 +			iVisWins2->SetExt(TPoint(80, 80), TSize(120,120));
  1.5389 +			iVisWins2->Activate();
  1.5390 +
  1.5391 +			AddExpectedEvent(EEventFocusGained);
  1.5392 +			AddExpectedVisibilityChange(fullyVisible);
  1.5393 +			}
  1.5394 +			break;
  1.5395 +		case 1:
  1.5396 +			iVisWins1->BaseWin()->SetVisible(EFalse);
  1.5397 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
  1.5398 +			break;
  1.5399 +		case 2:
  1.5400 +			iVisWins1->BaseWin()->SetVisible(ETrue);
  1.5401 +			AddExpectedVisibilityChange(fullyVisible);
  1.5402 +			break;
  1.5403 +		case 3:
  1.5404 +			iVisWins2->SetExt(TPoint(0,0), TSize(120,120));
  1.5405 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
  1.5406 +			break;
  1.5407 +		case 4:
  1.5408 +			iVisWins2->BaseWin()->SetVisible(EFalse);
  1.5409 +			AddExpectedVisibilityChange(fullyVisible);
  1.5410 +			break;
  1.5411 +		case 5:
  1.5412 +			iVisWins2->BaseWin()->SetVisible(ETrue);
  1.5413 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
  1.5414 +			break;
  1.5415 +		case 6:
  1.5416 +			iVisWins2->SetExt(TPoint(60,60), TSize(120,120));
  1.5417 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::EPartiallyVisible);
  1.5418 +			break;
  1.5419 +		case 7:
  1.5420 +			iVisWins1->SetExt(TPoint(80,80), TSize(40,40));
  1.5421 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
  1.5422 +			break;
  1.5423 +		case 8:
  1.5424 +			iVisWins1->BaseWin()->SetOrdinalPosition(0);
  1.5425 +			AddExpectedVisibilityChange(fullyVisible);
  1.5426 +
  1.5427 +			if(TransparencySupportedL() != KErrNone)
  1.5428 +				{
  1.5429 +				iEventSet += 2; //we shall skip set 9,10 as they work with transparency
  1.5430 +				}
  1.5431 +			break;
  1.5432 +		case 9:
  1.5433 +			{
  1.5434 +			TDisplayMode mode = EColor256;
  1.5435 +			iTransWin=CTransWindow::NewL(iQueueClient->iGroup, TRgb(255, 0, 0, 128), TRect(0,0,200,200), &mode);
  1.5436 +			iTransWin->CTWin::DrawNow();
  1.5437 +			// it gets put at ordinal position 0
  1.5438 +			iVisWins2->BaseWin()->SetOrdinalPosition(1);
  1.5439 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
  1.5440 +			}
  1.5441 +			break;
  1.5442 +		case 10:
  1.5443 +			iVisWins1->BaseWin()->SetOrdinalPosition(1);
  1.5444 +			AddExpectedVisibilityChange(fullyVisible);
  1.5445 +			break;
  1.5446 +		case 11:
  1.5447 +			{
  1.5448 +			delete iVisWins1;
  1.5449 +			iVisWins1=NULL;
  1.5450 +			iVisWins1=NewBlueForgroundWindow();
  1.5451 +
  1.5452 +			iVisWins1->Activate();
  1.5453 +			iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5454 +
  1.5455 +			AddExpectedVisibilityChange(fullyVisible);
  1.5456 +			}
  1.5457 +			break;
  1.5458 +		case 12:
  1.5459 +			{
  1.5460 +			delete iVisWins1;
  1.5461 +			iVisWins1=NULL;
  1.5462 +			iVisWins1=NewBlueForgroundWindow();
  1.5463 +
  1.5464 +			iVisWins1->Activate();
  1.5465 +			iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5466 +			iVisWins1->BaseWin()->SetVisible(EFalse);
  1.5467 +
  1.5468 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
  1.5469 +			}
  1.5470 +			break;
  1.5471 +		case 13:
  1.5472 +			{
  1.5473 +			delete iVisWins1;
  1.5474 +			iVisWins1=NULL;
  1.5475 +			iVisWins1=NewBlueForgroundWindow();
  1.5476 +
  1.5477 +			iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5478 +			iVisWins1->Activate();
  1.5479 +
  1.5480 +			AddExpectedVisibilityChange(fullyVisible);
  1.5481 +			}
  1.5482 +			break;
  1.5483 +		case 14:
  1.5484 +			{
  1.5485 +			delete iVisWins1;
  1.5486 +			iVisWins1=NULL;
  1.5487 +			iVisWins1=NewBlueForgroundWindow();
  1.5488 +
  1.5489 +			iVisWins1->Activate();
  1.5490 +			iVisWins1->BaseWin()->SetVisible(EFalse);
  1.5491 +			iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
  1.5492 +
  1.5493 +			AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
  1.5494 +			}
  1.5495 +			break;
  1.5496 +		default:
  1.5497 +			delete iVisWins1;
  1.5498 +			delete iVisWins2;
  1.5499 +			iVisWins1 = NULL;
  1.5500 +			iVisWins2 = NULL;
  1.5501 +			delete iTransWin;
  1.5502 +			iTransWin = NULL;
  1.5503 +			CActiveScheduler::Stop();
  1.5504 +			break;
  1.5505 +		}
  1.5506 +	TheClient->iWs.Flush();
  1.5507 +	}
  1.5508 +
  1.5509 +void CTEventTest::CheckTimeStamp_NextSetOfEventsL()
  1.5510 +	{
  1.5511 +	iQueueClient->EventQueue()->SetCheckTimeStamp(ETrue);
  1.5512 +	switch(iEventSet++)
  1.5513 +		{
  1.5514 +	case 0:
  1.5515 +		iTest->SimulateKey(TRawEvent::EKeyDown, 'A');	// Create a raw event
  1.5516 +		iTest->SimulateKey(TRawEvent::EKeyUp, 'A');	// Create a raw event
  1.5517 +		AddExpectedEvent(EEventFocusGained);
  1.5518 +		AddExpectedKey(EEventKeyDown,'A');
  1.5519 +		AddExpectedKey(EEventKey,'A','a');
  1.5520 +		AddExpectedKey(EEventKeyUp,'A','a');
  1.5521 +		break;
  1.5522 +	case 1:
  1.5523 +		{
  1.5524 +		_LIT8(KMsgParam,"CheckTimeStamp");
  1.5525 +		TBuf8<0x20> params(KMsgParam);
  1.5526 +		TInt err = TheClient->iWs.SendMessageToWindowGroup(iQueueClient->WindowGroupIdentifier(),TUid::Uid(123),params);
  1.5527 +		AddExpectedEvent(EEventMessageReady);
  1.5528 +		}
  1.5529 +		break;
  1.5530 +	default:
  1.5531 +		CActiveScheduler::Stop();
  1.5532 +		break;
  1.5533 +		}
  1.5534 +	TheClient->iWs.Flush();
  1.5535 +	}
  1.5536 +
  1.5537 +/**
  1.5538 + * @SYMTestCaseID GRAPHICS-WSERV-0001
  1.5539 + *
  1.5540 + * @SYMPREQ PREQ525
  1.5541 + *
  1.5542 + * @SYMTestCaseDesc Test Capture priority of different top most windows in a Group.
  1.5543 + *
  1.5544 + * @SYMTestPriority Critical
  1.5545 + *
  1.5546 + * @SYMTestStatus Implemented
  1.5547 + *
  1.5548 + * @SYMTestActions Create two different top client windows under one parent window
  1.5549 + *	in a same window group. Add pointer event by clicking various position on the
  1.5550 + *	window and Simulate the pointer event. Change the pointer capture flag, capture
  1.5551 + *	priority and simulate the pointer event.
  1.5552 + *
  1.5553 + * @SYMTestExpectedResults In general the expected event and the window server event should
  1.5554 + *	match same event handle, type and pointer position for following cases.
  1.5555 + *	When pointer capture is disabled and capture priorities are 0, the pointer position on window1
  1.5556 + *	window2 or parent window are same as expected.
  1.5557 + *	When pointer capture is enabled and capture priorities are 0, the pointer position on window2(which is top most now)
  1.5558 + *	is same as expected.
  1.5559 + *	When pointer capture is enabled and capture priorities of win1 is greater than win2
  1.5560 + *	the pointer position on win1 and win2 are same as expected.
  1.5561 + *	The combination of above cases should match the general expexted result.
  1.5562 + *
  1.5563 + */
  1.5564 +void CTEventTest::PointerCapture_NextSetOfEventsL()
  1.5565 +	{
  1.5566 +#if defined(LOGGING)
  1.5567 +	TLogMessageText logMessageText;
  1.5568 +	_LIT(KSet,"Pointer Capture SetOfEvents: %d (last=9)");
  1.5569 +	logMessageText.Format(KSet,iEventSet);
  1.5570 +	INFO_PRINTF1(logMessageText);
  1.5571 +#endif
  1.5572 +	switch(iEventSet++)
  1.5573 +		{
  1.5574 +		case 0:			//Create two top client windows of same group
  1.5575 +			iVisWins1=new (ELeave) CTBlankWindow;
  1.5576 +			iVisWins2=new (ELeave) CTBlankWindow;
  1.5577 +			iVisWins1->ConstructL(*iQueueClient->iGroup);
  1.5578 +			iVisWins2->ConstructL(*iQueueClient->iGroup);
  1.5579 +			iVisWins1->SetColor(KRgbBlue);
  1.5580 +			iVisWins1->SetExt(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize());
  1.5581 +			iVisWins1->Activate();
  1.5582 +			iVisWins2->SetColor(KRgbGreen);
  1.5583 +			iVisWins2->SetExt(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize());
  1.5584 +			iVisWins2->Activate();
  1.5585 +			iQueueClient->iWs.Flush();
  1.5586 +			AddExpectedEvent(EEventFocusGained);
  1.5587 +			break;
  1.5588 +		case 1:			//Pointer capture are disabled and priorities are 0
  1.5589 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureDisabled);
  1.5590 +			iVisWins1->BaseWin()->SetPointerCapturePriority(0);
  1.5591 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureDisabled);
  1.5592 +			iVisWins2->BaseWin()->SetPointerCapturePriority(0);
  1.5593 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25));	//Pointer on the first window
  1.5594 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25));
  1.5595 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));	//Pointer on the second window(overlaping on first window)
  1.5596 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5597 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));	//Pointer on the second window
  1.5598 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5599 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25));	//Pointer on the parent window
  1.5600 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25));
  1.5601 +			iQueueClient->iWs.Flush();
  1.5602 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5603 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5604 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5605 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5606 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5607 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5608 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5609 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5610 +			break;
  1.5611 +		case 2:			//Pointer capture are enabled and priorities are 0
  1.5612 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5613 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5614 +			iVisWins1->BaseWin()->SetPointerCapturePriority(0);
  1.5615 +			iVisWins2->BaseWin()->SetPointerCapturePriority(0);
  1.5616 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2);	//Pointer on the first window
  1.5617 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2);
  1.5618 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));	//Pointer on the second window(overlaping on first window)
  1.5619 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5620 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));	//Pointer on the second window
  1.5621 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5622 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2);	//Pointer on the parent window
  1.5623 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2);
  1.5624 +			iQueueClient->iWs.Flush();
  1.5625 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5626 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5627 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5628 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5629 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5630 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5631 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5632 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5633 +			break;
  1.5634 +		case 3:			//Pointer capture are enabled and priorities of win1 is higher than win2
  1.5635 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5636 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5637 +			iVisWins1->BaseWin()->SetPointerCapturePriority(1);
  1.5638 +			iVisWins2->BaseWin()->SetPointerCapturePriority(0);
  1.5639 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25));
  1.5640 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25));
  1.5641 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));
  1.5642 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5643 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));
  1.5644 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5645 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2);
  1.5646 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2);
  1.5647 +			iQueueClient->iWs.Flush();
  1.5648 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5649 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5650 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5651 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5652 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5653 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5654 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5655 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5656 +			break;
  1.5657 +		case 4:			//Pointer capture are enabled and priorities of win1 is equal to win2
  1.5658 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5659 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5660 +			iVisWins1->BaseWin()->SetPointerCapturePriority(1);
  1.5661 +			iVisWins2->BaseWin()->SetPointerCapturePriority(1);
  1.5662 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2);
  1.5663 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2);
  1.5664 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));
  1.5665 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5666 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));
  1.5667 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5668 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2);
  1.5669 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2);
  1.5670 +			iQueueClient->iWs.Flush();
  1.5671 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5672 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5673 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5674 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5675 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5676 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5677 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5678 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5679 +			break;
  1.5680 +		case 5:			//Pointer capture are enabled and priorities of win2 is higher than win1
  1.5681 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5682 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5683 +			iVisWins1->BaseWin()->SetPointerCapturePriority(0);
  1.5684 +			iVisWins2->BaseWin()->SetPointerCapturePriority(1);
  1.5685 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2);
  1.5686 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2);
  1.5687 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));
  1.5688 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5689 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));
  1.5690 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5691 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2);
  1.5692 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2);
  1.5693 +			iQueueClient->iWs.Flush();
  1.5694 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5695 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5696 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5697 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5698 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5699 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5700 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5701 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5702 +			break;
  1.5703 +		case 6:			//Pointer capture are enabled for all groups and priorities of win1 is higher than win2
  1.5704 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups);
  1.5705 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups);
  1.5706 +			iVisWins1->BaseWin()->SetPointerCapturePriority(1);
  1.5707 +			iVisWins2->BaseWin()->SetPointerCapturePriority(0);
  1.5708 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25));
  1.5709 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25));
  1.5710 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));
  1.5711 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5712 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));
  1.5713 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5714 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2);
  1.5715 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2);
  1.5716 +			iQueueClient->iWs.Flush();
  1.5717 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5718 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5719 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5720 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5721 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5722 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5723 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5724 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5725 +			break;
  1.5726 +		case 7:			//Pointer capture are enabled and priorities of iWin is higher than the other windows
  1.5727 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5728 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5729 +			iVisWins1->BaseWin()->SetPointerCapturePriority(0);
  1.5730 +			iVisWins2->BaseWin()->SetPointerCapturePriority(0);
  1.5731 +			iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5732 +			iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(1);
  1.5733 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20));	//Pointer on the parent window
  1.5734 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20));
  1.5735 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2);
  1.5736 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2);
  1.5737 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));
  1.5738 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5739 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));
  1.5740 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5741 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25));
  1.5742 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25));
  1.5743 +			iQueueClient->iWs.Flush();
  1.5744 +			SimulatePointer(TRawEvent::EButton1Down,80,20);
  1.5745 +			SimulatePointer(TRawEvent::EButton1Up,80,20);
  1.5746 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5747 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5748 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5749 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5750 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5751 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5752 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5753 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5754 +			break;
  1.5755 +		case 8:			//Pointer capture are enabled and priorities of iWin is 0
  1.5756 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5757 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5758 +			iVisWins1->BaseWin()->SetPointerCapturePriority(1);
  1.5759 +			iVisWins2->BaseWin()->SetPointerCapturePriority(0);
  1.5760 +			iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
  1.5761 +			iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(0);
  1.5762 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20),(TInt)iVisWins2);	//Pointer on the parent window
  1.5763 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20),(TInt)iVisWins2);
  1.5764 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25));
  1.5765 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25));
  1.5766 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));
  1.5767 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5768 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));
  1.5769 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5770 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2);
  1.5771 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2);
  1.5772 +			iQueueClient->iWs.Flush();
  1.5773 +			SimulatePointer(TRawEvent::EButton1Down,80,20);
  1.5774 +			SimulatePointer(TRawEvent::EButton1Up,80,20);
  1.5775 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5776 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5777 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5778 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5779 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5780 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5781 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5782 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5783 +			break;
  1.5784 +		case 9:			//Pointer capture are enabled and with different groups
  1.5785 +			iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups);
  1.5786 +			iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups);
  1.5787 +			iVisWins1->BaseWin()->SetPointerCapturePriority(0);
  1.5788 +			iVisWins2->BaseWin()->SetPointerCapturePriority(0);
  1.5789 +			iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups);
  1.5790 +			iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(1);
  1.5791 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(25,150),(TInt)iVisWins2);
  1.5792 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(25,150),(TInt)iVisWins2);
  1.5793 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(150,25),(TInt)iVisWins2);
  1.5794 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(150,25),(TInt)iVisWins2);
  1.5795 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20));	//Pointer on the parent window
  1.5796 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20));
  1.5797 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2);
  1.5798 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2);
  1.5799 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50));
  1.5800 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50));
  1.5801 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30));
  1.5802 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30));
  1.5803 +			AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25));
  1.5804 +			AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25));
  1.5805 +			iQueueClient->iWs.Flush();
  1.5806 +			SimulatePointer(TRawEvent::EButton1Down,25,150);
  1.5807 +			SimulatePointer(TRawEvent::EButton1Up,25,150);
  1.5808 +			SimulatePointer(TRawEvent::EButton1Down,150,25);
  1.5809 +			SimulatePointer(TRawEvent::EButton1Up,150,25);
  1.5810 +			SimulatePointer(TRawEvent::EButton1Down,80,20);
  1.5811 +			SimulatePointer(TRawEvent::EButton1Up,80,20);
  1.5812 +			SimulatePointer(TRawEvent::EButton1Down,35,25);
  1.5813 +			SimulatePointer(TRawEvent::EButton1Up,35,25);
  1.5814 +			SimulatePointer(TRawEvent::EButton1Down,60,50);
  1.5815 +			SimulatePointer(TRawEvent::EButton1Up,60,50);
  1.5816 +			SimulatePointer(TRawEvent::EButton1Down,50,30);
  1.5817 +			SimulatePointer(TRawEvent::EButton1Up,50,30);
  1.5818 +			SimulatePointer(TRawEvent::EButton1Down,75,25);
  1.5819 +			SimulatePointer(TRawEvent::EButton1Up,75,25);
  1.5820 +			break;
  1.5821 +		default:
  1.5822 +			delete iVisWins1;
  1.5823 +			delete iVisWins2;
  1.5824 +			iVisWins1=NULL;
  1.5825 +			iVisWins2=NULL;
  1.5826 +			CActiveScheduler::Stop();
  1.5827 +			break;
  1.5828 +		}
  1.5829 +	TheClient->iWs.Flush();
  1.5830 +	}
  1.5831 +
  1.5832 +/**
  1.5833 +PDEF110849
  1.5834 +Allocate a pointer buffer, send it some events and then disconnect.
  1.5835 +Now fill the event queue, causing a purge.
  1.5836 +The purge will call void CWsPointerBuffer::DiscardPointerMoveBuffer(TUint aHandle)
  1.5837 +in which an access violation occurred because iCurrentBuffer had not been set to NULL.
  1.5838 +*/
  1.5839 +void CTEventTest::PointerBufferPurge_NextSetOfEventsL()
  1.5840 +	{
  1.5841 +#if defined(LOGGING)
  1.5842 +	TLogMessageText logMessageText;
  1.5843 +	_LIT(KSet,"PointerBufferPurge SetOfEvents: %d of 1");
  1.5844 +	logMessageText.Format(KSet,iEventSet);
  1.5845 +	TheClient->LogMessage(logMessageText);
  1.5846 +#endif
  1.5847 +	iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
  1.5848 +	iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
  1.5849 +	switch(iEventSet++)
  1.5850 +		{
  1.5851 +		case 0:
  1.5852 +			{
  1.5853 +			RWindowBase& win = *iQueueClient->iWin->BaseWin();
  1.5854 +			
  1.5855 +			// Cause a connect to happen
  1.5856 +			RDebug::Print(_L("PointerBufferPurge - AllocPointerMoveBuffer()"));
  1.5857 +			win.AllocPointerMoveBuffer(10, 0);
  1.5858 +			
  1.5859 +			// Allow pen events to be received
  1.5860 +			RDebug::Print(_L("PointerBufferPurge - EnablePointerMoveBuffer()"));
  1.5861 +			win.EnablePointerMoveBuffer();
  1.5862 +			
  1.5863 +			// Simulate some pen events
  1.5864 +			RDebug::Print(_L("PointerBufferPurge - Events"));
  1.5865 +			SimulatePointer(TRawEvent::EPointerMove,10,20);
  1.5866 +			SimulatePointer(TRawEvent::EButton1Down,10,20);
  1.5867 +			SimulatePointer(TRawEvent::EPointerMove,11,21);
  1.5868 +			SimulatePointer(TRawEvent::EButton1Up,11,21);
  1.5869 +	
  1.5870 +			// Disconnect
  1.5871 +			RDebug::Print(_L("PointerBufferPurge - FreePointerMoveBuffer()"));
  1.5872 +			win.FreePointerMoveBuffer();
  1.5873 +			
  1.5874 +			// Send sufficient events to cause a purge to happen
  1.5875 +			for (TInt i=0; i<EMaxEventQueueSize; i++)
  1.5876 +				{
  1.5877 +				RDebug::Print(_L("PointerBufferPurge - Purge Loop %d"), i);
  1.5878 +				SimulatePointer(TRawEvent::EButton1Up,15,25);
  1.5879 +				}
  1.5880 +	
  1.5881 +			// Expected events
  1.5882 +			// - We only expect the focus and button up events because the other events have been purged
  1.5883 +			// - button up events which are not paired with button down take precedence 
  1.5884 +			// - but even some of our button up events will have been purged - hence the lower count
  1.5885 +			
  1.5886 +			AddExpectedEvent(EEventFocusGained);
  1.5887 +			
  1.5888 +			for (TInt i=0; i<EMaxEventQueueSize-1; i++)
  1.5889 +				{
  1.5890 +				AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,25-EWinPositionY));
  1.5891 +				}
  1.5892 +				
  1.5893 +			break;
  1.5894 +			}
  1.5895 +		default:
  1.5896 +			CActiveScheduler::Stop();
  1.5897 +		break;
  1.5898 +		}
  1.5899 +	TheClient->iWs.SetAutoFlush(iTheClientFlush);
  1.5900 +	iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
  1.5901 +	}
  1.5902 +
  1.5903 +/**
  1.5904 + * @SYMTestCaseID GRAPHICS-WSERV-0025
  1.5905 + *
  1.5906 + * @SYMDEF DEF085009
  1.5907 + *
  1.5908 + * @SYMTestCaseDesc Test removal of event handlers mid-way through processing an event.
  1.5909 + *
  1.5910 + * @SYMTestPriority Critical
  1.5911 + *
  1.5912 + * @SYMTestStatus Implemented
  1.5913 + *
  1.5914 + * @SYMTestActions The following tests use RRemovable anim to replicate the removal of
  1.5915 + * event handlers mid-way through processing an event (where an event is offered to each of the
  1.5916 + * listed event handlers).
  1.5917 + *
  1.5918 + * RRemovableAnim is an anim which removes itself from the event handler list
  1.5919 + * after receiving n events, where n is the 'lifetime' of the anim measured in events received.
  1.5920 + * By setting the lifetimes of a number of these anims, we replicate the removal of event handlers
  1.5921 + * mid-way through processing an event.
  1.5922 + *
  1.5923 + * Event set 0:
  1.5924 + *  Sends 2 events e1,e2 and expects them be received by wserv event processing.
  1.5925 + *
  1.5926 + * Event set 1: (Simple scenario)
  1.5927 + *  Adds 3 removable anims to event handler list
  1.5928 + *  Sets lifetimes as {1000,2,5}
  1.5929 + *  Sends 6 events
  1.5930 + *  Expected events to be received by anims: {6,2,5}
  1.5931 + *
  1.5932 + * Event set 2: (Manual removal and reset state)
  1.5933 + *  Manually remove all anims from event handler list
  1.5934 + *  Sends 2 events
  1.5935 + *  No events expected to be received by anims
  1.5936 + *  Resets all anims ready for next test
  1.5937 + *
  1.5938 + * Event set 3: (Removal of multiple anims on receipt of same event)
  1.5939 + *  Adds 10 removable anims in event handler list
  1.5940 + *  Set lifetimes: {1,5,9,3,8,8,8,10,5,2}
  1.5941 + *  Sends 12 events:
  1.5942 + *  Expected number of received events for anims: {1,5,9,3,8,8,8,10,5,2}
  1.5943 + *
  1.5944 + * Event set 4: (Manual removal and reset state)
  1.5945 + *  Manually remove all anims from event handler list
  1.5946 + *  Sends 2 events
  1.5947 + *  No events expected to be received by anims
  1.5948 + *  Resets all anims ready for next test
  1.5949 + *
  1.5950 + * Event set 5: (Addition of anims to non-empty event handler list, part 1)
  1.5951 + *  Adds 6 removable anims in the event handler list
  1.5952 + *  Set lifetimes: {1,1,1,5,5,5}
  1.5953 + *  Sends 2 events:
  1.5954 + *  Expected number of received events for anims: {1,1,1,2,2,2}
  1.5955 + *
  1.5956 + * Event set 6: (Addition of anims to non-empty event handler list, part 2)
  1.5957 + *  Readds first 3 anims to event handler list
  1.5958 + *  Sets lifetimes of these three anims {13,24,6}
  1.5959 + *  Sends 5 events:
  1.5960 + *  Expected number of received events for anims: {5,5,5,3,3,3}
  1.5961 + *
  1.5962 + * Event set 7: (Addition of anims to non-empty event handler list, part 3)
  1.5963 + *  Sends 16 events:
  1.5964 + *  Expected number of received events for anims: {8,16,1,0,0,0}
  1.5965 + *
  1.5966 + * Event set 8: (Manual Removal and reset state)
  1.5967 + *  Manually remove all anims from event handler list
  1.5968 + *  Sends 2 events
  1.5969 + *  No events expected to be received by anims
  1.5970 + *  Resets all anims ready for next test
  1.5971 + *
  1.5972 + * Event set 9: (Creating anims which again generate events.)
  1.5973 + *  Create 3 anims. One anims generates events in its OfferrawEvent function.
  1.5974 + *	Check the funtionality of ProcessRawEvent in Wserv when it is called
  1.5975 + *	recursively. Also check the fix for defect INC095892.
  1.5976 + *
  1.5977 + * @SYMTestExpectedResults
  1.5978 + *  All events should be received by wserv event processing
  1.5979 + *  Each anim should only receive events when (number of events received by anim) <= (lifetime of anim)
  1.5980 + */
  1.5981 +void CTEventTest::EventHandlerRemoval_NextSetOfEventsL()
  1.5982 +	{
  1.5983 +#if defined(LOGGING)
  1.5984 +	INFO_PRINTF1(_L("EventHandlerRemoval SetOfEvents: (Max=8)"));
  1.5985 +#endif
  1.5986 +	switch(iEventSet++)
  1.5987 +		{
  1.5988 +		case 0:
  1.5989 +		#if defined(LOGGING)
  1.5990 +			INFO_PRINTF1(_L("AUTO  Event Handler Removal Anim Events"));
  1.5991 +		#endif
  1.5992 +		#if defined(DETAILED)
  1.5993 +			INFO_PRINTF1(_L("No anims in event handler list"));
  1.5994 +			INFO_PRINTF1(_L(" Send 2 events"));
  1.5995 +			INFO_PRINTF1(_L(" - Expected to be received by wserv event processing"));
  1.5996 +		#endif
  1.5997 +			// Always get a focus gain at start
  1.5998 +			AddExpectedEvent(EEventFocusGained);
  1.5999 +			// All expected to be received by wserv event processing
  1.6000 +			AddExpectedKey(EEventKeyDown,32,ETrue);
  1.6001 +			AddExpectedKey(EEventKeyUp,32,ETrue);
  1.6002 +			// Send 2 events - none expected to be received by anims,
  1.6003 +			iTest->SimulateKey(TRawEvent::EKeyDown,32);
  1.6004 +			iTest->SimulateKey(TRawEvent::EKeyUp,32);
  1.6005 +			// Flush events to wserv
  1.6006 +			TheClient->iWs.Flush();
  1.6007 +			// Create all anims for all tests in first event set because
  1.6008 +			// first event set is only place where leaving functions can be called
  1.6009 +			EventHandlerRemoval_CreateAnimsL(10);
  1.6010 +			break;
  1.6011 +		case 1:
  1.6012 +			{
  1.6013 +		#if defined(DETAILED)
  1.6014 +			INFO_PRINTF1(_L(" Add 3 removable anims to event handler list"));
  1.6015 +			INFO_PRINTF1(_L(" Set lifetimes for anims: {1000,2,5}"));
  1.6016 +			INFO_PRINTF1(_L(" Send 6 events"));
  1.6017 +			INFO_PRINTF1(_L(" - Expected number of received events for anims: {6,2,5}"));
  1.6018 +			INFO_PRINTF1(_L(" All events expected to be received by wserv event processing"));
  1.6019 +		#endif
  1.6020 +			const TInt KLifetimes [] = {1000,2,5};
  1.6021 +			EventHandlerRemoval_PrepareAnims(KLifetimes, 3);
  1.6022 +			EventHandlerRemoval_CreateExpectedEvents(6,3);
  1.6023 +			// Flush events to wserv
  1.6024 +			TheClient->iWs.Flush();
  1.6025 +			// Check each anim has received the expected events
  1.6026 +			EventHandlerRemoval_CheckExpectedEventsReceivedByAnims();
  1.6027 +			}
  1.6028 +			break;
  1.6029 +		case 2:
  1.6030 +			{
  1.6031 +			// Remove all anims, check removal was successful
  1.6032 +			// and reset all anims ready for next test
  1.6033 +			EventHandlerRemoval_RemoveAndResetAllAnims();
  1.6034 +			}
  1.6035 +			break;
  1.6036 +		case 3:
  1.6037 +			{
  1.6038 +		#if defined(DETAILED)
  1.6039 +			INFO_PRINTF1(_L(" Add 10 removable anims in event handler list"));
  1.6040 +			INFO_PRINTF1(_L(" Set lifetimes: {1,5,9,3,8,8,8,10,5,2}"));
  1.6041 +			INFO_PRINTF1(_L(" Send 12 events"));
  1.6042 +			INFO_PRINTF1(_L(" - Expected number of received events for anims:{1,5,9,3,8,8,8,10,5,2}"));
  1.6043 +			INFO_PRINTF1(_L(" All expected to be received by wserv event processing"));
  1.6044 +		#endif
  1.6045 +			const TInt KLifetimes [] = {1,5,9,3,8,8,8,10,5,2};
  1.6046 +
  1.6047 +			// Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array
  1.6048 +			EventHandlerRemoval_PrepareAnims(KLifetimes, 10);
  1.6049 +			EventHandlerRemoval_CreateExpectedEvents(12,10);
  1.6050 +			// Flush events to wserv
  1.6051 +			TheClient->iWs.Flush();
  1.6052 +			// Check each anim has received the expected events
  1.6053 +			EventHandlerRemoval_CheckExpectedEventsReceivedByAnims();
  1.6054 +			}
  1.6055 +			break;
  1.6056 +		case 4:
  1.6057 +			{
  1.6058 +			// Remove all anims, check removal was successful
  1.6059 +			// and reset all anims ready for next test
  1.6060 +			EventHandlerRemoval_RemoveAndResetAllAnims();
  1.6061 +			}
  1.6062 +			break;
  1.6063 +		case 5:
  1.6064 +			{
  1.6065 +		#if defined(DETAILED)
  1.6066 +			INFO_PRINTF1(_L(" Add 6 removable anims in event handler list"));
  1.6067 +			INFO_PRINTF1(_L(" Set lifetimes: {1,1,1,5,5,5}"));
  1.6068 +			INFO_PRINTF1(_L(" Send 2 events"));
  1.6069 +			INFO_PRINTF1(_L(" - Expected number of received events for anims:{1,1,1,2,2,2}"));
  1.6070 +			INFO_PRINTF1(_L(" All expected to be received by wserv event processing"));
  1.6071 +		#endif
  1.6072 +			const TInt KLifetimes [] = {1,1,1,5,5,5};
  1.6073 +
  1.6074 +			// Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array
  1.6075 +			EventHandlerRemoval_PrepareAnims(KLifetimes, 6);
  1.6076 +			EventHandlerRemoval_CreateExpectedEvents(2, 6);
  1.6077 +			// Flush events to wserv
  1.6078 +			TheClient->iWs.Flush();
  1.6079 +			// Check each anim has received the expected events
  1.6080 +			EventHandlerRemoval_CheckExpectedEventsReceivedByAnims();
  1.6081 +			}
  1.6082 +			break;
  1.6083 +		case 6:
  1.6084 +			{
  1.6085 +		#if defined(DETAILED)
  1.6086 +			INFO_PRINTF1(_L(" Readds first 3 removable anims to event handler list"));
  1.6087 +			INFO_PRINTF1(_L(" Set lifetimes of these three anims {13,24,6}"));
  1.6088 +			INFO_PRINTF1(_L(" Send 5 events"));
  1.6089 +			INFO_PRINTF1(_L(" - Expected number of received events for anims: {5,5,5,3,3,3}"));
  1.6090 +			INFO_PRINTF1(_L(" All expected to be received by wserv event processing"));
  1.6091 +		#endif
  1.6092 +			const TInt KLifetimes [] = {13,24,6};
  1.6093 +
  1.6094 +			// Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array
  1.6095 +			EventHandlerRemoval_PrepareAnims(KLifetimes, 3);
  1.6096 +			EventHandlerRemoval_CreateExpectedEvents(5, 6);
  1.6097 +			// Flush events to wserv
  1.6098 +			TheClient->iWs.Flush();
  1.6099 +			// Check each anim has received the expected events
  1.6100 +			EventHandlerRemoval_CheckExpectedEventsReceivedByAnims();
  1.6101 +			}
  1.6102 +			break;
  1.6103 +		case 7:
  1.6104 +			{
  1.6105 +		#if defined(DETAILED)
  1.6106 +			INFO_PRINTF1(_L(" Send 16 events"));
  1.6107 +			INFO_PRINTF1(_L(" - Expected number of received events for anims:{8,16,1,0,0,0}"));
  1.6108 +			INFO_PRINTF1(_L(" All expected to be received by wserv event processing"));
  1.6109 +		#endif
  1.6110 +			EventHandlerRemoval_CreateExpectedEvents(16, 3);
  1.6111 +			// Flush events to wserv
  1.6112 +			TheClient->iWs.Flush();
  1.6113 +			// Check each anim has received the expected events
  1.6114 +			EventHandlerRemoval_CheckExpectedEventsReceivedByAnims();
  1.6115 +			}
  1.6116 +			break;
  1.6117 +		case 8:
  1.6118 +			{
  1.6119 +			// Remove all anims, check removal was successful
  1.6120 +			// and reset all anims ready for next test
  1.6121 +			EventHandlerRemoval_RemoveAndResetAllAnims();
  1.6122 +			}
  1.6123 +			break;
  1.6124 +		case 9:
  1.6125 +			EventHandlerRemoval_CheckRecursionOfProcessRawEvent();
  1.6126 +			break;
  1.6127 +		case 10:
  1.6128 +			EventHandlerRemoval_AddEventHandlerMultipleTimes();
  1.6129 +			break;
  1.6130 +		default:
  1.6131 +		#if defined(DETAILED)
  1.6132 +			INFO_PRINTF1(_L(" Test postamble"));
  1.6133 +			INFO_PRINTF1(_L(" Destroy anims"));
  1.6134 +		#endif
  1.6135 +			// Destroy anims
  1.6136 +			EventHandlerRemoval_DestroyAllAnims();
  1.6137 +			iRemovableAnims->Close();
  1.6138 +			delete iRemovableAnims;
  1.6139 +			iRemovableAnims = NULL;
  1.6140 +			CActiveScheduler::Stop();
  1.6141 +			break;
  1.6142 +		}
  1.6143 +	TheClient->iWs.Flush();
  1.6144 +	}
  1.6145 +
  1.6146 +/**
  1.6147 + * Creates an array of aAnimCount anims on heap
  1.6148 + * Assigns array to iRemovableAnims for use in rest of tests
  1.6149 + */
  1.6150 +void CTEventTest::EventHandlerRemoval_CreateAnimsL(TInt aAnimCount)
  1.6151 +	{
  1.6152 +	RPointerArray<RRemovableAnim>* removableAnims = new (ELeave) RPointerArray<RRemovableAnim>();
  1.6153 +	CleanupStack::PushL(removableAnims);
  1.6154 +	for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++)
  1.6155 +		{
  1.6156 +		RRemovableAnim* anim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll);
  1.6157 +		removableAnims->AppendL(anim);
  1.6158 +		}
  1.6159 +	CleanupStack::Pop(aAnimCount, (*removableAnims)[0]);
  1.6160 +	CleanupStack::Pop(removableAnims);
  1.6161 +	iRemovableAnims = removableAnims;
  1.6162 +	}
  1.6163 +
  1.6164 +/**
  1.6165 + * Sets lifetimes of anims as specified in aLifeTimes
  1.6166 + * Adds anims to event handler list
  1.6167 + */
  1.6168 +void CTEventTest::EventHandlerRemoval_PrepareAnims(const TInt* aLifetimes, TInt aAnimCount)
  1.6169 +	{
  1.6170 +	for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++)
  1.6171 +		{
  1.6172 +		RRemovableAnim* anim = (*iRemovableAnims)[animIndex];
  1.6173 +		anim->SetEventHandlerLifetime(aLifetimes[animIndex]);
  1.6174 +		anim->AddToEventHandlers();
  1.6175 +		}
  1.6176 +	}
  1.6177 +
  1.6178 +/**
  1.6179 + * Creates aEventCount key events to be used in test
  1.6180 + * Adds the expected event aEvent to the first aLiveAnimCount anims
  1.6181 + * Adds expected events observed by the rest of wserv
  1.6182 + * Simulates events on wserv
  1.6183 + */
  1.6184 +void CTEventTest::EventHandlerRemoval_CreateExpectedEvents(TInt aEventCount, TInt aLiveAnimCount)
  1.6185 +	{
  1.6186 +	RArray<TRawEvent> events;
  1.6187 +
  1.6188 +	// Add expected events to anims
  1.6189 +	for (TInt eventCount = 0; eventCount < aEventCount; eventCount++)
  1.6190 +		{
  1.6191 +		TRawEvent rawEvent;
  1.6192 +		TInt scanCode = 33 + eventCount;
  1.6193 +		// Alternate key down, key up events.
  1.6194 +		if (eventCount%2 == 0)
  1.6195 +			{
  1.6196 +			rawEvent.Set(TRawEvent::EKeyDown, scanCode);
  1.6197 +			}
  1.6198 +		else
  1.6199 +			{
  1.6200 +			rawEvent.Set(TRawEvent::EKeyUp, scanCode);
  1.6201 +			}
  1.6202 + 		EventHandlerRemoval_AddExpectedEvent(rawEvent, aLiveAnimCount);
  1.6203 +		events.Append(rawEvent);
  1.6204 +		}
  1.6205 +
  1.6206 +	// Simulates expected events
  1.6207 +	for (TInt eventCount = 0; eventCount < aEventCount; eventCount++)
  1.6208 +		{
  1.6209 +		TRawEvent event = events[eventCount];
  1.6210 +		iTest->SimulateKey(event.Type(), event.ScanCode());
  1.6211 +		}
  1.6212 +
  1.6213 +	events.Close();
  1.6214 +	}
  1.6215 +
  1.6216 +/**
  1.6217 + * Adds the expected event aEvent to the first aLiveAnimCount anims
  1.6218 + * Adds expected event observed by the rest of wserv
  1.6219 + */
  1.6220 +void CTEventTest::EventHandlerRemoval_AddExpectedEvent(TRawEvent aEvent, TInt aLiveAnimCount)
  1.6221 +	{
  1.6222 +	// Add event to each of the anims
  1.6223 +	for (TInt animIndex = 0; animIndex < aLiveAnimCount; animIndex++)
  1.6224 +		{
  1.6225 +		TInt err = (*iRemovableAnims)[animIndex]->AddExpectedEvent(aEvent);
  1.6226 +		}
  1.6227 +	TInt eventType = (aEvent.Type() == TRawEvent::EKeyDown ? EEventKeyDown : EEventKeyUp);
  1.6228 +	AddExpectedKey(eventType, aEvent.ScanCode(), ETrue);
  1.6229 +	}
  1.6230 +
  1.6231 +/**
  1.6232 + * Checks each anim has received the expected events
  1.6233 + */
  1.6234 +void CTEventTest::EventHandlerRemoval_CheckExpectedEventsReceivedByAnims()
  1.6235 +	{
  1.6236 +	for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
  1.6237 +		{
  1.6238 +		if (!(*iRemovableAnims)[animIndex]->TestPassed())
  1.6239 +			{
  1.6240 +			Failed();
  1.6241 +			break;
  1.6242 +			}
  1.6243 +		}
  1.6244 +	}
  1.6245 +
  1.6246 +
  1.6247 +/**
  1.6248 + * Create three anims. In the first anim's Offer raw event generate two more events
  1.6249 + * which will call recursively the process raw event at the server side.
  1.6250 + * The second and third anims are just removable anims. To simulate the scenario 
  1.6251 + * for the defect INC095892. If teh fix for this is defect is not supplied then
  1.6252 + * wserv would panic for this test case.
  1.6253 + */
  1.6254 +void CTEventTest::EventHandlerRemoval_CheckRecursionOfProcessRawEvent()
  1.6255 +	{
  1.6256 +	iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
  1.6257 +	iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
  1.6258 +	
  1.6259 +	// Create 3 anims	
  1.6260 +	RRemovableAnim* eventRecurAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll);
  1.6261 +	RRemovableAnim* removableAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll);
  1.6262 +	RRemovableAnim* eventAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll);
  1.6263 +
  1.6264 +	// Add these anim as event handlers and set thier respective life time
  1.6265 +	eventRecurAnim->AddToEventHandlers();
  1.6266 +	eventRecurAnim->SetEventHandlerLifetime(4);
  1.6267 +	
  1.6268 +	removableAnim->AddToEventHandlers();
  1.6269 +	removableAnim->SetEventHandlerLifetime(1);
  1.6270 +	
  1.6271 +	eventAnim->AddToEventHandlers();
  1.6272 +	eventAnim->SetEventHandlerLifetime(2);
  1.6273 +
  1.6274 +	TRawEvent rawEvent1;
  1.6275 +	TRawEvent rawEvent2;
  1.6276 +	TRawEvent rawEvent3;
  1.6277 +	rawEvent1.Set(TRawEvent::EKeyDown, 60);
  1.6278 +	rawEvent2.Set(TRawEvent::EKeyUp, 34);
  1.6279 +	rawEvent3.Set(TRawEvent::EKeyUp, 35);
  1.6280 +	
  1.6281 +	eventRecurAnim->AddExpectedEvent(rawEvent2);
  1.6282 +	eventRecurAnim->AddExpectedEvent(rawEvent3);
  1.6283 +	
  1.6284 +	removableAnim->AddExpectedEvent(rawEvent2);
  1.6285 +	
  1.6286 +	eventAnim->AddExpectedEvent(rawEvent2);
  1.6287 +	eventAnim->AddExpectedEvent(rawEvent3);
  1.6288 +
  1.6289 +	// Add these events to iQueueClient for testing	
  1.6290 +	AddExpectedKey(EEventKeyUp, 34, ETrue);
  1.6291 +	AddExpectedKey(EEventKeyUp, 35, ETrue);
  1.6292 +
  1.6293 +	iTest->SimulateKey(rawEvent1.Type(), rawEvent1.ScanCode());
  1.6294 +	
  1.6295 +	CleanupStack::PopAndDestroy(3, eventRecurAnim);
  1.6296 +	
  1.6297 +	TheClient->iWs.SetAutoFlush(iTheClientFlush);
  1.6298 +	iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
  1.6299 +	}
  1.6300 +
  1.6301 +/**
  1.6302 + * Manually removes all anims from event handlers array
  1.6303 + */
  1.6304 +void CTEventTest::EventHandlerRemoval_ManuallyRemoveAllAnims()
  1.6305 +	{
  1.6306 +	// Manually remove all anims from event handler list
  1.6307 +	for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
  1.6308 +		{
  1.6309 +		(*iRemovableAnims)[animIndex]->RemoveFromEventHandlers();
  1.6310 +		}
  1.6311 +	}
  1.6312 +
  1.6313 +/**
  1.6314 + * Manually removes all anims from event handlers array
  1.6315 + */
  1.6316 +void CTEventTest::EventHandlerRemoval_ResetAllAnims()
  1.6317 +	{
  1.6318 +	// Manually remove all anims from event handler list
  1.6319 +	for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
  1.6320 +		{
  1.6321 +		(*iRemovableAnims)[animIndex]->Reset();
  1.6322 +		(*iRemovableAnims)[animIndex]->SetEventHandlerLifetime(0);
  1.6323 +		}
  1.6324 +	}
  1.6325 +
  1.6326 +/**
  1.6327 + *  Manually removes all anims from event handler list
  1.6328 + *  Sends 2 events
  1.6329 + *  Checks that no events have been received by anims
  1.6330 + *  Resets all anims ready for next test
  1.6331 + */
  1.6332 +void CTEventTest::EventHandlerRemoval_RemoveAndResetAllAnims()
  1.6333 +	{
  1.6334 +#if defined(DETAILED)
  1.6335 +	INFO_PRINTF1(_L(" Manually remove all anims from event handler list"));
  1.6336 +	INFO_PRINTF1(_L(" Send 2 events: none expected to be received by anims"));
  1.6337 +	INFO_PRINTF1(_L(" All expected to be received by wserv event processing"));
  1.6338 +#endif
  1.6339 +	// Manually remove all anims from event handler list
  1.6340 +	EventHandlerRemoval_ManuallyRemoveAllAnims();
  1.6341 +	// All expected to be received by wserv event processing
  1.6342 +	AddExpectedKey(EEventKeyDown,32,ETrue);
  1.6343 +	AddExpectedKey(EEventKeyUp,32,ETrue);
  1.6344 +	// Send 2 events - none expected to be received by anims,
  1.6345 +	iTest->SimulateKey(TRawEvent::EKeyDown,32);
  1.6346 +	iTest->SimulateKey(TRawEvent::EKeyUp,32);
  1.6347 +	// Flush events to wserv
  1.6348 +	TheClient->iWs.Flush();
  1.6349 +	// Check the anims have not received any events
  1.6350 +	EventHandlerRemoval_CheckExpectedEventsReceivedByAnims();
  1.6351 +#if defined(DETAILED)
  1.6352 +	INFO_PRINTF1(_L(" Cleanup before next step"));
  1.6353 +#endif
  1.6354 +	// Reset anims
  1.6355 +	EventHandlerRemoval_ResetAllAnims();
  1.6356 +	}
  1.6357 +
  1.6358 +/**
  1.6359 + * Destroys all anims in iRemovableAnims
  1.6360 + * Resets iRemovableAnims
  1.6361 + */
  1.6362 +void CTEventTest::EventHandlerRemoval_DestroyAllAnims()
  1.6363 +	{
  1.6364 +	if (iRemovableAnims)
  1.6365 +		{
  1.6366 +		// Destroy anims
  1.6367 +		for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
  1.6368 +			{
  1.6369 +			RRemovableAnim* anim = (*iRemovableAnims)[animIndex];
  1.6370 +			if (anim)
  1.6371 +				{
  1.6372 +				anim->Destroy();
  1.6373 +				}
  1.6374 +			}
  1.6375 +		iRemovableAnims->Reset();
  1.6376 +		}
  1.6377 +	}
  1.6378 +
  1.6379 +/**
  1.6380 +SYMTestCaseID			GRAPHICS-WSERV-0496
  1.6381 +
  1.6382 +@SYMDEF					DEF133776
  1.6383 +
  1.6384 +@SYMTestCaseDesc		Cancels key captures using all combinations of 
  1.6385 + RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs.
  1.6386 +
  1.6387 +@SYMTestPriority 		High
  1.6388 +
  1.6389 +@SYMTestStatus 			Implemented
  1.6390 +
  1.6391 +@SYMTestActions 		Call each of the RWindowGroup::Capture***() APIs followed by
  1.6392 + each of the RWindowGroup::CancelCapture***() APIs.
  1.6393 + RWindowGroup::Capture***() APIs:
  1.6394 + 	CaptureKey(TUint, TUint, TUint)
  1.6395 + 	CaptureKey(TUint, TUint, TUint, TInt)
  1.6396 + 	CaptureKeyUpAndDowns(TUint, TUint, TUint)
  1.6397 + 	CaptureKeyUpAndDowns(TUint, TUint, TUint, TInt)
  1.6398 + 	CaptureLongKey(TUint, TUint, TUint, TUint, TInt, TUint)
  1.6399 +  	CaptureLongKey(TTimeIntervalMicroSeconds32, TUint, TUint, TUint, TUint, TInt, TUint)
  1.6400 + RWindowGroup::CancelCapture***() APIs:
  1.6401 +	CancelCaptureKey()
  1.6402 +	CancelCaptureKeyUpAndDowns()
  1.6403 +	CancelCaptureLongKey()
  1.6404 +
  1.6405 +@SYMTestExpectedResults WServ should handle matched and mismatched Cancel 
  1.6406 + and Capture calls without panicking.
  1.6407 + */
  1.6408 +void CTEventTest::MismatchedCapture_NextSetOfEventsL()
  1.6409 +	{
  1.6410 +	if (iEventSet == 0)
  1.6411 +		AddExpectedEvent(EEventFocusGained);
  1.6412 +	
  1.6413 +	if (iEventSet < (EMaxCaptureKeyApis*EMaxCancelCaptureKeyApis))
  1.6414 +		{
  1.6415 +		TestCaptureAndCancelCapturePair(static_cast<TCaptureKeyApis>(iEventSet%EMaxCaptureKeyApis), static_cast<TCancelCaptureKeyApis>(iEventSet/EMaxCaptureKeyApis));
  1.6416 +		iEventSet++;
  1.6417 +		}	
  1.6418 +	else
  1.6419 +		{
  1.6420 +		CActiveScheduler::Stop();				
  1.6421 +		}
  1.6422 +	}
  1.6423 +
  1.6424 +/** Helper function that applies a key capture and then cancels it using the
  1.6425 +passed capture and cancel RWindowGroup APIs.
  1.6426 +
  1.6427 +@param aCaptureApi Enum value specifying the capture API to use
  1.6428 +@param aCancelCaptureApi Enum value specifying the cancel capture API to use
  1.6429 + */
  1.6430 +void CTEventTest::TestCaptureAndCancelCapturePair(TCaptureKeyApis aCaptureApi, TCancelCaptureKeyApis aCancelCaptureApi)
  1.6431 +	{		
  1.6432 +#if defined(LOGGING)
  1.6433 +	_LIT(KCaptureKey, "CaptureKey");
  1.6434 +	_LIT(KCaptureKeyKeyUpAndDowns, "CaptureKeyKeyUpAndDowns");
  1.6435 +	_LIT(KCaptureLongKey, "CaptureLongKey");	
  1.6436 +	_LIT(KCancelCaptureKey, "CancelCaptureKey");
  1.6437 +	_LIT(KCancelCaptureKeyKeyUpAndDowns, "CancelCaptureKeyKeyUpAndDowns");
  1.6438 +	_LIT(KCancelCaptureLongKey, "CancelCaptureLongKey");
  1.6439 +	_LIT(KLog,"TestCaptureAndCancelCapturePair: %S, %S");
  1.6440 +	TPtrC captures[EMaxCaptureKeyApis] = {KCaptureKey(), KCaptureKey(), KCaptureKeyKeyUpAndDowns(), KCaptureKeyKeyUpAndDowns(), KCaptureLongKey(), KCaptureLongKey()};
  1.6441 +	TPtrC cancelCaptures[EMaxCancelCaptureKeyApis] = {KCancelCaptureKey(), KCancelCaptureKeyKeyUpAndDowns(), KCancelCaptureLongKey()};
  1.6442 +	TLogMessageText logMessageText;	
  1.6443 +	logMessageText.Format(KLog, &captures[aCaptureApi], &cancelCaptures[aCancelCaptureApi]);
  1.6444 +	INFO_PRINTF1(logMessageText);
  1.6445 +#endif // LOGGING	
  1.6446 +	
  1.6447 +	// Start a key capture using one of the six RWindowGroup Capture***() APIs
  1.6448 +	switch (aCaptureApi)
  1.6449 +		{
  1.6450 +		case ECaptureKey1:
  1.6451 +		case ECaptureKey2:
  1.6452 +			// Test RWindowGroup::CaptureKey()
  1.6453 +			if (aCaptureApi == ECaptureKey1) 				
  1.6454 +				iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('A',0,0);
  1.6455 +			else
  1.6456 +				iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('A',0,0,1); // priority 1 (default priority is 0)
  1.6457 +			iTest->SimulateKey(TRawEvent::EKeyDown, 'A');
  1.6458 +			TheClient->iWs.Flush();
  1.6459 +			User::After(KeyRepeatTime()*3/2);
  1.6460 +			iTest->SimulateKey(TRawEvent::EKeyUp, 'A');
  1.6461 +			TheClient->iWs.Flush();
  1.6462 +			AddExpectedKey(EEventKeyDown, 'A');
  1.6463 +			AddExpectedKey(EEventKey,'A','a');
  1.6464 +			AddExpectedKey(EEventKey,'A','a',1);			
  1.6465 +			AddExpectedKey(EEventKeyUp, 'A');
  1.6466 +			break;				
  1.6467 +			
  1.6468 +		case ECaptureKeyUpAndDowns1:
  1.6469 +		case ECaptureKeyUpAndDowns2:
  1.6470 +			// Test RWindowGroup::CaptureKeyUpAndDowns()
  1.6471 +			if (aCaptureApi == ECaptureKeyUpAndDowns1)			
  1.6472 +				iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0);
  1.6473 +			else
  1.6474 +				iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0,1); // priority 1 (default priority is 0)
  1.6475 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.6476 +			TheClient->iWs.Flush();			
  1.6477 +			User::After(KeyRepeatTime()*3/2);
  1.6478 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.6479 +			TheClient->iWs.Flush();
  1.6480 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.6481 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.6482 +			AddExpectedKey(EEventKey,EStdKeySpace,' ',1);
  1.6483 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.6484 +			break;	
  1.6485 +			
  1.6486 +		case ECaptureLongKey1:
  1.6487 +		case ECaptureLongKey2:
  1.6488 +			{
  1.6489 +			// Test RWindowGroup::CaptureLongKey()
  1.6490 +			TTimeIntervalMicroSeconds32 repeat = KeyRepeatTime();
  1.6491 +			if (aCaptureApi == ECaptureLongKey1)
  1.6492 +				{
  1.6493 +				iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ', 'a', 0, 0, 2, ELongCaptureNormal);	
  1.6494 +				}
  1.6495 +			else
  1.6496 +				{
  1.6497 +				repeat = KeyRepeatTime()/2;
  1.6498 +				iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(repeat, ' ', 'a', 0, 0, 2, ELongCaptureNormal);
  1.6499 +				}					
  1.6500 +			iQueueClient->iWs.Flush();
  1.6501 +			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  1.6502 +			TheClient->iWs.Flush();
  1.6503 +			User::After(KeyRepeatTime()*3/2);
  1.6504 +			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  1.6505 +			TheClient->iWs.Flush();
  1.6506 +			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  1.6507 +			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  1.6508 +			AddExpectedKey(EEventKey,EStdKeySpace,'a',1);
  1.6509 +			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  1.6510 +			}
  1.6511 +			break;
  1.6512 +				
  1.6513 +		default:
  1.6514 +			INFO_PRINTF1(_L("Unexpected TCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()"));
  1.6515 +			TEST(EFalse);
  1.6516 +			break;
  1.6517 +		}	
  1.6518 +	
  1.6519 +	if (iCaptureKey)
  1.6520 +		{
  1.6521 +		// End a capture using one of the three RWindowGroup CancelCapture***() APIs,
  1.6522 +		// for each Capture***() API each one of these will be called, therefore there will
  1.6523 +		// be one correct CancelCapture***() APIs called and two incorrect CancelCapture***() 
  1.6524 +		// APIs called for each Capture***() API.
  1.6525 +		switch (aCancelCaptureApi)
  1.6526 +			{
  1.6527 +			case ECancelCaptureKey:
  1.6528 +				iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  1.6529 +				break;
  1.6530 +			case ECancelCaptureKeyUpAndDowns:
  1.6531 +				iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
  1.6532 +				break;
  1.6533 +			case ECancelCaptureLongKey:
  1.6534 +				iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.6535 +				break;
  1.6536 +			default:
  1.6537 +				INFO_PRINTF1(_L("Unexpected TCancelCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()"));
  1.6538 +				TEST(EFalse);
  1.6539 +				break;
  1.6540 +			}
  1.6541 +		
  1.6542 +		// If an mistmatched CancelCapture***() API was called, call the correct one now
  1.6543 +		// to make sure the Capture/CancelCapture state is clean before the next test starts
  1.6544 +		if ((aCaptureApi/2) != aCancelCaptureApi)
  1.6545 +			{
  1.6546 +			switch (aCaptureApi)				
  1.6547 +				{
  1.6548 +				case ECaptureKey1:
  1.6549 +				case ECaptureKey2:
  1.6550 +					iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  1.6551 +					break;
  1.6552 +				case ECaptureKeyUpAndDowns1:
  1.6553 +				case ECaptureKeyUpAndDowns2:
  1.6554 +					iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
  1.6555 +					break;
  1.6556 +				case ECaptureLongKey1:
  1.6557 +				case ECaptureLongKey2:
  1.6558 +					iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  1.6559 +					break;
  1.6560 +				}
  1.6561 +			}
  1.6562 +		}
  1.6563 +		
  1.6564 +	TheClient->iWs.Flush();
  1.6565 +	}	
  1.6566 +
  1.6567 +/*void CTEventTest::_NextSetOfEvents()		//Template for these functions
  1.6568 +	{
  1.6569 +	switch(iEventSet++)
  1.6570 +		{
  1.6571 +		case 0:
  1.6572 +			iQueueClient->iWin->WinTreeNode()->;		//Set up window
  1.6573 +			iQueueClient->iWin->BaseWin()->;
  1.6574 +			iQueueClient->iGroup->GroupWin()->;
  1.6575 +			iQueueClient->iWs.Flush();					//Make take effect
  1.6576 +			SimulateEvent(TRawEvent::);					//Create an event
  1.6577 +			TheClient->iWs.Flush();						//Send event
  1.6578 +			AddExpectedEvent(EEventFocusGained);		//Always get a focus gain at start
  1.6579 +			AddExpectedEvent();							//Expect the event that was created above
  1.6580 +			break;
  1.6581 +		case 1:
  1.6582 +			iQueueClient->iWs.Flush();
  1.6583 +			SimulateEvent(TRawEvent::);
  1.6584 +			TheClient->iWs.Flush();
  1.6585 +			AddExpectedEvent();
  1.6586 +			break;
  1.6587 +		default:
  1.6588 +			CActiveScheduler::Stop();
  1.6589 +			break;
  1.6590 +		}
  1.6591 +	TheClient->iWs.Flush();
  1.6592 +	}*/
  1.6593 +
  1.6594 +/**
  1.6595 +	@SYMTestCaseID GRAPHICS-WSERV-CODEBASE-WSERV-0051
  1.6596 +  
  1.6597 +	@SYMPREQ PGM027
  1.6598 +  
  1.6599 +	@SYMTestCaseDesc Tests SetKeyboardRepeatRate API. 
  1.6600 +   
  1.6601 +	@SYMTestPriority 1 
  1.6602 +  
  1.6603 +	@SYMTestStatus Implemented
  1.6604 +   
  1.6605 +	@SYMTestActions This test tryes to call SetKeyboardRepeatRate with invalid time values\n
  1.6606 +			
  1.6607 +	@SYMTestExpectedResults KeyRepeatRateNegTest should tests the API SetKeyboardRepeatRate return value\n
  1.6608 +	The test should pass and API should return KErrArgument.
  1.6609 +
  1.6610 + */
  1.6611 +void CTEventTest::KeyRepeatRateNegTest(TInt aInitialRepeat, TInt aRepeat)
  1.6612 +	{
  1.6613 +	((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-CODEBASE-WSERV-0051"));
  1.6614 +	TInt ret=TheClient->iWs.SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32(aInitialRepeat), TTimeIntervalMicroSeconds32(aRepeat));
  1.6615 +	TEST(ret==KErrArgument);
  1.6616 +	TRAPD(err,((CTEventTestStep*)iStep)->RecordTestResultL());
  1.6617 +   	if (err!=KErrNone)
  1.6618 +    		INFO_PRINTF1(_L("Failed to record test result"));
  1.6619 +	}
  1.6620 +
  1.6621 +void CTEventTest::RunTestsL(TBool aNeedChildWindows/*=EFalse*/)
  1.6622 +	{
  1.6623 +	iQueueClient=new(ELeave) CTQueueClient(this);
  1.6624 +	iQueueClient->SetScreenNumber(iTest->iScreenNumber);
  1.6625 +	iQueueClient->ConstructL(aNeedChildWindows);
  1.6626 +	iEventSet=0;
  1.6627 +	TRAPD(err,NextSetOfEventsL());
  1.6628 +	if (err!=KErrNone)
  1.6629 +		{
  1.6630 +		iFailed=ETrue;
  1.6631 +		return;
  1.6632 +		}
  1.6633 +//
  1.6634 +	CActiveScheduler::Start();
  1.6635 +//
  1.6636 +	TInt eventsLeft=iQueueClient->EventQueue()->EventsLeft();
  1.6637 +	if (eventsLeft>0)
  1.6638 +		iFailed=ETrue;
  1.6639 +	delete iVisWins1;
  1.6640 +	iVisWins1 = NULL;
  1.6641 +	delete iVisWins2;
  1.6642 +	iVisWins2 = NULL;
  1.6643 +	delete iQueueClient;
  1.6644 +	iQueueClient=NULL;
  1.6645 +	}
  1.6646 +
  1.6647 +void CTEventTest::RunTestsRestoreAreaL(TBool aNeedChildWindows)
  1.6648 +	{
  1.6649 +	TRect area(TheClient->iWs.PointerCursorArea());
  1.6650 +	RunTestsL(aNeedChildWindows);
  1.6651 +	TheClient->iWs.SetPointerCursorArea(area);
  1.6652 +	}
  1.6653 +
  1.6654 +/*void CTEventTest::QueuePurgingL()
  1.6655 +	{
  1.6656 +	RunTestsL(EFalse);
  1.6657 +	}
  1.6658 +
  1.6659 +void CTEventTest::SendEventL()
  1.6660 +	{
  1.6661 +	RunTestsL(EFalse);
  1.6662 +	}
  1.6663 +
  1.6664 +void CTEventTest::InvisibleWindowL()
  1.6665 +	{
  1.6666 +	RunTestsL(ETrue);
  1.6667 +	}
  1.6668 +
  1.6669 +void CTEventTest::JavaAdditionsL()
  1.6670 +	{
  1.6671 +	RunTestsL(EFalse);
  1.6672 +	}*/
  1.6673 +
  1.6674 +void CTEventTest::WindowCapBugL()
  1.6675 +	{
  1.6676 +	RunTestsL(ETrue);
  1.6677 +	}
  1.6678 +
  1.6679 +/*void CTEventTest::XyInputTypeL()
  1.6680 +	{
  1.6681 +	RunTestsL(EFalse);
  1.6682 +	}
  1.6683 +
  1.6684 +void CTEventTest::MovingPointerCursorL()
  1.6685 +	{
  1.6686 +	RunTestsRestoreAreaL(ETrue);
  1.6687 +	}
  1.6688 +
  1.6689 +void CTEventTest::RotatedModeL()
  1.6690 +	{
  1.6691 +	RunTestsRestoreAreaL(EFalse);
  1.6692 +	}*/
  1.6693 +
  1.6694 +/**
  1.6695 +* This test creates one anim and calls AddToEventHandlers() twenty times.
  1.6696 +* it shouldn't add the same anim to event handler if anim is already in handler.
  1.6697 +*/
  1.6698 +void CTEventTest::EventHandlerRemoval_AddEventHandlerMultipleTimes()
  1.6699 +	{
  1.6700 +	iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
  1.6701 +	iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
  1.6702 +
  1.6703 +	RRemovableAnim* eventTestAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll);
  1.6704 +
  1.6705 +	// Call AddToEventHandlers() on same anim 20 times, it should add this anim in event handler only once
  1.6706 +	for (TInt count = 0; count < 20; count++)
  1.6707 +		eventTestAnim->AddToEventHandlers();
  1.6708 +	eventTestAnim->SetEventHandlerLifetime(1);
  1.6709 +
  1.6710 +	TRawEvent rawEvent1;
  1.6711 +	rawEvent1.Set(TRawEvent::EKeyUp, 34);
  1.6712 +
  1.6713 +	eventTestAnim->AddExpectedEvent(rawEvent1);
  1.6714 +
  1.6715 +	// Add these events to iQueueClient for testing
  1.6716 +	AddExpectedKey(EEventKeyUp, 34, ETrue);
  1.6717 +
  1.6718 +	iTest->SimulateKey(TRawEvent::EKeyUp, 34);
  1.6719 +
  1.6720 +	CleanupStack::PopAndDestroy(eventTestAnim);
  1.6721 +	TheClient->iWs.SetAutoFlush(iTheClientFlush);
  1.6722 +	iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
  1.6723 +	}
  1.6724 +
  1.6725 +void CTEventTest::EventQueuePtrCrashTest()
  1.6726 +// Code designed to hit the defect reported in INC109199 & INC105430, needs a very specific sequence of
  1.6727 +// events and client disconnections to hit the exact problem state.
  1.6728 +	{
  1.6729 +	const TInt KNumTestEvents=6;
  1.6730 +	const TInt KMaxNumTestEvents=16;
  1.6731 +	// Number of iterations needs to be as high as the queue granularity to make sure at least
  1.6732 +	// once around we actually hit the code to change the queue size
  1.6733 +	const TInt KNumEvTestIterations=4;
  1.6734 +	const TInt KNumBaseTestSessions=KNumEvTestIterations+1;
  1.6735 +	const TInt KNumMainTestSessions=13;
  1.6736 +	const TInt KMaxNumSessions=KNumBaseTestSessions+KNumMainTestSessions+KNumEvTestIterations;
  1.6737 +	RWsSession wsSessions[KMaxNumSessions];
  1.6738 +	RWindowGroup wGroups[KMaxNumSessions];
  1.6739 +	for(TInt iterationLoop=0;iterationLoop<KNumEvTestIterations;iterationLoop++)
  1.6740 +		{
  1.6741 +		const TInt numTestSessions=KNumBaseTestSessions+KNumMainTestSessions+iterationLoop;
  1.6742 +	#if defined(LOGGING)
  1.6743 +		_LIT(KLog1,"EventQueuePtrCrashTest: Test Creating %d Clients");
  1.6744 +		LOG_MESSAGE2(KLog1,numTestSessions);
  1.6745 +	#endif
  1.6746 +		for(TInt testSessionIndex=0;testSessionIndex<numTestSessions;testSessionIndex++)
  1.6747 +			{
  1.6748 +			RWsSession& ws=wsSessions[testSessionIndex];
  1.6749 +			User::LeaveIfError(ws.Connect());
  1.6750 +			wGroups[testSessionIndex]=RWindowGroup(ws);
  1.6751 +			RWindowGroup& group=wGroups[testSessionIndex];
  1.6752 +			User::LeaveIfError(group.Construct(testSessionIndex+1,EFalse)); 
  1.6753 +			if (testSessionIndex>=KNumBaseTestSessions)
  1.6754 +				{
  1.6755 +				TWsEvent event;
  1.6756 +				for(TInt evLoop=0;evLoop<KNumTestEvents;evLoop++)
  1.6757 +					{
  1.6758 +					event.SetType(1001+evLoop);
  1.6759 +					ws.SendEventToWindowGroup(group.Identifier(),event);
  1.6760 +					}
  1.6761 +				if (testSessionIndex==(numTestSessions-1))
  1.6762 +					{
  1.6763 +					for(TInt eventIndex=0;eventIndex<KMaxNumTestEvents;eventIndex++)
  1.6764 +						{
  1.6765 +						event.SetType(1001+eventIndex);
  1.6766 +						ws.SendEventToAllWindowGroups(event);
  1.6767 +						}
  1.6768 +					}
  1.6769 +				}
  1.6770 +			}
  1.6771 +	#if defined(LOGGING)
  1.6772 +		_LIT(KLog2,"EventQueuePtrCrashTest: Closing Clients");
  1.6773 +		LOG_MESSAGE(KLog2);
  1.6774 +	#endif
  1.6775 +		TInt closeLoop=0;
  1.6776 +		while(closeLoop<KNumBaseTestSessions)
  1.6777 +			{
  1.6778 +			wsSessions[closeLoop++].Close();
  1.6779 +			}
  1.6780 +		RWsSession extraSession1;
  1.6781 +		User::LeaveIfError(extraSession1.Connect());
  1.6782 +		extraSession1.Close();
  1.6783 +		while(closeLoop<numTestSessions)
  1.6784 +			{
  1.6785 +			wsSessions[closeLoop++].Close();
  1.6786 +			}
  1.6787 +		}
  1.6788 +	}
  1.6789 +
  1.6790 +/**
  1.6791 +Test queue size of the new queue can be initialized to be at least EMinQueueSize.
  1.6792 +@param aEventReadyCancel whether there is inactive client. This parameter can be specified
  1.6793 +		to test different code path for expanding spaces for new queue. If the value is false, 
  1.6794 +		the space for the new queue is gained from current global queue or by growing global queue size. 
  1.6795 +		Otherwise, there are inactive clients which	cancel their listening to event, in addition, 
  1.6796 +		memory allocation is simulated to be failed when growing global queue size, 
  1.6797 +		so that space is gained by purging events from inactive clients. 
  1.6798 +*/
  1.6799 +void CTEventTest::InitializeQueueSizeTestL(TBool aEventReadyCancel)
  1.6800 +	{
  1.6801 +	const TInt numEvents = 50;
  1.6802 +	const TInt maxClients = 3; 
  1.6803 +	const TInt oneSecond = 1000000;
  1.6804 +	RWsSession wsSession[maxClients];
  1.6805 +	RWindowGroup groupWin[maxClients];
  1.6806 +	TRequestStatus status;
  1.6807 +	TInt cliHanGrpWin = 10000;
  1.6808 +	RTimer timer;
  1.6809 +	timer.CreateLocal();
  1.6810 +	CleanupClosePushL(timer);
  1.6811 +	// To have the test creating different number of clients is to make sure
  1.6812 +	// there is at least one of the tests meets the below requirement:
  1.6813 +	// the number of the connections when the new queue created for test is not multiple
  1.6814 +	// of queue granularity, so that the queue size initialization is not done by growing
  1.6815 +	// global queue size due to the increase of the connections.
  1.6816 +	for (TInt numClients = maxClients - 1; numClients <= maxClients; numClients++)
  1.6817 +		{
  1.6818 +		TInt clientIndex;
  1.6819 +		//Create test clients
  1.6820 +		for (clientIndex = 0; clientIndex < numClients; clientIndex++)
  1.6821 +			{
  1.6822 +			User::LeaveIfError(wsSession[clientIndex].Connect());
  1.6823 +			CleanupClosePushL(wsSession[clientIndex]);
  1.6824 +			groupWin[clientIndex] = RWindowGroup(wsSession[clientIndex]);
  1.6825 +			User::LeaveIfError(groupWin[clientIndex].Construct(cliHanGrpWin++));
  1.6826 +			CleanupClosePushL(groupWin[clientIndex]);
  1.6827 +			}
  1.6828 +		
  1.6829 +		// Cancel listening to event for the first client. 
  1.6830 +		// This is for testing PurgeInactiveEvents. 
  1.6831 +		if (aEventReadyCancel)
  1.6832 +			{
  1.6833 +			wsSession[0].EventReady(&status);
  1.6834 +			wsSession[0].EventReadyCancel();
  1.6835 +			User::WaitForRequest(status);
  1.6836 +			}
  1.6837 +
  1.6838 +		//send events to window group to make the queue full.
  1.6839 +		TWsEvent event;
  1.6840 +		TInt evLoop;
  1.6841 +		for(evLoop = 0; evLoop < numEvents; evLoop++)
  1.6842 +			{
  1.6843 +			event.SetType(2001 + evLoop);
  1.6844 +			TheClient->iWs.SendEventToWindowGroup(groupWin[0].Identifier(),event);
  1.6845 +			TheClient->iWs.SendEventToWindowGroup(groupWin[1].Identifier(),event);
  1.6846 +			}
  1.6847 +		
  1.6848 +		//To create a new client, although the queue is full, wserv will guarantee to initialize 
  1.6849 +		//the queue size of the new queue to at least EMinQueueSize. So that it can response to 
  1.6850 +		//the event.
  1.6851 +		RWsSession testWsSession;
  1.6852 +		RWindowGroup testGroupWin;
  1.6853 +		TRequestStatus testStatus;
  1.6854 +		if (aEventReadyCancel)
  1.6855 +			{
  1.6856 +			//Simulate the heap allocation failure to test expanding spaces by purge 
  1.6857 +			//events from inactive clients when initialize queue size.
  1.6858 +			TInt failAt = 1;
  1.6859 +			TInt err;
  1.6860 +			do	{
  1.6861 +				TheClient->iWs.HeapSetFail(RHeap::EFailNext, failAt++);
  1.6862 +				TheClient->iWs.Flush();
  1.6863 +				err = testWsSession.Connect();
  1.6864 +				TheClient->iWs.HeapSetFail(RHeap::ENone, 1);
  1.6865 +				} while (err == KErrNoMemory);
  1.6866 +			User::LeaveIfError(err);
  1.6867 +			}
  1.6868 +		else
  1.6869 +			{
  1.6870 +			User::LeaveIfError(testWsSession.Connect());
  1.6871 +			}
  1.6872 +		CleanupClosePushL(testWsSession);
  1.6873 +		testGroupWin = RWindowGroup(testWsSession);
  1.6874 +		User::LeaveIfError(testGroupWin.Construct(cliHanGrpWin++));
  1.6875 +		CleanupClosePushL(testGroupWin);
  1.6876 +	
  1.6877 +		//Send events to the newly created client.
  1.6878 +		// The Debug version of WServ puts a EEventFocusGained into the event 
  1.6879 +		// before this test's custom event, so leave one slot in the queue 
  1.6880 +		// for it.
  1.6881 +#if (defined _DEBUG)
  1.6882 +		TInt testEventCount = EMinQueueSize - 1; 
  1.6883 +#else
  1.6884 +		TInt testEventCount = EMinQueueSize; 
  1.6885 +#endif
  1.6886 +		for(TInt evLoop = 0; evLoop < testEventCount; evLoop++)
  1.6887 +			{
  1.6888 +			event.SetType(3001 + evLoop);
  1.6889 +			TheClient->iWs.SendEventToWindowGroup(testGroupWin.Identifier(),event);
  1.6890 +			}
  1.6891 +		
  1.6892 +		//Check the event queue.
  1.6893 +		//Having a timer here to avoid infinitely wait for event.
  1.6894 +		TInt expectedEvent = 3001;
  1.6895 +		for(TInt evLoop = 0; evLoop < EMinQueueSize; evLoop++)
  1.6896 +            {
  1.6897 +			testWsSession.EventReady(&testStatus);
  1.6898 +			TRequestStatus timerStatus;
  1.6899 +			timer.After(timerStatus, oneSecond);
  1.6900 +			User::WaitForRequest(testStatus, timerStatus);
  1.6901 +			TEST(testStatus == 0);
  1.6902 +			if (testStatus == 0) 
  1.6903 +				{
  1.6904 +				// Tests the event
  1.6905 +				testWsSession.GetEvent(event);
  1.6906 +				// WServ sometimes puts a EEventFocusGained event into the queue 
  1.6907 +				// before the test's custom event, so ignore it.
  1.6908 +				if (event.Type() != EEventFocusGained)
  1.6909 +					{
  1.6910 +					TEST(event.Type() == expectedEvent);
  1.6911 +					expectedEvent++;
  1.6912 +					}
  1.6913 +				// testStatus has been completed. Cancel the timer.
  1.6914 +				timer.Cancel();
  1.6915 +				User::WaitForRequest(timerStatus);
  1.6916 +				}
  1.6917 +			else
  1.6918 +				{
  1.6919 +				// Times out, cancel the event notification
  1.6920 +				testWsSession.EventReadyCancel();
  1.6921 +				User::WaitForRequest(testStatus);
  1.6922 +				}
  1.6923 +			}
  1.6924 +		CleanupStack::PopAndDestroy(2*numClients + 2, &wsSession[0]);
  1.6925 +		}
  1.6926 +	CleanupStack::PopAndDestroy(&timer);
  1.6927 +	}
  1.6928 +
  1.6929 +void CTEventTest::SimulateRepeatEvent(TInt aScanCode, TInt aRepeats/*=0*/)
  1.6930 +    {
  1.6931 +    TRawEvent rawEvent;
  1.6932 +    if (aRepeats)
  1.6933 +        rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode, aRepeats);
  1.6934 +    else
  1.6935 +        rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode);
  1.6936 +    UserSvr::AddEvent(rawEvent);
  1.6937 +    }
  1.6938 +
  1.6939 +void CTEventTest::RawEventRepeatTest_NextSetOfEventsL()
  1.6940 +    {
  1.6941 +    switch(iEventSet++)
  1.6942 +        {
  1.6943 +        case 0:
  1.6944 +            // Tests EKeyRepeat without repeat value set.
  1.6945 +            SimulateRepeatEvent(32);
  1.6946 +            
  1.6947 +            // Tests EKeyRepeat with repeat value set to 2.
  1.6948 +            SimulateRepeatEvent(33,2);
  1.6949 +          
  1.6950 +            AddExpectedEvent(EEventFocusGained);
  1.6951 +            AddExpectedKey(EEventKey, 32);
  1.6952 +            AddExpectedKey(EEventKey, 33, 0, 2);
  1.6953 +            break;
  1.6954 +        default:
  1.6955 +             CActiveScheduler::Stop();
  1.6956 +             break;
  1.6957 +        }
  1.6958 +    TheClient->iWs.Flush();
  1.6959 +    }
  1.6960 +
  1.6961 +void CTEventTest::RunTestCaseL(TInt /*aCurTestCase*/)
  1.6962 +	{
  1.6963 +	_LIT(KTest0,"General 1");
  1.6964 +	_LIT(KTest1,"Event queue purging");
  1.6965 +	_LIT(KTest2,"SendEvent");
  1.6966 +	_LIT(KTest3,"SendEventToAll");
  1.6967 +	_LIT(KTest4,"InvisibleWindow");
  1.6968 +	_LIT(KTest5,"JavaAdditions");
  1.6969 +	_LIT(KTest6,"WindowCaptureBug");
  1.6970 +	_LIT(KTest7,"XYInput Types");
  1.6971 +	_LIT(KTest8,"MovingPointerCursor");
  1.6972 +	_LIT(KTest9,"Rotated Modes");
  1.6973 +	_LIT(KTest10,"Anim Event");
  1.6974 +	_LIT(KTest11,"Focus Changed");
  1.6975 +	_LIT(KTest12,"On/Off Events");
  1.6976 +	_LIT(KTest13,"Virtual Keyboard");
  1.6977 +	_LIT(KTest14,"Key Clicks");
  1.6978 +	_LIT(KTest15,"Capture Long");
  1.6979 +	_LIT(KTest16,"Password Window");
  1.6980 +	_LIT(KTest17,"Group List Changed");
  1.6981 +	_LIT(KTest18,"Repeatable Key Events");
  1.6982 +	_LIT(KTest19,"Screen Scaling");
  1.6983 +	_LIT(KTest20,"Visibility Changed Events");
  1.6984 +	_LIT(KTest21,"Check Time Stamp Of Events");
  1.6985 +	_LIT(KTest22,"Pointer Capture Priority Events");
  1.6986 +	_LIT(KTest23,"Event Handler Removal");
  1.6987 +	_LIT(KTest24,"Event Queue ptr crash test");
  1.6988 +	_LIT(KTest25,"Mismatched Pointer Events");
  1.6989 +	_LIT(KTest26,"Pointer Buffer Purge");
  1.6990 +	_LIT(KTest27,"TRawEvent test for Repeats");
  1.6991 +#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 
  1.6992 +	_LIT(KTest28,"Translation of key events by routing plug-in");
  1.6993 +	_LIT(KTest29,"Blocking of key events by routing plug-in");
  1.6994 +	_LIT(KTest30,"App UID based restriction of key capture");
  1.6995 +	_LIT(KTest31,"App UID based routing of key events");
  1.6996 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
  1.6997 +	_LIT(KTest32,"Transparent Surface Visibility Changed Events 1");
  1.6998 +	_LIT(KTest33,"Transparent Surface Visibility Changed Events 2");
  1.6999 +	_LIT(KTest34,"Transparent Surface Visibility Changed Events 3");
  1.7000 +#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  1.7001 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1.7002 +	_LIT(KTest35A,"Initialize Queue Size without inactive queue");
  1.7003 +	_LIT(KTest35B,"Initialize Queue Size with inactive queue");	
  1.7004 +	
  1.7005 +	if (!TestBase()->ConfigurationSupportsPointerEventTesting())
  1.7006 +	    {
  1.7007 +	    INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
  1.7008 +	    TestComplete();
  1.7009 +	    return;
  1.7010 +	    }
  1.7011 +	
  1.7012 +	//if (iTest->iState==1) iTest->iState=14;	//Use this line to skip to a particular test
  1.7013 +	((CTEventTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
  1.7014 +	switch(iTest->iState)
  1.7015 +		{
  1.7016 +/**
  1.7017 +@SYMTestCaseID		GRAPHICS-WSERV-0053
  1.7018 +
  1.7019 +@SYMDEF             DEF081259
  1.7020 +
  1.7021 +@SYMTestCaseDesc    Carry out general event tests on WServ
  1.7022 +
  1.7023 +@SYMTestPriority    High
  1.7024 +
  1.7025 +@SYMTestStatus      Implemented
  1.7026 +
  1.7027 +@SYMTestActions     General events are sent via WServ
  1.7028 +
  1.7029 +@SYMTestExpectedResults The events are sent without error
  1.7030 +*/
  1.7031 +		case 0:
  1.7032 +			iTest->LogSubTest(KTest0);
  1.7033 +			General();
  1.7034 +			((CTEventTestStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-WSERV-0053"));
  1.7035 +			//iState=8;
  1.7036 +			break;
  1.7037 +/**
  1.7038 +@SYMTestCaseID		GRAPHICS-WSERV-0054
  1.7039 +
  1.7040 +@SYMDEF             DEF081259
  1.7041 +
  1.7042 +@SYMTestCaseDesc    Carry out event queue purging
  1.7043 +
  1.7044 +@SYMTestPriority    High
  1.7045 +
  1.7046 +@SYMTestStatus      Implemented
  1.7047 +
  1.7048 +@SYMTestActions     Purge the event queue
  1.7049 +
  1.7050 +@SYMTestExpectedResults The events queue is purged without error
  1.7051 +*/
  1.7052 +		case 1:
  1.7053 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0054"));
  1.7054 +			iTest->LogSubTest(KTest1);
  1.7055 +			RunTestsL();		//QueuePurgingL();
  1.7056 +			break;
  1.7057 +/**
  1.7058 +@SYMTestCaseID		GRAPHICS-WSERV-0055
  1.7059 +
  1.7060 +@SYMDEF             DEF081259
  1.7061 +
  1.7062 +@SYMTestCaseDesc    Test that events can be sent
  1.7063 +
  1.7064 +@SYMTestPriority    High
  1.7065 +
  1.7066 +@SYMTestStatus      Implemented
  1.7067 +
  1.7068 +@SYMTestActions     Send events in WServ
  1.7069 +
  1.7070 +@SYMTestExpectedResults The events are sent without error
  1.7071 +*/
  1.7072 +		case 2:
  1.7073 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0055"));
  1.7074 +			iTest->LogSubTest(KTest2);
  1.7075 +			RunTestsL();		//SendEventL();
  1.7076 +			break;
  1.7077 +/**
  1.7078 +@SYMTestCaseID		GRAPHICS-WSERV-0056
  1.7079 +
  1.7080 +@SYMDEF             DEF081259
  1.7081 +
  1.7082 +@SYMTestCaseDesc    Send an event to all window groups
  1.7083 +
  1.7084 +@SYMTestPriority    High
  1.7085 +
  1.7086 +@SYMTestStatus      Implemented
  1.7087 +
  1.7088 +@SYMTestActions     Send an event to all window groups
  1.7089 +
  1.7090 +@SYMTestExpectedResults The events are sent to all window groups
  1.7091 +						without error
  1.7092 +*/
  1.7093 +		case 3:
  1.7094 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0056"));
  1.7095 +			iTest->LogSubTest(KTest3);
  1.7096 +			General2();
  1.7097 +			break;
  1.7098 +/**
  1.7099 +@SYMTestCaseID		GRAPHICS-WSERV-0057
  1.7100 +
  1.7101 +@SYMDEF             DEF081259
  1.7102 +
  1.7103 +@SYMTestCaseDesc    Send events to an invisible window
  1.7104 +
  1.7105 +@SYMTestPriority    High
  1.7106 +
  1.7107 +@SYMTestStatus      Implemented
  1.7108 +
  1.7109 +@SYMTestActions     Send events to an invisible window
  1.7110 +
  1.7111 +@SYMTestExpectedResults The events are sent to the window without
  1.7112 +						error
  1.7113 +*/
  1.7114 +		case 4:
  1.7115 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0057"));
  1.7116 +			iTest->LogSubTest(KTest4);
  1.7117 +			RunTestsL(ETrue);		//InvisibleWindowL();
  1.7118 +			break;
  1.7119 +/**
  1.7120 +@SYMTestCaseID		GRAPHICS-WSERV-0058
  1.7121 +
  1.7122 +@SYMDEF             DEF081259
  1.7123 +
  1.7124 +@SYMTestCaseDesc    Send events for java additions
  1.7125 +
  1.7126 +@SYMTestPriority    High
  1.7127 +
  1.7128 +@SYMTestStatus      Implemented
  1.7129 +
  1.7130 +@SYMTestActions     Send events for java additions
  1.7131 +
  1.7132 +@SYMTestExpectedResults The events are sent to the window without
  1.7133 +						error
  1.7134 +*/
  1.7135 +		case 5:
  1.7136 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0058"));
  1.7137 +			iTest->LogSubTest(KTest5);
  1.7138 +			RunTestsL();		//JavaAdditionsL();
  1.7139 +			break;
  1.7140 +
  1.7141 +		case 6:
  1.7142 +			((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  1.7143 +			iTest->LogSubTest(KTest6);
  1.7144 +			//WindowCapBugL();		//Not finished
  1.7145 +			break;
  1.7146 +/**
  1.7147 +@SYMTestCaseID		GRAPHICS-WSERV-0059
  1.7148 +
  1.7149 +@SYMDEF             DEF081259
  1.7150 +
  1.7151 +@SYMTestCaseDesc    Send events for x and y inputs
  1.7152 +
  1.7153 +@SYMTestPriority    High
  1.7154 +
  1.7155 +@SYMTestStatus      Implemented
  1.7156 +
  1.7157 +@SYMTestActions     Send events for x and y inputs
  1.7158 +
  1.7159 +@SYMTestExpectedResults The events are sent to the window without
  1.7160 +						error
  1.7161 +*/
  1.7162 +		case 7:
  1.7163 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0059"));
  1.7164 +			iTest->LogSubTest(KTest7);
  1.7165 +			RunTestsL();		//XyInputTypeL();
  1.7166 +			break;
  1.7167 +/**
  1.7168 +@SYMTestCaseID		GRAPHICS-WSERV-0060
  1.7169 +
  1.7170 +@SYMDEF             DEF081259
  1.7171 +
  1.7172 +@SYMTestCaseDesc    Send events for moving pointer cursor
  1.7173 +
  1.7174 +@SYMTestPriority    High
  1.7175 +
  1.7176 +@SYMTestStatus      Implemented
  1.7177 +
  1.7178 +@SYMTestActions     Send events for moving pointer cursor
  1.7179 +
  1.7180 +@SYMTestExpectedResults The events are sent to the window without
  1.7181 +						error
  1.7182 +*/
  1.7183 +		case 8:
  1.7184 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0060"));
  1.7185 +			iTest->LogSubTest(KTest8);
  1.7186 +			RunTestsRestoreAreaL(ETrue);		//MovingPointerCursorL();
  1.7187 +		    break;
  1.7188 +/**
  1.7189 +@SYMTestCaseID		GRAPHICS-WSERV-0061
  1.7190 +
  1.7191 +@SYMDEF             DEF081259
  1.7192 +
  1.7193 +@SYMTestCaseDesc    Send events for rotate mode
  1.7194 +
  1.7195 +@SYMTestPriority    High
  1.7196 +
  1.7197 +@SYMTestStatus      Implemented
  1.7198 +
  1.7199 +@SYMTestActions     Send events for rotate mode
  1.7200 +
  1.7201 +@SYMTestExpectedResults The events are sent to the window without
  1.7202 +						error
  1.7203 +*/
  1.7204 +		case 9:
  1.7205 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0061"));
  1.7206 +			iTest->LogSubTest(KTest9);
  1.7207 +			RunTestsRestoreAreaL(EFalse);		//RotatedModeL();
  1.7208 +			break;
  1.7209 +/**
  1.7210 +@SYMTestCaseID		GRAPHICS-WSERV-0062
  1.7211 +
  1.7212 +@SYMDEF             DEF081259
  1.7213 +
  1.7214 +@SYMTestCaseDesc    Send events for an anim event
  1.7215 +
  1.7216 +@SYMTestPriority    High
  1.7217 +
  1.7218 +@SYMTestStatus      Implemented
  1.7219 +
  1.7220 +@SYMTestActions     Send events for an anim event
  1.7221 +
  1.7222 +@SYMTestExpectedResults The events are sent to the window without
  1.7223 +						error
  1.7224 +*/
  1.7225 +		case 10:
  1.7226 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0062"));
  1.7227 +			iTest->LogSubTest(KTest10);
  1.7228 +			RunTestsRestoreAreaL(EFalse);		//AnimEvent();
  1.7229 +			break;
  1.7230 +/**
  1.7231 +@SYMTestCaseID		GRAPHICS-WSERV-0063
  1.7232 +
  1.7233 +@SYMDEF             DEF081259
  1.7234 +
  1.7235 +@SYMTestCaseDesc    Send events for focus changed
  1.7236 +
  1.7237 +@SYMTestPriority    High
  1.7238 +
  1.7239 +@SYMTestStatus      Implemented
  1.7240 +
  1.7241 +@SYMTestActions     Send events for focus changed
  1.7242 +
  1.7243 +@SYMTestExpectedResults The events are sent to the window without
  1.7244 +						error
  1.7245 +*/
  1.7246 +		case 11:
  1.7247 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0063"));
  1.7248 +			iTest->LogSubTest(KTest11);
  1.7249 +			RunTestsL();		//FocusChanged();
  1.7250 +			break;
  1.7251 +/**
  1.7252 +@SYMTestCaseID		GRAPHICS-WSERV-0064
  1.7253 +
  1.7254 +@SYMDEF             DEF081259
  1.7255 +
  1.7256 +@SYMTestCaseDesc    Send stop events
  1.7257 +
  1.7258 +@SYMTestPriority    High
  1.7259 +
  1.7260 +@SYMTestStatus      Implemented
  1.7261 +
  1.7262 +@SYMTestActions     Send stop events
  1.7263 +
  1.7264 +@SYMTestExpectedResults The events are sent to the window without
  1.7265 +						error
  1.7266 +*/
  1.7267 +		case 12:
  1.7268 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0064"));
  1.7269 +			iTest->LogSubTest(KTest12);
  1.7270 +			RunTestsL(ETrue);		//StopEvents();
  1.7271 +			break;
  1.7272 +/**
  1.7273 +@SYMTestCaseID		GRAPHICS-WSERV-0065
  1.7274 +
  1.7275 +@SYMDEF             DEF081259
  1.7276 +
  1.7277 +@SYMTestCaseDesc    Send events for the virtual keyboard
  1.7278 +
  1.7279 +@SYMTestPriority    High
  1.7280 +
  1.7281 +@SYMTestStatus      Implemented
  1.7282 +
  1.7283 +@SYMTestActions     Send events for the virtual keyboard
  1.7284 +
  1.7285 +@SYMTestExpectedResults The events are sent to the window without
  1.7286 +						error
  1.7287 +*/
  1.7288 +		case 13:
  1.7289 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0065"));
  1.7290 +			iTest->LogSubTest(KTest13);
  1.7291 +			RunTestsL();		//VirtualKeyboard();
  1.7292 +			break;
  1.7293 +/**
  1.7294 +@SYMTestCaseID		GRAPHICS-WSERV-0066
  1.7295 +
  1.7296 +@SYMDEF             DEF081259
  1.7297 +
  1.7298 +@SYMTestCaseDesc    Send events for key clicks
  1.7299 +
  1.7300 +@SYMTestPriority    High
  1.7301 +
  1.7302 +@SYMTestStatus      Implemented
  1.7303 +
  1.7304 +@SYMTestActions     Send stop events
  1.7305 +
  1.7306 +@SYMTestExpectedResults The events are sent to the window without
  1.7307 +						error
  1.7308 +*/
  1.7309 +		case 14:
  1.7310 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0066"));
  1.7311 +			iTest->LogSubTest(KTest14);
  1.7312 +			{
  1.7313 +			TBool changeable;
  1.7314 +			if (iClick.IsLoaded(changeable) && !iTest->IsFullRomL())
  1.7315 +				RunTestsL(ETrue);		//KeyClicks();
  1.7316 +			}
  1.7317 +			break;
  1.7318 +/**
  1.7319 +@SYMTestCaseID		GRAPHICS-WSERV-0067
  1.7320 +
  1.7321 +@SYMDEF             DEF081259
  1.7322 +
  1.7323 +@SYMTestCaseDesc    Test RWindowGroup::CaptureLongKey()
  1.7324 +
  1.7325 +@SYMTestPriority    High
  1.7326 +
  1.7327 +@SYMTestStatus      Implemented
  1.7328 +
  1.7329 +@SYMTestActions     Simulate long key presses and check that long key capture
  1.7330 +					and key repeat work as expected.
  1.7331 +
  1.7332 +@SYMTestExpectedResults The correct key events are sent to the window without
  1.7333 +						error
  1.7334 +*/
  1.7335 +		case 15:
  1.7336 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0067"));
  1.7337 +			iTest->LogSubTest(KTest15);
  1.7338 +			RunTestsL(ETrue);		//CaptureLong();
  1.7339 +			break;
  1.7340 +/**
  1.7341 +@SYMTestCaseID		GRAPHICS-WSERV-0068
  1.7342 +
  1.7343 +@SYMDEF             DEF081259
  1.7344 +
  1.7345 +@SYMTestCaseDesc    Send events for activating password
  1.7346 +
  1.7347 +@SYMTestPriority    High
  1.7348 +
  1.7349 +@SYMTestStatus      Implemented
  1.7350 +
  1.7351 +@SYMTestActions     Send events for activating password
  1.7352 +
  1.7353 +@SYMTestExpectedResults The events are sent to the window without
  1.7354 +						error
  1.7355 +*/
  1.7356 +		case 16:
  1.7357 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0068"));
  1.7358 +			iTest->LogSubTest(KTest16);
  1.7359 +			if (!iTest->IsFullRomL())
  1.7360 +				RunTestsL();		//Password();
  1.7361 +			break;
  1.7362 +/**
  1.7363 +@SYMTestCaseID		GRAPHICS-WSERV-0069
  1.7364 +
  1.7365 +@SYMDEF             DEF081259
  1.7366 +
  1.7367 +@SYMTestCaseDesc    Send events for activating password
  1.7368 +
  1.7369 +@SYMTestPriority    High
  1.7370 +
  1.7371 +@SYMTestStatus      Implemented
  1.7372 +
  1.7373 +@SYMTestActions     Send events for activating password
  1.7374 +
  1.7375 +@SYMTestExpectedResults The events are sent to the window without
  1.7376 +						error
  1.7377 +*/
  1.7378 +		case 17:
  1.7379 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0069"));
  1.7380 +			iTest->LogSubTest(KTest17);
  1.7381 +			RunTestsL();
  1.7382 +			break;
  1.7383 +/**
  1.7384 +@SYMTestCaseID		GRAPHICS-WSERV-0070
  1.7385 +
  1.7386 +@SYMDEF             DEF081259
  1.7387 +
  1.7388 +@SYMTestCaseDesc    Send repeatable key events
  1.7389 +
  1.7390 +@SYMTestPriority    High
  1.7391 +
  1.7392 +@SYMTestStatus      Implemented
  1.7393 +
  1.7394 +@SYMTestActions     Send repeatable key events
  1.7395 +
  1.7396 +@SYMTestExpectedResults The events are sent to the window without
  1.7397 +						error
  1.7398 +*/
  1.7399 +		case 18:
  1.7400 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0070"));
  1.7401 +			iTest->LogSubTest(KTest18);
  1.7402 +			RunTestsL();
  1.7403 +			break;
  1.7404 +/**
  1.7405 +@SYMTestCaseID		GRAPHICS-WSERV-0071
  1.7406 +
  1.7407 +@SYMDEF             DEF081259
  1.7408 +
  1.7409 +@SYMTestCaseDesc    Send Screen Scaling events
  1.7410 +
  1.7411 +@SYMTestPriority    High
  1.7412 +
  1.7413 +@SYMTestStatus      Implemented
  1.7414 +
  1.7415 +@SYMTestActions     Send Screen Scaling events
  1.7416 +
  1.7417 +@SYMTestExpectedResults The events are sent to the window without
  1.7418 +						error
  1.7419 +*/
  1.7420 +		case 19:
  1.7421 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0071"));
  1.7422 +			iTest->LogSubTest(KTest19);
  1.7423 +			if (iScreenModeTests&EDoScale)
  1.7424 +				{
  1.7425 +				RunTestsL();
  1.7426 +				}
  1.7427 +			break;
  1.7428 +/**
  1.7429 +@SYMTestCaseID		GRAPHICS-WSERV-0072
  1.7430 +
  1.7431 +@SYMDEF             DEF081259
  1.7432 +
  1.7433 +@SYMTestCaseDesc    Send Visibility Changed events
  1.7434 +
  1.7435 +@SYMTestPriority    High
  1.7436 +
  1.7437 +@SYMTestStatus      Implemented
  1.7438 +
  1.7439 +@SYMTestActions     Send Visibility Changed events
  1.7440 +
  1.7441 +@SYMTestExpectedResults The events are sent to the window without
  1.7442 +						error
  1.7443 +*/
  1.7444 +		case 20:
  1.7445 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0072"));
  1.7446 +			iTest->LogSubTest(KTest20);
  1.7447 +			RunTestsL();
  1.7448 +			break;
  1.7449 +/**
  1.7450 +@SYMTestCaseID		GRAPHICS-WSERV-0073
  1.7451 +
  1.7452 +@SYMDEF             DEF081259
  1.7453 +
  1.7454 +@SYMTestCaseDesc    Check Time Stamp Of Sent Events
  1.7455 +
  1.7456 +@SYMTestPriority    High
  1.7457 +
  1.7458 +@SYMTestStatus      Implemented
  1.7459 +
  1.7460 +@SYMTestActions     Check Time Stamp Of Sent Events
  1.7461 +
  1.7462 +@SYMTestExpectedResults The time stamps for the events are correct
  1.7463 +*/
  1.7464 +		case 21:
  1.7465 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0073"));
  1.7466 +			iTest->LogSubTest(KTest21);
  1.7467 +			RunTestsL();
  1.7468 +			break;
  1.7469 +/**
  1.7470 +@SYMTestCaseID		GRAPHICS-WSERV-0074
  1.7471 +
  1.7472 +@SYMDEF             DEF081259
  1.7473 +
  1.7474 +@SYMTestCaseDesc    Send Pointer Capture Priority Events
  1.7475 +
  1.7476 +@SYMTestPriority    High
  1.7477 +
  1.7478 +@SYMTestStatus      Implemented
  1.7479 +
  1.7480 +@SYMTestActions     Send Pointer Capture Priority Events
  1.7481 +
  1.7482 +@SYMTestExpectedResults The events are sent to the window without
  1.7483 +						error
  1.7484 +*/
  1.7485 +		case 22:
  1.7486 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0074"));
  1.7487 +			iTest->LogSubTest(KTest22);
  1.7488 +			RunTestsL();
  1.7489 +			break;
  1.7490 +/**
  1.7491 +@SYMTestCaseID		GRAPHICS-WSERV-0343
  1.7492 +
  1.7493 +@SYMDEF             DEF081259
  1.7494 +
  1.7495 +@SYMTestCaseDesc    Send Event Handler Removal Events
  1.7496 +
  1.7497 +@SYMTestPriority    High
  1.7498 +
  1.7499 +@SYMTestStatus      Implemented
  1.7500 +
  1.7501 +@SYMTestActions     Send Event Handler Removal Events
  1.7502 +
  1.7503 +@SYMTestExpectedResults The events are sent to the window without
  1.7504 +						error
  1.7505 +*/
  1.7506 +		case 23:
  1.7507 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0343"));
  1.7508 +			iTest->LogSubTest(KTest23);
  1.7509 +			RunTestsL();                   //EventHandlerRemoval();
  1.7510 +			break;
  1.7511 +		case 24:
  1.7512 +/**
  1.7513 +@SYMTestCaseID		GRAPHICS-WSERV-0565
  1.7514 +*/
  1.7515 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0565"));
  1.7516 +			iTest->LogSubTest(KTest24);
  1.7517 +			EventQueuePtrCrashTest();
  1.7518 +			break;
  1.7519 +/**
  1.7520 +@SYMTestCaseID 		GRAPHICS-WSERV-0496
  1.7521 +
  1.7522 +@SYMDEF 			DEF133776
  1.7523 +
  1.7524 +@SYMTestCaseDesc 	Cancels key captures using all combinations of 
  1.7525 +  RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs.
  1.7526 +
  1.7527 +@SYMTestPriority 	High
  1.7528 +
  1.7529 +@SYMTestStatus 		Implemented
  1.7530 +
  1.7531 +@SYMTestActions 	Call each of the RWindowGroup::Capture***() APIs followed by
  1.7532 + each of the RWindowGroup::CancelCapture***() APIs.
  1.7533 + RWindowGroup::Capture***() APIs:
  1.7534 + 	CaptureKey(TUint, TUint, TUint)
  1.7535 + 	CaptureKey(TUint, TUint, TUint, TInt)
  1.7536 + 	CaptureKeyUpAndDowns(TUint, TUint, TUint)
  1.7537 + 	CaptureKeyUpAndDowns(TUint, TUint, TUint, TInt)
  1.7538 + 	CaptureLongKey(TUint, TUint, TUint, TUint, TInt, TUint)
  1.7539 + 	CaptureLongKey(TTimeIntervalMicroSeconds32, TUint, TUint, TUint, TUint, TInt, TUint)
  1.7540 + RWindowGroup::CancelCapture***() APIs:
  1.7541 +	CancelCaptureKey()
  1.7542 +	CancelCaptureKeyUpAndDowns()
  1.7543 +	CancelCaptureLongKey()
  1.7544 + 
  1.7545 +@SYMTestExpectedResults WServ should handle matched and mismatched Cancel 
  1.7546 + and Capture calls without panicking.
  1.7547 +*/			
  1.7548 +		case 25:
  1.7549 +// Skip this test in debug on the emulator, run it always on hardware as debug ROMs include
  1.7550 +// a release version of the production code that doesn't panic
  1.7551 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0496"));
  1.7552 +#if defined(_DEBUG) && !defined (__MARM__)
  1.7553 +			INFO_PRINTF1(_L("Skipping this test in _DEBUG on emulator to avoid debug only panics, see GRAPHICS-WSERV-0497 for the matching panic test"));				
  1.7554 +#else						
  1.7555 +			iTest->LogSubTest(KTest25);
  1.7556 +			RunTestsL();
  1.7557 +#endif
  1.7558 +			break;	
  1.7559 +/**
  1.7560 +@SYMTestCaseID		GRAPHICS-WSERV-0444
  1.7561 +
  1.7562 +@SYMDEF             PDEF110849
  1.7563 +
  1.7564 +@SYMTestCaseDesc    Pointer Buffer Exception After Event Queue Purge
  1.7565 +
  1.7566 +@SYMTestPriority    High
  1.7567 +
  1.7568 +@SYMTestStatus      Implemented
  1.7569 +
  1.7570 +@SYMTestActions     Connect to pointer buffer, send it some pointer events and disconnect.
  1.7571 +					Now send enough events to cause an event queue purge.  The purge will
  1.7572 +					attempt to empty the pointer buffer, but will fail because we have disconnected.
  1.7573 +
  1.7574 +@SYMTestExpectedResults The purge will realise it does not need to empty the pointer buffer and 
  1.7575 +						so there will not be an access violation - exception.
  1.7576 +						
  1.7577 +*/			
  1.7578 +		case 26:
  1.7579 +			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0444"));
  1.7580 +			iTest->LogSubTest(KTest26);
  1.7581 +			RunTestsL();
  1.7582 +			break;
  1.7583 +/**
  1.7584 +@SYMTestCaseID		GRAPHICS-WSERV-0484
  1.7585 +@SYMDEF             PDEF120721
  1.7586 +@SYMTestCaseDesc    Window server guarantees to initialize the queue size of the new queue to 
  1.7587 +					at least EMinQueueSize.
  1.7588 +@SYMTestPriority    High
  1.7589 +@SYMTestStatus      Implemented
  1.7590 +@SYMTestActions     Create multiple clients to connect to window server.
  1.7591 +					Send enough events to make the event queue full.
  1.7592 +					Create a new client to connect to window server.
  1.7593 +					Send events to the new client and test that the new client 
  1.7594 +					can get the events.
  1.7595 +@SYMTestExpectedResults Window server guarantees to initialize the size of the new event 
  1.7596 +						queue to EMinQueueSize, so that window server will not lock up
  1.7597 +						due to the full of global event queue.
  1.7598 +						
  1.7599 +*/			
  1.7600 +		case 27:
  1.7601 +		    iTest->LogSubTest(KTest27);
  1.7602 +		    RunTestsL();
  1.7603 +		    break;
  1.7604 +		    
  1.7605 +#ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA            
  1.7606 +/**
  1.7607 +@SYMTestCaseID      GRAPHICS-WSERV-0751, GRAPHICS-WSERV-0752, GRAPHICS-WSERV-0753
  1.7608 +@SYMPREQ			417-61800
  1.7609 +@SYMTestCaseDesc    Test translation of key events by Key Event Routing plug-in
  1.7610 +@SYMTestPriority    High
  1.7611 +@SYMTestStatus      Implemented
  1.7612 +@SYMTestActions     Use RWindowGroup::CaptureKey() to capture pseudo key
  1.7613 +					Device0 (key code EKeyDevice0, scan code EStdKeyDevice0).
  1.7614 +					Simulate pressing key Device1.
  1.7615 +					Repeat using CaptureKeyUpAndDowns().
  1.7616 +					Repeat using CaptureLongKey().
  1.7617 +					Repeat without any capture requests.
  1.7618 +@SYMTestExpectedResults
  1.7619 +					The key event delivered contains the key or scan code for
  1.7620 +					Device0, if captured. When using CaptureKey() and
  1.7621 +					CaptureLongKey(), only the key code is translated. Using
  1.7622 +					CaptureKeyUpAndDowns(), only the scan code is translated.
  1.7623 +
  1.7624 +Note: this test requires an entry in the translation table of the Key Routing
  1.7625 +Plug-in to map Device0 to Device1 at capture request time.
  1.7626 +*/
  1.7627 +		case 28:
  1.7628 +            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0751"));
  1.7629 +            iTest->LogSubTest(KTest28);
  1.7630 +            RunTestsL();
  1.7631 +            break;
  1.7632 +
  1.7633 +/**
  1.7634 +@SYMTestCaseID      GRAPHICS-WSERV-0760, GRAPHICS-WSERV-0761, GRAPHICS-WSERV-0762
  1.7635 +@SYMPREQ			417-61800
  1.7636 +@SYMTestCaseDesc    Test blocking of key events by Key Event Routing plug-in
  1.7637 +@SYMTestPriority    High
  1.7638 +@SYMTestStatus      Implemented
  1.7639 +@SYMTestActions     Simulate pressing a blocked key (Device3) while no
  1.7640 +					key capture is in effect.
  1.7641 +					Use RWindowGroup::CaptureKey() to capture EKeyDevice3
  1.7642 +					and simulate pressing the blocked key again.
  1.7643 +					Repeat using CaptureKeyUpAndDowns().
  1.7644 +					Repeat using CaptureLongKey().
  1.7645 +@SYMTestExpectedResults
  1.7646 +					The blocked key event is only delivered when captured and
  1.7647 +					is not routed to the focussed window group by default.
  1.7648 +
  1.7649 +Note: this test requires entries in the Blocked Key Table of the Reference
  1.7650 +Key Routing Plug-in for EKeyDevice3 and EStdKeyDevice3.
  1.7651 +*/
  1.7652 +		case 29:
  1.7653 +            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0760"));
  1.7654 +            iTest->LogSubTest(KTest29);
  1.7655 +            RunTestsL();
  1.7656 +            break;
  1.7657 +
  1.7658 +/**
  1.7659 +@SYMTestCaseID      GRAPHICS-WSERV-0754, GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756
  1.7660 +@SYMPREQ			417-61800
  1.7661 +@SYMTestCaseDesc    Test application UID-based restriction of key capture by
  1.7662 +					Key Event Routing plug-in.
  1.7663 +@SYMTestPriority    High
  1.7664 +@SYMTestStatus      Implemented
  1.7665 +@SYMTestActions     Attempt to capture a key that is restricted by UID
  1.7666 +					to another application.
  1.7667 +					Use RWindowGroup::CaptureKey() to capture a key that is
  1.7668 +					restricted to the current application's UID.
  1.7669 +					Simulate pressing the second key.
  1.7670 +					Repeat using CaptureKeyUpAndDowns().
  1.7671 +					Repeat using CaptureLongKey().
  1.7672 +@SYMTestExpectedResults
  1.7673 +					Capture of the first key fails with KErrPermissionDenied.
  1.7674 +					Capture of the second key succeeds and the key event is
  1.7675 +					delivered.
  1.7676 +
  1.7677 +Note: this test requires entries in the Restricted Key Table of the Reference
  1.7678 +Key Routing Plug-in for the chosen keys.
  1.7679 +*/
  1.7680 +		case 30:
  1.7681 +            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0754"));
  1.7682 +            iTest->LogSubTest(KTest30);
  1.7683 +            RunTestsL();
  1.7684 +            break;
  1.7685 +
  1.7686 +/**
  1.7687 +@SYMTestCaseID      GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758, GRAPHICS-WSERV-0759
  1.7688 +@SYMPREQ			417-61800
  1.7689 +@SYMTestCaseDesc    Test application UID-based routing of key events by
  1.7690 +					Key Event Routing plug-in.
  1.7691 +@SYMTestPriority    High
  1.7692 +@SYMTestStatus      Implemented
  1.7693 +@SYMTestActions     Invoke another application to capture two different keys
  1.7694 +					with high priority using each of RWindowGroup::CaptureKey(),
  1.7695 +					CaptureKeyUpAndDowns() and CaptureLongKey(). One key of
  1.7696 +					each pair has precedence for capture by the current
  1.7697 +					application's UID (i.e. this test).
  1.7698 +					In the current application, use RWindowGroup::CaptureKey()
  1.7699 +					to capture both keys with lower priority.
  1.7700 +					Simulate pressing the keys.
  1.7701 +					Repeat using CaptureKeyUpAndDowns().
  1.7702 +					Repeat using CaptureLongKey().
  1.7703 +@SYMTestExpectedResults
  1.7704 +					The key event with UID-based precedence is delivered to
  1.7705 +					the current application but the other key is not.
  1.7706 +
  1.7707 +Note: this test requires entries in the Priority Application Table of the
  1.7708 +Reference Key Routing Plug-in for the chosen key.
  1.7709 +*/
  1.7710 +		case 31:
  1.7711 +            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0757"));
  1.7712 +            iTest->LogSubTest(KTest31);
  1.7713 +            RunTestsL();
  1.7714 +            break;
  1.7715 +
  1.7716 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
  1.7717 +/**
  1.7718 +@SYMTestCaseID      GRAPHICS-WSERV-2669-0015
  1.7719 +@SYMREQ             REQ13202: Possibility for external layers to appear above UI layer
  1.7720 +@SYMTestCaseDesc    Window obscured by transparent surface window receives 
  1.7721 +                    (EPartiallyVisible | EFullyVisible) when surface is made semi-transparent.
  1.7722 +@SYMTestPriority    2
  1.7723 +@SYMPrerequisites   Win1 – bottom window
  1.7724 +                    Win2 – middle window with background surface, which totally obscures win1
  1.7725 +@SYMTestActions     Call SetSurfaceTransparency(ETrue) on win2
  1.7726 +@SYMTestExpectedResults Win1 receives visibility event
  1.7727 +*/            
  1.7728 +        case 32:
  1.7729 +            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0015"));
  1.7730 +            iTest->LogSubTest(KTest32);
  1.7731 +            RunTestsL();
  1.7732 +            break;
  1.7733 +/**
  1.7734 +@SYMTestCaseID      GRAPHICS-WSERV-2669-0016
  1.7735 +@SYMREQ             REQ13202: Possibility for external layers to appear above UI layer 
  1.7736 +@SYMTestCaseDesc    Window obscured by semi-transparent surface window receives   
  1.7737 +                    (EPartiallyVisible | EFullyVisible) when obscuring window is deleted
  1.7738 +@SYMTestPriority    2
  1.7739 +@SYMPrerequisites   Win1 – bottom window
  1.7740 +                    Win2 – middle window with semi-transparent background surface, which totally obscures win1
  1.7741 +                    Win3 – top window which totally obscures win2, and is opaque
  1.7742 +@SYMTestActions     Delete win3
  1.7743 +@SYMTestExpectedResults Both win1 and win2 receive visibility events
  1.7744 +*/            
  1.7745 +        case 33:
  1.7746 +            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0016"));
  1.7747 +            iTest->LogSubTest(KTest33);
  1.7748 +            RunTestsL();
  1.7749 +            break;
  1.7750 +/**
  1.7751 +@SYMTestCaseID      GRAPHICS-WSERV-2669-0017
  1.7752 +@SYMREQ             REQ13202: Possibility for external layers to appear above UI layer 
  1.7753 +@SYMTestCaseDesc    Window does not receive any visibiliy event when a semi-transparent
  1.7754 +                    surface is moved onto/above it.
  1.7755 +@SYMTestPriority    2
  1.7756 +@SYMPrerequisites   Win1 – bottom window
  1.7757 +                    Win2 – top window which does not overlap win1
  1.7758 +@SYMTestActions     Move win2 to overlap win1
  1.7759 +@SYMTestExpectedResults No visibility event is received (win1 is still fully visible)
  1.7760 +*/            
  1.7761 +        case 34:
  1.7762 +            ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0017"));
  1.7763 +            iTest->LogSubTest(KTest34);
  1.7764 +            RunTestsL();
  1.7765 +            break;
  1.7766 +#endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS  
  1.7767 +#endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1.7768 +
  1.7769 +/**
  1.7770 +@SYMTestCaseID      GRAPHICS-WSERV-0559
  1.7771 +@SYMDEF             INC140850
  1.7772 +@SYMTestCaseDesc    To check Wserv passes correct repeat value for TRawEvent of type EKeyRepeat.
  1.7773 +@SYMTestPriority    High
  1.7774 +@SYMTestStatus      Implemented
  1.7775 +@SYMTestActions     Simulate TRawEvent of type EKeyRepeat without Repeat value set.
  1.7776 +                    Simulate the above with repeat value set to 2.
  1.7777 +@SYMTestExpectedResults Simulated events should match expected events added to the array. 
  1.7778 +*/
  1.7779 +
  1.7780 +#ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1.7781 +		case 28:
  1.7782 +#else
  1.7783 +#ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  1.7784 +		case 35:
  1.7785 +#else
  1.7786 +		case 32:
  1.7787 +#endif
  1.7788 +#endif
  1.7789 +		    // This test was moved to be the last test in the test suite, because it sometimes leaves events in the event queue, 
  1.7790 +		    //it can affect the results of other tests. This test case should be the last test in the test suite. 
  1.7791 +		    ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0484"));
  1.7792 +		    iTest->LogSubTest(KTest35A);
  1.7793 +		    InitializeQueueSizeTestL(EFalse);
  1.7794 +		    iTest->LogSubTest(KTest35B);
  1.7795 +		    InitializeQueueSizeTestL(ETrue);
  1.7796 +		    break;    
  1.7797 +			
  1.7798 +		default:
  1.7799 +            ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  1.7800 +			((CTEventTestStep*)iStep)->CloseTMSGraphicsStep();
  1.7801 +			TestComplete();
  1.7802 +			break;
  1.7803 +		}
  1.7804 +	((CTEventTestStep*)iStep)->RecordTestResultL();
  1.7805 +	if (iFailed)
  1.7806 +		{
  1.7807 +		TEST(EFalse);
  1.7808 +		iFailed=EFalse;
  1.7809 +		}
  1.7810 +	++iTest->iState;
  1.7811 +	}
  1.7812 +
  1.7813 +__WS_CONSTRUCT_STEP__(EventTest)
  1.7814 +