windowing/windowserver/test/tauto/TEvent.CPP
changeset 188 1b081cb0800b
parent 103 2717213c588a
child 178 89bd4cfee505
equal deleted inserted replaced
187:9f66f99ee56f 188:1b081cb0800b
     1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of "Eclipse Public License v1.0"
     4 // under the terms of "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    35 //#define DETAILED
    35 //#define DETAILED
    36 #define LOGGING 1	//Uncomment this when there is a fail so that you get more logging
    36 #define LOGGING 1	//Uncomment this when there is a fail so that you get more logging
    37 
    37 
    38 _LIT(KKeyClickPluginDll, "click.dll");
    38 _LIT(KKeyClickPluginDll, "click.dll");
    39 
    39 
       
    40 const TInt KLongKeyCaptureLowPriority = 1;
       
    41 const TInt KLongKeyCaptureHighPriority = 2;
       
    42 
    40 CTQueueClient::CTQueueClient(CTEventTest *aTest) : iTest(aTest)
    43 CTQueueClient::CTQueueClient(CTEventTest *aTest) : iTest(aTest)
    41 	{
    44 	{
    42 	}
    45 	}
    43 
    46 
    44 CTQueueClient::~CTQueueClient()
    47 CTQueueClient::~CTQueueClient()
   201 			}
   204 			}
   202 	#endif
   205 	#endif
   203 		TestL(wsEvent.Type()==expectedEvent.Type() && wsEvent.Handle()==expectedEvent.Handle());
   206 		TestL(wsEvent.Type()==expectedEvent.Type() && wsEvent.Handle()==expectedEvent.Handle());
   204 		}		
   207 		}		
   205 	iLastEventError=(wsEvent.Type()==EEventErrorMessage);
   208 	iLastEventError=(wsEvent.Type()==EEventErrorMessage);
       
   209 
   206 	switch(wsEvent.Type())
   210 	switch(wsEvent.Type())
   207 		{
   211 		{
   208 		case EEventKey:
   212 		case EEventKey:
   209 		#if defined(FAIL_LOGGING)
   213 		#if defined(FAIL_LOGGING)
   210 			wsKeyCode=wsEvent.Key()->iCode,eKeyCode=expectedEvent.Key()->iCode;
   214 			wsKeyCode=wsEvent.Key()->iCode,eKeyCode=expectedEvent.Key()->iCode;
   211 			if (wsKeyCode!=eKeyCode)
   215 			if (wsKeyCode!=eKeyCode)
   212 				{
   216 				{
   213 				_LIT(KKeysDiff,"Count=%d  Key Code Exp=%d (%c)  Act=%d (%c)");
   217 				_LIT(KKeysDiff,"Count=%d  Key Code Exp=%d (%c)  Act=%d (%c)");
   214 				buf.Copy(KStartString);
   218 				buf.Copy(KStartString);
   215 				buf.AppendFormat(KKeysDiff,iEventCount,iEventCount,eKeyCode,eKeyCode,wsKeyCode,wsKeyCode);
   219 				buf.AppendFormat(KKeysDiff,iEventCount,eKeyCode,eKeyCode,wsKeyCode,wsKeyCode);
   216 				iTest->LOG_MESSAGE(buf);
   220 				iTest->LOG_MESSAGE(buf);
   217 				}
   221 				}
   218 			wsKeyRepeat=wsEvent.Key()->iRepeats,eKeyRepeat=expectedEvent.Key()->iRepeats;
   222 			wsKeyRepeat=wsEvent.Key()->iRepeats,eKeyRepeat=expectedEvent.Key()->iRepeats;
   219 			if ((wsKeyRepeat>0)!=(eKeyRepeat>0) || wsKeyRepeat<eKeyRepeat)
   223 			if ((wsKeyRepeat>0)!=(eKeyRepeat>0) || wsKeyRepeat<eKeyRepeat)
   220 				{
   224 				{
   222 				buf.Copy(KStartString);
   226 				buf.Copy(KStartString);
   223 				buf.AppendFormat(KKeysRepDiff,iEventCount,eKeyRepeat,wsKeyRepeat);
   227 				buf.AppendFormat(KKeysRepDiff,iEventCount,eKeyRepeat,wsKeyRepeat);
   224 				iTest->LOG_MESSAGE(buf);
   228 				iTest->LOG_MESSAGE(buf);
   225 				}
   229 				}
   226 		#endif
   230 		#endif
   227 			TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode && wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats
   231 			TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode &&
   228 								&& (wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0));		//Fall Through
   232 				wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats &&
       
   233 				(wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0));
       
   234 			// Fall Through
   229 		case EEventKeyDown:
   235 		case EEventKeyDown:
   230 		case EEventKeyUp:
   236 		case EEventKeyUp:
       
   237 			{
       
   238 			TUint wsModifiers = wsEvent.Key()->iModifiers;
       
   239 			TUint eModifiers = expectedEvent.Key()->iModifiers;
   231 		#if defined(FAIL_LOGGING)
   240 		#if defined(FAIL_LOGGING)
   232 			wsKeyScan=wsEvent.Key()->iScanCode,eKeyScan=expectedEvent.Key()->iScanCode;
   241 			wsKeyScan=wsEvent.Key()->iScanCode,eKeyScan=expectedEvent.Key()->iScanCode;
   233 			if (wsKeyScan!=eKeyScan)
   242 			if (wsKeyScan!=eKeyScan)
   234 				{
   243 				{
   235 				_LIT(KScanDiff,"Count=%d  Scan Code Exp=%d (%c)  Act=%d (%c)");
   244 				_LIT(KScanDiff,"Count=%d  Scan Code Exp=%d (%c)  Act=%d (%c)");
   236 				buf.Copy(KStartString);
   245 				buf.Copy(KStartString);
   237 				buf.AppendFormat(KScanDiff,iEventCount,eKeyScan,eKeyScan,wsKeyScan,wsKeyScan);
   246 				buf.AppendFormat(KScanDiff,iEventCount,eKeyScan,eKeyScan,wsKeyScan,wsKeyScan);
   238 				iTest->LOG_MESSAGE(buf);
   247 				iTest->LOG_MESSAGE(buf);
   239 				}
   248 				}
       
   249 
       
   250 			if (eModifiers != KModifiersIgnore && wsModifiers != eModifiers)
       
   251 				{
       
   252 				_LIT(KModDiff,"Count=%d  Modifiers Exp=0x%x  Act=0x%x");
       
   253 				buf.Copy(KStartString);
       
   254 				buf.AppendFormat(KModDiff, iEventCount, eModifiers, wsModifiers);
       
   255 				iTest->LOG_MESSAGE(buf);
       
   256 				}
   240 		#endif
   257 		#endif
   241 			TestL(wsEvent.Key()->iScanCode==expectedEvent.Key()->iScanCode);
   258 			TestL(wsEvent.Key()->iScanCode == expectedEvent.Key()->iScanCode &&
       
   259 				(eModifiers == KModifiersIgnore || wsModifiers == eModifiers));
       
   260 			}
   242 			break;
   261 			break;
   243 		case EEventModifiersChanged:
   262 		case EEventModifiersChanged:
   244 			{
   263 			{
   245 			TBool changeModifiersOK=(wsEvent.ModifiersChanged()->iChangedModifiers
   264 			TBool changeModifiersOK=(wsEvent.ModifiersChanged()->iChangedModifiers
   246 																==expectedEvent.ModifiersChanged()->iChangedModifiers);
   265 																==expectedEvent.ModifiersChanged()->iChangedModifiers);
   706 	// 2d or 3d pointer?
   725 	// 2d or 3d pointer?
   707 	if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone)
   726 	if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone)
   708 		{
   727 		{
   709 		iIs3DPointer=EFalse;
   728 		iIs3DPointer=EFalse;
   710 		}
   729 		}
   711 #endif		
   730 #endif
       
   731 	TheClient->iWs.GetKeyboardRepeatRate(iKeyBoardRepeatInitialDelay, iKeyBoardRepeatNextDelay);
   712 	}
   732 	}
   713 
   733 
   714 void CTEventTest::Failed()
   734 void CTEventTest::Failed()
   715 	{
   735 	{
   716 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	
   736 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	
   818 	TCallBack callBack(EventCancelFunc,TheClient);
   838 	TCallBack callBack(EventCancelFunc,TheClient);
   819 	TheClient->SetCancelFunction(callBack);
   839 	TheClient->SetCancelFunction(callBack);
   820 	group.SetOrdinalPosition(position,priority);
   840 	group.SetOrdinalPosition(position,priority);
   821 	}
   841 	}
   822 
   842 
   823 void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
   843 void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
   824 	{
   844 	{
   825 	TPckgBuf<TWsEvent> evtPkg;
   845 	TPckgBuf<TWsEvent> evtPkg;
   826 	TWsEvent& event=evtPkg();
   846 	TWsEvent& event=evtPkg();
   827 	if (aEventCode==EEventKey && aCode==0)
   847 	if (aEventCode==EEventKey && aCode==0)
   828 		aCode=aScanCode;
   848 		aCode=aScanCode;
   832 	event.Key()->iScanCode=aScanCode;
   852 	event.Key()->iScanCode=aScanCode;
   833 	event.Key()->iModifiers=aModifiers;
   853 	event.Key()->iModifiers=aModifiers;
   834 	event.Key()->iRepeats=aRepeats;
   854 	event.Key()->iRepeats=aRepeats;
   835 	iQueueClient->AddExpectedEvent(event);
   855 	iQueueClient->AddExpectedEvent(event);
   836 	if (iAddToClick)
   856 	if (iAddToClick)
       
   857 		{
       
   858 		if (aModifiers == KModifiersIgnore)
       
   859 			{
       
   860 			// Key click tests assume zero modifiers in click event by default
       
   861 			event.Key()->iModifiers = 0;
       
   862 			}
   837 		iClick.CommandReply(EClickEventAdd,evtPkg);
   863 		iClick.CommandReply(EClickEventAdd,evtPkg);
   838 	}
   864 		}
   839 
   865 	}
   840 void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
   866 
       
   867 void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
   841 	{
   868 	{
   842 	__ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital));
   869 	__ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital));
   843 	AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,aModifiers);
   870 	// EModiferAutorepeatable can be present in EEventKey but is never valid
       
   871 	// in EEventKeyDown and EEventKeyUp. 
       
   872 	TUint modifiersDownUp = (aModifiers == KModifiersIgnore) ?
       
   873 		aModifiers : aModifiers & ~EModifierAutorepeatable;
       
   874 
       
   875 	AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,modifiersDownUp);
   844 	AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers);
   876 	AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers);
   845 	AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,aModifiers);
   877 	AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,modifiersDownUp);
   846 	}
   878 	}
   847 
   879 
   848 void CTEventTest::AddExpectedEvent(TInt aEventCode, CTWinBase* aWin)
   880 void CTEventTest::AddExpectedEvent(TInt aEventCode, CTWinBase* aWin)
   849 	{
   881 	{
   850 	TWsQTEvent event;
   882 	TWsQTEvent event;
  1158 		PointerBufferPurge_NextSetOfEventsL();		
  1190 		PointerBufferPurge_NextSetOfEventsL();		
  1159 		break;	
  1191 		break;	
  1160 	case 27:
  1192 	case 27:
  1161 	    RawEventRepeatTest_NextSetOfEventsL();
  1193 	    RawEventRepeatTest_NextSetOfEventsL();
  1162 	    break;
  1194 	    break;
  1163 	    
  1195 
  1164 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	    
       
  1165 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 	    
  1196 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 	    
  1166     case 28:
  1197     case 28:
       
  1198         KeyEventTranslation_NextSetOfEventsL();
       
  1199         break;
       
  1200     case 29:
       
  1201         KeyEventBlocking_NextSetOfEventsL();
       
  1202         break;
       
  1203     case 30:
       
  1204         KeyEventAppRestriction_NextSetOfEventsL();
       
  1205         break;
       
  1206     case 31:
       
  1207         KeyEventAppPriority_NextSetOfEventsL();
       
  1208         break;
       
  1209 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS	    
       
  1210     case 32:
  1167         SurfaceVisibilityChanged1_NextSetOfEventsL();
  1211         SurfaceVisibilityChanged1_NextSetOfEventsL();
  1168         break;
  1212         break;
  1169     case 29:
  1213     case 33:
  1170         SurfaceVisibilityChanged2_NextSetOfEventsL();
  1214         SurfaceVisibilityChanged2_NextSetOfEventsL();
  1171         break;
  1215         break;
  1172     case 30:
  1216     case 34:
  1173         SurfaceVisibilityChanged3_NextSetOfEventsL();
  1217         SurfaceVisibilityChanged3_NextSetOfEventsL();
  1174         break;
  1218         break;
       
  1219 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  1175 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1220 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  1176 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
       
  1177         
  1221         
  1178 	default:
  1222 	default:
  1179 		AutoPanic(EAutoPanicWrongTest);
  1223 		AutoPanic(EAutoPanicWrongTest);
  1180 		}
  1224 		}
  1181 	}
  1225 	}
  3543 			iTest->SimulateKeyDownUp(EStdKeyLeftShift);		//2 events
  3587 			iTest->SimulateKeyDownUp(EStdKeyLeftShift);		//2 events
  3544 			events=14;
  3588 			events=14;
  3545 			break;
  3589 			break;
  3546 		case 2:
  3590 		case 2:
  3547 			AddExpectedKey(EEventKeyDown,EStdKeyRightShift,0,0,EModifierRightShift|EModifierShift);
  3591 			AddExpectedKey(EEventKeyDown,EStdKeyRightShift,0,0,EModifierRightShift|EModifierShift);
  3548 			AddExpectedKeyDownUp('B','B',0,EModifierRightShift|EModifierShift);
  3592 			AddExpectedKeyDownUp('B','B',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable);
  3549 			AddExpectedKeyDownUp('W','W',0,EModifierRightShift|EModifierShift);
  3593 			AddExpectedKeyDownUp('W','W',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable);
  3550 			AddExpectedKey(EEventKeyUp,EStdKeyRightShift);
  3594 			AddExpectedKey(EEventKeyUp,EStdKeyRightShift);
  3551 			iQueueClient->iWs.Flush();
  3595 			iQueueClient->iWs.Flush();
  3552 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift);		//1 event
  3596 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift);		//1 event
  3553 			iTest->SimulateKeyDownUp('B');		//3 events
  3597 			iTest->SimulateKeyDownUp('B');		//3 events
  3554 			iTest->SimulateKeyDownUp('W');		//3 events
  3598 			iTest->SimulateKeyDownUp('W');		//3 events
  3852 	iClick.CommandReply(EClickReset,TPtrC8(NULL,0));
  3896 	iClick.CommandReply(EClickReset,TPtrC8(NULL,0));
  3853 	}
  3897 	}
  3854 
  3898 
  3855 void CTEventTest::CaptureLong_NextSetOfEventsL()
  3899 void CTEventTest::CaptureLong_NextSetOfEventsL()
  3856 	{
  3900 	{
  3857 	TTimeIntervalMicroSeconds32 initialTime,time;
       
  3858 	TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
       
  3859 	#if defined(LOGGING)
  3901 	#if defined(LOGGING)
  3860 		TLogMessageText logMessageText;
  3902 		TLogMessageText logMessageText;
  3861 		_LIT(KSet,"CaptureLong SetOfEvents: %d of 14");
  3903 		_LIT(KSet,"CaptureLong SetOfEvents: %d of 23");
  3862 		logMessageText.Format(KSet,iEventSet);
  3904 		logMessageText.Format(KSet,iEventSet);
  3863 		INFO_PRINTF1(logMessageText);
  3905 		INFO_PRINTF1(logMessageText);
  3864 	#endif
  3906 	#endif
  3865 
  3907 
  3866 	switch(iEventSet++)
  3908 	switch(iEventSet++)
  3870 			iTest->SimulateKeyDownUp('A');
  3912 			iTest->SimulateKeyDownUp('A');
  3871 			AddExpectedEvent(EEventFocusGained);
  3913 			AddExpectedEvent(EEventFocusGained);
  3872 			AddExpectedKeyDownUp('A','a');
  3914 			AddExpectedKeyDownUp('A','a');
  3873 			break;
  3915 			break;
  3874 		case 1:
  3916 		case 1:
  3875 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal);
  3917 			// Test CaptureLongKey() with modifier value EModifierShift and flag value ELongCaptureNormal
  3876 			iQueueClient->iWs.Flush();
  3918 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',EModifierShift,EModifierShift,2,ELongCaptureNormal);
       
  3919 			iQueueClient->iWs.Flush();
       
  3920 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift);
  3877 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  3921 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  3878 			TheClient->iWs.Flush();
  3922 			TheClient->iWs.Flush();
  3879 			User::After(initialTime.Int()+time.Int()/3);
  3923 			DelayForRepeatEvents(1, 3);
  3880 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  3924 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
       
  3925 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift);
       
  3926 			AddExpectedKey(EEventKeyDown,EStdKeyLeftShift);
  3881 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  3927 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  3882 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  3928 			AddExpectedKey(EEventKey,EStdKeySpace,' ',0,EModifierLeftShift|EModifierShift|EModifierAutorepeatable);
  3883 			AddExpectedKey(EEventKey,EStdKeySpace,'a',1);
  3929 			AddExpectedKey(EEventKey,EStdKeySpace,'a',1,EModifierLongKey|EModifierLeftShift|EModifierShift|EModifierAutorepeatable);
  3884 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  3930 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
       
  3931 			AddExpectedKey(EEventKeyUp,EStdKeyLeftShift);
  3885 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  3932 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  3886 			break;
  3933 			break;
  3887 		case 2:
  3934 		case 2:	
  3888 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureWaitShort);
  3935 			// Test CaptureLongKey() with modifier value EModifierFunc and flag value ELongCaptureWaitShort
  3889 			iQueueClient->iWs.Flush();
  3936 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc,EModifierFunc,2,ELongCaptureWaitShort);
  3890 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  3937 			iQueueClient->iWs.Flush();
  3891 			TheClient->iWs.Flush();
  3938 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
  3892 			User::After(initialTime.Int()+time.Int()/3);
  3939 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter);
  3893 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  3940 			TheClient->iWs.Flush();
       
  3941 			DelayForRepeatEvents(1, 3);
       
  3942 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter);
       
  3943 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
  3894 			iTest->SimulateKeyDownUp(EStdKeySpace);
  3944 			iTest->SimulateKeyDownUp(EStdKeySpace);
  3895 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  3945 			AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc);
  3896 			AddExpectedKey(EEventKey,EStdKeySpace,'a',1);
  3946 			AddExpectedKey(EEventKeyDown,EStdKeyEnter);
  3897 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  3947 			AddExpectedKey(EEventKey,EStdKeyEnter,'a',1,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierAutorepeatable);
       
  3948 			AddExpectedKey(EEventKeyUp,EStdKeyEnter);
       
  3949 			AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc);
  3898 			AddExpectedKeyDownUp(EStdKeySpace,' ');
  3950 			AddExpectedKeyDownUp(EStdKeySpace,' ');
  3899 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  3951 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  3900 			break;
  3952 			break;
  3901 		case 3:
  3953 		case 3:
  3902 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  3954 			// Test CaptureLongKey() with modifier values EModifierFunc|EModifierAlt and flag values ELongCaptureNormal|ELongCaptureRepeatEvents)
  3903 			iQueueClient->iWs.Flush();
  3955 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc|EModifierAlt,EModifierFunc|EModifierAlt,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  3904 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  3956 			iQueueClient->iWs.Flush();
  3905 			TheClient->iWs.Flush();
  3957 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc);
  3906 			User::After(initialTime.Int()+5*time.Int());
  3958 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftAlt);
  3907 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  3959 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter);
  3908 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  3960 			TheClient->iWs.Flush();
  3909 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  3961 			DelayForRepeatEvents(5, 1);
  3910 			AddExpectedKey(EEventKey,EStdKeySpace,'a',2);
  3962 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter);
  3911 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  3963 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftAlt);
       
  3964 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc);
       
  3965 			AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc);
       
  3966 			AddExpectedKey(EEventKeyDown,EStdKeyLeftAlt);
       
  3967 			AddExpectedKey(EEventKeyDown,EStdKeyEnter);
       
  3968 			AddExpectedKey(EEventKey,EStdKeyEnter,EKeyEnter,0,EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable);
       
  3969 			AddExpectedKey(EEventKey,EStdKeyEnter,'a',2,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable);
       
  3970 			AddExpectedKey(EEventKeyUp,EStdKeyEnter);
       
  3971 			AddExpectedKey(EEventKeyUp,EStdKeyLeftAlt);
       
  3972 			AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc);
  3912 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  3973 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  3913 			break;
  3974 			break;
  3914 		case 4:
  3975 		case 4:
  3915 			iQueueClient->iWs.Flush();
  3976 			iQueueClient->iWs.Flush();
  3916 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  3977 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  3917 			TheClient->iWs.Flush();
  3978 			TheClient->iWs.Flush();
  3918 			User::After(initialTime.Int()+3*time.Int());
  3979 			DelayForRepeatEvents(3, 1);
  3919 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  3980 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  3920 			TheClient->iWs.Flush();
  3981 			TheClient->iWs.Flush();
  3921 			User::After(initialTime.Int()+2*time.Int());
  3982 			DelayForRepeatEvents(2, 1);
  3922 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  3983 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  3923 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  3984 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  3924 			AddExpectedKey(EEventKeyDown,'Z');
  3985 			AddExpectedKey(EEventKeyDown,'Z');
  3925 			AddExpectedKey(EEventKey,'Z','z');
  3986 			AddExpectedKey(EEventKey,'Z','z');
  3926 			AddExpectedKey(EEventKey,'Z','z',1);
  3987 			AddExpectedKey(EEventKey,'Z','z',1);
  3932 			break;
  3993 			break;
  3933 		case 5:
  3994 		case 5:
  3934 			iQueueClient->iWs.Flush();
  3995 			iQueueClient->iWs.Flush();
  3935 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  3996 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  3936 			TheClient->iWs.Flush();
  3997 			TheClient->iWs.Flush();
  3937 			User::After(initialTime.Int()+3*time.Int());
  3998 			DelayForRepeatEvents(3, 1);
  3938 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  3999 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  3939 			TheClient->iWs.Flush();
  4000 			TheClient->iWs.Flush();
  3940 			User::After(initialTime.Int()+5*time.Int()/2);
  4001 			DelayForRepeatEvents(5, 2);
  3941 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  4002 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  3942 			TheClient->iWs.Flush();
  4003 			TheClient->iWs.Flush();
  3943 			User::After(initialTime.Int()+2*time.Int());
  4004 			DelayForRepeatEvents(2, 1);
  3944 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  4005 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  3945 			AddExpectedKey(EEventKeyDown,'Z');
  4006 			AddExpectedKey(EEventKeyDown,'Z');
  3946 			AddExpectedKey(EEventKey,'Z','z');
  4007 			AddExpectedKey(EEventKey,'Z','z');
  3947 			AddExpectedKey(EEventKey,'Z','z',1);
  4008 			AddExpectedKey(EEventKey,'Z','z',1);
  3948 			AddExpectedKey(EEventKeyDown,'Y');
  4009 			AddExpectedKey(EEventKeyDown,'Y');
  3955 		case 6:
  4016 		case 6:
  3956 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal);
  4017 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal);
  3957 			iQueueClient->iWs.Flush();
  4018 			iQueueClient->iWs.Flush();
  3958 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  4019 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  3959 			TheClient->iWs.Flush();
  4020 			TheClient->iWs.Flush();
  3960 			User::After(initialTime.Int()+3*time.Int());
  4021 			DelayForRepeatEvents(3, 1);
  3961 			iTest->SimulateKeyDownUp(EStdKeySpace);
  4022 			iTest->SimulateKeyDownUp(EStdKeySpace);
  3962 			TheClient->iWs.Flush();
  4023 			TheClient->iWs.Flush();
  3963 			if(!iTest->IsFullRomL())
  4024 			if(!iTest->IsFullRomL())
  3964 				{
  4025 				{
  3965 				User::After(initialTime.Int()+2*time.Int());
  4026 				DelayForRepeatEvents(2, 1);
  3966 				}
  4027 				}
  3967 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  4028 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  3968 			AddExpectedKey(EEventKeyDown,'X');
  4029 			AddExpectedKey(EEventKeyDown,'X');
  3969 			AddExpectedKey(EEventKey,'X','x');
  4030 			AddExpectedKey(EEventKey,'X','x');
  3970 			AddExpectedKey(EEventKey,'X','x',1);
  4031 			AddExpectedKey(EEventKey,'X','x',1);
  3981 		case 7:
  4042 		case 7:
  3982 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  4043 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  3983 			iQueueClient->iWs.Flush();
  4044 			iQueueClient->iWs.Flush();
  3984 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  4045 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  3985 			TheClient->iWs.Flush();
  4046 			TheClient->iWs.Flush();
  3986 			User::After(initialTime.Int()+5*time.Int());
  4047 			DelayForRepeatEvents(5, 1);
  3987 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4048 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  3988 			TheClient->iWs.Flush();
  4049 			TheClient->iWs.Flush();
  3989 			User::After(initialTime.Int()+time.Int()/3);
  4050 			DelayForRepeatEvents(1, 3);
  3990 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4051 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  3991 			TheClient->iWs.Flush();
  4052 			TheClient->iWs.Flush();
  3992 			User::ResetInactivityTime();
  4053 			User::ResetInactivityTime();
  3993 			User::After(initialTime.Int()+4*time.Int());
  4054 			DelayForRepeatEvents(4, 1);
  3994 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  4055 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  3995 			AddExpectedKey(EEventKeyDown,'X');
  4056 			AddExpectedKey(EEventKeyDown,'X');
  3996 			AddExpectedKey(EEventKey,'X','x');
  4057 			AddExpectedKey(EEventKey,'X','x');
  3997 			AddExpectedKey(EEventKey,'X','x',1);
  4058 			AddExpectedKey(EEventKey,'X','x',1);
  3998 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4059 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4006 		case 8:
  4067 		case 8:
  4007 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','c',0,0,2,ELongCaptureRepeatEvents);
  4068 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','c',0,0,2,ELongCaptureRepeatEvents);
  4008 			iQueueClient->iWs.Flush();
  4069 			iQueueClient->iWs.Flush();
  4009 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4070 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4010 			TheClient->iWs.Flush();
  4071 			TheClient->iWs.Flush();
  4011 			User::After(initialTime.Int()+5*time.Int());
  4072 			DelayForRepeatEvents(5, 1);
  4012 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4073 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4013 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4074 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4014 			AddExpectedKey(EEventKey,EStdKeySpace,'c',1);
  4075 			AddExpectedKey(EEventKey,EStdKeySpace,'c',1);
  4015 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  4076 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  4016 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  4077 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  4020 			TInt captureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEscape,'e',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  4081 			TInt captureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEscape,'e',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  4021 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','d',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  4082 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','d',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  4022 			iQueueClient->iWs.Flush();
  4083 			iQueueClient->iWs.Flush();
  4023 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4084 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4024 			TheClient->iWs.Flush();
  4085 			TheClient->iWs.Flush();
  4025 			User::After(initialTime.Int()+5*time.Int()/2);
  4086 			DelayForRepeatEvents(5, 2);
  4026 			iTest->SimulateKeyDownUp(EStdKeyEscape);
  4087 			iTest->SimulateKeyDownUp(EStdKeyEscape);
  4027 			TheClient->iWs.Flush();
  4088 			TheClient->iWs.Flush();
  4028 			User::After(initialTime.Int()+3*time.Int());
  4089 			DelayForRepeatEvents(3, 1);
  4029 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4090 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4030 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4091 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4031 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  4092 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  4032 			AddExpectedKey(EEventKey,EStdKeySpace,'d',1);
  4093 			AddExpectedKey(EEventKey,EStdKeySpace,'d',1);
  4033 			AddExpectedKey(EEventKeyDown,EStdKeyEscape);
  4094 			AddExpectedKey(EEventKeyDown,EStdKeyEscape);
  4043 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  4104 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents);
  4044 			iQueueClient->iWs.Flush();
  4105 			iQueueClient->iWs.Flush();
  4045 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4106 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4046 			TheClient->iWs.Flush();
  4107 			TheClient->iWs.Flush();
  4047 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  4108 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  4048 			User::After(initialTime.Int()+5*time.Int());
  4109 			DelayForRepeatEvents(5, 1);
  4049 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4110 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4050 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4111 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4051 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  4112 			AddExpectedKey(EEventKey,EStdKeySpace,' ');
  4052 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  4113 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  4053 			break;
  4114 			break;
  4054 		case 11:
  4115 		case 11:
  4055 			//Cancel a capture key up and down event whilst a repeat is underway
  4116 			// Cancel a key up/down capture whilst a repeat is underway.
  4056 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0);
  4117 			// This should have no effect since only key press events are
       
  4118 			// repeated.
       
  4119 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns('X',0,0);
  4057 			iQueueClient->iWs.Flush();
  4120 			iQueueClient->iWs.Flush();
  4058 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  4121 			iTest->SimulateKey(TRawEvent::EKeyDown,'X');
  4059 			TheClient->iWs.Flush();
  4122 			TheClient->iWs.Flush();
  4060 			iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
  4123 			iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
  4061 			User::After(initialTime.Int()+5*time.Int());
  4124 			DelayForRepeatEvents(5, 1);
  4062 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  4125 			iTest->SimulateKey(TRawEvent::EKeyUp,'X');
  4063 			AddExpectedKey(EEventKeyDown,'X');
  4126 			AddExpectedKey(EEventKeyDown,'X');
  4064 			AddExpectedKey(EEventKey,'X','x');
  4127 			AddExpectedKey(EEventKey,'X','x');
       
  4128 			AddExpectedKey(EEventKey,'X','x',2);
  4065 			AddExpectedKey(EEventKeyUp,'X');
  4129 			AddExpectedKey(EEventKeyUp,'X');
  4066 			break;
  4130 			break;
  4067 		case 12:
  4131 		case 12:
  4068 			//Cancel a capture key event whilst a repeat is underway
  4132 			//Cancel a capture key event whilst a repeat is underway
  4069 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey(EStdKeySpace,0,0);
  4133 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('y',0,0);
  4070 			iQueueClient->iWs.Flush();
  4134 			iQueueClient->iWs.Flush();
  4071 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  4135 			iTest->SimulateKey(TRawEvent::EKeyDown,'Y');
  4072 			TheClient->iWs.Flush();
  4136 			TheClient->iWs.Flush();
  4073 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  4137 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  4074 			User::After(initialTime.Int()+5*time.Int());
  4138 			DelayForRepeatEvents(5, 1);
  4075 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  4139 			iTest->SimulateKey(TRawEvent::EKeyUp,'Y');
  4076 			AddExpectedKey(EEventKeyDown,'Y');
  4140 			AddExpectedKey(EEventKeyDown,'Y');
  4077 			AddExpectedKey(EEventKey,'Y','y');
  4141 			AddExpectedKey(EEventKey,'Y','y');
  4078 			AddExpectedKey(EEventKeyUp,'Y');
  4142 			AddExpectedKey(EEventKeyUp,'Y');
  4079 			break;
  4143 			break;
  4080 		case 13:
  4144 		case 13:
  4081 			//Variation on case 12 i.e. change in the timing of the CancelCaptureKey call
  4145 			//Variation on case 12 i.e. change in the timing of the CancelCaptureKey call
  4082 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey(EStdKeySpace,0,0);
  4146 			iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('z',0,0);
  4083 			iQueueClient->iWs.Flush();
  4147 			iQueueClient->iWs.Flush();
  4084 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  4148 			iTest->SimulateKey(TRawEvent::EKeyDown,'Z');
  4085 			TheClient->iWs.Flush();
  4149 			TheClient->iWs.Flush();
  4086 			User::After(initialTime.Int()+5*time.Int()/2);
  4150 			DelayForRepeatEvents(5, 2);
  4087 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  4151 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
  4088 			User::After(initialTime.Int()+5*time.Int()/2);
  4152 			DelayForRepeatEvents(5, 2);
  4089 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  4153 			iTest->SimulateKey(TRawEvent::EKeyUp,'Z');
  4090 			AddExpectedKey(EEventKeyDown,'Z');
  4154 			AddExpectedKey(EEventKeyDown,'Z');
  4091 			AddExpectedKey(EEventKey,'Z','z');
  4155 			AddExpectedKey(EEventKey,'Z','z');
  4092 			AddExpectedKey(EEventKey,'Z','z',2);
  4156 			AddExpectedKey(EEventKey,'Z','z',2);
  4093 			AddExpectedKey(EEventKeyUp,'Z');
  4157 			AddExpectedKey(EEventKeyUp,'Z');
  4100 			TInt shortCaptKey = TheClient->iGroup->GroupWin()->CaptureKey(' ',0,0);
  4164 			TInt shortCaptKey = TheClient->iGroup->GroupWin()->CaptureKey(' ',0,0);
  4101 
  4165 
  4102 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4166 			iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
  4103 			TheClient->iWs.Flush();
  4167 			TheClient->iWs.Flush();
  4104 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  4168 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
  4105 			User::After(initialTime.Int()+time.Int()/3);
  4169 			DelayForRepeatEvents(1, 3);
  4106 
  4170 
  4107 			TheClient->iGroup->GroupWin()->CancelCaptureKey(shortCaptKey);
  4171 			TheClient->iGroup->GroupWin()->CancelCaptureKey(shortCaptKey);
  4108 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4172 			iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
  4109 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4173 			AddExpectedKey(EEventKeyDown,EStdKeySpace);
  4110 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  4174 			AddExpectedKey(EEventKeyUp,EStdKeySpace);
  4111 			}
  4175 			}
  4112 			break;
  4176 			break;
       
  4177 		case 15:
       
  4178 			// @SYMPREQ 417-61800: Check that long key events are marked with
       
  4179 			// EModifierLongKey and short events are not.
       
  4180 			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, 0, ELongCaptureNormal);
       
  4181 			iQueueClient->iWs.Flush();
       
  4182 			iTest->SimulateKey(TRawEvent::EKeyDown, 'M');
       
  4183 			TheClient->iWs.Flush();
       
  4184 			DelayForRepeatEvents(1, 3);
       
  4185 			iTest->SimulateKey(TRawEvent::EKeyUp, 'M');
       
  4186 			AddExpectedKey(EEventKeyDown, 'M', 0, 0, 0);
       
  4187 			AddExpectedKey(EEventKey, 'M', 'm', 0, EModifierAutorepeatable);
       
  4188 			AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable);
       
  4189 			AddExpectedKey(EEventKeyUp, 'M', 0, 0, 0);
       
  4190 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
       
  4191 			break;
       
  4192 		case 16:
       
  4193 			CheckLongkeyCaptureWithPriority(ELongkeyCaptureDiffPriority);
       
  4194 			break;
       
  4195 		case 17:
       
  4196 			CheckLongkeyCaptureWithPriority(ELongkeyCaptureSamePriority);
       
  4197 			break;
       
  4198 		case 18:
       
  4199 			// Test CaptureLongKey() with flag value ELongCaptureWaitShort
       
  4200 			// when key is not held down long enough to generate a long event.
       
  4201 			// Verify that short event is delivered when the key is released.
       
  4202 			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('p', 'p', 0, 0, 0, ELongCaptureWaitShort);
       
  4203 			iQueueClient->iWs.Flush();
       
  4204 			iTest->SimulateKey(TRawEvent::EKeyDown, 'P');
       
  4205 			TheClient->iWs.Flush();
       
  4206 			User::After(iKeyBoardRepeatInitialDelay.Int() / 2);
       
  4207 			iTest->SimulateKey(TRawEvent::EKeyUp, 'P');
       
  4208 			TheClient->iWs.Flush();
       
  4209 			iTest->SimulateKeyDownUp(EStdKeySpace);
       
  4210 			AddExpectedKey(EEventKeyDown, 'P');
       
  4211 			AddExpectedKey(EEventKey, 'P', 'p', 0, EModifierAutorepeatable);
       
  4212 			AddExpectedKey(EEventKeyUp, 'P');
       
  4213 			AddExpectedKeyDownUp(EStdKeySpace, ' ');
       
  4214 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
       
  4215 			break;
       
  4216 		case 19:
       
  4217 			{
       
  4218 			// Cancel a capture key event whilst a repeat is underway for a
       
  4219 			// different capture. This should not cancel repeating.
       
  4220 			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('q', 0, 0);
       
  4221 			TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureKey('r', 0, 0);
       
  4222 			iQueueClient->iWs.Flush();
       
  4223 			iTest->SimulateKey(TRawEvent::EKeyDown, 'Q');
       
  4224 			TheClient->iWs.Flush();
       
  4225 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(captureKey2);
       
  4226 			DelayForRepeatEvents(5, 1);
       
  4227 			iTest->SimulateKey(TRawEvent::EKeyUp, 'Q');
       
  4228 			AddExpectedKey(EEventKeyDown, 'Q');
       
  4229 			AddExpectedKey(EEventKey, 'Q', 'q', 0, EModifierAutorepeatable);
       
  4230 			AddExpectedKey(EEventKey, 'Q', 'q', 2, EModifierAutorepeatable);
       
  4231 			AddExpectedKey(EEventKeyUp, 'Q');
       
  4232 			iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
       
  4233 			}
       
  4234 			break;
       
  4235 		case 20:
       
  4236 			{
       
  4237 			// Cancel a long capture key event whilst a repeat is underway for
       
  4238 			// a different capture. This should not cancel repeating.
       
  4239 			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('s', 's', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents);
       
  4240 			TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureLongKey('t', 't', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents);
       
  4241 			iQueueClient->iWs.Flush();
       
  4242 			iTest->SimulateKey(TRawEvent::EKeyDown, 'S');
       
  4243 			TheClient->iWs.Flush();
       
  4244 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(captureKey2);
       
  4245 			DelayForRepeatEvents(5, 1);
       
  4246 			iTest->SimulateKey(TRawEvent::EKeyUp, 'S');
       
  4247 			AddExpectedKey(EEventKeyDown, 'S');
       
  4248 			AddExpectedKey(EEventKey, 'S', 's', 0, EModifierAutorepeatable);
       
  4249 			AddExpectedKey(EEventKey, 'S', 's', 2, EModifierLongKey | EModifierAutorepeatable);
       
  4250 			AddExpectedKey(EEventKeyUp, 'S');
       
  4251 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
       
  4252 			}
       
  4253 			break;
       
  4254 		case 21:
       
  4255 			{
       
  4256 			// Test CaptureLongKey() with a user specified initial repeat time.
       
  4257 			// Simulate holding down the key for a period shorter than the
       
  4258 			// specified delay. Verify that a long key event is NOT generated.
       
  4259 			// (Note that the period is longer than the default initial repeat
       
  4260 			// time, thus proving that CaptureLongKey() has honoured the delay
       
  4261 			// argument.)
       
  4262 			TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() * 4);
       
  4263 			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'u', 'u', 0, 0, 0, ELongCaptureNormal);
       
  4264 			iQueueClient->iWs.Flush();
       
  4265 			iTest->SimulateKey(TRawEvent::EKeyDown, 'U');
       
  4266 			TheClient->iWs.Flush();
       
  4267 			User::After(delay.Int() / 2);
       
  4268 			iTest->SimulateKey(TRawEvent::EKeyUp, 'U');
       
  4269 			TheClient->iWs.Flush();
       
  4270 			iTest->SimulateKeyDownUp(EStdKeySpace);
       
  4271 			AddExpectedKey(EEventKeyDown, 'U');
       
  4272 			AddExpectedKey(EEventKey, 'U', 'u', 0, EModifierAutorepeatable);
       
  4273 			AddExpectedKey(EEventKeyUp, 'U');
       
  4274 			AddExpectedKeyDownUp(EStdKeySpace, ' ');
       
  4275 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
       
  4276 			}
       
  4277 			break;
       
  4278 		case 22:
       
  4279 			{
       
  4280 			// Test CaptureLongKey() with a user specified initial repeat time.
       
  4281 			// Simulate holding down the key for a period longer than the
       
  4282 			// specified delay. Verify that a long key event is generated.
       
  4283 			// (Note that the period is shorter than the default initial repeat
       
  4284 			// time, thus proving that CaptureLongKey() has honoured the delay
       
  4285 			// argument.)
       
  4286 			TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() / 4);
       
  4287 			iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'v', 'v', 0, 0, 0, ELongCaptureNormal);
       
  4288 			iQueueClient->iWs.Flush();
       
  4289 			iTest->SimulateKey(TRawEvent::EKeyDown, 'V');
       
  4290 			TheClient->iWs.Flush();
       
  4291 			User::After(delay.Int() * 2);
       
  4292 			iTest->SimulateKey(TRawEvent::EKeyUp, 'V');
       
  4293 			TheClient->iWs.Flush();
       
  4294 			iTest->SimulateKeyDownUp(EStdKeySpace);
       
  4295 			AddExpectedKey(EEventKeyDown, 'V');
       
  4296 			AddExpectedKey(EEventKey, 'V', 'v', 0, EModifierAutorepeatable);
       
  4297 			AddExpectedKey(EEventKey, 'V', 'v', 1, EModifierLongKey | EModifierAutorepeatable);
       
  4298 			AddExpectedKey(EEventKeyUp, 'V');
       
  4299 			AddExpectedKeyDownUp(EStdKeySpace, ' ');
       
  4300 			iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
       
  4301 			}
       
  4302 			break;
  4113 		default:
  4303 		default:
  4114 			CActiveScheduler::Stop();
  4304 			CActiveScheduler::Stop();
  4115 			break;
  4305 			break;
  4116 		}
  4306 		}
  4117 	TheClient->iWs.Flush();
  4307 	TheClient->iWs.Flush();
  4118 	}
  4308 	}
       
  4309 
       
  4310 /** Function used for checking CaptureLongKey() works fine with different priorities.
       
  4311 
       
  4312 If two window groups have requested capture of the same key with different priorities, 
       
  4313 then the event should be delivered to the group that specified higher priority 
       
  4314 (even if it is in the background).
       
  4315 
       
  4316 If two window groups have requested capture of the same key with same priorities,
       
  4317 then the event should be delivered to the group that requested capture most recently.
       
  4318 
       
  4319 @param aTestType Enum value specifying test with same priority or with different priority
       
  4320 */
       
  4321 void CTEventTest::CheckLongkeyCaptureWithPriority(TLongkeyCapPriorityTests aTestType)
       
  4322 	{
       
  4323 	TInt ordinalPriority = TheClient->iGroup->GroupWin()->OrdinalPriority();
       
  4324 	TInt ordinalPosition = TheClient->iGroup->GroupWin()->OrdinalPosition();
       
  4325 	// Bring other window group to foreground and request capture with lower/same priority
       
  4326 	// And request capture from iQueueClient group window with higher priority
       
  4327 	TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, 10);
       
  4328 	TInt capKeyFrontWin = TheClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, (aTestType == ELongkeyCaptureDiffPriority ? KLongKeyCaptureLowPriority : KLongKeyCaptureHighPriority), ELongCaptureNormal);
       
  4329 	iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, KLongKeyCaptureHighPriority, ELongCaptureNormal);
       
  4330 	iQueueClient->iWs.Flush();
       
  4331 	iTest->SimulateKey(TRawEvent::EKeyDown, 'M');
       
  4332 	TheClient->iWs.Flush();
       
  4333 	DelayForRepeatEvents(1, 3);
       
  4334 	iTest->SimulateKey(TRawEvent::EKeyUp, 'M');
       
  4335 	AddExpectedEvent(EEventFocusLost);
       
  4336 	//Note: Button down/up events along with immediate key events are not delivered to iQueueCLient's window group
       
  4337 	//as they are sent to foreground/focused window group
       
  4338 	AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable);
       
  4339 	iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
       
  4340 	TheClient->iGroup->GroupWin()->CancelCaptureLongKey(capKeyFrontWin);
       
  4341 	TheClient->iGroup->GroupWin()->SetOrdinalPosition(ordinalPosition, ordinalPriority);
       
  4342 	AddExpectedEvent(EEventFocusGained);
       
  4343 	}
       
  4344 
       
  4345 /** Function used for delaying current thread so that repeat events can be generated.
       
  4346 
       
  4347 It uses iKeyBoardRepeatInitialDelay and iKeyBoardRepeatNextDelay variables to get the desired delay.
       
  4348 The idea is to wait for initial delay + some extra value so that first repeat is generated.
       
  4349 For more than one repeat events, wait will be initial delay + next delay + some extra value, and so on.
       
  4350 
       
  4351 The extra value is taken as fraction of iKeyBoardRepeatNextDelay.
       
  4352 
       
  4353 @param aNumeratorFracVal Numerator value of the fraction.
       
  4354 @param aDenominatorFracVal Denominator value of the fraction.
       
  4355 */
       
  4356 void CTEventTest::DelayForRepeatEvents(TInt aNumeratorFracVal, TInt aDenominatorFracVal)
       
  4357 	{
       
  4358 	if (!aNumeratorFracVal || !aDenominatorFracVal)
       
  4359 		return;
       
  4360 	User::After(iKeyBoardRepeatInitialDelay.Int() + (iKeyBoardRepeatNextDelay.Int()*aNumeratorFracVal/aDenominatorFracVal));
       
  4361 	}
       
  4362 
       
  4363 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
       
  4364 void CTEventTest::KeyEventTranslation_NextSetOfEventsL()
       
  4365 	{
       
  4366 	TTimeIntervalMicroSeconds32 initialTime;
       
  4367 	TTimeIntervalMicroSeconds32 time;
       
  4368 	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
       
  4369 
       
  4370 	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
       
  4371 
       
  4372 	#if defined(LOGGING)
       
  4373 		TLogMessageText logMessageText;
       
  4374 		_LIT(KSet,"KeyEventTranslation SetOfEvents: %d of 5");
       
  4375 		logMessageText.Format(KSet,iEventSet);
       
  4376 		INFO_PRINTF1(logMessageText);
       
  4377 	#endif
       
  4378 
       
  4379 	switch (iEventSet++)
       
  4380 		{
       
  4381 		case 0:
       
  4382 			iQueueClient->iWs.Flush();
       
  4383 			iTest->SimulateKeyDownUp('A');
       
  4384 			AddExpectedEvent(EEventFocusGained);
       
  4385 			AddExpectedKeyDownUp('A','a');
       
  4386 			break;
       
  4387 		case 1:
       
  4388 			// Test key event translation using CaptureKey()
       
  4389 			iCaptureKey = wg->CaptureKey(EKeyDevice0, 0, 0);
       
  4390 			TEST(iCaptureKey >= 0);
       
  4391 			iQueueClient->iWs.Flush();
       
  4392 			iTest->SimulateKeyDownUp(EStdKeyDevice1);
       
  4393 			TheClient->iWs.Flush();
       
  4394 			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
       
  4395 			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 0);
       
  4396 			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
       
  4397 			wg->CancelCaptureKey(iCaptureKey);
       
  4398 			break;
       
  4399 		case 2:
       
  4400 			// Test key event translation using CaptureKeyUpAndDowns()
       
  4401 			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice0, 0, 0);
       
  4402 			TEST(iCaptureKey >= 0);
       
  4403 			iQueueClient->iWs.Flush();
       
  4404 			iTest->SimulateKeyDownUp(EStdKeyDevice1);
       
  4405 			TheClient->iWs.Flush();
       
  4406 			AddExpectedKey(EEventKeyDown, EStdKeyDevice0, 0, 0);
       
  4407 			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0);
       
  4408 			AddExpectedKey(EEventKeyUp, EStdKeyDevice0, 0, 0);
       
  4409 			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
       
  4410 			break;
       
  4411 		case 3:
       
  4412 			// Test key event translation using CaptureLongKey()
       
  4413 			iCaptureKey = wg->CaptureLongKey(EKeyDevice0, EKeyDevice0, 0, 0, 0, ELongCaptureNormal);
       
  4414 			TEST(iCaptureKey >= 0);
       
  4415 			iQueueClient->iWs.Flush();
       
  4416 
       
  4417 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice1);
       
  4418 			TheClient->iWs.Flush();
       
  4419 			User::After(initialTime.Int() + time.Int() / 3);
       
  4420 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice1);
       
  4421 			TheClient->iWs.Flush();
       
  4422 
       
  4423 			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
       
  4424 			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0, EModifierAutorepeatable);
       
  4425 			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 1, EModifierLongKey | EModifierAutorepeatable);
       
  4426 			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
       
  4427 
       
  4428 			wg->CancelCaptureLongKey(iCaptureKey);
       
  4429 			break;
       
  4430 		case 4:
       
  4431 			// Negative test: check that the capture key code listed in the
       
  4432 			// translation table of the Key Routing Plug-in is not translated
       
  4433 			// in the absence of any capture request for the mapped key.
       
  4434 			iTest->SimulateKeyDownUp(EStdKeyDevice1);
       
  4435 			TheClient->iWs.Flush();
       
  4436 			AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0);
       
  4437 			AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0);
       
  4438 			AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0);
       
  4439 			break;
       
  4440 		default:
       
  4441 			CActiveScheduler::Stop();
       
  4442 			break;
       
  4443 		}
       
  4444 
       
  4445 	TheClient->iWs.Flush();
       
  4446 	}
       
  4447 
       
  4448 void CTEventTest::KeyEventBlocking_NextSetOfEventsL()
       
  4449 	{
       
  4450 	TTimeIntervalMicroSeconds32 initialTime;
       
  4451 	TTimeIntervalMicroSeconds32 time;
       
  4452 	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
       
  4453 
       
  4454 	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
       
  4455 
       
  4456 	#if defined(LOGGING)
       
  4457 		TLogMessageText logMessageText;
       
  4458 		_LIT(KSet,"KeyEventBlocking SetOfEvents: %d of 5");
       
  4459 		logMessageText.Format(KSet,iEventSet);
       
  4460 		INFO_PRINTF1(logMessageText);
       
  4461 	#endif
       
  4462 
       
  4463 	switch (iEventSet++)
       
  4464 		{
       
  4465 		case 0:
       
  4466 			iQueueClient->iWs.Flush();
       
  4467 			iTest->SimulateKeyDownUp('A');
       
  4468 			AddExpectedEvent(EEventFocusGained);
       
  4469 			AddExpectedKeyDownUp('A','a');
       
  4470 			break;
       
  4471 		case 1:
       
  4472 			// Simulate pressing a blocked key (Device3) while no
       
  4473 			// key capture is in effect.
       
  4474 			iTest->SimulateKeyDownUp(EStdKeyDevice3);
       
  4475 			iTest->SimulateKeyDownUp('B');
       
  4476 			TheClient->iWs.Flush();
       
  4477 			AddExpectedKeyDownUp('B','b');
       
  4478 			break;
       
  4479 		case 2:
       
  4480 			// Use RWindowGroup::CaptureKey() to capture EKeyDevice3
       
  4481 			// and simulate pressing the blocked key again.
       
  4482 			iCaptureKey = wg->CaptureKey(EKeyDevice3, 0, 0);
       
  4483 			TEST(iCaptureKey >= 0);
       
  4484 			iQueueClient->iWs.Flush();
       
  4485 			iTest->SimulateKeyDownUp(EStdKeyDevice3);
       
  4486 			iTest->SimulateKeyDownUp('B');
       
  4487 			TheClient->iWs.Flush();
       
  4488 			AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 0);
       
  4489 			AddExpectedKeyDownUp('B','b');
       
  4490 			wg->CancelCaptureKey(iCaptureKey);
       
  4491 			break;
       
  4492 		case 3:
       
  4493 			// Repeat using CaptureKeyUpAndDowns()
       
  4494 			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice3, 0, 0);
       
  4495 			TEST(iCaptureKey >= 0);
       
  4496 			iQueueClient->iWs.Flush();
       
  4497 			iTest->SimulateKeyDownUp(EStdKeyDevice3);
       
  4498 			iTest->SimulateKeyDownUp('B');
       
  4499 			TheClient->iWs.Flush();
       
  4500 			AddExpectedKey(EEventKeyDown, EStdKeyDevice3, 0, 0);
       
  4501 			AddExpectedKey(EEventKeyUp, EStdKeyDevice3, 0, 0);
       
  4502 			AddExpectedKeyDownUp('B','b');
       
  4503 			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
       
  4504 			break;
       
  4505 		case 4:
       
  4506 			// Repeat using CaptureLongKey()
       
  4507 			iCaptureKey = wg->CaptureLongKey(EKeyDevice3, EKeyDevice3, 0, 0, 0, ELongCaptureNormal);
       
  4508 			TEST(iCaptureKey >= 0);
       
  4509 			iQueueClient->iWs.Flush();
       
  4510 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice3);
       
  4511 			TheClient->iWs.Flush();
       
  4512 			User::After(initialTime.Int() + time.Int() / 3);
       
  4513 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice3);
       
  4514 			iTest->SimulateKeyDownUp('B');
       
  4515 			TheClient->iWs.Flush();
       
  4516 			AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 1, EModifierLongKey | EModifierAutorepeatable);
       
  4517 			AddExpectedKeyDownUp('B','b');
       
  4518 			wg->CancelCaptureLongKey(iCaptureKey);
       
  4519 			break;
       
  4520 		default:
       
  4521 			CActiveScheduler::Stop();
       
  4522 			break;
       
  4523 		}
       
  4524 
       
  4525 	TheClient->iWs.Flush();
       
  4526 	}
       
  4527 
       
  4528 void CTEventTest::KeyEventAppRestriction_NextSetOfEventsL()
       
  4529 	{
       
  4530 	TTimeIntervalMicroSeconds32 initialTime;
       
  4531 	TTimeIntervalMicroSeconds32 time;
       
  4532 	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
       
  4533 
       
  4534 	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
       
  4535 
       
  4536 	#if defined(LOGGING)
       
  4537 		TLogMessageText logMessageText;
       
  4538 		_LIT(KSet,"KeyEventAppRestriction SetOfEvents: %d of 4");
       
  4539 		logMessageText.Format(KSet,iEventSet);
       
  4540 		INFO_PRINTF1(logMessageText);
       
  4541 	#endif
       
  4542 
       
  4543 	switch (iEventSet++)
       
  4544 		{
       
  4545 		case 0:
       
  4546 			// Make window group non-focusable so that it receives only
       
  4547 			// keys that are captured and not those that are default-routed.
       
  4548 			wg->EnableReceiptOfFocus(EFalse);
       
  4549 			iQueueClient->iWs.Flush();
       
  4550 			AddExpectedEvent(EEventFocusGained);
       
  4551 			AddExpectedEvent(EEventFocusLost);
       
  4552 			break;
       
  4553 		case 1:
       
  4554 			// Using RWindowGroup::CaptureKey(), attempt to capture a key
       
  4555 			// that is restricted by UID to another application.
       
  4556 			iCaptureKey = wg->CaptureKey(EKeyF20, 0, 0);
       
  4557 			TEST(iCaptureKey == KErrPermissionDenied);
       
  4558 			// Now capture a key that is restricted to the current
       
  4559 			// application's UID and simulate pressing the restricted key.
       
  4560 			iCaptureKey = wg->CaptureKey(EKeyF21, 0, 0);
       
  4561 			TEST(iCaptureKey >= 0);
       
  4562 			iQueueClient->iWs.Flush();
       
  4563 			// Can't use SimulateKeyDownUp() here due to its check that scan
       
  4564 			// codes are not in the range corresponding to lower case letters
       
  4565 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
       
  4566 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
       
  4567 			TheClient->iWs.Flush();
       
  4568 			AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 0);
       
  4569 			wg->CancelCaptureKey(iCaptureKey);
       
  4570 			break;
       
  4571 		case 2:
       
  4572 			// Repeat using CaptureKeyUpAndDowns()
       
  4573 			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF20, 0, 0);
       
  4574 			TEST(iCaptureKey == KErrPermissionDenied);
       
  4575 			iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF21, 0, 0);
       
  4576 			TEST(iCaptureKey >= 0);
       
  4577 			iQueueClient->iWs.Flush();
       
  4578 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
       
  4579 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
       
  4580 			TheClient->iWs.Flush();
       
  4581 			AddExpectedKey(EEventKeyDown, EStdKeyF21, 0, 0);
       
  4582 			AddExpectedKey(EEventKeyUp, EStdKeyF21, 0, 0);
       
  4583 			wg->CancelCaptureKeyUpAndDowns(iCaptureKey);
       
  4584 			break;
       
  4585 		case 3:
       
  4586 			// Repeat using CaptureLongKey()
       
  4587 			iCaptureKey = wg->CaptureLongKey(EKeyF20, EKeyF20, 0, 0, 0, ELongCaptureNormal);
       
  4588 			TEST(iCaptureKey == KErrPermissionDenied);
       
  4589 			iCaptureKey = wg->CaptureLongKey(EKeyF21, EKeyF21, 0, 0, 0, ELongCaptureNormal);
       
  4590 			TEST(iCaptureKey >= 0);
       
  4591 			iQueueClient->iWs.Flush();
       
  4592 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21);
       
  4593 			TheClient->iWs.Flush();
       
  4594 			User::After(initialTime.Int() + time.Int() / 3);
       
  4595 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21);
       
  4596 			TheClient->iWs.Flush();
       
  4597 			AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 1, EModifierLongKey | EModifierAutorepeatable);
       
  4598 			wg->CancelCaptureLongKey(iCaptureKey);
       
  4599 			break;
       
  4600 		default:
       
  4601 			CActiveScheduler::Stop();
       
  4602 			break;
       
  4603 		}
       
  4604 
       
  4605 	TheClient->iWs.Flush();
       
  4606 	}
       
  4607 
       
  4608 void CTEventTest::KeyEventAppPriority_NextSetOfEventsL()
       
  4609 	{
       
  4610 	TTimeIntervalMicroSeconds32 initialTime;
       
  4611 	TTimeIntervalMicroSeconds32 time;
       
  4612 	TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
       
  4613 
       
  4614 	RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
       
  4615 	TInt handle1 = 0;
       
  4616 	TInt handle2 = 0;
       
  4617 	TInt handle3 = 0;
       
  4618 	TInt handle4 = 0;
       
  4619 	TInt handle5 = 0;
       
  4620 	TInt handle6 = 0;
       
  4621 
       
  4622 	#if defined(LOGGING)
       
  4623 		TLogMessageText logMessageText;
       
  4624 		_LIT(KSet,"KeyEventAppPriority SetOfEvents: %d of 5");
       
  4625 		logMessageText.Format(KSet,iEventSet);
       
  4626 		INFO_PRINTF1(logMessageText);
       
  4627 	#endif
       
  4628 
       
  4629 	switch (iEventSet++)
       
  4630 		{
       
  4631 		case 0:
       
  4632 			SpawnCaptureAppL(iCaptureApp1);
       
  4633 			iQueueClient->iWs.Flush();
       
  4634 			AddExpectedEvent(EEventFocusGained);
       
  4635 			AddExpectedEvent(EEventFocusLost);
       
  4636 			break;
       
  4637 		case 1:
       
  4638 			// Use RWindowGroup::CaptureKey() to capture EKeyF22
       
  4639 			// and EKeyF23 with priority 0. Simulate pressing both
       
  4640 			// keys. Since the current application has precedence by UID
       
  4641 			// for capture of EKeyF22, it should receive that key
       
  4642 			// but should not receive EKeyF23.
       
  4643 			handle1 = wg->CaptureKey(EKeyF22, 0, 0);
       
  4644 			handle2 = wg->CaptureKey(EKeyF23, 0, 0);
       
  4645 			TEST(handle1 >= 0);
       
  4646 			TEST(handle2 >= 0);
       
  4647 			iQueueClient->iWs.Flush();
       
  4648 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
       
  4649 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
       
  4650 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
       
  4651 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
       
  4652 			TheClient->iWs.Flush();
       
  4653 			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0);
       
  4654 			wg->CancelCaptureKey(handle1);
       
  4655 			wg->CancelCaptureKey(handle2);
       
  4656 			break;
       
  4657 		case 2:
       
  4658 			// Repeat using CaptureKeyUpAndDowns()
       
  4659 			handle1 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0);
       
  4660 			handle2 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0);
       
  4661 			TEST(handle1 >= 0);
       
  4662 			TEST(handle2 >= 0);
       
  4663 			iQueueClient->iWs.Flush();
       
  4664 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
       
  4665 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
       
  4666 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
       
  4667 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
       
  4668 			TheClient->iWs.Flush();
       
  4669 			AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0);
       
  4670 			AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0);
       
  4671 			wg->CancelCaptureKeyUpAndDowns(handle1);
       
  4672 			wg->CancelCaptureKeyUpAndDowns(handle2);
       
  4673 			break;
       
  4674 		case 3:
       
  4675 			// Repeat using CaptureLongKey()
       
  4676 			handle1 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal);
       
  4677 			handle2 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal);
       
  4678 			TEST(handle1 >= 0);
       
  4679 			TEST(handle2 >= 0);
       
  4680 			iQueueClient->iWs.Flush();
       
  4681 
       
  4682 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
       
  4683 			TheClient->iWs.Flush();
       
  4684 			User::After(initialTime.Int() + time.Int() / 3);
       
  4685 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
       
  4686 
       
  4687 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
       
  4688 			TheClient->iWs.Flush();
       
  4689 			User::After(initialTime.Int() + time.Int() / 3);
       
  4690 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
       
  4691 			TheClient->iWs.Flush();
       
  4692 
       
  4693 			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable);
       
  4694 			wg->CancelCaptureLongKey(handle1);
       
  4695 			wg->CancelCaptureLongKey(handle2);
       
  4696 			break;
       
  4697 		case 4:
       
  4698 			// Repeat with additional capture requests for improved code
       
  4699 			// coverage. (Also verifies that UID-based precedence works even
       
  4700 			// when another app makes the most recent capture request.)
       
  4701 			// Spawn a second capture app so that requests occur in the
       
  4702 			// following order:
       
  4703 			// 1. CaptureApp1, priority 1 (outstanding)
       
  4704 			// 2. Current App, priority 0, precedence by UID
       
  4705 			// 3. CaptureApp2, priority 1
       
  4706 			// Note that all three capture types are tested together here.
       
  4707 			handle1 = wg->CaptureKey(EKeyF22, 0, 0);
       
  4708 			handle2 = wg->CaptureKey(EKeyF23, 0, 0);
       
  4709 			handle3 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0);
       
  4710 			handle4 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0);
       
  4711 			handle5 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal);
       
  4712 			handle6 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal);
       
  4713 			TEST(handle1 >= 0);
       
  4714 			TEST(handle2 >= 0);
       
  4715 			TEST(handle3 >= 0);
       
  4716 			TEST(handle4 >= 0);
       
  4717 			TEST(handle5 >= 0);
       
  4718 			TEST(handle6 >= 0);
       
  4719 			iQueueClient->iWs.Flush();
       
  4720 
       
  4721 			SpawnCaptureAppL(iCaptureApp2);
       
  4722 
       
  4723 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
       
  4724 			TheClient->iWs.Flush();
       
  4725 			User::After(initialTime.Int() + time.Int() / 3);
       
  4726 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
       
  4727 
       
  4728 			iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23);
       
  4729 			TheClient->iWs.Flush();
       
  4730 			User::After(initialTime.Int() + time.Int() / 3);
       
  4731 			iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23);
       
  4732 			TheClient->iWs.Flush();
       
  4733 
       
  4734 			AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0);
       
  4735 			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0);
       
  4736 			AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable);
       
  4737 			AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0);
       
  4738 			wg->CancelCaptureKey(handle1);
       
  4739 			wg->CancelCaptureKey(handle2);
       
  4740 			wg->CancelCaptureKeyUpAndDowns(handle3);
       
  4741 			wg->CancelCaptureKeyUpAndDowns(handle4);
       
  4742 			wg->CancelCaptureLongKey(handle5);
       
  4743 			wg->CancelCaptureLongKey(handle6);
       
  4744 			break;
       
  4745 		default:
       
  4746 			iCaptureApp1.Kill(KErrNone);
       
  4747 			iCaptureApp2.Kill(KErrNone);
       
  4748 			iCaptureApp1.Close();
       
  4749 			iCaptureApp2.Close();
       
  4750 			CActiveScheduler::Stop();
       
  4751 			break;
       
  4752 		}
       
  4753 
       
  4754 	TheClient->iWs.Flush();
       
  4755 	}
       
  4756 
       
  4757 /**
       
  4758 Spawn another application that will capture the keys EKeyF22 and
       
  4759 EKeyF23 with high priority.
       
  4760 
       
  4761 @param aProcess		Process to create
       
  4762 */
       
  4763 void CTEventTest::SpawnCaptureAppL(RProcess& aProcess)
       
  4764 	{
       
  4765 	_LIT(KCaptureApp, "tevent_captureapp.exe");
       
  4766 	TInt error = aProcess.Create(KCaptureApp, KNullDesC);
       
  4767 	if (error != KErrNone)
       
  4768 		{
       
  4769 #if defined(LOGGING)
       
  4770 		TLogMessageText logMessageText;
       
  4771 		_LIT(KLog, "Cannot create capture app - error %d");
       
  4772 		logMessageText.Format(KLog, error);
       
  4773 		INFO_PRINTF1(logMessageText);
       
  4774 #endif
       
  4775 		User::Leave(error);
       
  4776 		}
       
  4777 
       
  4778 	// Make rendezvous request to capture app
       
  4779 	TRequestStatus status;
       
  4780 	aProcess.Rendezvous(status);
       
  4781 	aProcess.Resume();
       
  4782 
       
  4783 	// Wait for capture app to make its capture requests
       
  4784 	User::WaitForRequest(status);
       
  4785 	TEST(status.Int() == KErrNone);
       
  4786 	}
       
  4787 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA  	
  4119 
  4788 
  4120 #define PASSWORD_START_OF_DAY 4
  4789 #define PASSWORD_START_OF_DAY 4
  4121 void CTEventTest::Password_NextSetOfEvents()
  4790 void CTEventTest::Password_NextSetOfEvents()
  4122 	{
  4791 	{
  4123 	switch(iEventSet++)
  4792 	switch(iEventSet++)
  6314 	_LIT(KTest23,"Event Handler Removal");
  6983 	_LIT(KTest23,"Event Handler Removal");
  6315 	_LIT(KTest24,"Event Queue ptr crash test");
  6984 	_LIT(KTest24,"Event Queue ptr crash test");
  6316 	_LIT(KTest25,"Mismatched Pointer Events");
  6985 	_LIT(KTest25,"Mismatched Pointer Events");
  6317 	_LIT(KTest26,"Pointer Buffer Purge");
  6986 	_LIT(KTest26,"Pointer Buffer Purge");
  6318 	_LIT(KTest27,"TRawEvent test for Repeats");
  6987 	_LIT(KTest27,"TRawEvent test for Repeats");
       
  6988 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 
       
  6989 	_LIT(KTest28,"Translation of key events by routing plug-in");
       
  6990 	_LIT(KTest29,"Blocking of key events by routing plug-in");
       
  6991 	_LIT(KTest30,"App UID based restriction of key capture");
       
  6992 	_LIT(KTest31,"App UID based routing of key events");
  6319 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
  6993 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
  6320 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA 
  6994 	_LIT(KTest32,"Transparent Surface Visibility Changed Events 1");
  6321 	_LIT(KTest28,"Transparent Surface Visibility Changed Events 1");
  6995 	_LIT(KTest33,"Transparent Surface Visibility Changed Events 2");
  6322 	_LIT(KTest29,"Transparent Surface Visibility Changed Events 2");
  6996 	_LIT(KTest34,"Transparent Surface Visibility Changed Events 3");
  6323 	_LIT(KTest30,"Transparent Surface Visibility Changed Events 3");
  6997 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  6324 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  6998 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  6325 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  6999 	_LIT(KTest35A,"Initialize Queue Size without inactive queue");
  6326 	_LIT(KTest31A,"Initialize Queue Size without inactive queue");
  7000 	_LIT(KTest35B,"Initialize Queue Size with inactive queue");	
  6327 	_LIT(KTest31B,"Initialize Queue Size with inactive queue");	
       
  6328 	
  7001 	
  6329 	if (!TestBase()->ConfigurationSupportsPointerEventTesting())
  7002 	if (!TestBase()->ConfigurationSupportsPointerEventTesting())
  6330 	    {
  7003 	    {
  6331 	    INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
  7004 	    INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
  6332 	    TestComplete();
  7005 	    TestComplete();
  6642 /**
  7315 /**
  6643 @SYMTestCaseID		GRAPHICS-WSERV-0067
  7316 @SYMTestCaseID		GRAPHICS-WSERV-0067
  6644 
  7317 
  6645 @SYMDEF             DEF081259
  7318 @SYMDEF             DEF081259
  6646 
  7319 
  6647 @SYMTestCaseDesc    Send events for capturing large areas of text
  7320 @SYMTestCaseDesc    Test RWindowGroup::CaptureLongKey()
  6648 
  7321 
  6649 @SYMTestPriority    High
  7322 @SYMTestPriority    High
  6650 
  7323 
  6651 @SYMTestStatus      Implemented
  7324 @SYMTestStatus      Implemented
  6652 
  7325 
  6653 @SYMTestActions     Send events for capturing large areas of text
  7326 @SYMTestActions     Simulate long key presses and check that long key capture
  6654 
  7327 					and key repeat work as expected.
  6655 @SYMTestExpectedResults The events are sent to the window without
  7328 
       
  7329 @SYMTestExpectedResults The correct key events are sent to the window without
  6656 						error
  7330 						error
  6657 */
  7331 */
  6658 		case 15:
  7332 		case 15:
  6659 			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0067"));
  7333 			((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0067"));
  6660 			iTest->LogSubTest(KTest15);
  7334 			iTest->LogSubTest(KTest15);
  6923 		case 27:
  7597 		case 27:
  6924 		    iTest->LogSubTest(KTest27);
  7598 		    iTest->LogSubTest(KTest27);
  6925 		    RunTestsL();
  7599 		    RunTestsL();
  6926 		    break;
  7600 		    break;
  6927 		    
  7601 		    
       
  7602 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA            
       
  7603 /**
       
  7604 @SYMTestCaseID      GRAPHICS-WSERV-0751, GRAPHICS-WSERV-0752, GRAPHICS-WSERV-0753
       
  7605 @SYMPREQ			417-61800
       
  7606 @SYMTestCaseDesc    Test translation of key events by Key Event Routing plug-in
       
  7607 @SYMTestPriority    High
       
  7608 @SYMTestStatus      Implemented
       
  7609 @SYMTestActions     Use RWindowGroup::CaptureKey() to capture pseudo key
       
  7610 					Device0 (key code EKeyDevice0, scan code EStdKeyDevice0).
       
  7611 					Simulate pressing key Device1.
       
  7612 					Repeat using CaptureKeyUpAndDowns().
       
  7613 					Repeat using CaptureLongKey().
       
  7614 					Repeat without any capture requests.
       
  7615 @SYMTestExpectedResults
       
  7616 					The key event delivered contains the key or scan code for
       
  7617 					Device0, if captured. When using CaptureKey() and
       
  7618 					CaptureLongKey(), only the key code is translated. Using
       
  7619 					CaptureKeyUpAndDowns(), only the scan code is translated.
       
  7620 
       
  7621 Note: this test requires an entry in the translation table of the Key Routing
       
  7622 Plug-in to map Device0 to Device1 at capture request time.
       
  7623 */
       
  7624 		case 28:
       
  7625             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0751"));
       
  7626             iTest->LogSubTest(KTest28);
       
  7627             RunTestsL();
       
  7628             break;
       
  7629 
       
  7630 /**
       
  7631 @SYMTestCaseID      GRAPHICS-WSERV-0760, GRAPHICS-WSERV-0761, GRAPHICS-WSERV-0762
       
  7632 @SYMPREQ			417-61800
       
  7633 @SYMTestCaseDesc    Test blocking of key events by Key Event Routing plug-in
       
  7634 @SYMTestPriority    High
       
  7635 @SYMTestStatus      Implemented
       
  7636 @SYMTestActions     Simulate pressing a blocked key (Device3) while no
       
  7637 					key capture is in effect.
       
  7638 					Use RWindowGroup::CaptureKey() to capture EKeyDevice3
       
  7639 					and simulate pressing the blocked key again.
       
  7640 					Repeat using CaptureKeyUpAndDowns().
       
  7641 					Repeat using CaptureLongKey().
       
  7642 @SYMTestExpectedResults
       
  7643 					The blocked key event is only delivered when captured and
       
  7644 					is not routed to the focussed window group by default.
       
  7645 
       
  7646 Note: this test requires entries in the Blocked Key Table of the Reference
       
  7647 Key Routing Plug-in for EKeyDevice3 and EStdKeyDevice3.
       
  7648 */
       
  7649 		case 29:
       
  7650             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0760"));
       
  7651             iTest->LogSubTest(KTest29);
       
  7652             RunTestsL();
       
  7653             break;
       
  7654 
       
  7655 /**
       
  7656 @SYMTestCaseID      GRAPHICS-WSERV-0754, GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756
       
  7657 @SYMPREQ			417-61800
       
  7658 @SYMTestCaseDesc    Test application UID-based restriction of key capture by
       
  7659 					Key Event Routing plug-in.
       
  7660 @SYMTestPriority    High
       
  7661 @SYMTestStatus      Implemented
       
  7662 @SYMTestActions     Attempt to capture a key that is restricted by UID
       
  7663 					to another application.
       
  7664 					Use RWindowGroup::CaptureKey() to capture a key that is
       
  7665 					restricted to the current application's UID.
       
  7666 					Simulate pressing the second key.
       
  7667 					Repeat using CaptureKeyUpAndDowns().
       
  7668 					Repeat using CaptureLongKey().
       
  7669 @SYMTestExpectedResults
       
  7670 					Capture of the first key fails with KErrPermissionDenied.
       
  7671 					Capture of the second key succeeds and the key event is
       
  7672 					delivered.
       
  7673 
       
  7674 Note: this test requires entries in the Restricted Key Table of the Reference
       
  7675 Key Routing Plug-in for the chosen keys.
       
  7676 */
       
  7677 		case 30:
       
  7678             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0754"));
       
  7679             iTest->LogSubTest(KTest30);
       
  7680             RunTestsL();
       
  7681             break;
       
  7682 
       
  7683 /**
       
  7684 @SYMTestCaseID      GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758, GRAPHICS-WSERV-0759
       
  7685 @SYMPREQ			417-61800
       
  7686 @SYMTestCaseDesc    Test application UID-based routing of key events by
       
  7687 					Key Event Routing plug-in.
       
  7688 @SYMTestPriority    High
       
  7689 @SYMTestStatus      Implemented
       
  7690 @SYMTestActions     Invoke another application to capture two different keys
       
  7691 					with high priority using each of RWindowGroup::CaptureKey(),
       
  7692 					CaptureKeyUpAndDowns() and CaptureLongKey(). One key of
       
  7693 					each pair has precedence for capture by the current
       
  7694 					application's UID (i.e. this test).
       
  7695 					In the current application, use RWindowGroup::CaptureKey()
       
  7696 					to capture both keys with lower priority.
       
  7697 					Simulate pressing the keys.
       
  7698 					Repeat using CaptureKeyUpAndDowns().
       
  7699 					Repeat using CaptureLongKey().
       
  7700 @SYMTestExpectedResults
       
  7701 					The key event with UID-based precedence is delivered to
       
  7702 					the current application but the other key is not.
       
  7703 
       
  7704 Note: this test requires entries in the Priority Application Table of the
       
  7705 Reference Key Routing Plug-in for the chosen key.
       
  7706 */
       
  7707 		case 31:
       
  7708             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0757"));
       
  7709             iTest->LogSubTest(KTest31);
       
  7710             RunTestsL();
       
  7711             break;
       
  7712 
  6928 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
  7713 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS            
  6929 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA            
       
  6930 /**
  7714 /**
  6931 @SYMTestCaseID      GRAPHICS-WSERV-2669-0015
  7715 @SYMTestCaseID      GRAPHICS-WSERV-2669-0015
  6932 @SYMREQ             REQ13202: Possibility for external layers to appear above UI layer
  7716 @SYMREQ             REQ13202: Possibility for external layers to appear above UI layer
  6933 @SYMTestCaseDesc    Window obscured by transparent surface window receives 
  7717 @SYMTestCaseDesc    Window obscured by transparent surface window receives 
  6934                     (EPartiallyVisible | EFullyVisible) when surface is made semi-transparent.
  7718                     (EPartiallyVisible | EFullyVisible) when surface is made semi-transparent.
  6936 @SYMPrerequisites   Win1 – bottom window
  7720 @SYMPrerequisites   Win1 – bottom window
  6937                     Win2 – middle window with background surface, which totally obscures win1
  7721                     Win2 – middle window with background surface, which totally obscures win1
  6938 @SYMTestActions     Call SetSurfaceTransparency(ETrue) on win2
  7722 @SYMTestActions     Call SetSurfaceTransparency(ETrue) on win2
  6939 @SYMTestExpectedResults Win1 receives visibility event
  7723 @SYMTestExpectedResults Win1 receives visibility event
  6940 */            
  7724 */            
  6941         case 28:
  7725         case 32:
  6942             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0015"));
  7726             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0015"));
  6943             iTest->LogSubTest(KTest28);
  7727             iTest->LogSubTest(KTest32);
  6944             RunTestsL();
  7728             RunTestsL();
  6945             break;
  7729             break;
  6946 /**
  7730 /**
  6947 @SYMTestCaseID      GRAPHICS-WSERV-2669-0016
  7731 @SYMTestCaseID      GRAPHICS-WSERV-2669-0016
  6948 @SYMREQ             REQ13202: Possibility for external layers to appear above UI layer 
  7732 @SYMREQ             REQ13202: Possibility for external layers to appear above UI layer 
  6953                     Win2 – middle window with semi-transparent background surface, which totally obscures win1
  7737                     Win2 – middle window with semi-transparent background surface, which totally obscures win1
  6954                     Win3 – top window which totally obscures win2, and is opaque
  7738                     Win3 – top window which totally obscures win2, and is opaque
  6955 @SYMTestActions     Delete win3
  7739 @SYMTestActions     Delete win3
  6956 @SYMTestExpectedResults Both win1 and win2 receive visibility events
  7740 @SYMTestExpectedResults Both win1 and win2 receive visibility events
  6957 */            
  7741 */            
  6958         case 29:
  7742         case 33:
  6959             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0016"));
  7743             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0016"));
  6960             iTest->LogSubTest(KTest29);
  7744             iTest->LogSubTest(KTest33);
  6961             RunTestsL();
  7745             RunTestsL();
  6962             break;
  7746             break;
  6963 /**
  7747 /**
  6964 @SYMTestCaseID      GRAPHICS-WSERV-2669-0017
  7748 @SYMTestCaseID      GRAPHICS-WSERV-2669-0017
  6965 @SYMREQ             REQ13202: Possibility for external layers to appear above UI layer 
  7749 @SYMREQ             REQ13202: Possibility for external layers to appear above UI layer 
  6969 @SYMPrerequisites   Win1 – bottom window
  7753 @SYMPrerequisites   Win1 – bottom window
  6970                     Win2 – top window which does not overlap win1
  7754                     Win2 – top window which does not overlap win1
  6971 @SYMTestActions     Move win2 to overlap win1
  7755 @SYMTestActions     Move win2 to overlap win1
  6972 @SYMTestExpectedResults No visibility event is received (win1 is still fully visible)
  7756 @SYMTestExpectedResults No visibility event is received (win1 is still fully visible)
  6973 */            
  7757 */            
  6974         case 30:
  7758         case 34:
  6975             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0017"));
  7759             ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0017"));
  6976             iTest->LogSubTest(KTest30);
  7760             iTest->LogSubTest(KTest34);
  6977             RunTestsL();
  7761             RunTestsL();
  6978             break;
  7762             break;
       
  7763 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS  
  6979 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  7764 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  6980 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS  
       
  6981 
  7765 
  6982 /**
  7766 /**
  6983 @SYMTestCaseID      GRAPHICS-WSERV-0559
  7767 @SYMTestCaseID      GRAPHICS-WSERV-0559
  6984 @SYMDEF             INC140850
  7768 @SYMDEF             INC140850
  6985 @SYMTestCaseDesc    To check Wserv passes correct repeat value for TRawEvent of type EKeyRepeat.
  7769 @SYMTestCaseDesc    To check Wserv passes correct repeat value for TRawEvent of type EKeyRepeat.
  6992 
  7776 
  6993 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  7777 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
  6994 		case 28:
  7778 		case 28:
  6995 #else
  7779 #else
  6996 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  7780 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
  6997 		case 31:
  7781 		case 35:
  6998 #else
  7782 #else
  6999 		case 28:
  7783 		case 32:
  7000 #endif
  7784 #endif
  7001 #endif
  7785 #endif
  7002 		    // This test was moved to be the last test in the test suite, because it sometimes leaves events in the event queue, 
  7786 		    // This test was moved to be the last test in the test suite, because it sometimes leaves events in the event queue, 
  7003 		    //it can affect the results of other tests. This test case should be the last test in the test suite. 
  7787 		    //it can affect the results of other tests. This test case should be the last test in the test suite. 
  7004 		    ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0484"));
  7788 		    ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0484"));
  7005 		    iTest->LogSubTest(KTest31A);
  7789 		    iTest->LogSubTest(KTest35A);
  7006 		    InitializeQueueSizeTestL(EFalse);
  7790 		    InitializeQueueSizeTestL(EFalse);
  7007 		    iTest->LogSubTest(KTest31B);
  7791 		    iTest->LogSubTest(KTest35B);
  7008 		    InitializeQueueSizeTestL(ETrue);
  7792 		    InitializeQueueSizeTestL(ETrue);
  7009 		    break;    
  7793 		    break;    
  7010 			
  7794 			
  7011 		default:
  7795 		default:
  7012             ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  7796             ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);