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); |
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++) |