First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Test window server events
21 @internalComponent - Internal Symbian test code
24 #ifndef __INIPARSER_H__
25 #define __INIPARSER_H__
26 #endif // __INIPARSER_H__
28 #include "PARSEINIDATA.H"
34 #define FAIL_LOGGING on
36 #define LOGGING 1 //Uncomment this when there is a fail so that you get more logging
38 _LIT(KKeyClickPluginDll, "click.dll");
40 const TInt KLongKeyCaptureLowPriority = 1;
41 const TInt KLongKeyCaptureHighPriority = 2;
43 CTQueueClient::CTQueueClient(CTEventTest *aTest) : iTest(aTest)
47 CTQueueClient::~CTQueueClient()
49 CloseEventTestGroupOnSecondScreen();
50 iGroup->GroupWin()->EnableReceiptOfFocus(EFalse);
56 void CTQueueClient::ConstructL(TBool aCreateChild)
58 CTClient::ConstructL();
59 iGroup=new(ELeave) CTQueueWindowGroup(this);
61 iWin=new(ELeave) CTBackedUpWin(EGray4);
62 iWin->ConstructExtLD(*iGroup,TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight));
66 iChildWin=new(ELeave) CTBackedUpWin(EGray4);
67 iChildWin->ConstructExtLD(*iWin,ChildTopLeft(),ChildSize());
68 iChildWin->Activate();
73 void CTQueueClient::ConstructEventHandlerL()
75 iEventHandler=new(ELeave) CTQueueTestEvent(&iWs, iTest);
76 ((CTQueueTestEvent *)iEventHandler)->ConstructL();
79 TInt CTQueueClient::WindowGroupIdentifier()
81 return(iGroup->GroupWin()->Identifier());
84 CTWinBase* CTQueueClient::GetHandle(TPoint& aPos)
88 if (iChildWin && TRect(ChildTopLeft(),ChildSize()).Contains(aPos))
89 //if (iChildWin && TRect(TPoint(),ChildSize()).Contains(aPos))
99 void CTQueueClient::AddExpectedEvent(TWsEvent &aEvent)
101 #if defined(DETAILED)
102 _LIT(KLog," Adding Event Type=%d");
104 buf.Format(KLog,aEvent.Type());
107 ((CTQueueTestEvent *)iEventHandler)->AddExpectedEvent(aEvent);
110 void CTQueueClient::SetChildCapture(TInt aCaptureFlags)
114 iChildWin->BaseWin()->SetPointerCapture(aCaptureFlags);
115 if (aCaptureFlags|RWindowBase::TCaptureFlagEnabled)
116 iChildCapturing=ETrue;
120 CTQueueTestEvent::CTQueueTestEvent(RWsSession *aWs, CTEventTest *aTest) : CTEvent(aWs)
123 iCheckTimeStamp = EFalse;
124 iLastEventError = EFalse;
127 void CTQueueTestEvent::ConstructL()
129 CTEventBase::Construct();
130 iEventBuffer.SetLengthL(EEventBufferSize);
131 iRedrawType=iTest->TestBase()->RedrawStoreTypeL();
134 void CTQueueTestEvent::TestL(TInt aTest)
139 User::Leave(ETestFailed);
143 //#define FAIL_LOGGING yes
144 void CTQueueTestEvent::doRunL()
147 iWs->GetEvent(wsEvent);
148 TWsEvent expectedEvent;
150 #if defined(FAIL_LOGGING)
151 TInt eType,wsHan,eHan,wsKeyCode,eKeyCode,wsKeyRepeat,eKeyRepeat,wsKeyScan,eKeyScan;
153 _LIT(KStartString,"AUTO EventTestFail ");
155 TInt wsType=wsEvent.Type();
156 if (wsEvent.Type()==EEventNull)
157 TestL(wsEvent.Handle()==0);
160 TInt count=iEventBuffer.Count();
161 if (count==0 && wsType==EEventFocusGained)
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
167 #if defined(DETAILED)
168 _LIT(KLog,"Skip Duplicate Error Message");
169 iTest->LOG_MESSAGE(KLog);
171 return; //Ignore repeated error events
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);
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();
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);
193 #if defined(DETAILED)
194 _LIT(KLog," Count=%d Event Type=%d");
195 iTest->LOG_MESSAGE3(KLog,iEventCount,wsType);
200 _LIT(KHandlesDiff,"Count=%d Handles Differ");
201 buf.Copy(KStartString);
202 buf.AppendFormat(KHandlesDiff,iEventCount);
203 iTest->LOG_MESSAGE(buf);
206 TestL(wsEvent.Type()==expectedEvent.Type() && wsEvent.Handle()==expectedEvent.Handle());
208 iLastEventError=(wsEvent.Type()==EEventErrorMessage);
210 switch(wsEvent.Type())
213 #if defined(FAIL_LOGGING)
214 wsKeyCode=wsEvent.Key()->iCode,eKeyCode=expectedEvent.Key()->iCode;
215 if (wsKeyCode!=eKeyCode)
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);
222 wsKeyRepeat=wsEvent.Key()->iRepeats,eKeyRepeat=expectedEvent.Key()->iRepeats;
223 if ((wsKeyRepeat>0)!=(eKeyRepeat>0) || wsKeyRepeat<eKeyRepeat)
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);
231 TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode &&
232 wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats &&
233 (wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0));
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)
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);
250 if (eModifiers != KModifiersIgnore && wsModifiers != eModifiers)
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);
258 TestL(wsEvent.Key()->iScanCode == expectedEvent.Key()->iScanCode &&
259 (eModifiers == KModifiersIgnore || wsModifiers == eModifiers));
262 case EEventModifiersChanged:
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)
271 _LIT(KModDiff,"Count=%d Modifiers");
272 buf.Copy(KStartString);
273 buf.AppendFormat(KModDiff,iEventCount);
274 iTest->LOG_MESSAGE(buf);
277 TestL(changeModifiersOK);
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)
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);
294 if (actualPos!=expectedPos)
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);
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.
308 case EEventWindowVisibilityChanged:
310 #if defined(FAIL_LOGGING)
311 TUint expectedFlags=expectedEvent.VisibilityChanged()->iFlags;
312 TUint actualFlags=wsEvent.VisibilityChanged()->iFlags;
313 if (actualFlags!=expectedFlags)
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);
321 TestL(wsEvent.VisibilityChanged()->iFlags==expectedEvent.VisibilityChanged()->iFlags);
322 TInt count=iEventBuffer.Count();count++; //Dummy line to help in debugging.
325 case EEventMessageReady:
327 const SEventMessageReady message = *(SEventMessageReady*)wsEvent.EventData();
328 TestL(message.iMessageUid== TUid::Uid(123));
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)
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);
346 TestL(Abs(offset)<KOffset);
349 if (iEventBuffer.Count()==0)
351 TRAPD(err, iTest->NextSetOfEventsL()); //Not allowed to leave
354 buf.Copy(KStartString);
355 buf.AppendFormat(_L("Subtest does not follow rules set by TEvent test framework, leave code: %d"), err);
357 iTest->LOG_MESSAGE(buf);
364 void CTQueueTestEvent::AddExpectedEvent(TWsEvent &aEvent)
368 static_cast<TWsQTEvent&>(aEvent).Time().UniversalTime();
370 iEventBuffer.Add(&aEvent);
373 TInt CTQueueTestEvent::EventsLeft()
375 return iEventBuffer.Count();
379 CTQueueWindowGroup::CTQueueWindowGroup(CTClient *aClient) : CTWindowGroup(aClient)
382 void CTQueueWindowGroup::ConstructL()
384 CTWindowGroup::ConstructL();
385 User::LeaveIfError(iGroupWin.EnableOnEvents(EEventControlAlways));
386 User::LeaveIfError(iGroupWin.EnableGroupChangeEvents());
392 Closes and deletes anim DLL.
393 @param aAnimDll Pointer to the anim Dll to be closed and deleted
395 LOCAL_C void DestroyAnimDll(TAny* aAnimDll)
397 (static_cast<RAnimDll*>(aAnimDll))->Destroy();
401 Destroys an REventAnimBase derived anim
402 @param aAnim REventAnimBase derived client-side handle to anim
404 LOCAL_C void DestroyAnim(TAny* aAnim)
406 (static_cast<REventAnimBase*>(aAnim))->Destroy();
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
414 RAnimDll* REventAnimBase::LoadL()
416 RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs);
417 CleanupStack::PushL(TCleanupItem(DestroyAnimDll,animDll));
418 User::LeaveIfError(animDll->Load(KAnimDLLName));
419 CleanupStack::Pop(animDll);
424 Closes the client-side handle to the anim, destroys the DLL and deletes itself.
426 void REventAnimBase::Destroy()
433 Resets server-side state of anim
435 void REventAnimBase::Reset()
437 CommandReply(EADllReset);
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.
445 TInt REventAnimBase::ErrorCode()
447 return CommandReply(EADllErrorCode);
451 @return The number of events received by the anim since it was last reset.
453 TInt REventAnimBase::NumberOfEventsReceived()
455 return CommandReply(EADllNumberOfEventsReceived);
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.
464 TInt REventAnimBase::AddExpectedEvent(TBool aEat, const TRawEvent& aEvent)
467 event.iRawEvent=aEvent;
469 return AddExpectedEvent(event);
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.
477 TInt REventAnimBase::AddExpectedEvent(const TAnimRawEvent& aEvent)
479 TPckgBuf<TAnimRawEvent> param;
481 return CommandReply(EADllAddExpectedEvent,param);
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
491 REventAnim* REventAnim::NewL(RWindowBase* aWin, RAnimDll* aDll, REventAnimBase::EAnimationType aType/*=EEventAnim*/)
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);
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
506 TInt REventAnim::TestFail(TInt aNoEvents)
508 TInt events=CommandReply(EADllErrorCode);
511 events=CommandReply(EADllNoEventsAndReset);
512 if (events==aNoEvents)
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
523 RRemovableAnim* RRemovableAnim::NewLC(RWindowBase* aWin, RAnimDll* aDll)
525 RRemovableAnim* self=new(ELeave) RRemovableAnim(aDll);
526 CleanupStack::PushL(TCleanupItem(DestroyAnim,self));
527 User::LeaveIfError(self->Construct(*aWin,EAnimTypeRemovableAnim,TPtrC8()));
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
536 TInt RRemovableAnim::SetEventHandlerLifetime(TInt aEventCount)
538 TPckgBuf<TInt> param;
540 return CommandReply(EADllSetEventHandlerLifetime, param);
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
548 TInt RRemovableAnim::EventHandlerLifetime()
550 return CommandReply(EADllEventHandlerLifetime);
553 Adds the anim to the list of event handlers.
554 This anim should receive any subsequent events.
555 @return KErrNone on successful addition.
557 TInt RRemovableAnim::AddToEventHandlers()
559 return CommandReply(EADllAddToEventHandlers);
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.
567 TInt RRemovableAnim::RemoveFromEventHandlers()
569 return CommandReply(EADllRemoveFromEventHandlers);
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.
578 TBool RRemovableAnim::TestPassed()
580 return CommandReply(EADllTestPassed);
585 CTEventTest::CTEventTest(CTestStep* aStep) : CTWsGraphicsBase(aStep)
587 INFO_PRINTF1(_L("Testing Event functions"));
590 CTEventTest::~CTEventTest()
593 iBackingWindow.Close();
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)
609 if (iTurnBackOnCapsLock)
611 TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOnModifier);
615 EventHandlerRemoval_DestroyAllAnims();
616 iRemovableAnims->Close();
617 delete iRemovableAnims;
623 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
624 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
625 if (!iSurfaceId.IsNull())
627 iSurfaceManager.CloseSurface(iSurfaceId);
629 iSurfaceManager.Close();
632 iTimeOutCallback->Cancel();
633 delete iTimeOutCallback;
635 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
636 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
639 void CTEventTest::ConstructL()
641 _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini");
642 CIniData* iniData = CIniData::NewL(KWsIniFile, ' ');
643 _LIT( KWsiniYShifting, "YSHIFTING");
644 iniData->FindVar(KWsiniYShifting, iYOffset);
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()));
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()));
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);
680 CleanupStack::PushL(rotations);
681 for (mode=0;mode<modes;++mode)
683 User::LeaveIfError(TheClient->iScreen->GetRotationsList(mode,rotations));
684 for (rot=rotations->Count()-1;rot>=0;--rot)
686 iScreenModeTests|=(1<<(*rotations)[rot]);
689 if (CheckScalingSupportedOrNot())
690 iScreenModeTests|=EDoScale;
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)
698 User::LeaveIfError(iClick.Load(KKeyClickPluginDll));
699 iPtrPluginLoaded = ETrue;
701 CleanupStack::PopAndDestroy();
702 if (TheClient->iWs.GetModifierState()&EModifierCapsLock)
704 iTurnBackOnCapsLock=ETrue;
705 TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOffModifier);
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();
724 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
726 if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone)
731 TheClient->iWs.GetKeyboardRepeatRate(iKeyBoardRepeatInitialDelay, iKeyBoardRepeatNextDelay);
734 void CTEventTest::Failed()
736 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
737 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
740 iTimeOutCallback->Cancel();
741 iTimeOutCallback->Deque();
742 delete iTimeOutCallback;
743 iTimeOutCallback = NULL;
746 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
747 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
748 CActiveScheduler::Stop();
752 void CTEventTest::CheckTimeInterval(const TTimeIntervalMicroSeconds32 &aTime,TInt aCheckTime)
754 TEST(aTime.Int()==aCheckTime);
755 if (aTime.Int()!=aCheckTime)
756 INFO_PRINTF3(_L("aTime.Int()==aCheckTime - Expected: %d, Actual: %d"), aCheckTime, aTime.Int());
759 void CTEventTest::KeyRepeatRate(TInt aInitialRepeat, TInt aRepeat)
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);
769 void CTEventTest::DoubleClickSettings(TInt aInterval, TInt aDistance)
771 TheClient->iWs.SetDoubleClick(TTimeIntervalMicroSeconds32(aInterval), aDistance);
772 TTimeIntervalMicroSeconds32 interval;
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);
781 TInt EventCancelFunc(TAny* aClient)
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);
789 TRequestStatus status;
790 ((CTClient *)aClient)->iWs.EventReady(&status);
791 ((CTClient *)aClient)->iWs.EventReadyCancel();
792 User::WaitForRequest(status);
796 void CTEventTest::General()
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);
806 TTimeIntervalMicroSeconds32 oldInitialTime;
807 TTimeIntervalMicroSeconds32 oldTime;
808 TheClient->iWs.GetKeyboardRepeatRate(oldInitialTime,oldTime);
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);
825 #define UNIQUE_PRIORITY 123
826 void CTEventTest::General2()
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);
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);
843 void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
845 TPckgBuf<TWsEvent> evtPkg;
846 TWsEvent& event=evtPkg();
847 if (aEventCode==EEventKey && aCode==0)
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);
858 if (aModifiers == KModifiersIgnore)
860 // Key click tests assume zero modifiers in click event by default
861 event.Key()->iModifiers = 0;
863 iClick.CommandReply(EClickEventAdd,evtPkg);
867 void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/)
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;
875 AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,modifiersDownUp);
876 AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers);
877 AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,modifiersDownUp);
880 void CTEventTest::AddExpectedEvent(TInt aEventCode, CTWinBase* aWin)
883 event.iType=aEventCode;
884 event.iHandle=REINTERPRET_CAST(TInt,aWin);
885 iQueueClient->AddExpectedEvent(event);
888 void CTEventTest::AddExpectedEvent(TInt aEventCode, RWindowGroup* aWindow)
891 event.iType=aEventCode;
892 event.iHandle=(TUint32)aWindow;
893 iQueueClient->AddExpectedEvent(event);
896 void CTEventTest::AddExpectedEvent(TInt aEventCode)
898 AddExpectedEvent(aEventCode,iQueueClient->iGroup);
901 void CTEventTest::AddExpectedErrorMessage(TWsErrorMessage::TErrorCategory aCategory, TInt aError)
904 event.iType=EEventErrorMessage;
905 event.iHandle=(TInt)iQueueClient->iGroup;
906 event.ErrorMessage()->iErrorCategory=aCategory;
907 event.ErrorMessage()->iError=aError;
908 iQueueClient->AddExpectedEvent(event);
911 void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos)
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);
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;
934 void CTEventTest::CalculatePointerCaptureEvent(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TInt aHandle)
936 TPointerEvent& ptrEvent=*aEvent.Pointer();
937 aEvent.SetType(EEventPointer);
938 ptrEvent.iParentPosition=aPos; //Must be done before next line
939 if(iVisWins1 && iVisWins2)
941 if (TRect(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()).Contains(aPos) &&
942 !TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos))
944 aPos-=iQueueClient->ChildTopLeft(); //Pointer is on the first window
945 aEvent.SetHandle((TInt)iVisWins1);
947 else if (TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos))
949 aPos-=(iQueueClient->ChildTopLeft()+TPoint(15,15)); //Pointer is on the second window
950 aEvent.SetHandle((TInt)iVisWins2);
952 else if (TRect(TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight)).Contains(aPos))
954 aPos-=TPoint(EWinPositionX,EWinPositionY); //Pointer is on the parent window
955 aEvent.SetHandle((TInt)iQueueClient->iWin);
959 aEvent.SetHandle((TInt)0); //Pointer is not in the same window group
962 ptrEvent.iType=aType;
963 ptrEvent.iModifiers=0;
964 if(aHandle!=0 && aHandle!=aEvent.Handle())
966 aEvent.SetHandle(aHandle);
967 ptrEvent.iPosition=ptrEvent.iParentPosition-(iQueueClient->ChildTopLeft()+TPoint(15,15));
971 ptrEvent.iPosition=aPos;
975 void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aHandle)
977 TPckgBuf<TWsQTEvent> evtPkg;
978 CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aHandle);
979 iQueueClient->AddExpectedEvent(evtPkg());
982 void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos)
984 TPckgBuf<TWsQTEvent> evtPkg;
985 CalculatePointerEvent(evtPkg(),aType,aPos);
986 iQueueClient->AddExpectedEvent(evtPkg());
989 evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY);
990 iClick.CommandReply(EClickEventAdd,evtPkg);
994 void CTEventTest::AddExpectedPointerClick(TPointerEvent::TType aType, TPoint aPos)
996 TPckgBuf<TWsQTEvent> evtPkg;
997 CalculatePointerEvent(evtPkg(),aType,aPos);
998 evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY);
999 iClick.CommandReply(EClickEventAdd,evtPkg);
1002 void CTEventTest::AddExpectedPointerDownUp(TPoint aPos)
1004 AddExpectedPointer(TPointerEvent::EButton1Down,aPos);
1005 AddExpectedPointer(TPointerEvent::EButton1Up,aPos);
1008 void CTEventTest::AddExpectedPointerScr(TPointerEvent::TType aType, TPoint aPos)
1010 AddExpectedPointer(aType,TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY));
1013 void CTEventTest::AddExpectedPointerDownUpScr(TPoint aPos)
1015 AddExpectedPointerDownUp(TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY));
1018 void CTEventTest::AddExpectedModifiersChanged(TInt aChangedModifiers, TInt aModifiers)
1021 event.iType=EEventModifiersChanged;
1022 event.iHandle=(TInt)iQueueClient->iGroup;
1023 event.ModifiersChanged()->iChangedModifiers=aChangedModifiers;
1024 event.ModifiersChanged()->iModifiers=aModifiers;
1025 iQueueClient->AddExpectedEvent(event);
1028 void CTEventTest::AddExpectedEnterExit(TInt aEventCode, TPoint aPos)
1030 AddExpectedEvent(aEventCode,iQueueClient->GetHandle(aPos));
1033 void CTEventTest::AddExpectedKeyAnim(TRawEvent::TType aEventCode, TInt aScanCode, TBool aEat)
1035 TAnimRawEvent event;
1036 event.iRawEvent.Set(aEventCode,aScanCode);
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);
1044 AddExpectedKey((aEventCode==TRawEvent::EKeyDown ? EEventKeyDown:EEventKeyUp),aScanCode);
1047 void CTEventTest::AddExpectedPointerAnim(TRawEvent::TType aEventCode, TPoint aPoint, TBool aEat/*=ETrue*/)
1049 TAnimRawEvent event;
1050 event.iRawEvent.Set(aEventCode,aPoint.iX,aPoint.iY);
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);
1059 AddExpectedPointer((aEventCode==TRawEvent::EButton1Down ? TPointerEvent::EButton1Down:TPointerEvent::EButton1Up)
1060 ,aPoint-TPoint(EWinPositionX,EWinPositionY));
1063 void CTEventTest::AddExpectedVisibilityChange(TUint aFlags)
1066 event.iType=EEventWindowVisibilityChanged;
1067 event.iHandle=(TInt)iVisWins1;
1068 event.VisibilityChanged()->iFlags=aFlags;
1069 iQueueClient->AddExpectedEvent(event);
1072 void CTEventTest::AddExpectedVisibilityChange(TUint aFlags, CTBlankWindow* aWindow)
1075 event.iType=EEventWindowVisibilityChanged;
1076 event.iHandle=(TInt)aWindow;
1077 event.VisibilityChanged()->iFlags=aFlags;
1078 iQueueClient->AddExpectedEvent(event);
1081 void CTEventTest::SimulatePointerWin(TRawEvent::TType aType, TInt aX, TInt aY)
1083 SimulatePointer(aType,EWinPositionX+aX,EWinPositionY+aY+iYOffset);
1086 void CTEventTest::SimulatePointerDownUpWin(TInt aX, TInt aY)
1088 iTest->SimulatePointerDownUp(EWinPositionX+aX,EWinPositionY+aY+iYOffset);
1091 void CTEventTest::SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY)
1093 iTest->SimulatePointer(aType,aX,aY+iYOffset);
1096 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
1097 void CTEventTest::SimulateButton1DownWithSimulatedMove(TInt aX, TInt aY)
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.
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);
1109 // then the original button down event
1110 SimulatePointer(TRawEvent::EButton1Down,aX,aY);
1114 void CTEventTest::NextSetOfEventsL()
1116 iQueueClient->ResetCount(iEventSet);
1117 switch (iTest->iState)
1120 QueuePurge_NextSetOfEventsL();
1123 SendEventTest_NextSetOfEvents();
1126 InvisibleWindow_NextSetOfEvents();
1129 JavaAdditions_NextSetOfEvents();
1132 WinCap_NextSetOfEvents();
1135 XyInputType_NextSetOfEvents();
1138 MovingPointerCursor_NextSetOfEventsL();
1141 RotatedMode_NextSetOfEventsL();
1144 AnimEvent_NextSetOfEventsL();
1147 FocusChanged_NextSetOfEventsL();
1150 StopEvents_NextSetOfEventsL();
1153 VirtualKeyboard_NextSetOfEventsL();
1156 KeyClicks_NextSetOfEvents();
1159 CaptureLong_NextSetOfEventsL();
1162 Password_NextSetOfEvents();
1165 GroupListChanged_NextSetOfEventsL();
1171 ScreenScaling_NextSetOfEventsL();
1174 VisibilityChanged_NextSetOfEventsL();
1177 CheckTimeStamp_NextSetOfEventsL();
1180 PointerCapture_NextSetOfEventsL();
1183 EventHandlerRemoval_NextSetOfEventsL();
1185 // Note that case 24 (which is KTest24) does not use NextSetOfEventsL()
1187 MismatchedCapture_NextSetOfEventsL();
1190 PointerBufferPurge_NextSetOfEventsL();
1193 RawEventRepeatTest_NextSetOfEventsL();
1196 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1198 KeyEventTranslation_NextSetOfEventsL();
1201 KeyEventBlocking_NextSetOfEventsL();
1204 KeyEventAppRestriction_NextSetOfEventsL();
1207 KeyEventAppPriority_NextSetOfEventsL();
1209 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
1211 SurfaceVisibilityChanged1_NextSetOfEventsL();
1214 SurfaceVisibilityChanged2_NextSetOfEventsL();
1217 SurfaceVisibilityChanged3_NextSetOfEventsL();
1219 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
1220 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
1223 AutoPanic(EAutoPanicWrongTest);
1227 void CTEventTest::TriggerOomMessage(TTimeIntervalMinutes aPeriod)
1230 if (aPeriod.Int()!=0) // adjust time to affect Oom message triggering
1233 User::SetHomeTime(time+aPeriod);
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);
1241 TheClient->iWs.Flush();
1242 TheClient->iWs.HeapSetFail(RHeap::ENone,0);
1243 if (aPeriod.Int()!=0)
1246 User::SetHomeTime(time-aPeriod);
1251 TBool CTEventTest::SetClickType(TClickOutputModes aType)
1253 TPckgBuf<TInt> intPkg;
1255 TInt err=iClick.CommandReply(EClickCommandSetOutput,intPkg);
1261 void CTEventTest::CreateEventTestGroup()
1263 iEventTestGroup=RWindowGroup(TheClient->iWs);
1264 iEventTestGroup.Construct(123, EFalse);
1265 iEventTestGroup.SetName(_L("Fred"));
1268 void CTQueueClient::CreateEventTestGroupOnSecondScreenL()
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));
1279 void CTQueueClient::CloseEventTestGroupOnSecondScreen()
1300 void CTEventTest::CloseEventTestGroup()
1302 iEventTestGroup.Close();
1305 void CTEventTest::CreateAndCloseEventTestGroup()
1307 // Create and close a window group to test sending of group changed messages
1310 CreateEventTestGroup();
1311 CloseEventTestGroup();
1314 void CTEventTest::QueuePurge_NextSetOfEventsL()
1316 #if defined(LOGGING)
1317 TLogMessageText logMessageText;
1318 _LIT(KSet,"QueuePurge SetOfEvents: %d of 11");
1319 logMessageText.Format(KSet,iEventSet);
1320 TheClient->LogMessage(logMessageText);
1322 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
1323 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
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();
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);
1345 for(TInt count=0;count<100;count++)
1347 iTest->SimulateKey(TRawEvent::EKeyDown,'A'+(count%26));
1348 iTest->SimulateKey(TRawEvent::EKeyUp,'A'+(count%26));
1350 for(TInt count2=0;count2<EMaxEventQueueSize/3;count2++)
1352 AddExpectedKey(EEventKeyDown,'A'+(count2%26));
1353 AddExpectedKey(EEventKey,'A'+(count2%26),'a'+(count2%26));
1354 AddExpectedKey(EEventKeyUp,'A'+(count2%26));
1356 AddExpectedKey(EEventKeyDown,'A'+(99%26));
1357 AddExpectedKey(EEventKeyUp,'A'+(99%26));
1362 User::LeaveIfError(iQueueClient->iGroup->GroupWin()->EnableModifierChangedEvents(0xFFFFFFFF, EEventControlOnlyWhenVisible));
1363 for(TInt count=0;count<20;count++)
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);
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();
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');
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
1422 CreateEventTestGroup();
1423 AddExpectedEvent(EEventWindowGroupsChanged);
1426 CloseEventTestGroup();
1427 AddExpectedEvent(EEventWindowGroupsChanged);
1430 iQueueClient->iGroup->GroupWin()->DisableGroupChangeEvents();
1431 CreateAndCloseEventTestGroup();
1432 iTest->SimulateEvent(TRawEvent::ESwitchOn);
1433 AddExpectedEvent(EEventSwitchOn);
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);
1446 SendEvent(EEventUser);
1447 AddExpectedEvent(EEventUser);
1451 for(TInt count5=0;count5<500;count5++)
1453 RWindowGroup group(TheClient->iWs);
1454 group.Construct(ENullWsHandle);
1455 group.EnableReceiptOfFocus(EFalse);
1457 SimulatePointer(TRawEvent::EButton1Up,10,20);
1459 for(TInt count4=0;count4<EMaxEventQueueSize;count4++)
1460 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY));
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));
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);
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);
1498 iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY));
1499 TheClient->iWs.Finish();
1504 RWindowGroup *group=iQueueClient->iGroup->GroupWin();
1505 SendEvent(EEventUser);
1506 AddExpectedEvent(EEventUser);
1508 if(iTest->IsFullRomL())
1511 // Test focus only messages when with and without focus
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);
1526 // Test focus only messages when with visible and invisible
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));
1537 // Check always mode sends an event
1539 User::LeaveIfError(group->EnableErrorMessages(EEventControlAlways));
1540 TriggerOomMessage(TTimeIntervalMinutes(3));
1541 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
1543 iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight));
1544 TriggerOomMessage(TTimeIntervalMinutes(3));
1545 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
1546 iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY));
1548 group->SetOrdinalPosition(1);
1549 AddExpectedEvent(EEventFocusLost);
1550 TriggerOomMessage(TTimeIntervalMinutes(3));
1551 AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory);
1552 group->SetOrdinalPosition(0);
1553 AddExpectedEvent(EEventFocusGained);
1555 // Check timing of OOM messages
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);
1577 TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,ETrue);
1578 TRAPD(err, EventQueueExpansionTestL());
1583 TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,EFalse);
1584 CActiveScheduler::Stop();
1587 TheClient->iWs.SetAutoFlush(iTheClientFlush);
1588 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
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()
1599 const TInt numClients = 5;
1600 TInt cliHanGrpWin = 777;
1601 TInt cliHanBlkWin = 888;
1603 RWsSession wsSession[numClients];
1604 RWindowGroup groupWin[numClients];
1605 RBlankWindow blankWin[numClients];
1607 for (TInt i = 0; i < numClients; i++)
1609 User::LeaveIfError(wsSession[i].Connect());
1610 CleanupClosePushL(wsSession[i]);
1612 groupWin[i] = RWindowGroup(wsSession[i]);
1613 User::LeaveIfError(groupWin[i].Construct(cliHanGrpWin++));
1614 CleanupClosePushL(groupWin[i]);
1615 groupWin[i].DefaultOwningWindow();
1617 blankWin[i] = RBlankWindow(wsSession[i]);
1618 User::LeaveIfError(blankWin[i].Construct(groupWin[i], cliHanBlkWin++));
1621 CleanupClosePushL(blankWin[i]);
1624 blankWin[i].Activate();
1628 CleanupStack::Pop(2, &wsSession[i]);
1629 wsSession[i].Close();
1632 for (TInt count=0; count < 40; count++)
1634 rawEvent.Set(TRawEvent::EKeyDown,'A'+(i%26));
1635 wsSession[i-1].SimulateRawEvent(rawEvent);
1637 rawEvent.Set(TRawEvent::EKeyUp,'A'+(i%26));
1638 wsSession[i-1].SimulateRawEvent(rawEvent);
1642 CleanupStack::PopAndDestroy(pushed*3, &wsSession[0]);
1645 void CTEventTest::doSendEvent(TWsEvent &aEvent)
1647 iQueueClient->iWs.SendEventToWindowGroup(iQueueClient->WindowGroupIdentifier(),aEvent);
1650 void CTEventTest::SendKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt iRepeats/*=0*/)
1653 if (aEventCode==EEventKey && aCode==0)
1655 event.SetType(aEventCode);
1656 event.Key()->iCode=aCode;
1657 event.Key()->iScanCode=aScanCode;
1658 event.Key()->iModifiers=0;
1659 event.Key()->iRepeats=iRepeats;
1663 void CTEventTest::SendEvent(TInt aEventCode)
1666 event.SetType(aEventCode);
1670 void CTEventTest::SimulateAndCheck(TPoint aOrigin,TSize aScale,TInt aXOffset,TInt aYOffset,TPointerEvent::TType aEventType,TRect aPointerCursorArea)
1672 TPoint ptCheck=PhysicalToLogical(TPoint(aOrigin.iX+aXOffset,aOrigin.iY+aYOffset)-aOrigin,aScale);
1673 if (ptCheck.iX < aPointerCursorArea.iTl.iX)
1675 ptCheck.iX=aPointerCursorArea.iTl.iX;
1677 else if (ptCheck.iX > aPointerCursorArea.iBr.iX)
1679 ptCheck.iX=aPointerCursorArea.iBr.iX;
1681 if (ptCheck.iY < aPointerCursorArea.iTl.iY)
1683 ptCheck.iY=aPointerCursorArea.iTl.iY;
1685 else if (ptCheck.iY > aPointerCursorArea.iBr.iY)
1687 ptCheck.iY=aPointerCursorArea.iBr.iY;
1689 AddExpectedPointer(aEventType,TPoint(ptCheck.iX-EWinPositionX,ptCheck.iY-EWinPositionY));
1692 void CTEventTest::CheckPointerCursorInDifferentScreenMode(TSizeMode aMode,TPoint aOrigin)
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
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));
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);
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();
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);
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);
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);
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);
1742 void CTEventTest::SendEventTest_NextSetOfEvents()
1744 TTimeIntervalMicroSeconds32 initialTime,time;
1745 TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
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);
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);
1767 #if defined(SCREEN_MODE_TESTING)
1770 iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents();
1772 if (SetClickType(EClickCheck))
1776 iQueueClient->iScreen->SetScreenMode(1);
1779 SetClickType(EClickNone);
1781 AddExpectedEvent(EEventScreenDeviceChanged);
1782 SendEvent(EEventUser);
1783 AddExpectedEvent(EEventUser);
1784 iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents();
1785 if (iQueueClient->iScreen->ScreenModeEnforcement()==ESizeEnforcementPixelsAndRotation)
1786 AddExpectedEvent(EEventFocusLost);
1789 SendEvent(EEventUser+1);
1790 AddExpectedEvent(EEventUser+1);
1793 #if defined(SCREEN_MODE_TESTING)
1796 iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents();
1798 if (SetClickType(EClickCheck))
1802 iQueueClient->iScreen->SetScreenMode(0);
1803 iQueueClient->iScreen->SetScreenMode(1);
1804 iQueueClient->iScreen->SetScreenMode(0);
1807 SetClickType(EClickNone);
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();
1817 SendEvent(EEventUser+3);
1818 AddExpectedEvent(EEventUser+3);
1821 #if defined(SCREEN_MODE_TESTING)
1824 iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents();
1825 iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents();
1827 if (SetClickType(EClickCheck))
1831 iQueueClient->iScreen->SetScreenMode(0);
1834 SetClickType(EClickNone);
1836 SendEvent(EEventUser+1);
1837 AddExpectedEvent(EEventUser+1);
1840 SendEvent(EEventUser+4);
1841 AddExpectedEvent(EEventUser+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);
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);
1871 CActiveScheduler::Stop();
1874 TheClient->iWs.Flush();
1877 void CTEventTest::InvisibleWindow_NextSetOfEvents()
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));
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));
1919 CActiveScheduler::Stop();
1922 TheClient->iWs.Flush();
1925 #define TOP16A 0xAAAA0000
1926 #define TOP16B 0x55550000
1927 void CTEventTest::JavaAdditions_NextSetOfEvents()
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);
1940 SimulatePointer(TRawEvent::EButton1Down,46,31);
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);
1954 SimulatePointer(TRawEvent::EButton1Down,21,11);
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);
1968 SimulatePointer(TRawEvent::EButton1Down,23,13);
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));
1995 #if defined(__WINS__)
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');
2025 CActiveScheduler::Stop();
2028 TheClient->iWs.Flush();
2031 void CTEventTest::WinCap_NextSetOfEvents()
2036 //iQueueClient->SetChildCapture(RWindowBase::TCaptureEnabled);
2037 SimulatePointer(TRawEvent::EButton1Down,35,27);
2038 SimulatePointer(TRawEvent::EButton1Up,25,12);
2041 AddExpectedEvent(EEventFocusGained);
2042 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(35-EWinPositionX,27-EWinPositionY));
2043 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,12-EWinPositionY));
2048 CActiveScheduler::Stop();
2051 TheClient->iWs.Flush();
2054 void CTEventTest::XyInputType_NextSetOfEvents()
2059 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents|EPointerFilterDrag,EPointerGenerateSimulatedMove);
2060 iQueueClient->iWs.Flush();
2061 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
2062 SimulateButton1DownWithSimulatedMove(46,31);
2064 SimulatePointer(TRawEvent::EButton1Down,46,31);
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
2074 // check if RWindowGroup::SimulatePointerEvent is working (DEF131563)
2075 RWindowGroup& group = *iQueueClient->iGroup->GroupWin();
2077 event.Set(TRawEvent::EButton1Down, 10, 10);
2078 group.SimulatePointerEvent(event);
2079 event.Set(TRawEvent::EButton1Up, 10, 10);
2080 group.SimulatePointerEvent(event);
2083 // simulated move will be generated
2084 AddExpectedPointer(TPointerEvent::EMove, TPoint(10 - EWinPositionX, 10 - EWinPositionY));
2086 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10 - EWinPositionX, 10 - EWinPositionY));
2087 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10 - EWinPositionX, 10 - EWinPositionY));
2090 #if defined(__WINS__)
2092 #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA)
2093 SimulateButton1DownWithSimulatedMove(45,32);
2095 SimulatePointer(TRawEvent::EButton1Down,45,32);
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);
2111 SimulatePointer(TRawEvent::EButton1Down,47,32);
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));
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));
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));
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));
2197 CActiveScheduler::Stop();
2200 TheClient->iWs.Flush();
2203 void CTEventTest::MovingPointerCursor_NextSetOfEventsL()
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);
2215 #if defined(__WINS__)
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));
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));
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));
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));
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));
2386 TheClient->iWs.SetPointerCursorArea(TRect(0,0,95,50));
2387 CActiveScheduler::Stop();
2390 TheClient->iWs.Flush();
2393 void CTEventTest::RotatedMode_NextSetOfEventsL()
2395 #if defined(LOGGING)
2396 TLogMessageText logMessageText;
2397 _LIT(KSet,"RotatedMode SetOfEvents: %d Max=4");
2398 logMessageText.Format(KSet,iEventSet);
2399 INFO_PRINTF1(logMessageText);
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));
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);
2436 INFO_PRINTF1(_L(" Set of Events"));
2437 if (iScreenModeTests&EDoRot90)
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);
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);
2452 INFO_PRINTF1(_L(" Sent Up and Down 90"));
2454 if (iScreenModeTests&EDoRot180)
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);
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);
2470 INFO_PRINTF1(_L(" Sent Up and Down 180"));
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)
2479 SimulatePointer(TRawEvent::EButton1Down,24,24);
2480 SimulatePointer(TRawEvent::EButton1Up,24,24);
2482 if (iScreenModeTests&EDoRot90)
2484 if (enforc>ESizeEnforcementNone)
2486 AddExpectedEvent(EEventFocusLost);
2487 AddExpectedEvent(EEventFocusGained);
2491 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset));
2492 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset));
2495 if (iScreenModeTests&EDoRot180)
2497 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset));
2498 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset));
2500 if (iScreenModeTests&EDoRot0)
2502 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,24-EWinPositionY));
2503 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,24-EWinPositionY));
2505 INFO_PRINTF1(_L(" Added Expected"));
2506 User::After(EPointerCursorUpdateGap);
2507 iBlankWin->SetVisible(EFalse);
2510 #if defined(__WINS__)
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)
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);
2529 TheClient->iWs.SetPointerCursorPosition(TPoint(27+EWinPositionX,25+EWinPositionY));
2530 if (iScreenModeTests&EDoRot180)
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);
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)
2549 SimulatePointer(TRawEvent::EButton1Down,24,24);
2550 SimulatePointer(TRawEvent::EButton1Up,24,24);
2552 TheClient->iWs.SimulateXyInputType(EXYInputPointer);
2553 TheClient->iWs.Flush();
2554 if (iScreenModeTests&EDoRot90)
2556 if (enforc>ESizeEnforcementNone)
2558 AddExpectedEvent(EEventFocusLost);
2559 AddExpectedEvent(EEventFocusGained);
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));
2569 if (iScreenModeTests&EDoRot180)
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));
2576 if (iScreenModeTests&EDoRot0)
2578 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20,26));
2579 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20,26));
2585 #if defined(LOGGING)
2586 _LIT(KSet2,"AUTO Rotating Events ");
2587 INFO_PRINTF1(KSet2);
2589 INFO_PRINTF1(_L(" :3rd Set of Events"));
2590 if (iScreenModeTests&EDoScale)
2592 INFO_PRINTF1(_L(" :Screen Scalling Supported"));
2593 iBlankWin->SetVisible(ETrue);
2594 iCurrentMode=iNumScrModes;
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++)
2605 INFO_PRINTF1(_L(" :New X-Scale Value"));
2606 for (TInt yScale=2;yScale<4;yScale++)
2608 INFO_PRINTF1(_L(" :New Y-Scale Value"));
2609 testMode.iScreenScale.SetSize(xScale,yScale);
2610 CheckPointerCursorInDifferentScreenMode(testMode,TPoint(20,30));
2613 User::After(EPointerCursorUpdateGap);
2614 iBlankWin->SetVisible(EFalse);
2620 if (iScreenModeTests&EDoScale)
2622 TSizeMode testMode=iSizeMode;
2623 iBlankWin->SetVisible(ETrue);
2624 for (TInt xScale=2;xScale<4;xScale++)
2626 for (TInt yScale=2;yScale<4;yScale++)
2628 testMode.iScreenScale.SetSize(xScale,yScale);
2629 CheckPointerCursorInDifferentScreenMode(testMode,TPoint(30,20));
2632 User::After(EPointerCursorUpdateGap);
2633 iBlankWin->SetVisible(EFalse);
2639 #if defined(__WINS__)
2640 if (iScreenModeTests&EDoScale)
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);
2652 User::After(500000); //0.5secs, to allow other screen devices to respond to the flip events
2653 CActiveScheduler::Stop();
2656 TheClient->iWs.Flush();
2660 void CTEventTest::ScreenScaling_NextSetOfEventsL()
2662 #if defined(LOGGING)
2663 TLogMessageText logMessageText;
2664 _LIT(KSet,"ScreenScaling SetOfEvents: %d (Last=3)");
2665 logMessageText.Format(KSet,iEventSet);
2666 INFO_PRINTF1(logMessageText);
2668 if(! (iScreenModeTests & EDoScale))
2670 User::After(500000);
2671 CActiveScheduler::Stop();
2678 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
2679 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
2680 iBlankWin->SetVisible(ETrue);
2682 TInt mode = TheClient->iScreen->CurrentScreenMode();
2684 iSizeMode = iQueueClient->iScreen->GetCurrentScreenModeAttributes();
2686 iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0);
2687 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
2689 TSizeMode szMode2 = iSizeMode;
2691 szMode2.iScreenScale.SetSize(2,2);
2693 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
2694 TheClient->iScreen->SetAppScreenMode(mode);
2695 iQueueClient->iScreen->SetAppScreenMode(mode);
2696 iQueueClient->iScreen->SetScreenMode(mode);
2698 TPoint theScreenOrigin(iQueueClient->iScreen->GetScreenModeOrigin(mode));
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);
2709 AddExpectedEvent(EEventFocusGained);
2710 AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,10-EWinPositionY));
2711 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,10-EWinPositionY));
2717 TSizeMode szMode2 = iSizeMode;
2718 TInt mode = TheClient->iScreen->CurrentScreenMode();
2720 szMode2.iScreenScale.SetSize(2,2);
2721 szMode2.iOrigin.SetXY(20,20);
2723 iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2);
2724 TheClient->iScreen->SetAppScreenMode(mode);
2725 iQueueClient->iScreen->SetAppScreenMode(mode);
2726 iQueueClient->iScreen->SetScreenMode(mode);
2728 TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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));
2744 iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode);
2745 TheClient->iScreen->SetAppScreenMode(mode);
2746 iQueueClient->iScreen->SetAppScreenMode(mode);
2747 iQueueClient->iScreen->SetScreenMode(mode);
2749 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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));
2768 TInt mode = TheClient->iScreen->CurrentScreenMode();
2769 TRect theRect = TheClient->iWs.PointerCursorArea();
2771 TSizeMode szMode2 = iSizeMode;
2773 //----------- scaling 2X2
2774 szMode2.iScreenScale.SetSize(2,2);
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);
2783 TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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);
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);
2807 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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);
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);
2831 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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
2848 szMode2.iScreenScale.SetSize(3,1);
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);
2856 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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
2873 szMode2.iScreenScale.SetSize(3,2);
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);
2881 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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);
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);
2905 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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);
2930 iQueueClient->iWs.SetAutoFlush(ETrue);
2931 TInt theCurMode = iQueueClient->iScreen->CurrentScreenMode();
2932 TPoint theScreenOrigin;
2935 TheClient->iScreen->SetAppScreenMode(2);
2936 iQueueClient->iScreen->SetAppScreenMode(2);
2937 TheClient->iScreen->SetScreenMode(2);
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);
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));
2959 TheClient->iScreen->SetAppScreenMode(0);
2960 iQueueClient->iScreen->SetAppScreenMode(0);
2961 iQueueClient->iScreen->SetScreenMode(0);
2962 iTest->DelayIfFullRomL();
2964 theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin());
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);
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);
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));
2986 #if defined(__WINS__)
2987 AddExpectedPointer(TPointerEvent::EMove, TPoint(25-EWinPositionX,26-EWinPositionY));
2990 iQueueClient->iScreen->SetAppScreenMode(theCurMode);
2991 TheClient->iScreen->SetScreenMode(theCurMode);
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();
3006 void CTEventTest::AnimEvent_NextSetOfEventsL()
3008 #if defined(LOGGING)
3009 TLogMessageText logMessageText;
3010 _LIT(KSet,"AnimEvent SetOfEvents: %d (Max=4)");
3011 logMessageText.Format(KSet,iEventSet);
3012 INFO_PRINTF1(logMessageText);
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))
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))
3062 #if defined(LOGGING)
3063 _LIT(KLog," :2nd Set of Events Modes=0x%x");
3064 logMessageText.Format(KLog,iScreenModeTests);
3065 INFO_PRINTF1(logMessageText);
3067 TInt enforc=TheClient->iScreen->ScreenModeEnforcement();
3068 iBlankWin->SetVisible(ETrue);
3069 TInt expectedEvents=0;
3070 if (iScreenModeTests&EDoRot90 && enforc==ESizeEnforcementNone)
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));
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);
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);
3089 if (iScreenModeTests&EDoRot180)
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));
3100 #if defined(__WINS__)
3101 iTest->SimulatePointer(TRawEvent::EButton1Down,22,22);
3102 iTest->SimulatePointer(TRawEvent::EButton1Up,22,22);
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);
3109 TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal);
3110 TheClient->iScreen->SetScreenMode(0);
3111 TheClient->iWs.Flush();
3112 iTest->DelayIfFullRomL();
3113 if (iScreenModeTests&EDoRot0)
3115 INFO_PRINTF1(_L(" :Rotation 0"));
3116 AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(24,24),EFalse);
3117 AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(24,24),EFalse);
3119 SimulatePointer(TRawEvent::EButton1Down,24,24);
3120 SimulatePointer(TRawEvent::EButton1Up,24,24);
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);
3130 if (iAnim->TestFail(expectedEvents))
3132 User::After(EPointerCursorUpdateGap);
3133 iBlankWin->SetVisible(EFalse);
3134 INFO_PRINTF1(_L(" :Finished 2nd Set"));
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));
3148 AddExpectedKeyAnim(TRawEvent::EKeyDown,32,ETrue);
3149 AddExpectedKeyAnim(TRawEvent::EKeyDown,32,EFalse);
3150 AddExpectedKeyAnim(TRawEvent::EKeyUp,32,ETrue);
3151 AddExpectedKeyAnim(TRawEvent::EKeyUp,32,EFalse);
3153 iTest->SimulateKey(TRawEvent::EKeyDown,32);
3154 iTest->SimulateKey(TRawEvent::EKeyUp,32);
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);
3167 AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers);
3169 AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers);
3171 iTest->SimulateKey(TRawEvent::EKeyDown,45);
3176 CActiveScheduler::Stop();
3179 TheClient->iWs.Flush();
3182 void CTEventTest::FocusChanged_NextSetOfEventsL()
3184 #if defined(LOGGING)
3185 TLogMessageText logMessageText;
3186 _LIT(KSet,"FocusChanged SetOfEvents: %d ");
3187 logMessageText.Format(KSet,iEventSet);
3188 INFO_PRINTF1(logMessageText);
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);
3206 iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(EFalse);
3207 AddExpectedEvent(EEventFocusGained);
3208 AddExpectedEvent(EEventFocusGroupChanged);
3211 iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(ETrue);
3212 AddExpectedEvent(EEventFocusLost);
3213 AddExpectedEvent(EEventFocusGroupChanged);
3216 iEventTestGroup2->GroupWin()->SetOrdinalPosition(999);
3217 AddExpectedEvent(EEventFocusGained);
3218 AddExpectedEvent(EEventFocusGroupChanged);
3221 iEventTestGroup2->GroupWin()->SetOrdinalPosition(0);
3222 AddExpectedEvent(EEventFocusLost);
3223 AddExpectedEvent(EEventFocusGroupChanged);
3226 delete iEventTestGroup2;
3227 iEventTestGroup2=NULL;
3228 AddExpectedEvent(EEventWindowGroupsChanged);
3229 AddExpectedEvent(EEventFocusGroupChanged);
3232 CActiveScheduler::Stop();
3235 TheClient->iWs.Flush();
3239 void CTEventTest::StopEvents_NextSetOfEventsL()
3241 // we are not running tests 0,1,2 as they currently fail
3245 AddExpectedEvent(EEventFocusGained);
3247 TInt retVal = KErrNone;
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);
3274 case 1: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(....
3277 iQueueClient->iWs.Flush();
3278 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()));
3279 event.iCode=EKeyOff;
3280 event.iScanCode=EKeyOff;
3283 TheClient->iWs.SimulateKeyEvent(event);
3284 TheClient->iWs.Flush();
3285 User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse));
3286 AddExpectedEvent(EEventKeySwitchOff);
3290 case 2: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(....
3293 event.iCode=EKeyOff;
3294 event.iScanCode=EKeyOff;
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);
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);
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);
3373 iQueueClient->iWs.Flush();
3374 event.iCode=EKeyOff;
3375 event.iScanCode=EKeyOff;
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);
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);
3407 CActiveScheduler::Stop();
3410 TheClient->iWs.Flush();
3413 void CTEventTest::VirtualKeyboard_NextSetOfEventsL()
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';
3425 iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse);
3426 for (ii=0;ii<noVirtualKeys;++ii)
3428 iQueueClient->iWin->BaseWin()->AddKeyRect(TRect(startX,1,startX+keyWidth,keyHeight),baseChar+ii,EFalse);
3431 iQueueClient->iWs.Flush();
3432 iTest->SimulatePointerDownUp(EWinPositionX+1,EWinPositionY+1+iYOffset);
3433 //TheClient->iWs.Flush();
3434 AddExpectedEvent(EEventFocusGained);
3435 AddExpectedKeyDownUp(baseChar);
3439 for (ii=0;ii<noVirtualKeys-2;++ii) //Can't do all 10 as this will overflow the event buffer
3441 iTest->SimulatePointerDownUp(startX+EWinPositionX+1,EWinPositionY+keyHeight-1+iYOffset);
3442 AddExpectedKeyDownUp(baseChar+ii);
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);
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);
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);
3496 CActiveScheduler::Stop();
3499 TheClient->iWs.Flush();
3502 TInt CTEventTest::ClickCommandReply(TInt aCommand,TInt aData)
3504 TPckgBuf<TInt> intPkg;
3506 return iClick.CommandReply(aCommand,intPkg);
3509 TInt CTEventTest::CreateGroupWindow(RWindowGroup& aWinGp,TClients aClient,TInt& aWinGpId)
3511 ClickCommandReply(EClickCreateGroupWin,aClient);
3512 TInt err=aWinGp.Construct(ENullWsHandle,EFalse);
3515 aWinGpId=aWinGp.Identifier();
3516 ClickCommandReply(EClickCheckGpWinId,aWinGpId);
3521 void CTEventTest::CloseGroupWindow(RWindowGroup& aWinGp,TInt aWinGpId)
3523 ClickCommandReply(EClickCloseGroupWin,aWinGpId);
3527 void CTEventTest::CloseWindow(RWindowBase& aWin,TInt aHandle,TInt aWinGpId)
3529 TPckgBuf<TWindowCloseData> winClose;
3530 winClose().iClientHandle=aHandle;
3531 winClose().iWindowGroupId=aWinGpId;
3532 iClick.CommandReply(EClickCloseWin,winClose);
3537 @SYMTestCaseID GRAPHICS-WSERV-0447
3541 @SYMTestCaseDesc Tests that Key Click Plug-in gets new event Information
3543 @SYMTestPriority High
3545 @SYMTestStatus Implemented
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.
3550 @SYMTestExpectedResults When Test Plug-in is querried to see if events match what was expected it says that they were.
3552 void CTEventTest::KeyClicks_NextSetOfEvents()
3554 #if defined(LOGGING)
3555 TLogMessageText logMessageText;
3556 _LIT(KSet,"KeyClicks SetOfEvents: %d (last=13)");
3557 logMessageText.Format(KSet,iEventSet);
3558 INFO_PRINTF1(logMessageText);
3564 if (SetClickType(EClickCheck))
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
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
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
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
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
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
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
3680 AddExpectedKeyDownUp('2');
3682 AddExpectedKeyDownUp('G','g');
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
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');
3711 AddExpectedPointerDownUpScr(TPoint(43,27));
3712 AddExpectedKeyDownUp('4');
3713 AddExpectedPointerDownUpScr(TPoint(42,27));
3714 AddExpectedKeyDownUp('I','i');
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);
3742 RWindowGroup winGp(iQueueClient->iWs);
3745 AddExpectedEvent(EEventWindowGroupsChanged);
3746 for (ii=0;ii<2;++ii) //events x2
3748 if (CreateGroupWindow(winGp,EQueueClient,winGpId)) //1 event
3750 CloseGroupWindow(winGp,winGpId); //1 event
3751 iQueueClient->iWs.Flush();
3758 RWindowGroup winGp(TheClient->iWs);
3759 RWindowGroup winGp1(iQueueClient->iWs);
3760 RWindowGroup winGp2(iQueueClient->iWs);
3764 AddExpectedEvent(EEventWindowGroupsChanged);
3765 if (CreateGroupWindow(winGp,ETheClient,winGpId)) //1 event
3767 CloseGroupWindow(winGp,winGpId); //1 event
3768 TheClient->iWs.Flush();
3769 if (CreateGroupWindow(winGp1,EQueueClient,winGpId1)) //1 event
3771 if (CreateGroupWindow(winGp2,EQueueClient,winGpId2)) //1 event
3773 if (CreateGroupWindow(winGp,ETheClient,winGpId)) //1 event
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();
3786 RWindowGroup winGp(iQueueClient->iWs);
3788 AddExpectedEvent(EEventWindowGroupsChanged);
3789 if (CreateGroupWindow(winGp,EQueueClient,winGpId)) //1 event
3791 RWindow win(iQueueClient->iWs);
3792 const TInt handle=79;
3793 if (win.Construct(winGp,handle))
3796 CloseWindow(win,handle,winGpId); //1 event
3797 iQueueClient->iWs.Flush();
3798 CloseGroupWindow(winGp,winGpId); //1 event
3799 iQueueClient->iWs.Flush();
3805 RWindowGroup winGp1(iQueueClient->iWs);
3806 RWindowGroup winGp2(TheClient->iWs);
3809 AddExpectedEvent(EEventWindowGroupsChanged);
3810 if (CreateGroupWindow(winGp2,ETheClient,winGpId2)) //1 event
3812 if (CreateGroupWindow(winGp1,EQueueClient,winGpId1)) //1 event
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))
3825 if (win2.Construct(win1,handle2a))
3828 if (win.Construct(winGp2,handle))
3831 CloseWindow(win2,handle2a,winGpId1); //1 event
3832 iQueueClient->iWs.Flush();
3833 if (win2.Construct(winGp1,handle2b))
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))
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();
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);
3881 if (!SetClickType(EClickNone))
3882 CActiveScheduler::Stop();
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)
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);
3896 iClick.CommandReply(EClickReset,TPtrC8(NULL,0));
3899 void CTEventTest::CaptureLong_NextSetOfEventsL()
3901 #if defined(LOGGING)
3902 TLogMessageText logMessageText;
3903 _LIT(KSet,"CaptureLong SetOfEvents: %d of 23");
3904 logMessageText.Format(KSet,iEventSet);
3905 INFO_PRINTF1(logMessageText);
3911 iQueueClient->iWs.Flush();
3912 iTest->SimulateKeyDownUp('A');
3913 AddExpectedEvent(EEventFocusGained);
3914 AddExpectedKeyDownUp('A','a');
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);
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);
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);
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');
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');
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())
4026 DelayForRepeatEvents(2, 1);
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())
4037 AddExpectedKey(EEventKey,'X','x',1);
4039 AddExpectedKey(EEventKeyUp,'X');
4040 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
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);
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);
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);
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);
4116 // Cancel a key up/down capture whilst a repeat is underway.
4117 // This should have no effect since only key press events are
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');
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');
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');
4161 // Cancel long capture key event when normal capture key is scheduled for different
4163 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal);
4164 TInt shortCaptKey = TheClient->iGroup->GroupWin()->CaptureKey(' ',0,0);
4166 iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace);
4167 TheClient->iWs.Flush();
4168 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
4169 DelayForRepeatEvents(1, 3);
4171 TheClient->iGroup->GroupWin()->CancelCaptureKey(shortCaptKey);
4172 iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace);
4173 AddExpectedKey(EEventKeyDown,EStdKeySpace);
4174 AddExpectedKey(EEventKeyUp,EStdKeySpace);
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);
4193 CheckLongkeyCaptureWithPriority(ELongkeyCaptureDiffPriority);
4196 CheckLongkeyCaptureWithPriority(ELongkeyCaptureSamePriority);
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);
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);
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);
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
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);
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
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);
4304 CActiveScheduler::Stop();
4307 TheClient->iWs.Flush();
4310 /** Function used for checking CaptureLongKey() works fine with different priorities.
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).
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.
4319 @param aTestType Enum value specifying test with same priority or with different priority
4321 void CTEventTest::CheckLongkeyCaptureWithPriority(TLongkeyCapPriorityTests aTestType)
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);
4345 /** Function used for delaying current thread so that repeat events can be generated.
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.
4351 The extra value is taken as fraction of iKeyBoardRepeatNextDelay.
4353 @param aNumeratorFracVal Numerator value of the fraction.
4354 @param aDenominatorFracVal Denominator value of the fraction.
4356 void CTEventTest::DelayForRepeatEvents(TInt aNumeratorFracVal, TInt aDenominatorFracVal)
4358 if (!aNumeratorFracVal || !aDenominatorFracVal)
4360 User::After(iKeyBoardRepeatInitialDelay.Int() + (iKeyBoardRepeatNextDelay.Int()*aNumeratorFracVal/aDenominatorFracVal));
4363 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
4364 void CTEventTest::KeyEventTranslation_NextSetOfEventsL()
4366 TTimeIntervalMicroSeconds32 initialTime;
4367 TTimeIntervalMicroSeconds32 time;
4368 TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
4370 RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
4372 #if defined(LOGGING)
4373 TLogMessageText logMessageText;
4374 _LIT(KSet,"KeyEventTranslation SetOfEvents: %d of 5");
4375 logMessageText.Format(KSet,iEventSet);
4376 INFO_PRINTF1(logMessageText);
4379 switch (iEventSet++)
4382 iQueueClient->iWs.Flush();
4383 iTest->SimulateKeyDownUp('A');
4384 AddExpectedEvent(EEventFocusGained);
4385 AddExpectedKeyDownUp('A','a');
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);
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);
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();
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();
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);
4428 wg->CancelCaptureLongKey(iCaptureKey);
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);
4441 CActiveScheduler::Stop();
4445 TheClient->iWs.Flush();
4448 void CTEventTest::KeyEventBlocking_NextSetOfEventsL()
4450 TTimeIntervalMicroSeconds32 initialTime;
4451 TTimeIntervalMicroSeconds32 time;
4452 TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
4454 RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
4456 #if defined(LOGGING)
4457 TLogMessageText logMessageText;
4458 _LIT(KSet,"KeyEventBlocking SetOfEvents: %d of 5");
4459 logMessageText.Format(KSet,iEventSet);
4460 INFO_PRINTF1(logMessageText);
4463 switch (iEventSet++)
4466 iQueueClient->iWs.Flush();
4467 iTest->SimulateKeyDownUp('A');
4468 AddExpectedEvent(EEventFocusGained);
4469 AddExpectedKeyDownUp('A','a');
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');
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);
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);
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);
4521 CActiveScheduler::Stop();
4525 TheClient->iWs.Flush();
4528 void CTEventTest::KeyEventAppRestriction_NextSetOfEventsL()
4530 TTimeIntervalMicroSeconds32 initialTime;
4531 TTimeIntervalMicroSeconds32 time;
4532 TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
4534 RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
4536 #if defined(LOGGING)
4537 TLogMessageText logMessageText;
4538 _LIT(KSet,"KeyEventAppRestriction SetOfEvents: %d of 4");
4539 logMessageText.Format(KSet,iEventSet);
4540 INFO_PRINTF1(logMessageText);
4543 switch (iEventSet++)
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);
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);
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);
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);
4601 CActiveScheduler::Stop();
4605 TheClient->iWs.Flush();
4608 void CTEventTest::KeyEventAppPriority_NextSetOfEventsL()
4610 TTimeIntervalMicroSeconds32 initialTime;
4611 TTimeIntervalMicroSeconds32 time;
4612 TheClient->iWs.GetKeyboardRepeatRate(initialTime, time);
4614 RWindowGroup* wg = iQueueClient->iGroup->GroupWin();
4622 #if defined(LOGGING)
4623 TLogMessageText logMessageText;
4624 _LIT(KSet,"KeyEventAppPriority SetOfEvents: %d of 5");
4625 logMessageText.Format(KSet,iEventSet);
4626 INFO_PRINTF1(logMessageText);
4629 switch (iEventSet++)
4632 SpawnCaptureAppL(iCaptureApp1);
4633 iQueueClient->iWs.Flush();
4634 AddExpectedEvent(EEventFocusGained);
4635 AddExpectedEvent(EEventFocusLost);
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);
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);
4658 // Repeat using CaptureKeyUpAndDowns()
4659 handle1 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0);
4660 handle2 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 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);
4675 // Repeat using CaptureLongKey()
4676 handle1 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal);
4677 handle2 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal);
4680 iQueueClient->iWs.Flush();
4682 iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
4683 TheClient->iWs.Flush();
4684 User::After(initialTime.Int() + time.Int() / 3);
4685 iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
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();
4693 AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable);
4694 wg->CancelCaptureLongKey(handle1);
4695 wg->CancelCaptureLongKey(handle2);
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
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);
4719 iQueueClient->iWs.Flush();
4721 SpawnCaptureAppL(iCaptureApp2);
4723 iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22);
4724 TheClient->iWs.Flush();
4725 User::After(initialTime.Int() + time.Int() / 3);
4726 iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22);
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();
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);
4746 iCaptureApp1.Kill(KErrNone);
4747 iCaptureApp2.Kill(KErrNone);
4748 iCaptureApp1.Close();
4749 iCaptureApp2.Close();
4750 CActiveScheduler::Stop();
4754 TheClient->iWs.Flush();
4758 Spawn another application that will capture the keys EKeyF22 and
4759 EKeyF23 with high priority.
4761 @param aProcess Process to create
4763 void CTEventTest::SpawnCaptureAppL(RProcess& aProcess)
4765 _LIT(KCaptureApp, "tevent_captureapp.exe");
4766 TInt error = aProcess.Create(KCaptureApp, KNullDesC);
4767 if (error != KErrNone)
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);
4778 // Make rendezvous request to capture app
4779 TRequestStatus status;
4780 aProcess.Rendezvous(status);
4783 // Wait for capture app to make its capture requests
4784 User::WaitForRequest(status);
4785 TEST(status.Int() == KErrNone);
4787 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
4789 #define PASSWORD_START_OF_DAY 4
4790 void CTEventTest::Password_NextSetOfEvents()
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');
4804 iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADayTriggerNow);
4805 iQueueClient->iWs.PasswordEntered();
4806 iTest->SimulateKeyDownUp('3');
4807 iQueueClient->iWs.Flush();
4808 AddExpectedEvent(EEventPassword);
4809 AddExpectedKeyDownUp('3');
4815 TInt day=time.DayNoInMonth();
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);
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);
4854 CActiveScheduler::Stop();
4857 TheClient->iWs.Flush();
4860 void CTEventTest::GroupListChanged_NextSetOfEventsL()
4862 _LIT(WindowGroup1,"WindowGroupName1");
4863 _LIT(WindowGroup2,"WindowGroupName2");
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);
4881 _LIT(TestGroup4,"GroupListEvents4");
4882 iEventTestGroup4=new(ELeave) CTWindowGroup(TheClient);
4883 iEventTestGroup4->ConstructL();
4884 iEventTestGroup4->GroupWin()->SetName(TestGroup4);
4885 AddExpectedEvent(EEventWindowGroupListChanged);
4886 AddExpectedEvent(EEventWindowGroupsChanged);
4890 iEventTestGroup3->GroupWin()->SetOrdinalPosition(0);
4891 AddExpectedEvent(EEventWindowGroupListChanged);
4894 iEventTestGroup3->GroupWin()->SetOrdinalPosition(999);
4895 AddExpectedEvent(EEventWindowGroupListChanged);
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);
4910 iEventTestGroup3->GroupWin()->SetOrdinalPosition(999);
4911 AddExpectedEvent(EEventWindowGroupListChanged);
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);
4921 iEventTestGroup3->GroupWin()->SetName(WindowGroup2);
4922 SimulatePointer(TRawEvent::EButton1Up,10,20);
4923 AddExpectedEvent(EEventWindowGroupsChanged);
4924 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY));
4927 iEventTestGroup3->GroupWin()->SetName(WindowGroup1);
4928 SimulatePointer(TRawEvent::EButton2Down,20,30);
4929 AddExpectedEvent(EEventWindowGroupsChanged);
4930 AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(20-EWinPositionX,30-EWinPositionY));
4933 SimulatePointer(TRawEvent::EButton1Up,15,15);
4934 iEventTestGroup3->GroupWin()->SetName(WindowGroup2);
4935 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,15-EWinPositionY));
4936 AddExpectedEvent(EEventWindowGroupsChanged);
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);
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));
4957 delete iEventTestGroup3;
4958 iEventTestGroup3=NULL;
4959 AddExpectedEvent(EEventWindowGroupsChanged);
4960 AddExpectedEvent(EEventWindowGroupListChanged);
4963 delete iEventTestGroup4;
4964 iEventTestGroup4=NULL;
4965 AddExpectedEvent(EEventWindowGroupsChanged);
4966 AddExpectedEvent(EEventWindowGroupListChanged);
4969 CActiveScheduler::Stop();
4972 TheClient->iWs.Flush();
4975 TInt CTEventTest::KeyRepeatTime() const
4977 TTimeIntervalMicroSeconds32 initialTime;
4978 TTimeIntervalMicroSeconds32 time;
4979 TheClient->iWs.GetKeyboardRepeatRate(initialTime,time);
4980 return(initialTime.Int());
4983 void CTEventTest::RepeatableKeysL()
4985 // repeatable key event
4986 TKeyEvent repKeyEvent;
4987 repKeyEvent.iCode='J';
4988 repKeyEvent.iScanCode=0;
4989 repKeyEvent.iModifiers=EModifierAutorepeatable;
4990 repKeyEvent.iRepeats=0;
4992 // non-repeatable key event
4995 keyEvent.iScanCode=0;
4996 keyEvent.iModifiers=0;
4997 keyEvent.iRepeats=0;
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
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');
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');
5050 CActiveScheduler::Stop();
5053 TheClient->iWs.Flush();
5056 CTBlankWindow* CTEventTest::NewBlueForgroundWindowL()
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);
5065 window->SetColor(KRgbBlue);
5066 window->SetExt(TPoint(40, 40), TSize(40,40));
5067 window->BaseWin()->SetOrdinalPosition(0);
5071 CTBlankWindow* CTEventTest::NewBlueForgroundWindow()
5073 CTBlankWindow* window = NULL;
5074 TRAPD(err, window=NewBlueForgroundWindowL());
5075 if (err != KErrNone)
5080 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
5081 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
5082 static void CreateSurfaceAttributes(RSurfaceManager::TSurfaceCreationAttributesBuf& aBuffer , const TSize& aSize)
5084 RSurfaceManager::TSurfaceCreationAttributes& b = aBuffer();
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;
5097 static const TInt KFullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible;
5099 void CTEventTest::SurfaceVisibilityChanged1_NextSetOfEventsL()
5106 LOG_MESSAGE(_L("case 0"));
5107 TInt err = iSurfaceManager.Open();
5108 if (err != KErrNone)
5110 RDebug::Printf("RSurfaceManager::Open() failed", err);
5114 iVisWins1=NewBlueForgroundWindowL();
5115 iVisWins1->Activate();
5116 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
5118 AddExpectedEvent(EEventFocusGained);
5119 AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
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();
5129 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1);
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());
5139 iSurfaceId = TSurfaceId::CreateNullId();
5140 TInt err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId);
5141 if (err != KErrNone)
5143 RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err);
5147 err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId);
5148 if (err != KErrNone)
5150 RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err);
5154 iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //iVisWins1 will become visible
5156 AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
5160 LOG_MESSAGE(_L("default"));
5161 if (!iSurfaceId.IsNull())
5163 iSurfaceManager.CloseSurface(iSurfaceId);
5164 iSurfaceId = TSurfaceId::CreateNullId();
5166 iSurfaceManager.Close();
5171 CActiveScheduler::Stop();
5174 TheClient->iWs.Flush();
5177 void CTEventTest::SurfaceVisibilityChanged2_NextSetOfEventsL()
5179 switch (iEventSet++)
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)
5189 RDebug::Printf("RSurfaceManager::Open() failed", err);
5193 iVisWins1 = NewBlueForgroundWindowL();
5194 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
5196 iVisWins2 = NewBlueForgroundWindowL();
5197 iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer
5198 iVisWins2->BaseWin()->EnableVisibilityChangeEvents();
5200 iVisWins1->Activate(); //obscured
5201 iVisWins2->Activate(); //visible
5203 // Create surface for background window
5204 RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf;
5205 CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size());
5207 iSurfaceId = TSurfaceId::CreateNullId();
5208 err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId);
5209 if (err != KErrNone)
5211 RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err);
5215 err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId);
5216 if (err != KErrNone)
5218 RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err);
5222 iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //win1 and win2 both visible
5224 AddExpectedEvent(EEventFocusGained);
5225 AddExpectedVisibilityChange(KFullyVisible, iVisWins2);
5226 AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
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();
5237 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins2);
5238 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1);
5243 //This case contains the actual test GRAPHICS-WSERV-2669-0016
5244 LOG_MESSAGE(_L("case 2"));
5248 AddExpectedVisibilityChange(KFullyVisible, iVisWins2);
5249 AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
5253 LOG_MESSAGE(_L("default"));
5254 if (!iSurfaceId.IsNull())
5256 iSurfaceManager.CloseSurface(iSurfaceId);
5257 iSurfaceId = TSurfaceId::CreateNullId();
5259 iSurfaceManager.Close();
5266 CActiveScheduler::Stop();
5269 TheClient->iWs.Flush();
5272 TInt CTEventTest::GenerateAnEvent(TAny* aEventTest)
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);
5282 void CTEventTest::SurfaceVisibilityChanged3_NextSetOfEventsL()
5284 switch (iEventSet++)
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)
5294 RDebug::Printf("RSurfaceManager::Open() failed", err);
5297 iTimeOutCallback = CPeriodic::NewL(CActive::EPriorityIdle);
5299 iVisWins1 = NewBlueForgroundWindowL();
5300 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
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
5307 iVisWins1->Activate(); //upper left
5308 iVisWins2->Activate(); //lower right
5310 // Create surface for background window
5311 RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf;
5312 CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size());
5314 iSurfaceId = TSurfaceId::CreateNullId();
5315 err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId);
5316 if (err != KErrNone)
5318 RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err);
5322 err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId);
5323 if (err != KErrNone)
5325 RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err);
5329 iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue);
5331 AddExpectedEvent(EEventFocusGained);
5332 AddExpectedVisibilityChange(KFullyVisible, iVisWins1);
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
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);
5348 LOG_MESSAGE(_L("default"));
5349 iTimeOutCallback->Cancel();
5350 delete iTimeOutCallback;
5351 iTimeOutCallback = NULL;
5352 if (!iSurfaceId.IsNull())
5354 iSurfaceManager.CloseSurface(iSurfaceId);
5355 iSurfaceId = TSurfaceId::CreateNullId();
5357 iSurfaceManager.Close();
5362 CActiveScheduler::Stop();
5365 TheClient->iWs.Flush();
5367 #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
5368 #endif //SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
5370 void CTEventTest::VisibilityChanged_NextSetOfEventsL()
5372 const TInt fullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible;
5376 case 0: //only this case can leave
5378 iQueueClient->iWin->BackedUpWin()->MaintainBackup();
5379 iVisWins1=NewBlueForgroundWindowL();
5380 iVisWins2=NewBlueForgroundWindowL();
5382 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
5383 iVisWins1->Activate();
5384 iVisWins2->SetColor(KRgbGreen);
5385 iVisWins2->SetExt(TPoint(80, 80), TSize(120,120));
5386 iVisWins2->Activate();
5388 AddExpectedEvent(EEventFocusGained);
5389 AddExpectedVisibilityChange(fullyVisible);
5393 iVisWins1->BaseWin()->SetVisible(EFalse);
5394 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
5397 iVisWins1->BaseWin()->SetVisible(ETrue);
5398 AddExpectedVisibilityChange(fullyVisible);
5401 iVisWins2->SetExt(TPoint(0,0), TSize(120,120));
5402 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
5405 iVisWins2->BaseWin()->SetVisible(EFalse);
5406 AddExpectedVisibilityChange(fullyVisible);
5409 iVisWins2->BaseWin()->SetVisible(ETrue);
5410 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
5413 iVisWins2->SetExt(TPoint(60,60), TSize(120,120));
5414 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::EPartiallyVisible);
5417 iVisWins1->SetExt(TPoint(80,80), TSize(40,40));
5418 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
5421 iVisWins1->BaseWin()->SetOrdinalPosition(0);
5422 AddExpectedVisibilityChange(fullyVisible);
5424 if(TransparencySupportedL() != KErrNone)
5426 iEventSet += 2; //we shall skip set 9,10 as they work with transparency
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);
5440 iVisWins1->BaseWin()->SetOrdinalPosition(1);
5441 AddExpectedVisibilityChange(fullyVisible);
5447 iVisWins1=NewBlueForgroundWindow();
5449 iVisWins1->Activate();
5450 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
5452 AddExpectedVisibilityChange(fullyVisible);
5459 iVisWins1=NewBlueForgroundWindow();
5461 iVisWins1->Activate();
5462 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
5463 iVisWins1->BaseWin()->SetVisible(EFalse);
5465 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
5472 iVisWins1=NewBlueForgroundWindow();
5474 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
5475 iVisWins1->Activate();
5477 AddExpectedVisibilityChange(fullyVisible);
5484 iVisWins1=NewBlueForgroundWindow();
5486 iVisWins1->Activate();
5487 iVisWins1->BaseWin()->SetVisible(EFalse);
5488 iVisWins1->BaseWin()->EnableVisibilityChangeEvents();
5490 AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible);
5500 CActiveScheduler::Stop();
5503 TheClient->iWs.Flush();
5506 void CTEventTest::CheckTimeStamp_NextSetOfEventsL()
5508 iQueueClient->EventQueue()->SetCheckTimeStamp(ETrue);
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');
5521 _LIT8(KMsgParam,"CheckTimeStamp");
5522 TBuf8<0x20> params(KMsgParam);
5523 TInt err = TheClient->iWs.SendMessageToWindowGroup(iQueueClient->WindowGroupIdentifier(),TUid::Uid(123),params);
5524 AddExpectedEvent(EEventMessageReady);
5528 CActiveScheduler::Stop();
5531 TheClient->iWs.Flush();
5535 * @SYMTestCaseID GRAPHICS-WSERV-0001
5539 * @SYMTestCaseDesc Test Capture priority of different top most windows in a Group.
5541 * @SYMTestPriority Critical
5543 * @SYMTestStatus Implemented
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.
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.
5561 void CTEventTest::PointerCapture_NextSetOfEventsL()
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
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);
5823 CActiveScheduler::Stop();
5826 TheClient->iWs.Flush();
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.
5836 void CTEventTest::PointerBufferPurge_NextSetOfEventsL()
5838 #if defined(LOGGING)
5839 TLogMessageText logMessageText;
5840 _LIT(KSet,"PointerBufferPurge SetOfEvents: %d of 1");
5841 logMessageText.Format(KSet,iEventSet);
5842 TheClient->LogMessage(logMessageText);
5844 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
5845 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
5850 RWindowBase& win = *iQueueClient->iWin->BaseWin();
5852 // Cause a connect to happen
5853 RDebug::Print(_L("PointerBufferPurge - AllocPointerMoveBuffer()"));
5854 win.AllocPointerMoveBuffer(10, 0);
5856 // Allow pen events to be received
5857 RDebug::Print(_L("PointerBufferPurge - EnablePointerMoveBuffer()"));
5858 win.EnablePointerMoveBuffer();
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);
5868 RDebug::Print(_L("PointerBufferPurge - FreePointerMoveBuffer()"));
5869 win.FreePointerMoveBuffer();
5871 // Send sufficient events to cause a purge to happen
5872 for (TInt i=0; i<EMaxEventQueueSize; i++)
5874 RDebug::Print(_L("PointerBufferPurge - Purge Loop %d"), i);
5875 SimulatePointer(TRawEvent::EButton1Up,15,25);
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
5883 AddExpectedEvent(EEventFocusGained);
5885 for (TInt i=0; i<EMaxEventQueueSize-1; i++)
5887 AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,25-EWinPositionY));
5893 CActiveScheduler::Stop();
5896 TheClient->iWs.SetAutoFlush(iTheClientFlush);
5897 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
5901 * @SYMTestCaseID GRAPHICS-WSERV-0025
5905 * @SYMTestCaseDesc Test removal of event handlers mid-way through processing an event.
5907 * @SYMTestPriority Critical
5909 * @SYMTestStatus Implemented
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).
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.
5921 * Sends 2 events e1,e2 and expects them be received by wserv event processing.
5923 * Event set 1: (Simple scenario)
5924 * Adds 3 removable anims to event handler list
5925 * Sets lifetimes as {1000,2,5}
5927 * Expected events to be received by anims: {6,2,5}
5929 * Event set 2: (Manual removal and reset state)
5930 * Manually remove all anims from event handler list
5932 * No events expected to be received by anims
5933 * Resets all anims ready for next test
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}
5939 * Expected number of received events for anims: {1,5,9,3,8,8,8,10,5,2}
5941 * Event set 4: (Manual removal and reset state)
5942 * Manually remove all anims from event handler list
5944 * No events expected to be received by anims
5945 * Resets all anims ready for next test
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}
5951 * Expected number of received events for anims: {1,1,1,2,2,2}
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}
5957 * Expected number of received events for anims: {5,5,5,3,3,3}
5959 * Event set 7: (Addition of anims to non-empty event handler list, part 3)
5961 * Expected number of received events for anims: {8,16,1,0,0,0}
5963 * Event set 8: (Manual Removal and reset state)
5964 * Manually remove all anims from event handler list
5966 * No events expected to be received by anims
5967 * Resets all anims ready for next test
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.
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)
5978 void CTEventTest::EventHandlerRemoval_NextSetOfEventsL()
5980 #if defined(LOGGING)
5981 INFO_PRINTF1(_L("EventHandlerRemoval SetOfEvents: (Max=8)"));
5986 #if defined(LOGGING)
5987 INFO_PRINTF1(_L("AUTO Event Handler Removal Anim Events"));
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"));
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);
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"));
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();
6028 // Remove all anims, check removal was successful
6029 // and reset all anims ready for next test
6030 EventHandlerRemoval_RemoveAndResetAllAnims();
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"));
6042 const TInt KLifetimes [] = {1,5,9,3,8,8,8,10,5,2};
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();
6055 // Remove all anims, check removal was successful
6056 // and reset all anims ready for next test
6057 EventHandlerRemoval_RemoveAndResetAllAnims();
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"));
6069 const TInt KLifetimes [] = {1,1,1,5,5,5};
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();
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"));
6089 const TInt KLifetimes [] = {13,24,6};
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();
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"));
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();
6116 // Remove all anims, check removal was successful
6117 // and reset all anims ready for next test
6118 EventHandlerRemoval_RemoveAndResetAllAnims();
6122 EventHandlerRemoval_CheckRecursionOfProcessRawEvent();
6125 EventHandlerRemoval_AddEventHandlerMultipleTimes();
6128 #if defined(DETAILED)
6129 INFO_PRINTF1(_L(" Test postamble"));
6130 INFO_PRINTF1(_L(" Destroy anims"));
6133 EventHandlerRemoval_DestroyAllAnims();
6134 iRemovableAnims->Close();
6135 delete iRemovableAnims;
6136 iRemovableAnims = NULL;
6137 CActiveScheduler::Stop();
6140 TheClient->iWs.Flush();
6144 * Creates an array of aAnimCount anims on heap
6145 * Assigns array to iRemovableAnims for use in rest of tests
6147 void CTEventTest::EventHandlerRemoval_CreateAnimsL(TInt aAnimCount)
6149 RPointerArray<RRemovableAnim>* removableAnims = new (ELeave) RPointerArray<RRemovableAnim>();
6150 CleanupStack::PushL(removableAnims);
6151 for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++)
6153 RRemovableAnim* anim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll);
6154 removableAnims->AppendL(anim);
6156 CleanupStack::Pop(aAnimCount, (*removableAnims)[0]);
6157 CleanupStack::Pop(removableAnims);
6158 iRemovableAnims = removableAnims;
6162 * Sets lifetimes of anims as specified in aLifeTimes
6163 * Adds anims to event handler list
6165 void CTEventTest::EventHandlerRemoval_PrepareAnims(const TInt* aLifetimes, TInt aAnimCount)
6167 for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++)
6169 RRemovableAnim* anim = (*iRemovableAnims)[animIndex];
6170 anim->SetEventHandlerLifetime(aLifetimes[animIndex]);
6171 anim->AddToEventHandlers();
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
6181 void CTEventTest::EventHandlerRemoval_CreateExpectedEvents(TInt aEventCount, TInt aLiveAnimCount)
6183 RArray<TRawEvent> events;
6185 // Add expected events to anims
6186 for (TInt eventCount = 0; eventCount < aEventCount; eventCount++)
6189 TInt scanCode = 33 + eventCount;
6190 // Alternate key down, key up events.
6191 if (eventCount%2 == 0)
6193 rawEvent.Set(TRawEvent::EKeyDown, scanCode);
6197 rawEvent.Set(TRawEvent::EKeyUp, scanCode);
6199 EventHandlerRemoval_AddExpectedEvent(rawEvent, aLiveAnimCount);
6200 events.Append(rawEvent);
6203 // Simulates expected events
6204 for (TInt eventCount = 0; eventCount < aEventCount; eventCount++)
6206 TRawEvent event = events[eventCount];
6207 iTest->SimulateKey(event.Type(), event.ScanCode());
6214 * Adds the expected event aEvent to the first aLiveAnimCount anims
6215 * Adds expected event observed by the rest of wserv
6217 void CTEventTest::EventHandlerRemoval_AddExpectedEvent(TRawEvent aEvent, TInt aLiveAnimCount)
6219 // Add event to each of the anims
6220 for (TInt animIndex = 0; animIndex < aLiveAnimCount; animIndex++)
6222 TInt err = (*iRemovableAnims)[animIndex]->AddExpectedEvent(aEvent);
6224 TInt eventType = (aEvent.Type() == TRawEvent::EKeyDown ? EEventKeyDown : EEventKeyUp);
6225 AddExpectedKey(eventType, aEvent.ScanCode(), ETrue);
6229 * Checks each anim has received the expected events
6231 void CTEventTest::EventHandlerRemoval_CheckExpectedEventsReceivedByAnims()
6233 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
6235 if (!(*iRemovableAnims)[animIndex]->TestPassed())
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.
6251 void CTEventTest::EventHandlerRemoval_CheckRecursionOfProcessRawEvent()
6253 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
6254 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
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);
6261 // Add these anim as event handlers and set thier respective life time
6262 eventRecurAnim->AddToEventHandlers();
6263 eventRecurAnim->SetEventHandlerLifetime(4);
6265 removableAnim->AddToEventHandlers();
6266 removableAnim->SetEventHandlerLifetime(1);
6268 eventAnim->AddToEventHandlers();
6269 eventAnim->SetEventHandlerLifetime(2);
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);
6278 eventRecurAnim->AddExpectedEvent(rawEvent2);
6279 eventRecurAnim->AddExpectedEvent(rawEvent3);
6281 removableAnim->AddExpectedEvent(rawEvent2);
6283 eventAnim->AddExpectedEvent(rawEvent2);
6284 eventAnim->AddExpectedEvent(rawEvent3);
6286 // Add these events to iQueueClient for testing
6287 AddExpectedKey(EEventKeyUp, 34, ETrue);
6288 AddExpectedKey(EEventKeyUp, 35, ETrue);
6290 iTest->SimulateKey(rawEvent1.Type(), rawEvent1.ScanCode());
6292 CleanupStack::PopAndDestroy(3, eventRecurAnim);
6294 TheClient->iWs.SetAutoFlush(iTheClientFlush);
6295 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
6299 * Manually removes all anims from event handlers array
6301 void CTEventTest::EventHandlerRemoval_ManuallyRemoveAllAnims()
6303 // Manually remove all anims from event handler list
6304 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
6306 (*iRemovableAnims)[animIndex]->RemoveFromEventHandlers();
6311 * Manually removes all anims from event handlers array
6313 void CTEventTest::EventHandlerRemoval_ResetAllAnims()
6315 // Manually remove all anims from event handler list
6316 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
6318 (*iRemovableAnims)[animIndex]->Reset();
6319 (*iRemovableAnims)[animIndex]->SetEventHandlerLifetime(0);
6324 * Manually removes all anims from event handler list
6326 * Checks that no events have been received by anims
6327 * Resets all anims ready for next test
6329 void CTEventTest::EventHandlerRemoval_RemoveAndResetAllAnims()
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"));
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"));
6352 EventHandlerRemoval_ResetAllAnims();
6356 * Destroys all anims in iRemovableAnims
6357 * Resets iRemovableAnims
6359 void CTEventTest::EventHandlerRemoval_DestroyAllAnims()
6361 if (iRemovableAnims)
6364 for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--)
6366 RRemovableAnim* anim = (*iRemovableAnims)[animIndex];
6372 iRemovableAnims->Reset();
6377 SYMTestCaseID GRAPHICS-WSERV-0496
6381 @SYMTestCaseDesc Cancels key captures using all combinations of
6382 RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs.
6384 @SYMTestPriority High
6386 @SYMTestStatus Implemented
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:
6399 CancelCaptureKeyUpAndDowns()
6400 CancelCaptureLongKey()
6402 @SYMTestExpectedResults WServ should handle matched and mismatched Cancel
6403 and Capture calls without panicking.
6405 void CTEventTest::MismatchedCapture_NextSetOfEventsL()
6408 AddExpectedEvent(EEventFocusGained);
6410 if (iEventSet < (EMaxCaptureKeyApis*EMaxCancelCaptureKeyApis))
6412 TestCaptureAndCancelCapturePair(static_cast<TCaptureKeyApis>(iEventSet%EMaxCaptureKeyApis), static_cast<TCancelCaptureKeyApis>(iEventSet/EMaxCaptureKeyApis));
6417 CActiveScheduler::Stop();
6421 /** Helper function that applies a key capture and then cancels it using the
6422 passed capture and cancel RWindowGroup APIs.
6424 @param aCaptureApi Enum value specifying the capture API to use
6425 @param aCancelCaptureApi Enum value specifying the cancel capture API to use
6427 void CTEventTest::TestCaptureAndCancelCapturePair(TCaptureKeyApis aCaptureApi, TCancelCaptureKeyApis aCancelCaptureApi)
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);
6444 // Start a key capture using one of the six RWindowGroup Capture***() APIs
6445 switch (aCaptureApi)
6449 // Test RWindowGroup::CaptureKey()
6450 if (aCaptureApi == ECaptureKey1)
6451 iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('A',0,0);
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');
6465 case ECaptureKeyUpAndDowns1:
6466 case ECaptureKeyUpAndDowns2:
6467 // Test RWindowGroup::CaptureKeyUpAndDowns()
6468 if (aCaptureApi == ECaptureKeyUpAndDowns1)
6469 iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0);
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);
6483 case ECaptureLongKey1:
6484 case ECaptureLongKey2:
6486 // Test RWindowGroup::CaptureLongKey()
6487 TTimeIntervalMicroSeconds32 repeat = KeyRepeatTime();
6488 if (aCaptureApi == ECaptureLongKey1)
6490 iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ', 'a', 0, 0, 2, ELongCaptureNormal);
6494 repeat = KeyRepeatTime()/2;
6495 iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(repeat, ' ', 'a', 0, 0, 2, ELongCaptureNormal);
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);
6511 INFO_PRINTF1(_L("Unexpected TCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()"));
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)
6524 case ECancelCaptureKey:
6525 iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
6527 case ECancelCaptureKeyUpAndDowns:
6528 iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
6530 case ECancelCaptureLongKey:
6531 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
6534 INFO_PRINTF1(_L("Unexpected TCancelCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()"));
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)
6543 switch (aCaptureApi)
6547 iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey);
6549 case ECaptureKeyUpAndDowns1:
6550 case ECaptureKeyUpAndDowns2:
6551 iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey);
6553 case ECaptureLongKey1:
6554 case ECaptureLongKey2:
6555 iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey);
6561 TheClient->iWs.Flush();
6564 /*void CTEventTest::_NextSetOfEvents() //Template for these functions
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
6579 iQueueClient->iWs.Flush();
6580 SimulateEvent(TRawEvent::);
6581 TheClient->iWs.Flush();
6585 CActiveScheduler::Stop();
6588 TheClient->iWs.Flush();
6592 @SYMTestCaseID GRAPHICS-WSERV-CODEBASE-WSERV-0051
6596 @SYMTestCaseDesc Tests SetKeyboardRepeatRate API.
6600 @SYMTestStatus Implemented
6602 @SYMTestActions This test tryes to call SetKeyboardRepeatRate with invalid time values\n
6604 @SYMTestExpectedResults KeyRepeatRateNegTest should tests the API SetKeyboardRepeatRate return value\n
6605 The test should pass and API should return KErrArgument.
6608 void CTEventTest::KeyRepeatRateNegTest(TInt aInitialRepeat, TInt aRepeat)
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());
6615 INFO_PRINTF1(_L("Failed to record test result"));
6618 void CTEventTest::RunTestsL(TBool aNeedChildWindows/*=EFalse*/)
6620 iQueueClient=new(ELeave) CTQueueClient(this);
6621 iQueueClient->SetScreenNumber(iTest->iScreenNumber);
6622 iQueueClient->ConstructL(aNeedChildWindows);
6624 TRAPD(err,NextSetOfEventsL());
6631 CActiveScheduler::Start();
6633 TInt eventsLeft=iQueueClient->EventQueue()->EventsLeft();
6640 delete iQueueClient;
6644 void CTEventTest::RunTestsRestoreAreaL(TBool aNeedChildWindows)
6646 TRect area(TheClient->iWs.PointerCursorArea());
6647 RunTestsL(aNeedChildWindows);
6648 TheClient->iWs.SetPointerCursorArea(area);
6651 /*void CTEventTest::QueuePurgingL()
6656 void CTEventTest::SendEventL()
6661 void CTEventTest::InvisibleWindowL()
6666 void CTEventTest::JavaAdditionsL()
6671 void CTEventTest::WindowCapBugL()
6676 /*void CTEventTest::XyInputTypeL()
6681 void CTEventTest::MovingPointerCursorL()
6683 RunTestsRestoreAreaL(ETrue);
6686 void CTEventTest::RotatedModeL()
6688 RunTestsRestoreAreaL(EFalse);
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.
6695 void CTEventTest::EventHandlerRemoval_AddEventHandlerMultipleTimes()
6697 iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue);
6698 iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue);
6700 RRemovableAnim* eventTestAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll);
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);
6707 TRawEvent rawEvent1;
6708 rawEvent1.Set(TRawEvent::EKeyUp, 34);
6710 eventTestAnim->AddExpectedEvent(rawEvent1);
6712 // Add these events to iQueueClient for testing
6713 AddExpectedKey(EEventKeyUp, 34, ETrue);
6715 iTest->SimulateKey(TRawEvent::EKeyUp, 34);
6717 CleanupStack::PopAndDestroy(eventTestAnim);
6718 TheClient->iWs.SetAutoFlush(iTheClientFlush);
6719 iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush);
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.
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++)
6738 const TInt numTestSessions=KNumBaseTestSessions+KNumMainTestSessions+iterationLoop;
6739 #if defined(LOGGING)
6740 _LIT(KLog1,"EventQueuePtrCrashTest: Test Creating %d Clients");
6741 LOG_MESSAGE2(KLog1,numTestSessions);
6743 for(TInt testSessionIndex=0;testSessionIndex<numTestSessions;testSessionIndex++)
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)
6753 for(TInt evLoop=0;evLoop<KNumTestEvents;evLoop++)
6755 event.SetType(1001+evLoop);
6756 ws.SendEventToWindowGroup(group.Identifier(),event);
6758 if (testSessionIndex==(numTestSessions-1))
6760 for(TInt eventIndex=0;eventIndex<KMaxNumTestEvents;eventIndex++)
6762 event.SetType(1001+eventIndex);
6763 ws.SendEventToAllWindowGroups(event);
6768 #if defined(LOGGING)
6769 _LIT(KLog2,"EventQueuePtrCrashTest: Closing Clients");
6773 while(closeLoop<KNumBaseTestSessions)
6775 wsSessions[closeLoop++].Close();
6777 RWsSession extraSession1;
6778 User::LeaveIfError(extraSession1.Connect());
6779 extraSession1.Close();
6780 while(closeLoop<numTestSessions)
6782 wsSessions[closeLoop++].Close();
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.
6796 void CTEventTest::InitializeQueueSizeTestL(TBool aEventReadyCancel)
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;
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++)
6816 //Create test clients
6817 for (clientIndex = 0; clientIndex < numClients; clientIndex++)
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]);
6826 // Cancel listening to event for the first client.
6827 // This is for testing PurgeInactiveEvents.
6828 if (aEventReadyCancel)
6830 wsSession[0].EventReady(&status);
6831 wsSession[0].EventReadyCancel();
6832 User::WaitForRequest(status);
6835 //send events to window group to make the queue full.
6838 for(evLoop = 0; evLoop < numEvents; evLoop++)
6840 event.SetType(2001 + evLoop);
6841 TheClient->iWs.SendEventToWindowGroup(groupWin[0].Identifier(),event);
6842 TheClient->iWs.SendEventToWindowGroup(groupWin[1].Identifier(),event);
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
6848 RWsSession testWsSession;
6849 RWindowGroup testGroupWin;
6850 TRequestStatus testStatus;
6851 if (aEventReadyCancel)
6853 //Simulate the heap allocation failure to test expanding spaces by purge
6854 //events from inactive clients when initialize queue size.
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);
6867 User::LeaveIfError(testWsSession.Connect());
6869 CleanupClosePushL(testWsSession);
6870 testGroupWin = RWindowGroup(testWsSession);
6871 User::LeaveIfError(testGroupWin.Construct(cliHanGrpWin++));
6872 CleanupClosePushL(testGroupWin);
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
6878 #if (defined _DEBUG)
6879 TInt testEventCount = EMinQueueSize - 1;
6881 TInt testEventCount = EMinQueueSize;
6883 for(TInt evLoop = 0; evLoop < testEventCount; evLoop++)
6885 event.SetType(3001 + evLoop);
6886 TheClient->iWs.SendEventToWindowGroup(testGroupWin.Identifier(),event);
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++)
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)
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)
6907 TEST(event.Type() == expectedEvent);
6910 // testStatus has been completed. Cancel the timer.
6912 User::WaitForRequest(timerStatus);
6916 // Times out, cancel the event notification
6917 testWsSession.EventReadyCancel();
6918 User::WaitForRequest(testStatus);
6921 CleanupStack::PopAndDestroy(2*numClients + 2, &wsSession[0]);
6923 CleanupStack::PopAndDestroy(&timer);
6926 void CTEventTest::SimulateRepeatEvent(TInt aScanCode, TInt aRepeats/*=0*/)
6930 rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode, aRepeats);
6932 rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode);
6933 UserSvr::AddEvent(rawEvent);
6936 void CTEventTest::RawEventRepeatTest_NextSetOfEventsL()
6941 // Tests EKeyRepeat without repeat value set.
6942 SimulateRepeatEvent(32);
6944 // Tests EKeyRepeat with repeat value set to 2.
6945 SimulateRepeatEvent(33,2);
6947 AddExpectedEvent(EEventFocusGained);
6948 AddExpectedKey(EEventKey, 32);
6949 AddExpectedKey(EEventKey, 33, 0, 2);
6952 CActiveScheduler::Stop();
6955 TheClient->iWs.Flush();
6958 void CTEventTest::RunTestCaseL(TInt /*aCurTestCase*/)
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");
7002 if (!TestBase()->ConfigurationSupportsPointerEventTesting())
7004 INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
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)
7014 @SYMTestCaseID GRAPHICS-WSERV-0053
7018 @SYMTestCaseDesc Carry out general event tests on WServ
7020 @SYMTestPriority High
7022 @SYMTestStatus Implemented
7024 @SYMTestActions General events are sent via WServ
7026 @SYMTestExpectedResults The events are sent without error
7029 iTest->LogSubTest(KTest0);
7031 ((CTEventTestStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-WSERV-0053"));
7035 @SYMTestCaseID GRAPHICS-WSERV-0054
7039 @SYMTestCaseDesc Carry out event queue purging
7041 @SYMTestPriority High
7043 @SYMTestStatus Implemented
7045 @SYMTestActions Purge the event queue
7047 @SYMTestExpectedResults The events queue is purged without error
7050 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0054"));
7051 iTest->LogSubTest(KTest1);
7052 RunTestsL(); //QueuePurgingL();
7055 @SYMTestCaseID GRAPHICS-WSERV-0055
7059 @SYMTestCaseDesc Test that events can be sent
7061 @SYMTestPriority High
7063 @SYMTestStatus Implemented
7065 @SYMTestActions Send events in WServ
7067 @SYMTestExpectedResults The events are sent without error
7070 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0055"));
7071 iTest->LogSubTest(KTest2);
7072 RunTestsL(); //SendEventL();
7075 @SYMTestCaseID GRAPHICS-WSERV-0056
7079 @SYMTestCaseDesc Send an event to all window groups
7081 @SYMTestPriority High
7083 @SYMTestStatus Implemented
7085 @SYMTestActions Send an event to all window groups
7087 @SYMTestExpectedResults The events are sent to all window groups
7091 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0056"));
7092 iTest->LogSubTest(KTest3);
7096 @SYMTestCaseID GRAPHICS-WSERV-0057
7100 @SYMTestCaseDesc Send events to an invisible window
7102 @SYMTestPriority High
7104 @SYMTestStatus Implemented
7106 @SYMTestActions Send events to an invisible window
7108 @SYMTestExpectedResults The events are sent to the window without
7112 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0057"));
7113 iTest->LogSubTest(KTest4);
7114 RunTestsL(ETrue); //InvisibleWindowL();
7117 @SYMTestCaseID GRAPHICS-WSERV-0058
7121 @SYMTestCaseDesc Send events for java additions
7123 @SYMTestPriority High
7125 @SYMTestStatus Implemented
7127 @SYMTestActions Send events for java additions
7129 @SYMTestExpectedResults The events are sent to the window without
7133 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0058"));
7134 iTest->LogSubTest(KTest5);
7135 RunTestsL(); //JavaAdditionsL();
7139 ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
7140 iTest->LogSubTest(KTest6);
7141 //WindowCapBugL(); //Not finished
7144 @SYMTestCaseID GRAPHICS-WSERV-0059
7148 @SYMTestCaseDesc Send events for x and y inputs
7150 @SYMTestPriority High
7152 @SYMTestStatus Implemented
7154 @SYMTestActions Send events for x and y inputs
7156 @SYMTestExpectedResults The events are sent to the window without
7160 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0059"));
7161 iTest->LogSubTest(KTest7);
7162 RunTestsL(); //XyInputTypeL();
7165 @SYMTestCaseID GRAPHICS-WSERV-0060
7169 @SYMTestCaseDesc Send events for moving pointer cursor
7171 @SYMTestPriority High
7173 @SYMTestStatus Implemented
7175 @SYMTestActions Send events for moving pointer cursor
7177 @SYMTestExpectedResults The events are sent to the window without
7181 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0060"));
7182 iTest->LogSubTest(KTest8);
7183 RunTestsRestoreAreaL(ETrue); //MovingPointerCursorL();
7186 @SYMTestCaseID GRAPHICS-WSERV-0061
7190 @SYMTestCaseDesc Send events for rotate mode
7192 @SYMTestPriority High
7194 @SYMTestStatus Implemented
7196 @SYMTestActions Send events for rotate mode
7198 @SYMTestExpectedResults The events are sent to the window without
7202 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0061"));
7203 iTest->LogSubTest(KTest9);
7204 RunTestsRestoreAreaL(EFalse); //RotatedModeL();
7207 @SYMTestCaseID GRAPHICS-WSERV-0062
7211 @SYMTestCaseDesc Send events for an anim event
7213 @SYMTestPriority High
7215 @SYMTestStatus Implemented
7217 @SYMTestActions Send events for an anim event
7219 @SYMTestExpectedResults The events are sent to the window without
7223 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0062"));
7224 iTest->LogSubTest(KTest10);
7225 RunTestsRestoreAreaL(EFalse); //AnimEvent();
7228 @SYMTestCaseID GRAPHICS-WSERV-0063
7232 @SYMTestCaseDesc Send events for focus changed
7234 @SYMTestPriority High
7236 @SYMTestStatus Implemented
7238 @SYMTestActions Send events for focus changed
7240 @SYMTestExpectedResults The events are sent to the window without
7244 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0063"));
7245 iTest->LogSubTest(KTest11);
7246 RunTestsL(); //FocusChanged();
7249 @SYMTestCaseID GRAPHICS-WSERV-0064
7253 @SYMTestCaseDesc Send stop events
7255 @SYMTestPriority High
7257 @SYMTestStatus Implemented
7259 @SYMTestActions Send stop events
7261 @SYMTestExpectedResults The events are sent to the window without
7265 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0064"));
7266 iTest->LogSubTest(KTest12);
7267 RunTestsL(ETrue); //StopEvents();
7270 @SYMTestCaseID GRAPHICS-WSERV-0065
7274 @SYMTestCaseDesc Send events for the virtual keyboard
7276 @SYMTestPriority High
7278 @SYMTestStatus Implemented
7280 @SYMTestActions Send events for the virtual keyboard
7282 @SYMTestExpectedResults The events are sent to the window without
7286 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0065"));
7287 iTest->LogSubTest(KTest13);
7288 RunTestsL(); //VirtualKeyboard();
7291 @SYMTestCaseID GRAPHICS-WSERV-0066
7295 @SYMTestCaseDesc Send events for key clicks
7297 @SYMTestPriority High
7299 @SYMTestStatus Implemented
7301 @SYMTestActions Send stop events
7303 @SYMTestExpectedResults The events are sent to the window without
7307 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0066"));
7308 iTest->LogSubTest(KTest14);
7311 if (iClick.IsLoaded(changeable) && !iTest->IsFullRomL())
7312 RunTestsL(ETrue); //KeyClicks();
7316 @SYMTestCaseID GRAPHICS-WSERV-0067
7320 @SYMTestCaseDesc Test RWindowGroup::CaptureLongKey()
7322 @SYMTestPriority High
7324 @SYMTestStatus Implemented
7326 @SYMTestActions Simulate long key presses and check that long key capture
7327 and key repeat work as expected.
7329 @SYMTestExpectedResults The correct key events are sent to the window without
7333 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0067"));
7334 iTest->LogSubTest(KTest15);
7335 RunTestsL(ETrue); //CaptureLong();
7338 @SYMTestCaseID GRAPHICS-WSERV-0068
7342 @SYMTestCaseDesc Send events for activating password
7344 @SYMTestPriority High
7346 @SYMTestStatus Implemented
7348 @SYMTestActions Send events for activating password
7350 @SYMTestExpectedResults The events are sent to the window without
7354 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0068"));
7355 iTest->LogSubTest(KTest16);
7356 if (!iTest->IsFullRomL())
7357 RunTestsL(); //Password();
7360 @SYMTestCaseID GRAPHICS-WSERV-0069
7364 @SYMTestCaseDesc Send events for activating password
7366 @SYMTestPriority High
7368 @SYMTestStatus Implemented
7370 @SYMTestActions Send events for activating password
7372 @SYMTestExpectedResults The events are sent to the window without
7376 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0069"));
7377 iTest->LogSubTest(KTest17);
7381 @SYMTestCaseID GRAPHICS-WSERV-0070
7385 @SYMTestCaseDesc Send repeatable key events
7387 @SYMTestPriority High
7389 @SYMTestStatus Implemented
7391 @SYMTestActions Send repeatable key events
7393 @SYMTestExpectedResults The events are sent to the window without
7397 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0070"));
7398 iTest->LogSubTest(KTest18);
7402 @SYMTestCaseID GRAPHICS-WSERV-0071
7406 @SYMTestCaseDesc Send Screen Scaling events
7408 @SYMTestPriority High
7410 @SYMTestStatus Implemented
7412 @SYMTestActions Send Screen Scaling events
7414 @SYMTestExpectedResults The events are sent to the window without
7418 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0071"));
7419 iTest->LogSubTest(KTest19);
7420 if (iScreenModeTests&EDoScale)
7426 @SYMTestCaseID GRAPHICS-WSERV-0072
7430 @SYMTestCaseDesc Send Visibility Changed events
7432 @SYMTestPriority High
7434 @SYMTestStatus Implemented
7436 @SYMTestActions Send Visibility Changed events
7438 @SYMTestExpectedResults The events are sent to the window without
7442 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0072"));
7443 iTest->LogSubTest(KTest20);
7447 @SYMTestCaseID GRAPHICS-WSERV-0073
7451 @SYMTestCaseDesc Check Time Stamp Of Sent Events
7453 @SYMTestPriority High
7455 @SYMTestStatus Implemented
7457 @SYMTestActions Check Time Stamp Of Sent Events
7459 @SYMTestExpectedResults The time stamps for the events are correct
7462 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0073"));
7463 iTest->LogSubTest(KTest21);
7467 @SYMTestCaseID GRAPHICS-WSERV-0074
7471 @SYMTestCaseDesc Send Pointer Capture Priority Events
7473 @SYMTestPriority High
7475 @SYMTestStatus Implemented
7477 @SYMTestActions Send Pointer Capture Priority Events
7479 @SYMTestExpectedResults The events are sent to the window without
7483 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0074"));
7484 iTest->LogSubTest(KTest22);
7488 @SYMTestCaseID GRAPHICS-WSERV-0343
7492 @SYMTestCaseDesc Send Event Handler Removal Events
7494 @SYMTestPriority High
7496 @SYMTestStatus Implemented
7498 @SYMTestActions Send Event Handler Removal Events
7500 @SYMTestExpectedResults The events are sent to the window without
7504 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0343"));
7505 iTest->LogSubTest(KTest23);
7506 RunTestsL(); //EventHandlerRemoval();
7510 @SYMTestCaseID GRAPHICS-WSERV-0565
7512 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0565"));
7513 iTest->LogSubTest(KTest24);
7514 EventQueuePtrCrashTest();
7517 @SYMTestCaseID GRAPHICS-WSERV-0496
7521 @SYMTestCaseDesc Cancels key captures using all combinations of
7522 RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs.
7524 @SYMTestPriority High
7526 @SYMTestStatus Implemented
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:
7539 CancelCaptureKeyUpAndDowns()
7540 CancelCaptureLongKey()
7542 @SYMTestExpectedResults WServ should handle matched and mismatched Cancel
7543 and Capture calls without panicking.
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"));
7552 iTest->LogSubTest(KTest25);
7557 @SYMTestCaseID GRAPHICS-WSERV-0444
7561 @SYMTestCaseDesc Pointer Buffer Exception After Event Queue Purge
7563 @SYMTestPriority High
7565 @SYMTestStatus Implemented
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.
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.
7576 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0444"));
7577 iTest->LogSubTest(KTest26);
7581 @SYMTestCaseID GRAPHICS-WSERV-0484
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
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.
7598 iTest->LogSubTest(KTest27);
7602 #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
7604 @SYMTestCaseID GRAPHICS-WSERV-0751, GRAPHICS-WSERV-0752, GRAPHICS-WSERV-0753
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.
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.
7625 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0751"));
7626 iTest->LogSubTest(KTest28);
7631 @SYMTestCaseID GRAPHICS-WSERV-0760, GRAPHICS-WSERV-0761, GRAPHICS-WSERV-0762
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.
7646 Note: this test requires entries in the Blocked Key Table of the Reference
7647 Key Routing Plug-in for EKeyDevice3 and EStdKeyDevice3.
7650 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0760"));
7651 iTest->LogSubTest(KTest29);
7656 @SYMTestCaseID GRAPHICS-WSERV-0754, GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756
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
7674 Note: this test requires entries in the Restricted Key Table of the Reference
7675 Key Routing Plug-in for the chosen keys.
7678 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0754"));
7679 iTest->LogSubTest(KTest30);
7684 @SYMTestCaseID GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758, GRAPHICS-WSERV-0759
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.
7704 Note: this test requires entries in the Priority Application Table of the
7705 Reference Key Routing Plug-in for the chosen key.
7708 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0757"));
7709 iTest->LogSubTest(KTest31);
7713 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
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.
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
7726 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0015"));
7727 iTest->LogSubTest(KTest32);
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
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
7743 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0016"));
7744 iTest->LogSubTest(KTest33);
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.
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)
7759 ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0017"));
7760 iTest->LogSubTest(KTest34);
7763 #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
7764 #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
7767 @SYMTestCaseID GRAPHICS-WSERV-0559
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.
7777 #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA
7780 #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS
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);
7796 ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
7797 ((CTEventTestStep*)iStep)->CloseTMSGraphicsStep();
7801 ((CTEventTestStep*)iStep)->RecordTestResultL();
7810 __WS_CONSTRUCT_STEP__(EventTest)