|
1 // Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // Test window server events |
|
15 // |
|
16 // |
|
17 |
|
18 /** |
|
19 @file |
|
20 @test |
|
21 @internalComponent - Internal Symbian test code |
|
22 */ |
|
23 |
|
24 #ifndef __INIPARSER_H__ |
|
25 #define __INIPARSER_H__ |
|
26 #endif // __INIPARSER_H__ |
|
27 |
|
28 #include "PARSEINIDATA.H" |
|
29 #include "TEVENT.H" |
|
30 #include "W32CLICK.H" |
|
31 #include <w32debug.h> |
|
32 #include <hal.h> |
|
33 |
|
34 #define FAIL_LOGGING on |
|
35 //#define DETAILED |
|
36 #define LOGGING 1 //Uncomment this when there is a fail so that you get more logging |
|
37 |
|
38 _LIT(KKeyClickPluginDll, "click.dll"); |
|
39 |
|
40 const TInt KLongKeyCaptureLowPriority = 1; |
|
41 const TInt KLongKeyCaptureHighPriority = 2; |
|
42 |
|
43 CTQueueClient::CTQueueClient(CTEventTest *aTest) : iTest(aTest) |
|
44 { |
|
45 } |
|
46 |
|
47 CTQueueClient::~CTQueueClient() |
|
48 { |
|
49 CloseEventTestGroupOnSecondScreen(); |
|
50 iGroup->GroupWin()->EnableReceiptOfFocus(EFalse); |
|
51 delete iChildWin; |
|
52 delete iWin; |
|
53 |
|
54 } |
|
55 |
|
56 void CTQueueClient::ConstructL(TBool aCreateChild) |
|
57 { |
|
58 CTClient::ConstructL(); |
|
59 iGroup=new(ELeave) CTQueueWindowGroup(this); |
|
60 iGroup->ConstructL(); |
|
61 iWin=new(ELeave) CTBackedUpWin(EGray4); |
|
62 iWin->ConstructExtLD(*iGroup,TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight)); |
|
63 iWin->Activate(); |
|
64 if (aCreateChild) |
|
65 { |
|
66 iChildWin=new(ELeave) CTBackedUpWin(EGray4); |
|
67 iChildWin->ConstructExtLD(*iWin,ChildTopLeft(),ChildSize()); |
|
68 iChildWin->Activate(); |
|
69 } |
|
70 iWs.Flush(); |
|
71 } |
|
72 |
|
73 void CTQueueClient::ConstructEventHandlerL() |
|
74 { |
|
75 iEventHandler=new(ELeave) CTQueueTestEvent(&iWs, iTest); |
|
76 ((CTQueueTestEvent *)iEventHandler)->ConstructL(); |
|
77 } |
|
78 |
|
79 TInt CTQueueClient::WindowGroupIdentifier() |
|
80 { |
|
81 return(iGroup->GroupWin()->Identifier()); |
|
82 } |
|
83 |
|
84 CTWinBase* CTQueueClient::GetHandle(TPoint& aPos) |
|
85 { |
|
86 if (iCapturing) |
|
87 return iChildWin; |
|
88 if (iChildWin && TRect(ChildTopLeft(),ChildSize()).Contains(aPos)) |
|
89 //if (iChildWin && TRect(TPoint(),ChildSize()).Contains(aPos)) |
|
90 { |
|
91 aPos-=ChildTopLeft(); |
|
92 if (iChildCapturing) |
|
93 iCapturing=ETrue; |
|
94 return iChildWin; |
|
95 } |
|
96 return iWin; |
|
97 } |
|
98 |
|
99 void CTQueueClient::AddExpectedEvent(TWsEvent &aEvent) |
|
100 { |
|
101 #if defined(DETAILED) |
|
102 _LIT(KLog," Adding Event Type=%d"); |
|
103 TLogMessageText buf; |
|
104 buf.Format(KLog,aEvent.Type()); |
|
105 LogMessage(buf); |
|
106 #endif |
|
107 ((CTQueueTestEvent *)iEventHandler)->AddExpectedEvent(aEvent); |
|
108 } |
|
109 |
|
110 void CTQueueClient::SetChildCapture(TInt aCaptureFlags) |
|
111 { |
|
112 if (!iChildWin) |
|
113 return; |
|
114 iChildWin->BaseWin()->SetPointerCapture(aCaptureFlags); |
|
115 if (aCaptureFlags|RWindowBase::TCaptureFlagEnabled) |
|
116 iChildCapturing=ETrue; |
|
117 } |
|
118 // |
|
119 |
|
120 CTQueueTestEvent::CTQueueTestEvent(RWsSession *aWs, CTEventTest *aTest) : CTEvent(aWs) |
|
121 { |
|
122 iTest = aTest; |
|
123 iCheckTimeStamp = EFalse; |
|
124 iLastEventError = EFalse; |
|
125 } |
|
126 |
|
127 void CTQueueTestEvent::ConstructL() |
|
128 { |
|
129 CTEventBase::Construct(); |
|
130 iEventBuffer.SetLengthL(EEventBufferSize); |
|
131 iRedrawType=iTest->TestBase()->RedrawStoreTypeL(); |
|
132 } |
|
133 |
|
134 void CTQueueTestEvent::TestL(TInt aTest) |
|
135 { |
|
136 if (!aTest) |
|
137 { |
|
138 iTest->Failed(); |
|
139 User::Leave(ETestFailed); |
|
140 } |
|
141 } |
|
142 |
|
143 //#define FAIL_LOGGING yes |
|
144 void CTQueueTestEvent::doRunL() |
|
145 { |
|
146 TWsEvent wsEvent; |
|
147 iWs->GetEvent(wsEvent); |
|
148 TWsEvent expectedEvent; |
|
149 |
|
150 #if defined(FAIL_LOGGING) |
|
151 TInt eType,wsHan,eHan,wsKeyCode,eKeyCode,wsKeyRepeat,eKeyRepeat,wsKeyScan,eKeyScan; |
|
152 TLogMessageText buf; |
|
153 _LIT(KStartString,"AUTO EventTestFail "); |
|
154 #endif |
|
155 TInt wsType=wsEvent.Type(); |
|
156 if (wsEvent.Type()==EEventNull) |
|
157 TestL(wsEvent.Handle()==0); |
|
158 else |
|
159 { |
|
160 TInt count=iEventBuffer.Count(); |
|
161 if (count==0 && wsType==EEventFocusGained) |
|
162 goto End; |
|
163 if (iLastEventError |
|
164 && (iRedrawType==EPartialRedraw_FullRedrawSupport || iRedrawType==EPartialRedraw_PreserveStoredCmds) |
|
165 && wsEvent.Type()==EEventErrorMessage /*&& expectedEvent.Type()!=EEventErrorMessage*/) //Should really check if the next expected event is an error but there is no way to do this without removing it from the buffer |
|
166 { |
|
167 #if defined(DETAILED) |
|
168 _LIT(KLog,"Skip Duplicate Error Message"); |
|
169 iTest->LOG_MESSAGE(KLog); |
|
170 #endif |
|
171 return; //Ignore repeated error events |
|
172 } |
|
173 do { |
|
174 TestL(iEventBuffer.Remove(&expectedEvent)); //Loop needed for REL Build with DEB WSERV and W32 |
|
175 #if defined(DETAILED) |
|
176 _LIT(KLog,"Skip event while waiting for error message"); |
|
177 if (expectedEvent.Type()==EEventErrorMessage && wsEvent.Type()!=expectedEvent.Type()) |
|
178 iTest->LOG_MESSAGE(KLog); |
|
179 #endif |
|
180 } while (expectedEvent.Type()==EEventErrorMessage && wsEvent.Type()!=expectedEvent.Type()); |
|
181 ++iEventCount; //iEventSet |
|
182 #if defined(FAIL_LOGGING) |
|
183 wsType=wsEvent.Type(),eType=expectedEvent.Type(),wsHan=wsEvent.Handle(),eHan=expectedEvent.Handle(); |
|
184 if (wsType!=eType) |
|
185 { |
|
186 _LIT(KEventDiff,"Count=%d Events Differ Exp=%d Act=%d"); |
|
187 buf.Copy(KStartString); |
|
188 buf.AppendFormat(KEventDiff,iEventCount,eType,wsType); |
|
189 iTest->LOG_MESSAGE(buf); |
|
190 } |
|
191 else |
|
192 { |
|
193 #if defined(DETAILED) |
|
194 _LIT(KLog," Count=%d Event Type=%d"); |
|
195 iTest->LOG_MESSAGE3(KLog,iEventCount,wsType); |
|
196 #endif |
|
197 } |
|
198 if (wsHan!=eHan) |
|
199 { |
|
200 _LIT(KHandlesDiff,"Count=%d Handles Differ"); |
|
201 buf.Copy(KStartString); |
|
202 buf.AppendFormat(KHandlesDiff,iEventCount); |
|
203 iTest->LOG_MESSAGE(buf); |
|
204 } |
|
205 #endif |
|
206 TestL(wsEvent.Type()==expectedEvent.Type() && wsEvent.Handle()==expectedEvent.Handle()); |
|
207 } |
|
208 iLastEventError=(wsEvent.Type()==EEventErrorMessage); |
|
209 |
|
210 switch(wsEvent.Type()) |
|
211 { |
|
212 case EEventKey: |
|
213 #if defined(FAIL_LOGGING) |
|
214 wsKeyCode=wsEvent.Key()->iCode,eKeyCode=expectedEvent.Key()->iCode; |
|
215 if (wsKeyCode!=eKeyCode) |
|
216 { |
|
217 _LIT(KKeysDiff,"Count=%d Key Code Exp=%d (%c) Act=%d (%c)"); |
|
218 buf.Copy(KStartString); |
|
219 buf.AppendFormat(KKeysDiff,iEventCount,eKeyCode,eKeyCode,wsKeyCode,wsKeyCode); |
|
220 iTest->LOG_MESSAGE(buf); |
|
221 } |
|
222 wsKeyRepeat=wsEvent.Key()->iRepeats,eKeyRepeat=expectedEvent.Key()->iRepeats; |
|
223 if ((wsKeyRepeat>0)!=(eKeyRepeat>0) || wsKeyRepeat<eKeyRepeat) |
|
224 { |
|
225 _LIT(KKeysRepDiff,"Count=%d Key Repeat Exp=%d Act=%d"); |
|
226 buf.Copy(KStartString); |
|
227 buf.AppendFormat(KKeysRepDiff,iEventCount,eKeyRepeat,wsKeyRepeat); |
|
228 iTest->LOG_MESSAGE(buf); |
|
229 } |
|
230 #endif |
|
231 TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode && |
|
232 wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats && |
|
233 (wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0)); |
|
234 // Fall Through |
|
235 case EEventKeyDown: |
|
236 case EEventKeyUp: |
|
237 { |
|
238 TUint wsModifiers = wsEvent.Key()->iModifiers; |
|
239 TUint eModifiers = expectedEvent.Key()->iModifiers; |
|
240 #if defined(FAIL_LOGGING) |
|
241 wsKeyScan=wsEvent.Key()->iScanCode,eKeyScan=expectedEvent.Key()->iScanCode; |
|
242 if (wsKeyScan!=eKeyScan) |
|
243 { |
|
244 _LIT(KScanDiff,"Count=%d Scan Code Exp=%d (%c) Act=%d (%c)"); |
|
245 buf.Copy(KStartString); |
|
246 buf.AppendFormat(KScanDiff,iEventCount,eKeyScan,eKeyScan,wsKeyScan,wsKeyScan); |
|
247 iTest->LOG_MESSAGE(buf); |
|
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 } |
|
257 #endif |
|
258 TestL(wsEvent.Key()->iScanCode == expectedEvent.Key()->iScanCode && |
|
259 (eModifiers == KModifiersIgnore || wsModifiers == eModifiers)); |
|
260 } |
|
261 break; |
|
262 case EEventModifiersChanged: |
|
263 { |
|
264 TBool changeModifiersOK=(wsEvent.ModifiersChanged()->iChangedModifiers |
|
265 ==expectedEvent.ModifiersChanged()->iChangedModifiers); |
|
266 TBool modifiersOK=((wsEvent.ModifiersChanged()->iModifiers&wsEvent.ModifiersChanged()->iChangedModifiers)== |
|
267 (expectedEvent.ModifiersChanged()->iModifiers&wsEvent.ModifiersChanged()->iChangedModifiers)); |
|
268 #if defined(FAIL_LOGGING) |
|
269 if (!changeModifiersOK || !modifiersOK) |
|
270 { |
|
271 _LIT(KModDiff,"Count=%d Modifiers"); |
|
272 buf.Copy(KStartString); |
|
273 buf.AppendFormat(KModDiff,iEventCount); |
|
274 iTest->LOG_MESSAGE(buf); |
|
275 } |
|
276 #endif |
|
277 TestL(changeModifiersOK); |
|
278 TestL(modifiersOK); |
|
279 } |
|
280 break; |
|
281 case EEventPointer: |
|
282 case EEventDragDrop: |
|
283 { |
|
284 #if defined(FAIL_LOGGING) |
|
285 TInt expectedType=expectedEvent.Pointer()->iType, actualType=wsEvent.Pointer()->iType; |
|
286 TPoint expectedPos=expectedEvent.Pointer()->iPosition, actualPos=wsEvent.Pointer()->iPosition; |
|
287 if (actualType!=expectedType) |
|
288 { |
|
289 _LIT(KPointerDiff,"Count=%d Pointer Type Exp=%d Act=%d"); |
|
290 buf.Copy(KStartString); |
|
291 buf.AppendFormat(KPointerDiff,iEventCount,expectedType,actualType); |
|
292 iTest->LOG_MESSAGE(buf); |
|
293 } |
|
294 if (actualPos!=expectedPos) |
|
295 { |
|
296 _LIT(KPointerPosDiff,"Count=%d Pointer Pos E=(%d,%d) A=(%d,%d)"); |
|
297 buf.Copy(KStartString); |
|
298 buf.AppendFormat(KPointerPosDiff,iEventCount,expectedPos.iX,expectedPos.iY |
|
299 ,actualPos.iX,actualPos.iY); |
|
300 iTest->LOG_MESSAGE(buf); |
|
301 } |
|
302 #endif |
|
303 TestL(wsEvent.Pointer()->iType==expectedEvent.Pointer()->iType); |
|
304 TestL(wsEvent.Pointer()->iPosition==expectedEvent.Pointer()->iPosition); |
|
305 TInt count=iEventBuffer.Count();count++; //Dummy line to help in debugging. |
|
306 } |
|
307 break; |
|
308 case EEventWindowVisibilityChanged: |
|
309 { |
|
310 #if defined(FAIL_LOGGING) |
|
311 TUint expectedFlags=expectedEvent.VisibilityChanged()->iFlags; |
|
312 TUint actualFlags=wsEvent.VisibilityChanged()->iFlags; |
|
313 if (actualFlags!=expectedFlags) |
|
314 { |
|
315 _LIT(KVisibilityDiff,"Count=%d Visibility Flags Exp=%d Act=%d"); |
|
316 buf.Copy(KStartString); |
|
317 buf.AppendFormat(KVisibilityDiff,iEventCount,expectedFlags,actualFlags); |
|
318 iTest->LOG_MESSAGE(buf); |
|
319 } |
|
320 #endif |
|
321 TestL(wsEvent.VisibilityChanged()->iFlags==expectedEvent.VisibilityChanged()->iFlags); |
|
322 TInt count=iEventBuffer.Count();count++; //Dummy line to help in debugging. |
|
323 } |
|
324 break; |
|
325 case EEventMessageReady: |
|
326 { |
|
327 const SEventMessageReady message = *(SEventMessageReady*)wsEvent.EventData(); |
|
328 TestL(message.iMessageUid== TUid::Uid(123)); |
|
329 } |
|
330 break; |
|
331 default:; |
|
332 } |
|
333 if(iCheckTimeStamp) |
|
334 { |
|
335 const TInt KOffset=100000; //0.1secs |
|
336 TInt64 offset = expectedEvent.Time().Int64() - wsEvent.Time().Int64(); |
|
337 #if defined(FAIL_LOGGING) |
|
338 if(Abs(offset)<KOffset) |
|
339 { |
|
340 _LIT(KTimeStampDiff,"Count=%d Offset=%d, ExpectedTime=%d, WServEventTime=%d"); |
|
341 buf.Copy(KStartString); |
|
342 buf.AppendFormat(KTimeStampDiff,iEventCount,offset,expectedEvent.Time().Int64(),wsEvent.Time().Int64()); |
|
343 iTest->LOG_MESSAGE(buf); |
|
344 } |
|
345 #endif |
|
346 TestL(Abs(offset)<KOffset); |
|
347 } |
|
348 End: |
|
349 if (iEventBuffer.Count()==0) |
|
350 { |
|
351 TRAPD(err, iTest->NextSetOfEventsL()); //Not allowed to leave |
|
352 if(err != KErrNone) |
|
353 { |
|
354 buf.Copy(KStartString); |
|
355 buf.AppendFormat(_L("Subtest does not follow rules set by TEvent test framework, leave code: %d"), err); |
|
356 iTest->TEST(EFalse); |
|
357 iTest->LOG_MESSAGE(buf); |
|
358 User::Leave(err); |
|
359 } |
|
360 } |
|
361 |
|
362 } |
|
363 |
|
364 void CTQueueTestEvent::AddExpectedEvent(TWsEvent &aEvent) |
|
365 { |
|
366 if(iCheckTimeStamp) |
|
367 { |
|
368 static_cast<TWsQTEvent&>(aEvent).Time().UniversalTime(); |
|
369 } |
|
370 iEventBuffer.Add(&aEvent); |
|
371 } |
|
372 |
|
373 TInt CTQueueTestEvent::EventsLeft() |
|
374 { |
|
375 return iEventBuffer.Count(); |
|
376 } |
|
377 // |
|
378 |
|
379 CTQueueWindowGroup::CTQueueWindowGroup(CTClient *aClient) : CTWindowGroup(aClient) |
|
380 {} |
|
381 |
|
382 void CTQueueWindowGroup::ConstructL() |
|
383 { |
|
384 CTWindowGroup::ConstructL(); |
|
385 User::LeaveIfError(iGroupWin.EnableOnEvents(EEventControlAlways)); |
|
386 User::LeaveIfError(iGroupWin.EnableGroupChangeEvents()); |
|
387 } |
|
388 |
|
389 // |
|
390 |
|
391 /** |
|
392 Closes and deletes anim DLL. |
|
393 @param aAnimDll Pointer to the anim Dll to be closed and deleted |
|
394 */ |
|
395 LOCAL_C void DestroyAnimDll(TAny* aAnimDll) |
|
396 { |
|
397 (static_cast<RAnimDll*>(aAnimDll))->Destroy(); |
|
398 } |
|
399 |
|
400 /** |
|
401 Destroys an REventAnimBase derived anim |
|
402 @param aAnim REventAnimBase derived client-side handle to anim |
|
403 */ |
|
404 LOCAL_C void DestroyAnim(TAny* aAnim) |
|
405 { |
|
406 (static_cast<REventAnimBase*>(aAnim))->Destroy(); |
|
407 } |
|
408 |
|
409 /** |
|
410 Loads the DLL containing the test anims and pushes it onto the cleanup stack. |
|
411 This function leaves if the operation was unsuccessful. |
|
412 @return A pointer to the DLL containing test anims |
|
413 */ |
|
414 RAnimDll* REventAnimBase::LoadL() |
|
415 { |
|
416 RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs); |
|
417 CleanupStack::PushL(TCleanupItem(DestroyAnimDll,animDll)); |
|
418 User::LeaveIfError(animDll->Load(KAnimDLLName)); |
|
419 CleanupStack::Pop(animDll); |
|
420 return animDll; |
|
421 } |
|
422 |
|
423 /** |
|
424 Closes the client-side handle to the anim, destroys the DLL and deletes itself. |
|
425 */ |
|
426 void REventAnimBase::Destroy() |
|
427 { |
|
428 Close(); |
|
429 delete this; |
|
430 } |
|
431 |
|
432 /** |
|
433 Resets server-side state of anim |
|
434 */ |
|
435 void REventAnimBase::Reset() |
|
436 { |
|
437 CommandReply(EADllReset); |
|
438 } |
|
439 |
|
440 /** |
|
441 @return Under non-error conditions, returns 0. |
|
442 Under error conditions, returns the number of events received |
|
443 since the first unexpected event was sent. |
|
444 */ |
|
445 TInt REventAnimBase::ErrorCode() |
|
446 { |
|
447 return CommandReply(EADllErrorCode); |
|
448 } |
|
449 |
|
450 /** |
|
451 @return The number of events received by the anim since it was last reset. |
|
452 */ |
|
453 TInt REventAnimBase::NumberOfEventsReceived() |
|
454 { |
|
455 return CommandReply(EADllNumberOfEventsReceived); |
|
456 } |
|
457 |
|
458 /** |
|
459 Adds an expected event to the list of events expected by the anim. |
|
460 @param aEat Indicates if event is expected to be eaten (ETrue 'indicates expected to be eaten') |
|
461 @param aEvent The expected event |
|
462 @return KErrNone if succcessful, othewise error code. |
|
463 */ |
|
464 TInt REventAnimBase::AddExpectedEvent(TBool aEat, const TRawEvent& aEvent) |
|
465 { |
|
466 TAnimRawEvent event; |
|
467 event.iRawEvent=aEvent; |
|
468 event.iEat=aEat; |
|
469 return AddExpectedEvent(event); |
|
470 } |
|
471 |
|
472 /** |
|
473 Adds an expected event to the list of events expected by the anim. |
|
474 @param aEvent The expected event |
|
475 @return KErrNone if succcessful, othewise error code. |
|
476 */ |
|
477 TInt REventAnimBase::AddExpectedEvent(const TAnimRawEvent& aEvent) |
|
478 { |
|
479 TPckgBuf<TAnimRawEvent> param; |
|
480 param()=aEvent; |
|
481 return CommandReply(EADllAddExpectedEvent,param); |
|
482 } |
|
483 |
|
484 // |
|
485 |
|
486 /** |
|
487 Loads the DLL containing the event test anim and creates an anim for event tests |
|
488 @param aWin the base window to which the anim is associated (this anim is a Window anim) |
|
489 @return A pointer to the new REventAnim |
|
490 */ |
|
491 REventAnim* REventAnim::NewL(RWindowBase* aWin, RAnimDll* aDll, REventAnimBase::EAnimationType aType/*=EEventAnim*/) |
|
492 { |
|
493 REventAnim* self=new(ELeave) REventAnim(aDll); |
|
494 CleanupStack::PushL(TCleanupItem(DestroyAnim,self)); |
|
495 User::LeaveIfError(self->Construct(*aWin,(aType == EEventAnim ? EAnimTypeEventTest : EAnimTypeEventPostingTest), TPtrC8())); |
|
496 CleanupStack::Pop(self); |
|
497 return self; |
|
498 } |
|
499 |
|
500 /** |
|
501 Checks if the anim has received the correct events, and resets the sever-side state of the anim |
|
502 @return positive value if events did not match expected showing the first event that didn't match. |
|
503 negative value if there were the wrong number of events showing the number of events there were |
|
504 0 if correct number of events and they all match |
|
505 */ |
|
506 TInt REventAnim::TestFail(TInt aNoEvents) |
|
507 { |
|
508 TInt events=CommandReply(EADllErrorCode); |
|
509 if (events>0) |
|
510 return events; |
|
511 events=CommandReply(EADllNoEventsAndReset); |
|
512 if (events==aNoEvents) |
|
513 return 0; |
|
514 return -events; |
|
515 } |
|
516 |
|
517 // |
|
518 /** |
|
519 Loads the DLL containing the event test anim and creates an anim for event handler removal tests |
|
520 @param aWin the base window to which the anim is associated (this anim is a Window anim) |
|
521 @return A pointer to the new REventAnim |
|
522 */ |
|
523 RRemovableAnim* RRemovableAnim::NewLC(RWindowBase* aWin, RAnimDll* aDll) |
|
524 { |
|
525 RRemovableAnim* self=new(ELeave) RRemovableAnim(aDll); |
|
526 CleanupStack::PushL(TCleanupItem(DestroyAnim,self)); |
|
527 User::LeaveIfError(self->Construct(*aWin,EAnimTypeRemovableAnim,TPtrC8())); |
|
528 return self; |
|
529 } |
|
530 |
|
531 /** |
|
532 Sets the lifetime of the anim. This anim will remove itself from the |
|
533 event handler list after receiving this number of events. |
|
534 @return The lifetime of the anim |
|
535 */ |
|
536 TInt RRemovableAnim::SetEventHandlerLifetime(TInt aEventCount) |
|
537 { |
|
538 TPckgBuf<TInt> param; |
|
539 param()=aEventCount; |
|
540 return CommandReply(EADllSetEventHandlerLifetime, param); |
|
541 } |
|
542 |
|
543 /** |
|
544 Retrieves the lifetime of the anim. This anim will remove itself from the |
|
545 event handler list after receiving this number of events. |
|
546 @return The lifetime of the anim |
|
547 */ |
|
548 TInt RRemovableAnim::EventHandlerLifetime() |
|
549 { |
|
550 return CommandReply(EADllEventHandlerLifetime); |
|
551 } |
|
552 /** |
|
553 Adds the anim to the list of event handlers. |
|
554 This anim should receive any subsequent events. |
|
555 @return KErrNone on successful addition. |
|
556 */ |
|
557 TInt RRemovableAnim::AddToEventHandlers() |
|
558 { |
|
559 return CommandReply(EADllAddToEventHandlers); |
|
560 } |
|
561 |
|
562 /** |
|
563 Removes the anim from the list of event handlers. |
|
564 This anim should not receive any subsequent events. |
|
565 @return KErrNone on successful removal. |
|
566 */ |
|
567 TInt RRemovableAnim::RemoveFromEventHandlers() |
|
568 { |
|
569 return CommandReply(EADllRemoveFromEventHandlers); |
|
570 } |
|
571 |
|
572 /** |
|
573 Tests if the anim has received the correct number of events, and that |
|
574 the events received are all the correct events. |
|
575 @param aNoEvents The total expected number of events since it was last reset/constructed. |
|
576 @return ETrue if the anim has received the expected events. |
|
577 */ |
|
578 TBool RRemovableAnim::TestPassed() |
|
579 { |
|
580 return CommandReply(EADllTestPassed); |
|
581 } |
|
582 |
|
583 // |
|
584 |
|
585 CTEventTest::CTEventTest(CTestStep* aStep) : CTWsGraphicsBase(aStep) |
|
586 { |
|
587 INFO_PRINTF1(_L("Testing Event functions")); |
|
588 } |
|
589 |
|
590 CTEventTest::~CTEventTest() |
|
591 { |
|
592 delete iBlankWin; |
|
593 iBackingWindow.Close(); |
|
594 delete iVisWins1; |
|
595 delete iVisWins2; |
|
596 delete iVisWins3; |
|
597 delete iTransWin; |
|
598 delete iQueueClient; |
|
599 if (iAnim) |
|
600 iAnim->Destroy(); |
|
601 delete iEventTestGroup2; //Just in case it doesn't get deleted normally |
|
602 delete iEventTestGroup3; //Just in case it doesn't get deleted normally |
|
603 delete iEventTestGroup4; //Just in case it doesn't get deleted normally |
|
604 if (iPtrPluginLoaded) |
|
605 { |
|
606 iClick.Unload(); |
|
607 } |
|
608 iClick.Close(); |
|
609 if (iTurnBackOnCapsLock) |
|
610 { |
|
611 TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOnModifier); |
|
612 } |
|
613 if (iRemovableAnims) |
|
614 { |
|
615 EventHandlerRemoval_DestroyAllAnims(); |
|
616 iRemovableAnims->Close(); |
|
617 delete iRemovableAnims; |
|
618 } |
|
619 if (iAnimDll) |
|
620 { |
|
621 iAnimDll->Destroy(); |
|
622 } |
|
623 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
624 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
625 if (!iSurfaceId.IsNull()) |
|
626 { |
|
627 iSurfaceManager.CloseSurface(iSurfaceId); |
|
628 } |
|
629 iSurfaceManager.Close(); |
|
630 if(iTimeOutCallback) |
|
631 { |
|
632 iTimeOutCallback->Cancel(); |
|
633 delete iTimeOutCallback; |
|
634 } |
|
635 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
636 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
637 } |
|
638 |
|
639 void CTEventTest::ConstructL() |
|
640 { |
|
641 _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini"); |
|
642 CIniData* iniData = CIniData::NewL(KWsIniFile, ' '); |
|
643 _LIT( KWsiniYShifting, "YSHIFTING"); |
|
644 iniData->FindVar(KWsiniYShifting, iYOffset); |
|
645 delete iniData; |
|
646 TheClient->iScreen->SetAppScreenMode(0); |
|
647 TheClient->iScreen->SetScreenMode(0); // in mode 0 TheClient->iScreen->SizeInPixels() |
|
648 iPhysicalScreenSize = TheClient->iScreen->SizeInPixels(); // is equal to physical screen size |
|
649 BaseWin->Invalidate(); |
|
650 BaseWin->Win()->BeginRedraw(); |
|
651 TheGc->Activate(*BaseWin->Win()); |
|
652 TheGc->SetBrushColor(TRgb::Gray16(12)); |
|
653 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
654 TheGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
655 TheGc->DrawRect(TRect(BaseWin->Win()->Size())); |
|
656 TheGc->Deactivate(); |
|
657 BaseWin->Win()->EndRedraw(); |
|
658 TheGc->Activate(*TestWin->Win()); |
|
659 TheGc->SetBrushColor(TRgb::Gray16(4)); |
|
660 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); |
|
661 TheGc->SetPenStyle(CGraphicsContext::ENullPen); |
|
662 TheGc->DrawRect(TRect(TestWin->Win()->Size())); |
|
663 TheGc->Deactivate(); |
|
664 iBackingWindow=RBlankWindow(TheClient->iWs); |
|
665 iBackingWindow.Construct(*TheClient->iGroup->WinTreeNode(),ENullWsHandle); |
|
666 iBackingWindow.SetColor(TRgb(0,0xDD,0xDD)); |
|
667 iBackingWindow.SetOrdinalPosition(-1,-25); |
|
668 iBackingWindow.Activate(); |
|
669 iBlankWin=new(ELeave) CTBlankWindow(); |
|
670 iBlankWin->ConstructL(*TheClient->iGroup); |
|
671 User::LeaveIfError(iBlankWin->BaseWin()->SetRequiredDisplayMode(EColor256)); |
|
672 iBlankWin->SetExt(TPoint(),iPhysicalScreenSize); |
|
673 iBlankWin->SetVisible(EFalse); |
|
674 iBlankWin->Activate(); |
|
675 CArrayFixFlat<TInt> *rotations=new(ELeave) CArrayFixFlat<TInt>(1); |
|
676 iNumScrModes=TheClient->iScreen->NumScreenModes(); |
|
677 TInt modes=Min(2,iNumScrModes); |
|
678 TInt mode; |
|
679 TInt rot; |
|
680 CleanupStack::PushL(rotations); |
|
681 for (mode=0;mode<modes;++mode) |
|
682 { |
|
683 User::LeaveIfError(TheClient->iScreen->GetRotationsList(mode,rotations)); |
|
684 for (rot=rotations->Count()-1;rot>=0;--rot) |
|
685 { |
|
686 iScreenModeTests|=(1<<(*rotations)[rot]); |
|
687 } |
|
688 } |
|
689 if (CheckScalingSupportedOrNot()) |
|
690 iScreenModeTests|=EDoScale; |
|
691 |
|
692 iClick=RSoundPlugIn(TheClient->iWs); |
|
693 User::LeaveIfError(iClick.Construct(TUid::Uid(CLICK_THIRD_UID))); |
|
694 TBool ptrPluginLoadable = EFalse; |
|
695 iClick.IsLoaded(ptrPluginLoadable); |
|
696 if (ptrPluginLoadable) |
|
697 { |
|
698 User::LeaveIfError(iClick.Load(KKeyClickPluginDll)); |
|
699 iPtrPluginLoaded = ETrue; |
|
700 } |
|
701 CleanupStack::PopAndDestroy(); |
|
702 if (TheClient->iWs.GetModifierState()&EModifierCapsLock) |
|
703 { |
|
704 iTurnBackOnCapsLock=ETrue; |
|
705 TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOffModifier); |
|
706 } |
|
707 iAnimDll = REventAnimBase::LoadL(); |
|
708 TInt mods=TheClient->iWs.GetModifierState(); |
|
709 if (mods&EModifierCapsLock) |
|
710 iTest->SimulateKeyDownUp(EStdKeyCapsLock); |
|
711 if (mods&EModifierNumLock) |
|
712 iTest->SimulateKeyDownUp(EStdKeyNumLock); |
|
713 //Make sure all the keys we test are in the up state |
|
714 iTest->SimulateKeyDownUp(EStdKeyLeftShift); |
|
715 iTest->SimulateKeyDownUp(EStdKeyRightShift); |
|
716 iTest->SimulateKeyDownUp(EStdKeyLeftFunc); |
|
717 iTest->SimulateKeyDownUp(EStdKeyLeftCtrl); |
|
718 iTest->SimulateKeyDownUp(EStdKeyRightCtrl); |
|
719 mods=TheClient->iWs.GetModifierState(); |
|
720 _LIT(KLog,"Initial Modifiers state 0x%x (ideally should be zero)"); |
|
721 LOG_MESSAGE2(KLog,mods); |
|
722 iTest->DelayIfFullRomL(); |
|
723 |
|
724 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
725 // 2d or 3d pointer? |
|
726 if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone) |
|
727 { |
|
728 iIs3DPointer=EFalse; |
|
729 } |
|
730 #endif |
|
731 TheClient->iWs.GetKeyboardRepeatRate(iKeyBoardRepeatInitialDelay, iKeyBoardRepeatNextDelay); |
|
732 } |
|
733 |
|
734 void CTEventTest::Failed() |
|
735 { |
|
736 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
737 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
738 if(iTimeOutCallback) |
|
739 { |
|
740 iTimeOutCallback->Cancel(); |
|
741 iTimeOutCallback->Deque(); |
|
742 delete iTimeOutCallback; |
|
743 iTimeOutCallback = NULL; |
|
744 } |
|
745 TEST(EFalse); |
|
746 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
747 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
748 CActiveScheduler::Stop(); |
|
749 iFailed=ETrue; |
|
750 } |
|
751 |
|
752 void CTEventTest::CheckTimeInterval(const TTimeIntervalMicroSeconds32 &aTime,TInt aCheckTime) |
|
753 { |
|
754 TEST(aTime.Int()==aCheckTime); |
|
755 if (aTime.Int()!=aCheckTime) |
|
756 INFO_PRINTF3(_L("aTime.Int()==aCheckTime - Expected: %d, Actual: %d"), aCheckTime, aTime.Int()); |
|
757 } |
|
758 |
|
759 void CTEventTest::KeyRepeatRate(TInt aInitialRepeat, TInt aRepeat) |
|
760 { |
|
761 TheClient->iWs.SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32(aInitialRepeat), TTimeIntervalMicroSeconds32(aRepeat)); |
|
762 TTimeIntervalMicroSeconds32 initialTime; |
|
763 TTimeIntervalMicroSeconds32 time; |
|
764 TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); |
|
765 CheckTimeInterval(initialTime,aInitialRepeat); |
|
766 CheckTimeInterval(time,aRepeat); |
|
767 } |
|
768 |
|
769 void CTEventTest::DoubleClickSettings(TInt aInterval, TInt aDistance) |
|
770 { |
|
771 TheClient->iWs.SetDoubleClick(TTimeIntervalMicroSeconds32(aInterval), aDistance); |
|
772 TTimeIntervalMicroSeconds32 interval; |
|
773 TInt distance; |
|
774 TheClient->iWs.GetDoubleClickSettings(interval, distance); |
|
775 CheckTimeInterval(interval,aInterval); |
|
776 TEST(aDistance==distance); |
|
777 if (aDistance!=distance) |
|
778 INFO_PRINTF3(_L("aDistance==distance - Expected: %d, Actual: %d"), distance, aDistance); |
|
779 } |
|
780 |
|
781 TInt EventCancelFunc(TAny* aClient) |
|
782 { |
|
783 TWsQTEvent event; |
|
784 event.SetType(EEventModifiersChanged); |
|
785 ((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0; |
|
786 ((TModifiersChangedEvent *)event.EventData())->iModifiers=0; |
|
787 TheClient->iWs.SendEventToWindowGroup(TheClient->iGroup->GroupWin()->Identifier(),event); |
|
788 // |
|
789 TRequestStatus status; |
|
790 ((CTClient *)aClient)->iWs.EventReady(&status); |
|
791 ((CTClient *)aClient)->iWs.EventReadyCancel(); |
|
792 User::WaitForRequest(status); |
|
793 return(KErrNone); |
|
794 } |
|
795 |
|
796 void CTEventTest::General() |
|
797 { |
|
798 TWsQTEvent event; |
|
799 event.SetType(EEventModifiersChanged); |
|
800 ((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0; |
|
801 ((TModifiersChangedEvent *)event.EventData())->iModifiers=0; |
|
802 TheClient->iWs.SendEventToWindowGroup(TheClient->iGroup->GroupWin()->Identifier(),event); |
|
803 TCallBack callBack(EventCancelFunc,TheClient); |
|
804 TheClient->SetCancelFunction(callBack); |
|
805 // |
|
806 TTimeIntervalMicroSeconds32 oldInitialTime; |
|
807 TTimeIntervalMicroSeconds32 oldTime; |
|
808 TheClient->iWs.GetKeyboardRepeatRate(oldInitialTime,oldTime); |
|
809 // |
|
810 KeyRepeatRate(EKeyboardInitialRepeat1, EKeyboardRepeat1); |
|
811 KeyRepeatRate(EKeyboardInitialRepeat2, EKeyboardRepeat2); |
|
812 KeyRepeatRate(EKeyboardInitialRepeat3+200, EKeyboardRepeat3); // Max initial repeat with normal keyboard repeat value |
|
813 KeyRepeatRate(EKeyboardInitialRepeat3, EKeyboardRepeat7+200); // Max key and initial repeat |
|
814 KeyRepeatRateNegTest(EKeyboardInitialRepeat4, EKeyboardRepeat4); // -ve initial repeat |
|
815 KeyRepeatRateNegTest(EKeyboardInitialRepeat2, EKeyboardRepeat6); // -ve keyboard repeat |
|
816 #if defined __WINS__ || defined __WINSCW__ |
|
817 KeyRepeatRateNegTest(EKeyboardInitialRepeat3+400, EKeyboardRepeat5); // More than max initial repeat |
|
818 #endif//defined __WINS__ || defined __WINSCW__ |
|
819 DoubleClickSettings(EDoubleClickTime1,EDoubleClickGap1); |
|
820 DoubleClickSettings(EDoubleClickTime2,EDoubleClickGap2); |
|
821 TheClient->iWs.SetKeyboardRepeatRate(oldInitialTime,oldTime); |
|
822 // |
|
823 } |
|
824 |
|
825 #define UNIQUE_PRIORITY 123 |
|
826 void CTEventTest::General2() |
|
827 { |
|
828 RWindowGroup& group=*TheClient->iGroup->GroupWin(); |
|
829 TInt priority=group.OrdinalPriority(); |
|
830 TInt position=group.OrdinalPosition(); |
|
831 TInt priorityGain=TheClient->iWs.GetWindowGroupOrdinalPriority(group.Identifier())-priority; |
|
832 group.SetOrdinalPosition(0,UNIQUE_PRIORITY); |
|
833 TWsQTEvent event; |
|
834 event.SetType(EEventModifiersChanged); |
|
835 ((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0; |
|
836 ((TModifiersChangedEvent *)event.EventData())->iModifiers=0; |
|
837 TheClient->iWs.SendEventToAllWindowGroups(UNIQUE_PRIORITY+priorityGain,event); |
|
838 TCallBack callBack(EventCancelFunc,TheClient); |
|
839 TheClient->SetCancelFunction(callBack); |
|
840 group.SetOrdinalPosition(position,priority); |
|
841 } |
|
842 |
|
843 void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/) |
|
844 { |
|
845 TPckgBuf<TWsEvent> evtPkg; |
|
846 TWsEvent& event=evtPkg(); |
|
847 if (aEventCode==EEventKey && aCode==0) |
|
848 aCode=aScanCode; |
|
849 event.SetType(aEventCode); |
|
850 event.SetHandle((TInt)iQueueClient->iGroup); |
|
851 event.Key()->iCode=aCode; |
|
852 event.Key()->iScanCode=aScanCode; |
|
853 event.Key()->iModifiers=aModifiers; |
|
854 event.Key()->iRepeats=aRepeats; |
|
855 iQueueClient->AddExpectedEvent(event); |
|
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 } |
|
863 iClick.CommandReply(EClickEventAdd,evtPkg); |
|
864 } |
|
865 } |
|
866 |
|
867 void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/) |
|
868 { |
|
869 __ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital)); |
|
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); |
|
876 AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers); |
|
877 AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,modifiersDownUp); |
|
878 } |
|
879 |
|
880 void CTEventTest::AddExpectedEvent(TInt aEventCode, CTWinBase* aWin) |
|
881 { |
|
882 TWsQTEvent event; |
|
883 event.iType=aEventCode; |
|
884 event.iHandle=REINTERPRET_CAST(TInt,aWin); |
|
885 iQueueClient->AddExpectedEvent(event); |
|
886 } |
|
887 |
|
888 void CTEventTest::AddExpectedEvent(TInt aEventCode, RWindowGroup* aWindow) |
|
889 { |
|
890 TWsQTEvent event; |
|
891 event.iType=aEventCode; |
|
892 event.iHandle=(TUint32)aWindow; |
|
893 iQueueClient->AddExpectedEvent(event); |
|
894 } |
|
895 |
|
896 void CTEventTest::AddExpectedEvent(TInt aEventCode) |
|
897 { |
|
898 AddExpectedEvent(aEventCode,iQueueClient->iGroup); |
|
899 } |
|
900 |
|
901 void CTEventTest::AddExpectedErrorMessage(TWsErrorMessage::TErrorCategory aCategory, TInt aError) |
|
902 { |
|
903 TWsQTEvent event; |
|
904 event.iType=EEventErrorMessage; |
|
905 event.iHandle=(TInt)iQueueClient->iGroup; |
|
906 event.ErrorMessage()->iErrorCategory=aCategory; |
|
907 event.ErrorMessage()->iError=aError; |
|
908 iQueueClient->AddExpectedEvent(event); |
|
909 } |
|
910 |
|
911 void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos) |
|
912 { |
|
913 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
914 TAdvancedPointerEvent& ptrEvent=*aEvent.Pointer(); |
|
915 aEvent.SetType(EEventPointer); |
|
916 ptrEvent.iParentPosition=aPos; |
|
917 // SetHandle must be done after iParentPosition is set, but before iPosition is set. |
|
918 aEvent.SetHandle(reinterpret_cast<TInt>(iQueueClient->GetHandle(aPos))); |
|
919 const TPoint3D point3D(aPos.iX, aPos.iY, 0); |
|
920 const TInt pointerEventModifiers=0; |
|
921 const TUint8 pointerNumber=0; |
|
922 aEvent.InitAdvancedPointerEvent(aType,pointerEventModifiers,point3D,pointerNumber); |
|
923 #else |
|
924 TPointerEvent& ptrEvent=*aEvent.Pointer(); |
|
925 aEvent.SetType(EEventPointer); |
|
926 ptrEvent.iParentPosition=aPos; //Must be done before next line |
|
927 aEvent.SetHandle(REINTERPRET_CAST(TInt,iQueueClient->GetHandle(aPos))); |
|
928 ptrEvent.iType=aType; |
|
929 ptrEvent.iModifiers=0; |
|
930 ptrEvent.iPosition=aPos; |
|
931 #endif |
|
932 } |
|
933 |
|
934 void CTEventTest::CalculatePointerCaptureEvent(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TInt aHandle) |
|
935 { |
|
936 TPointerEvent& ptrEvent=*aEvent.Pointer(); |
|
937 aEvent.SetType(EEventPointer); |
|
938 ptrEvent.iParentPosition=aPos; //Must be done before next line |
|
939 if(iVisWins1 && iVisWins2) |
|
940 { |
|
941 if (TRect(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()).Contains(aPos) && |
|
942 !TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos)) |
|
943 { |
|
944 aPos-=iQueueClient->ChildTopLeft(); //Pointer is on the first window |
|
945 aEvent.SetHandle((TInt)iVisWins1); |
|
946 } |
|
947 else if (TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos)) |
|
948 { |
|
949 aPos-=(iQueueClient->ChildTopLeft()+TPoint(15,15)); //Pointer is on the second window |
|
950 aEvent.SetHandle((TInt)iVisWins2); |
|
951 } |
|
952 else if (TRect(TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight)).Contains(aPos)) |
|
953 { |
|
954 aPos-=TPoint(EWinPositionX,EWinPositionY); //Pointer is on the parent window |
|
955 aEvent.SetHandle((TInt)iQueueClient->iWin); |
|
956 } |
|
957 else |
|
958 { |
|
959 aEvent.SetHandle((TInt)0); //Pointer is not in the same window group |
|
960 } |
|
961 } |
|
962 ptrEvent.iType=aType; |
|
963 ptrEvent.iModifiers=0; |
|
964 if(aHandle!=0 && aHandle!=aEvent.Handle()) |
|
965 { |
|
966 aEvent.SetHandle(aHandle); |
|
967 ptrEvent.iPosition=ptrEvent.iParentPosition-(iQueueClient->ChildTopLeft()+TPoint(15,15)); |
|
968 } |
|
969 else |
|
970 { |
|
971 ptrEvent.iPosition=aPos; |
|
972 } |
|
973 } |
|
974 |
|
975 void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aHandle) |
|
976 { |
|
977 TPckgBuf<TWsQTEvent> evtPkg; |
|
978 CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aHandle); |
|
979 iQueueClient->AddExpectedEvent(evtPkg()); |
|
980 } |
|
981 |
|
982 void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos) |
|
983 { |
|
984 TPckgBuf<TWsQTEvent> evtPkg; |
|
985 CalculatePointerEvent(evtPkg(),aType,aPos); |
|
986 iQueueClient->AddExpectedEvent(evtPkg()); |
|
987 if (iAddToClick) |
|
988 { |
|
989 evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY); |
|
990 iClick.CommandReply(EClickEventAdd,evtPkg); |
|
991 } |
|
992 } |
|
993 |
|
994 void CTEventTest::AddExpectedPointerClick(TPointerEvent::TType aType, TPoint aPos) |
|
995 { |
|
996 TPckgBuf<TWsQTEvent> evtPkg; |
|
997 CalculatePointerEvent(evtPkg(),aType,aPos); |
|
998 evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY); |
|
999 iClick.CommandReply(EClickEventAdd,evtPkg); |
|
1000 } |
|
1001 |
|
1002 void CTEventTest::AddExpectedPointerDownUp(TPoint aPos) |
|
1003 { |
|
1004 AddExpectedPointer(TPointerEvent::EButton1Down,aPos); |
|
1005 AddExpectedPointer(TPointerEvent::EButton1Up,aPos); |
|
1006 } |
|
1007 |
|
1008 void CTEventTest::AddExpectedPointerScr(TPointerEvent::TType aType, TPoint aPos) |
|
1009 { |
|
1010 AddExpectedPointer(aType,TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY)); |
|
1011 } |
|
1012 |
|
1013 void CTEventTest::AddExpectedPointerDownUpScr(TPoint aPos) |
|
1014 { |
|
1015 AddExpectedPointerDownUp(TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY)); |
|
1016 } |
|
1017 |
|
1018 void CTEventTest::AddExpectedModifiersChanged(TInt aChangedModifiers, TInt aModifiers) |
|
1019 { |
|
1020 TWsQTEvent event; |
|
1021 event.iType=EEventModifiersChanged; |
|
1022 event.iHandle=(TInt)iQueueClient->iGroup; |
|
1023 event.ModifiersChanged()->iChangedModifiers=aChangedModifiers; |
|
1024 event.ModifiersChanged()->iModifiers=aModifiers; |
|
1025 iQueueClient->AddExpectedEvent(event); |
|
1026 } |
|
1027 |
|
1028 void CTEventTest::AddExpectedEnterExit(TInt aEventCode, TPoint aPos) |
|
1029 { |
|
1030 AddExpectedEvent(aEventCode,iQueueClient->GetHandle(aPos)); |
|
1031 } |
|
1032 |
|
1033 void CTEventTest::AddExpectedKeyAnim(TRawEvent::TType aEventCode, TInt aScanCode, TBool aEat) |
|
1034 { |
|
1035 TAnimRawEvent event; |
|
1036 event.iRawEvent.Set(aEventCode,aScanCode); |
|
1037 event.iEat=aEat; |
|
1038 TInt retVal = iAnim->AddEvent(event); |
|
1039 TEST(retVal==KErrNone); |
|
1040 if (retVal!=KErrNone) |
|
1041 INFO_PRINTF3(_L("iAnim->AddEvent(event) return value - Expected: %d, Actual: %d"), KErrNone, retVal); |
|
1042 |
|
1043 if (!aEat) |
|
1044 AddExpectedKey((aEventCode==TRawEvent::EKeyDown ? EEventKeyDown:EEventKeyUp),aScanCode); |
|
1045 } |
|
1046 |
|
1047 void CTEventTest::AddExpectedPointerAnim(TRawEvent::TType aEventCode, TPoint aPoint, TBool aEat/*=ETrue*/) |
|
1048 { |
|
1049 TAnimRawEvent event; |
|
1050 event.iRawEvent.Set(aEventCode,aPoint.iX,aPoint.iY); |
|
1051 event.iEat=aEat; |
|
1052 |
|
1053 TInt retVal = iAnim->AddEvent(event); |
|
1054 TEST(retVal==KErrNone); |
|
1055 if (retVal!=KErrNone) |
|
1056 INFO_PRINTF3(_L("iAnim->AddEvent(event) return value - Expected: %d, Actual: %d"), KErrNone, retVal); |
|
1057 |
|
1058 if (!aEat) |
|
1059 AddExpectedPointer((aEventCode==TRawEvent::EButton1Down ? TPointerEvent::EButton1Down:TPointerEvent::EButton1Up) |
|
1060 ,aPoint-TPoint(EWinPositionX,EWinPositionY)); |
|
1061 } |
|
1062 |
|
1063 void CTEventTest::AddExpectedVisibilityChange(TUint aFlags) |
|
1064 { |
|
1065 TWsQTEvent event; |
|
1066 event.iType=EEventWindowVisibilityChanged; |
|
1067 event.iHandle=(TInt)iVisWins1; |
|
1068 event.VisibilityChanged()->iFlags=aFlags; |
|
1069 iQueueClient->AddExpectedEvent(event); |
|
1070 } |
|
1071 |
|
1072 void CTEventTest::AddExpectedVisibilityChange(TUint aFlags, CTBlankWindow* aWindow) |
|
1073 { |
|
1074 TWsQTEvent event; |
|
1075 event.iType=EEventWindowVisibilityChanged; |
|
1076 event.iHandle=(TInt)aWindow; |
|
1077 event.VisibilityChanged()->iFlags=aFlags; |
|
1078 iQueueClient->AddExpectedEvent(event); |
|
1079 } |
|
1080 |
|
1081 void CTEventTest::SimulatePointerWin(TRawEvent::TType aType, TInt aX, TInt aY) |
|
1082 { |
|
1083 SimulatePointer(aType,EWinPositionX+aX,EWinPositionY+aY+iYOffset); |
|
1084 } |
|
1085 |
|
1086 void CTEventTest::SimulatePointerDownUpWin(TInt aX, TInt aY) |
|
1087 { |
|
1088 iTest->SimulatePointerDownUp(EWinPositionX+aX,EWinPositionY+aY+iYOffset); |
|
1089 } |
|
1090 |
|
1091 void CTEventTest::SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY) |
|
1092 { |
|
1093 iTest->SimulatePointer(aType,aX,aY+iYOffset); |
|
1094 } |
|
1095 |
|
1096 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
1097 void CTEventTest::SimulateButton1DownWithSimulatedMove(TInt aX, TInt aY) |
|
1098 { |
|
1099 if(iIs3DPointer) |
|
1100 { |
|
1101 // With advanced pointer events we can have an XYInputType of Pointer coupled with 3DPointer |
|
1102 // which now makes MovesAvailable return ETrue rahter than EFalse, which in turn stops the simulated |
|
1103 // Emove from being generated. |
|
1104 // So... |
|
1105 // If MovesAvailable() returns ETrue, then this move will be used, and the WServ simulated move wont be generated |
|
1106 // If MovesAvailable() returns EFalse, then this move will be filtered out, and the WServ simulated move will be generated |
|
1107 SimulatePointer(TRawEvent::EPointerMove,aX,aY); |
|
1108 } |
|
1109 // then the original button down event |
|
1110 SimulatePointer(TRawEvent::EButton1Down,aX,aY); |
|
1111 } |
|
1112 #endif |
|
1113 |
|
1114 void CTEventTest::NextSetOfEventsL() |
|
1115 { |
|
1116 iQueueClient->ResetCount(iEventSet); |
|
1117 switch (iTest->iState) |
|
1118 { |
|
1119 case 1: |
|
1120 QueuePurge_NextSetOfEventsL(); |
|
1121 break; |
|
1122 case 2: |
|
1123 SendEventTest_NextSetOfEvents(); |
|
1124 break; |
|
1125 case 4: |
|
1126 InvisibleWindow_NextSetOfEvents(); |
|
1127 break; |
|
1128 case 5: |
|
1129 JavaAdditions_NextSetOfEvents(); |
|
1130 break; |
|
1131 case 6: |
|
1132 WinCap_NextSetOfEvents(); |
|
1133 break; |
|
1134 case 7: |
|
1135 XyInputType_NextSetOfEvents(); |
|
1136 break; |
|
1137 case 8: |
|
1138 MovingPointerCursor_NextSetOfEventsL(); |
|
1139 break; |
|
1140 case 9: |
|
1141 RotatedMode_NextSetOfEventsL(); |
|
1142 break; |
|
1143 case 10: |
|
1144 AnimEvent_NextSetOfEventsL(); |
|
1145 break; |
|
1146 case 11: |
|
1147 FocusChanged_NextSetOfEventsL(); |
|
1148 break; |
|
1149 case 12: |
|
1150 StopEvents_NextSetOfEventsL(); |
|
1151 break; |
|
1152 case 13: |
|
1153 VirtualKeyboard_NextSetOfEventsL(); |
|
1154 break; |
|
1155 case 14: |
|
1156 KeyClicks_NextSetOfEvents(); |
|
1157 break; |
|
1158 case 15: |
|
1159 CaptureLong_NextSetOfEventsL(); |
|
1160 break; |
|
1161 case 16: |
|
1162 Password_NextSetOfEvents(); |
|
1163 break; |
|
1164 case 17: |
|
1165 GroupListChanged_NextSetOfEventsL(); |
|
1166 break; |
|
1167 case 18: |
|
1168 RepeatableKeysL(); |
|
1169 break; |
|
1170 case 19: |
|
1171 ScreenScaling_NextSetOfEventsL(); |
|
1172 break; |
|
1173 case 20: |
|
1174 VisibilityChanged_NextSetOfEventsL(); |
|
1175 break; |
|
1176 case 21: |
|
1177 CheckTimeStamp_NextSetOfEventsL(); |
|
1178 break; |
|
1179 case 22: |
|
1180 PointerCapture_NextSetOfEventsL(); |
|
1181 break; |
|
1182 case 23: |
|
1183 EventHandlerRemoval_NextSetOfEventsL(); |
|
1184 break; |
|
1185 // Note that case 24 (which is KTest24) does not use NextSetOfEventsL() |
|
1186 case 25: |
|
1187 MismatchedCapture_NextSetOfEventsL(); |
|
1188 break; |
|
1189 case 26: |
|
1190 PointerBufferPurge_NextSetOfEventsL(); |
|
1191 break; |
|
1192 case 27: |
|
1193 RawEventRepeatTest_NextSetOfEventsL(); |
|
1194 break; |
|
1195 |
|
1196 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
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: |
|
1211 SurfaceVisibilityChanged1_NextSetOfEventsL(); |
|
1212 break; |
|
1213 case 33: |
|
1214 SurfaceVisibilityChanged2_NextSetOfEventsL(); |
|
1215 break; |
|
1216 case 34: |
|
1217 SurfaceVisibilityChanged3_NextSetOfEventsL(); |
|
1218 break; |
|
1219 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
1220 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
1221 |
|
1222 default: |
|
1223 AutoPanic(EAutoPanicWrongTest); |
|
1224 } |
|
1225 } |
|
1226 |
|
1227 void CTEventTest::TriggerOomMessage(TTimeIntervalMinutes aPeriod) |
|
1228 { |
|
1229 TTime time; |
|
1230 if (aPeriod.Int()!=0) // adjust time to affect Oom message triggering |
|
1231 { |
|
1232 time.HomeTime(); |
|
1233 User::SetHomeTime(time+aPeriod); |
|
1234 } |
|
1235 RBlankWindow win(TheClient->iWs); |
|
1236 win.Construct(*(TheClient->iGroup->WinTreeNode()),1); |
|
1237 win.SetColor(TRgb::Gray4(1)); |
|
1238 win.SetExtent(TPoint(10,10),TheClient->iGroup->Size()-TSize(20,20)); |
|
1239 TheClient->iWs.HeapSetFail(RHeap::EDeterministic,1); |
|
1240 win.Activate(); |
|
1241 TheClient->iWs.Flush(); |
|
1242 TheClient->iWs.HeapSetFail(RHeap::ENone,0); |
|
1243 if (aPeriod.Int()!=0) |
|
1244 { |
|
1245 time.HomeTime(); |
|
1246 User::SetHomeTime(time-aPeriod); |
|
1247 } |
|
1248 win.Close(); |
|
1249 } |
|
1250 |
|
1251 TBool CTEventTest::SetClickType(TClickOutputModes aType) |
|
1252 { |
|
1253 TPckgBuf<TInt> intPkg; |
|
1254 intPkg()=aType; |
|
1255 TInt err=iClick.CommandReply(EClickCommandSetOutput,intPkg); |
|
1256 if (err!=KErrNone) |
|
1257 Failed(); |
|
1258 return err; |
|
1259 } |
|
1260 |
|
1261 void CTEventTest::CreateEventTestGroup() |
|
1262 { |
|
1263 iEventTestGroup=RWindowGroup(TheClient->iWs); |
|
1264 iEventTestGroup.Construct(123, EFalse); |
|
1265 iEventTestGroup.SetName(_L("Fred")); |
|
1266 } |
|
1267 |
|
1268 void CTQueueClient::CreateEventTestGroupOnSecondScreenL() |
|
1269 { |
|
1270 const TInt KSndScreenNo=1; |
|
1271 iSndScreen=new(ELeave) CWsScreenDevice(iWs); |
|
1272 User::LeaveIfError(iSndScreen->Construct(KSndScreenNo)); |
|
1273 iWinGp1 = new(ELeave) RWindowGroup(iWs); |
|
1274 User::LeaveIfError(iWinGp1->Construct((TUint32)iWinGp1,ETrue,iSndScreen)); |
|
1275 iWinGp2 = new (ELeave) RWindowGroup(iWs); |
|
1276 User::LeaveIfError(iWinGp2->Construct((TUint32)iWinGp2,ETrue,iSndScreen)); |
|
1277 } |
|
1278 |
|
1279 void CTQueueClient::CloseEventTestGroupOnSecondScreen() |
|
1280 { |
|
1281 if(iWinGp1) |
|
1282 { |
|
1283 iWinGp1->Close(); |
|
1284 delete iWinGp1; |
|
1285 iWinGp1=NULL; |
|
1286 } |
|
1287 if(iWinGp2) |
|
1288 { |
|
1289 iWinGp2->Close(); |
|
1290 delete iWinGp2; |
|
1291 iWinGp2=NULL; |
|
1292 } |
|
1293 if(iSndScreen) |
|
1294 { |
|
1295 delete iSndScreen; |
|
1296 iSndScreen = NULL; |
|
1297 } |
|
1298 } |
|
1299 |
|
1300 void CTEventTest::CloseEventTestGroup() |
|
1301 { |
|
1302 iEventTestGroup.Close(); |
|
1303 } |
|
1304 |
|
1305 void CTEventTest::CreateAndCloseEventTestGroup() |
|
1306 // |
|
1307 // Create and close a window group to test sending of group changed messages |
|
1308 // |
|
1309 { |
|
1310 CreateEventTestGroup(); |
|
1311 CloseEventTestGroup(); |
|
1312 } |
|
1313 |
|
1314 void CTEventTest::QueuePurge_NextSetOfEventsL() |
|
1315 { |
|
1316 #if defined(LOGGING) |
|
1317 TLogMessageText logMessageText; |
|
1318 _LIT(KSet,"QueuePurge SetOfEvents: %d of 11"); |
|
1319 logMessageText.Format(KSet,iEventSet); |
|
1320 TheClient->LogMessage(logMessageText); |
|
1321 #endif |
|
1322 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); |
|
1323 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); |
|
1324 switch(iEventSet++) |
|
1325 { |
|
1326 case 0: |
|
1327 iTest->SimulateKey(TRawEvent::EKeyDown,32); |
|
1328 iTest->SimulateKey(TRawEvent::EKeyUp,32); |
|
1329 CreateAndCloseEventTestGroup(); |
|
1330 SimulatePointer(TRawEvent::EButton1Down,10,20); |
|
1331 SimulatePointer(TRawEvent::EButton1Up,20,30); |
|
1332 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1333 CreateAndCloseEventTestGroup(); |
|
1334 // |
|
1335 AddExpectedEvent(EEventFocusGained); |
|
1336 AddExpectedKey(EEventKeyDown,32); |
|
1337 AddExpectedKey(EEventKeyUp,32); |
|
1338 AddExpectedEvent(EEventWindowGroupsChanged); |
|
1339 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,20-EWinPositionY)); |
|
1340 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,30-EWinPositionY)); |
|
1341 AddExpectedEvent(EEventSwitchOn); |
|
1342 break; |
|
1343 case 1: |
|
1344 { |
|
1345 for(TInt count=0;count<100;count++) |
|
1346 { |
|
1347 iTest->SimulateKey(TRawEvent::EKeyDown,'A'+(count%26)); |
|
1348 iTest->SimulateKey(TRawEvent::EKeyUp,'A'+(count%26)); |
|
1349 } |
|
1350 for(TInt count2=0;count2<EMaxEventQueueSize/3;count2++) |
|
1351 { |
|
1352 AddExpectedKey(EEventKeyDown,'A'+(count2%26)); |
|
1353 AddExpectedKey(EEventKey,'A'+(count2%26),'a'+(count2%26)); |
|
1354 AddExpectedKey(EEventKeyUp,'A'+(count2%26)); |
|
1355 } |
|
1356 AddExpectedKey(EEventKeyDown,'A'+(99%26)); |
|
1357 AddExpectedKey(EEventKeyUp,'A'+(99%26)); |
|
1358 } |
|
1359 break; |
|
1360 case 2: |
|
1361 { |
|
1362 User::LeaveIfError(iQueueClient->iGroup->GroupWin()->EnableModifierChangedEvents(0xFFFFFFFF, EEventControlOnlyWhenVisible)); |
|
1363 for(TInt count=0;count<20;count++) |
|
1364 { |
|
1365 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1366 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1367 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift); |
|
1368 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift); |
|
1369 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift); |
|
1370 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1371 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift); |
|
1372 } |
|
1373 for(TInt count2=0;count2<60;count2++) |
|
1374 iTest->SimulateKey(TRawEvent::EKeyDown,'A'); |
|
1375 AddExpectedEvent(EEventSwitchOn); |
|
1376 AddExpectedModifiersChanged(EModifierLeftShift|EModifierRightShift|EModifierShift,0); |
|
1377 for(TInt count3=0;count3<EMaxEventQueueSize-2;count3++) |
|
1378 AddExpectedKey(EEventKeyDown,'A'); |
|
1379 iQueueClient->iGroup->GroupWin()->DisableModifierChangedEvents(); |
|
1380 } |
|
1381 break; |
|
1382 case 3: |
|
1383 { |
|
1384 SimulatePointer(TRawEvent::EButton1Up,10,20); |
|
1385 SimulatePointer(TRawEvent::EButton2Up,11,22); |
|
1386 SimulatePointer(TRawEvent::EButton1Down,12,23); |
|
1387 SimulatePointer(TRawEvent::EPointerMove,13,24); |
|
1388 SimulatePointer(TRawEvent::EButton3Down,15,25); |
|
1389 SimulatePointer(TRawEvent::EButton1Up,14,24); |
|
1390 for(TInt count2=0;count2<60;count2++) |
|
1391 iTest->SimulateKey(TRawEvent::EKeyDown,'A'); |
|
1392 SimulatePointer(TRawEvent::EButton3Up,15,25); // Should get stripped by unmatched purged down handling code |
|
1393 iTest->SimulateKey(TRawEvent::EKeyUp,'A'); // To stop repeats |
|
1394 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY)); |
|
1395 AddExpectedPointer(TPointerEvent::EButton2Up, TPoint(11-EWinPositionX,22-EWinPositionY)); |
|
1396 for(TInt count3=0;count3<EMaxEventQueueSize-2;count3++) |
|
1397 AddExpectedKey(EEventKeyDown,'A'); |
|
1398 } |
|
1399 break; |
|
1400 case 4: |
|
1401 { |
|
1402 SimulatePointer(TRawEvent::EButton1Up,10,20); |
|
1403 SimulatePointer(TRawEvent::EButton2Up,11,22); |
|
1404 iTest->SimulateKey(TRawEvent::EKeyDown,'B'); |
|
1405 SimulatePointer(TRawEvent::EButton1Down,12,23); |
|
1406 SimulatePointer(TRawEvent::EPointerMove,13,24); |
|
1407 iTest->SimulateKey(TRawEvent::EKeyUp,'B'); |
|
1408 SimulatePointer(TRawEvent::EButton3Down,15,25); |
|
1409 SimulatePointer(TRawEvent::EButton1Up,14,24); |
|
1410 iQueueClient->iWs.PurgePointerEvents(); |
|
1411 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1412 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY)); |
|
1413 AddExpectedPointer(TPointerEvent::EButton2Up, TPoint(11-EWinPositionX,22-EWinPositionY)); |
|
1414 AddExpectedKey(EEventKeyDown,'B'); |
|
1415 AddExpectedKey(EEventKey,'B','b'); |
|
1416 AddExpectedKey(EEventKeyUp,'B'); |
|
1417 // AddExpectedPointer(TPointerEvent::EButton3Down, TPoint(15-EWinPositionX,25-EWinPositionY)); |
|
1418 AddExpectedEvent(EEventSwitchOn); // To check pointer events purged okay |
|
1419 } |
|
1420 break; |
|
1421 case 5: |
|
1422 CreateEventTestGroup(); |
|
1423 AddExpectedEvent(EEventWindowGroupsChanged); |
|
1424 break; |
|
1425 case 6: |
|
1426 CloseEventTestGroup(); |
|
1427 AddExpectedEvent(EEventWindowGroupsChanged); |
|
1428 break; |
|
1429 case 7: |
|
1430 iQueueClient->iGroup->GroupWin()->DisableGroupChangeEvents(); |
|
1431 CreateAndCloseEventTestGroup(); |
|
1432 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1433 AddExpectedEvent(EEventSwitchOn); |
|
1434 break; |
|
1435 case 8: |
|
1436 SimulatePointer(TRawEvent::EButton1Down,12,23); |
|
1437 iQueueClient->iWs.PurgePointerEvents(); |
|
1438 SimulatePointer(TRawEvent::EButton1Up,13,24); |
|
1439 SimulatePointer(TRawEvent::EButton2Down,12,23); |
|
1440 iQueueClient->iWs.PurgePointerEvents(); |
|
1441 SimulatePointer(TRawEvent::EButton2Up,13,24); |
|
1442 SimulatePointer(TRawEvent::EButton3Down,12,23); |
|
1443 iQueueClient->iWs.PurgePointerEvents(); |
|
1444 SimulatePointer(TRawEvent::EButton3Up,13,24); |
|
1445 // |
|
1446 SendEvent(EEventUser); |
|
1447 AddExpectedEvent(EEventUser); |
|
1448 break; |
|
1449 case 9: |
|
1450 { |
|
1451 for(TInt count5=0;count5<500;count5++) |
|
1452 { |
|
1453 RWindowGroup group(TheClient->iWs); |
|
1454 group.Construct(ENullWsHandle); |
|
1455 group.EnableReceiptOfFocus(EFalse); |
|
1456 group.Close(); |
|
1457 SimulatePointer(TRawEvent::EButton1Up,10,20); |
|
1458 } |
|
1459 for(TInt count4=0;count4<EMaxEventQueueSize;count4++) |
|
1460 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY)); |
|
1461 } |
|
1462 break; |
|
1463 case 10: |
|
1464 { |
|
1465 RWindowGroup *group=iQueueClient->iGroup->GroupWin(); |
|
1466 User::LeaveIfError(group->EnableOnEvents(EEventControlOnlyWithKeyboardFocus)); |
|
1467 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1468 SimulatePointer(TRawEvent::EButton3Down,EWinPositionX,EWinPositionY); |
|
1469 AddExpectedEvent(EEventSwitchOn); |
|
1470 AddExpectedPointer(TPointerEvent::EButton3Down, TPoint(0,0)); |
|
1471 // |
|
1472 group->SetOrdinalPosition(-1); |
|
1473 TheClient->iWs.Finish(); |
|
1474 iTest->SimulateEvent(TRawEvent::ESwitchOn); // Shouldn't get it as in background this time |
|
1475 AddExpectedEvent(EEventFocusLost); |
|
1476 group->SetOrdinalPosition(0); |
|
1477 TheClient->iWs.Finish(); |
|
1478 AddExpectedEvent(EEventFocusGained); |
|
1479 // |
|
1480 User::LeaveIfError(group->EnableOnEvents(EEventControlOnlyWhenVisible)); |
|
1481 User::LeaveIfError(group->EnableModifierChangedEvents(EModifierShift, EEventControlOnlyWhenVisible)); |
|
1482 iTest->SimulateEvent(TRawEvent::ESwitchOn); // Should get this as window still visible |
|
1483 AddExpectedEvent(EEventSwitchOn); |
|
1484 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift); // Should get modifier changed event as window still visible |
|
1485 AddExpectedModifiersChanged(EModifierShift,EModifierShift); |
|
1486 AddExpectedKey(EEventKeyDown,EStdKeyLeftShift); |
|
1487 SimulatePointer(TRawEvent::EButton1Down,EWinPositionX,EWinPositionY); |
|
1488 SimulatePointer(TRawEvent::EButton1Up,EWinPositionX,EWinPositionY); |
|
1489 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(0,0)); |
|
1490 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(0,0)); |
|
1491 iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight)); |
|
1492 TheClient->iWs.Finish(); |
|
1493 // The following two events shouldn't cause an on or mod changed event as the window is now hidden |
|
1494 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
1495 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift); |
|
1496 AddExpectedKey(EEventKeyUp,EStdKeyLeftShift); |
|
1497 // |
|
1498 iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY)); |
|
1499 TheClient->iWs.Finish(); |
|
1500 } |
|
1501 break; |
|
1502 case 11: |
|
1503 { |
|
1504 RWindowGroup *group=iQueueClient->iGroup->GroupWin(); |
|
1505 SendEvent(EEventUser); |
|
1506 AddExpectedEvent(EEventUser); |
|
1507 |
|
1508 if(iTest->IsFullRomL()) |
|
1509 break; |
|
1510 // |
|
1511 // Test focus only messages when with and without focus |
|
1512 // |
|
1513 User::LeaveIfError(group->EnableErrorMessages(EEventControlOnlyWithKeyboardFocus)); |
|
1514 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1515 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1516 SendEvent(EEventUser); |
|
1517 AddExpectedEvent(EEventUser); |
|
1518 group->SetOrdinalPosition(1); |
|
1519 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1520 AddExpectedEvent(EEventFocusLost); |
|
1521 group->SetOrdinalPosition(0); |
|
1522 AddExpectedEvent(EEventFocusGained); |
|
1523 SendEvent(EEventUser+1); |
|
1524 AddExpectedEvent(EEventUser+1); |
|
1525 // |
|
1526 // Test focus only messages when with visible and invisible |
|
1527 // |
|
1528 User::LeaveIfError(group->EnableErrorMessages(EEventControlOnlyWhenVisible)); |
|
1529 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1530 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1531 iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight)); |
|
1532 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1533 SendEvent(EEventUser+2); |
|
1534 AddExpectedEvent(EEventUser+2); |
|
1535 iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY)); |
|
1536 // |
|
1537 // Check always mode sends an event |
|
1538 // |
|
1539 User::LeaveIfError(group->EnableErrorMessages(EEventControlAlways)); |
|
1540 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1541 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1542 // |
|
1543 iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight)); |
|
1544 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1545 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1546 iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY)); |
|
1547 // |
|
1548 group->SetOrdinalPosition(1); |
|
1549 AddExpectedEvent(EEventFocusLost); |
|
1550 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1551 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1552 group->SetOrdinalPosition(0); |
|
1553 AddExpectedEvent(EEventFocusGained); |
|
1554 // |
|
1555 // Check timing of OOM messages |
|
1556 // |
|
1557 TriggerOomMessage(TTimeIntervalMinutes(3)); |
|
1558 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1559 TriggerOomMessage(TTimeIntervalMinutes(0)); |
|
1560 User::After(TTimeIntervalMicroSeconds32(1100000)); // 1.1 second |
|
1561 TriggerOomMessage(TTimeIntervalMinutes(0)); |
|
1562 SendEvent(EEventUser+3); |
|
1563 AddExpectedEvent(EEventUser+3); |
|
1564 TriggerOomMessage(TTimeIntervalMinutes(3)); // Forward by a 2 minutes plus the 1.1 from previous test should trigger an OOM event |
|
1565 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1566 SendEvent(EEventUser+4); |
|
1567 AddExpectedEvent(EEventUser+4); |
|
1568 TriggerOomMessage(TTimeIntervalMinutes(-1)); // Clock going backwards should trigger an event |
|
1569 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); |
|
1570 User::After(TTimeIntervalMicroSeconds32(800000)); // 8/10ths of a second |
|
1571 TriggerOomMessage(TTimeIntervalMinutes(0)); // Shouldn't trigger an event |
|
1572 SendEvent(EEventUser+5); |
|
1573 AddExpectedEvent(EEventUser+5); |
|
1574 } |
|
1575 break; |
|
1576 default: |
|
1577 TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,ETrue); |
|
1578 TRAPD(err, EventQueueExpansionTestL()); |
|
1579 if (err!=KErrNone) |
|
1580 { |
|
1581 iFailed=ETrue; |
|
1582 } |
|
1583 TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,EFalse); |
|
1584 CActiveScheduler::Stop(); |
|
1585 break; |
|
1586 } |
|
1587 TheClient->iWs.SetAutoFlush(iTheClientFlush); |
|
1588 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); |
|
1589 } |
|
1590 |
|
1591 // Used for testing PDEF112243. |
|
1592 // Create RWsSession/RWindowGroup/RBlankWindow in a loop. In case of odd loop, |
|
1593 // close the session which causes the previous window to gain focus. Also go |
|
1594 // on adding events to the previous session. Along with some change in product |
|
1595 // code and this test code we get some space/memory before globaleventqueue, |
|
1596 // which is the problem faced by licensee for this defect. |
|
1597 void CTEventTest::EventQueueExpansionTestL() |
|
1598 { |
|
1599 const TInt numClients = 5; |
|
1600 TInt cliHanGrpWin = 777; |
|
1601 TInt cliHanBlkWin = 888; |
|
1602 TInt pushed=0; |
|
1603 RWsSession wsSession[numClients]; |
|
1604 RWindowGroup groupWin[numClients]; |
|
1605 RBlankWindow blankWin[numClients]; |
|
1606 |
|
1607 for (TInt i = 0; i < numClients; i++) |
|
1608 { |
|
1609 User::LeaveIfError(wsSession[i].Connect()); |
|
1610 CleanupClosePushL(wsSession[i]); |
|
1611 |
|
1612 groupWin[i] = RWindowGroup(wsSession[i]); |
|
1613 User::LeaveIfError(groupWin[i].Construct(cliHanGrpWin++)); |
|
1614 CleanupClosePushL(groupWin[i]); |
|
1615 groupWin[i].DefaultOwningWindow(); |
|
1616 |
|
1617 blankWin[i] = RBlankWindow(wsSession[i]); |
|
1618 User::LeaveIfError(blankWin[i].Construct(groupWin[i], cliHanBlkWin++)); |
|
1619 if (i%2 == 0) |
|
1620 { |
|
1621 CleanupClosePushL(blankWin[i]); |
|
1622 pushed++; |
|
1623 } |
|
1624 blankWin[i].Activate(); |
|
1625 |
|
1626 if (i%2 == 1) |
|
1627 { |
|
1628 CleanupStack::Pop(2, &wsSession[i]); |
|
1629 wsSession[i].Close(); |
|
1630 |
|
1631 TRawEvent rawEvent; |
|
1632 for (TInt count=0; count < 40; count++) |
|
1633 { |
|
1634 rawEvent.Set(TRawEvent::EKeyDown,'A'+(i%26)); |
|
1635 wsSession[i-1].SimulateRawEvent(rawEvent); |
|
1636 |
|
1637 rawEvent.Set(TRawEvent::EKeyUp,'A'+(i%26)); |
|
1638 wsSession[i-1].SimulateRawEvent(rawEvent); |
|
1639 } |
|
1640 } |
|
1641 } |
|
1642 CleanupStack::PopAndDestroy(pushed*3, &wsSession[0]); |
|
1643 } |
|
1644 |
|
1645 void CTEventTest::doSendEvent(TWsEvent &aEvent) |
|
1646 { |
|
1647 iQueueClient->iWs.SendEventToWindowGroup(iQueueClient->WindowGroupIdentifier(),aEvent); |
|
1648 } |
|
1649 |
|
1650 void CTEventTest::SendKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt iRepeats/*=0*/) |
|
1651 { |
|
1652 TWsEvent event; |
|
1653 if (aEventCode==EEventKey && aCode==0) |
|
1654 aCode=aScanCode; |
|
1655 event.SetType(aEventCode); |
|
1656 event.Key()->iCode=aCode; |
|
1657 event.Key()->iScanCode=aScanCode; |
|
1658 event.Key()->iModifiers=0; |
|
1659 event.Key()->iRepeats=iRepeats; |
|
1660 doSendEvent(event); |
|
1661 } |
|
1662 |
|
1663 void CTEventTest::SendEvent(TInt aEventCode) |
|
1664 { |
|
1665 TWsQTEvent event; |
|
1666 event.SetType(aEventCode); |
|
1667 doSendEvent(event); |
|
1668 } |
|
1669 |
|
1670 void CTEventTest::SimulateAndCheck(TPoint aOrigin,TSize aScale,TInt aXOffset,TInt aYOffset,TPointerEvent::TType aEventType,TRect aPointerCursorArea) |
|
1671 { |
|
1672 TPoint ptCheck=PhysicalToLogical(TPoint(aOrigin.iX+aXOffset,aOrigin.iY+aYOffset)-aOrigin,aScale); |
|
1673 if (ptCheck.iX < aPointerCursorArea.iTl.iX) |
|
1674 { |
|
1675 ptCheck.iX=aPointerCursorArea.iTl.iX; |
|
1676 } |
|
1677 else if (ptCheck.iX > aPointerCursorArea.iBr.iX) |
|
1678 { |
|
1679 ptCheck.iX=aPointerCursorArea.iBr.iX; |
|
1680 } |
|
1681 if (ptCheck.iY < aPointerCursorArea.iTl.iY) |
|
1682 { |
|
1683 ptCheck.iY=aPointerCursorArea.iTl.iY; |
|
1684 } |
|
1685 else if (ptCheck.iY > aPointerCursorArea.iBr.iY) |
|
1686 { |
|
1687 ptCheck.iY=aPointerCursorArea.iBr.iY; |
|
1688 } |
|
1689 AddExpectedPointer(aEventType,TPoint(ptCheck.iX-EWinPositionX,ptCheck.iY-EWinPositionY)); |
|
1690 } |
|
1691 |
|
1692 void CTEventTest::CheckPointerCursorInDifferentScreenMode(TSizeMode aMode,TPoint aOrigin) |
|
1693 { |
|
1694 aMode.iOrigin=aOrigin; |
|
1695 iQueueClient->iScreen->SetCurrentScreenModeAttributes(aMode); |
|
1696 iQueueClient->iScreen->SetAppScreenMode(iCurrentMode); //This makes the App pick up the new mode parameters |
|
1697 TheClient->iScreen->SetAppScreenMode(iCurrentMode); //Ditto |
|
1698 iQueueClient->iScreen->SetScreenMode(iCurrentMode); //This causes all the windows to be updated |
|
1699 |
|
1700 //.. Tests the general pointer cursor area setting and getting |
|
1701 RWsSession& ws=iQueueClient->iWs; |
|
1702 TRect rect=ws.PointerCursorArea(iCurrentMode); //ws.PointerCursorArea() by default gets first screen mode's pointer cursor area so use other overloaded function |
|
1703 TPoint origin=iQueueClient->iScreen->GetScreenModeOrigin(iCurrentMode); |
|
1704 TSize scale=iQueueClient->iScreen->GetScreenModeScale(iCurrentMode); |
|
1705 TSize fullScreenModeSize=iQueueClient->iScreen->SizeInPixels(); |
|
1706 TRect rect1(PhysicalToLogical(TPoint(),scale),PhysicalToLogical(fullScreenModeSize.AsPoint()-origin,scale)); |
|
1707 TRect rect2=rect1; |
|
1708 rect2.Shrink(20,20); |
|
1709 ws.SetPointerCursorArea(iCurrentMode,rect1); |
|
1710 TEST(ws.PointerCursorArea(iCurrentMode)==rect1); |
|
1711 ws.SetPointerCursorArea(iCurrentMode,rect2); |
|
1712 TEST(ws.PointerCursorArea(iCurrentMode)==rect2); |
|
1713 ws.SetPointerCursorArea(iCurrentMode,rect); |
|
1714 TEST(ws.PointerCursorArea(iCurrentMode)==rect); |
|
1715 |
|
1716 //.. Test events are restricted to correct pointer cursor area |
|
1717 TRect rectPointerCursorArea(10,10,51,51); |
|
1718 iQueueClient->iWs.SetPointerCursorArea(iCurrentMode,rectPointerCursorArea); |
|
1719 TPoint screenModeOrigin=iQueueClient->iScreen->GetDefaultScreenModeOrigin(); |
|
1720 |
|
1721 SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+5,screenModeOrigin.iY+5); |
|
1722 SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+25,screenModeOrigin.iY+25); |
|
1723 SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+50,screenModeOrigin.iY+50); |
|
1724 SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+75,screenModeOrigin.iY+75); |
|
1725 |
|
1726 SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+10,screenModeOrigin.iY+15); |
|
1727 SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+20,screenModeOrigin.iY+5); |
|
1728 SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+35,screenModeOrigin.iY+40); |
|
1729 SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+45,screenModeOrigin.iY+70); |
|
1730 |
|
1731 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,5,5,TPointerEvent::EButton1Down,rectPointerCursorArea); |
|
1732 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,25,25,TPointerEvent::EButton1Up,rectPointerCursorArea); |
|
1733 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,50,50,TPointerEvent::EButton1Down,rectPointerCursorArea); |
|
1734 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,75,75,TPointerEvent::EButton1Up,rectPointerCursorArea); |
|
1735 |
|
1736 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,10,15,TPointerEvent::EButton1Down,rectPointerCursorArea); |
|
1737 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,20,5,TPointerEvent::EButton1Up,rectPointerCursorArea); |
|
1738 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,35,40,TPointerEvent::EButton1Down,rectPointerCursorArea); |
|
1739 SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,45,70,TPointerEvent::EButton1Up,rectPointerCursorArea); |
|
1740 } |
|
1741 |
|
1742 void CTEventTest::SendEventTest_NextSetOfEvents() |
|
1743 { |
|
1744 TTimeIntervalMicroSeconds32 initialTime,time; |
|
1745 TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); |
|
1746 switch(iEventSet++) |
|
1747 { |
|
1748 case 0: |
|
1749 SendKey(EEventKeyDown,1); |
|
1750 SendKey(EEventKeyDown,2); |
|
1751 SendEvent(EEventUser); |
|
1752 SendKey(EEventKeyUp,1); |
|
1753 SendKey(EEventKeyUp,2); |
|
1754 SendEvent(EEventUser+1); |
|
1755 SendEvent(EEventUser+2); |
|
1756 // |
|
1757 AddExpectedEvent(EEventFocusGained); |
|
1758 AddExpectedKey(EEventKeyDown,1); |
|
1759 AddExpectedKey(EEventKeyDown,2); |
|
1760 AddExpectedEvent(EEventUser); |
|
1761 AddExpectedKey(EEventKeyUp,1); |
|
1762 AddExpectedKey(EEventKeyUp,2); |
|
1763 AddExpectedEvent(EEventUser+1); |
|
1764 AddExpectedEvent(EEventUser+2); |
|
1765 break; |
|
1766 case 1: |
|
1767 #if defined(SCREEN_MODE_TESTING) |
|
1768 if (iNumScrModes>1) |
|
1769 { |
|
1770 iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents(); |
|
1771 |
|
1772 if (SetClickType(EClickCheck)) |
|
1773 return; |
|
1774 iAddToClick=ETrue; |
|
1775 |
|
1776 iQueueClient->iScreen->SetScreenMode(1); |
|
1777 |
|
1778 iAddToClick=EFalse; |
|
1779 SetClickType(EClickNone); |
|
1780 |
|
1781 AddExpectedEvent(EEventScreenDeviceChanged); |
|
1782 SendEvent(EEventUser); |
|
1783 AddExpectedEvent(EEventUser); |
|
1784 iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents(); |
|
1785 if (iQueueClient->iScreen->ScreenModeEnforcement()==ESizeEnforcementPixelsAndRotation) |
|
1786 AddExpectedEvent(EEventFocusLost); |
|
1787 } |
|
1788 #endif |
|
1789 SendEvent(EEventUser+1); |
|
1790 AddExpectedEvent(EEventUser+1); |
|
1791 break; |
|
1792 case 2: |
|
1793 #if defined(SCREEN_MODE_TESTING) |
|
1794 if (iNumScrModes>1) |
|
1795 { |
|
1796 iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents(); |
|
1797 |
|
1798 if (SetClickType(EClickCheck)) |
|
1799 return; |
|
1800 iAddToClick=ETrue; |
|
1801 |
|
1802 iQueueClient->iScreen->SetScreenMode(0); |
|
1803 iQueueClient->iScreen->SetScreenMode(1); |
|
1804 iQueueClient->iScreen->SetScreenMode(0); |
|
1805 |
|
1806 iAddToClick=EFalse; |
|
1807 SetClickType(EClickNone); |
|
1808 |
|
1809 AddExpectedEvent(EEventScreenDeviceChanged); // Only one event should get queued |
|
1810 if (iQueueClient->iScreen->ScreenModeEnforcement()==ESizeEnforcementPixelsAndRotation) |
|
1811 AddExpectedEvent(EEventFocusGained); |
|
1812 SendEvent(EEventUser+2); |
|
1813 AddExpectedEvent(EEventUser+2); |
|
1814 iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents(); |
|
1815 } |
|
1816 #endif |
|
1817 SendEvent(EEventUser+3); |
|
1818 AddExpectedEvent(EEventUser+3); |
|
1819 break; |
|
1820 case 3: |
|
1821 #if defined(SCREEN_MODE_TESTING) |
|
1822 if (iNumScrModes>1) |
|
1823 { |
|
1824 iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents(); |
|
1825 iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents(); |
|
1826 |
|
1827 if (SetClickType(EClickCheck)) |
|
1828 return; |
|
1829 iAddToClick=ETrue; |
|
1830 |
|
1831 iQueueClient->iScreen->SetScreenMode(0); |
|
1832 |
|
1833 iAddToClick=EFalse; |
|
1834 SetClickType(EClickNone); |
|
1835 |
|
1836 SendEvent(EEventUser+1); |
|
1837 AddExpectedEvent(EEventUser+1); |
|
1838 } |
|
1839 #endif |
|
1840 SendEvent(EEventUser+4); |
|
1841 AddExpectedEvent(EEventUser+4); |
|
1842 break; |
|
1843 case 4: |
|
1844 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
1845 TheClient->iWs.Flush(); |
|
1846 User::After(initialTime.Int()+time.Int()/3); |
|
1847 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
1848 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
1849 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
1850 AddExpectedKey(EEventKey,EStdKeySpace,' ',1); |
|
1851 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
1852 break; |
|
1853 case 5: //To test sending a key event with iRepeats!=0 |
|
1854 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
1855 TheClient->iWs.Flush(); |
|
1856 User::After(initialTime.Int()+time.Int()/3); |
|
1857 SendKey(EEventKey,EStdKeyHome,EKeyHome,0); |
|
1858 User::After(initialTime.Int()+time.Int()/3); |
|
1859 SendKey(EEventKey,EStdKeyEnd,EKeyEnd,12345); |
|
1860 User::After(initialTime.Int()+time.Int()/3); |
|
1861 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
1862 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
1863 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
1864 AddExpectedKey(EEventKey,EStdKeySpace,' ',1); |
|
1865 AddExpectedKey(EEventKey,EStdKeyHome,EKeyHome); |
|
1866 AddExpectedKey(EEventKey,EStdKeySpace,' ',1); |
|
1867 AddExpectedKey(EEventKey,EStdKeyEnd,EKeyEnd,1); |
|
1868 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
1869 break; |
|
1870 default: |
|
1871 CActiveScheduler::Stop(); |
|
1872 break; |
|
1873 } |
|
1874 TheClient->iWs.Flush(); |
|
1875 } |
|
1876 |
|
1877 void CTEventTest::InvisibleWindow_NextSetOfEvents() |
|
1878 { |
|
1879 switch(iEventSet++) |
|
1880 { |
|
1881 case 0: |
|
1882 SimulatePointer(TRawEvent::EButton1Down,45,30); |
|
1883 SimulatePointer(TRawEvent::EButton1Up,45,30); |
|
1884 SimulatePointer(TRawEvent::EButton1Down,20,10); |
|
1885 SimulatePointer(TRawEvent::EButton1Up,20,10); |
|
1886 TheClient->iWs.Flush(); |
|
1887 iQueueClient->iChildWin->BaseWin()->SetVisible(EFalse); |
|
1888 iQueueClient->iChildWin->BaseWin()->SetVisible(ETrue); |
|
1889 iQueueClient->iWs.Flush(); |
|
1890 SimulatePointer(TRawEvent::EButton1Down,46,31); |
|
1891 SimulatePointer(TRawEvent::EButton1Up,46,31); |
|
1892 AddExpectedEvent(EEventFocusGained); |
|
1893 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,10-EWinPositionY)); |
|
1894 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,10-EWinPositionY)); |
|
1895 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
1896 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
1897 break; |
|
1898 case 1: |
|
1899 SimulatePointer(TRawEvent::EButton1Down,21,11); |
|
1900 SimulatePointer(TRawEvent::EButton1Up,21,11); |
|
1901 SimulatePointer(TRawEvent::EButton1Down,44,30); |
|
1902 SimulatePointer(TRawEvent::EButton1Up,44,30); |
|
1903 TheClient->iWs.Flush(); |
|
1904 iQueueClient->iWin->BaseWin()->SetVisible(EFalse); |
|
1905 iQueueClient->iWin->BaseWin()->SetVisible(ETrue); |
|
1906 iQueueClient->iWs.Flush(); |
|
1907 SimulatePointer(TRawEvent::EButton1Down,19,12); |
|
1908 SimulatePointer(TRawEvent::EButton1Up,19,12); |
|
1909 SimulatePointer(TRawEvent::EButton1Down,47,32); |
|
1910 SimulatePointer(TRawEvent::EButton1Up,47,32); |
|
1911 /*AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(44-EWinPositionX,30-EWinPositionY)); |
|
1912 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(44-EWinPositionX,30-EWinPositionY));*/ |
|
1913 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(19-EWinPositionX,12-EWinPositionY)); |
|
1914 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(19-EWinPositionX,12-EWinPositionY)); |
|
1915 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(47-EWinPositionX,32-EWinPositionY)); |
|
1916 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY)); |
|
1917 break; |
|
1918 default: |
|
1919 CActiveScheduler::Stop(); |
|
1920 break; |
|
1921 } |
|
1922 TheClient->iWs.Flush(); |
|
1923 } |
|
1924 |
|
1925 #define TOP16A 0xAAAA0000 |
|
1926 #define TOP16B 0x55550000 |
|
1927 void CTEventTest::JavaAdditions_NextSetOfEvents() |
|
1928 { |
|
1929 switch(iEventSet++) |
|
1930 { |
|
1931 case 0: |
|
1932 SimulatePointer(TRawEvent::EButton1Down,45,30); |
|
1933 SimulatePointer(TRawEvent::EButton1Up,45,30); |
|
1934 TheClient->iWs.Flush(); |
|
1935 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove); |
|
1936 iQueueClient->iWs.Flush(); |
|
1937 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
1938 SimulateButton1DownWithSimulatedMove(46,31); |
|
1939 #else |
|
1940 SimulatePointer(TRawEvent::EButton1Down,46,31); |
|
1941 #endif |
|
1942 SimulatePointer(TRawEvent::EButton1Up,46,31); |
|
1943 TheClient->iWs.Flush(); |
|
1944 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,0); |
|
1945 iQueueClient->iWs.Flush(); |
|
1946 SimulatePointer(TRawEvent::EButton1Down,20,10); |
|
1947 SimulatePointer(TRawEvent::EButton1Up,20,10); |
|
1948 TheClient->iWs.Flush(); |
|
1949 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove); |
|
1950 iQueueClient->iWs.Flush(); |
|
1951 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
1952 SimulateButton1DownWithSimulatedMove(21,11); |
|
1953 #else |
|
1954 SimulatePointer(TRawEvent::EButton1Down,21,11); |
|
1955 #endif |
|
1956 SimulatePointer(TRawEvent::EButton1Up,21,11); |
|
1957 TheClient->iWs.Flush(); |
|
1958 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerMoveEvents); |
|
1959 iQueueClient->iWs.Flush(); |
|
1960 SimulatePointer(TRawEvent::EButton1Down,22,12); |
|
1961 SimulatePointer(TRawEvent::EButton1Up,22,12); |
|
1962 TheClient->iWs.Flush(); |
|
1963 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove); |
|
1964 iQueueClient->iWs.Flush(); |
|
1965 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
1966 SimulateButton1DownWithSimulatedMove(23,13); |
|
1967 #else |
|
1968 SimulatePointer(TRawEvent::EButton1Down,23,13); |
|
1969 #endif |
|
1970 SimulatePointer(TRawEvent::EButton1Up,23,13); |
|
1971 TheClient->iWs.Flush(); |
|
1972 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerFilterMove); |
|
1973 iQueueClient->iWs.Flush(); |
|
1974 SimulatePointer(TRawEvent::EButton1Down,24,14); |
|
1975 SimulatePointer(TRawEvent::EButton1Up,24,14); |
|
1976 AddExpectedEvent(EEventFocusGained); |
|
1977 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(45-EWinPositionX,30-EWinPositionY)); |
|
1978 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(45-EWinPositionX,30-EWinPositionY)); |
|
1979 AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
1980 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
1981 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
1982 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,10-EWinPositionY)); |
|
1983 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,10-EWinPositionY)); |
|
1984 AddExpectedPointer(TPointerEvent::EMove, TPoint(21-EWinPositionX,11-EWinPositionY)); |
|
1985 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(21-EWinPositionX,11-EWinPositionY)); |
|
1986 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(21-EWinPositionX,11-EWinPositionY)); |
|
1987 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(22-EWinPositionX,12-EWinPositionY)); |
|
1988 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(22-EWinPositionX,12-EWinPositionY)); |
|
1989 AddExpectedPointer(TPointerEvent::EMove, TPoint(23-EWinPositionX,13-EWinPositionY)); |
|
1990 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(23-EWinPositionX,13-EWinPositionY)); |
|
1991 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(23-EWinPositionX,13-EWinPositionY)); |
|
1992 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,14-EWinPositionY)); |
|
1993 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,14-EWinPositionY)); |
|
1994 break; |
|
1995 #if defined(__WINS__) |
|
1996 case 1: |
|
1997 { |
|
1998 RWindowGroup *group=iQueueClient->iGroup->GroupWin(); |
|
1999 group->SetOrdinalPosition(0); |
|
2000 iTest->SimulateKey(TRawEvent::EKeyDown,'2'|TOP16A); |
|
2001 iTest->SimulateKey(TRawEvent::EKeyUp,'2'); |
|
2002 TheClient->iWs.Flush(); |
|
2003 iQueueClient->iWs.SetRemoveKeyCode(EFalse); |
|
2004 iQueueClient->iWs.Flush(); |
|
2005 iTest->SimulateKey(TRawEvent::EKeyDown,'3'|TOP16B); |
|
2006 iTest->SimulateKey(TRawEvent::EKeyUp,'3'); |
|
2007 TheClient->iWs.Flush(); |
|
2008 iQueueClient->iWs.SetRemoveKeyCode(ETrue); |
|
2009 iQueueClient->iWs.Flush(); |
|
2010 iTest->SimulateKey(TRawEvent::EKeyDown,'4'|TOP16B); |
|
2011 iTest->SimulateKey(TRawEvent::EKeyUp,'4'); |
|
2012 AddExpectedKey(EEventKeyDown,'2'); |
|
2013 AddExpectedKey(EEventKey,'2',TOP16A>>16); |
|
2014 AddExpectedKey(EEventKeyUp,'2'); |
|
2015 AddExpectedKey(EEventKeyDown,'3'|TOP16B); |
|
2016 AddExpectedKey(EEventKey,'3',TOP16B>>16); |
|
2017 AddExpectedKey(EEventKeyUp,'3'); |
|
2018 AddExpectedKey(EEventKeyDown,'4'); |
|
2019 AddExpectedKey(EEventKey,'4',TOP16B>>16); |
|
2020 AddExpectedKey(EEventKeyUp,'4'); |
|
2021 break; |
|
2022 } |
|
2023 #endif |
|
2024 default: |
|
2025 CActiveScheduler::Stop(); |
|
2026 break; |
|
2027 } |
|
2028 TheClient->iWs.Flush(); |
|
2029 } |
|
2030 |
|
2031 void CTEventTest::WinCap_NextSetOfEvents() |
|
2032 { |
|
2033 switch(iEventSet++) |
|
2034 { |
|
2035 case 0: |
|
2036 //iQueueClient->SetChildCapture(RWindowBase::TCaptureEnabled); |
|
2037 SimulatePointer(TRawEvent::EButton1Down,35,27); |
|
2038 SimulatePointer(TRawEvent::EButton1Up,25,12); |
|
2039 |
|
2040 |
|
2041 AddExpectedEvent(EEventFocusGained); |
|
2042 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(35-EWinPositionX,27-EWinPositionY)); |
|
2043 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,12-EWinPositionY)); |
|
2044 break; |
|
2045 |
|
2046 |
|
2047 default: |
|
2048 CActiveScheduler::Stop(); |
|
2049 break; |
|
2050 } |
|
2051 TheClient->iWs.Flush(); |
|
2052 } |
|
2053 |
|
2054 void CTEventTest::XyInputType_NextSetOfEvents() |
|
2055 { |
|
2056 switch(iEventSet++) |
|
2057 { |
|
2058 case 0: |
|
2059 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents|EPointerFilterDrag,EPointerGenerateSimulatedMove); |
|
2060 iQueueClient->iWs.Flush(); |
|
2061 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
2062 SimulateButton1DownWithSimulatedMove(46,31); |
|
2063 #else |
|
2064 SimulatePointer(TRawEvent::EButton1Down,46,31); |
|
2065 #endif |
|
2066 SimulatePointer(TRawEvent::EButton1Up,46,31); |
|
2067 AddExpectedEvent(EEventFocusGained); |
|
2068 AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
2069 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
2070 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
2071 break; //Must do something |
|
2072 case 1: |
|
2073 { |
|
2074 // check if RWindowGroup::SimulatePointerEvent is working (DEF131563) |
|
2075 RWindowGroup& group = *iQueueClient->iGroup->GroupWin(); |
|
2076 TRawEvent event; |
|
2077 event.Set(TRawEvent::EButton1Down, 10, 10); |
|
2078 group.SimulatePointerEvent(event); |
|
2079 event.Set(TRawEvent::EButton1Up, 10, 10); |
|
2080 group.SimulatePointerEvent(event); |
|
2081 if(!iIs3DPointer) |
|
2082 { |
|
2083 // simulated move will be generated |
|
2084 AddExpectedPointer(TPointerEvent::EMove, TPoint(10 - EWinPositionX, 10 - EWinPositionY)); |
|
2085 } |
|
2086 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10 - EWinPositionX, 10 - EWinPositionY)); |
|
2087 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10 - EWinPositionX, 10 - EWinPositionY)); |
|
2088 } |
|
2089 break; |
|
2090 #if defined(__WINS__) |
|
2091 case 2: |
|
2092 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
2093 SimulateButton1DownWithSimulatedMove(45,32); |
|
2094 #else |
|
2095 SimulatePointer(TRawEvent::EButton1Down,45,32); |
|
2096 #endif |
|
2097 SimulatePointer(TRawEvent::EButton1Up,45,32); |
|
2098 TheClient->iWs.SimulateXyInputType(EXYInputNone); |
|
2099 SimulatePointer(TRawEvent::EButton1Down,44,32); |
|
2100 SimulatePointer(TRawEvent::EPointerMove,43,32); |
|
2101 SimulatePointer(TRawEvent::EButton1Up,43,31); |
|
2102 SimulatePointer(TRawEvent::EButton2Down,44,33); |
|
2103 SimulatePointer(TRawEvent::EButton2Up,44,33); |
|
2104 SimulatePointer(TRawEvent::EButton3Down,43,32); |
|
2105 SimulatePointer(TRawEvent::EButton3Up,43,32); |
|
2106 SimulatePointer(TRawEvent::EPointerSwitchOn,48,32); |
|
2107 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2108 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) |
|
2109 SimulateButton1DownWithSimulatedMove(47,32); |
|
2110 #else |
|
2111 SimulatePointer(TRawEvent::EButton1Down,47,32); |
|
2112 #endif |
|
2113 SimulatePointer(TRawEvent::EButton1Up,47,32); |
|
2114 AddExpectedPointer(TPointerEvent::EMove, TPoint(45-EWinPositionX,32-EWinPositionY)); |
|
2115 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(45-EWinPositionX,32-EWinPositionY)); |
|
2116 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(45-EWinPositionX,32-EWinPositionY)); |
|
2117 AddExpectedPointer(TPointerEvent::EMove, TPoint(47-EWinPositionX,32-EWinPositionY)); |
|
2118 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(47-EWinPositionX,32-EWinPositionY)); |
|
2119 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY)); |
|
2120 break; |
|
2121 case 3: |
|
2122 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerGenerateSimulatedMove,0); |
|
2123 iQueueClient->iWs.Flush(); |
|
2124 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2125 SimulatePointer(TRawEvent::EButton1Down,49,32); |
|
2126 SimulatePointer(TRawEvent::EPointerMove,50,30); |
|
2127 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
2128 SimulatePointer(TRawEvent::EButton1Down,51,32); |
|
2129 SimulatePointer(TRawEvent::EPointerMove,52,30); |
|
2130 SimulatePointer(TRawEvent::EButton1Up,52,30); |
|
2131 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2132 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(49-EWinPositionX,32-EWinPositionY)); |
|
2133 AddExpectedPointer(TPointerEvent::EDrag, TPoint(50-EWinPositionX,30-EWinPositionY)); |
|
2134 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,30-EWinPositionY)); |
|
2135 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(51-EWinPositionX,32-EWinPositionY)); |
|
2136 AddExpectedPointer(TPointerEvent::EDrag, TPoint(52-EWinPositionX,30-EWinPositionY)); |
|
2137 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(52-EWinPositionX,30-EWinPositionY)); |
|
2138 break; |
|
2139 case 4: |
|
2140 SimulatePointer(TRawEvent::EButton1Down,49,31); |
|
2141 SimulatePointer(TRawEvent::EButton1Up,49,31); |
|
2142 TheClient->iWs.SimulateXyInputType(EXYInputMouse); |
|
2143 SimulatePointer(TRawEvent::EPointerMove,50,31); |
|
2144 SimulatePointer(TRawEvent::EButton1Down,50,31); |
|
2145 SimulatePointer(TRawEvent::EPointerMove,50,30); |
|
2146 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
2147 SimulatePointer(TRawEvent::EPointerMove,51,31); |
|
2148 SimulatePointer(TRawEvent::EButton1Down,51,31); |
|
2149 SimulatePointer(TRawEvent::EPointerMove,51,30); |
|
2150 SimulatePointer(TRawEvent::EButton1Up,51,30); |
|
2151 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2152 SimulatePointer(TRawEvent::EButton1Down,52,31); |
|
2153 SimulatePointer(TRawEvent::EButton1Up,52,31); |
|
2154 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(49-EWinPositionX,31-EWinPositionY)); |
|
2155 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(49-EWinPositionX,31-EWinPositionY)); |
|
2156 AddExpectedPointer(TPointerEvent::EMove, TPoint(50-EWinPositionX,31-EWinPositionY)); |
|
2157 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,31-EWinPositionY)); |
|
2158 AddExpectedPointer(TPointerEvent::EDrag, TPoint(50-EWinPositionX,30-EWinPositionY)); |
|
2159 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,30-EWinPositionY)); |
|
2160 AddExpectedPointer(TPointerEvent::EMove, TPoint(51-EWinPositionX,31-EWinPositionY)); |
|
2161 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(51-EWinPositionX,31-EWinPositionY)); |
|
2162 AddExpectedPointer(TPointerEvent::EDrag, TPoint(51-EWinPositionX,30-EWinPositionY)); |
|
2163 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(51-EWinPositionX,30-EWinPositionY)); |
|
2164 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(52-EWinPositionX,31-EWinPositionY)); |
|
2165 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(52-EWinPositionX,31-EWinPositionY)); |
|
2166 break; |
|
2167 case 5: |
|
2168 SimulatePointer(TRawEvent::EButton1Down,69,31); |
|
2169 SimulatePointer(TRawEvent::EButton1Up,69,31); |
|
2170 TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); |
|
2171 SimulatePointer(TRawEvent::EPointerMove,-5,-5); |
|
2172 SimulatePointer(TRawEvent::EButton1Down,7,8); |
|
2173 SimulatePointer(TRawEvent::EPointerMove,10,-3); |
|
2174 SimulatePointer(TRawEvent::EButton1Up,-7,-8); |
|
2175 SimulatePointer(TRawEvent::EPointerMove,-4,9); |
|
2176 SimulatePointer(TRawEvent::EButton1Down,123,456); |
|
2177 SimulatePointer(TRawEvent::EPointerMove,15,13); |
|
2178 SimulatePointer(TRawEvent::EButton1Up,-2345,-6789); |
|
2179 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2180 SimulatePointer(TRawEvent::EButton1Down,62,31); |
|
2181 SimulatePointer(TRawEvent::EButton1Up,62,31); |
|
2182 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(69-EWinPositionX,31-EWinPositionY)); |
|
2183 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(69-EWinPositionX,31-EWinPositionY)); |
|
2184 AddExpectedPointer(TPointerEvent::EMove, TPoint(64-EWinPositionX,26-EWinPositionY)); |
|
2185 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(64-EWinPositionX,26-EWinPositionY)); |
|
2186 AddExpectedPointer(TPointerEvent::EDrag, TPoint(74-EWinPositionX,23-EWinPositionY)); |
|
2187 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(74-EWinPositionX,23-EWinPositionY)); |
|
2188 AddExpectedPointer(TPointerEvent::EMove, TPoint(70-EWinPositionX,32-EWinPositionY)); |
|
2189 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(70-EWinPositionX,32-EWinPositionY)); |
|
2190 AddExpectedPointer(TPointerEvent::EDrag, TPoint(85-EWinPositionX,45-EWinPositionY)); |
|
2191 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(85-EWinPositionX,45-EWinPositionY)); |
|
2192 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(62-EWinPositionX,31-EWinPositionY)); |
|
2193 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(62-EWinPositionX,31-EWinPositionY)); |
|
2194 break; |
|
2195 #endif |
|
2196 default: |
|
2197 CActiveScheduler::Stop(); |
|
2198 break; |
|
2199 } |
|
2200 TheClient->iWs.Flush(); |
|
2201 } |
|
2202 |
|
2203 void CTEventTest::MovingPointerCursor_NextSetOfEventsL() |
|
2204 { |
|
2205 switch(iEventSet++) |
|
2206 { |
|
2207 case 0: |
|
2208 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); |
|
2209 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); |
|
2210 iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); |
|
2211 iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse); |
|
2212 iQueueClient->iWs.Flush(); |
|
2213 //AddExpectedEvent(EEventFocusGained); |
|
2214 break; |
|
2215 #if defined(__WINS__) |
|
2216 case 1: |
|
2217 TheClient->iWs.SimulateXyInputType(EXYInputMouse); |
|
2218 iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); |
|
2219 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); |
|
2220 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); |
|
2221 iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse); |
|
2222 iQueueClient->iWs.Flush(); |
|
2223 SimulatePointer(TRawEvent::EPointerMove,46,31); |
|
2224 SimulatePointer(TRawEvent::EButton1Down,46,31); |
|
2225 SimulatePointer(TRawEvent::EPointerMove,47,32); |
|
2226 SimulatePointer(TRawEvent::EButton1Up,47,32); |
|
2227 AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
2228 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); |
|
2229 AddExpectedPointer(TPointerEvent::EDrag, TPoint(47-EWinPositionX,32-EWinPositionY)); |
|
2230 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY)); |
|
2231 break; |
|
2232 case 2: |
|
2233 TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); |
|
2234 TheClient->iWs.SetPointerCursorPosition(TPoint(62,24)); |
|
2235 SimulatePointer(TRawEvent::EPointerMove,-5,-5); |
|
2236 TheClient->iWs.SetPointerCursorPosition(TPoint(60,20)); |
|
2237 SimulatePointer(TRawEvent::EPointerMove,6,7); |
|
2238 SimulatePointer(TRawEvent::EButton1Down,27,38); |
|
2239 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2240 TheClient->iWs.SetPointerCursorPosition(TPoint(55,25)); |
|
2241 SimulatePointer(TRawEvent::EPointerMove,4,-13); |
|
2242 TheClient->iWs.SetPointerCursorPosition(TPoint(58,20)); |
|
2243 SimulatePointer(TRawEvent::EButton1Up,45,-678); |
|
2244 TheClient->iWs.Flush(); |
|
2245 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,0); |
|
2246 iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,0); |
|
2247 iQueueClient->iWs.Flush(); |
|
2248 TheClient->iWs.SetPointerCursorPosition(TPoint(80,45)); |
|
2249 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2250 AddExpectedPointer(TPointerEvent::EMove, TPoint(57-EWinPositionX,19-EWinPositionY)); |
|
2251 AddExpectedPointer(TPointerEvent::EMove, TPoint(66-EWinPositionX,27-EWinPositionY)); |
|
2252 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(66-EWinPositionX,27-EWinPositionY)); |
|
2253 AddExpectedPointer(TPointerEvent::EDrag, TPoint(66-EWinPositionX,27-EWinPositionY)); |
|
2254 AddExpectedPointer(TPointerEvent::EDrag, TPoint(59-EWinPositionX,12-EWinPositionY)); |
|
2255 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(58-EWinPositionX,20-EWinPositionY)); |
|
2256 AddExpectedEnterExit(EEventPointerEnter, TPoint(58-EWinPositionX,20-EWinPositionY)); |
|
2257 AddExpectedEnterExit(EEventPointerExit, TPoint(58-EWinPositionX,20-EWinPositionY)); |
|
2258 AddExpectedEnterExit(EEventPointerEnter, TPoint(80-EWinPositionX,45-EWinPositionY)); |
|
2259 break; |
|
2260 case 3: |
|
2261 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,EPointerFilterEnterExit); |
|
2262 iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,EPointerFilterEnterExit); |
|
2263 iQueueClient->iWs.Flush(); |
|
2264 TheClient->iWs.SetPointerCursorArea(TRect(0,0,70,240)); |
|
2265 TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); |
|
2266 TheClient->iWs.SetPointerCursorPosition(TPoint(65,30)); |
|
2267 SimulatePointer(TRawEvent::EPointerMove,20,0); |
|
2268 TheClient->iWs.SetPointerCursorPosition(TPoint(75,32)); |
|
2269 SimulatePointer(TRawEvent::EPointerMove,-1,20); |
|
2270 SimulatePointer(TRawEvent::EButton1Down,29,37); |
|
2271 SimulatePointer(TRawEvent::EPointerMove,25,-13); |
|
2272 SimulatePointer(TRawEvent::EButton1Up,47,-648); |
|
2273 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2274 AddExpectedPointer(TPointerEvent::EMove, TPoint(69-EWinPositionX,30-EWinPositionY)); |
|
2275 AddExpectedPointer(TPointerEvent::EMove, TPoint(68-EWinPositionX,52-EWinPositionY)); |
|
2276 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(68-EWinPositionX,52-EWinPositionY)); |
|
2277 AddExpectedPointer(TPointerEvent::EDrag, TPoint(69-EWinPositionX,39-EWinPositionY)); |
|
2278 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(69-EWinPositionX,39-EWinPositionY)); |
|
2279 break; |
|
2280 case 4: |
|
2281 TheClient->iWs.SetPointerCursorArea(TRect(EWinPositionX+2,EWinPositionY+2,EWinPositionX+99,EWinPositionY+49)); |
|
2282 TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); |
|
2283 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2284 SimulatePointer(TRawEvent::EPointerMove,0,-34); |
|
2285 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2286 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2287 SimulatePointer(TRawEvent::EPointerMove,-77,-35); |
|
2288 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2289 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2290 SimulatePointer(TRawEvent::EPointerMove,-78,0); |
|
2291 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2292 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2293 SimulatePointer(TRawEvent::EPointerMove,-79,36); |
|
2294 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2295 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2296 SimulatePointer(TRawEvent::EPointerMove,0,37); |
|
2297 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2298 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2299 SimulatePointer(TRawEvent::EPointerMove,80,38); |
|
2300 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2301 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2302 SimulatePointer(TRawEvent::EPointerMove,81,0); |
|
2303 TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); |
|
2304 SimulatePointer(TRawEvent::EPointerMove,0,0); |
|
2305 SimulatePointer(TRawEvent::EPointerMove,82,-39); |
|
2306 TheClient->iWs.SetPointerCursorPosition(TPoint(2,2)); |
|
2307 SimulatePointer(TRawEvent::EPointerMove,30,30); |
|
2308 TheClient->iWs.SetPointerCursorPosition(TPoint(1,30)); |
|
2309 SimulatePointer(TRawEvent::EPointerMove,1,0); |
|
2310 TheClient->iWs.SetPointerCursorPosition(TPoint(2,88)); |
|
2311 SimulatePointer(TRawEvent::EPointerMove,30,-30); |
|
2312 TheClient->iWs.SetPointerCursorPosition(TPoint(56,88)); |
|
2313 SimulatePointer(TRawEvent::EPointerMove,0,-1); |
|
2314 TheClient->iWs.SetPointerCursorPosition(TPoint(123,88)); |
|
2315 SimulatePointer(TRawEvent::EPointerMove,-30,-30); |
|
2316 TheClient->iWs.SetPointerCursorPosition(TPoint(123,30)); |
|
2317 SimulatePointer(TRawEvent::EPointerMove,-1,0); |
|
2318 TheClient->iWs.SetPointerCursorPosition(TPoint(123,2)); |
|
2319 SimulatePointer(TRawEvent::EPointerMove,-30,30); |
|
2320 TheClient->iWs.SetPointerCursorPosition(TPoint(56,1)); |
|
2321 SimulatePointer(TRawEvent::EPointerMove,0,1); |
|
2322 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2323 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,2)); |
|
2324 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); |
|
2325 AddExpectedPointer(TPointerEvent::EMove, TPoint(2,2)); |
|
2326 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); |
|
2327 AddExpectedPointer(TPointerEvent::EMove, TPoint(2,30-EWinPositionY)); |
|
2328 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); |
|
2329 AddExpectedPointer(TPointerEvent::EMove, TPoint(2,48)); |
|
2330 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); |
|
2331 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,48)); |
|
2332 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); |
|
2333 AddExpectedPointer(TPointerEvent::EMove, TPoint(98,48)); |
|
2334 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); |
|
2335 AddExpectedPointer(TPointerEvent::EMove, TPoint(98,30-EWinPositionY)); |
|
2336 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); |
|
2337 AddExpectedPointer(TPointerEvent::EMove, TPoint(98,2)); |
|
2338 AddExpectedPointer(TPointerEvent::EMove, TPoint(32,32)); |
|
2339 AddExpectedPointer(TPointerEvent::EMove, TPoint(3,30-EWinPositionY)); |
|
2340 AddExpectedPointer(TPointerEvent::EMove, TPoint(32,18)); |
|
2341 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,47)); |
|
2342 AddExpectedPointer(TPointerEvent::EMove, TPoint(68,18)); |
|
2343 AddExpectedPointer(TPointerEvent::EMove, TPoint(97,30-EWinPositionY)); |
|
2344 AddExpectedPointer(TPointerEvent::EMove, TPoint(68,32)); |
|
2345 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,3)); |
|
2346 break; |
|
2347 case 5: |
|
2348 TheClient->iWs.SetPointerCursorArea(TRect(0,0,EWinPositionX+100,EWinPositionY+50)); |
|
2349 TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); |
|
2350 TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); |
|
2351 TheClient->iWs.SetPointerCursorArea(TRect(0,35,EWinPositionX+100,EWinPositionY+50)); |
|
2352 SimulatePointer(TRawEvent::EPointerMove,1,0); |
|
2353 TheClient->iWs.SetPointerCursorPosition(TPoint(10,55)); |
|
2354 TheClient->iWs.SetPointerCursorArea(TRect(15,0,EWinPositionX+100,50)); |
|
2355 SimulatePointer(TRawEvent::EPointerMove,1,1); |
|
2356 TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); |
|
2357 TheClient->iWs.SetPointerCursorArea(TRect(0,0,50,EWinPositionY+50)); |
|
2358 SimulatePointer(TRawEvent::EPointerMove,0,1); |
|
2359 TheClient->iWs.SetPointerCursorPosition(TPoint(10,10)); |
|
2360 TheClient->iWs.SetPointerCursorArea(TRect(15,15,EWinPositionX+100,EWinPositionY+50)); |
|
2361 SimulatePointer(TRawEvent::EPointerMove,1,-1); |
|
2362 TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); |
|
2363 TheClient->iWs.SetPointerCursorArea(TRect(0,0,EWinPositionX+100,30)); |
|
2364 SimulatePointer(TRawEvent::EPointerMove,-1,0); |
|
2365 TheClient->iWs.SetPointerCursorPosition(TPoint(100,10)); |
|
2366 TheClient->iWs.SetPointerCursorArea(TRect(0,15,95,EWinPositionY+50)); |
|
2367 SimulatePointer(TRawEvent::EPointerMove,-1,-1); |
|
2368 TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); |
|
2369 TheClient->iWs.SetPointerCursorArea(TRect(60,0,EWinPositionX+100,EWinPositionY+50)); |
|
2370 SimulatePointer(TRawEvent::EPointerMove,0,-1); |
|
2371 TheClient->iWs.SetPointerCursorPosition(TPoint(100,55)); |
|
2372 TheClient->iWs.SetPointerCursorArea(TRect(0,0,95,50)); |
|
2373 SimulatePointer(TRawEvent::EPointerMove,1,-1); |
|
2374 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2375 AddExpectedPointer(TPointerEvent::EMove, TPoint(58-EWinPositionX,35-EWinPositionY)); |
|
2376 AddExpectedPointer(TPointerEvent::EMove, TPoint(16-EWinPositionX,49-EWinPositionY)); |
|
2377 AddExpectedPointer(TPointerEvent::EMove, TPoint(49-EWinPositionX,32-EWinPositionY)); |
|
2378 AddExpectedPointer(TPointerEvent::EMove, TPoint(16-EWinPositionX,15-EWinPositionY)); |
|
2379 AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,29-EWinPositionY)); |
|
2380 AddExpectedPointer(TPointerEvent::EMove, TPoint(93-EWinPositionX,15-EWinPositionY)); |
|
2381 AddExpectedPointer(TPointerEvent::EMove, TPoint(60-EWinPositionX,30-EWinPositionY)); |
|
2382 AddExpectedPointer(TPointerEvent::EMove, TPoint(94-EWinPositionX,48-EWinPositionY)); |
|
2383 break; |
|
2384 #endif |
|
2385 default: |
|
2386 TheClient->iWs.SetPointerCursorArea(TRect(0,0,95,50)); |
|
2387 CActiveScheduler::Stop(); |
|
2388 break; |
|
2389 } |
|
2390 TheClient->iWs.Flush(); |
|
2391 } |
|
2392 |
|
2393 void CTEventTest::RotatedMode_NextSetOfEventsL() |
|
2394 { |
|
2395 #if defined(LOGGING) |
|
2396 TLogMessageText logMessageText; |
|
2397 _LIT(KSet,"RotatedMode SetOfEvents: %d Max=4"); |
|
2398 logMessageText.Format(KSet,iEventSet); |
|
2399 INFO_PRINTF1(logMessageText); |
|
2400 #endif |
|
2401 switch(iEventSet++) |
|
2402 { |
|
2403 case 0: |
|
2404 { |
|
2405 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); |
|
2406 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); |
|
2407 iQueueClient->iWs.Flush(); |
|
2408 TheClient->iWs.SetPointerCursorArea(TRect(10,10,51,51)); |
|
2409 SimulatePointer(TRawEvent::EButton1Down,5,5); |
|
2410 SimulatePointer(TRawEvent::EButton1Up,25,5); |
|
2411 SimulatePointer(TRawEvent::EButton1Down,55,5); |
|
2412 SimulatePointer(TRawEvent::EButton1Up,55,35); |
|
2413 SimulatePointer(TRawEvent::EButton1Down,55,55); |
|
2414 SimulatePointer(TRawEvent::EButton1Up,25,55); |
|
2415 SimulatePointer(TRawEvent::EButton1Down,5,55); |
|
2416 SimulatePointer(TRawEvent::EButton1Up,5,35); |
|
2417 AddExpectedEvent(EEventFocusGained); |
|
2418 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,10-EWinPositionY)); |
|
2419 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(25-EWinPositionX,10-EWinPositionY)); |
|
2420 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,10-EWinPositionY)); |
|
2421 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,35-EWinPositionY)); |
|
2422 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,50-EWinPositionY)); |
|
2423 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(25-EWinPositionX,50-EWinPositionY)); |
|
2424 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,50-EWinPositionY)); |
|
2425 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,35-EWinPositionY)); |
|
2426 } |
|
2427 break; |
|
2428 case 1: |
|
2429 { |
|
2430 TInt enforc=TheClient->iScreen->ScreenModeEnforcement(); |
|
2431 iBlankWin->SetVisible(ETrue); |
|
2432 #if defined(LOGGING) |
|
2433 _LIT(KSet1,"AUTO Rotating Events :1st "); |
|
2434 INFO_PRINTF1(KSet1); |
|
2435 #endif |
|
2436 INFO_PRINTF1(_L(" Set of Events")); |
|
2437 if (iScreenModeTests&EDoRot90) |
|
2438 { |
|
2439 TheClient->iScreen->SetScreenMode(1); |
|
2440 TheClient->iWs.Flush(); |
|
2441 iTest->DelayIfFullRomL(); |
|
2442 INFO_PRINTF1(_L(" Screen mode 1.")); |
|
2443 TPoint screenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin(); |
|
2444 #if defined(__WINS__) |
|
2445 iTest->SimulatePointer(TRawEvent::EButton1Down,20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
2446 iTest->SimulatePointer(TRawEvent::EButton1Up,20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
2447 #else |
|
2448 // simulate pointer at (20,20) on rotated screen by providing physical coordinates |
|
2449 iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
2450 iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
2451 #endif |
|
2452 INFO_PRINTF1(_L(" Sent Up and Down 90")); |
|
2453 } |
|
2454 if (iScreenModeTests&EDoRot180) |
|
2455 { |
|
2456 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180); |
|
2457 TheClient->iScreen->SetScreenMode(0); |
|
2458 INFO_PRINTF1(_L(" Screen mode 0")); |
|
2459 TheClient->iWs.Flush(); |
|
2460 iTest->DelayIfFullRomL(); |
|
2461 INFO_PRINTF1(_L(" Upside Down")); |
|
2462 #if defined(__WINS__) |
|
2463 iTest->SimulatePointer(TRawEvent::EButton1Down,22,22); |
|
2464 iTest->SimulatePointer(TRawEvent::EButton1Up,22,22); |
|
2465 #else |
|
2466 // simulate pointer at (22,22) on rotated screen by providing physical coordinates |
|
2467 iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); |
|
2468 iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); |
|
2469 #endif |
|
2470 INFO_PRINTF1(_L(" Sent Up and Down 180")); |
|
2471 } |
|
2472 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); |
|
2473 TheClient->iScreen->SetScreenMode(0); |
|
2474 TheClient->iWs.Flush(); |
|
2475 iTest->DelayIfFullRomL(); |
|
2476 INFO_PRINTF1(_L(" Normal Screen mode")); |
|
2477 if (iScreenModeTests&EDoRot0) |
|
2478 { |
|
2479 SimulatePointer(TRawEvent::EButton1Down,24,24); |
|
2480 SimulatePointer(TRawEvent::EButton1Up,24,24); |
|
2481 } |
|
2482 if (iScreenModeTests&EDoRot90) |
|
2483 { |
|
2484 if (enforc>ESizeEnforcementNone) |
|
2485 { |
|
2486 AddExpectedEvent(EEventFocusLost); |
|
2487 AddExpectedEvent(EEventFocusGained); |
|
2488 } |
|
2489 else |
|
2490 { |
|
2491 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset)); |
|
2492 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset)); |
|
2493 } |
|
2494 } |
|
2495 if (iScreenModeTests&EDoRot180) |
|
2496 { |
|
2497 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset)); |
|
2498 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset)); |
|
2499 } |
|
2500 if (iScreenModeTests&EDoRot0) |
|
2501 { |
|
2502 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,24-EWinPositionY)); |
|
2503 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,24-EWinPositionY)); |
|
2504 } |
|
2505 INFO_PRINTF1(_L(" Added Expected")); |
|
2506 User::After(EPointerCursorUpdateGap); |
|
2507 iBlankWin->SetVisible(EFalse); |
|
2508 } |
|
2509 break; |
|
2510 #if defined(__WINS__) |
|
2511 case 2: |
|
2512 { |
|
2513 TInt enforc=TheClient->iScreen->ScreenModeEnforcement(); |
|
2514 //INFO_PRINTF1("AUTO Rotating Events "); |
|
2515 //INFO_PRINTF1(" :2nd Set of Events"); |
|
2516 TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); |
|
2517 TheClient->iWs.SetPointerCursorPosition(TPoint(24+EWinPositionX,24+EWinPositionY)); |
|
2518 if (iScreenModeTests&EDoRot90) |
|
2519 { |
|
2520 TheClient->iScreen->SetScreenMode(1); |
|
2521 TheClient->iWs.Flush(); |
|
2522 iTest->DelayIfFullRomL(); |
|
2523 SimulatePointer(TRawEvent::EPointerMove,1,2); |
|
2524 SimulatePointer(TRawEvent::EButton1Down,56,89); |
|
2525 SimulatePointer(TRawEvent::EPointerMove,2,-1); |
|
2526 SimulatePointer(TRawEvent::EButton1Up,234,456); |
|
2527 } |
|
2528 else |
|
2529 TheClient->iWs.SetPointerCursorPosition(TPoint(27+EWinPositionX,25+EWinPositionY)); |
|
2530 if (iScreenModeTests&EDoRot180) |
|
2531 { |
|
2532 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180); |
|
2533 TheClient->iScreen->SetScreenMode(0); |
|
2534 TheClient->iWs.Flush(); |
|
2535 iTest->DelayIfFullRomL(); |
|
2536 SimulatePointer(TRawEvent::EPointerMove,-3,4); |
|
2537 SimulatePointer(TRawEvent::EButton1Down,156,289); |
|
2538 SimulatePointer(TRawEvent::EPointerMove,-4,-3); |
|
2539 SimulatePointer(TRawEvent::EButton1Up,2234,3456); |
|
2540 } |
|
2541 else |
|
2542 TheClient->iWs.SetPointerCursorPosition(TPoint(20+EWinPositionX,26+EWinPositionY)); |
|
2543 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); |
|
2544 TheClient->iScreen->SetScreenMode(0); |
|
2545 TheClient->iWs.Flush(); |
|
2546 iTest->DelayIfFullRomL(); |
|
2547 if (iScreenModeTests&EDoRot0) |
|
2548 { |
|
2549 SimulatePointer(TRawEvent::EButton1Down,24,24); |
|
2550 SimulatePointer(TRawEvent::EButton1Up,24,24); |
|
2551 } |
|
2552 TheClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2553 TheClient->iWs.Flush(); |
|
2554 if (iScreenModeTests&EDoRot90) |
|
2555 { |
|
2556 if (enforc>ESizeEnforcementNone) |
|
2557 { |
|
2558 AddExpectedEvent(EEventFocusLost); |
|
2559 AddExpectedEvent(EEventFocusGained); |
|
2560 } |
|
2561 else |
|
2562 { |
|
2563 AddExpectedPointer(TPointerEvent::EMove, TPoint(25,26)); |
|
2564 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25,26)); |
|
2565 AddExpectedPointer(TPointerEvent::EDrag, TPoint(27,25)); |
|
2566 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(27,25)); |
|
2567 } |
|
2568 } |
|
2569 if (iScreenModeTests&EDoRot180) |
|
2570 { |
|
2571 AddExpectedPointer(TPointerEvent::EMove, TPoint(24,29)); |
|
2572 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24,29)); |
|
2573 AddExpectedPointer(TPointerEvent::EDrag, TPoint(20,26)); |
|
2574 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20,26)); |
|
2575 } |
|
2576 if (iScreenModeTests&EDoRot0) |
|
2577 { |
|
2578 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20,26)); |
|
2579 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20,26)); |
|
2580 } |
|
2581 } |
|
2582 break; |
|
2583 case 3: |
|
2584 { |
|
2585 #if defined(LOGGING) |
|
2586 _LIT(KSet2,"AUTO Rotating Events "); |
|
2587 INFO_PRINTF1(KSet2); |
|
2588 #endif |
|
2589 INFO_PRINTF1(_L(" :3rd Set of Events")); |
|
2590 if (iScreenModeTests&EDoScale) |
|
2591 { |
|
2592 INFO_PRINTF1(_L(" :Screen Scalling Supported")); |
|
2593 iBlankWin->SetVisible(ETrue); |
|
2594 iCurrentMode=iNumScrModes; |
|
2595 --iCurrentMode; |
|
2596 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); |
|
2597 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); |
|
2598 iQueueClient->iScreen->SetScreenMode(iCurrentMode); |
|
2599 TheClient->iScreen->SetAppScreenMode(iCurrentMode); |
|
2600 iQueueClient->iScreen->SetAppScreenMode(iCurrentMode); |
|
2601 iSizeMode=iQueueClient->iScreen->GetCurrentScreenModeAttributes(); |
|
2602 TSizeMode testMode=iSizeMode; |
|
2603 for (TInt xScale=2;xScale<4;xScale++) |
|
2604 { |
|
2605 INFO_PRINTF1(_L(" :New X-Scale Value")); |
|
2606 for (TInt yScale=2;yScale<4;yScale++) |
|
2607 { |
|
2608 INFO_PRINTF1(_L(" :New Y-Scale Value")); |
|
2609 testMode.iScreenScale.SetSize(xScale,yScale); |
|
2610 CheckPointerCursorInDifferentScreenMode(testMode,TPoint(20,30)); |
|
2611 } |
|
2612 } |
|
2613 User::After(EPointerCursorUpdateGap); |
|
2614 iBlankWin->SetVisible(EFalse); |
|
2615 break; |
|
2616 } |
|
2617 } |
|
2618 case 4: |
|
2619 { |
|
2620 if (iScreenModeTests&EDoScale) |
|
2621 { |
|
2622 TSizeMode testMode=iSizeMode; |
|
2623 iBlankWin->SetVisible(ETrue); |
|
2624 for (TInt xScale=2;xScale<4;xScale++) |
|
2625 { |
|
2626 for (TInt yScale=2;yScale<4;yScale++) |
|
2627 { |
|
2628 testMode.iScreenScale.SetSize(xScale,yScale); |
|
2629 CheckPointerCursorInDifferentScreenMode(testMode,TPoint(30,20)); |
|
2630 } |
|
2631 } |
|
2632 User::After(EPointerCursorUpdateGap); |
|
2633 iBlankWin->SetVisible(EFalse); |
|
2634 break; |
|
2635 } |
|
2636 } |
|
2637 #endif |
|
2638 default: |
|
2639 #if defined(__WINS__) |
|
2640 if (iScreenModeTests&EDoScale) |
|
2641 { |
|
2642 iQueueClient->iScreen->SetScreenMode(iCurrentMode); |
|
2643 iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); |
|
2644 iQueueClient->iScreen->SetAppScreenMode(0); |
|
2645 TheClient->iScreen->SetAppScreenMode(0); |
|
2646 iQueueClient->iScreen->SetScreenMode(0); |
|
2647 iBlankWin->SetVisible(EFalse); |
|
2648 TheClient->iWs.SetAutoFlush(iTheClientFlush); |
|
2649 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); |
|
2650 } |
|
2651 #endif |
|
2652 User::After(500000); //0.5secs, to allow other screen devices to respond to the flip events |
|
2653 CActiveScheduler::Stop(); |
|
2654 break; |
|
2655 } |
|
2656 TheClient->iWs.Flush(); |
|
2657 } |
|
2658 |
|
2659 |
|
2660 void CTEventTest::ScreenScaling_NextSetOfEventsL() |
|
2661 { |
|
2662 #if defined(LOGGING) |
|
2663 TLogMessageText logMessageText; |
|
2664 _LIT(KSet,"ScreenScaling SetOfEvents: %d (Last=3)"); |
|
2665 logMessageText.Format(KSet,iEventSet); |
|
2666 INFO_PRINTF1(logMessageText); |
|
2667 #endif |
|
2668 if(! (iScreenModeTests & EDoScale)) |
|
2669 { |
|
2670 User::After(500000); |
|
2671 CActiveScheduler::Stop(); |
|
2672 return; |
|
2673 } |
|
2674 switch(iEventSet++) |
|
2675 { |
|
2676 case 0: |
|
2677 { |
|
2678 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); |
|
2679 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); |
|
2680 iBlankWin->SetVisible(ETrue); |
|
2681 |
|
2682 TInt mode = TheClient->iScreen->CurrentScreenMode(); |
|
2683 |
|
2684 iSizeMode = iQueueClient->iScreen->GetCurrentScreenModeAttributes(); |
|
2685 |
|
2686 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); |
|
2687 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); |
|
2688 |
|
2689 TSizeMode szMode2 = iSizeMode; |
|
2690 |
|
2691 szMode2.iScreenScale.SetSize(2,2); |
|
2692 |
|
2693 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2694 TheClient->iScreen->SetAppScreenMode(mode); |
|
2695 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2696 iQueueClient->iScreen->SetScreenMode(mode); |
|
2697 |
|
2698 TPoint theScreenOrigin(iQueueClient->iScreen->GetScreenModeOrigin(mode)); |
|
2699 |
|
2700 SimulatePointer(TRawEvent::EButton1Down, |
|
2701 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2702 SimulatePointer(TRawEvent::EButton1Up, |
|
2703 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2704 iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); |
|
2705 TheClient->iScreen->SetAppScreenMode(mode); |
|
2706 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2707 iQueueClient->iScreen->SetScreenMode(mode); |
|
2708 |
|
2709 AddExpectedEvent(EEventFocusGained); |
|
2710 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,10-EWinPositionY)); |
|
2711 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,10-EWinPositionY)); |
|
2712 |
|
2713 break; |
|
2714 } |
|
2715 case 1: |
|
2716 { |
|
2717 TSizeMode szMode2 = iSizeMode; |
|
2718 TInt mode = TheClient->iScreen->CurrentScreenMode(); |
|
2719 |
|
2720 szMode2.iScreenScale.SetSize(2,2); |
|
2721 szMode2.iOrigin.SetXY(20,20); |
|
2722 |
|
2723 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2724 TheClient->iScreen->SetAppScreenMode(mode); |
|
2725 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2726 iQueueClient->iScreen->SetScreenMode(mode); |
|
2727 |
|
2728 TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2729 |
|
2730 SimulatePointer(TRawEvent::EButton1Down, |
|
2731 30+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2732 SimulatePointer(TRawEvent::EButton1Up, |
|
2733 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2734 SimulatePointer(TRawEvent::EButton1Down, |
|
2735 40+theScreenOrigin.iX, 60+theScreenOrigin.iY); |
|
2736 SimulatePointer(TRawEvent::EButton1Up, |
|
2737 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2738 |
|
2739 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(15-EWinPositionX,15-EWinPositionY)); |
|
2740 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(13-EWinPositionX,10-EWinPositionY)); |
|
2741 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,30-EWinPositionY)); |
|
2742 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(13-EWinPositionX,10-EWinPositionY)); |
|
2743 |
|
2744 iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); |
|
2745 TheClient->iScreen->SetAppScreenMode(mode); |
|
2746 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2747 iQueueClient->iScreen->SetScreenMode(mode); |
|
2748 |
|
2749 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2750 |
|
2751 SimulatePointer(TRawEvent::EButton1Down, |
|
2752 30+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2753 SimulatePointer(TRawEvent::EButton1Up, |
|
2754 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2755 SimulatePointer(TRawEvent::EButton1Down, |
|
2756 40+theScreenOrigin.iX, 50+theScreenOrigin.iY); |
|
2757 SimulatePointer(TRawEvent::EButton1Up, |
|
2758 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2759 |
|
2760 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(30-EWinPositionX,30-EWinPositionY)); |
|
2761 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); |
|
2762 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(40-EWinPositionX,50-EWinPositionY)); |
|
2763 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); |
|
2764 break; |
|
2765 } |
|
2766 case 2: |
|
2767 { |
|
2768 TInt mode = TheClient->iScreen->CurrentScreenMode(); |
|
2769 TRect theRect = TheClient->iWs.PointerCursorArea(); |
|
2770 |
|
2771 TSizeMode szMode2 = iSizeMode; |
|
2772 |
|
2773 //----------- scaling 2X2 |
|
2774 szMode2.iScreenScale.SetSize(2,2); |
|
2775 |
|
2776 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2777 iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); |
|
2778 TheClient->iScreen->SetAppScreenMode(mode); |
|
2779 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2780 iQueueClient->iScreen->SetScreenMode(mode); |
|
2781 |
|
2782 |
|
2783 TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2784 |
|
2785 SimulatePointer(TRawEvent::EButton1Down, |
|
2786 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2787 SimulatePointer(TRawEvent::EButton1Up, |
|
2788 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2789 SimulatePointer(TRawEvent::EButton1Down, |
|
2790 50+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2791 SimulatePointer(TRawEvent::EButton1Up, |
|
2792 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2793 |
|
2794 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2795 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2796 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,15-EWinPositionY)); |
|
2797 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2798 //------------------------ scaling 1X2 |
|
2799 szMode2.iScreenScale.SetSize(1,2); |
|
2800 |
|
2801 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2802 iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); |
|
2803 TheClient->iScreen->SetAppScreenMode(mode); |
|
2804 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2805 iQueueClient->iScreen->SetScreenMode(mode); |
|
2806 |
|
2807 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2808 |
|
2809 SimulatePointer(TRawEvent::EButton1Down, |
|
2810 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2811 SimulatePointer(TRawEvent::EButton1Up, |
|
2812 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2813 SimulatePointer(TRawEvent::EButton1Down, |
|
2814 50+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2815 SimulatePointer(TRawEvent::EButton1Up, |
|
2816 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2817 |
|
2818 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2819 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,10-EWinPositionY)); |
|
2820 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,15-EWinPositionY)); |
|
2821 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,10-EWinPositionY)); |
|
2822 //------------------------ scaling 2X1 |
|
2823 szMode2.iScreenScale.SetSize(2,1); |
|
2824 |
|
2825 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2826 iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); |
|
2827 TheClient->iScreen->SetAppScreenMode(mode); |
|
2828 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2829 iQueueClient->iScreen->SetScreenMode(mode); |
|
2830 |
|
2831 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2832 |
|
2833 SimulatePointer(TRawEvent::EButton1Down, |
|
2834 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2835 SimulatePointer(TRawEvent::EButton1Up, |
|
2836 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2837 SimulatePointer(TRawEvent::EButton1Down, |
|
2838 50+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2839 SimulatePointer(TRawEvent::EButton1Up, |
|
2840 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2841 |
|
2842 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,20-EWinPositionY)); |
|
2843 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); |
|
2844 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,30-EWinPositionY)); |
|
2845 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); |
|
2846 //------------------------ scaling 3X1 |
|
2847 |
|
2848 szMode2.iScreenScale.SetSize(3,1); |
|
2849 |
|
2850 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2851 iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); |
|
2852 TheClient->iScreen->SetAppScreenMode(mode); |
|
2853 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2854 iQueueClient->iScreen->SetScreenMode(mode); |
|
2855 |
|
2856 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2857 |
|
2858 SimulatePointer(TRawEvent::EButton1Down, |
|
2859 21+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2860 SimulatePointer(TRawEvent::EButton1Up, |
|
2861 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2862 SimulatePointer(TRawEvent::EButton1Down, |
|
2863 75+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2864 SimulatePointer(TRawEvent::EButton1Up, |
|
2865 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2866 |
|
2867 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,20-EWinPositionY)); |
|
2868 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); |
|
2869 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,30-EWinPositionY)); |
|
2870 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); |
|
2871 //------------------------ scaling 3X2 |
|
2872 |
|
2873 szMode2.iScreenScale.SetSize(3,2); |
|
2874 |
|
2875 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2876 iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); |
|
2877 TheClient->iScreen->SetAppScreenMode(mode); |
|
2878 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2879 iQueueClient->iScreen->SetScreenMode(mode); |
|
2880 |
|
2881 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2882 |
|
2883 SimulatePointer(TRawEvent::EButton1Down, |
|
2884 21+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2885 SimulatePointer(TRawEvent::EButton1Up, |
|
2886 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2887 SimulatePointer(TRawEvent::EButton1Down, |
|
2888 75+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2889 SimulatePointer(TRawEvent::EButton1Up, |
|
2890 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2891 |
|
2892 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2893 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2894 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,15-EWinPositionY)); |
|
2895 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2896 //------------------------ scaling 3X3 |
|
2897 szMode2.iScreenScale.SetSize(3,3); |
|
2898 |
|
2899 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); |
|
2900 iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); |
|
2901 TheClient->iScreen->SetAppScreenMode(mode); |
|
2902 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2903 iQueueClient->iScreen->SetScreenMode(mode); |
|
2904 |
|
2905 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2906 |
|
2907 SimulatePointer(TRawEvent::EButton1Down, |
|
2908 21+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2909 SimulatePointer(TRawEvent::EButton1Up, |
|
2910 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2911 SimulatePointer(TRawEvent::EButton1Down, |
|
2912 75+theScreenOrigin.iX, 33+theScreenOrigin.iY); |
|
2913 SimulatePointer(TRawEvent::EButton1Up, |
|
2914 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2915 |
|
2916 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2917 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2918 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,11-EWinPositionY)); |
|
2919 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); |
|
2920 //------------------------ |
|
2921 iQueueClient->iWs.SetPointerCursorArea(mode, theRect); |
|
2922 iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); |
|
2923 TheClient->iScreen->SetAppScreenMode(mode); |
|
2924 iQueueClient->iScreen->SetAppScreenMode(mode); |
|
2925 iQueueClient->iScreen->SetScreenMode(mode); |
|
2926 break; |
|
2927 } |
|
2928 case 3: |
|
2929 { |
|
2930 iQueueClient->iWs.SetAutoFlush(ETrue); |
|
2931 TInt theCurMode = iQueueClient->iScreen->CurrentScreenMode(); |
|
2932 TPoint theScreenOrigin; |
|
2933 if (iNumScrModes>2) |
|
2934 { |
|
2935 TheClient->iScreen->SetAppScreenMode(2); |
|
2936 iQueueClient->iScreen->SetAppScreenMode(2); |
|
2937 TheClient->iScreen->SetScreenMode(2); |
|
2938 |
|
2939 theScreenOrigin=iQueueClient->iScreen->GetDefaultScreenModeOrigin(); |
|
2940 SimulatePointer(TRawEvent::EButton1Down, |
|
2941 30+theScreenOrigin.iX,30+theScreenOrigin.iY); |
|
2942 SimulatePointer(TRawEvent::EButton1Up, |
|
2943 26+theScreenOrigin.iX,20+theScreenOrigin.iY); |
|
2944 SimulatePointer(TRawEvent::EButton1Down, |
|
2945 40+theScreenOrigin.iX,60+theScreenOrigin.iY); |
|
2946 SimulatePointer(TRawEvent::EButton1Up, |
|
2947 26+theScreenOrigin.iX,20+theScreenOrigin.iY); |
|
2948 |
|
2949 AddExpectedPointer(TPointerEvent::EButton1Down, |
|
2950 TPoint(15-EWinPositionX,15-EWinPositionY)); |
|
2951 AddExpectedPointer(TPointerEvent::EButton1Up, |
|
2952 TPoint(13-EWinPositionX,10-EWinPositionY)); |
|
2953 AddExpectedPointer(TPointerEvent::EButton1Down, |
|
2954 TPoint(20-EWinPositionX,30-EWinPositionY)); |
|
2955 AddExpectedPointer(TPointerEvent::EButton1Up, |
|
2956 TPoint(13-EWinPositionX,10-EWinPositionY)); |
|
2957 } |
|
2958 |
|
2959 TheClient->iScreen->SetAppScreenMode(0); |
|
2960 iQueueClient->iScreen->SetAppScreenMode(0); |
|
2961 iQueueClient->iScreen->SetScreenMode(0); |
|
2962 iTest->DelayIfFullRomL(); |
|
2963 |
|
2964 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); |
|
2965 |
|
2966 SimulatePointer(TRawEvent::EButton1Down, |
|
2967 30+theScreenOrigin.iX, 30+theScreenOrigin.iY); |
|
2968 SimulatePointer(TRawEvent::EButton1Up, |
|
2969 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2970 SimulatePointer(TRawEvent::EButton1Down, |
|
2971 40+theScreenOrigin.iX, 50+theScreenOrigin.iY); |
|
2972 SimulatePointer(TRawEvent::EButton1Up, |
|
2973 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); |
|
2974 |
|
2975 #if defined(__WINS__) |
|
2976 iQueueClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); |
|
2977 iQueueClient->iWs.SetPointerCursorPosition(TPoint(24+theScreenOrigin.iX,24+theScreenOrigin.iY)); |
|
2978 SimulatePointer(TRawEvent::EPointerMove,1,2); |
|
2979 iQueueClient->iWs.SimulateXyInputType(EXYInputPointer); |
|
2980 #endif |
|
2981 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(30-EWinPositionX,30-EWinPositionY)); |
|
2982 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); |
|
2983 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(40-EWinPositionX,50-EWinPositionY)); |
|
2984 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); |
|
2985 |
|
2986 #if defined(__WINS__) |
|
2987 AddExpectedPointer(TPointerEvent::EMove, TPoint(25-EWinPositionX,26-EWinPositionY)); |
|
2988 #endif |
|
2989 |
|
2990 iQueueClient->iScreen->SetAppScreenMode(theCurMode); |
|
2991 TheClient->iScreen->SetScreenMode(theCurMode); |
|
2992 break; |
|
2993 } |
|
2994 default: |
|
2995 User::After(EPointerCursorUpdateGap); |
|
2996 iBlankWin->SetVisible(EFalse); |
|
2997 TheClient->iWs.SetAutoFlush(iTheClientFlush); |
|
2998 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); |
|
2999 iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); |
|
3000 User::After(500000); //0.5secs, to allow other screen devices to respond to the flip events |
|
3001 CActiveScheduler::Stop(); |
|
3002 break; |
|
3003 } |
|
3004 } |
|
3005 |
|
3006 void CTEventTest::AnimEvent_NextSetOfEventsL() |
|
3007 { |
|
3008 #if defined(LOGGING) |
|
3009 TLogMessageText logMessageText; |
|
3010 _LIT(KSet,"AnimEvent SetOfEvents: %d (Max=4)"); |
|
3011 logMessageText.Format(KSet,iEventSet); |
|
3012 INFO_PRINTF1(logMessageText); |
|
3013 #endif |
|
3014 switch(iEventSet++) |
|
3015 { |
|
3016 case 0: |
|
3017 iAnim=REventAnim::NewL(iQueueClient->iWin->BaseWin(), iAnimDll); |
|
3018 AddExpectedEvent(EEventFocusGained); |
|
3019 AddExpectedKeyAnim(TRawEvent::EKeyDown,32,ETrue); |
|
3020 AddExpectedKeyAnim(TRawEvent::EKeyUp,32,ETrue); |
|
3021 AddExpectedKeyAnim(TRawEvent::EKeyDown,33,EFalse); |
|
3022 AddExpectedKeyAnim(TRawEvent::EKeyUp,33,EFalse); |
|
3023 iTest->SimulateKey(TRawEvent::EKeyDown,32); |
|
3024 iTest->SimulateKey(TRawEvent::EKeyUp,32); |
|
3025 iTest->SimulateKey(TRawEvent::EKeyDown,33); |
|
3026 iTest->SimulateKey(TRawEvent::EKeyUp,33); |
|
3027 TheClient->iWs.Flush(); |
|
3028 if (iAnim->TestFail(4)) |
|
3029 Failed(); |
|
3030 break; |
|
3031 case 1: |
|
3032 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); |
|
3033 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); |
|
3034 iQueueClient->iWs.Flush(); |
|
3035 TheClient->iWs.SetPointerCursorArea(TRect(10,10,51,51)); |
|
3036 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(10,10)); |
|
3037 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(25,10)); |
|
3038 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(50,10)); |
|
3039 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(50,35)); |
|
3040 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(50,50)); |
|
3041 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(25,50)); |
|
3042 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(10,50)); |
|
3043 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(10,35)); |
|
3044 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(30,30),EFalse); |
|
3045 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(30,30),EFalse); |
|
3046 SimulatePointer(TRawEvent::EButton1Down,5,5); |
|
3047 SimulatePointer(TRawEvent::EButton1Up,25,5); |
|
3048 SimulatePointer(TRawEvent::EButton1Down,55,5); |
|
3049 SimulatePointer(TRawEvent::EButton1Up,55,35); |
|
3050 SimulatePointer(TRawEvent::EButton1Down,55,55); |
|
3051 SimulatePointer(TRawEvent::EButton1Up,25,55); |
|
3052 SimulatePointer(TRawEvent::EButton1Down,5,55); |
|
3053 SimulatePointer(TRawEvent::EButton1Up,5,35); |
|
3054 SimulatePointer(TRawEvent::EButton1Down,30,30); |
|
3055 SimulatePointer(TRawEvent::EButton1Up,30,30); |
|
3056 TheClient->iWs.Flush(); |
|
3057 if (iAnim->TestFail(10)) |
|
3058 Failed(); |
|
3059 break; |
|
3060 case 2: |
|
3061 { |
|
3062 #if defined(LOGGING) |
|
3063 _LIT(KLog," :2nd Set of Events Modes=0x%x"); |
|
3064 logMessageText.Format(KLog,iScreenModeTests); |
|
3065 INFO_PRINTF1(logMessageText); |
|
3066 #endif |
|
3067 TInt enforc=TheClient->iScreen->ScreenModeEnforcement(); |
|
3068 iBlankWin->SetVisible(ETrue); |
|
3069 TInt expectedEvents=0; |
|
3070 if (iScreenModeTests&EDoRot90 && enforc==ESizeEnforcementNone) |
|
3071 { |
|
3072 INFO_PRINTF1(_L(" :Rotation 90")); |
|
3073 TheClient->iScreen->SetScreenMode(1); |
|
3074 TheClient->iWs.Flush(); |
|
3075 iTest->DelayIfFullRomL(); |
|
3076 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(20,20-iYOffset)); |
|
3077 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(20,20-iYOffset)); |
|
3078 expectedEvents+=2; |
|
3079 TPoint screenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin(); |
|
3080 #if defined(__WINS__) |
|
3081 iTest->SimulatePointer(TRawEvent::EButton1Down,20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
3082 iTest->SimulatePointer(TRawEvent::EButton1Up,20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
3083 #else |
|
3084 // simulate pointer at (20,20) on rotated screen by providing physical coordinates |
|
3085 iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
3086 iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); |
|
3087 #endif |
|
3088 } |
|
3089 if (iScreenModeTests&EDoRot180) |
|
3090 { |
|
3091 INFO_PRINTF1(_L(" :Rotation 180")); |
|
3092 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180); |
|
3093 TheClient->iScreen->SetScreenMode(0); |
|
3094 TheClient->iWs.Flush(); |
|
3095 iTest->DelayIfFullRomL(); |
|
3096 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(22,22-iYOffset)); |
|
3097 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(22,22-iYOffset)); |
|
3098 |
|
3099 expectedEvents+=2; |
|
3100 #if defined(__WINS__) |
|
3101 iTest->SimulatePointer(TRawEvent::EButton1Down,22,22); |
|
3102 iTest->SimulatePointer(TRawEvent::EButton1Up,22,22); |
|
3103 #else |
|
3104 // simulate pointer at (22,22) on rotated screen by providing physical coordinates |
|
3105 iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); |
|
3106 iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); |
|
3107 #endif |
|
3108 } |
|
3109 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); |
|
3110 TheClient->iScreen->SetScreenMode(0); |
|
3111 TheClient->iWs.Flush(); |
|
3112 iTest->DelayIfFullRomL(); |
|
3113 if (iScreenModeTests&EDoRot0) |
|
3114 { |
|
3115 INFO_PRINTF1(_L(" :Rotation 0")); |
|
3116 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(24,24),EFalse); |
|
3117 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(24,24),EFalse); |
|
3118 expectedEvents+=2; |
|
3119 SimulatePointer(TRawEvent::EButton1Down,24,24); |
|
3120 SimulatePointer(TRawEvent::EButton1Up,24,24); |
|
3121 } |
|
3122 #if defined(LOGGING) |
|
3123 _LIT(KNumEvents," :Expected Number of Events=%d Actual=%d"); |
|
3124 logMessageText.Format(KNumEvents,expectedEvents,iAnim->GetNumEvents()); |
|
3125 INFO_PRINTF1(logMessageText); |
|
3126 _LIT(KError," :Error Value %d ('0'=OK)"); |
|
3127 logMessageText.Format(KError,iAnim->GetError()); |
|
3128 INFO_PRINTF1(logMessageText); |
|
3129 #endif |
|
3130 if (iAnim->TestFail(expectedEvents)) |
|
3131 Failed(); |
|
3132 User::After(EPointerCursorUpdateGap); |
|
3133 iBlankWin->SetVisible(EFalse); |
|
3134 INFO_PRINTF1(_L(" :Finished 2nd Set")); |
|
3135 } |
|
3136 break; |
|
3137 case 3: |
|
3138 iAnim->Destroy(); iAnim=NULL; |
|
3139 // Create an EventPostingAnim, key down & key up events are simulated. |
|
3140 // The event posting anim sees the key events in turn, and creates duplicates. |
|
3141 // Test checks that each simulated event is received twice. |
|
3142 TRAPD(err, iAnim=REventAnim::NewL(iQueueClient->iWin->BaseWin(), iAnimDll, REventAnimBase::EEventPostingAnim)); |
|
3143 if (err!=KErrNone) |
|
3144 { |
|
3145 Failed(); |
|
3146 return; |
|
3147 } |
|
3148 AddExpectedKeyAnim(TRawEvent::EKeyDown,32,ETrue); |
|
3149 AddExpectedKeyAnim(TRawEvent::EKeyDown,32,EFalse); |
|
3150 AddExpectedKeyAnim(TRawEvent::EKeyUp,32,ETrue); |
|
3151 AddExpectedKeyAnim(TRawEvent::EKeyUp,32,EFalse); |
|
3152 |
|
3153 iTest->SimulateKey(TRawEvent::EKeyDown,32); |
|
3154 iTest->SimulateKey(TRawEvent::EKeyUp,32); |
|
3155 break; |
|
3156 case 4: |
|
3157 // Simulate a key down event, which calls anim's offer raw event |
|
3158 // which inturn calls post key event with old and new API |
|
3159 // Test checks the repeat count for old and new API are as expected. |
|
3160 AddExpectedKeyAnim(TRawEvent::EKeyDown,45,ETrue); |
|
3161 |
|
3162 TKeyEvent event; |
|
3163 event.iCode='J'; |
|
3164 event.iScanCode=0; |
|
3165 event.iModifiers=0; |
|
3166 event.iRepeats=0; |
|
3167 AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers); |
|
3168 event.iRepeats=2; |
|
3169 AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers); |
|
3170 |
|
3171 iTest->SimulateKey(TRawEvent::EKeyDown,45); |
|
3172 break; |
|
3173 default: |
|
3174 iAnim->Destroy(); |
|
3175 iAnim=NULL; |
|
3176 CActiveScheduler::Stop(); |
|
3177 break; |
|
3178 } |
|
3179 TheClient->iWs.Flush(); |
|
3180 } |
|
3181 |
|
3182 void CTEventTest::FocusChanged_NextSetOfEventsL() |
|
3183 { |
|
3184 #if defined(LOGGING) |
|
3185 TLogMessageText logMessageText; |
|
3186 _LIT(KSet,"FocusChanged SetOfEvents: %d "); |
|
3187 logMessageText.Format(KSet,iEventSet); |
|
3188 INFO_PRINTF1(logMessageText); |
|
3189 #endif |
|
3190 switch(iEventSet++) |
|
3191 { |
|
3192 case 0: |
|
3193 { |
|
3194 _LIT(AutoFocusTest,"FocusEvents"); |
|
3195 iQueueClient->EnableFocusChangeEvents(); |
|
3196 iEventTestGroup2=new(ELeave) CTWindowGroup(TheClient); |
|
3197 iEventTestGroup2->ConstructL(); |
|
3198 iEventTestGroup2->GroupWin()->SetName(AutoFocusTest); |
|
3199 AddExpectedEvent(EEventFocusGained); |
|
3200 AddExpectedEvent(EEventFocusLost); |
|
3201 AddExpectedEvent(EEventFocusGroupChanged); |
|
3202 AddExpectedEvent(EEventWindowGroupsChanged); |
|
3203 } |
|
3204 break; |
|
3205 case 1: |
|
3206 iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(EFalse); |
|
3207 AddExpectedEvent(EEventFocusGained); |
|
3208 AddExpectedEvent(EEventFocusGroupChanged); |
|
3209 break; |
|
3210 case 2: |
|
3211 iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(ETrue); |
|
3212 AddExpectedEvent(EEventFocusLost); |
|
3213 AddExpectedEvent(EEventFocusGroupChanged); |
|
3214 break; |
|
3215 case 3: |
|
3216 iEventTestGroup2->GroupWin()->SetOrdinalPosition(999); |
|
3217 AddExpectedEvent(EEventFocusGained); |
|
3218 AddExpectedEvent(EEventFocusGroupChanged); |
|
3219 break; |
|
3220 case 4: |
|
3221 iEventTestGroup2->GroupWin()->SetOrdinalPosition(0); |
|
3222 AddExpectedEvent(EEventFocusLost); |
|
3223 AddExpectedEvent(EEventFocusGroupChanged); |
|
3224 break; |
|
3225 case 5: |
|
3226 delete iEventTestGroup2; |
|
3227 iEventTestGroup2=NULL; |
|
3228 AddExpectedEvent(EEventWindowGroupsChanged); |
|
3229 AddExpectedEvent(EEventFocusGroupChanged); |
|
3230 break; |
|
3231 default: |
|
3232 CActiveScheduler::Stop(); |
|
3233 break; |
|
3234 } |
|
3235 TheClient->iWs.Flush(); |
|
3236 } |
|
3237 |
|
3238 |
|
3239 void CTEventTest::StopEvents_NextSetOfEventsL() |
|
3240 { |
|
3241 // we are not running tests 0,1,2 as they currently fail |
|
3242 if(iEventSet==0) |
|
3243 { |
|
3244 iEventSet=3; |
|
3245 AddExpectedEvent(EEventFocusGained); |
|
3246 } |
|
3247 TInt retVal = KErrNone; |
|
3248 |
|
3249 switch(iEventSet++) |
|
3250 { |
|
3251 case 0: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(.... |
|
3252 iQueueClient->iWs.Flush(); |
|
3253 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); |
|
3254 iTest->SimulateEvent(TRawEvent::ESwitchOff); |
|
3255 TheClient->iWs.Flush(); |
|
3256 retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()); |
|
3257 TEST(retVal==KErrAlreadyExists); |
|
3258 if (retVal!=KErrAlreadyExists) |
|
3259 INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal); |
|
3260 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse,iQueueClient->iGroup->WinTreeNode())); |
|
3261 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); |
|
3262 iTest->SimulateEvent(TRawEvent::ESwitchOff); |
|
3263 TheClient->iWs.Flush(); |
|
3264 retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()); |
|
3265 TEST(retVal==KErrAlreadyExists); |
|
3266 if (retVal!=KErrAlreadyExists) |
|
3267 INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal); |
|
3268 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); |
|
3269 AddExpectedEvent(EEventFocusGained); |
|
3270 AddExpectedEvent(EEventSwitchOff); |
|
3271 AddExpectedEvent(EEventSwitchOff); |
|
3272 break; |
|
3273 |
|
3274 case 1: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(.... |
|
3275 { |
|
3276 TKeyEvent event; |
|
3277 iQueueClient->iWs.Flush(); |
|
3278 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); |
|
3279 event.iCode=EKeyOff; |
|
3280 event.iScanCode=EKeyOff; |
|
3281 event.iModifiers=0; |
|
3282 event.iRepeats=0; |
|
3283 TheClient->iWs.SimulateKeyEvent(event); |
|
3284 TheClient->iWs.Flush(); |
|
3285 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); |
|
3286 AddExpectedEvent(EEventKeySwitchOff); |
|
3287 } |
|
3288 break; |
|
3289 |
|
3290 case 2: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(.... |
|
3291 { |
|
3292 TKeyEvent event; |
|
3293 event.iCode=EKeyOff; |
|
3294 event.iScanCode=EKeyOff; |
|
3295 event.iModifiers=0; |
|
3296 event.iRepeats=0; |
|
3297 iQueueClient->iWs.Flush(); |
|
3298 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); |
|
3299 iTest->SimulateEvent(TRawEvent::ESwitchOff); |
|
3300 TheClient->iWs.SimulateKeyEvent(event); |
|
3301 iTest->SimulateEvent(TRawEvent::ECaseClose); |
|
3302 TheClient->iWs.Flush(); |
|
3303 retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()); |
|
3304 TEST(retVal==KErrAlreadyExists); |
|
3305 if (retVal!=KErrAlreadyExists) |
|
3306 INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal); |
|
3307 iTest->SimulateEvent(TRawEvent::ESwitchOff); |
|
3308 iTest->SimulateEvent(TRawEvent::ECaseClose); |
|
3309 TheClient->iWs.SimulateKeyEvent(event); |
|
3310 TheClient->iWs.Flush(); |
|
3311 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse,iQueueClient->iGroup->WinTreeNode())); |
|
3312 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode())); |
|
3313 iTest->SimulateEvent(TRawEvent::ECaseClose); |
|
3314 iTest->SimulateEvent(TRawEvent::ESwitchOff); |
|
3315 TheClient->iWs.SimulateKeyEvent(event); |
|
3316 TheClient->iWs.Flush(); |
|
3317 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); |
|
3318 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iChildWin->WinTreeNode())); |
|
3319 iTest->SimulateEvent(TRawEvent::ESwitchOff); |
|
3320 TheClient->iWs.SimulateKeyEvent(event); |
|
3321 iTest->SimulateEvent(TRawEvent::ECaseClose); |
|
3322 TheClient->iWs.Flush(); |
|
3323 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); |
|
3324 AddExpectedEvent(EEventSwitchOff); |
|
3325 AddExpectedEvent(EEventKeySwitchOff); |
|
3326 AddExpectedEvent(EEventCaseClosed); |
|
3327 AddExpectedEvent(EEventSwitchOff); |
|
3328 AddExpectedEvent(EEventCaseClosed); |
|
3329 AddExpectedEvent(EEventKeySwitchOff); |
|
3330 AddExpectedEvent(EEventCaseClosed,iQueueClient->iWin); |
|
3331 AddExpectedEvent(EEventSwitchOff,iQueueClient->iWin); |
|
3332 AddExpectedEvent(EEventKeySwitchOff,iQueueClient->iWin); |
|
3333 AddExpectedEvent(EEventSwitchOff,iQueueClient->iChildWin); |
|
3334 AddExpectedEvent(EEventKeySwitchOff,iQueueClient->iChildWin); |
|
3335 AddExpectedEvent(EEventCaseClosed,iQueueClient->iChildWin); |
|
3336 } |
|
3337 break; |
|
3338 |
|
3339 case 3: |
|
3340 iQueueClient->iWs.Flush(); |
|
3341 //User::LeaveIfError(iQueueClient->iGroup->WinTreeNode()->EnableOnEvents(EEventControlAlways)); |
|
3342 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
3343 iTest->SimulateEvent(TRawEvent::ECaseOpen); |
|
3344 TheClient->iWs.Flush(); |
|
3345 User::LeaveIfError(iQueueClient->iWin->WinTreeNode()->EnableOnEvents(EEventControlAlways)); |
|
3346 iTest->SimulateEvent(TRawEvent::ECaseOpen); |
|
3347 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
3348 TheClient->iWs.Flush(); |
|
3349 iQueueClient->iWin->WinTreeNode()->DisableOnEvents(); |
|
3350 AddExpectedEvent(EEventSwitchOn); |
|
3351 //AddExpectedEvent(EEventSwitchOn); |
|
3352 AddExpectedEvent(EEventCaseOpened); |
|
3353 AddExpectedEvent(EEventCaseOpened,iQueueClient->iWin); |
|
3354 AddExpectedEvent(EEventCaseOpened); |
|
3355 AddExpectedEvent(EEventSwitchOn,iQueueClient->iWin); |
|
3356 AddExpectedEvent(EEventSwitchOn); |
|
3357 break; |
|
3358 |
|
3359 case 4: |
|
3360 iQueueClient->iWs.Flush(); |
|
3361 // switch off the device |
|
3362 iTest->SimulateEvent(TRawEvent::ESwitchOff); |
|
3363 // switch it back on. |
|
3364 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
3365 TheClient->iWs.Flush(); |
|
3366 // TRawEvent::ESwitchOff never actually comes back. The tests will hang if we look for one |
|
3367 AddExpectedEvent(EEventSwitchOn); |
|
3368 break; |
|
3369 |
|
3370 case 5: |
|
3371 { |
|
3372 TKeyEvent event; |
|
3373 iQueueClient->iWs.Flush(); |
|
3374 event.iCode=EKeyOff; |
|
3375 event.iScanCode=EKeyOff; |
|
3376 event.iModifiers=0; |
|
3377 event.iRepeats=0; |
|
3378 // switch off the device - this one seems to send it to standby rather than off |
|
3379 TheClient->iWs.SimulateKeyEvent(event); |
|
3380 // switch it back on or no further tests will complete |
|
3381 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
3382 TheClient->iWs.Flush(); |
|
3383 // again we would expect EEventKeySwitchOff but it doesn't come back. The tests will hang if we look for one |
|
3384 AddExpectedEvent(EEventSwitchOn); |
|
3385 } |
|
3386 break; |
|
3387 |
|
3388 case 6: |
|
3389 iQueueClient->iWs.Flush(); |
|
3390 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
3391 iTest->SimulateEvent(TRawEvent::ECaseOpen); |
|
3392 TheClient->iWs.Flush(); |
|
3393 User::LeaveIfError(iQueueClient->iWin->WinTreeNode()->EnableOnEvents(EEventControlAlways)); |
|
3394 iTest->SimulateEvent(TRawEvent::ECaseOpen); |
|
3395 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
3396 TheClient->iWs.Flush(); |
|
3397 iQueueClient->iWin->WinTreeNode()->DisableOnEvents(); |
|
3398 AddExpectedEvent(EEventSwitchOn); |
|
3399 AddExpectedEvent(EEventCaseOpened); |
|
3400 AddExpectedEvent(EEventCaseOpened,iQueueClient->iWin); |
|
3401 AddExpectedEvent(EEventCaseOpened); |
|
3402 AddExpectedEvent(EEventSwitchOn,iQueueClient->iWin); |
|
3403 AddExpectedEvent(EEventSwitchOn); |
|
3404 break; |
|
3405 |
|
3406 default: |
|
3407 CActiveScheduler::Stop(); |
|
3408 break; |
|
3409 } |
|
3410 TheClient->iWs.Flush(); |
|
3411 } |
|
3412 |
|
3413 void CTEventTest::VirtualKeyboard_NextSetOfEventsL() |
|
3414 { |
|
3415 const TInt noVirtualKeys=10; |
|
3416 const TInt keyWidth=2*EWinWidth/noVirtualKeys/3; |
|
3417 const TInt keyHeight=EWinHeight/2; |
|
3418 const TInt keySpacing=EWinWidth/noVirtualKeys; |
|
3419 const TInt baseChar='1'; |
|
3420 TInt startX=1; |
|
3421 TInt ii; |
|
3422 switch(iEventSet++) |
|
3423 { |
|
3424 case 0: |
|
3425 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); |
|
3426 for (ii=0;ii<noVirtualKeys;++ii) |
|
3427 { |
|
3428 iQueueClient->iWin->BaseWin()->AddKeyRect(TRect(startX,1,startX+keyWidth,keyHeight),baseChar+ii,EFalse); |
|
3429 startX+=keySpacing; |
|
3430 } |
|
3431 iQueueClient->iWs.Flush(); |
|
3432 iTest->SimulatePointerDownUp(EWinPositionX+1,EWinPositionY+1+iYOffset); |
|
3433 //TheClient->iWs.Flush(); |
|
3434 AddExpectedEvent(EEventFocusGained); |
|
3435 AddExpectedKeyDownUp(baseChar); |
|
3436 break; |
|
3437 case 1: |
|
3438 startX=3; |
|
3439 for (ii=0;ii<noVirtualKeys-2;++ii) //Can't do all 10 as this will overflow the event buffer |
|
3440 { |
|
3441 iTest->SimulatePointerDownUp(startX+EWinPositionX+1,EWinPositionY+keyHeight-1+iYOffset); |
|
3442 AddExpectedKeyDownUp(baseChar+ii); |
|
3443 startX+=keySpacing; |
|
3444 } |
|
3445 break; |
|
3446 case 2: |
|
3447 SimulatePointerDownUpWin(keySpacing+1,1); |
|
3448 //SimulatePointerDownUp(EWinPositionX+keySpacing+1,EWinPositionY+1); |
|
3449 iTest->SimulatePointerDownUp(EWinPositionX+keyWidth,EWinPositionY+1+iYOffset); |
|
3450 iTest->SimulatePointerDownUp(EWinPositionX+1,EWinPositionY+keyHeight-1+iYOffset); |
|
3451 iTest->SimulatePointerDownUp(EWinPositionX+keyWidth,EWinPositionY+keyHeight-1+iYOffset); |
|
3452 AddExpectedKeyDownUp(baseChar+1); |
|
3453 AddExpectedKeyDownUp(baseChar); |
|
3454 AddExpectedKeyDownUp(baseChar); |
|
3455 AddExpectedKeyDownUp(baseChar); |
|
3456 break; |
|
3457 case 3: |
|
3458 SimulatePointerDownUpWin(keySpacing+3,4); |
|
3459 SimulatePointerDownUpWin(0,0); //No Pointer event get through even if there are gaps |
|
3460 SimulatePointerDownUpWin(1,0); |
|
3461 SimulatePointerDownUpWin(0,1); |
|
3462 SimulatePointerDownUpWin(keyWidth+1,0); |
|
3463 SimulatePointerDownUpWin(keyWidth,0); |
|
3464 SimulatePointerDownUpWin(keyWidth+1,1); |
|
3465 SimulatePointerDownUpWin(0,keyHeight); |
|
3466 SimulatePointerDownUpWin(1,keyHeight); |
|
3467 SimulatePointerDownUpWin(0,keyHeight-1); |
|
3468 SimulatePointerDownUpWin(keyWidth+1,keyHeight); |
|
3469 SimulatePointerDownUpWin(keyWidth,keyHeight); |
|
3470 SimulatePointerDownUpWin(keyWidth+1,keyHeight-1); |
|
3471 SimulatePointerDownUpWin(2*keySpacing+3,4); |
|
3472 AddExpectedKeyDownUp(baseChar+1); |
|
3473 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+0)); //No Pointer event get through even if there are gaps |
|
3474 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+1,EWinPositionY+0)); |
|
3475 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+1)); |
|
3476 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+0)); |
|
3477 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth,EWinPositionY+0)); |
|
3478 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+1)); |
|
3479 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+keyHeight)); |
|
3480 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+1,EWinPositionY+keyHeight)); |
|
3481 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+keyHeight-1)); |
|
3482 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+keyHeight)); |
|
3483 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth,EWinPositionY+keyHeight)); |
|
3484 AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+keyHeight-1)); |
|
3485 AddExpectedKeyDownUp(baseChar+2); |
|
3486 break; |
|
3487 case 4: |
|
3488 SimulatePointerWin(TRawEvent::EButton1Down,keySpacing+2,6); |
|
3489 SimulatePointerWin(TRawEvent::EButton1Up,2*keySpacing+1,5); |
|
3490 SimulatePointerWin(TRawEvent::EButton1Down,2*keySpacing+2,7); |
|
3491 SimulatePointer(TRawEvent::EButton1Up,0,0); |
|
3492 AddExpectedKeyDownUp(baseChar+1); |
|
3493 AddExpectedKeyDownUp(baseChar+2); |
|
3494 break; |
|
3495 default: |
|
3496 CActiveScheduler::Stop(); |
|
3497 break; |
|
3498 } |
|
3499 TheClient->iWs.Flush(); |
|
3500 } |
|
3501 |
|
3502 TInt CTEventTest::ClickCommandReply(TInt aCommand,TInt aData) |
|
3503 { |
|
3504 TPckgBuf<TInt> intPkg; |
|
3505 intPkg()=aData; |
|
3506 return iClick.CommandReply(aCommand,intPkg); |
|
3507 } |
|
3508 |
|
3509 TInt CTEventTest::CreateGroupWindow(RWindowGroup& aWinGp,TClients aClient,TInt& aWinGpId) |
|
3510 { |
|
3511 ClickCommandReply(EClickCreateGroupWin,aClient); |
|
3512 TInt err=aWinGp.Construct(ENullWsHandle,EFalse); |
|
3513 if (!err) |
|
3514 { |
|
3515 aWinGpId=aWinGp.Identifier(); |
|
3516 ClickCommandReply(EClickCheckGpWinId,aWinGpId); |
|
3517 } |
|
3518 return err; |
|
3519 } |
|
3520 |
|
3521 void CTEventTest::CloseGroupWindow(RWindowGroup& aWinGp,TInt aWinGpId) |
|
3522 { |
|
3523 ClickCommandReply(EClickCloseGroupWin,aWinGpId); |
|
3524 aWinGp.Close(); |
|
3525 } |
|
3526 |
|
3527 void CTEventTest::CloseWindow(RWindowBase& aWin,TInt aHandle,TInt aWinGpId) |
|
3528 { |
|
3529 TPckgBuf<TWindowCloseData> winClose; |
|
3530 winClose().iClientHandle=aHandle; |
|
3531 winClose().iWindowGroupId=aWinGpId; |
|
3532 iClick.CommandReply(EClickCloseWin,winClose); |
|
3533 aWin.Close(); |
|
3534 } |
|
3535 |
|
3536 /** |
|
3537 @SYMTestCaseID GRAPHICS-WSERV-0447 |
|
3538 |
|
3539 @SYMCR CR1164 |
|
3540 |
|
3541 @SYMTestCaseDesc Tests that Key Click Plug-in gets new event Information |
|
3542 |
|
3543 @SYMTestPriority High |
|
3544 |
|
3545 @SYMTestStatus Implemented |
|
3546 |
|
3547 @SYMTestActions Do things that cause the new events to be sent into plug-in. |
|
3548 Creating destroying windows, pointer events. Provide test plug-in with information it needs to check events. |
|
3549 |
|
3550 @SYMTestExpectedResults When Test Plug-in is querried to see if events match what was expected it says that they were. |
|
3551 */ |
|
3552 void CTEventTest::KeyClicks_NextSetOfEvents() |
|
3553 { |
|
3554 #if defined(LOGGING) |
|
3555 TLogMessageText logMessageText; |
|
3556 _LIT(KSet,"KeyClicks SetOfEvents: %d (last=13)"); |
|
3557 logMessageText.Format(KSet,iEventSet); |
|
3558 INFO_PRINTF1(logMessageText); |
|
3559 #endif |
|
3560 TInt events=-1; |
|
3561 switch(iEventSet++) |
|
3562 { |
|
3563 case 0: |
|
3564 if (SetClickType(EClickCheck)) |
|
3565 return; |
|
3566 iAddToClick=ETrue; |
|
3567 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); |
|
3568 iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse); |
|
3569 AddExpectedEvent(EEventFocusGained); |
|
3570 AddExpectedKeyDownUp(EStdKeySpace,EKeySpace); |
|
3571 iQueueClient->iWs.Flush(); |
|
3572 iTest->SimulateKeyDownUp(EStdKeySpace); //3 events |
|
3573 events=3; |
|
3574 break; |
|
3575 case 1: |
|
3576 AddExpectedKeyDownUp(EStdKeyEnter,EKeyEnter); |
|
3577 AddExpectedKeyDownUp('0'); |
|
3578 AddExpectedKeyDownUp('A','a'); |
|
3579 AddExpectedKeyDownUp('X','x'); |
|
3580 AddExpectedKey(EEventKeyDown,EStdKeyLeftShift,0,0,EModifierLeftShift|EModifierShift); |
|
3581 AddExpectedKey(EEventKeyUp,EStdKeyLeftShift); |
|
3582 iQueueClient->iWs.Flush(); |
|
3583 iTest->SimulateKeyDownUp(EStdKeyEnter); //3 events |
|
3584 iTest->SimulateKeyDownUp('0'); //3 events |
|
3585 iTest->SimulateKeyDownUp('A'); //3 events |
|
3586 iTest->SimulateKeyDownUp('X'); //3 events |
|
3587 iTest->SimulateKeyDownUp(EStdKeyLeftShift); //2 events |
|
3588 events=14; |
|
3589 break; |
|
3590 case 2: |
|
3591 AddExpectedKey(EEventKeyDown,EStdKeyRightShift,0,0,EModifierRightShift|EModifierShift); |
|
3592 AddExpectedKeyDownUp('B','B',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable); |
|
3593 AddExpectedKeyDownUp('W','W',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable); |
|
3594 AddExpectedKey(EEventKeyUp,EStdKeyRightShift); |
|
3595 iQueueClient->iWs.Flush(); |
|
3596 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift); //1 event |
|
3597 iTest->SimulateKeyDownUp('B'); //3 events |
|
3598 iTest->SimulateKeyDownUp('W'); //3 events |
|
3599 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift); //1 event |
|
3600 events=8; |
|
3601 break; |
|
3602 case 3: |
|
3603 AddExpectedKey(EEventKeyDown,'C'); |
|
3604 AddExpectedKey(EEventKey,'C','c'); |
|
3605 AddExpectedKey(EEventKeyDown,'V'); |
|
3606 AddExpectedKey(EEventKey,'V','v'); |
|
3607 AddExpectedKey(EEventKeyUp,'C'); |
|
3608 AddExpectedKey(EEventKeyUp,'V'); |
|
3609 iQueueClient->iWs.Flush(); |
|
3610 iTest->SimulateKey(TRawEvent::EKeyDown,'C'); //2 events |
|
3611 iTest->SimulateKey(TRawEvent::EKeyDown,'V'); //2 events |
|
3612 iTest->SimulateKey(TRawEvent::EKeyUp,'C'); //1 event |
|
3613 iTest->SimulateKey(TRawEvent::EKeyUp,'V'); //1 event |
|
3614 events=6; |
|
3615 break; |
|
3616 case 4: |
|
3617 { |
|
3618 AddExpectedKey(EEventKeyDown,'D'); |
|
3619 AddExpectedKey(EEventKey,'D','d'); |
|
3620 AddExpectedKey(EEventKey,'D','d',1); |
|
3621 AddExpectedKey(EEventKeyUp,'D'); |
|
3622 iQueueClient->iWs.Flush(); |
|
3623 iTest->SimulateKey(TRawEvent::EKeyDown,'D'); //2 events |
|
3624 TTimeIntervalMicroSeconds32 initialTime,time; |
|
3625 TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); |
|
3626 User::After(initialTime.Int()+time.Int()/4); //1 event |
|
3627 iTest->SimulateKey(TRawEvent::EKeyUp,'D'); //1 event |
|
3628 events=4; |
|
3629 } |
|
3630 break; |
|
3631 case 5: |
|
3632 AddExpectedPointerDownUpScr(TPoint(40,25)); |
|
3633 AddExpectedPointerDownUpScr(TPoint(95,30)); |
|
3634 AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(20-EWinPositionX,50-EWinPositionY)); |
|
3635 AddExpectedPointer(TPointerEvent::EDrag,TPoint(45-EWinPositionX,42-EWinPositionY)); |
|
3636 AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(45-EWinPositionX,42-EWinPositionY)); |
|
3637 AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(98-EWinPositionX,15-EWinPositionY)); |
|
3638 AddExpectedPointerClick(TPointerEvent::EDrag,TPoint(68-EWinPositionX,39-EWinPositionY)); |
|
3639 AddExpectedPointer(TPointerEvent::EDrag,TPoint(41-EWinPositionX,42-EWinPositionY)); |
|
3640 AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(50-EWinPositionX,58-EWinPositionY)); |
|
3641 iQueueClient->iWs.Flush(); |
|
3642 iTest->SimulatePointerDownUp(40,25+iYOffset); //2 events |
|
3643 iTest->SimulatePointerDownUp(95,30+iYOffset); //2 events |
|
3644 SimulatePointer(TRawEvent::EButton1Down,20,50); //1 event |
|
3645 SimulatePointer(TRawEvent::EPointerMove,45,42); //1 event |
|
3646 SimulatePointer(TRawEvent::EButton1Up,45,42); //1 event |
|
3647 SimulatePointer(TRawEvent::EButton1Down,98,15); //1 event |
|
3648 SimulatePointer(TRawEvent::EPointerMove,68,39); //1 event |
|
3649 SimulatePointer(TRawEvent::EPointerMove,41,42); //1 event |
|
3650 SimulatePointer(TRawEvent::EButton1Up,50,58); //1 event |
|
3651 events=11; |
|
3652 break; |
|
3653 case 6: |
|
3654 AddExpectedKey(EEventKeyDown,'E'); |
|
3655 AddExpectedKey(EEventKey,'E','e'); |
|
3656 AddExpectedPointerDownUpScr(TPoint(41,24)); |
|
3657 AddExpectedKey(EEventKeyUp,'E'); |
|
3658 AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(23-EWinPositionX,52-EWinPositionY)); |
|
3659 AddExpectedKeyDownUp('1'); |
|
3660 AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(44-EWinPositionX,45-EWinPositionY)); |
|
3661 AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(33-EWinPositionX,53-EWinPositionY)); |
|
3662 AddExpectedKey(EEventKeyDown,'F'); |
|
3663 AddExpectedKey(EEventKey,'F','f'); |
|
3664 AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(34-EWinPositionX,47-EWinPositionY)); |
|
3665 AddExpectedKey(EEventKeyUp,'F'); |
|
3666 iQueueClient->iWs.Flush(); |
|
3667 iTest->SimulateKey(TRawEvent::EKeyDown,'E'); //2 events |
|
3668 iTest->SimulatePointerDownUp(41,24+iYOffset); //2 events |
|
3669 iTest->SimulateKey(TRawEvent::EKeyUp,'E'); //1 event |
|
3670 SimulatePointer(TRawEvent::EButton1Down,23,52); //1 event |
|
3671 iTest->SimulateKeyDownUp('1'); //3 events |
|
3672 SimulatePointer(TRawEvent::EButton1Up,44,45); //1 event |
|
3673 SimulatePointer(TRawEvent::EButton1Down,33,53); //1 event |
|
3674 iTest->SimulateKey(TRawEvent::EKeyDown,'F'); //2 events |
|
3675 SimulatePointer(TRawEvent::EButton1Up,34,47); //1 event |
|
3676 iTest->SimulateKey(TRawEvent::EKeyUp,'F'); //1 event |
|
3677 events=15; |
|
3678 break; |
|
3679 case 7: |
|
3680 AddExpectedKeyDownUp('2'); |
|
3681 iAddToClick=EFalse; |
|
3682 AddExpectedKeyDownUp('G','g'); |
|
3683 iAddToClick=ETrue; |
|
3684 AddExpectedPointerDownUpScr(TPoint(42,26)); |
|
3685 AddExpectedKeyDownUp('U','u'); |
|
3686 iQueueClient->iWs.Flush(); |
|
3687 iTest->SimulateKeyDownUp('2'); //3 events |
|
3688 TheClient->iWs.Flush(); |
|
3689 iQueueClient->iGroup->GroupWin()->DisableKeyClick(ETrue); |
|
3690 iQueueClient->iWs.Flush(); |
|
3691 iTest->SimulateKeyDownUp('G'); |
|
3692 iTest->SimulatePointerDownUp(42,26+iYOffset); //2 events |
|
3693 TheClient->iWs.Flush(); |
|
3694 iQueueClient->iGroup->GroupWin()->DisableKeyClick(EFalse); |
|
3695 iQueueClient->iWs.Flush(); |
|
3696 iTest->SimulateKeyDownUp('U'); //3 events |
|
3697 events=8; |
|
3698 break; |
|
3699 case 8: |
|
3700 { |
|
3701 TPckgBuf<TPointerEventInfo> pointerEventInfo; |
|
3702 pointerEventInfo().iClientHandle=reinterpret_cast<TInt>(iQueueClient->iChildWin); |
|
3703 pointerEventInfo().iWinGpId=iQueueClient->iGroup->GroupWin()->Identifier(); |
|
3704 pointerEventInfo().iWinOrigin=iQueueClient->ChildTopLeft(); |
|
3705 pointerEventInfo().iParentOrigin.SetXY(EWinPositionX,EWinPositionY); |
|
3706 iClick.CommandReply(EClickPointerEvent,pointerEventInfo); |
|
3707 AddExpectedKeyDownUp('3'); |
|
3708 AddExpectedPointerDownUpScr(TPoint(43,26)); |
|
3709 AddExpectedKeyDownUp('H','h'); |
|
3710 iAddToClick=EFalse; |
|
3711 AddExpectedPointerDownUpScr(TPoint(43,27)); |
|
3712 AddExpectedKeyDownUp('4'); |
|
3713 AddExpectedPointerDownUpScr(TPoint(42,27)); |
|
3714 AddExpectedKeyDownUp('I','i'); |
|
3715 iAddToClick=ETrue; |
|
3716 AddExpectedPointerDownUpScr(TPoint(44,27)); |
|
3717 AddExpectedKeyDownUp('5'); |
|
3718 AddExpectedPointerDownUpScr(TPoint(44,26)); |
|
3719 iQueueClient->iWs.Flush(); |
|
3720 iTest->SimulateKeyDownUp('3'); //3 events |
|
3721 iTest->SimulatePointerDownUp(43,26+iYOffset); //2 events |
|
3722 iClick.SetPenClick(EFalse); |
|
3723 iTest->SimulateKeyDownUp('H'); //3 events |
|
3724 iTest->SimulatePointerDownUp(43,27+iYOffset); |
|
3725 iClick.SetKeyClick(EFalse); |
|
3726 iTest->SimulateKeyDownUp('4'); |
|
3727 iTest->SimulatePointerDownUp(42,27+iYOffset); |
|
3728 iClick.SetPenClick(ETrue); |
|
3729 iTest->SimulateKeyDownUp('I'); |
|
3730 iTest->SimulatePointerDownUp(44,27+iYOffset); //2 events |
|
3731 iClick.SetKeyClick(ETrue); |
|
3732 iTest->SimulateKeyDownUp('5'); //3 events |
|
3733 iTest->SimulatePointerDownUp(44,26+iYOffset); //2 events |
|
3734 pointerEventInfo().iClientHandle=0; |
|
3735 pointerEventInfo().iWinGpId=0; |
|
3736 iClick.CommandReply(EClickPointerEvent,pointerEventInfo); |
|
3737 events=15; |
|
3738 } |
|
3739 break; |
|
3740 case 9: |
|
3741 { |
|
3742 RWindowGroup winGp(iQueueClient->iWs); |
|
3743 TInt winGpId; |
|
3744 TInt ii; |
|
3745 AddExpectedEvent(EEventWindowGroupsChanged); |
|
3746 for (ii=0;ii<2;++ii) //events x2 |
|
3747 { |
|
3748 if (CreateGroupWindow(winGp,EQueueClient,winGpId)) //1 event |
|
3749 Failed(); |
|
3750 CloseGroupWindow(winGp,winGpId); //1 event |
|
3751 iQueueClient->iWs.Flush(); |
|
3752 } |
|
3753 events=4; |
|
3754 } |
|
3755 break; |
|
3756 case 10: |
|
3757 { |
|
3758 RWindowGroup winGp(TheClient->iWs); |
|
3759 RWindowGroup winGp1(iQueueClient->iWs); |
|
3760 RWindowGroup winGp2(iQueueClient->iWs); |
|
3761 TInt winGpId; |
|
3762 TInt winGpId1; |
|
3763 TInt winGpId2; |
|
3764 AddExpectedEvent(EEventWindowGroupsChanged); |
|
3765 if (CreateGroupWindow(winGp,ETheClient,winGpId)) //1 event |
|
3766 Failed(); |
|
3767 CloseGroupWindow(winGp,winGpId); //1 event |
|
3768 TheClient->iWs.Flush(); |
|
3769 if (CreateGroupWindow(winGp1,EQueueClient,winGpId1)) //1 event |
|
3770 Failed(); |
|
3771 if (CreateGroupWindow(winGp2,EQueueClient,winGpId2)) //1 event |
|
3772 Failed(); |
|
3773 if (CreateGroupWindow(winGp,ETheClient,winGpId)) //1 event |
|
3774 Failed(); |
|
3775 CloseGroupWindow(winGp2,winGpId2); //1 event |
|
3776 iQueueClient->iWs.Flush(); |
|
3777 CloseGroupWindow(winGp,winGpId); //1 event |
|
3778 TheClient->iWs.Flush(); |
|
3779 CloseGroupWindow(winGp1,winGpId1); //1 event |
|
3780 iQueueClient->iWs.Flush(); |
|
3781 events=8; |
|
3782 } |
|
3783 break; |
|
3784 case 11: |
|
3785 { |
|
3786 RWindowGroup winGp(iQueueClient->iWs); |
|
3787 TInt winGpId; |
|
3788 AddExpectedEvent(EEventWindowGroupsChanged); |
|
3789 if (CreateGroupWindow(winGp,EQueueClient,winGpId)) //1 event |
|
3790 Failed(); |
|
3791 RWindow win(iQueueClient->iWs); |
|
3792 const TInt handle=79; |
|
3793 if (win.Construct(winGp,handle)) |
|
3794 Failed(); |
|
3795 win.Activate(); |
|
3796 CloseWindow(win,handle,winGpId); //1 event |
|
3797 iQueueClient->iWs.Flush(); |
|
3798 CloseGroupWindow(winGp,winGpId); //1 event |
|
3799 iQueueClient->iWs.Flush(); |
|
3800 events=3; |
|
3801 } |
|
3802 break; |
|
3803 case 12: |
|
3804 { |
|
3805 RWindowGroup winGp1(iQueueClient->iWs); |
|
3806 RWindowGroup winGp2(TheClient->iWs); |
|
3807 TInt winGpId1; |
|
3808 TInt winGpId2; |
|
3809 AddExpectedEvent(EEventWindowGroupsChanged); |
|
3810 if (CreateGroupWindow(winGp2,ETheClient,winGpId2)) //1 event |
|
3811 Failed(); |
|
3812 if (CreateGroupWindow(winGp1,EQueueClient,winGpId1)) //1 event |
|
3813 Failed(); |
|
3814 RWindow win1(iQueueClient->iWs); |
|
3815 RWindow win2(iQueueClient->iWs); |
|
3816 RWindow win(TheClient->iWs); |
|
3817 const TInt handle1a=80; |
|
3818 const TInt handle1b=81; |
|
3819 const TInt handle2a=82; |
|
3820 const TInt handle2b=83; |
|
3821 const TInt handle=84; |
|
3822 if (win1.Construct(winGp1,handle1a)) |
|
3823 Failed(); |
|
3824 win1.Activate(); |
|
3825 if (win2.Construct(win1,handle2a)) |
|
3826 Failed(); |
|
3827 win2.Activate(); |
|
3828 if (win.Construct(winGp2,handle)) |
|
3829 Failed(); |
|
3830 win.Activate(); |
|
3831 CloseWindow(win2,handle2a,winGpId1); //1 event |
|
3832 iQueueClient->iWs.Flush(); |
|
3833 if (win2.Construct(winGp1,handle2b)) |
|
3834 Failed(); |
|
3835 win2.Activate(); |
|
3836 CloseWindow(win1,handle1a,winGpId1); //1 event |
|
3837 iQueueClient->iWs.Flush(); |
|
3838 CloseWindow(win,handle,winGpId2); //1 event |
|
3839 TheClient->iWs.Flush(); |
|
3840 if (win1.Construct(win2,handle1b)) |
|
3841 Failed(); |
|
3842 win1.Activate(); |
|
3843 CloseWindow(win1,handle1b,winGpId1); //1 event |
|
3844 iQueueClient->iWs.Flush(); |
|
3845 CloseGroupWindow(winGp2,winGpId2); //1 event |
|
3846 TheClient->iWs.Flush(); |
|
3847 CloseWindow(win2,handle2b,winGpId1); //1 event |
|
3848 iQueueClient->iWs.Flush(); |
|
3849 CloseGroupWindow(winGp1,winGpId1); //1 event |
|
3850 iQueueClient->iWs.Flush(); |
|
3851 events=9; |
|
3852 } |
|
3853 break; |
|
3854 case 13: |
|
3855 { |
|
3856 TPckgBuf<TPointerEventInfo> pointerEventInfo; |
|
3857 pointerEventInfo().iClientHandle=reinterpret_cast<TInt>(iQueueClient->iWin); |
|
3858 pointerEventInfo().iWinGpId=iQueueClient->iGroup->GroupWin()->Identifier(); |
|
3859 pointerEventInfo().iWinOrigin.SetXY(EWinPositionX,EWinPositionY); |
|
3860 pointerEventInfo().iParentOrigin.SetXY(0,0); |
|
3861 iClick.CommandReply(EClickPointerEvent,pointerEventInfo); |
|
3862 AddExpectedPointerDownUpScr(TPoint(43,18)); |
|
3863 AddExpectedPointerDownUpScr(TPoint(43,17)); |
|
3864 AddExpectedPointerDownUpScr(TPoint(42,52)); |
|
3865 AddExpectedPointerDownUpScr(TPoint(24,27)); |
|
3866 AddExpectedPointerDownUpScr(TPoint(94,26)); |
|
3867 iQueueClient->iWs.Flush(); |
|
3868 iTest->SimulatePointerDownUp(43,18+iYOffset); //2 events |
|
3869 iTest->SimulatePointerDownUp(43,17+iYOffset); //2 events |
|
3870 iTest->SimulatePointerDownUp(42,52+iYOffset); //2 events |
|
3871 iTest->SimulatePointerDownUp(24,27+iYOffset); //2 events |
|
3872 iTest->SimulatePointerDownUp(94,26+iYOffset); //2 events |
|
3873 pointerEventInfo().iClientHandle=0; |
|
3874 pointerEventInfo().iWinGpId=0; |
|
3875 iClick.CommandReply(EClickPointerEvent,pointerEventInfo); |
|
3876 events=10; |
|
3877 } |
|
3878 break; |
|
3879 default: |
|
3880 iAddToClick=EFalse; |
|
3881 if (!SetClickType(EClickNone)) |
|
3882 CActiveScheduler::Stop(); |
|
3883 return; |
|
3884 } |
|
3885 TInt failedAt=iClick.CommandReply(EClickFailed,TPtrC8(NULL,0)); |
|
3886 TInt eventsDone=iClick.CommandReply(EClickEvents,TPtrC8(NULL,0)); |
|
3887 if (failedAt!=0 || eventsDone!=events) //iEventSet (already incremented) |
|
3888 { |
|
3889 #if defined(LOGGING) |
|
3890 _LIT(KeyClickFailed,"KeyClick Failed EventSet=%d FailedAt=%d TotalEvents=%d EventsDone=%d"); |
|
3891 logMessageText.Format(KeyClickFailed,iEventSet-1,failedAt,events,eventsDone); |
|
3892 INFO_PRINTF1(logMessageText); |
|
3893 #endif |
|
3894 Failed(); |
|
3895 } |
|
3896 iClick.CommandReply(EClickReset,TPtrC8(NULL,0)); |
|
3897 } |
|
3898 |
|
3899 void CTEventTest::CaptureLong_NextSetOfEventsL() |
|
3900 { |
|
3901 #if defined(LOGGING) |
|
3902 TLogMessageText logMessageText; |
|
3903 _LIT(KSet,"CaptureLong SetOfEvents: %d of 23"); |
|
3904 logMessageText.Format(KSet,iEventSet); |
|
3905 INFO_PRINTF1(logMessageText); |
|
3906 #endif |
|
3907 |
|
3908 switch(iEventSet++) |
|
3909 { |
|
3910 case 0: |
|
3911 iQueueClient->iWs.Flush(); |
|
3912 iTest->SimulateKeyDownUp('A'); |
|
3913 AddExpectedEvent(EEventFocusGained); |
|
3914 AddExpectedKeyDownUp('A','a'); |
|
3915 break; |
|
3916 case 1: |
|
3917 // Test CaptureLongKey() with modifier value EModifierShift and flag value ELongCaptureNormal |
|
3918 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',EModifierShift,EModifierShift,2,ELongCaptureNormal); |
|
3919 iQueueClient->iWs.Flush(); |
|
3920 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift); |
|
3921 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
3922 TheClient->iWs.Flush(); |
|
3923 DelayForRepeatEvents(1, 3); |
|
3924 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
3925 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift); |
|
3926 AddExpectedKey(EEventKeyDown,EStdKeyLeftShift); |
|
3927 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
3928 AddExpectedKey(EEventKey,EStdKeySpace,' ',0,EModifierLeftShift|EModifierShift|EModifierAutorepeatable); |
|
3929 AddExpectedKey(EEventKey,EStdKeySpace,'a',1,EModifierLongKey|EModifierLeftShift|EModifierShift|EModifierAutorepeatable); |
|
3930 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
3931 AddExpectedKey(EEventKeyUp,EStdKeyLeftShift); |
|
3932 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
3933 break; |
|
3934 case 2: |
|
3935 // Test CaptureLongKey() with modifier value EModifierFunc and flag value ELongCaptureWaitShort |
|
3936 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc,EModifierFunc,2,ELongCaptureWaitShort); |
|
3937 iQueueClient->iWs.Flush(); |
|
3938 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc); |
|
3939 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter); |
|
3940 TheClient->iWs.Flush(); |
|
3941 DelayForRepeatEvents(1, 3); |
|
3942 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter); |
|
3943 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc); |
|
3944 iTest->SimulateKeyDownUp(EStdKeySpace); |
|
3945 AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc); |
|
3946 AddExpectedKey(EEventKeyDown,EStdKeyEnter); |
|
3947 AddExpectedKey(EEventKey,EStdKeyEnter,'a',1,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierAutorepeatable); |
|
3948 AddExpectedKey(EEventKeyUp,EStdKeyEnter); |
|
3949 AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc); |
|
3950 AddExpectedKeyDownUp(EStdKeySpace,' '); |
|
3951 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
3952 break; |
|
3953 case 3: |
|
3954 // Test CaptureLongKey() with modifier values EModifierFunc|EModifierAlt and flag values ELongCaptureNormal|ELongCaptureRepeatEvents) |
|
3955 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc|EModifierAlt,EModifierFunc|EModifierAlt,2,ELongCaptureNormal|ELongCaptureRepeatEvents); |
|
3956 iQueueClient->iWs.Flush(); |
|
3957 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc); |
|
3958 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftAlt); |
|
3959 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter); |
|
3960 TheClient->iWs.Flush(); |
|
3961 DelayForRepeatEvents(5, 1); |
|
3962 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter); |
|
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); |
|
3973 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
3974 break; |
|
3975 case 4: |
|
3976 iQueueClient->iWs.Flush(); |
|
3977 iTest->SimulateKey(TRawEvent::EKeyDown,'Z'); |
|
3978 TheClient->iWs.Flush(); |
|
3979 DelayForRepeatEvents(3, 1); |
|
3980 iTest->SimulateKey(TRawEvent::EKeyDown,'Y'); |
|
3981 TheClient->iWs.Flush(); |
|
3982 DelayForRepeatEvents(2, 1); |
|
3983 iTest->SimulateKey(TRawEvent::EKeyUp,'Z'); |
|
3984 iTest->SimulateKey(TRawEvent::EKeyUp,'Y'); |
|
3985 AddExpectedKey(EEventKeyDown,'Z'); |
|
3986 AddExpectedKey(EEventKey,'Z','z'); |
|
3987 AddExpectedKey(EEventKey,'Z','z',1); |
|
3988 AddExpectedKey(EEventKeyDown,'Y'); |
|
3989 AddExpectedKey(EEventKey,'Y','y'); |
|
3990 AddExpectedKey(EEventKey,'Y','y',1); |
|
3991 AddExpectedKey(EEventKeyUp,'Z'); |
|
3992 AddExpectedKey(EEventKeyUp,'Y'); |
|
3993 break; |
|
3994 case 5: |
|
3995 iQueueClient->iWs.Flush(); |
|
3996 iTest->SimulateKey(TRawEvent::EKeyDown,'Z'); |
|
3997 TheClient->iWs.Flush(); |
|
3998 DelayForRepeatEvents(3, 1); |
|
3999 iTest->SimulateKey(TRawEvent::EKeyDown,'Y'); |
|
4000 TheClient->iWs.Flush(); |
|
4001 DelayForRepeatEvents(5, 2); |
|
4002 iTest->SimulateKey(TRawEvent::EKeyUp,'Y'); |
|
4003 TheClient->iWs.Flush(); |
|
4004 DelayForRepeatEvents(2, 1); |
|
4005 iTest->SimulateKey(TRawEvent::EKeyUp,'Z'); |
|
4006 AddExpectedKey(EEventKeyDown,'Z'); |
|
4007 AddExpectedKey(EEventKey,'Z','z'); |
|
4008 AddExpectedKey(EEventKey,'Z','z',1); |
|
4009 AddExpectedKey(EEventKeyDown,'Y'); |
|
4010 AddExpectedKey(EEventKey,'Y','y'); |
|
4011 AddExpectedKey(EEventKey,'Y','y',1); |
|
4012 AddExpectedKey(EEventKeyUp,'Y'); |
|
4013 AddExpectedKey(EEventKey,'Z','z',1); |
|
4014 AddExpectedKey(EEventKeyUp,'Z'); |
|
4015 break; |
|
4016 case 6: |
|
4017 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal); |
|
4018 iQueueClient->iWs.Flush(); |
|
4019 iTest->SimulateKey(TRawEvent::EKeyDown,'X'); |
|
4020 TheClient->iWs.Flush(); |
|
4021 DelayForRepeatEvents(3, 1); |
|
4022 iTest->SimulateKeyDownUp(EStdKeySpace); |
|
4023 TheClient->iWs.Flush(); |
|
4024 if(!iTest->IsFullRomL()) |
|
4025 { |
|
4026 DelayForRepeatEvents(2, 1); |
|
4027 } |
|
4028 iTest->SimulateKey(TRawEvent::EKeyUp,'X'); |
|
4029 AddExpectedKey(EEventKeyDown,'X'); |
|
4030 AddExpectedKey(EEventKey,'X','x'); |
|
4031 AddExpectedKey(EEventKey,'X','x',1); |
|
4032 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
4033 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
4034 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
4035 if(!iTest->IsFullRomL()) |
|
4036 { |
|
4037 AddExpectedKey(EEventKey,'X','x',1); |
|
4038 } |
|
4039 AddExpectedKey(EEventKeyUp,'X'); |
|
4040 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
4041 break; |
|
4042 case 7: |
|
4043 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); |
|
4044 iQueueClient->iWs.Flush(); |
|
4045 iTest->SimulateKey(TRawEvent::EKeyDown,'X'); |
|
4046 TheClient->iWs.Flush(); |
|
4047 DelayForRepeatEvents(5, 1); |
|
4048 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
4049 TheClient->iWs.Flush(); |
|
4050 DelayForRepeatEvents(1, 3); |
|
4051 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
4052 TheClient->iWs.Flush(); |
|
4053 User::ResetInactivityTime(); |
|
4054 DelayForRepeatEvents(4, 1); |
|
4055 iTest->SimulateKey(TRawEvent::EKeyUp,'X'); |
|
4056 AddExpectedKey(EEventKeyDown,'X'); |
|
4057 AddExpectedKey(EEventKey,'X','x'); |
|
4058 AddExpectedKey(EEventKey,'X','x',1); |
|
4059 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
4060 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
4061 AddExpectedKey(EEventKey,EStdKeySpace,'b',1); |
|
4062 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
4063 AddExpectedKey(EEventKey,'X','x',1); |
|
4064 AddExpectedKey(EEventKeyUp,'X'); |
|
4065 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
4066 break; |
|
4067 case 8: |
|
4068 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','c',0,0,2,ELongCaptureRepeatEvents); |
|
4069 iQueueClient->iWs.Flush(); |
|
4070 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
4071 TheClient->iWs.Flush(); |
|
4072 DelayForRepeatEvents(5, 1); |
|
4073 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
4074 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
4075 AddExpectedKey(EEventKey,EStdKeySpace,'c',1); |
|
4076 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
4077 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
4078 break; |
|
4079 case 9: |
|
4080 { |
|
4081 TInt captureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEscape,'e',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); |
|
4082 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','d',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); |
|
4083 iQueueClient->iWs.Flush(); |
|
4084 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
4085 TheClient->iWs.Flush(); |
|
4086 DelayForRepeatEvents(5, 2); |
|
4087 iTest->SimulateKeyDownUp(EStdKeyEscape); |
|
4088 TheClient->iWs.Flush(); |
|
4089 DelayForRepeatEvents(3, 1); |
|
4090 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
4091 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
4092 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
4093 AddExpectedKey(EEventKey,EStdKeySpace,'d',1); |
|
4094 AddExpectedKey(EEventKeyDown,EStdKeyEscape); |
|
4095 AddExpectedKey(EEventKey,EStdKeyEscape,EKeyEscape); |
|
4096 AddExpectedKey(EEventKeyUp,EStdKeyEscape); |
|
4097 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
4098 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
4099 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(captureKey); |
|
4100 } |
|
4101 break; |
|
4102 case 10: |
|
4103 //Cancel a long capture key event whilst a repeat is underway |
|
4104 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); |
|
4105 iQueueClient->iWs.Flush(); |
|
4106 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
4107 TheClient->iWs.Flush(); |
|
4108 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
4109 DelayForRepeatEvents(5, 1); |
|
4110 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
4111 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
4112 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
4113 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
4114 break; |
|
4115 case 11: |
|
4116 // Cancel a key up/down capture whilst a repeat is underway. |
|
4117 // This should have no effect since only key press events are |
|
4118 // repeated. |
|
4119 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns('X',0,0); |
|
4120 iQueueClient->iWs.Flush(); |
|
4121 iTest->SimulateKey(TRawEvent::EKeyDown,'X'); |
|
4122 TheClient->iWs.Flush(); |
|
4123 iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey); |
|
4124 DelayForRepeatEvents(5, 1); |
|
4125 iTest->SimulateKey(TRawEvent::EKeyUp,'X'); |
|
4126 AddExpectedKey(EEventKeyDown,'X'); |
|
4127 AddExpectedKey(EEventKey,'X','x'); |
|
4128 AddExpectedKey(EEventKey,'X','x',2); |
|
4129 AddExpectedKey(EEventKeyUp,'X'); |
|
4130 break; |
|
4131 case 12: |
|
4132 //Cancel a capture key event whilst a repeat is underway |
|
4133 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('y',0,0); |
|
4134 iQueueClient->iWs.Flush(); |
|
4135 iTest->SimulateKey(TRawEvent::EKeyDown,'Y'); |
|
4136 TheClient->iWs.Flush(); |
|
4137 iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); |
|
4138 DelayForRepeatEvents(5, 1); |
|
4139 iTest->SimulateKey(TRawEvent::EKeyUp,'Y'); |
|
4140 AddExpectedKey(EEventKeyDown,'Y'); |
|
4141 AddExpectedKey(EEventKey,'Y','y'); |
|
4142 AddExpectedKey(EEventKeyUp,'Y'); |
|
4143 break; |
|
4144 case 13: |
|
4145 //Variation on case 12 i.e. change in the timing of the CancelCaptureKey call |
|
4146 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('z',0,0); |
|
4147 iQueueClient->iWs.Flush(); |
|
4148 iTest->SimulateKey(TRawEvent::EKeyDown,'Z'); |
|
4149 TheClient->iWs.Flush(); |
|
4150 DelayForRepeatEvents(5, 2); |
|
4151 iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); |
|
4152 DelayForRepeatEvents(5, 2); |
|
4153 iTest->SimulateKey(TRawEvent::EKeyUp,'Z'); |
|
4154 AddExpectedKey(EEventKeyDown,'Z'); |
|
4155 AddExpectedKey(EEventKey,'Z','z'); |
|
4156 AddExpectedKey(EEventKey,'Z','z',2); |
|
4157 AddExpectedKey(EEventKeyUp,'Z'); |
|
4158 break; |
|
4159 case 14: |
|
4160 { |
|
4161 // Cancel long capture key event when normal capture key is scheduled for different |
|
4162 // window group. |
|
4163 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal); |
|
4164 TInt shortCaptKey = TheClient->iGroup->GroupWin()->CaptureKey(' ',0,0); |
|
4165 |
|
4166 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
4167 TheClient->iWs.Flush(); |
|
4168 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
4169 DelayForRepeatEvents(1, 3); |
|
4170 |
|
4171 TheClient->iGroup->GroupWin()->CancelCaptureKey(shortCaptKey); |
|
4172 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
4173 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
4174 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
4175 } |
|
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; |
|
4303 default: |
|
4304 CActiveScheduler::Stop(); |
|
4305 break; |
|
4306 } |
|
4307 TheClient->iWs.Flush(); |
|
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 |
|
4788 |
|
4789 #define PASSWORD_START_OF_DAY 4 |
|
4790 void CTEventTest::Password_NextSetOfEvents() |
|
4791 { |
|
4792 switch(iEventSet++) |
|
4793 { |
|
4794 case 0: |
|
4795 iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordAlwaysTriggerNow); |
|
4796 iQueueClient->iWs.PasswordEntered(); |
|
4797 iTest->SimulateKeyDownUp('2'); |
|
4798 iQueueClient->iWs.Flush(); |
|
4799 AddExpectedEvent(EEventFocusGained); |
|
4800 AddExpectedEvent(EEventPassword); |
|
4801 AddExpectedKeyDownUp('2'); |
|
4802 break; |
|
4803 case 1: |
|
4804 iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADayTriggerNow); |
|
4805 iQueueClient->iWs.PasswordEntered(); |
|
4806 iTest->SimulateKeyDownUp('3'); |
|
4807 iQueueClient->iWs.Flush(); |
|
4808 AddExpectedEvent(EEventPassword); |
|
4809 AddExpectedKeyDownUp('3'); |
|
4810 break; |
|
4811 case 2: |
|
4812 { |
|
4813 TTime time; |
|
4814 time.HomeTime(); |
|
4815 TInt day=time.DayNoInMonth(); |
|
4816 if (day==0) |
|
4817 day=5; |
|
4818 time-=TTimeIntervalDays(day); |
|
4819 time+=TTimeIntervalHours(PASSWORD_START_OF_DAY); |
|
4820 User::SetHomeTime(time); |
|
4821 iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADayTriggerNow); |
|
4822 iQueueClient->iWs.PasswordEntered(); |
|
4823 iTest->SimulateKeyDownUp('3'); |
|
4824 iQueueClient->iWs.Flush(); |
|
4825 AddExpectedEvent(EEventPassword); |
|
4826 AddExpectedKeyDownUp('3'); |
|
4827 time+=TTimeIntervalDays(day); |
|
4828 time-=TTimeIntervalHours(PASSWORD_START_OF_DAY); |
|
4829 User::SetHomeTime(time); |
|
4830 } |
|
4831 break; |
|
4832 case 3: |
|
4833 { |
|
4834 TTime time; |
|
4835 time.HomeTime(); |
|
4836 TInt day=time.DayNoInMonth(); |
|
4837 time-=TTimeIntervalDays(day); |
|
4838 time+=TTimeIntervalHours(PASSWORD_START_OF_DAY); |
|
4839 User::SetHomeTime(time); |
|
4840 iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADay); |
|
4841 iQueueClient->iWs.PasswordEntered(); |
|
4842 iTest->SimulateEvent(TRawEvent::ESwitchOn); |
|
4843 iTest->SimulateKeyDownUp('3'); |
|
4844 iQueueClient->iWs.Flush(); |
|
4845 AddExpectedEvent(EEventPassword); |
|
4846 AddExpectedEvent(EEventSwitchOn); |
|
4847 AddExpectedKeyDownUp('3'); |
|
4848 time+=TTimeIntervalDays(day); |
|
4849 time-=TTimeIntervalHours(PASSWORD_START_OF_DAY); |
|
4850 User::SetHomeTime(time); |
|
4851 } |
|
4852 break; |
|
4853 default: |
|
4854 CActiveScheduler::Stop(); |
|
4855 break; |
|
4856 } |
|
4857 TheClient->iWs.Flush(); |
|
4858 } |
|
4859 |
|
4860 void CTEventTest::GroupListChanged_NextSetOfEventsL() |
|
4861 { |
|
4862 _LIT(WindowGroup1,"WindowGroupName1"); |
|
4863 _LIT(WindowGroup2,"WindowGroupName2"); |
|
4864 switch(iEventSet++) |
|
4865 { |
|
4866 case 0: |
|
4867 { |
|
4868 _LIT(TestGroup3,"GroupListEvents3"); |
|
4869 iQueueClient->EnableGroupListChangeEvents(); |
|
4870 iEventTestGroup3=new(ELeave) CTWindowGroup(TheClient); |
|
4871 iEventTestGroup3->ConstructL(); |
|
4872 iEventTestGroup3->GroupWin()->SetName(TestGroup3); |
|
4873 AddExpectedEvent(EEventFocusGained); |
|
4874 AddExpectedEvent(EEventFocusLost); |
|
4875 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4876 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4877 } |
|
4878 break; |
|
4879 case 1: |
|
4880 { |
|
4881 _LIT(TestGroup4,"GroupListEvents4"); |
|
4882 iEventTestGroup4=new(ELeave) CTWindowGroup(TheClient); |
|
4883 iEventTestGroup4->ConstructL(); |
|
4884 iEventTestGroup4->GroupWin()->SetName(TestGroup4); |
|
4885 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4886 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4887 } |
|
4888 break; |
|
4889 case 2: |
|
4890 iEventTestGroup3->GroupWin()->SetOrdinalPosition(0); |
|
4891 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4892 break; |
|
4893 case 3: |
|
4894 iEventTestGroup3->GroupWin()->SetOrdinalPosition(999); |
|
4895 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4896 break; |
|
4897 case 4: |
|
4898 iEventTestGroup4->GroupWin()->SetOrdinalPosition(999); |
|
4899 AddExpectedEvent(EEventFocusGained); |
|
4900 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4901 // Testcase for defect INC135635 |
|
4902 // Since iWin has OrdinalPosition Zero (the front) clicking on it won't generate an |
|
4903 // EEventWindowGroupListChanged event as there is no change in the order of the windows |
|
4904 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,11-EWinPositionY)); |
|
4905 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,11-EWinPositionY)); |
|
4906 SimulatePointer(TRawEvent::EButton1Down,20,11); |
|
4907 SimulatePointer(TRawEvent::EButton1Up,20,11); |
|
4908 break; |
|
4909 case 5: |
|
4910 iEventTestGroup3->GroupWin()->SetOrdinalPosition(999); |
|
4911 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4912 break; |
|
4913 case 6: |
|
4914 iEventTestGroup3->GroupWin()->SetOrdinalPosition(99); |
|
4915 SimulatePointer(TRawEvent::EButton1Down,20,11); |
|
4916 iEventTestGroup3->GroupWin()->SetName(WindowGroup1); |
|
4917 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,11-EWinPositionY)); |
|
4918 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4919 break; |
|
4920 case 7: |
|
4921 iEventTestGroup3->GroupWin()->SetName(WindowGroup2); |
|
4922 SimulatePointer(TRawEvent::EButton1Up,10,20); |
|
4923 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4924 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY)); |
|
4925 break; |
|
4926 case 8: |
|
4927 iEventTestGroup3->GroupWin()->SetName(WindowGroup1); |
|
4928 SimulatePointer(TRawEvent::EButton2Down,20,30); |
|
4929 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4930 AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(20-EWinPositionX,30-EWinPositionY)); |
|
4931 break; |
|
4932 case 9: |
|
4933 SimulatePointer(TRawEvent::EButton1Up,15,15); |
|
4934 iEventTestGroup3->GroupWin()->SetName(WindowGroup2); |
|
4935 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,15-EWinPositionY)); |
|
4936 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4937 break; |
|
4938 case 10: |
|
4939 SimulatePointer(TRawEvent::EButton2Down,25,20); |
|
4940 iEventTestGroup3->GroupWin()->SetName(WindowGroup2); |
|
4941 SimulatePointer(TRawEvent::EButton1Up,15,20); |
|
4942 iEventTestGroup3->GroupWin()->SetName(WindowGroup1); |
|
4943 AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(25-EWinPositionX,20-EWinPositionY)); |
|
4944 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,20-EWinPositionY)); |
|
4945 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4946 break; |
|
4947 case 11: |
|
4948 iEventTestGroup3->GroupWin()->SetName(WindowGroup1); |
|
4949 SimulatePointer(TRawEvent::EButton2Down,12,12); |
|
4950 iEventTestGroup3->GroupWin()->SetName(WindowGroup2); |
|
4951 SimulatePointer(TRawEvent::EButton1Up,12,12); |
|
4952 AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(12-EWinPositionX,12-EWinPositionY)); |
|
4953 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4954 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(12-EWinPositionX,12-EWinPositionY)); |
|
4955 break; |
|
4956 case 12: |
|
4957 delete iEventTestGroup3; |
|
4958 iEventTestGroup3=NULL; |
|
4959 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4960 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4961 break; |
|
4962 case 13: |
|
4963 delete iEventTestGroup4; |
|
4964 iEventTestGroup4=NULL; |
|
4965 AddExpectedEvent(EEventWindowGroupsChanged); |
|
4966 AddExpectedEvent(EEventWindowGroupListChanged); |
|
4967 break; |
|
4968 default: |
|
4969 CActiveScheduler::Stop(); |
|
4970 break; |
|
4971 } |
|
4972 TheClient->iWs.Flush(); |
|
4973 } |
|
4974 |
|
4975 TInt CTEventTest::KeyRepeatTime() const |
|
4976 { |
|
4977 TTimeIntervalMicroSeconds32 initialTime; |
|
4978 TTimeIntervalMicroSeconds32 time; |
|
4979 TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); |
|
4980 return(initialTime.Int()); |
|
4981 } |
|
4982 |
|
4983 void CTEventTest::RepeatableKeysL() |
|
4984 { |
|
4985 // repeatable key event |
|
4986 TKeyEvent repKeyEvent; |
|
4987 repKeyEvent.iCode='J'; |
|
4988 repKeyEvent.iScanCode=0; |
|
4989 repKeyEvent.iModifiers=EModifierAutorepeatable; |
|
4990 repKeyEvent.iRepeats=0; |
|
4991 |
|
4992 // non-repeatable key event |
|
4993 TKeyEvent keyEvent; |
|
4994 keyEvent.iCode='J'; |
|
4995 keyEvent.iScanCode=0; |
|
4996 keyEvent.iModifiers=0; |
|
4997 keyEvent.iRepeats=0; |
|
4998 |
|
4999 switch(iEventSet++) |
|
5000 { |
|
5001 case 0: |
|
5002 { |
|
5003 TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event |
|
5004 TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event |
|
5005 TheClient->iWs.SimulateKeyEvent(keyEvent); // Create a non-repeatable key event |
|
5006 TheClient->iWs.Flush(); // Send events |
|
5007 AddExpectedEvent(EEventFocusGained); // Always get a focus gain at start |
|
5008 AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above |
|
5009 AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above |
|
5010 AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above |
|
5011 break; |
|
5012 } |
|
5013 case 1: |
|
5014 { |
|
5015 TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event |
|
5016 TheClient->iWs.SimulateKeyEvent(keyEvent); // Create a non-repeatable key event |
|
5017 TheClient->iWs.Flush(); |
|
5018 iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); // Create a raw event |
|
5019 TheClient->iWs.Flush(); |
|
5020 User::After(KeyRepeatTime()*3/2); |
|
5021 iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); // Create a raw event |
|
5022 TheClient->iWs.Flush(); |
|
5023 AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above |
|
5024 AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above |
|
5025 AddExpectedKey(EEventKeyDown, 'A'); |
|
5026 AddExpectedKey(EEventKey,'A','a'); |
|
5027 AddExpectedKey(EEventKey,'A','a',1); |
|
5028 AddExpectedKey(EEventKeyUp, 'A'); |
|
5029 break; |
|
5030 } |
|
5031 case 2: |
|
5032 { |
|
5033 iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); // Create a raw event |
|
5034 TheClient->iWs.Flush(); |
|
5035 User::After(KeyRepeatTime()*3/2); |
|
5036 TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event |
|
5037 TheClient->iWs.SimulateKeyEvent(keyEvent); // Create a non-repeatable key event |
|
5038 TheClient->iWs.Flush(); // Send event |
|
5039 iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); // Create a raw event |
|
5040 TheClient->iWs.Flush(); |
|
5041 AddExpectedKey(EEventKeyDown, 'A'); |
|
5042 AddExpectedKey(EEventKey,'A','a'); |
|
5043 AddExpectedKey(EEventKey,'A','a',1); |
|
5044 AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above |
|
5045 AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above |
|
5046 AddExpectedKey(EEventKeyUp, 'A'); |
|
5047 break; |
|
5048 } |
|
5049 default: |
|
5050 CActiveScheduler::Stop(); |
|
5051 break; |
|
5052 } |
|
5053 TheClient->iWs.Flush(); |
|
5054 } |
|
5055 |
|
5056 CTBlankWindow* CTEventTest::NewBlueForgroundWindowL() |
|
5057 { |
|
5058 CTBlankWindow* window; |
|
5059 window=new (ELeave) CTBlankWindow; |
|
5060 CleanupStack::PushL(window); |
|
5061 window->ConstructL(*iQueueClient->iGroup); |
|
5062 User::LeaveIfError(window->BaseWin()->SetRequiredDisplayMode(EColor256)); |
|
5063 CleanupStack::Pop(window); |
|
5064 |
|
5065 window->SetColor(KRgbBlue); |
|
5066 window->SetExt(TPoint(40, 40), TSize(40,40)); |
|
5067 window->BaseWin()->SetOrdinalPosition(0); |
|
5068 return window; |
|
5069 } |
|
5070 |
|
5071 CTBlankWindow* CTEventTest::NewBlueForgroundWindow() |
|
5072 { |
|
5073 CTBlankWindow* window = NULL; |
|
5074 TRAPD(err, window=NewBlueForgroundWindowL()); |
|
5075 if (err != KErrNone) |
|
5076 Failed(); |
|
5077 return window; |
|
5078 } |
|
5079 |
|
5080 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
5081 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
5082 static void CreateSurfaceAttributes(RSurfaceManager::TSurfaceCreationAttributesBuf& aBuffer , const TSize& aSize) |
|
5083 { |
|
5084 RSurfaceManager::TSurfaceCreationAttributes& b = aBuffer(); |
|
5085 |
|
5086 b.iSize.iWidth = aSize.iWidth; |
|
5087 b.iSize.iHeight = aSize.iHeight; |
|
5088 b.iBuffers = 1; // number of buffers in the surface |
|
5089 b.iPixelFormat = EUidPixelFormatARGB_8888; |
|
5090 b.iStride = aSize.iWidth * 4; // Number of bytes between start of one line and start of next |
|
5091 b.iOffsetToFirstBuffer = 0; // way of reserving space before the surface pixel data |
|
5092 b.iAlignment = 4; // alignment, 1,2,4,8 byte aligned |
|
5093 b.iContiguous = EFalse; |
|
5094 b.iMappable = ETrue; |
|
5095 } |
|
5096 |
|
5097 static const TInt KFullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible; |
|
5098 |
|
5099 void CTEventTest::SurfaceVisibilityChanged1_NextSetOfEventsL() |
|
5100 { |
|
5101 switch(iEventSet++) |
|
5102 { |
|
5103 case 0: |
|
5104 { |
|
5105 //Setup |
|
5106 LOG_MESSAGE(_L("case 0")); |
|
5107 TInt err = iSurfaceManager.Open(); |
|
5108 if (err != KErrNone) |
|
5109 { |
|
5110 RDebug::Printf("RSurfaceManager::Open() failed", err); |
|
5111 User::Leave(err); |
|
5112 } |
|
5113 |
|
5114 iVisWins1=NewBlueForgroundWindowL(); |
|
5115 iVisWins1->Activate(); |
|
5116 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5117 |
|
5118 AddExpectedEvent(EEventFocusGained); |
|
5119 AddExpectedVisibilityChange(KFullyVisible, iVisWins1); |
|
5120 break; |
|
5121 } |
|
5122 case 1: |
|
5123 { |
|
5124 LOG_MESSAGE(_L("case 1")); |
|
5125 iVisWins2=NewBlueForgroundWindowL(); // will cover iVisWins1 |
|
5126 iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer |
|
5127 iVisWins2->Activate(); |
|
5128 |
|
5129 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1); |
|
5130 break; |
|
5131 } |
|
5132 case 2: |
|
5133 { |
|
5134 // This case contains the actual test GRAPHICS-WSERV-2669-0015 |
|
5135 LOG_MESSAGE(_L("case 2")); |
|
5136 RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf; |
|
5137 CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size()); |
|
5138 |
|
5139 iSurfaceId = TSurfaceId::CreateNullId(); |
|
5140 TInt err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId); |
|
5141 if (err != KErrNone) |
|
5142 { |
|
5143 RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err); |
|
5144 TEST(EFalse); |
|
5145 } |
|
5146 |
|
5147 err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId); |
|
5148 if (err != KErrNone) |
|
5149 { |
|
5150 RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err); |
|
5151 TEST(EFalse); |
|
5152 } |
|
5153 |
|
5154 iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //iVisWins1 will become visible |
|
5155 |
|
5156 AddExpectedVisibilityChange(KFullyVisible, iVisWins1); |
|
5157 break; |
|
5158 } |
|
5159 default: |
|
5160 LOG_MESSAGE(_L("default")); |
|
5161 if (!iSurfaceId.IsNull()) |
|
5162 { |
|
5163 iSurfaceManager.CloseSurface(iSurfaceId); |
|
5164 iSurfaceId = TSurfaceId::CreateNullId(); |
|
5165 } |
|
5166 iSurfaceManager.Close(); |
|
5167 delete iVisWins1; |
|
5168 iVisWins1 = NULL; |
|
5169 delete iVisWins2; |
|
5170 iVisWins2 = NULL; |
|
5171 CActiveScheduler::Stop(); |
|
5172 break; |
|
5173 } |
|
5174 TheClient->iWs.Flush(); |
|
5175 } |
|
5176 |
|
5177 void CTEventTest::SurfaceVisibilityChanged2_NextSetOfEventsL() |
|
5178 { |
|
5179 switch (iEventSet++) |
|
5180 { |
|
5181 case 0: |
|
5182 { |
|
5183 //Win1 - bottom window |
|
5184 //Win2 - middle window with semi-transparent background surface, which totally obscures win1 |
|
5185 LOG_MESSAGE(_L("case 0")); |
|
5186 TInt err = iSurfaceManager.Open(); |
|
5187 if (err != KErrNone) |
|
5188 { |
|
5189 RDebug::Printf("RSurfaceManager::Open() failed", err); |
|
5190 User::Leave(err); |
|
5191 } |
|
5192 |
|
5193 iVisWins1 = NewBlueForgroundWindowL(); |
|
5194 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5195 |
|
5196 iVisWins2 = NewBlueForgroundWindowL(); |
|
5197 iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer |
|
5198 iVisWins2->BaseWin()->EnableVisibilityChangeEvents(); |
|
5199 |
|
5200 iVisWins1->Activate(); //obscured |
|
5201 iVisWins2->Activate(); //visible |
|
5202 |
|
5203 // Create surface for background window |
|
5204 RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf; |
|
5205 CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size()); |
|
5206 |
|
5207 iSurfaceId = TSurfaceId::CreateNullId(); |
|
5208 err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId); |
|
5209 if (err != KErrNone) |
|
5210 { |
|
5211 RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err); |
|
5212 TEST(EFalse); |
|
5213 } |
|
5214 |
|
5215 err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId); |
|
5216 if (err != KErrNone) |
|
5217 { |
|
5218 RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err); |
|
5219 TEST(EFalse); |
|
5220 } |
|
5221 |
|
5222 iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //win1 and win2 both visible |
|
5223 |
|
5224 AddExpectedEvent(EEventFocusGained); |
|
5225 AddExpectedVisibilityChange(KFullyVisible, iVisWins2); |
|
5226 AddExpectedVisibilityChange(KFullyVisible, iVisWins1); |
|
5227 break; |
|
5228 } |
|
5229 case 1: |
|
5230 { |
|
5231 //Win3 - opaque top window which obscures win2 and win1 |
|
5232 LOG_MESSAGE(_L("case 1")); |
|
5233 iVisWins3 = NewBlueForgroundWindowL(); |
|
5234 iVisWins3->SetColor(KRgbRed); |
|
5235 iVisWins3->Activate(); |
|
5236 |
|
5237 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins2); |
|
5238 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1); |
|
5239 break; |
|
5240 } |
|
5241 case 2: |
|
5242 { |
|
5243 //This case contains the actual test GRAPHICS-WSERV-2669-0016 |
|
5244 LOG_MESSAGE(_L("case 2")); |
|
5245 delete iVisWins3; |
|
5246 iVisWins3 = NULL; |
|
5247 |
|
5248 AddExpectedVisibilityChange(KFullyVisible, iVisWins2); |
|
5249 AddExpectedVisibilityChange(KFullyVisible, iVisWins1); |
|
5250 break; |
|
5251 } |
|
5252 default: |
|
5253 LOG_MESSAGE(_L("default")); |
|
5254 if (!iSurfaceId.IsNull()) |
|
5255 { |
|
5256 iSurfaceManager.CloseSurface(iSurfaceId); |
|
5257 iSurfaceId = TSurfaceId::CreateNullId(); |
|
5258 } |
|
5259 iSurfaceManager.Close(); |
|
5260 delete iVisWins1; |
|
5261 iVisWins1 = NULL; |
|
5262 delete iVisWins2; |
|
5263 iVisWins2 = NULL; |
|
5264 delete iVisWins3; |
|
5265 iVisWins3 = NULL; |
|
5266 CActiveScheduler::Stop(); |
|
5267 return; |
|
5268 } |
|
5269 TheClient->iWs.Flush(); |
|
5270 } |
|
5271 |
|
5272 TInt CTEventTest::GenerateAnEvent(TAny* aEventTest) |
|
5273 { |
|
5274 CTEventTest* self = static_cast<CTEventTest*>(aEventTest); |
|
5275 self->LogMessage(((TText8*)__FILE__), __LINE__,_L("Negative test passed OK - no event was generated.")); |
|
5276 //Now we must generate an event to get CTQueueTestEvent out of its wait loop |
|
5277 self->SimulateRepeatEvent(32); |
|
5278 self->AddExpectedKey(EEventKey, 32); |
|
5279 return KErrNone; |
|
5280 } |
|
5281 |
|
5282 void CTEventTest::SurfaceVisibilityChanged3_NextSetOfEventsL() |
|
5283 { |
|
5284 switch (iEventSet++) |
|
5285 { |
|
5286 case 0: |
|
5287 { |
|
5288 //Win1 - Bottom window |
|
5289 //Win2 - Top window with semi-transparent background surface. Does not overlap win1. |
|
5290 LOG_MESSAGE(_L("case 0")); |
|
5291 TInt err = iSurfaceManager.Open(); |
|
5292 if (err != KErrNone) |
|
5293 { |
|
5294 RDebug::Printf("RSurfaceManager::Open() failed", err); |
|
5295 User::Leave(err); |
|
5296 } |
|
5297 iTimeOutCallback = CPeriodic::NewL(CActive::EPriorityIdle); |
|
5298 |
|
5299 iVisWins1 = NewBlueForgroundWindowL(); |
|
5300 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5301 |
|
5302 iVisWins2 = NewBlueForgroundWindowL(); |
|
5303 iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer |
|
5304 TPoint newPos(iVisWins1->Position() + iVisWins1->Size()); |
|
5305 iVisWins2->SetPos(newPos); //to not overlap win1 |
|
5306 |
|
5307 iVisWins1->Activate(); //upper left |
|
5308 iVisWins2->Activate(); //lower right |
|
5309 |
|
5310 // Create surface for background window |
|
5311 RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf; |
|
5312 CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size()); |
|
5313 |
|
5314 iSurfaceId = TSurfaceId::CreateNullId(); |
|
5315 err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId); |
|
5316 if (err != KErrNone) |
|
5317 { |
|
5318 RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err); |
|
5319 TEST(EFalse); |
|
5320 } |
|
5321 |
|
5322 err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId); |
|
5323 if (err != KErrNone) |
|
5324 { |
|
5325 RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err); |
|
5326 TEST(EFalse); |
|
5327 } |
|
5328 |
|
5329 iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); |
|
5330 |
|
5331 AddExpectedEvent(EEventFocusGained); |
|
5332 AddExpectedVisibilityChange(KFullyVisible, iVisWins1); |
|
5333 break; |
|
5334 } |
|
5335 case 1: |
|
5336 { |
|
5337 //This case contains the actual test GRAPHICS-WSERV-2669-0017 |
|
5338 LOG_MESSAGE(_L("case 1")); |
|
5339 iVisWins2->SetPos(iVisWins1->Position()); //Win2 now overlaps Win1, but because Win2 has |
|
5340 //a transparent surface Win1 is still fully visible |
|
5341 |
|
5342 //Because we don't expect any events we need to generate one to avoid waiting forever. |
|
5343 TCallBack timeout(GenerateAnEvent, this); |
|
5344 iTimeOutCallback->Start(1000000, 10000000, timeout); |
|
5345 break; |
|
5346 } |
|
5347 default: |
|
5348 LOG_MESSAGE(_L("default")); |
|
5349 iTimeOutCallback->Cancel(); |
|
5350 delete iTimeOutCallback; |
|
5351 iTimeOutCallback = NULL; |
|
5352 if (!iSurfaceId.IsNull()) |
|
5353 { |
|
5354 iSurfaceManager.CloseSurface(iSurfaceId); |
|
5355 iSurfaceId = TSurfaceId::CreateNullId(); |
|
5356 } |
|
5357 iSurfaceManager.Close(); |
|
5358 delete iVisWins1; |
|
5359 iVisWins1 = NULL; |
|
5360 delete iVisWins2; |
|
5361 iVisWins2 = NULL; |
|
5362 CActiveScheduler::Stop(); |
|
5363 return; |
|
5364 } |
|
5365 TheClient->iWs.Flush(); |
|
5366 } |
|
5367 #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
5368 #endif //SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
5369 |
|
5370 void CTEventTest::VisibilityChanged_NextSetOfEventsL() |
|
5371 { |
|
5372 const TInt fullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible; |
|
5373 |
|
5374 switch(iEventSet++) |
|
5375 { |
|
5376 case 0: //only this case can leave |
|
5377 { |
|
5378 iQueueClient->iWin->BackedUpWin()->MaintainBackup(); |
|
5379 iVisWins1=NewBlueForgroundWindowL(); |
|
5380 iVisWins2=NewBlueForgroundWindowL(); |
|
5381 |
|
5382 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5383 iVisWins1->Activate(); |
|
5384 iVisWins2->SetColor(KRgbGreen); |
|
5385 iVisWins2->SetExt(TPoint(80, 80), TSize(120,120)); |
|
5386 iVisWins2->Activate(); |
|
5387 |
|
5388 AddExpectedEvent(EEventFocusGained); |
|
5389 AddExpectedVisibilityChange(fullyVisible); |
|
5390 } |
|
5391 break; |
|
5392 case 1: |
|
5393 iVisWins1->BaseWin()->SetVisible(EFalse); |
|
5394 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); |
|
5395 break; |
|
5396 case 2: |
|
5397 iVisWins1->BaseWin()->SetVisible(ETrue); |
|
5398 AddExpectedVisibilityChange(fullyVisible); |
|
5399 break; |
|
5400 case 3: |
|
5401 iVisWins2->SetExt(TPoint(0,0), TSize(120,120)); |
|
5402 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); |
|
5403 break; |
|
5404 case 4: |
|
5405 iVisWins2->BaseWin()->SetVisible(EFalse); |
|
5406 AddExpectedVisibilityChange(fullyVisible); |
|
5407 break; |
|
5408 case 5: |
|
5409 iVisWins2->BaseWin()->SetVisible(ETrue); |
|
5410 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); |
|
5411 break; |
|
5412 case 6: |
|
5413 iVisWins2->SetExt(TPoint(60,60), TSize(120,120)); |
|
5414 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::EPartiallyVisible); |
|
5415 break; |
|
5416 case 7: |
|
5417 iVisWins1->SetExt(TPoint(80,80), TSize(40,40)); |
|
5418 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); |
|
5419 break; |
|
5420 case 8: |
|
5421 iVisWins1->BaseWin()->SetOrdinalPosition(0); |
|
5422 AddExpectedVisibilityChange(fullyVisible); |
|
5423 |
|
5424 if(TransparencySupportedL() != KErrNone) |
|
5425 { |
|
5426 iEventSet += 2; //we shall skip set 9,10 as they work with transparency |
|
5427 } |
|
5428 break; |
|
5429 case 9: |
|
5430 { |
|
5431 TDisplayMode mode = EColor256; |
|
5432 iTransWin=CTransWindow::NewL(iQueueClient->iGroup, TRgb(255, 0, 0, 128), TRect(0,0,200,200), &mode); |
|
5433 iTransWin->CTWin::DrawNow(); |
|
5434 // it gets put at ordinal position 0 |
|
5435 iVisWins2->BaseWin()->SetOrdinalPosition(1); |
|
5436 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); |
|
5437 } |
|
5438 break; |
|
5439 case 10: |
|
5440 iVisWins1->BaseWin()->SetOrdinalPosition(1); |
|
5441 AddExpectedVisibilityChange(fullyVisible); |
|
5442 break; |
|
5443 case 11: |
|
5444 { |
|
5445 delete iVisWins1; |
|
5446 iVisWins1=NULL; |
|
5447 iVisWins1=NewBlueForgroundWindow(); |
|
5448 |
|
5449 iVisWins1->Activate(); |
|
5450 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5451 |
|
5452 AddExpectedVisibilityChange(fullyVisible); |
|
5453 } |
|
5454 break; |
|
5455 case 12: |
|
5456 { |
|
5457 delete iVisWins1; |
|
5458 iVisWins1=NULL; |
|
5459 iVisWins1=NewBlueForgroundWindow(); |
|
5460 |
|
5461 iVisWins1->Activate(); |
|
5462 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5463 iVisWins1->BaseWin()->SetVisible(EFalse); |
|
5464 |
|
5465 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); |
|
5466 } |
|
5467 break; |
|
5468 case 13: |
|
5469 { |
|
5470 delete iVisWins1; |
|
5471 iVisWins1=NULL; |
|
5472 iVisWins1=NewBlueForgroundWindow(); |
|
5473 |
|
5474 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5475 iVisWins1->Activate(); |
|
5476 |
|
5477 AddExpectedVisibilityChange(fullyVisible); |
|
5478 } |
|
5479 break; |
|
5480 case 14: |
|
5481 { |
|
5482 delete iVisWins1; |
|
5483 iVisWins1=NULL; |
|
5484 iVisWins1=NewBlueForgroundWindow(); |
|
5485 |
|
5486 iVisWins1->Activate(); |
|
5487 iVisWins1->BaseWin()->SetVisible(EFalse); |
|
5488 iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); |
|
5489 |
|
5490 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); |
|
5491 } |
|
5492 break; |
|
5493 default: |
|
5494 delete iVisWins1; |
|
5495 delete iVisWins2; |
|
5496 iVisWins1 = NULL; |
|
5497 iVisWins2 = NULL; |
|
5498 delete iTransWin; |
|
5499 iTransWin = NULL; |
|
5500 CActiveScheduler::Stop(); |
|
5501 break; |
|
5502 } |
|
5503 TheClient->iWs.Flush(); |
|
5504 } |
|
5505 |
|
5506 void CTEventTest::CheckTimeStamp_NextSetOfEventsL() |
|
5507 { |
|
5508 iQueueClient->EventQueue()->SetCheckTimeStamp(ETrue); |
|
5509 switch(iEventSet++) |
|
5510 { |
|
5511 case 0: |
|
5512 iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); // Create a raw event |
|
5513 iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); // Create a raw event |
|
5514 AddExpectedEvent(EEventFocusGained); |
|
5515 AddExpectedKey(EEventKeyDown,'A'); |
|
5516 AddExpectedKey(EEventKey,'A','a'); |
|
5517 AddExpectedKey(EEventKeyUp,'A','a'); |
|
5518 break; |
|
5519 case 1: |
|
5520 { |
|
5521 _LIT8(KMsgParam,"CheckTimeStamp"); |
|
5522 TBuf8<0x20> params(KMsgParam); |
|
5523 TInt err = TheClient->iWs.SendMessageToWindowGroup(iQueueClient->WindowGroupIdentifier(),TUid::Uid(123),params); |
|
5524 AddExpectedEvent(EEventMessageReady); |
|
5525 } |
|
5526 break; |
|
5527 default: |
|
5528 CActiveScheduler::Stop(); |
|
5529 break; |
|
5530 } |
|
5531 TheClient->iWs.Flush(); |
|
5532 } |
|
5533 |
|
5534 /** |
|
5535 * @SYMTestCaseID GRAPHICS-WSERV-0001 |
|
5536 * |
|
5537 * @SYMPREQ PREQ525 |
|
5538 * |
|
5539 * @SYMTestCaseDesc Test Capture priority of different top most windows in a Group. |
|
5540 * |
|
5541 * @SYMTestPriority Critical |
|
5542 * |
|
5543 * @SYMTestStatus Implemented |
|
5544 * |
|
5545 * @SYMTestActions Create two different top client windows under one parent window |
|
5546 * in a same window group. Add pointer event by clicking various position on the |
|
5547 * window and Simulate the pointer event. Change the pointer capture flag, capture |
|
5548 * priority and simulate the pointer event. |
|
5549 * |
|
5550 * @SYMTestExpectedResults In general the expected event and the window server event should |
|
5551 * match same event handle, type and pointer position for following cases. |
|
5552 * When pointer capture is disabled and capture priorities are 0, the pointer position on window1 |
|
5553 * window2 or parent window are same as expected. |
|
5554 * When pointer capture is enabled and capture priorities are 0, the pointer position on window2(which is top most now) |
|
5555 * is same as expected. |
|
5556 * When pointer capture is enabled and capture priorities of win1 is greater than win2 |
|
5557 * the pointer position on win1 and win2 are same as expected. |
|
5558 * The combination of above cases should match the general expexted result. |
|
5559 * |
|
5560 */ |
|
5561 void CTEventTest::PointerCapture_NextSetOfEventsL() |
|
5562 { |
|
5563 #if defined(LOGGING) |
|
5564 TLogMessageText logMessageText; |
|
5565 _LIT(KSet,"Pointer Capture SetOfEvents: %d (last=9)"); |
|
5566 logMessageText.Format(KSet,iEventSet); |
|
5567 INFO_PRINTF1(logMessageText); |
|
5568 #endif |
|
5569 switch(iEventSet++) |
|
5570 { |
|
5571 case 0: //Create two top client windows of same group |
|
5572 iVisWins1=new (ELeave) CTBlankWindow; |
|
5573 iVisWins2=new (ELeave) CTBlankWindow; |
|
5574 iVisWins1->ConstructL(*iQueueClient->iGroup); |
|
5575 iVisWins2->ConstructL(*iQueueClient->iGroup); |
|
5576 iVisWins1->SetColor(KRgbBlue); |
|
5577 iVisWins1->SetExt(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()); |
|
5578 iVisWins1->Activate(); |
|
5579 iVisWins2->SetColor(KRgbGreen); |
|
5580 iVisWins2->SetExt(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()); |
|
5581 iVisWins2->Activate(); |
|
5582 iQueueClient->iWs.Flush(); |
|
5583 AddExpectedEvent(EEventFocusGained); |
|
5584 break; |
|
5585 case 1: //Pointer capture are disabled and priorities are 0 |
|
5586 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureDisabled); |
|
5587 iVisWins1->BaseWin()->SetPointerCapturePriority(0); |
|
5588 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureDisabled); |
|
5589 iVisWins2->BaseWin()->SetPointerCapturePriority(0); |
|
5590 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); //Pointer on the first window |
|
5591 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); |
|
5592 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); //Pointer on the second window(overlaping on first window) |
|
5593 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5594 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); //Pointer on the second window |
|
5595 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5596 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25)); //Pointer on the parent window |
|
5597 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25)); |
|
5598 iQueueClient->iWs.Flush(); |
|
5599 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5600 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5601 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5602 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5603 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5604 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5605 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5606 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5607 break; |
|
5608 case 2: //Pointer capture are enabled and priorities are 0 |
|
5609 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5610 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5611 iVisWins1->BaseWin()->SetPointerCapturePriority(0); |
|
5612 iVisWins2->BaseWin()->SetPointerCapturePriority(0); |
|
5613 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); //Pointer on the first window |
|
5614 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); |
|
5615 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); //Pointer on the second window(overlaping on first window) |
|
5616 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5617 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); //Pointer on the second window |
|
5618 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5619 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); //Pointer on the parent window |
|
5620 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); |
|
5621 iQueueClient->iWs.Flush(); |
|
5622 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5623 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5624 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5625 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5626 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5627 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5628 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5629 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5630 break; |
|
5631 case 3: //Pointer capture are enabled and priorities of win1 is higher than win2 |
|
5632 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5633 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5634 iVisWins1->BaseWin()->SetPointerCapturePriority(1); |
|
5635 iVisWins2->BaseWin()->SetPointerCapturePriority(0); |
|
5636 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); |
|
5637 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); |
|
5638 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); |
|
5639 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5640 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); |
|
5641 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5642 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); |
|
5643 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); |
|
5644 iQueueClient->iWs.Flush(); |
|
5645 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5646 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5647 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5648 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5649 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5650 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5651 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5652 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5653 break; |
|
5654 case 4: //Pointer capture are enabled and priorities of win1 is equal to win2 |
|
5655 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5656 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5657 iVisWins1->BaseWin()->SetPointerCapturePriority(1); |
|
5658 iVisWins2->BaseWin()->SetPointerCapturePriority(1); |
|
5659 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); |
|
5660 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); |
|
5661 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); |
|
5662 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5663 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); |
|
5664 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5665 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); |
|
5666 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); |
|
5667 iQueueClient->iWs.Flush(); |
|
5668 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5669 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5670 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5671 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5672 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5673 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5674 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5675 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5676 break; |
|
5677 case 5: //Pointer capture are enabled and priorities of win2 is higher than win1 |
|
5678 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5679 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5680 iVisWins1->BaseWin()->SetPointerCapturePriority(0); |
|
5681 iVisWins2->BaseWin()->SetPointerCapturePriority(1); |
|
5682 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); |
|
5683 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); |
|
5684 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); |
|
5685 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5686 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); |
|
5687 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5688 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); |
|
5689 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); |
|
5690 iQueueClient->iWs.Flush(); |
|
5691 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5692 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5693 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5694 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5695 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5696 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5697 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5698 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5699 break; |
|
5700 case 6: //Pointer capture are enabled for all groups and priorities of win1 is higher than win2 |
|
5701 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); |
|
5702 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); |
|
5703 iVisWins1->BaseWin()->SetPointerCapturePriority(1); |
|
5704 iVisWins2->BaseWin()->SetPointerCapturePriority(0); |
|
5705 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); |
|
5706 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); |
|
5707 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); |
|
5708 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5709 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); |
|
5710 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5711 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); |
|
5712 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); |
|
5713 iQueueClient->iWs.Flush(); |
|
5714 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5715 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5716 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5717 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5718 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5719 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5720 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5721 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5722 break; |
|
5723 case 7: //Pointer capture are enabled and priorities of iWin is higher than the other windows |
|
5724 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5725 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5726 iVisWins1->BaseWin()->SetPointerCapturePriority(0); |
|
5727 iVisWins2->BaseWin()->SetPointerCapturePriority(0); |
|
5728 iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5729 iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(1); |
|
5730 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20)); //Pointer on the parent window |
|
5731 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20)); |
|
5732 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); |
|
5733 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); |
|
5734 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); |
|
5735 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5736 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); |
|
5737 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5738 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25)); |
|
5739 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25)); |
|
5740 iQueueClient->iWs.Flush(); |
|
5741 SimulatePointer(TRawEvent::EButton1Down,80,20); |
|
5742 SimulatePointer(TRawEvent::EButton1Up,80,20); |
|
5743 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5744 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5745 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5746 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5747 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5748 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5749 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5750 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5751 break; |
|
5752 case 8: //Pointer capture are enabled and priorities of iWin is 0 |
|
5753 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5754 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5755 iVisWins1->BaseWin()->SetPointerCapturePriority(1); |
|
5756 iVisWins2->BaseWin()->SetPointerCapturePriority(0); |
|
5757 iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); |
|
5758 iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(0); |
|
5759 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20),(TInt)iVisWins2); //Pointer on the parent window |
|
5760 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20),(TInt)iVisWins2); |
|
5761 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); |
|
5762 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); |
|
5763 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); |
|
5764 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5765 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); |
|
5766 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5767 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); |
|
5768 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); |
|
5769 iQueueClient->iWs.Flush(); |
|
5770 SimulatePointer(TRawEvent::EButton1Down,80,20); |
|
5771 SimulatePointer(TRawEvent::EButton1Up,80,20); |
|
5772 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5773 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5774 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5775 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5776 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5777 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5778 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5779 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5780 break; |
|
5781 case 9: //Pointer capture are enabled and with different groups |
|
5782 iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); |
|
5783 iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); |
|
5784 iVisWins1->BaseWin()->SetPointerCapturePriority(0); |
|
5785 iVisWins2->BaseWin()->SetPointerCapturePriority(0); |
|
5786 iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); |
|
5787 iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(1); |
|
5788 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(25,150),(TInt)iVisWins2); |
|
5789 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(25,150),(TInt)iVisWins2); |
|
5790 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(150,25),(TInt)iVisWins2); |
|
5791 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(150,25),(TInt)iVisWins2); |
|
5792 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20)); //Pointer on the parent window |
|
5793 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20)); |
|
5794 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); |
|
5795 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); |
|
5796 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); |
|
5797 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); |
|
5798 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); |
|
5799 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); |
|
5800 AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25)); |
|
5801 AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25)); |
|
5802 iQueueClient->iWs.Flush(); |
|
5803 SimulatePointer(TRawEvent::EButton1Down,25,150); |
|
5804 SimulatePointer(TRawEvent::EButton1Up,25,150); |
|
5805 SimulatePointer(TRawEvent::EButton1Down,150,25); |
|
5806 SimulatePointer(TRawEvent::EButton1Up,150,25); |
|
5807 SimulatePointer(TRawEvent::EButton1Down,80,20); |
|
5808 SimulatePointer(TRawEvent::EButton1Up,80,20); |
|
5809 SimulatePointer(TRawEvent::EButton1Down,35,25); |
|
5810 SimulatePointer(TRawEvent::EButton1Up,35,25); |
|
5811 SimulatePointer(TRawEvent::EButton1Down,60,50); |
|
5812 SimulatePointer(TRawEvent::EButton1Up,60,50); |
|
5813 SimulatePointer(TRawEvent::EButton1Down,50,30); |
|
5814 SimulatePointer(TRawEvent::EButton1Up,50,30); |
|
5815 SimulatePointer(TRawEvent::EButton1Down,75,25); |
|
5816 SimulatePointer(TRawEvent::EButton1Up,75,25); |
|
5817 break; |
|
5818 default: |
|
5819 delete iVisWins1; |
|
5820 delete iVisWins2; |
|
5821 iVisWins1=NULL; |
|
5822 iVisWins2=NULL; |
|
5823 CActiveScheduler::Stop(); |
|
5824 break; |
|
5825 } |
|
5826 TheClient->iWs.Flush(); |
|
5827 } |
|
5828 |
|
5829 /** |
|
5830 PDEF110849 |
|
5831 Allocate a pointer buffer, send it some events and then disconnect. |
|
5832 Now fill the event queue, causing a purge. |
|
5833 The purge will call void CWsPointerBuffer::DiscardPointerMoveBuffer(TUint aHandle) |
|
5834 in which an access violation occurred because iCurrentBuffer had not been set to NULL. |
|
5835 */ |
|
5836 void CTEventTest::PointerBufferPurge_NextSetOfEventsL() |
|
5837 { |
|
5838 #if defined(LOGGING) |
|
5839 TLogMessageText logMessageText; |
|
5840 _LIT(KSet,"PointerBufferPurge SetOfEvents: %d of 1"); |
|
5841 logMessageText.Format(KSet,iEventSet); |
|
5842 TheClient->LogMessage(logMessageText); |
|
5843 #endif |
|
5844 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); |
|
5845 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); |
|
5846 switch(iEventSet++) |
|
5847 { |
|
5848 case 0: |
|
5849 { |
|
5850 RWindowBase& win = *iQueueClient->iWin->BaseWin(); |
|
5851 |
|
5852 // Cause a connect to happen |
|
5853 RDebug::Print(_L("PointerBufferPurge - AllocPointerMoveBuffer()")); |
|
5854 win.AllocPointerMoveBuffer(10, 0); |
|
5855 |
|
5856 // Allow pen events to be received |
|
5857 RDebug::Print(_L("PointerBufferPurge - EnablePointerMoveBuffer()")); |
|
5858 win.EnablePointerMoveBuffer(); |
|
5859 |
|
5860 // Simulate some pen events |
|
5861 RDebug::Print(_L("PointerBufferPurge - Events")); |
|
5862 SimulatePointer(TRawEvent::EPointerMove,10,20); |
|
5863 SimulatePointer(TRawEvent::EButton1Down,10,20); |
|
5864 SimulatePointer(TRawEvent::EPointerMove,11,21); |
|
5865 SimulatePointer(TRawEvent::EButton1Up,11,21); |
|
5866 |
|
5867 // Disconnect |
|
5868 RDebug::Print(_L("PointerBufferPurge - FreePointerMoveBuffer()")); |
|
5869 win.FreePointerMoveBuffer(); |
|
5870 |
|
5871 // Send sufficient events to cause a purge to happen |
|
5872 for (TInt i=0; i<EMaxEventQueueSize; i++) |
|
5873 { |
|
5874 RDebug::Print(_L("PointerBufferPurge - Purge Loop %d"), i); |
|
5875 SimulatePointer(TRawEvent::EButton1Up,15,25); |
|
5876 } |
|
5877 |
|
5878 // Expected events |
|
5879 // - We only expect the focus and button up events because the other events have been purged |
|
5880 // - button up events which are not paired with button down take precedence |
|
5881 // - but even some of our button up events will have been purged - hence the lower count |
|
5882 |
|
5883 AddExpectedEvent(EEventFocusGained); |
|
5884 |
|
5885 for (TInt i=0; i<EMaxEventQueueSize-1; i++) |
|
5886 { |
|
5887 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,25-EWinPositionY)); |
|
5888 } |
|
5889 |
|
5890 break; |
|
5891 } |
|
5892 default: |
|
5893 CActiveScheduler::Stop(); |
|
5894 break; |
|
5895 } |
|
5896 TheClient->iWs.SetAutoFlush(iTheClientFlush); |
|
5897 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); |
|
5898 } |
|
5899 |
|
5900 /** |
|
5901 * @SYMTestCaseID GRAPHICS-WSERV-0025 |
|
5902 * |
|
5903 * @SYMDEF DEF085009 |
|
5904 * |
|
5905 * @SYMTestCaseDesc Test removal of event handlers mid-way through processing an event. |
|
5906 * |
|
5907 * @SYMTestPriority Critical |
|
5908 * |
|
5909 * @SYMTestStatus Implemented |
|
5910 * |
|
5911 * @SYMTestActions The following tests use RRemovable anim to replicate the removal of |
|
5912 * event handlers mid-way through processing an event (where an event is offered to each of the |
|
5913 * listed event handlers). |
|
5914 * |
|
5915 * RRemovableAnim is an anim which removes itself from the event handler list |
|
5916 * after receiving n events, where n is the 'lifetime' of the anim measured in events received. |
|
5917 * By setting the lifetimes of a number of these anims, we replicate the removal of event handlers |
|
5918 * mid-way through processing an event. |
|
5919 * |
|
5920 * Event set 0: |
|
5921 * Sends 2 events e1,e2 and expects them be received by wserv event processing. |
|
5922 * |
|
5923 * Event set 1: (Simple scenario) |
|
5924 * Adds 3 removable anims to event handler list |
|
5925 * Sets lifetimes as {1000,2,5} |
|
5926 * Sends 6 events |
|
5927 * Expected events to be received by anims: {6,2,5} |
|
5928 * |
|
5929 * Event set 2: (Manual removal and reset state) |
|
5930 * Manually remove all anims from event handler list |
|
5931 * Sends 2 events |
|
5932 * No events expected to be received by anims |
|
5933 * Resets all anims ready for next test |
|
5934 * |
|
5935 * Event set 3: (Removal of multiple anims on receipt of same event) |
|
5936 * Adds 10 removable anims in event handler list |
|
5937 * Set lifetimes: {1,5,9,3,8,8,8,10,5,2} |
|
5938 * Sends 12 events: |
|
5939 * Expected number of received events for anims: {1,5,9,3,8,8,8,10,5,2} |
|
5940 * |
|
5941 * Event set 4: (Manual removal and reset state) |
|
5942 * Manually remove all anims from event handler list |
|
5943 * Sends 2 events |
|
5944 * No events expected to be received by anims |
|
5945 * Resets all anims ready for next test |
|
5946 * |
|
5947 * Event set 5: (Addition of anims to non-empty event handler list, part 1) |
|
5948 * Adds 6 removable anims in the event handler list |
|
5949 * Set lifetimes: {1,1,1,5,5,5} |
|
5950 * Sends 2 events: |
|
5951 * Expected number of received events for anims: {1,1,1,2,2,2} |
|
5952 * |
|
5953 * Event set 6: (Addition of anims to non-empty event handler list, part 2) |
|
5954 * Readds first 3 anims to event handler list |
|
5955 * Sets lifetimes of these three anims {13,24,6} |
|
5956 * Sends 5 events: |
|
5957 * Expected number of received events for anims: {5,5,5,3,3,3} |
|
5958 * |
|
5959 * Event set 7: (Addition of anims to non-empty event handler list, part 3) |
|
5960 * Sends 16 events: |
|
5961 * Expected number of received events for anims: {8,16,1,0,0,0} |
|
5962 * |
|
5963 * Event set 8: (Manual Removal and reset state) |
|
5964 * Manually remove all anims from event handler list |
|
5965 * Sends 2 events |
|
5966 * No events expected to be received by anims |
|
5967 * Resets all anims ready for next test |
|
5968 * |
|
5969 * Event set 9: (Creating anims which again generate events.) |
|
5970 * Create 3 anims. One anims generates events in its OfferrawEvent function. |
|
5971 * Check the funtionality of ProcessRawEvent in Wserv when it is called |
|
5972 * recursively. Also check the fix for defect INC095892. |
|
5973 * |
|
5974 * @SYMTestExpectedResults |
|
5975 * All events should be received by wserv event processing |
|
5976 * Each anim should only receive events when (number of events received by anim) <= (lifetime of anim) |
|
5977 */ |
|
5978 void CTEventTest::EventHandlerRemoval_NextSetOfEventsL() |
|
5979 { |
|
5980 #if defined(LOGGING) |
|
5981 INFO_PRINTF1(_L("EventHandlerRemoval SetOfEvents: (Max=8)")); |
|
5982 #endif |
|
5983 switch(iEventSet++) |
|
5984 { |
|
5985 case 0: |
|
5986 #if defined(LOGGING) |
|
5987 INFO_PRINTF1(_L("AUTO Event Handler Removal Anim Events")); |
|
5988 #endif |
|
5989 #if defined(DETAILED) |
|
5990 INFO_PRINTF1(_L("No anims in event handler list")); |
|
5991 INFO_PRINTF1(_L(" Send 2 events")); |
|
5992 INFO_PRINTF1(_L(" - Expected to be received by wserv event processing")); |
|
5993 #endif |
|
5994 // Always get a focus gain at start |
|
5995 AddExpectedEvent(EEventFocusGained); |
|
5996 // All expected to be received by wserv event processing |
|
5997 AddExpectedKey(EEventKeyDown,32,ETrue); |
|
5998 AddExpectedKey(EEventKeyUp,32,ETrue); |
|
5999 // Send 2 events - none expected to be received by anims, |
|
6000 iTest->SimulateKey(TRawEvent::EKeyDown,32); |
|
6001 iTest->SimulateKey(TRawEvent::EKeyUp,32); |
|
6002 // Flush events to wserv |
|
6003 TheClient->iWs.Flush(); |
|
6004 // Create all anims for all tests in first event set because |
|
6005 // first event set is only place where leaving functions can be called |
|
6006 EventHandlerRemoval_CreateAnimsL(10); |
|
6007 break; |
|
6008 case 1: |
|
6009 { |
|
6010 #if defined(DETAILED) |
|
6011 INFO_PRINTF1(_L(" Add 3 removable anims to event handler list")); |
|
6012 INFO_PRINTF1(_L(" Set lifetimes for anims: {1000,2,5}")); |
|
6013 INFO_PRINTF1(_L(" Send 6 events")); |
|
6014 INFO_PRINTF1(_L(" - Expected number of received events for anims: {6,2,5}")); |
|
6015 INFO_PRINTF1(_L(" All events expected to be received by wserv event processing")); |
|
6016 #endif |
|
6017 const TInt KLifetimes [] = {1000,2,5}; |
|
6018 EventHandlerRemoval_PrepareAnims(KLifetimes, 3); |
|
6019 EventHandlerRemoval_CreateExpectedEvents(6,3); |
|
6020 // Flush events to wserv |
|
6021 TheClient->iWs.Flush(); |
|
6022 // Check each anim has received the expected events |
|
6023 EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); |
|
6024 } |
|
6025 break; |
|
6026 case 2: |
|
6027 { |
|
6028 // Remove all anims, check removal was successful |
|
6029 // and reset all anims ready for next test |
|
6030 EventHandlerRemoval_RemoveAndResetAllAnims(); |
|
6031 } |
|
6032 break; |
|
6033 case 3: |
|
6034 { |
|
6035 #if defined(DETAILED) |
|
6036 INFO_PRINTF1(_L(" Add 10 removable anims in event handler list")); |
|
6037 INFO_PRINTF1(_L(" Set lifetimes: {1,5,9,3,8,8,8,10,5,2}")); |
|
6038 INFO_PRINTF1(_L(" Send 12 events")); |
|
6039 INFO_PRINTF1(_L(" - Expected number of received events for anims:{1,5,9,3,8,8,8,10,5,2}")); |
|
6040 INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); |
|
6041 #endif |
|
6042 const TInt KLifetimes [] = {1,5,9,3,8,8,8,10,5,2}; |
|
6043 |
|
6044 // Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array |
|
6045 EventHandlerRemoval_PrepareAnims(KLifetimes, 10); |
|
6046 EventHandlerRemoval_CreateExpectedEvents(12,10); |
|
6047 // Flush events to wserv |
|
6048 TheClient->iWs.Flush(); |
|
6049 // Check each anim has received the expected events |
|
6050 EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); |
|
6051 } |
|
6052 break; |
|
6053 case 4: |
|
6054 { |
|
6055 // Remove all anims, check removal was successful |
|
6056 // and reset all anims ready for next test |
|
6057 EventHandlerRemoval_RemoveAndResetAllAnims(); |
|
6058 } |
|
6059 break; |
|
6060 case 5: |
|
6061 { |
|
6062 #if defined(DETAILED) |
|
6063 INFO_PRINTF1(_L(" Add 6 removable anims in event handler list")); |
|
6064 INFO_PRINTF1(_L(" Set lifetimes: {1,1,1,5,5,5}")); |
|
6065 INFO_PRINTF1(_L(" Send 2 events")); |
|
6066 INFO_PRINTF1(_L(" - Expected number of received events for anims:{1,1,1,2,2,2}")); |
|
6067 INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); |
|
6068 #endif |
|
6069 const TInt KLifetimes [] = {1,1,1,5,5,5}; |
|
6070 |
|
6071 // Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array |
|
6072 EventHandlerRemoval_PrepareAnims(KLifetimes, 6); |
|
6073 EventHandlerRemoval_CreateExpectedEvents(2, 6); |
|
6074 // Flush events to wserv |
|
6075 TheClient->iWs.Flush(); |
|
6076 // Check each anim has received the expected events |
|
6077 EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); |
|
6078 } |
|
6079 break; |
|
6080 case 6: |
|
6081 { |
|
6082 #if defined(DETAILED) |
|
6083 INFO_PRINTF1(_L(" Readds first 3 removable anims to event handler list")); |
|
6084 INFO_PRINTF1(_L(" Set lifetimes of these three anims {13,24,6}")); |
|
6085 INFO_PRINTF1(_L(" Send 5 events")); |
|
6086 INFO_PRINTF1(_L(" - Expected number of received events for anims: {5,5,5,3,3,3}")); |
|
6087 INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); |
|
6088 #endif |
|
6089 const TInt KLifetimes [] = {13,24,6}; |
|
6090 |
|
6091 // Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array |
|
6092 EventHandlerRemoval_PrepareAnims(KLifetimes, 3); |
|
6093 EventHandlerRemoval_CreateExpectedEvents(5, 6); |
|
6094 // Flush events to wserv |
|
6095 TheClient->iWs.Flush(); |
|
6096 // Check each anim has received the expected events |
|
6097 EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); |
|
6098 } |
|
6099 break; |
|
6100 case 7: |
|
6101 { |
|
6102 #if defined(DETAILED) |
|
6103 INFO_PRINTF1(_L(" Send 16 events")); |
|
6104 INFO_PRINTF1(_L(" - Expected number of received events for anims:{8,16,1,0,0,0}")); |
|
6105 INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); |
|
6106 #endif |
|
6107 EventHandlerRemoval_CreateExpectedEvents(16, 3); |
|
6108 // Flush events to wserv |
|
6109 TheClient->iWs.Flush(); |
|
6110 // Check each anim has received the expected events |
|
6111 EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); |
|
6112 } |
|
6113 break; |
|
6114 case 8: |
|
6115 { |
|
6116 // Remove all anims, check removal was successful |
|
6117 // and reset all anims ready for next test |
|
6118 EventHandlerRemoval_RemoveAndResetAllAnims(); |
|
6119 } |
|
6120 break; |
|
6121 case 9: |
|
6122 EventHandlerRemoval_CheckRecursionOfProcessRawEvent(); |
|
6123 break; |
|
6124 case 10: |
|
6125 EventHandlerRemoval_AddEventHandlerMultipleTimes(); |
|
6126 break; |
|
6127 default: |
|
6128 #if defined(DETAILED) |
|
6129 INFO_PRINTF1(_L(" Test postamble")); |
|
6130 INFO_PRINTF1(_L(" Destroy anims")); |
|
6131 #endif |
|
6132 // Destroy anims |
|
6133 EventHandlerRemoval_DestroyAllAnims(); |
|
6134 iRemovableAnims->Close(); |
|
6135 delete iRemovableAnims; |
|
6136 iRemovableAnims = NULL; |
|
6137 CActiveScheduler::Stop(); |
|
6138 break; |
|
6139 } |
|
6140 TheClient->iWs.Flush(); |
|
6141 } |
|
6142 |
|
6143 /** |
|
6144 * Creates an array of aAnimCount anims on heap |
|
6145 * Assigns array to iRemovableAnims for use in rest of tests |
|
6146 */ |
|
6147 void CTEventTest::EventHandlerRemoval_CreateAnimsL(TInt aAnimCount) |
|
6148 { |
|
6149 RPointerArray<RRemovableAnim>* removableAnims = new (ELeave) RPointerArray<RRemovableAnim>(); |
|
6150 CleanupStack::PushL(removableAnims); |
|
6151 for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++) |
|
6152 { |
|
6153 RRemovableAnim* anim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); |
|
6154 removableAnims->AppendL(anim); |
|
6155 } |
|
6156 CleanupStack::Pop(aAnimCount, (*removableAnims)[0]); |
|
6157 CleanupStack::Pop(removableAnims); |
|
6158 iRemovableAnims = removableAnims; |
|
6159 } |
|
6160 |
|
6161 /** |
|
6162 * Sets lifetimes of anims as specified in aLifeTimes |
|
6163 * Adds anims to event handler list |
|
6164 */ |
|
6165 void CTEventTest::EventHandlerRemoval_PrepareAnims(const TInt* aLifetimes, TInt aAnimCount) |
|
6166 { |
|
6167 for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++) |
|
6168 { |
|
6169 RRemovableAnim* anim = (*iRemovableAnims)[animIndex]; |
|
6170 anim->SetEventHandlerLifetime(aLifetimes[animIndex]); |
|
6171 anim->AddToEventHandlers(); |
|
6172 } |
|
6173 } |
|
6174 |
|
6175 /** |
|
6176 * Creates aEventCount key events to be used in test |
|
6177 * Adds the expected event aEvent to the first aLiveAnimCount anims |
|
6178 * Adds expected events observed by the rest of wserv |
|
6179 * Simulates events on wserv |
|
6180 */ |
|
6181 void CTEventTest::EventHandlerRemoval_CreateExpectedEvents(TInt aEventCount, TInt aLiveAnimCount) |
|
6182 { |
|
6183 RArray<TRawEvent> events; |
|
6184 |
|
6185 // Add expected events to anims |
|
6186 for (TInt eventCount = 0; eventCount < aEventCount; eventCount++) |
|
6187 { |
|
6188 TRawEvent rawEvent; |
|
6189 TInt scanCode = 33 + eventCount; |
|
6190 // Alternate key down, key up events. |
|
6191 if (eventCount%2 == 0) |
|
6192 { |
|
6193 rawEvent.Set(TRawEvent::EKeyDown, scanCode); |
|
6194 } |
|
6195 else |
|
6196 { |
|
6197 rawEvent.Set(TRawEvent::EKeyUp, scanCode); |
|
6198 } |
|
6199 EventHandlerRemoval_AddExpectedEvent(rawEvent, aLiveAnimCount); |
|
6200 events.Append(rawEvent); |
|
6201 } |
|
6202 |
|
6203 // Simulates expected events |
|
6204 for (TInt eventCount = 0; eventCount < aEventCount; eventCount++) |
|
6205 { |
|
6206 TRawEvent event = events[eventCount]; |
|
6207 iTest->SimulateKey(event.Type(), event.ScanCode()); |
|
6208 } |
|
6209 |
|
6210 events.Close(); |
|
6211 } |
|
6212 |
|
6213 /** |
|
6214 * Adds the expected event aEvent to the first aLiveAnimCount anims |
|
6215 * Adds expected event observed by the rest of wserv |
|
6216 */ |
|
6217 void CTEventTest::EventHandlerRemoval_AddExpectedEvent(TRawEvent aEvent, TInt aLiveAnimCount) |
|
6218 { |
|
6219 // Add event to each of the anims |
|
6220 for (TInt animIndex = 0; animIndex < aLiveAnimCount; animIndex++) |
|
6221 { |
|
6222 TInt err = (*iRemovableAnims)[animIndex]->AddExpectedEvent(aEvent); |
|
6223 } |
|
6224 TInt eventType = (aEvent.Type() == TRawEvent::EKeyDown ? EEventKeyDown : EEventKeyUp); |
|
6225 AddExpectedKey(eventType, aEvent.ScanCode(), ETrue); |
|
6226 } |
|
6227 |
|
6228 /** |
|
6229 * Checks each anim has received the expected events |
|
6230 */ |
|
6231 void CTEventTest::EventHandlerRemoval_CheckExpectedEventsReceivedByAnims() |
|
6232 { |
|
6233 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) |
|
6234 { |
|
6235 if (!(*iRemovableAnims)[animIndex]->TestPassed()) |
|
6236 { |
|
6237 Failed(); |
|
6238 break; |
|
6239 } |
|
6240 } |
|
6241 } |
|
6242 |
|
6243 |
|
6244 /** |
|
6245 * Create three anims. In the first anim's Offer raw event generate two more events |
|
6246 * which will call recursively the process raw event at the server side. |
|
6247 * The second and third anims are just removable anims. To simulate the scenario |
|
6248 * for the defect INC095892. If teh fix for this is defect is not supplied then |
|
6249 * wserv would panic for this test case. |
|
6250 */ |
|
6251 void CTEventTest::EventHandlerRemoval_CheckRecursionOfProcessRawEvent() |
|
6252 { |
|
6253 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); |
|
6254 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); |
|
6255 |
|
6256 // Create 3 anims |
|
6257 RRemovableAnim* eventRecurAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); |
|
6258 RRemovableAnim* removableAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); |
|
6259 RRemovableAnim* eventAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); |
|
6260 |
|
6261 // Add these anim as event handlers and set thier respective life time |
|
6262 eventRecurAnim->AddToEventHandlers(); |
|
6263 eventRecurAnim->SetEventHandlerLifetime(4); |
|
6264 |
|
6265 removableAnim->AddToEventHandlers(); |
|
6266 removableAnim->SetEventHandlerLifetime(1); |
|
6267 |
|
6268 eventAnim->AddToEventHandlers(); |
|
6269 eventAnim->SetEventHandlerLifetime(2); |
|
6270 |
|
6271 TRawEvent rawEvent1; |
|
6272 TRawEvent rawEvent2; |
|
6273 TRawEvent rawEvent3; |
|
6274 rawEvent1.Set(TRawEvent::EKeyDown, 60); |
|
6275 rawEvent2.Set(TRawEvent::EKeyUp, 34); |
|
6276 rawEvent3.Set(TRawEvent::EKeyUp, 35); |
|
6277 |
|
6278 eventRecurAnim->AddExpectedEvent(rawEvent2); |
|
6279 eventRecurAnim->AddExpectedEvent(rawEvent3); |
|
6280 |
|
6281 removableAnim->AddExpectedEvent(rawEvent2); |
|
6282 |
|
6283 eventAnim->AddExpectedEvent(rawEvent2); |
|
6284 eventAnim->AddExpectedEvent(rawEvent3); |
|
6285 |
|
6286 // Add these events to iQueueClient for testing |
|
6287 AddExpectedKey(EEventKeyUp, 34, ETrue); |
|
6288 AddExpectedKey(EEventKeyUp, 35, ETrue); |
|
6289 |
|
6290 iTest->SimulateKey(rawEvent1.Type(), rawEvent1.ScanCode()); |
|
6291 |
|
6292 CleanupStack::PopAndDestroy(3, eventRecurAnim); |
|
6293 |
|
6294 TheClient->iWs.SetAutoFlush(iTheClientFlush); |
|
6295 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); |
|
6296 } |
|
6297 |
|
6298 /** |
|
6299 * Manually removes all anims from event handlers array |
|
6300 */ |
|
6301 void CTEventTest::EventHandlerRemoval_ManuallyRemoveAllAnims() |
|
6302 { |
|
6303 // Manually remove all anims from event handler list |
|
6304 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) |
|
6305 { |
|
6306 (*iRemovableAnims)[animIndex]->RemoveFromEventHandlers(); |
|
6307 } |
|
6308 } |
|
6309 |
|
6310 /** |
|
6311 * Manually removes all anims from event handlers array |
|
6312 */ |
|
6313 void CTEventTest::EventHandlerRemoval_ResetAllAnims() |
|
6314 { |
|
6315 // Manually remove all anims from event handler list |
|
6316 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) |
|
6317 { |
|
6318 (*iRemovableAnims)[animIndex]->Reset(); |
|
6319 (*iRemovableAnims)[animIndex]->SetEventHandlerLifetime(0); |
|
6320 } |
|
6321 } |
|
6322 |
|
6323 /** |
|
6324 * Manually removes all anims from event handler list |
|
6325 * Sends 2 events |
|
6326 * Checks that no events have been received by anims |
|
6327 * Resets all anims ready for next test |
|
6328 */ |
|
6329 void CTEventTest::EventHandlerRemoval_RemoveAndResetAllAnims() |
|
6330 { |
|
6331 #if defined(DETAILED) |
|
6332 INFO_PRINTF1(_L(" Manually remove all anims from event handler list")); |
|
6333 INFO_PRINTF1(_L(" Send 2 events: none expected to be received by anims")); |
|
6334 INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); |
|
6335 #endif |
|
6336 // Manually remove all anims from event handler list |
|
6337 EventHandlerRemoval_ManuallyRemoveAllAnims(); |
|
6338 // All expected to be received by wserv event processing |
|
6339 AddExpectedKey(EEventKeyDown,32,ETrue); |
|
6340 AddExpectedKey(EEventKeyUp,32,ETrue); |
|
6341 // Send 2 events - none expected to be received by anims, |
|
6342 iTest->SimulateKey(TRawEvent::EKeyDown,32); |
|
6343 iTest->SimulateKey(TRawEvent::EKeyUp,32); |
|
6344 // Flush events to wserv |
|
6345 TheClient->iWs.Flush(); |
|
6346 // Check the anims have not received any events |
|
6347 EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); |
|
6348 #if defined(DETAILED) |
|
6349 INFO_PRINTF1(_L(" Cleanup before next step")); |
|
6350 #endif |
|
6351 // Reset anims |
|
6352 EventHandlerRemoval_ResetAllAnims(); |
|
6353 } |
|
6354 |
|
6355 /** |
|
6356 * Destroys all anims in iRemovableAnims |
|
6357 * Resets iRemovableAnims |
|
6358 */ |
|
6359 void CTEventTest::EventHandlerRemoval_DestroyAllAnims() |
|
6360 { |
|
6361 if (iRemovableAnims) |
|
6362 { |
|
6363 // Destroy anims |
|
6364 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) |
|
6365 { |
|
6366 RRemovableAnim* anim = (*iRemovableAnims)[animIndex]; |
|
6367 if (anim) |
|
6368 { |
|
6369 anim->Destroy(); |
|
6370 } |
|
6371 } |
|
6372 iRemovableAnims->Reset(); |
|
6373 } |
|
6374 } |
|
6375 |
|
6376 /** |
|
6377 SYMTestCaseID GRAPHICS-WSERV-0496 |
|
6378 |
|
6379 @SYMDEF DEF133776 |
|
6380 |
|
6381 @SYMTestCaseDesc Cancels key captures using all combinations of |
|
6382 RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs. |
|
6383 |
|
6384 @SYMTestPriority High |
|
6385 |
|
6386 @SYMTestStatus Implemented |
|
6387 |
|
6388 @SYMTestActions Call each of the RWindowGroup::Capture***() APIs followed by |
|
6389 each of the RWindowGroup::CancelCapture***() APIs. |
|
6390 RWindowGroup::Capture***() APIs: |
|
6391 CaptureKey(TUint, TUint, TUint) |
|
6392 CaptureKey(TUint, TUint, TUint, TInt) |
|
6393 CaptureKeyUpAndDowns(TUint, TUint, TUint) |
|
6394 CaptureKeyUpAndDowns(TUint, TUint, TUint, TInt) |
|
6395 CaptureLongKey(TUint, TUint, TUint, TUint, TInt, TUint) |
|
6396 CaptureLongKey(TTimeIntervalMicroSeconds32, TUint, TUint, TUint, TUint, TInt, TUint) |
|
6397 RWindowGroup::CancelCapture***() APIs: |
|
6398 CancelCaptureKey() |
|
6399 CancelCaptureKeyUpAndDowns() |
|
6400 CancelCaptureLongKey() |
|
6401 |
|
6402 @SYMTestExpectedResults WServ should handle matched and mismatched Cancel |
|
6403 and Capture calls without panicking. |
|
6404 */ |
|
6405 void CTEventTest::MismatchedCapture_NextSetOfEventsL() |
|
6406 { |
|
6407 if (iEventSet == 0) |
|
6408 AddExpectedEvent(EEventFocusGained); |
|
6409 |
|
6410 if (iEventSet < (EMaxCaptureKeyApis*EMaxCancelCaptureKeyApis)) |
|
6411 { |
|
6412 TestCaptureAndCancelCapturePair(static_cast<TCaptureKeyApis>(iEventSet%EMaxCaptureKeyApis), static_cast<TCancelCaptureKeyApis>(iEventSet/EMaxCaptureKeyApis)); |
|
6413 iEventSet++; |
|
6414 } |
|
6415 else |
|
6416 { |
|
6417 CActiveScheduler::Stop(); |
|
6418 } |
|
6419 } |
|
6420 |
|
6421 /** Helper function that applies a key capture and then cancels it using the |
|
6422 passed capture and cancel RWindowGroup APIs. |
|
6423 |
|
6424 @param aCaptureApi Enum value specifying the capture API to use |
|
6425 @param aCancelCaptureApi Enum value specifying the cancel capture API to use |
|
6426 */ |
|
6427 void CTEventTest::TestCaptureAndCancelCapturePair(TCaptureKeyApis aCaptureApi, TCancelCaptureKeyApis aCancelCaptureApi) |
|
6428 { |
|
6429 #if defined(LOGGING) |
|
6430 _LIT(KCaptureKey, "CaptureKey"); |
|
6431 _LIT(KCaptureKeyKeyUpAndDowns, "CaptureKeyKeyUpAndDowns"); |
|
6432 _LIT(KCaptureLongKey, "CaptureLongKey"); |
|
6433 _LIT(KCancelCaptureKey, "CancelCaptureKey"); |
|
6434 _LIT(KCancelCaptureKeyKeyUpAndDowns, "CancelCaptureKeyKeyUpAndDowns"); |
|
6435 _LIT(KCancelCaptureLongKey, "CancelCaptureLongKey"); |
|
6436 _LIT(KLog,"TestCaptureAndCancelCapturePair: %S, %S"); |
|
6437 TPtrC captures[EMaxCaptureKeyApis] = {KCaptureKey(), KCaptureKey(), KCaptureKeyKeyUpAndDowns(), KCaptureKeyKeyUpAndDowns(), KCaptureLongKey(), KCaptureLongKey()}; |
|
6438 TPtrC cancelCaptures[EMaxCancelCaptureKeyApis] = {KCancelCaptureKey(), KCancelCaptureKeyKeyUpAndDowns(), KCancelCaptureLongKey()}; |
|
6439 TLogMessageText logMessageText; |
|
6440 logMessageText.Format(KLog, &captures[aCaptureApi], &cancelCaptures[aCancelCaptureApi]); |
|
6441 INFO_PRINTF1(logMessageText); |
|
6442 #endif // LOGGING |
|
6443 |
|
6444 // Start a key capture using one of the six RWindowGroup Capture***() APIs |
|
6445 switch (aCaptureApi) |
|
6446 { |
|
6447 case ECaptureKey1: |
|
6448 case ECaptureKey2: |
|
6449 // Test RWindowGroup::CaptureKey() |
|
6450 if (aCaptureApi == ECaptureKey1) |
|
6451 iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('A',0,0); |
|
6452 else |
|
6453 iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('A',0,0,1); // priority 1 (default priority is 0) |
|
6454 iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); |
|
6455 TheClient->iWs.Flush(); |
|
6456 User::After(KeyRepeatTime()*3/2); |
|
6457 iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); |
|
6458 TheClient->iWs.Flush(); |
|
6459 AddExpectedKey(EEventKeyDown, 'A'); |
|
6460 AddExpectedKey(EEventKey,'A','a'); |
|
6461 AddExpectedKey(EEventKey,'A','a',1); |
|
6462 AddExpectedKey(EEventKeyUp, 'A'); |
|
6463 break; |
|
6464 |
|
6465 case ECaptureKeyUpAndDowns1: |
|
6466 case ECaptureKeyUpAndDowns2: |
|
6467 // Test RWindowGroup::CaptureKeyUpAndDowns() |
|
6468 if (aCaptureApi == ECaptureKeyUpAndDowns1) |
|
6469 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0); |
|
6470 else |
|
6471 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0,1); // priority 1 (default priority is 0) |
|
6472 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
6473 TheClient->iWs.Flush(); |
|
6474 User::After(KeyRepeatTime()*3/2); |
|
6475 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
6476 TheClient->iWs.Flush(); |
|
6477 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
6478 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
6479 AddExpectedKey(EEventKey,EStdKeySpace,' ',1); |
|
6480 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
6481 break; |
|
6482 |
|
6483 case ECaptureLongKey1: |
|
6484 case ECaptureLongKey2: |
|
6485 { |
|
6486 // Test RWindowGroup::CaptureLongKey() |
|
6487 TTimeIntervalMicroSeconds32 repeat = KeyRepeatTime(); |
|
6488 if (aCaptureApi == ECaptureLongKey1) |
|
6489 { |
|
6490 iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ', 'a', 0, 0, 2, ELongCaptureNormal); |
|
6491 } |
|
6492 else |
|
6493 { |
|
6494 repeat = KeyRepeatTime()/2; |
|
6495 iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(repeat, ' ', 'a', 0, 0, 2, ELongCaptureNormal); |
|
6496 } |
|
6497 iQueueClient->iWs.Flush(); |
|
6498 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); |
|
6499 TheClient->iWs.Flush(); |
|
6500 User::After(KeyRepeatTime()*3/2); |
|
6501 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); |
|
6502 TheClient->iWs.Flush(); |
|
6503 AddExpectedKey(EEventKeyDown,EStdKeySpace); |
|
6504 AddExpectedKey(EEventKey,EStdKeySpace,' '); |
|
6505 AddExpectedKey(EEventKey,EStdKeySpace,'a',1); |
|
6506 AddExpectedKey(EEventKeyUp,EStdKeySpace); |
|
6507 } |
|
6508 break; |
|
6509 |
|
6510 default: |
|
6511 INFO_PRINTF1(_L("Unexpected TCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()")); |
|
6512 TEST(EFalse); |
|
6513 break; |
|
6514 } |
|
6515 |
|
6516 if (iCaptureKey) |
|
6517 { |
|
6518 // End a capture using one of the three RWindowGroup CancelCapture***() APIs, |
|
6519 // for each Capture***() API each one of these will be called, therefore there will |
|
6520 // be one correct CancelCapture***() APIs called and two incorrect CancelCapture***() |
|
6521 // APIs called for each Capture***() API. |
|
6522 switch (aCancelCaptureApi) |
|
6523 { |
|
6524 case ECancelCaptureKey: |
|
6525 iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); |
|
6526 break; |
|
6527 case ECancelCaptureKeyUpAndDowns: |
|
6528 iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey); |
|
6529 break; |
|
6530 case ECancelCaptureLongKey: |
|
6531 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
6532 break; |
|
6533 default: |
|
6534 INFO_PRINTF1(_L("Unexpected TCancelCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()")); |
|
6535 TEST(EFalse); |
|
6536 break; |
|
6537 } |
|
6538 |
|
6539 // If an mistmatched CancelCapture***() API was called, call the correct one now |
|
6540 // to make sure the Capture/CancelCapture state is clean before the next test starts |
|
6541 if ((aCaptureApi/2) != aCancelCaptureApi) |
|
6542 { |
|
6543 switch (aCaptureApi) |
|
6544 { |
|
6545 case ECaptureKey1: |
|
6546 case ECaptureKey2: |
|
6547 iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); |
|
6548 break; |
|
6549 case ECaptureKeyUpAndDowns1: |
|
6550 case ECaptureKeyUpAndDowns2: |
|
6551 iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey); |
|
6552 break; |
|
6553 case ECaptureLongKey1: |
|
6554 case ECaptureLongKey2: |
|
6555 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); |
|
6556 break; |
|
6557 } |
|
6558 } |
|
6559 } |
|
6560 |
|
6561 TheClient->iWs.Flush(); |
|
6562 } |
|
6563 |
|
6564 /*void CTEventTest::_NextSetOfEvents() //Template for these functions |
|
6565 { |
|
6566 switch(iEventSet++) |
|
6567 { |
|
6568 case 0: |
|
6569 iQueueClient->iWin->WinTreeNode()->; //Set up window |
|
6570 iQueueClient->iWin->BaseWin()->; |
|
6571 iQueueClient->iGroup->GroupWin()->; |
|
6572 iQueueClient->iWs.Flush(); //Make take effect |
|
6573 SimulateEvent(TRawEvent::); //Create an event |
|
6574 TheClient->iWs.Flush(); //Send event |
|
6575 AddExpectedEvent(EEventFocusGained); //Always get a focus gain at start |
|
6576 AddExpectedEvent(); //Expect the event that was created above |
|
6577 break; |
|
6578 case 1: |
|
6579 iQueueClient->iWs.Flush(); |
|
6580 SimulateEvent(TRawEvent::); |
|
6581 TheClient->iWs.Flush(); |
|
6582 AddExpectedEvent(); |
|
6583 break; |
|
6584 default: |
|
6585 CActiveScheduler::Stop(); |
|
6586 break; |
|
6587 } |
|
6588 TheClient->iWs.Flush(); |
|
6589 }*/ |
|
6590 |
|
6591 /** |
|
6592 @SYMTestCaseID GRAPHICS-WSERV-CODEBASE-WSERV-0051 |
|
6593 |
|
6594 @SYMPREQ PGM027 |
|
6595 |
|
6596 @SYMTestCaseDesc Tests SetKeyboardRepeatRate API. |
|
6597 |
|
6598 @SYMTestPriority 1 |
|
6599 |
|
6600 @SYMTestStatus Implemented |
|
6601 |
|
6602 @SYMTestActions This test tryes to call SetKeyboardRepeatRate with invalid time values\n |
|
6603 |
|
6604 @SYMTestExpectedResults KeyRepeatRateNegTest should tests the API SetKeyboardRepeatRate return value\n |
|
6605 The test should pass and API should return KErrArgument. |
|
6606 |
|
6607 */ |
|
6608 void CTEventTest::KeyRepeatRateNegTest(TInt aInitialRepeat, TInt aRepeat) |
|
6609 { |
|
6610 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-CODEBASE-WSERV-0051")); |
|
6611 TInt ret=TheClient->iWs.SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32(aInitialRepeat), TTimeIntervalMicroSeconds32(aRepeat)); |
|
6612 TEST(ret==KErrArgument); |
|
6613 TRAPD(err,((CTEventTestStep*)iStep)->RecordTestResultL()); |
|
6614 if (err!=KErrNone) |
|
6615 INFO_PRINTF1(_L("Failed to record test result")); |
|
6616 } |
|
6617 |
|
6618 void CTEventTest::RunTestsL(TBool aNeedChildWindows/*=EFalse*/) |
|
6619 { |
|
6620 iQueueClient=new(ELeave) CTQueueClient(this); |
|
6621 iQueueClient->SetScreenNumber(iTest->iScreenNumber); |
|
6622 iQueueClient->ConstructL(aNeedChildWindows); |
|
6623 iEventSet=0; |
|
6624 TRAPD(err,NextSetOfEventsL()); |
|
6625 if (err!=KErrNone) |
|
6626 { |
|
6627 iFailed=ETrue; |
|
6628 return; |
|
6629 } |
|
6630 // |
|
6631 CActiveScheduler::Start(); |
|
6632 // |
|
6633 TInt eventsLeft=iQueueClient->EventQueue()->EventsLeft(); |
|
6634 if (eventsLeft>0) |
|
6635 iFailed=ETrue; |
|
6636 delete iVisWins1; |
|
6637 iVisWins1 = NULL; |
|
6638 delete iVisWins2; |
|
6639 iVisWins2 = NULL; |
|
6640 delete iQueueClient; |
|
6641 iQueueClient=NULL; |
|
6642 } |
|
6643 |
|
6644 void CTEventTest::RunTestsRestoreAreaL(TBool aNeedChildWindows) |
|
6645 { |
|
6646 TRect area(TheClient->iWs.PointerCursorArea()); |
|
6647 RunTestsL(aNeedChildWindows); |
|
6648 TheClient->iWs.SetPointerCursorArea(area); |
|
6649 } |
|
6650 |
|
6651 /*void CTEventTest::QueuePurgingL() |
|
6652 { |
|
6653 RunTestsL(EFalse); |
|
6654 } |
|
6655 |
|
6656 void CTEventTest::SendEventL() |
|
6657 { |
|
6658 RunTestsL(EFalse); |
|
6659 } |
|
6660 |
|
6661 void CTEventTest::InvisibleWindowL() |
|
6662 { |
|
6663 RunTestsL(ETrue); |
|
6664 } |
|
6665 |
|
6666 void CTEventTest::JavaAdditionsL() |
|
6667 { |
|
6668 RunTestsL(EFalse); |
|
6669 }*/ |
|
6670 |
|
6671 void CTEventTest::WindowCapBugL() |
|
6672 { |
|
6673 RunTestsL(ETrue); |
|
6674 } |
|
6675 |
|
6676 /*void CTEventTest::XyInputTypeL() |
|
6677 { |
|
6678 RunTestsL(EFalse); |
|
6679 } |
|
6680 |
|
6681 void CTEventTest::MovingPointerCursorL() |
|
6682 { |
|
6683 RunTestsRestoreAreaL(ETrue); |
|
6684 } |
|
6685 |
|
6686 void CTEventTest::RotatedModeL() |
|
6687 { |
|
6688 RunTestsRestoreAreaL(EFalse); |
|
6689 }*/ |
|
6690 |
|
6691 /** |
|
6692 * This test creates one anim and calls AddToEventHandlers() twenty times. |
|
6693 * it shouldn't add the same anim to event handler if anim is already in handler. |
|
6694 */ |
|
6695 void CTEventTest::EventHandlerRemoval_AddEventHandlerMultipleTimes() |
|
6696 { |
|
6697 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); |
|
6698 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); |
|
6699 |
|
6700 RRemovableAnim* eventTestAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); |
|
6701 |
|
6702 // Call AddToEventHandlers() on same anim 20 times, it should add this anim in event handler only once |
|
6703 for (TInt count = 0; count < 20; count++) |
|
6704 eventTestAnim->AddToEventHandlers(); |
|
6705 eventTestAnim->SetEventHandlerLifetime(1); |
|
6706 |
|
6707 TRawEvent rawEvent1; |
|
6708 rawEvent1.Set(TRawEvent::EKeyUp, 34); |
|
6709 |
|
6710 eventTestAnim->AddExpectedEvent(rawEvent1); |
|
6711 |
|
6712 // Add these events to iQueueClient for testing |
|
6713 AddExpectedKey(EEventKeyUp, 34, ETrue); |
|
6714 |
|
6715 iTest->SimulateKey(TRawEvent::EKeyUp, 34); |
|
6716 |
|
6717 CleanupStack::PopAndDestroy(eventTestAnim); |
|
6718 TheClient->iWs.SetAutoFlush(iTheClientFlush); |
|
6719 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); |
|
6720 } |
|
6721 |
|
6722 void CTEventTest::EventQueuePtrCrashTest() |
|
6723 // Code designed to hit the defect reported in INC109199 & INC105430, needs a very specific sequence of |
|
6724 // events and client disconnections to hit the exact problem state. |
|
6725 { |
|
6726 const TInt KNumTestEvents=6; |
|
6727 const TInt KMaxNumTestEvents=16; |
|
6728 // Number of iterations needs to be as high as the queue granularity to make sure at least |
|
6729 // once around we actually hit the code to change the queue size |
|
6730 const TInt KNumEvTestIterations=4; |
|
6731 const TInt KNumBaseTestSessions=KNumEvTestIterations+1; |
|
6732 const TInt KNumMainTestSessions=13; |
|
6733 const TInt KMaxNumSessions=KNumBaseTestSessions+KNumMainTestSessions+KNumEvTestIterations; |
|
6734 RWsSession wsSessions[KMaxNumSessions]; |
|
6735 RWindowGroup wGroups[KMaxNumSessions]; |
|
6736 for(TInt iterationLoop=0;iterationLoop<KNumEvTestIterations;iterationLoop++) |
|
6737 { |
|
6738 const TInt numTestSessions=KNumBaseTestSessions+KNumMainTestSessions+iterationLoop; |
|
6739 #if defined(LOGGING) |
|
6740 _LIT(KLog1,"EventQueuePtrCrashTest: Test Creating %d Clients"); |
|
6741 LOG_MESSAGE2(KLog1,numTestSessions); |
|
6742 #endif |
|
6743 for(TInt testSessionIndex=0;testSessionIndex<numTestSessions;testSessionIndex++) |
|
6744 { |
|
6745 RWsSession& ws=wsSessions[testSessionIndex]; |
|
6746 User::LeaveIfError(ws.Connect()); |
|
6747 wGroups[testSessionIndex]=RWindowGroup(ws); |
|
6748 RWindowGroup& group=wGroups[testSessionIndex]; |
|
6749 User::LeaveIfError(group.Construct(testSessionIndex+1,EFalse)); |
|
6750 if (testSessionIndex>=KNumBaseTestSessions) |
|
6751 { |
|
6752 TWsEvent event; |
|
6753 for(TInt evLoop=0;evLoop<KNumTestEvents;evLoop++) |
|
6754 { |
|
6755 event.SetType(1001+evLoop); |
|
6756 ws.SendEventToWindowGroup(group.Identifier(),event); |
|
6757 } |
|
6758 if (testSessionIndex==(numTestSessions-1)) |
|
6759 { |
|
6760 for(TInt eventIndex=0;eventIndex<KMaxNumTestEvents;eventIndex++) |
|
6761 { |
|
6762 event.SetType(1001+eventIndex); |
|
6763 ws.SendEventToAllWindowGroups(event); |
|
6764 } |
|
6765 } |
|
6766 } |
|
6767 } |
|
6768 #if defined(LOGGING) |
|
6769 _LIT(KLog2,"EventQueuePtrCrashTest: Closing Clients"); |
|
6770 LOG_MESSAGE(KLog2); |
|
6771 #endif |
|
6772 TInt closeLoop=0; |
|
6773 while(closeLoop<KNumBaseTestSessions) |
|
6774 { |
|
6775 wsSessions[closeLoop++].Close(); |
|
6776 } |
|
6777 RWsSession extraSession1; |
|
6778 User::LeaveIfError(extraSession1.Connect()); |
|
6779 extraSession1.Close(); |
|
6780 while(closeLoop<numTestSessions) |
|
6781 { |
|
6782 wsSessions[closeLoop++].Close(); |
|
6783 } |
|
6784 } |
|
6785 } |
|
6786 |
|
6787 /** |
|
6788 Test queue size of the new queue can be initialized to be at least EMinQueueSize. |
|
6789 @param aEventReadyCancel whether there is inactive client. This parameter can be specified |
|
6790 to test different code path for expanding spaces for new queue. If the value is false, |
|
6791 the space for the new queue is gained from current global queue or by growing global queue size. |
|
6792 Otherwise, there are inactive clients which cancel their listening to event, in addition, |
|
6793 memory allocation is simulated to be failed when growing global queue size, |
|
6794 so that space is gained by purging events from inactive clients. |
|
6795 */ |
|
6796 void CTEventTest::InitializeQueueSizeTestL(TBool aEventReadyCancel) |
|
6797 { |
|
6798 const TInt numEvents = 50; |
|
6799 const TInt maxClients = 3; |
|
6800 const TInt oneSecond = 1000000; |
|
6801 RWsSession wsSession[maxClients]; |
|
6802 RWindowGroup groupWin[maxClients]; |
|
6803 TRequestStatus status; |
|
6804 TInt cliHanGrpWin = 10000; |
|
6805 RTimer timer; |
|
6806 timer.CreateLocal(); |
|
6807 CleanupClosePushL(timer); |
|
6808 // To have the test creating different number of clients is to make sure |
|
6809 // there is at least one of the tests meets the below requirement: |
|
6810 // the number of the connections when the new queue created for test is not multiple |
|
6811 // of queue granularity, so that the queue size initialization is not done by growing |
|
6812 // global queue size due to the increase of the connections. |
|
6813 for (TInt numClients = maxClients - 1; numClients <= maxClients; numClients++) |
|
6814 { |
|
6815 TInt clientIndex; |
|
6816 //Create test clients |
|
6817 for (clientIndex = 0; clientIndex < numClients; clientIndex++) |
|
6818 { |
|
6819 User::LeaveIfError(wsSession[clientIndex].Connect()); |
|
6820 CleanupClosePushL(wsSession[clientIndex]); |
|
6821 groupWin[clientIndex] = RWindowGroup(wsSession[clientIndex]); |
|
6822 User::LeaveIfError(groupWin[clientIndex].Construct(cliHanGrpWin++)); |
|
6823 CleanupClosePushL(groupWin[clientIndex]); |
|
6824 } |
|
6825 |
|
6826 // Cancel listening to event for the first client. |
|
6827 // This is for testing PurgeInactiveEvents. |
|
6828 if (aEventReadyCancel) |
|
6829 { |
|
6830 wsSession[0].EventReady(&status); |
|
6831 wsSession[0].EventReadyCancel(); |
|
6832 User::WaitForRequest(status); |
|
6833 } |
|
6834 |
|
6835 //send events to window group to make the queue full. |
|
6836 TWsEvent event; |
|
6837 TInt evLoop; |
|
6838 for(evLoop = 0; evLoop < numEvents; evLoop++) |
|
6839 { |
|
6840 event.SetType(2001 + evLoop); |
|
6841 TheClient->iWs.SendEventToWindowGroup(groupWin[0].Identifier(),event); |
|
6842 TheClient->iWs.SendEventToWindowGroup(groupWin[1].Identifier(),event); |
|
6843 } |
|
6844 |
|
6845 //To create a new client, although the queue is full, wserv will guarantee to initialize |
|
6846 //the queue size of the new queue to at least EMinQueueSize. So that it can response to |
|
6847 //the event. |
|
6848 RWsSession testWsSession; |
|
6849 RWindowGroup testGroupWin; |
|
6850 TRequestStatus testStatus; |
|
6851 if (aEventReadyCancel) |
|
6852 { |
|
6853 //Simulate the heap allocation failure to test expanding spaces by purge |
|
6854 //events from inactive clients when initialize queue size. |
|
6855 TInt failAt = 1; |
|
6856 TInt err; |
|
6857 do { |
|
6858 TheClient->iWs.HeapSetFail(RHeap::EFailNext, failAt++); |
|
6859 TheClient->iWs.Flush(); |
|
6860 err = testWsSession.Connect(); |
|
6861 TheClient->iWs.HeapSetFail(RHeap::ENone, 1); |
|
6862 } while (err == KErrNoMemory); |
|
6863 User::LeaveIfError(err); |
|
6864 } |
|
6865 else |
|
6866 { |
|
6867 User::LeaveIfError(testWsSession.Connect()); |
|
6868 } |
|
6869 CleanupClosePushL(testWsSession); |
|
6870 testGroupWin = RWindowGroup(testWsSession); |
|
6871 User::LeaveIfError(testGroupWin.Construct(cliHanGrpWin++)); |
|
6872 CleanupClosePushL(testGroupWin); |
|
6873 |
|
6874 //Send events to the newly created client. |
|
6875 // The Debug version of WServ puts a EEventFocusGained into the event |
|
6876 // before this test's custom event, so leave one slot in the queue |
|
6877 // for it. |
|
6878 #if (defined _DEBUG) |
|
6879 TInt testEventCount = EMinQueueSize - 1; |
|
6880 #else |
|
6881 TInt testEventCount = EMinQueueSize; |
|
6882 #endif |
|
6883 for(TInt evLoop = 0; evLoop < testEventCount; evLoop++) |
|
6884 { |
|
6885 event.SetType(3001 + evLoop); |
|
6886 TheClient->iWs.SendEventToWindowGroup(testGroupWin.Identifier(),event); |
|
6887 } |
|
6888 |
|
6889 //Check the event queue. |
|
6890 //Having a timer here to avoid infinitely wait for event. |
|
6891 TInt expectedEvent = 3001; |
|
6892 for(TInt evLoop = 0; evLoop < EMinQueueSize; evLoop++) |
|
6893 { |
|
6894 testWsSession.EventReady(&testStatus); |
|
6895 TRequestStatus timerStatus; |
|
6896 timer.After(timerStatus, oneSecond); |
|
6897 User::WaitForRequest(testStatus, timerStatus); |
|
6898 TEST(testStatus == 0); |
|
6899 if (testStatus == 0) |
|
6900 { |
|
6901 // Tests the event |
|
6902 testWsSession.GetEvent(event); |
|
6903 // WServ sometimes puts a EEventFocusGained event into the queue |
|
6904 // before the test's custom event, so ignore it. |
|
6905 if (event.Type() != EEventFocusGained) |
|
6906 { |
|
6907 TEST(event.Type() == expectedEvent); |
|
6908 expectedEvent++; |
|
6909 } |
|
6910 // testStatus has been completed. Cancel the timer. |
|
6911 timer.Cancel(); |
|
6912 User::WaitForRequest(timerStatus); |
|
6913 } |
|
6914 else |
|
6915 { |
|
6916 // Times out, cancel the event notification |
|
6917 testWsSession.EventReadyCancel(); |
|
6918 User::WaitForRequest(testStatus); |
|
6919 } |
|
6920 } |
|
6921 CleanupStack::PopAndDestroy(2*numClients + 2, &wsSession[0]); |
|
6922 } |
|
6923 CleanupStack::PopAndDestroy(&timer); |
|
6924 } |
|
6925 |
|
6926 void CTEventTest::SimulateRepeatEvent(TInt aScanCode, TInt aRepeats/*=0*/) |
|
6927 { |
|
6928 TRawEvent rawEvent; |
|
6929 if (aRepeats) |
|
6930 rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode, aRepeats); |
|
6931 else |
|
6932 rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode); |
|
6933 UserSvr::AddEvent(rawEvent); |
|
6934 } |
|
6935 |
|
6936 void CTEventTest::RawEventRepeatTest_NextSetOfEventsL() |
|
6937 { |
|
6938 switch(iEventSet++) |
|
6939 { |
|
6940 case 0: |
|
6941 // Tests EKeyRepeat without repeat value set. |
|
6942 SimulateRepeatEvent(32); |
|
6943 |
|
6944 // Tests EKeyRepeat with repeat value set to 2. |
|
6945 SimulateRepeatEvent(33,2); |
|
6946 |
|
6947 AddExpectedEvent(EEventFocusGained); |
|
6948 AddExpectedKey(EEventKey, 32); |
|
6949 AddExpectedKey(EEventKey, 33, 0, 2); |
|
6950 break; |
|
6951 default: |
|
6952 CActiveScheduler::Stop(); |
|
6953 break; |
|
6954 } |
|
6955 TheClient->iWs.Flush(); |
|
6956 } |
|
6957 |
|
6958 void CTEventTest::RunTestCaseL(TInt /*aCurTestCase*/) |
|
6959 { |
|
6960 _LIT(KTest0,"General 1"); |
|
6961 _LIT(KTest1,"Event queue purging"); |
|
6962 _LIT(KTest2,"SendEvent"); |
|
6963 _LIT(KTest3,"SendEventToAll"); |
|
6964 _LIT(KTest4,"InvisibleWindow"); |
|
6965 _LIT(KTest5,"JavaAdditions"); |
|
6966 _LIT(KTest6,"WindowCaptureBug"); |
|
6967 _LIT(KTest7,"XYInput Types"); |
|
6968 _LIT(KTest8,"MovingPointerCursor"); |
|
6969 _LIT(KTest9,"Rotated Modes"); |
|
6970 _LIT(KTest10,"Anim Event"); |
|
6971 _LIT(KTest11,"Focus Changed"); |
|
6972 _LIT(KTest12,"On/Off Events"); |
|
6973 _LIT(KTest13,"Virtual Keyboard"); |
|
6974 _LIT(KTest14,"Key Clicks"); |
|
6975 _LIT(KTest15,"Capture Long"); |
|
6976 _LIT(KTest16,"Password Window"); |
|
6977 _LIT(KTest17,"Group List Changed"); |
|
6978 _LIT(KTest18,"Repeatable Key Events"); |
|
6979 _LIT(KTest19,"Screen Scaling"); |
|
6980 _LIT(KTest20,"Visibility Changed Events"); |
|
6981 _LIT(KTest21,"Check Time Stamp Of Events"); |
|
6982 _LIT(KTest22,"Pointer Capture Priority Events"); |
|
6983 _LIT(KTest23,"Event Handler Removal"); |
|
6984 _LIT(KTest24,"Event Queue ptr crash test"); |
|
6985 _LIT(KTest25,"Mismatched Pointer Events"); |
|
6986 _LIT(KTest26,"Pointer Buffer Purge"); |
|
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"); |
|
6993 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
6994 _LIT(KTest32,"Transparent Surface Visibility Changed Events 1"); |
|
6995 _LIT(KTest33,"Transparent Surface Visibility Changed Events 2"); |
|
6996 _LIT(KTest34,"Transparent Surface Visibility Changed Events 3"); |
|
6997 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
6998 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
6999 _LIT(KTest35A,"Initialize Queue Size without inactive queue"); |
|
7000 _LIT(KTest35B,"Initialize Queue Size with inactive queue"); |
|
7001 |
|
7002 if (!TestBase()->ConfigurationSupportsPointerEventTesting()) |
|
7003 { |
|
7004 INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing")); |
|
7005 TestComplete(); |
|
7006 return; |
|
7007 } |
|
7008 |
|
7009 //if (iTest->iState==1) iTest->iState=14; //Use this line to skip to a particular test |
|
7010 ((CTEventTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); |
|
7011 switch(iTest->iState) |
|
7012 { |
|
7013 /** |
|
7014 @SYMTestCaseID GRAPHICS-WSERV-0053 |
|
7015 |
|
7016 @SYMDEF DEF081259 |
|
7017 |
|
7018 @SYMTestCaseDesc Carry out general event tests on WServ |
|
7019 |
|
7020 @SYMTestPriority High |
|
7021 |
|
7022 @SYMTestStatus Implemented |
|
7023 |
|
7024 @SYMTestActions General events are sent via WServ |
|
7025 |
|
7026 @SYMTestExpectedResults The events are sent without error |
|
7027 */ |
|
7028 case 0: |
|
7029 iTest->LogSubTest(KTest0); |
|
7030 General(); |
|
7031 ((CTEventTestStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-WSERV-0053")); |
|
7032 //iState=8; |
|
7033 break; |
|
7034 /** |
|
7035 @SYMTestCaseID GRAPHICS-WSERV-0054 |
|
7036 |
|
7037 @SYMDEF DEF081259 |
|
7038 |
|
7039 @SYMTestCaseDesc Carry out event queue purging |
|
7040 |
|
7041 @SYMTestPriority High |
|
7042 |
|
7043 @SYMTestStatus Implemented |
|
7044 |
|
7045 @SYMTestActions Purge the event queue |
|
7046 |
|
7047 @SYMTestExpectedResults The events queue is purged without error |
|
7048 */ |
|
7049 case 1: |
|
7050 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0054")); |
|
7051 iTest->LogSubTest(KTest1); |
|
7052 RunTestsL(); //QueuePurgingL(); |
|
7053 break; |
|
7054 /** |
|
7055 @SYMTestCaseID GRAPHICS-WSERV-0055 |
|
7056 |
|
7057 @SYMDEF DEF081259 |
|
7058 |
|
7059 @SYMTestCaseDesc Test that events can be sent |
|
7060 |
|
7061 @SYMTestPriority High |
|
7062 |
|
7063 @SYMTestStatus Implemented |
|
7064 |
|
7065 @SYMTestActions Send events in WServ |
|
7066 |
|
7067 @SYMTestExpectedResults The events are sent without error |
|
7068 */ |
|
7069 case 2: |
|
7070 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0055")); |
|
7071 iTest->LogSubTest(KTest2); |
|
7072 RunTestsL(); //SendEventL(); |
|
7073 break; |
|
7074 /** |
|
7075 @SYMTestCaseID GRAPHICS-WSERV-0056 |
|
7076 |
|
7077 @SYMDEF DEF081259 |
|
7078 |
|
7079 @SYMTestCaseDesc Send an event to all window groups |
|
7080 |
|
7081 @SYMTestPriority High |
|
7082 |
|
7083 @SYMTestStatus Implemented |
|
7084 |
|
7085 @SYMTestActions Send an event to all window groups |
|
7086 |
|
7087 @SYMTestExpectedResults The events are sent to all window groups |
|
7088 without error |
|
7089 */ |
|
7090 case 3: |
|
7091 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0056")); |
|
7092 iTest->LogSubTest(KTest3); |
|
7093 General2(); |
|
7094 break; |
|
7095 /** |
|
7096 @SYMTestCaseID GRAPHICS-WSERV-0057 |
|
7097 |
|
7098 @SYMDEF DEF081259 |
|
7099 |
|
7100 @SYMTestCaseDesc Send events to an invisible window |
|
7101 |
|
7102 @SYMTestPriority High |
|
7103 |
|
7104 @SYMTestStatus Implemented |
|
7105 |
|
7106 @SYMTestActions Send events to an invisible window |
|
7107 |
|
7108 @SYMTestExpectedResults The events are sent to the window without |
|
7109 error |
|
7110 */ |
|
7111 case 4: |
|
7112 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0057")); |
|
7113 iTest->LogSubTest(KTest4); |
|
7114 RunTestsL(ETrue); //InvisibleWindowL(); |
|
7115 break; |
|
7116 /** |
|
7117 @SYMTestCaseID GRAPHICS-WSERV-0058 |
|
7118 |
|
7119 @SYMDEF DEF081259 |
|
7120 |
|
7121 @SYMTestCaseDesc Send events for java additions |
|
7122 |
|
7123 @SYMTestPriority High |
|
7124 |
|
7125 @SYMTestStatus Implemented |
|
7126 |
|
7127 @SYMTestActions Send events for java additions |
|
7128 |
|
7129 @SYMTestExpectedResults The events are sent to the window without |
|
7130 error |
|
7131 */ |
|
7132 case 5: |
|
7133 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0058")); |
|
7134 iTest->LogSubTest(KTest5); |
|
7135 RunTestsL(); //JavaAdditionsL(); |
|
7136 break; |
|
7137 |
|
7138 case 6: |
|
7139 ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
7140 iTest->LogSubTest(KTest6); |
|
7141 //WindowCapBugL(); //Not finished |
|
7142 break; |
|
7143 /** |
|
7144 @SYMTestCaseID GRAPHICS-WSERV-0059 |
|
7145 |
|
7146 @SYMDEF DEF081259 |
|
7147 |
|
7148 @SYMTestCaseDesc Send events for x and y inputs |
|
7149 |
|
7150 @SYMTestPriority High |
|
7151 |
|
7152 @SYMTestStatus Implemented |
|
7153 |
|
7154 @SYMTestActions Send events for x and y inputs |
|
7155 |
|
7156 @SYMTestExpectedResults The events are sent to the window without |
|
7157 error |
|
7158 */ |
|
7159 case 7: |
|
7160 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0059")); |
|
7161 iTest->LogSubTest(KTest7); |
|
7162 RunTestsL(); //XyInputTypeL(); |
|
7163 break; |
|
7164 /** |
|
7165 @SYMTestCaseID GRAPHICS-WSERV-0060 |
|
7166 |
|
7167 @SYMDEF DEF081259 |
|
7168 |
|
7169 @SYMTestCaseDesc Send events for moving pointer cursor |
|
7170 |
|
7171 @SYMTestPriority High |
|
7172 |
|
7173 @SYMTestStatus Implemented |
|
7174 |
|
7175 @SYMTestActions Send events for moving pointer cursor |
|
7176 |
|
7177 @SYMTestExpectedResults The events are sent to the window without |
|
7178 error |
|
7179 */ |
|
7180 case 8: |
|
7181 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0060")); |
|
7182 iTest->LogSubTest(KTest8); |
|
7183 RunTestsRestoreAreaL(ETrue); //MovingPointerCursorL(); |
|
7184 break; |
|
7185 /** |
|
7186 @SYMTestCaseID GRAPHICS-WSERV-0061 |
|
7187 |
|
7188 @SYMDEF DEF081259 |
|
7189 |
|
7190 @SYMTestCaseDesc Send events for rotate mode |
|
7191 |
|
7192 @SYMTestPriority High |
|
7193 |
|
7194 @SYMTestStatus Implemented |
|
7195 |
|
7196 @SYMTestActions Send events for rotate mode |
|
7197 |
|
7198 @SYMTestExpectedResults The events are sent to the window without |
|
7199 error |
|
7200 */ |
|
7201 case 9: |
|
7202 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0061")); |
|
7203 iTest->LogSubTest(KTest9); |
|
7204 RunTestsRestoreAreaL(EFalse); //RotatedModeL(); |
|
7205 break; |
|
7206 /** |
|
7207 @SYMTestCaseID GRAPHICS-WSERV-0062 |
|
7208 |
|
7209 @SYMDEF DEF081259 |
|
7210 |
|
7211 @SYMTestCaseDesc Send events for an anim event |
|
7212 |
|
7213 @SYMTestPriority High |
|
7214 |
|
7215 @SYMTestStatus Implemented |
|
7216 |
|
7217 @SYMTestActions Send events for an anim event |
|
7218 |
|
7219 @SYMTestExpectedResults The events are sent to the window without |
|
7220 error |
|
7221 */ |
|
7222 case 10: |
|
7223 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0062")); |
|
7224 iTest->LogSubTest(KTest10); |
|
7225 RunTestsRestoreAreaL(EFalse); //AnimEvent(); |
|
7226 break; |
|
7227 /** |
|
7228 @SYMTestCaseID GRAPHICS-WSERV-0063 |
|
7229 |
|
7230 @SYMDEF DEF081259 |
|
7231 |
|
7232 @SYMTestCaseDesc Send events for focus changed |
|
7233 |
|
7234 @SYMTestPriority High |
|
7235 |
|
7236 @SYMTestStatus Implemented |
|
7237 |
|
7238 @SYMTestActions Send events for focus changed |
|
7239 |
|
7240 @SYMTestExpectedResults The events are sent to the window without |
|
7241 error |
|
7242 */ |
|
7243 case 11: |
|
7244 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0063")); |
|
7245 iTest->LogSubTest(KTest11); |
|
7246 RunTestsL(); //FocusChanged(); |
|
7247 break; |
|
7248 /** |
|
7249 @SYMTestCaseID GRAPHICS-WSERV-0064 |
|
7250 |
|
7251 @SYMDEF DEF081259 |
|
7252 |
|
7253 @SYMTestCaseDesc Send stop events |
|
7254 |
|
7255 @SYMTestPriority High |
|
7256 |
|
7257 @SYMTestStatus Implemented |
|
7258 |
|
7259 @SYMTestActions Send stop events |
|
7260 |
|
7261 @SYMTestExpectedResults The events are sent to the window without |
|
7262 error |
|
7263 */ |
|
7264 case 12: |
|
7265 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0064")); |
|
7266 iTest->LogSubTest(KTest12); |
|
7267 RunTestsL(ETrue); //StopEvents(); |
|
7268 break; |
|
7269 /** |
|
7270 @SYMTestCaseID GRAPHICS-WSERV-0065 |
|
7271 |
|
7272 @SYMDEF DEF081259 |
|
7273 |
|
7274 @SYMTestCaseDesc Send events for the virtual keyboard |
|
7275 |
|
7276 @SYMTestPriority High |
|
7277 |
|
7278 @SYMTestStatus Implemented |
|
7279 |
|
7280 @SYMTestActions Send events for the virtual keyboard |
|
7281 |
|
7282 @SYMTestExpectedResults The events are sent to the window without |
|
7283 error |
|
7284 */ |
|
7285 case 13: |
|
7286 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0065")); |
|
7287 iTest->LogSubTest(KTest13); |
|
7288 RunTestsL(); //VirtualKeyboard(); |
|
7289 break; |
|
7290 /** |
|
7291 @SYMTestCaseID GRAPHICS-WSERV-0066 |
|
7292 |
|
7293 @SYMDEF DEF081259 |
|
7294 |
|
7295 @SYMTestCaseDesc Send events for key clicks |
|
7296 |
|
7297 @SYMTestPriority High |
|
7298 |
|
7299 @SYMTestStatus Implemented |
|
7300 |
|
7301 @SYMTestActions Send stop events |
|
7302 |
|
7303 @SYMTestExpectedResults The events are sent to the window without |
|
7304 error |
|
7305 */ |
|
7306 case 14: |
|
7307 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0066")); |
|
7308 iTest->LogSubTest(KTest14); |
|
7309 { |
|
7310 TBool changeable; |
|
7311 if (iClick.IsLoaded(changeable) && !iTest->IsFullRomL()) |
|
7312 RunTestsL(ETrue); //KeyClicks(); |
|
7313 } |
|
7314 break; |
|
7315 /** |
|
7316 @SYMTestCaseID GRAPHICS-WSERV-0067 |
|
7317 |
|
7318 @SYMDEF DEF081259 |
|
7319 |
|
7320 @SYMTestCaseDesc Test RWindowGroup::CaptureLongKey() |
|
7321 |
|
7322 @SYMTestPriority High |
|
7323 |
|
7324 @SYMTestStatus Implemented |
|
7325 |
|
7326 @SYMTestActions Simulate long key presses and check that long key capture |
|
7327 and key repeat work as expected. |
|
7328 |
|
7329 @SYMTestExpectedResults The correct key events are sent to the window without |
|
7330 error |
|
7331 */ |
|
7332 case 15: |
|
7333 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0067")); |
|
7334 iTest->LogSubTest(KTest15); |
|
7335 RunTestsL(ETrue); //CaptureLong(); |
|
7336 break; |
|
7337 /** |
|
7338 @SYMTestCaseID GRAPHICS-WSERV-0068 |
|
7339 |
|
7340 @SYMDEF DEF081259 |
|
7341 |
|
7342 @SYMTestCaseDesc Send events for activating password |
|
7343 |
|
7344 @SYMTestPriority High |
|
7345 |
|
7346 @SYMTestStatus Implemented |
|
7347 |
|
7348 @SYMTestActions Send events for activating password |
|
7349 |
|
7350 @SYMTestExpectedResults The events are sent to the window without |
|
7351 error |
|
7352 */ |
|
7353 case 16: |
|
7354 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0068")); |
|
7355 iTest->LogSubTest(KTest16); |
|
7356 if (!iTest->IsFullRomL()) |
|
7357 RunTestsL(); //Password(); |
|
7358 break; |
|
7359 /** |
|
7360 @SYMTestCaseID GRAPHICS-WSERV-0069 |
|
7361 |
|
7362 @SYMDEF DEF081259 |
|
7363 |
|
7364 @SYMTestCaseDesc Send events for activating password |
|
7365 |
|
7366 @SYMTestPriority High |
|
7367 |
|
7368 @SYMTestStatus Implemented |
|
7369 |
|
7370 @SYMTestActions Send events for activating password |
|
7371 |
|
7372 @SYMTestExpectedResults The events are sent to the window without |
|
7373 error |
|
7374 */ |
|
7375 case 17: |
|
7376 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0069")); |
|
7377 iTest->LogSubTest(KTest17); |
|
7378 RunTestsL(); |
|
7379 break; |
|
7380 /** |
|
7381 @SYMTestCaseID GRAPHICS-WSERV-0070 |
|
7382 |
|
7383 @SYMDEF DEF081259 |
|
7384 |
|
7385 @SYMTestCaseDesc Send repeatable key events |
|
7386 |
|
7387 @SYMTestPriority High |
|
7388 |
|
7389 @SYMTestStatus Implemented |
|
7390 |
|
7391 @SYMTestActions Send repeatable key events |
|
7392 |
|
7393 @SYMTestExpectedResults The events are sent to the window without |
|
7394 error |
|
7395 */ |
|
7396 case 18: |
|
7397 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0070")); |
|
7398 iTest->LogSubTest(KTest18); |
|
7399 RunTestsL(); |
|
7400 break; |
|
7401 /** |
|
7402 @SYMTestCaseID GRAPHICS-WSERV-0071 |
|
7403 |
|
7404 @SYMDEF DEF081259 |
|
7405 |
|
7406 @SYMTestCaseDesc Send Screen Scaling events |
|
7407 |
|
7408 @SYMTestPriority High |
|
7409 |
|
7410 @SYMTestStatus Implemented |
|
7411 |
|
7412 @SYMTestActions Send Screen Scaling events |
|
7413 |
|
7414 @SYMTestExpectedResults The events are sent to the window without |
|
7415 error |
|
7416 */ |
|
7417 case 19: |
|
7418 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0071")); |
|
7419 iTest->LogSubTest(KTest19); |
|
7420 if (iScreenModeTests&EDoScale) |
|
7421 { |
|
7422 RunTestsL(); |
|
7423 } |
|
7424 break; |
|
7425 /** |
|
7426 @SYMTestCaseID GRAPHICS-WSERV-0072 |
|
7427 |
|
7428 @SYMDEF DEF081259 |
|
7429 |
|
7430 @SYMTestCaseDesc Send Visibility Changed events |
|
7431 |
|
7432 @SYMTestPriority High |
|
7433 |
|
7434 @SYMTestStatus Implemented |
|
7435 |
|
7436 @SYMTestActions Send Visibility Changed events |
|
7437 |
|
7438 @SYMTestExpectedResults The events are sent to the window without |
|
7439 error |
|
7440 */ |
|
7441 case 20: |
|
7442 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0072")); |
|
7443 iTest->LogSubTest(KTest20); |
|
7444 RunTestsL(); |
|
7445 break; |
|
7446 /** |
|
7447 @SYMTestCaseID GRAPHICS-WSERV-0073 |
|
7448 |
|
7449 @SYMDEF DEF081259 |
|
7450 |
|
7451 @SYMTestCaseDesc Check Time Stamp Of Sent Events |
|
7452 |
|
7453 @SYMTestPriority High |
|
7454 |
|
7455 @SYMTestStatus Implemented |
|
7456 |
|
7457 @SYMTestActions Check Time Stamp Of Sent Events |
|
7458 |
|
7459 @SYMTestExpectedResults The time stamps for the events are correct |
|
7460 */ |
|
7461 case 21: |
|
7462 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0073")); |
|
7463 iTest->LogSubTest(KTest21); |
|
7464 RunTestsL(); |
|
7465 break; |
|
7466 /** |
|
7467 @SYMTestCaseID GRAPHICS-WSERV-0074 |
|
7468 |
|
7469 @SYMDEF DEF081259 |
|
7470 |
|
7471 @SYMTestCaseDesc Send Pointer Capture Priority Events |
|
7472 |
|
7473 @SYMTestPriority High |
|
7474 |
|
7475 @SYMTestStatus Implemented |
|
7476 |
|
7477 @SYMTestActions Send Pointer Capture Priority Events |
|
7478 |
|
7479 @SYMTestExpectedResults The events are sent to the window without |
|
7480 error |
|
7481 */ |
|
7482 case 22: |
|
7483 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0074")); |
|
7484 iTest->LogSubTest(KTest22); |
|
7485 RunTestsL(); |
|
7486 break; |
|
7487 /** |
|
7488 @SYMTestCaseID GRAPHICS-WSERV-0343 |
|
7489 |
|
7490 @SYMDEF DEF081259 |
|
7491 |
|
7492 @SYMTestCaseDesc Send Event Handler Removal Events |
|
7493 |
|
7494 @SYMTestPriority High |
|
7495 |
|
7496 @SYMTestStatus Implemented |
|
7497 |
|
7498 @SYMTestActions Send Event Handler Removal Events |
|
7499 |
|
7500 @SYMTestExpectedResults The events are sent to the window without |
|
7501 error |
|
7502 */ |
|
7503 case 23: |
|
7504 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0343")); |
|
7505 iTest->LogSubTest(KTest23); |
|
7506 RunTestsL(); //EventHandlerRemoval(); |
|
7507 break; |
|
7508 case 24: |
|
7509 /** |
|
7510 @SYMTestCaseID GRAPHICS-WSERV-0565 |
|
7511 */ |
|
7512 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0565")); |
|
7513 iTest->LogSubTest(KTest24); |
|
7514 EventQueuePtrCrashTest(); |
|
7515 break; |
|
7516 /** |
|
7517 @SYMTestCaseID GRAPHICS-WSERV-0496 |
|
7518 |
|
7519 @SYMDEF DEF133776 |
|
7520 |
|
7521 @SYMTestCaseDesc Cancels key captures using all combinations of |
|
7522 RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs. |
|
7523 |
|
7524 @SYMTestPriority High |
|
7525 |
|
7526 @SYMTestStatus Implemented |
|
7527 |
|
7528 @SYMTestActions Call each of the RWindowGroup::Capture***() APIs followed by |
|
7529 each of the RWindowGroup::CancelCapture***() APIs. |
|
7530 RWindowGroup::Capture***() APIs: |
|
7531 CaptureKey(TUint, TUint, TUint) |
|
7532 CaptureKey(TUint, TUint, TUint, TInt) |
|
7533 CaptureKeyUpAndDowns(TUint, TUint, TUint) |
|
7534 CaptureKeyUpAndDowns(TUint, TUint, TUint, TInt) |
|
7535 CaptureLongKey(TUint, TUint, TUint, TUint, TInt, TUint) |
|
7536 CaptureLongKey(TTimeIntervalMicroSeconds32, TUint, TUint, TUint, TUint, TInt, TUint) |
|
7537 RWindowGroup::CancelCapture***() APIs: |
|
7538 CancelCaptureKey() |
|
7539 CancelCaptureKeyUpAndDowns() |
|
7540 CancelCaptureLongKey() |
|
7541 |
|
7542 @SYMTestExpectedResults WServ should handle matched and mismatched Cancel |
|
7543 and Capture calls without panicking. |
|
7544 */ |
|
7545 case 25: |
|
7546 // Skip this test in debug on the emulator, run it always on hardware as debug ROMs include |
|
7547 // a release version of the production code that doesn't panic |
|
7548 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0496")); |
|
7549 #if defined(_DEBUG) && !defined (__MARM__) |
|
7550 INFO_PRINTF1(_L("Skipping this test in _DEBUG on emulator to avoid debug only panics, see GRAPHICS-WSERV-0497 for the matching panic test")); |
|
7551 #else |
|
7552 iTest->LogSubTest(KTest25); |
|
7553 RunTestsL(); |
|
7554 #endif |
|
7555 break; |
|
7556 /** |
|
7557 @SYMTestCaseID GRAPHICS-WSERV-0444 |
|
7558 |
|
7559 @SYMDEF PDEF110849 |
|
7560 |
|
7561 @SYMTestCaseDesc Pointer Buffer Exception After Event Queue Purge |
|
7562 |
|
7563 @SYMTestPriority High |
|
7564 |
|
7565 @SYMTestStatus Implemented |
|
7566 |
|
7567 @SYMTestActions Connect to pointer buffer, send it some pointer events and disconnect. |
|
7568 Now send enough events to cause an event queue purge. The purge will |
|
7569 attempt to empty the pointer buffer, but will fail because we have disconnected. |
|
7570 |
|
7571 @SYMTestExpectedResults The purge will realise it does not need to empty the pointer buffer and |
|
7572 so there will not be an access violation - exception. |
|
7573 |
|
7574 */ |
|
7575 case 26: |
|
7576 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0444")); |
|
7577 iTest->LogSubTest(KTest26); |
|
7578 RunTestsL(); |
|
7579 break; |
|
7580 /** |
|
7581 @SYMTestCaseID GRAPHICS-WSERV-0484 |
|
7582 @SYMDEF PDEF120721 |
|
7583 @SYMTestCaseDesc Window server guarantees to initialize the queue size of the new queue to |
|
7584 at least EMinQueueSize. |
|
7585 @SYMTestPriority High |
|
7586 @SYMTestStatus Implemented |
|
7587 @SYMTestActions Create multiple clients to connect to window server. |
|
7588 Send enough events to make the event queue full. |
|
7589 Create a new client to connect to window server. |
|
7590 Send events to the new client and test that the new client |
|
7591 can get the events. |
|
7592 @SYMTestExpectedResults Window server guarantees to initialize the size of the new event |
|
7593 queue to EMinQueueSize, so that window server will not lock up |
|
7594 due to the full of global event queue. |
|
7595 |
|
7596 */ |
|
7597 case 27: |
|
7598 iTest->LogSubTest(KTest27); |
|
7599 RunTestsL(); |
|
7600 break; |
|
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 |
|
7713 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
7714 /** |
|
7715 @SYMTestCaseID GRAPHICS-WSERV-2669-0015 |
|
7716 @SYMREQ REQ13202: Possibility for external layers to appear above UI layer |
|
7717 @SYMTestCaseDesc Window obscured by transparent surface window receives |
|
7718 (EPartiallyVisible | EFullyVisible) when surface is made semi-transparent. |
|
7719 @SYMTestPriority 2 |
|
7720 @SYMPrerequisites Win1 – bottom window |
|
7721 Win2 – middle window with background surface, which totally obscures win1 |
|
7722 @SYMTestActions Call SetSurfaceTransparency(ETrue) on win2 |
|
7723 @SYMTestExpectedResults Win1 receives visibility event |
|
7724 */ |
|
7725 case 32: |
|
7726 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0015")); |
|
7727 iTest->LogSubTest(KTest32); |
|
7728 RunTestsL(); |
|
7729 break; |
|
7730 /** |
|
7731 @SYMTestCaseID GRAPHICS-WSERV-2669-0016 |
|
7732 @SYMREQ REQ13202: Possibility for external layers to appear above UI layer |
|
7733 @SYMTestCaseDesc Window obscured by semi-transparent surface window receives |
|
7734 (EPartiallyVisible | EFullyVisible) when obscuring window is deleted |
|
7735 @SYMTestPriority 2 |
|
7736 @SYMPrerequisites Win1 – bottom window |
|
7737 Win2 – middle window with semi-transparent background surface, which totally obscures win1 |
|
7738 Win3 – top window which totally obscures win2, and is opaque |
|
7739 @SYMTestActions Delete win3 |
|
7740 @SYMTestExpectedResults Both win1 and win2 receive visibility events |
|
7741 */ |
|
7742 case 33: |
|
7743 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0016")); |
|
7744 iTest->LogSubTest(KTest33); |
|
7745 RunTestsL(); |
|
7746 break; |
|
7747 /** |
|
7748 @SYMTestCaseID GRAPHICS-WSERV-2669-0017 |
|
7749 @SYMREQ REQ13202: Possibility for external layers to appear above UI layer |
|
7750 @SYMTestCaseDesc Window does not receive any visibiliy event when a semi-transparent |
|
7751 surface is moved onto/above it. |
|
7752 @SYMTestPriority 2 |
|
7753 @SYMPrerequisites Win1 – bottom window |
|
7754 Win2 – top window which does not overlap win1 |
|
7755 @SYMTestActions Move win2 to overlap win1 |
|
7756 @SYMTestExpectedResults No visibility event is received (win1 is still fully visible) |
|
7757 */ |
|
7758 case 34: |
|
7759 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0017")); |
|
7760 iTest->LogSubTest(KTest34); |
|
7761 RunTestsL(); |
|
7762 break; |
|
7763 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
7764 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
7765 |
|
7766 /** |
|
7767 @SYMTestCaseID GRAPHICS-WSERV-0559 |
|
7768 @SYMDEF INC140850 |
|
7769 @SYMTestCaseDesc To check Wserv passes correct repeat value for TRawEvent of type EKeyRepeat. |
|
7770 @SYMTestPriority High |
|
7771 @SYMTestStatus Implemented |
|
7772 @SYMTestActions Simulate TRawEvent of type EKeyRepeat without Repeat value set. |
|
7773 Simulate the above with repeat value set to 2. |
|
7774 @SYMTestExpectedResults Simulated events should match expected events added to the array. |
|
7775 */ |
|
7776 |
|
7777 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA |
|
7778 case 28: |
|
7779 #else |
|
7780 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS |
|
7781 case 35: |
|
7782 #else |
|
7783 case 32: |
|
7784 #endif |
|
7785 #endif |
|
7786 // This test was moved to be the last test in the test suite, because it sometimes leaves events in the event queue, |
|
7787 //it can affect the results of other tests. This test case should be the last test in the test suite. |
|
7788 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0484")); |
|
7789 iTest->LogSubTest(KTest35A); |
|
7790 InitializeQueueSizeTestL(EFalse); |
|
7791 iTest->LogSubTest(KTest35B); |
|
7792 InitializeQueueSizeTestL(ETrue); |
|
7793 break; |
|
7794 |
|
7795 default: |
|
7796 ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); |
|
7797 ((CTEventTestStep*)iStep)->CloseTMSGraphicsStep(); |
|
7798 TestComplete(); |
|
7799 break; |
|
7800 } |
|
7801 ((CTEventTestStep*)iStep)->RecordTestResultL(); |
|
7802 if (iFailed) |
|
7803 { |
|
7804 TEST(EFalse); |
|
7805 iFailed=EFalse; |
|
7806 } |
|
7807 ++iTest->iState; |
|
7808 } |
|
7809 |
|
7810 __WS_CONSTRUCT_STEP__(EventTest) |
|
7811 |