sl@0: // Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Test window server events sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: #ifndef __INIPARSER_H__ sl@0: #define __INIPARSER_H__ sl@0: #endif // __INIPARSER_H__ sl@0: sl@0: #include "PARSEINIDATA.H" sl@0: #include "TEVENT.H" sl@0: #include "W32CLICK.H" sl@0: #include sl@0: #include sl@0: sl@0: #define FAIL_LOGGING on sl@0: //#define DETAILED sl@0: #define LOGGING 1 //Uncomment this when there is a fail so that you get more logging sl@0: sl@0: _LIT(KKeyClickPluginDll, "click.dll"); sl@0: sl@0: const TInt KLongKeyCaptureLowPriority = 1; sl@0: const TInt KLongKeyCaptureHighPriority = 2; sl@0: sl@0: CTQueueClient::CTQueueClient(CTEventTest *aTest) : iTest(aTest) sl@0: { sl@0: } sl@0: sl@0: CTQueueClient::~CTQueueClient() sl@0: { sl@0: CloseEventTestGroupOnSecondScreen(); sl@0: iGroup->GroupWin()->EnableReceiptOfFocus(EFalse); sl@0: delete iChildWin; sl@0: delete iWin; sl@0: sl@0: } sl@0: sl@0: void CTQueueClient::ConstructL(TBool aCreateChild) sl@0: { sl@0: CTClient::ConstructL(); sl@0: iGroup=new(ELeave) CTQueueWindowGroup(this); sl@0: iGroup->ConstructL(); sl@0: iWin=new(ELeave) CTBackedUpWin(EGray4); sl@0: iWin->ConstructExtLD(*iGroup,TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight)); sl@0: iWin->Activate(); sl@0: if (aCreateChild) sl@0: { sl@0: iChildWin=new(ELeave) CTBackedUpWin(EGray4); sl@0: iChildWin->ConstructExtLD(*iWin,ChildTopLeft(),ChildSize()); sl@0: iChildWin->Activate(); sl@0: } sl@0: iWs.Flush(); sl@0: } sl@0: sl@0: void CTQueueClient::ConstructEventHandlerL() sl@0: { sl@0: iEventHandler=new(ELeave) CTQueueTestEvent(&iWs, iTest); sl@0: ((CTQueueTestEvent *)iEventHandler)->ConstructL(); sl@0: } sl@0: sl@0: TInt CTQueueClient::WindowGroupIdentifier() sl@0: { sl@0: return(iGroup->GroupWin()->Identifier()); sl@0: } sl@0: sl@0: CTWinBase* CTQueueClient::GetHandle(TPoint& aPos) sl@0: { sl@0: if (iCapturing) sl@0: return iChildWin; sl@0: if (iChildWin && TRect(ChildTopLeft(),ChildSize()).Contains(aPos)) sl@0: //if (iChildWin && TRect(TPoint(),ChildSize()).Contains(aPos)) sl@0: { sl@0: aPos-=ChildTopLeft(); sl@0: if (iChildCapturing) sl@0: iCapturing=ETrue; sl@0: return iChildWin; sl@0: } sl@0: return iWin; sl@0: } sl@0: sl@0: void CTQueueClient::AddExpectedEvent(TWsEvent &aEvent) sl@0: { sl@0: #if defined(DETAILED) sl@0: _LIT(KLog," Adding Event Type=%d"); sl@0: TLogMessageText buf; sl@0: buf.Format(KLog,aEvent.Type()); sl@0: LogMessage(buf); sl@0: #endif sl@0: ((CTQueueTestEvent *)iEventHandler)->AddExpectedEvent(aEvent); sl@0: } sl@0: sl@0: void CTQueueClient::SetChildCapture(TInt aCaptureFlags) sl@0: { sl@0: if (!iChildWin) sl@0: return; sl@0: iChildWin->BaseWin()->SetPointerCapture(aCaptureFlags); sl@0: if (aCaptureFlags|RWindowBase::TCaptureFlagEnabled) sl@0: iChildCapturing=ETrue; sl@0: } sl@0: // sl@0: sl@0: CTQueueTestEvent::CTQueueTestEvent(RWsSession *aWs, CTEventTest *aTest) : CTEvent(aWs) sl@0: { sl@0: iTest = aTest; sl@0: iCheckTimeStamp = EFalse; sl@0: iLastEventError = EFalse; sl@0: } sl@0: sl@0: void CTQueueTestEvent::ConstructL() sl@0: { sl@0: CTEventBase::Construct(); sl@0: iEventBuffer.SetLengthL(EEventBufferSize); sl@0: iRedrawType=iTest->TestBase()->RedrawStoreTypeL(); sl@0: } sl@0: sl@0: void CTQueueTestEvent::TestL(TInt aTest) sl@0: { sl@0: if (!aTest) sl@0: { sl@0: iTest->Failed(); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: } sl@0: sl@0: //#define FAIL_LOGGING yes sl@0: void CTQueueTestEvent::doRunL() sl@0: { sl@0: TWsEvent wsEvent; sl@0: iWs->GetEvent(wsEvent); sl@0: TWsEvent expectedEvent; sl@0: sl@0: #if defined(FAIL_LOGGING) sl@0: TInt eType,wsHan,eHan,wsKeyCode,eKeyCode,wsKeyRepeat,eKeyRepeat,wsKeyScan,eKeyScan; sl@0: TLogMessageText buf; sl@0: _LIT(KStartString,"AUTO EventTestFail "); sl@0: #endif sl@0: TInt wsType=wsEvent.Type(); sl@0: if (wsEvent.Type()==EEventNull) sl@0: TestL(wsEvent.Handle()==0); sl@0: else sl@0: { sl@0: TInt count=iEventBuffer.Count(); sl@0: if (count==0 && wsType==EEventFocusGained) sl@0: goto End; sl@0: if (iLastEventError sl@0: && (iRedrawType==EPartialRedraw_FullRedrawSupport || iRedrawType==EPartialRedraw_PreserveStoredCmds) sl@0: && 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 sl@0: { sl@0: #if defined(DETAILED) sl@0: _LIT(KLog,"Skip Duplicate Error Message"); sl@0: iTest->LOG_MESSAGE(KLog); sl@0: #endif sl@0: return; //Ignore repeated error events sl@0: } sl@0: do { sl@0: TestL(iEventBuffer.Remove(&expectedEvent)); //Loop needed for REL Build with DEB WSERV and W32 sl@0: #if defined(DETAILED) sl@0: _LIT(KLog,"Skip event while waiting for error message"); sl@0: if (expectedEvent.Type()==EEventErrorMessage && wsEvent.Type()!=expectedEvent.Type()) sl@0: iTest->LOG_MESSAGE(KLog); sl@0: #endif sl@0: } while (expectedEvent.Type()==EEventErrorMessage && wsEvent.Type()!=expectedEvent.Type()); sl@0: ++iEventCount; //iEventSet sl@0: #if defined(FAIL_LOGGING) sl@0: wsType=wsEvent.Type(),eType=expectedEvent.Type(),wsHan=wsEvent.Handle(),eHan=expectedEvent.Handle(); sl@0: if (wsType!=eType) sl@0: { sl@0: _LIT(KEventDiff,"Count=%d Events Differ Exp=%d Act=%d"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KEventDiff,iEventCount,eType,wsType); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: else sl@0: { sl@0: #if defined(DETAILED) sl@0: _LIT(KLog," Count=%d Event Type=%d"); sl@0: iTest->LOG_MESSAGE3(KLog,iEventCount,wsType); sl@0: #endif sl@0: } sl@0: if (wsHan!=eHan) sl@0: { sl@0: _LIT(KHandlesDiff,"Count=%d Handles Differ"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KHandlesDiff,iEventCount); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: #endif sl@0: TestL(wsEvent.Type()==expectedEvent.Type() && wsEvent.Handle()==expectedEvent.Handle()); sl@0: } sl@0: iLastEventError=(wsEvent.Type()==EEventErrorMessage); sl@0: sl@0: switch(wsEvent.Type()) sl@0: { sl@0: case EEventKey: sl@0: #if defined(FAIL_LOGGING) sl@0: wsKeyCode=wsEvent.Key()->iCode,eKeyCode=expectedEvent.Key()->iCode; sl@0: if (wsKeyCode!=eKeyCode) sl@0: { sl@0: _LIT(KKeysDiff,"Count=%d Key Code Exp=%d (%c) Act=%d (%c)"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KKeysDiff,iEventCount,eKeyCode,eKeyCode,wsKeyCode,wsKeyCode); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: wsKeyRepeat=wsEvent.Key()->iRepeats,eKeyRepeat=expectedEvent.Key()->iRepeats; sl@0: if ((wsKeyRepeat>0)!=(eKeyRepeat>0) || wsKeyRepeatLOG_MESSAGE(buf); sl@0: } sl@0: #endif sl@0: TestL(wsEvent.Key()->iCode==expectedEvent.Key()->iCode && sl@0: wsEvent.Key()->iRepeats>=expectedEvent.Key()->iRepeats && sl@0: (wsEvent.Key()->iRepeats>0)==(expectedEvent.Key()->iRepeats>0)); sl@0: // Fall Through sl@0: case EEventKeyDown: sl@0: case EEventKeyUp: sl@0: { sl@0: TUint wsModifiers = wsEvent.Key()->iModifiers; sl@0: TUint eModifiers = expectedEvent.Key()->iModifiers; sl@0: #if defined(FAIL_LOGGING) sl@0: wsKeyScan=wsEvent.Key()->iScanCode,eKeyScan=expectedEvent.Key()->iScanCode; sl@0: if (wsKeyScan!=eKeyScan) sl@0: { sl@0: _LIT(KScanDiff,"Count=%d Scan Code Exp=%d (%c) Act=%d (%c)"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KScanDiff,iEventCount,eKeyScan,eKeyScan,wsKeyScan,wsKeyScan); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: sl@0: if (eModifiers != KModifiersIgnore && wsModifiers != eModifiers) sl@0: { sl@0: _LIT(KModDiff,"Count=%d Modifiers Exp=0x%x Act=0x%x"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KModDiff, iEventCount, eModifiers, wsModifiers); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: #endif sl@0: TestL(wsEvent.Key()->iScanCode == expectedEvent.Key()->iScanCode && sl@0: (eModifiers == KModifiersIgnore || wsModifiers == eModifiers)); sl@0: } sl@0: break; sl@0: case EEventModifiersChanged: sl@0: { sl@0: TBool changeModifiersOK=(wsEvent.ModifiersChanged()->iChangedModifiers sl@0: ==expectedEvent.ModifiersChanged()->iChangedModifiers); sl@0: TBool modifiersOK=((wsEvent.ModifiersChanged()->iModifiers&wsEvent.ModifiersChanged()->iChangedModifiers)== sl@0: (expectedEvent.ModifiersChanged()->iModifiers&wsEvent.ModifiersChanged()->iChangedModifiers)); sl@0: #if defined(FAIL_LOGGING) sl@0: if (!changeModifiersOK || !modifiersOK) sl@0: { sl@0: _LIT(KModDiff,"Count=%d Modifiers"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KModDiff,iEventCount); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: #endif sl@0: TestL(changeModifiersOK); sl@0: TestL(modifiersOK); sl@0: } sl@0: break; sl@0: case EEventPointer: sl@0: case EEventDragDrop: sl@0: { sl@0: #if defined(FAIL_LOGGING) sl@0: TInt expectedType=expectedEvent.Pointer()->iType, actualType=wsEvent.Pointer()->iType; sl@0: TPoint expectedPos=expectedEvent.Pointer()->iPosition, actualPos=wsEvent.Pointer()->iPosition; sl@0: if (actualType!=expectedType) sl@0: { sl@0: _LIT(KPointerDiff,"Count=%d Pointer Type Exp=%d Act=%d"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KPointerDiff,iEventCount,expectedType,actualType); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: if (actualPos!=expectedPos) sl@0: { sl@0: _LIT(KPointerPosDiff,"Count=%d Pointer Pos E=(%d,%d) A=(%d,%d)"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KPointerPosDiff,iEventCount,expectedPos.iX,expectedPos.iY sl@0: ,actualPos.iX,actualPos.iY); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: #endif sl@0: TestL(wsEvent.Pointer()->iType==expectedEvent.Pointer()->iType); sl@0: TestL(wsEvent.Pointer()->iPosition==expectedEvent.Pointer()->iPosition); sl@0: TInt count=iEventBuffer.Count();count++; //Dummy line to help in debugging. sl@0: } sl@0: break; sl@0: case EEventWindowVisibilityChanged: sl@0: { sl@0: #if defined(FAIL_LOGGING) sl@0: TUint expectedFlags=expectedEvent.VisibilityChanged()->iFlags; sl@0: TUint actualFlags=wsEvent.VisibilityChanged()->iFlags; sl@0: if (actualFlags!=expectedFlags) sl@0: { sl@0: _LIT(KVisibilityDiff,"Count=%d Visibility Flags Exp=%d Act=%d"); sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(KVisibilityDiff,iEventCount,expectedFlags,actualFlags); sl@0: iTest->LOG_MESSAGE(buf); sl@0: } sl@0: #endif sl@0: TestL(wsEvent.VisibilityChanged()->iFlags==expectedEvent.VisibilityChanged()->iFlags); sl@0: TInt count=iEventBuffer.Count();count++; //Dummy line to help in debugging. sl@0: } sl@0: break; sl@0: case EEventMessageReady: sl@0: { sl@0: const SEventMessageReady message = *(SEventMessageReady*)wsEvent.EventData(); sl@0: TestL(message.iMessageUid== TUid::Uid(123)); sl@0: } sl@0: break; sl@0: default:; sl@0: } sl@0: if(iCheckTimeStamp) sl@0: { sl@0: const TInt KOffset=100000; //0.1secs sl@0: TInt64 offset = expectedEvent.Time().Int64() - wsEvent.Time().Int64(); sl@0: #if defined(FAIL_LOGGING) sl@0: if(Abs(offset)LOG_MESSAGE(buf); sl@0: } sl@0: #endif sl@0: TestL(Abs(offset)NextSetOfEventsL()); //Not allowed to leave sl@0: if(err != KErrNone) sl@0: { sl@0: buf.Copy(KStartString); sl@0: buf.AppendFormat(_L("Subtest does not follow rules set by TEvent test framework, leave code: %d"), err); sl@0: iTest->TEST(EFalse); sl@0: iTest->LOG_MESSAGE(buf); sl@0: User::Leave(err); sl@0: } sl@0: } sl@0: sl@0: } sl@0: sl@0: void CTQueueTestEvent::AddExpectedEvent(TWsEvent &aEvent) sl@0: { sl@0: if(iCheckTimeStamp) sl@0: { sl@0: static_cast(aEvent).Time().UniversalTime(); sl@0: } sl@0: iEventBuffer.Add(&aEvent); sl@0: } sl@0: sl@0: TInt CTQueueTestEvent::EventsLeft() sl@0: { sl@0: return iEventBuffer.Count(); sl@0: } sl@0: // sl@0: sl@0: CTQueueWindowGroup::CTQueueWindowGroup(CTClient *aClient) : CTWindowGroup(aClient) sl@0: {} sl@0: sl@0: void CTQueueWindowGroup::ConstructL() sl@0: { sl@0: CTWindowGroup::ConstructL(); sl@0: User::LeaveIfError(iGroupWin.EnableOnEvents(EEventControlAlways)); sl@0: User::LeaveIfError(iGroupWin.EnableGroupChangeEvents()); sl@0: } sl@0: sl@0: // sl@0: sl@0: /** sl@0: Closes and deletes anim DLL. sl@0: @param aAnimDll Pointer to the anim Dll to be closed and deleted sl@0: */ sl@0: LOCAL_C void DestroyAnimDll(TAny* aAnimDll) sl@0: { sl@0: (static_cast(aAnimDll))->Destroy(); sl@0: } sl@0: sl@0: /** sl@0: Destroys an REventAnimBase derived anim sl@0: @param aAnim REventAnimBase derived client-side handle to anim sl@0: */ sl@0: LOCAL_C void DestroyAnim(TAny* aAnim) sl@0: { sl@0: (static_cast(aAnim))->Destroy(); sl@0: } sl@0: sl@0: /** sl@0: Loads the DLL containing the test anims and pushes it onto the cleanup stack. sl@0: This function leaves if the operation was unsuccessful. sl@0: @return A pointer to the DLL containing test anims sl@0: */ sl@0: RAnimDll* REventAnimBase::LoadL() sl@0: { sl@0: RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs); sl@0: CleanupStack::PushL(TCleanupItem(DestroyAnimDll,animDll)); sl@0: User::LeaveIfError(animDll->Load(KAnimDLLName)); sl@0: CleanupStack::Pop(animDll); sl@0: return animDll; sl@0: } sl@0: sl@0: /** sl@0: Closes the client-side handle to the anim, destroys the DLL and deletes itself. sl@0: */ sl@0: void REventAnimBase::Destroy() sl@0: { sl@0: Close(); sl@0: delete this; sl@0: } sl@0: sl@0: /** sl@0: Resets server-side state of anim sl@0: */ sl@0: void REventAnimBase::Reset() sl@0: { sl@0: CommandReply(EADllReset); sl@0: } sl@0: sl@0: /** sl@0: @return Under non-error conditions, returns 0. sl@0: Under error conditions, returns the number of events received sl@0: since the first unexpected event was sent. sl@0: */ sl@0: TInt REventAnimBase::ErrorCode() sl@0: { sl@0: return CommandReply(EADllErrorCode); sl@0: } sl@0: sl@0: /** sl@0: @return The number of events received by the anim since it was last reset. sl@0: */ sl@0: TInt REventAnimBase::NumberOfEventsReceived() sl@0: { sl@0: return CommandReply(EADllNumberOfEventsReceived); sl@0: } sl@0: sl@0: /** sl@0: Adds an expected event to the list of events expected by the anim. sl@0: @param aEat Indicates if event is expected to be eaten (ETrue 'indicates expected to be eaten') sl@0: @param aEvent The expected event sl@0: @return KErrNone if succcessful, othewise error code. sl@0: */ sl@0: TInt REventAnimBase::AddExpectedEvent(TBool aEat, const TRawEvent& aEvent) sl@0: { sl@0: TAnimRawEvent event; sl@0: event.iRawEvent=aEvent; sl@0: event.iEat=aEat; sl@0: return AddExpectedEvent(event); sl@0: } sl@0: sl@0: /** sl@0: Adds an expected event to the list of events expected by the anim. sl@0: @param aEvent The expected event sl@0: @return KErrNone if succcessful, othewise error code. sl@0: */ sl@0: TInt REventAnimBase::AddExpectedEvent(const TAnimRawEvent& aEvent) sl@0: { sl@0: TPckgBuf param; sl@0: param()=aEvent; sl@0: return CommandReply(EADllAddExpectedEvent,param); sl@0: } sl@0: sl@0: // sl@0: sl@0: /** sl@0: Loads the DLL containing the event test anim and creates an anim for event tests sl@0: @param aWin the base window to which the anim is associated (this anim is a Window anim) sl@0: @return A pointer to the new REventAnim sl@0: */ sl@0: REventAnim* REventAnim::NewL(RWindowBase* aWin, RAnimDll* aDll, REventAnimBase::EAnimationType aType/*=EEventAnim*/) sl@0: { sl@0: REventAnim* self=new(ELeave) REventAnim(aDll); sl@0: CleanupStack::PushL(TCleanupItem(DestroyAnim,self)); sl@0: User::LeaveIfError(self->Construct(*aWin,(aType == EEventAnim ? EAnimTypeEventTest : EAnimTypeEventPostingTest), TPtrC8())); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: Checks if the anim has received the correct events, and resets the sever-side state of the anim sl@0: @return positive value if events did not match expected showing the first event that didn't match. sl@0: negative value if there were the wrong number of events showing the number of events there were sl@0: 0 if correct number of events and they all match sl@0: */ sl@0: TInt REventAnim::TestFail(TInt aNoEvents) sl@0: { sl@0: TInt events=CommandReply(EADllErrorCode); sl@0: if (events>0) sl@0: return events; sl@0: events=CommandReply(EADllNoEventsAndReset); sl@0: if (events==aNoEvents) sl@0: return 0; sl@0: return -events; sl@0: } sl@0: sl@0: // sl@0: /** sl@0: Loads the DLL containing the event test anim and creates an anim for event handler removal tests sl@0: @param aWin the base window to which the anim is associated (this anim is a Window anim) sl@0: @return A pointer to the new REventAnim sl@0: */ sl@0: RRemovableAnim* RRemovableAnim::NewLC(RWindowBase* aWin, RAnimDll* aDll) sl@0: { sl@0: RRemovableAnim* self=new(ELeave) RRemovableAnim(aDll); sl@0: CleanupStack::PushL(TCleanupItem(DestroyAnim,self)); sl@0: User::LeaveIfError(self->Construct(*aWin,EAnimTypeRemovableAnim,TPtrC8())); sl@0: return self; sl@0: } sl@0: sl@0: /** sl@0: Sets the lifetime of the anim. This anim will remove itself from the sl@0: event handler list after receiving this number of events. sl@0: @return The lifetime of the anim sl@0: */ sl@0: TInt RRemovableAnim::SetEventHandlerLifetime(TInt aEventCount) sl@0: { sl@0: TPckgBuf param; sl@0: param()=aEventCount; sl@0: return CommandReply(EADllSetEventHandlerLifetime, param); sl@0: } sl@0: sl@0: /** sl@0: Retrieves the lifetime of the anim. This anim will remove itself from the sl@0: event handler list after receiving this number of events. sl@0: @return The lifetime of the anim sl@0: */ sl@0: TInt RRemovableAnim::EventHandlerLifetime() sl@0: { sl@0: return CommandReply(EADllEventHandlerLifetime); sl@0: } sl@0: /** sl@0: Adds the anim to the list of event handlers. sl@0: This anim should receive any subsequent events. sl@0: @return KErrNone on successful addition. sl@0: */ sl@0: TInt RRemovableAnim::AddToEventHandlers() sl@0: { sl@0: return CommandReply(EADllAddToEventHandlers); sl@0: } sl@0: sl@0: /** sl@0: Removes the anim from the list of event handlers. sl@0: This anim should not receive any subsequent events. sl@0: @return KErrNone on successful removal. sl@0: */ sl@0: TInt RRemovableAnim::RemoveFromEventHandlers() sl@0: { sl@0: return CommandReply(EADllRemoveFromEventHandlers); sl@0: } sl@0: sl@0: /** sl@0: Tests if the anim has received the correct number of events, and that sl@0: the events received are all the correct events. sl@0: @param aNoEvents The total expected number of events since it was last reset/constructed. sl@0: @return ETrue if the anim has received the expected events. sl@0: */ sl@0: TBool RRemovableAnim::TestPassed() sl@0: { sl@0: return CommandReply(EADllTestPassed); sl@0: } sl@0: sl@0: // sl@0: sl@0: CTEventTest::CTEventTest(CTestStep* aStep) : CTWsGraphicsBase(aStep) sl@0: { sl@0: INFO_PRINTF1(_L("Testing Event functions")); sl@0: } sl@0: sl@0: CTEventTest::~CTEventTest() sl@0: { sl@0: delete iBlankWin; sl@0: iBackingWindow.Close(); sl@0: delete iVisWins1; sl@0: delete iVisWins2; sl@0: delete iVisWins3; sl@0: delete iTransWin; sl@0: delete iQueueClient; sl@0: if (iAnim) sl@0: iAnim->Destroy(); sl@0: delete iEventTestGroup2; //Just in case it doesn't get deleted normally sl@0: delete iEventTestGroup3; //Just in case it doesn't get deleted normally sl@0: delete iEventTestGroup4; //Just in case it doesn't get deleted normally sl@0: if (iPtrPluginLoaded) sl@0: { sl@0: iClick.Unload(); sl@0: } sl@0: iClick.Close(); sl@0: if (iTurnBackOnCapsLock) sl@0: { sl@0: TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOnModifier); sl@0: } sl@0: if (iRemovableAnims) sl@0: { sl@0: EventHandlerRemoval_DestroyAllAnims(); sl@0: iRemovableAnims->Close(); sl@0: delete iRemovableAnims; sl@0: } sl@0: if (iAnimDll) sl@0: { sl@0: iAnimDll->Destroy(); sl@0: } sl@0: #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: if (!iSurfaceId.IsNull()) sl@0: { sl@0: iSurfaceManager.CloseSurface(iSurfaceId); sl@0: } sl@0: iSurfaceManager.Close(); sl@0: if(iTimeOutCallback) sl@0: { sl@0: iTimeOutCallback->Cancel(); sl@0: delete iTimeOutCallback; sl@0: } sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: } sl@0: sl@0: void CTEventTest::ConstructL() sl@0: { sl@0: _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini"); sl@0: CIniData* iniData = CIniData::NewL(KWsIniFile, ' '); sl@0: _LIT( KWsiniYShifting, "YSHIFTING"); sl@0: iniData->FindVar(KWsiniYShifting, iYOffset); sl@0: delete iniData; sl@0: TheClient->iScreen->SetAppScreenMode(0); sl@0: TheClient->iScreen->SetScreenMode(0); // in mode 0 TheClient->iScreen->SizeInPixels() sl@0: iPhysicalScreenSize = TheClient->iScreen->SizeInPixels(); // is equal to physical screen size sl@0: BaseWin->Invalidate(); sl@0: BaseWin->Win()->BeginRedraw(); sl@0: TheGc->Activate(*BaseWin->Win()); sl@0: TheGc->SetBrushColor(TRgb::Gray16(12)); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: TheGc->DrawRect(TRect(BaseWin->Win()->Size())); sl@0: TheGc->Deactivate(); sl@0: BaseWin->Win()->EndRedraw(); sl@0: TheGc->Activate(*TestWin->Win()); sl@0: TheGc->SetBrushColor(TRgb::Gray16(4)); sl@0: TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush); sl@0: TheGc->SetPenStyle(CGraphicsContext::ENullPen); sl@0: TheGc->DrawRect(TRect(TestWin->Win()->Size())); sl@0: TheGc->Deactivate(); sl@0: iBackingWindow=RBlankWindow(TheClient->iWs); sl@0: iBackingWindow.Construct(*TheClient->iGroup->WinTreeNode(),ENullWsHandle); sl@0: iBackingWindow.SetColor(TRgb(0,0xDD,0xDD)); sl@0: iBackingWindow.SetOrdinalPosition(-1,-25); sl@0: iBackingWindow.Activate(); sl@0: iBlankWin=new(ELeave) CTBlankWindow(); sl@0: iBlankWin->ConstructL(*TheClient->iGroup); sl@0: User::LeaveIfError(iBlankWin->BaseWin()->SetRequiredDisplayMode(EColor256)); sl@0: iBlankWin->SetExt(TPoint(),iPhysicalScreenSize); sl@0: iBlankWin->SetVisible(EFalse); sl@0: iBlankWin->Activate(); sl@0: CArrayFixFlat *rotations=new(ELeave) CArrayFixFlat(1); sl@0: iNumScrModes=TheClient->iScreen->NumScreenModes(); sl@0: TInt modes=Min(2,iNumScrModes); sl@0: TInt mode; sl@0: TInt rot; sl@0: CleanupStack::PushL(rotations); sl@0: for (mode=0;modeiScreen->GetRotationsList(mode,rotations)); sl@0: for (rot=rotations->Count()-1;rot>=0;--rot) sl@0: { sl@0: iScreenModeTests|=(1<<(*rotations)[rot]); sl@0: } sl@0: } sl@0: if (CheckScalingSupportedOrNot()) sl@0: iScreenModeTests|=EDoScale; sl@0: sl@0: iClick=RSoundPlugIn(TheClient->iWs); sl@0: User::LeaveIfError(iClick.Construct(TUid::Uid(CLICK_THIRD_UID))); sl@0: TBool ptrPluginLoadable = EFalse; sl@0: iClick.IsLoaded(ptrPluginLoadable); sl@0: if (ptrPluginLoadable) sl@0: { sl@0: User::LeaveIfError(iClick.Load(KKeyClickPluginDll)); sl@0: iPtrPluginLoaded = ETrue; sl@0: } sl@0: CleanupStack::PopAndDestroy(); sl@0: if (TheClient->iWs.GetModifierState()&EModifierCapsLock) sl@0: { sl@0: iTurnBackOnCapsLock=ETrue; sl@0: TheClient->iWs.SetModifierState(EModifierCapsLock,ETurnOffModifier); sl@0: } sl@0: iAnimDll = REventAnimBase::LoadL(); sl@0: TInt mods=TheClient->iWs.GetModifierState(); sl@0: if (mods&EModifierCapsLock) sl@0: iTest->SimulateKeyDownUp(EStdKeyCapsLock); sl@0: if (mods&EModifierNumLock) sl@0: iTest->SimulateKeyDownUp(EStdKeyNumLock); sl@0: //Make sure all the keys we test are in the up state sl@0: iTest->SimulateKeyDownUp(EStdKeyLeftShift); sl@0: iTest->SimulateKeyDownUp(EStdKeyRightShift); sl@0: iTest->SimulateKeyDownUp(EStdKeyLeftFunc); sl@0: iTest->SimulateKeyDownUp(EStdKeyLeftCtrl); sl@0: iTest->SimulateKeyDownUp(EStdKeyRightCtrl); sl@0: mods=TheClient->iWs.GetModifierState(); sl@0: _LIT(KLog,"Initial Modifiers state 0x%x (ideally should be zero)"); sl@0: LOG_MESSAGE2(KLog,mods); sl@0: iTest->DelayIfFullRomL(); sl@0: sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: // 2d or 3d pointer? sl@0: if(HAL::Get(HALData::EPointer3D,iIs3DPointer)!=KErrNone) sl@0: { sl@0: iIs3DPointer=EFalse; sl@0: } sl@0: #endif sl@0: TheClient->iWs.GetKeyboardRepeatRate(iKeyBoardRepeatInitialDelay, iKeyBoardRepeatNextDelay); sl@0: } sl@0: sl@0: void CTEventTest::Failed() sl@0: { sl@0: #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: if(iTimeOutCallback) sl@0: { sl@0: iTimeOutCallback->Cancel(); sl@0: iTimeOutCallback->Deque(); sl@0: delete iTimeOutCallback; sl@0: iTimeOutCallback = NULL; sl@0: } sl@0: TEST(EFalse); sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: CActiveScheduler::Stop(); sl@0: iFailed=ETrue; sl@0: } sl@0: sl@0: void CTEventTest::CheckTimeInterval(const TTimeIntervalMicroSeconds32 &aTime,TInt aCheckTime) sl@0: { sl@0: TEST(aTime.Int()==aCheckTime); sl@0: if (aTime.Int()!=aCheckTime) sl@0: INFO_PRINTF3(_L("aTime.Int()==aCheckTime - Expected: %d, Actual: %d"), aCheckTime, aTime.Int()); sl@0: } sl@0: sl@0: void CTEventTest::KeyRepeatRate(TInt aInitialRepeat, TInt aRepeat) sl@0: { sl@0: TheClient->iWs.SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32(aInitialRepeat), TTimeIntervalMicroSeconds32(aRepeat)); sl@0: TTimeIntervalMicroSeconds32 initialTime; sl@0: TTimeIntervalMicroSeconds32 time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); sl@0: CheckTimeInterval(initialTime,aInitialRepeat); sl@0: CheckTimeInterval(time,aRepeat); sl@0: } sl@0: sl@0: void CTEventTest::DoubleClickSettings(TInt aInterval, TInt aDistance) sl@0: { sl@0: TheClient->iWs.SetDoubleClick(TTimeIntervalMicroSeconds32(aInterval), aDistance); sl@0: TTimeIntervalMicroSeconds32 interval; sl@0: TInt distance; sl@0: TheClient->iWs.GetDoubleClickSettings(interval, distance); sl@0: CheckTimeInterval(interval,aInterval); sl@0: TEST(aDistance==distance); sl@0: if (aDistance!=distance) sl@0: INFO_PRINTF3(_L("aDistance==distance - Expected: %d, Actual: %d"), distance, aDistance); sl@0: } sl@0: sl@0: TInt EventCancelFunc(TAny* aClient) sl@0: { sl@0: TWsQTEvent event; sl@0: event.SetType(EEventModifiersChanged); sl@0: ((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0; sl@0: ((TModifiersChangedEvent *)event.EventData())->iModifiers=0; sl@0: TheClient->iWs.SendEventToWindowGroup(TheClient->iGroup->GroupWin()->Identifier(),event); sl@0: // sl@0: TRequestStatus status; sl@0: ((CTClient *)aClient)->iWs.EventReady(&status); sl@0: ((CTClient *)aClient)->iWs.EventReadyCancel(); sl@0: User::WaitForRequest(status); sl@0: return(KErrNone); sl@0: } sl@0: sl@0: void CTEventTest::General() sl@0: { sl@0: TWsQTEvent event; sl@0: event.SetType(EEventModifiersChanged); sl@0: ((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0; sl@0: ((TModifiersChangedEvent *)event.EventData())->iModifiers=0; sl@0: TheClient->iWs.SendEventToWindowGroup(TheClient->iGroup->GroupWin()->Identifier(),event); sl@0: TCallBack callBack(EventCancelFunc,TheClient); sl@0: TheClient->SetCancelFunction(callBack); sl@0: // sl@0: TTimeIntervalMicroSeconds32 oldInitialTime; sl@0: TTimeIntervalMicroSeconds32 oldTime; sl@0: TheClient->iWs.GetKeyboardRepeatRate(oldInitialTime,oldTime); sl@0: // sl@0: KeyRepeatRate(EKeyboardInitialRepeat1, EKeyboardRepeat1); sl@0: KeyRepeatRate(EKeyboardInitialRepeat2, EKeyboardRepeat2); sl@0: KeyRepeatRate(EKeyboardInitialRepeat3+200, EKeyboardRepeat3); // Max initial repeat with normal keyboard repeat value sl@0: KeyRepeatRate(EKeyboardInitialRepeat3, EKeyboardRepeat7+200); // Max key and initial repeat sl@0: KeyRepeatRateNegTest(EKeyboardInitialRepeat4, EKeyboardRepeat4); // -ve initial repeat sl@0: KeyRepeatRateNegTest(EKeyboardInitialRepeat2, EKeyboardRepeat6); // -ve keyboard repeat sl@0: #if defined __WINS__ || defined __WINSCW__ sl@0: KeyRepeatRateNegTest(EKeyboardInitialRepeat3+400, EKeyboardRepeat5); // More than max initial repeat sl@0: #endif//defined __WINS__ || defined __WINSCW__ sl@0: DoubleClickSettings(EDoubleClickTime1,EDoubleClickGap1); sl@0: DoubleClickSettings(EDoubleClickTime2,EDoubleClickGap2); sl@0: TheClient->iWs.SetKeyboardRepeatRate(oldInitialTime,oldTime); sl@0: // sl@0: } sl@0: sl@0: #define UNIQUE_PRIORITY 123 sl@0: void CTEventTest::General2() sl@0: { sl@0: RWindowGroup& group=*TheClient->iGroup->GroupWin(); sl@0: TInt priority=group.OrdinalPriority(); sl@0: TInt position=group.OrdinalPosition(); sl@0: TInt priorityGain=TheClient->iWs.GetWindowGroupOrdinalPriority(group.Identifier())-priority; sl@0: group.SetOrdinalPosition(0,UNIQUE_PRIORITY); sl@0: TWsQTEvent event; sl@0: event.SetType(EEventModifiersChanged); sl@0: ((TModifiersChangedEvent *)event.EventData())->iChangedModifiers=0; sl@0: ((TModifiersChangedEvent *)event.EventData())->iModifiers=0; sl@0: TheClient->iWs.SendEventToAllWindowGroups(UNIQUE_PRIORITY+priorityGain,event); sl@0: TCallBack callBack(EventCancelFunc,TheClient); sl@0: TheClient->SetCancelFunction(callBack); sl@0: group.SetOrdinalPosition(position,priority); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/) sl@0: { sl@0: TPckgBuf evtPkg; sl@0: TWsEvent& event=evtPkg(); sl@0: if (aEventCode==EEventKey && aCode==0) sl@0: aCode=aScanCode; sl@0: event.SetType(aEventCode); sl@0: event.SetHandle((TInt)iQueueClient->iGroup); sl@0: event.Key()->iCode=aCode; sl@0: event.Key()->iScanCode=aScanCode; sl@0: event.Key()->iModifiers=aModifiers; sl@0: event.Key()->iRepeats=aRepeats; sl@0: iQueueClient->AddExpectedEvent(event); sl@0: if (iAddToClick) sl@0: { sl@0: if (aModifiers == KModifiersIgnore) sl@0: { sl@0: // Key click tests assume zero modifiers in click event by default sl@0: event.Key()->iModifiers = 0; sl@0: } sl@0: iClick.CommandReply(EClickEventAdd,evtPkg); sl@0: } sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=KModifiersIgnore*/) sl@0: { sl@0: __ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital)); sl@0: // EModiferAutorepeatable can be present in EEventKey but is never valid sl@0: // in EEventKeyDown and EEventKeyUp. sl@0: TUint modifiersDownUp = (aModifiers == KModifiersIgnore) ? sl@0: aModifiers : aModifiers & ~EModifierAutorepeatable; sl@0: sl@0: AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,modifiersDownUp); sl@0: AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers); sl@0: AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,modifiersDownUp); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedEvent(TInt aEventCode, CTWinBase* aWin) sl@0: { sl@0: TWsQTEvent event; sl@0: event.iType=aEventCode; sl@0: event.iHandle=REINTERPRET_CAST(TInt,aWin); sl@0: iQueueClient->AddExpectedEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedEvent(TInt aEventCode, RWindowGroup* aWindow) sl@0: { sl@0: TWsQTEvent event; sl@0: event.iType=aEventCode; sl@0: event.iHandle=(TUint32)aWindow; sl@0: iQueueClient->AddExpectedEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedEvent(TInt aEventCode) sl@0: { sl@0: AddExpectedEvent(aEventCode,iQueueClient->iGroup); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedErrorMessage(TWsErrorMessage::TErrorCategory aCategory, TInt aError) sl@0: { sl@0: TWsQTEvent event; sl@0: event.iType=EEventErrorMessage; sl@0: event.iHandle=(TInt)iQueueClient->iGroup; sl@0: event.ErrorMessage()->iErrorCategory=aCategory; sl@0: event.ErrorMessage()->iError=aError; sl@0: iQueueClient->AddExpectedEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::CalculatePointerEvent(TWsEvent& aEvent,TPointerEvent::TType aType, TPoint aPos) sl@0: { sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: TAdvancedPointerEvent& ptrEvent=*aEvent.Pointer(); sl@0: aEvent.SetType(EEventPointer); sl@0: ptrEvent.iParentPosition=aPos; sl@0: // SetHandle must be done after iParentPosition is set, but before iPosition is set. sl@0: aEvent.SetHandle(reinterpret_cast(iQueueClient->GetHandle(aPos))); sl@0: const TPoint3D point3D(aPos.iX, aPos.iY, 0); sl@0: const TInt pointerEventModifiers=0; sl@0: const TUint8 pointerNumber=0; sl@0: aEvent.InitAdvancedPointerEvent(aType,pointerEventModifiers,point3D,pointerNumber); sl@0: #else sl@0: TPointerEvent& ptrEvent=*aEvent.Pointer(); sl@0: aEvent.SetType(EEventPointer); sl@0: ptrEvent.iParentPosition=aPos; //Must be done before next line sl@0: aEvent.SetHandle(REINTERPRET_CAST(TInt,iQueueClient->GetHandle(aPos))); sl@0: ptrEvent.iType=aType; sl@0: ptrEvent.iModifiers=0; sl@0: ptrEvent.iPosition=aPos; sl@0: #endif sl@0: } sl@0: sl@0: void CTEventTest::CalculatePointerCaptureEvent(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TInt aHandle) sl@0: { sl@0: TPointerEvent& ptrEvent=*aEvent.Pointer(); sl@0: aEvent.SetType(EEventPointer); sl@0: ptrEvent.iParentPosition=aPos; //Must be done before next line sl@0: if(iVisWins1 && iVisWins2) sl@0: { sl@0: if (TRect(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()).Contains(aPos) && sl@0: !TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos)) sl@0: { sl@0: aPos-=iQueueClient->ChildTopLeft(); //Pointer is on the first window sl@0: aEvent.SetHandle((TInt)iVisWins1); sl@0: } sl@0: else if (TRect(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()).Contains(aPos)) sl@0: { sl@0: aPos-=(iQueueClient->ChildTopLeft()+TPoint(15,15)); //Pointer is on the second window sl@0: aEvent.SetHandle((TInt)iVisWins2); sl@0: } sl@0: else if (TRect(TPoint(EWinPositionX,EWinPositionY),TSize(EWinWidth,EWinHeight)).Contains(aPos)) sl@0: { sl@0: aPos-=TPoint(EWinPositionX,EWinPositionY); //Pointer is on the parent window sl@0: aEvent.SetHandle((TInt)iQueueClient->iWin); sl@0: } sl@0: else sl@0: { sl@0: aEvent.SetHandle((TInt)0); //Pointer is not in the same window group sl@0: } sl@0: } sl@0: ptrEvent.iType=aType; sl@0: ptrEvent.iModifiers=0; sl@0: if(aHandle!=0 && aHandle!=aEvent.Handle()) sl@0: { sl@0: aEvent.SetHandle(aHandle); sl@0: ptrEvent.iPosition=ptrEvent.iParentPosition-(iQueueClient->ChildTopLeft()+TPoint(15,15)); sl@0: } sl@0: else sl@0: { sl@0: ptrEvent.iPosition=aPos; sl@0: } sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedPointerCapture(TPointerEvent::TType aType, TPoint aPos, TInt aHandle) sl@0: { sl@0: TPckgBuf evtPkg; sl@0: CalculatePointerCaptureEvent(evtPkg(),aType,aPos,aHandle); sl@0: iQueueClient->AddExpectedEvent(evtPkg()); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedPointer(TPointerEvent::TType aType, TPoint aPos) sl@0: { sl@0: TPckgBuf evtPkg; sl@0: CalculatePointerEvent(evtPkg(),aType,aPos); sl@0: iQueueClient->AddExpectedEvent(evtPkg()); sl@0: if (iAddToClick) sl@0: { sl@0: evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY); sl@0: iClick.CommandReply(EClickEventAdd,evtPkg); sl@0: } sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedPointerClick(TPointerEvent::TType aType, TPoint aPos) sl@0: { sl@0: TPckgBuf evtPkg; sl@0: CalculatePointerEvent(evtPkg(),aType,aPos); sl@0: evtPkg().Pointer()->iParentPosition+=TPoint(EWinPositionX,EWinPositionY); sl@0: iClick.CommandReply(EClickEventAdd,evtPkg); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedPointerDownUp(TPoint aPos) sl@0: { sl@0: AddExpectedPointer(TPointerEvent::EButton1Down,aPos); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up,aPos); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedPointerScr(TPointerEvent::TType aType, TPoint aPos) sl@0: { sl@0: AddExpectedPointer(aType,TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY)); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedPointerDownUpScr(TPoint aPos) sl@0: { sl@0: AddExpectedPointerDownUp(TPoint(aPos.iX-EWinPositionX,aPos.iY-EWinPositionY)); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedModifiersChanged(TInt aChangedModifiers, TInt aModifiers) sl@0: { sl@0: TWsQTEvent event; sl@0: event.iType=EEventModifiersChanged; sl@0: event.iHandle=(TInt)iQueueClient->iGroup; sl@0: event.ModifiersChanged()->iChangedModifiers=aChangedModifiers; sl@0: event.ModifiersChanged()->iModifiers=aModifiers; sl@0: iQueueClient->AddExpectedEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedEnterExit(TInt aEventCode, TPoint aPos) sl@0: { sl@0: AddExpectedEvent(aEventCode,iQueueClient->GetHandle(aPos)); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedKeyAnim(TRawEvent::TType aEventCode, TInt aScanCode, TBool aEat) sl@0: { sl@0: TAnimRawEvent event; sl@0: event.iRawEvent.Set(aEventCode,aScanCode); sl@0: event.iEat=aEat; sl@0: TInt retVal = iAnim->AddEvent(event); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("iAnim->AddEvent(event) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: if (!aEat) sl@0: AddExpectedKey((aEventCode==TRawEvent::EKeyDown ? EEventKeyDown:EEventKeyUp),aScanCode); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedPointerAnim(TRawEvent::TType aEventCode, TPoint aPoint, TBool aEat/*=ETrue*/) sl@0: { sl@0: TAnimRawEvent event; sl@0: event.iRawEvent.Set(aEventCode,aPoint.iX,aPoint.iY); sl@0: event.iEat=aEat; sl@0: sl@0: TInt retVal = iAnim->AddEvent(event); sl@0: TEST(retVal==KErrNone); sl@0: if (retVal!=KErrNone) sl@0: INFO_PRINTF3(_L("iAnim->AddEvent(event) return value - Expected: %d, Actual: %d"), KErrNone, retVal); sl@0: sl@0: if (!aEat) sl@0: AddExpectedPointer((aEventCode==TRawEvent::EButton1Down ? TPointerEvent::EButton1Down:TPointerEvent::EButton1Up) sl@0: ,aPoint-TPoint(EWinPositionX,EWinPositionY)); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedVisibilityChange(TUint aFlags) sl@0: { sl@0: TWsQTEvent event; sl@0: event.iType=EEventWindowVisibilityChanged; sl@0: event.iHandle=(TInt)iVisWins1; sl@0: event.VisibilityChanged()->iFlags=aFlags; sl@0: iQueueClient->AddExpectedEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::AddExpectedVisibilityChange(TUint aFlags, CTBlankWindow* aWindow) sl@0: { sl@0: TWsQTEvent event; sl@0: event.iType=EEventWindowVisibilityChanged; sl@0: event.iHandle=(TInt)aWindow; sl@0: event.VisibilityChanged()->iFlags=aFlags; sl@0: iQueueClient->AddExpectedEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::SimulatePointerWin(TRawEvent::TType aType, TInt aX, TInt aY) sl@0: { sl@0: SimulatePointer(aType,EWinPositionX+aX,EWinPositionY+aY+iYOffset); sl@0: } sl@0: sl@0: void CTEventTest::SimulatePointerDownUpWin(TInt aX, TInt aY) sl@0: { sl@0: iTest->SimulatePointerDownUp(EWinPositionX+aX,EWinPositionY+aY+iYOffset); sl@0: } sl@0: sl@0: void CTEventTest::SimulatePointer(TRawEvent::TType aType, TInt aX, TInt aY) sl@0: { sl@0: iTest->SimulatePointer(aType,aX,aY+iYOffset); sl@0: } sl@0: sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: void CTEventTest::SimulateButton1DownWithSimulatedMove(TInt aX, TInt aY) sl@0: { sl@0: if(iIs3DPointer) sl@0: { sl@0: // With advanced pointer events we can have an XYInputType of Pointer coupled with 3DPointer sl@0: // which now makes MovesAvailable return ETrue rahter than EFalse, which in turn stops the simulated sl@0: // Emove from being generated. sl@0: // So... sl@0: // If MovesAvailable() returns ETrue, then this move will be used, and the WServ simulated move wont be generated sl@0: // If MovesAvailable() returns EFalse, then this move will be filtered out, and the WServ simulated move will be generated sl@0: SimulatePointer(TRawEvent::EPointerMove,aX,aY); sl@0: } sl@0: // then the original button down event sl@0: SimulatePointer(TRawEvent::EButton1Down,aX,aY); sl@0: } sl@0: #endif sl@0: sl@0: void CTEventTest::NextSetOfEventsL() sl@0: { sl@0: iQueueClient->ResetCount(iEventSet); sl@0: switch (iTest->iState) sl@0: { sl@0: case 1: sl@0: QueuePurge_NextSetOfEventsL(); sl@0: break; sl@0: case 2: sl@0: SendEventTest_NextSetOfEvents(); sl@0: break; sl@0: case 4: sl@0: InvisibleWindow_NextSetOfEvents(); sl@0: break; sl@0: case 5: sl@0: JavaAdditions_NextSetOfEvents(); sl@0: break; sl@0: case 6: sl@0: WinCap_NextSetOfEvents(); sl@0: break; sl@0: case 7: sl@0: XyInputType_NextSetOfEvents(); sl@0: break; sl@0: case 8: sl@0: MovingPointerCursor_NextSetOfEventsL(); sl@0: break; sl@0: case 9: sl@0: RotatedMode_NextSetOfEventsL(); sl@0: break; sl@0: case 10: sl@0: AnimEvent_NextSetOfEventsL(); sl@0: break; sl@0: case 11: sl@0: FocusChanged_NextSetOfEventsL(); sl@0: break; sl@0: case 12: sl@0: StopEvents_NextSetOfEventsL(); sl@0: break; sl@0: case 13: sl@0: VirtualKeyboard_NextSetOfEventsL(); sl@0: break; sl@0: case 14: sl@0: KeyClicks_NextSetOfEvents(); sl@0: break; sl@0: case 15: sl@0: CaptureLong_NextSetOfEventsL(); sl@0: break; sl@0: case 16: sl@0: Password_NextSetOfEvents(); sl@0: break; sl@0: case 17: sl@0: GroupListChanged_NextSetOfEventsL(); sl@0: break; sl@0: case 18: sl@0: RepeatableKeysL(); sl@0: break; sl@0: case 19: sl@0: ScreenScaling_NextSetOfEventsL(); sl@0: break; sl@0: case 20: sl@0: VisibilityChanged_NextSetOfEventsL(); sl@0: break; sl@0: case 21: sl@0: CheckTimeStamp_NextSetOfEventsL(); sl@0: break; sl@0: case 22: sl@0: PointerCapture_NextSetOfEventsL(); sl@0: break; sl@0: case 23: sl@0: EventHandlerRemoval_NextSetOfEventsL(); sl@0: break; sl@0: // Note that case 24 (which is KTest24) does not use NextSetOfEventsL() sl@0: case 25: sl@0: MismatchedCapture_NextSetOfEventsL(); sl@0: break; sl@0: case 26: sl@0: PointerBufferPurge_NextSetOfEventsL(); sl@0: break; sl@0: case 27: sl@0: RawEventRepeatTest_NextSetOfEventsL(); sl@0: break; sl@0: sl@0: #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: case 28: sl@0: KeyEventTranslation_NextSetOfEventsL(); sl@0: break; sl@0: case 29: sl@0: KeyEventBlocking_NextSetOfEventsL(); sl@0: break; sl@0: case 30: sl@0: KeyEventAppRestriction_NextSetOfEventsL(); sl@0: break; sl@0: case 31: sl@0: KeyEventAppPriority_NextSetOfEventsL(); sl@0: break; sl@0: #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: case 32: sl@0: SurfaceVisibilityChanged1_NextSetOfEventsL(); sl@0: break; sl@0: case 33: sl@0: SurfaceVisibilityChanged2_NextSetOfEventsL(); sl@0: break; sl@0: case 34: sl@0: SurfaceVisibilityChanged3_NextSetOfEventsL(); sl@0: break; sl@0: #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: default: sl@0: AutoPanic(EAutoPanicWrongTest); sl@0: } sl@0: } sl@0: sl@0: void CTEventTest::TriggerOomMessage(TTimeIntervalMinutes aPeriod) sl@0: { sl@0: TTime time; sl@0: if (aPeriod.Int()!=0) // adjust time to affect Oom message triggering sl@0: { sl@0: time.HomeTime(); sl@0: User::SetHomeTime(time+aPeriod); sl@0: } sl@0: RBlankWindow win(TheClient->iWs); sl@0: win.Construct(*(TheClient->iGroup->WinTreeNode()),1); sl@0: win.SetColor(TRgb::Gray4(1)); sl@0: win.SetExtent(TPoint(10,10),TheClient->iGroup->Size()-TSize(20,20)); sl@0: TheClient->iWs.HeapSetFail(RHeap::EDeterministic,1); sl@0: win.Activate(); sl@0: TheClient->iWs.Flush(); sl@0: TheClient->iWs.HeapSetFail(RHeap::ENone,0); sl@0: if (aPeriod.Int()!=0) sl@0: { sl@0: time.HomeTime(); sl@0: User::SetHomeTime(time-aPeriod); sl@0: } sl@0: win.Close(); sl@0: } sl@0: sl@0: TBool CTEventTest::SetClickType(TClickOutputModes aType) sl@0: { sl@0: TPckgBuf intPkg; sl@0: intPkg()=aType; sl@0: TInt err=iClick.CommandReply(EClickCommandSetOutput,intPkg); sl@0: if (err!=KErrNone) sl@0: Failed(); sl@0: return err; sl@0: } sl@0: sl@0: void CTEventTest::CreateEventTestGroup() sl@0: { sl@0: iEventTestGroup=RWindowGroup(TheClient->iWs); sl@0: iEventTestGroup.Construct(123, EFalse); sl@0: iEventTestGroup.SetName(_L("Fred")); sl@0: } sl@0: sl@0: void CTQueueClient::CreateEventTestGroupOnSecondScreenL() sl@0: { sl@0: const TInt KSndScreenNo=1; sl@0: iSndScreen=new(ELeave) CWsScreenDevice(iWs); sl@0: User::LeaveIfError(iSndScreen->Construct(KSndScreenNo)); sl@0: iWinGp1 = new(ELeave) RWindowGroup(iWs); sl@0: User::LeaveIfError(iWinGp1->Construct((TUint32)iWinGp1,ETrue,iSndScreen)); sl@0: iWinGp2 = new (ELeave) RWindowGroup(iWs); sl@0: User::LeaveIfError(iWinGp2->Construct((TUint32)iWinGp2,ETrue,iSndScreen)); sl@0: } sl@0: sl@0: void CTQueueClient::CloseEventTestGroupOnSecondScreen() sl@0: { sl@0: if(iWinGp1) sl@0: { sl@0: iWinGp1->Close(); sl@0: delete iWinGp1; sl@0: iWinGp1=NULL; sl@0: } sl@0: if(iWinGp2) sl@0: { sl@0: iWinGp2->Close(); sl@0: delete iWinGp2; sl@0: iWinGp2=NULL; sl@0: } sl@0: if(iSndScreen) sl@0: { sl@0: delete iSndScreen; sl@0: iSndScreen = NULL; sl@0: } sl@0: } sl@0: sl@0: void CTEventTest::CloseEventTestGroup() sl@0: { sl@0: iEventTestGroup.Close(); sl@0: } sl@0: sl@0: void CTEventTest::CreateAndCloseEventTestGroup() sl@0: // sl@0: // Create and close a window group to test sending of group changed messages sl@0: // sl@0: { sl@0: CreateEventTestGroup(); sl@0: CloseEventTestGroup(); sl@0: } sl@0: sl@0: void CTEventTest::QueuePurge_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"QueuePurge SetOfEvents: %d of 11"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: TheClient->LogMessage(logMessageText); sl@0: #endif sl@0: iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); sl@0: iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,32); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,32); sl@0: CreateAndCloseEventTestGroup(); sl@0: SimulatePointer(TRawEvent::EButton1Down,10,20); sl@0: SimulatePointer(TRawEvent::EButton1Up,20,30); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: CreateAndCloseEventTestGroup(); sl@0: // sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKey(EEventKeyDown,32); sl@0: AddExpectedKey(EEventKeyUp,32); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: break; sl@0: case 1: sl@0: { sl@0: for(TInt count=0;count<100;count++) sl@0: { sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'A'+(count%26)); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'A'+(count%26)); sl@0: } sl@0: for(TInt count2=0;count2iGroup->GroupWin()->EnableModifierChangedEvents(0xFFFFFFFF, EEventControlOnlyWhenVisible)); sl@0: for(TInt count=0;count<20;count++) sl@0: { sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift); sl@0: } sl@0: for(TInt count2=0;count2<60;count2++) sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'A'); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: AddExpectedModifiersChanged(EModifierLeftShift|EModifierRightShift|EModifierShift,0); sl@0: for(TInt count3=0;count3iGroup->GroupWin()->DisableModifierChangedEvents(); sl@0: } sl@0: break; sl@0: case 3: sl@0: { sl@0: SimulatePointer(TRawEvent::EButton1Up,10,20); sl@0: SimulatePointer(TRawEvent::EButton2Up,11,22); sl@0: SimulatePointer(TRawEvent::EButton1Down,12,23); sl@0: SimulatePointer(TRawEvent::EPointerMove,13,24); sl@0: SimulatePointer(TRawEvent::EButton3Down,15,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,14,24); sl@0: for(TInt count2=0;count2<60;count2++) sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'A'); sl@0: SimulatePointer(TRawEvent::EButton3Up,15,25); // Should get stripped by unmatched purged down handling code sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'A'); // To stop repeats sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton2Up, TPoint(11-EWinPositionX,22-EWinPositionY)); sl@0: for(TInt count3=0;count3SimulateKey(TRawEvent::EKeyDown,'B'); sl@0: SimulatePointer(TRawEvent::EButton1Down,12,23); sl@0: SimulatePointer(TRawEvent::EPointerMove,13,24); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'B'); sl@0: SimulatePointer(TRawEvent::EButton3Down,15,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,14,24); sl@0: iQueueClient->iWs.PurgePointerEvents(); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton2Up, TPoint(11-EWinPositionX,22-EWinPositionY)); sl@0: AddExpectedKey(EEventKeyDown,'B'); sl@0: AddExpectedKey(EEventKey,'B','b'); sl@0: AddExpectedKey(EEventKeyUp,'B'); sl@0: // AddExpectedPointer(TPointerEvent::EButton3Down, TPoint(15-EWinPositionX,25-EWinPositionY)); sl@0: AddExpectedEvent(EEventSwitchOn); // To check pointer events purged okay sl@0: } sl@0: break; sl@0: case 5: sl@0: CreateEventTestGroup(); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: break; sl@0: case 6: sl@0: CloseEventTestGroup(); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: break; sl@0: case 7: sl@0: iQueueClient->iGroup->GroupWin()->DisableGroupChangeEvents(); sl@0: CreateAndCloseEventTestGroup(); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: break; sl@0: case 8: sl@0: SimulatePointer(TRawEvent::EButton1Down,12,23); sl@0: iQueueClient->iWs.PurgePointerEvents(); sl@0: SimulatePointer(TRawEvent::EButton1Up,13,24); sl@0: SimulatePointer(TRawEvent::EButton2Down,12,23); sl@0: iQueueClient->iWs.PurgePointerEvents(); sl@0: SimulatePointer(TRawEvent::EButton2Up,13,24); sl@0: SimulatePointer(TRawEvent::EButton3Down,12,23); sl@0: iQueueClient->iWs.PurgePointerEvents(); sl@0: SimulatePointer(TRawEvent::EButton3Up,13,24); sl@0: // sl@0: SendEvent(EEventUser); sl@0: AddExpectedEvent(EEventUser); sl@0: break; sl@0: case 9: sl@0: { sl@0: for(TInt count5=0;count5<500;count5++) sl@0: { sl@0: RWindowGroup group(TheClient->iWs); sl@0: group.Construct(ENullWsHandle); sl@0: group.EnableReceiptOfFocus(EFalse); sl@0: group.Close(); sl@0: SimulatePointer(TRawEvent::EButton1Up,10,20); sl@0: } sl@0: for(TInt count4=0;count4iGroup->GroupWin(); sl@0: User::LeaveIfError(group->EnableOnEvents(EEventControlOnlyWithKeyboardFocus)); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: SimulatePointer(TRawEvent::EButton3Down,EWinPositionX,EWinPositionY); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: AddExpectedPointer(TPointerEvent::EButton3Down, TPoint(0,0)); sl@0: // sl@0: group->SetOrdinalPosition(-1); sl@0: TheClient->iWs.Finish(); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); // Shouldn't get it as in background this time sl@0: AddExpectedEvent(EEventFocusLost); sl@0: group->SetOrdinalPosition(0); sl@0: TheClient->iWs.Finish(); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: // sl@0: User::LeaveIfError(group->EnableOnEvents(EEventControlOnlyWhenVisible)); sl@0: User::LeaveIfError(group->EnableModifierChangedEvents(EModifierShift, EEventControlOnlyWhenVisible)); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); // Should get this as window still visible sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift); // Should get modifier changed event as window still visible sl@0: AddExpectedModifiersChanged(EModifierShift,EModifierShift); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyLeftShift); sl@0: SimulatePointer(TRawEvent::EButton1Down,EWinPositionX,EWinPositionY); sl@0: SimulatePointer(TRawEvent::EButton1Up,EWinPositionX,EWinPositionY); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(0,0)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(0,0)); sl@0: iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight)); sl@0: TheClient->iWs.Finish(); sl@0: // The following two events shouldn't cause an on or mod changed event as the window is now hidden sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyLeftShift); sl@0: // sl@0: iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY)); sl@0: TheClient->iWs.Finish(); sl@0: } sl@0: break; sl@0: case 11: sl@0: { sl@0: RWindowGroup *group=iQueueClient->iGroup->GroupWin(); sl@0: SendEvent(EEventUser); sl@0: AddExpectedEvent(EEventUser); sl@0: sl@0: if(iTest->IsFullRomL()) sl@0: break; sl@0: // sl@0: // Test focus only messages when with and without focus sl@0: // sl@0: User::LeaveIfError(group->EnableErrorMessages(EEventControlOnlyWithKeyboardFocus)); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: SendEvent(EEventUser); sl@0: AddExpectedEvent(EEventUser); sl@0: group->SetOrdinalPosition(1); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: group->SetOrdinalPosition(0); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: SendEvent(EEventUser+1); sl@0: AddExpectedEvent(EEventUser+1); sl@0: // sl@0: // Test focus only messages when with visible and invisible sl@0: // sl@0: User::LeaveIfError(group->EnableErrorMessages(EEventControlOnlyWhenVisible)); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight)); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: SendEvent(EEventUser+2); sl@0: AddExpectedEvent(EEventUser+2); sl@0: iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY)); sl@0: // sl@0: // Check always mode sends an event sl@0: // sl@0: User::LeaveIfError(group->EnableErrorMessages(EEventControlAlways)); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: // sl@0: iQueueClient->iWin->SetPos(TPoint(-EWinWidth,-EWinHeight)); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: iQueueClient->iWin->SetPos(TPoint(EWinPositionX,EWinPositionY)); sl@0: // sl@0: group->SetOrdinalPosition(1); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: group->SetOrdinalPosition(0); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: // sl@0: // Check timing of OOM messages sl@0: // sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: TriggerOomMessage(TTimeIntervalMinutes(0)); sl@0: User::After(TTimeIntervalMicroSeconds32(1100000)); // 1.1 second sl@0: TriggerOomMessage(TTimeIntervalMinutes(0)); sl@0: SendEvent(EEventUser+3); sl@0: AddExpectedEvent(EEventUser+3); sl@0: TriggerOomMessage(TTimeIntervalMinutes(3)); // Forward by a 2 minutes plus the 1.1 from previous test should trigger an OOM event sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: SendEvent(EEventUser+4); sl@0: AddExpectedEvent(EEventUser+4); sl@0: TriggerOomMessage(TTimeIntervalMinutes(-1)); // Clock going backwards should trigger an event sl@0: AddExpectedErrorMessage(TWsErrorMessage::EDrawingRegion,KErrNoMemory); sl@0: User::After(TTimeIntervalMicroSeconds32(800000)); // 8/10ths of a second sl@0: TriggerOomMessage(TTimeIntervalMinutes(0)); // Shouldn't trigger an event sl@0: SendEvent(EEventUser+5); sl@0: AddExpectedEvent(EEventUser+5); sl@0: } sl@0: break; sl@0: default: sl@0: TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,ETrue); sl@0: TRAPD(err, EventQueueExpansionTestL()); sl@0: if (err!=KErrNone) sl@0: { sl@0: iFailed=ETrue; sl@0: } sl@0: TheClient->iWs.DebugInfo(EWsDebugSetEventQueueTest,EFalse); sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.SetAutoFlush(iTheClientFlush); sl@0: iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); sl@0: } sl@0: sl@0: // Used for testing PDEF112243. sl@0: // Create RWsSession/RWindowGroup/RBlankWindow in a loop. In case of odd loop, sl@0: // close the session which causes the previous window to gain focus. Also go sl@0: // on adding events to the previous session. Along with some change in product sl@0: // code and this test code we get some space/memory before globaleventqueue, sl@0: // which is the problem faced by licensee for this defect. sl@0: void CTEventTest::EventQueueExpansionTestL() sl@0: { sl@0: const TInt numClients = 5; sl@0: TInt cliHanGrpWin = 777; sl@0: TInt cliHanBlkWin = 888; sl@0: TInt pushed=0; sl@0: RWsSession wsSession[numClients]; sl@0: RWindowGroup groupWin[numClients]; sl@0: RBlankWindow blankWin[numClients]; sl@0: sl@0: for (TInt i = 0; i < numClients; i++) sl@0: { sl@0: User::LeaveIfError(wsSession[i].Connect()); sl@0: CleanupClosePushL(wsSession[i]); sl@0: sl@0: groupWin[i] = RWindowGroup(wsSession[i]); sl@0: User::LeaveIfError(groupWin[i].Construct(cliHanGrpWin++)); sl@0: CleanupClosePushL(groupWin[i]); sl@0: groupWin[i].DefaultOwningWindow(); sl@0: sl@0: blankWin[i] = RBlankWindow(wsSession[i]); sl@0: User::LeaveIfError(blankWin[i].Construct(groupWin[i], cliHanBlkWin++)); sl@0: if (i%2 == 0) sl@0: { sl@0: CleanupClosePushL(blankWin[i]); sl@0: pushed++; sl@0: } sl@0: blankWin[i].Activate(); sl@0: sl@0: if (i%2 == 1) sl@0: { sl@0: CleanupStack::Pop(2, &wsSession[i]); sl@0: wsSession[i].Close(); sl@0: sl@0: TRawEvent rawEvent; sl@0: for (TInt count=0; count < 40; count++) sl@0: { sl@0: rawEvent.Set(TRawEvent::EKeyDown,'A'+(i%26)); sl@0: wsSession[i-1].SimulateRawEvent(rawEvent); sl@0: sl@0: rawEvent.Set(TRawEvent::EKeyUp,'A'+(i%26)); sl@0: wsSession[i-1].SimulateRawEvent(rawEvent); sl@0: } sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(pushed*3, &wsSession[0]); sl@0: } sl@0: sl@0: void CTEventTest::doSendEvent(TWsEvent &aEvent) sl@0: { sl@0: iQueueClient->iWs.SendEventToWindowGroup(iQueueClient->WindowGroupIdentifier(),aEvent); sl@0: } sl@0: sl@0: void CTEventTest::SendKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt iRepeats/*=0*/) sl@0: { sl@0: TWsEvent event; sl@0: if (aEventCode==EEventKey && aCode==0) sl@0: aCode=aScanCode; sl@0: event.SetType(aEventCode); sl@0: event.Key()->iCode=aCode; sl@0: event.Key()->iScanCode=aScanCode; sl@0: event.Key()->iModifiers=0; sl@0: event.Key()->iRepeats=iRepeats; sl@0: doSendEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::SendEvent(TInt aEventCode) sl@0: { sl@0: TWsQTEvent event; sl@0: event.SetType(aEventCode); sl@0: doSendEvent(event); sl@0: } sl@0: sl@0: void CTEventTest::SimulateAndCheck(TPoint aOrigin,TSize aScale,TInt aXOffset,TInt aYOffset,TPointerEvent::TType aEventType,TRect aPointerCursorArea) sl@0: { sl@0: TPoint ptCheck=PhysicalToLogical(TPoint(aOrigin.iX+aXOffset,aOrigin.iY+aYOffset)-aOrigin,aScale); sl@0: if (ptCheck.iX < aPointerCursorArea.iTl.iX) sl@0: { sl@0: ptCheck.iX=aPointerCursorArea.iTl.iX; sl@0: } sl@0: else if (ptCheck.iX > aPointerCursorArea.iBr.iX) sl@0: { sl@0: ptCheck.iX=aPointerCursorArea.iBr.iX; sl@0: } sl@0: if (ptCheck.iY < aPointerCursorArea.iTl.iY) sl@0: { sl@0: ptCheck.iY=aPointerCursorArea.iTl.iY; sl@0: } sl@0: else if (ptCheck.iY > aPointerCursorArea.iBr.iY) sl@0: { sl@0: ptCheck.iY=aPointerCursorArea.iBr.iY; sl@0: } sl@0: AddExpectedPointer(aEventType,TPoint(ptCheck.iX-EWinPositionX,ptCheck.iY-EWinPositionY)); sl@0: } sl@0: sl@0: void CTEventTest::CheckPointerCursorInDifferentScreenMode(TSizeMode aMode,TPoint aOrigin) sl@0: { sl@0: aMode.iOrigin=aOrigin; sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(aMode); sl@0: iQueueClient->iScreen->SetAppScreenMode(iCurrentMode); //This makes the App pick up the new mode parameters sl@0: TheClient->iScreen->SetAppScreenMode(iCurrentMode); //Ditto sl@0: iQueueClient->iScreen->SetScreenMode(iCurrentMode); //This causes all the windows to be updated sl@0: sl@0: //.. Tests the general pointer cursor area setting and getting sl@0: RWsSession& ws=iQueueClient->iWs; sl@0: TRect rect=ws.PointerCursorArea(iCurrentMode); //ws.PointerCursorArea() by default gets first screen mode's pointer cursor area so use other overloaded function sl@0: TPoint origin=iQueueClient->iScreen->GetScreenModeOrigin(iCurrentMode); sl@0: TSize scale=iQueueClient->iScreen->GetScreenModeScale(iCurrentMode); sl@0: TSize fullScreenModeSize=iQueueClient->iScreen->SizeInPixels(); sl@0: TRect rect1(PhysicalToLogical(TPoint(),scale),PhysicalToLogical(fullScreenModeSize.AsPoint()-origin,scale)); sl@0: TRect rect2=rect1; sl@0: rect2.Shrink(20,20); sl@0: ws.SetPointerCursorArea(iCurrentMode,rect1); sl@0: TEST(ws.PointerCursorArea(iCurrentMode)==rect1); sl@0: ws.SetPointerCursorArea(iCurrentMode,rect2); sl@0: TEST(ws.PointerCursorArea(iCurrentMode)==rect2); sl@0: ws.SetPointerCursorArea(iCurrentMode,rect); sl@0: TEST(ws.PointerCursorArea(iCurrentMode)==rect); sl@0: sl@0: //.. Test events are restricted to correct pointer cursor area sl@0: TRect rectPointerCursorArea(10,10,51,51); sl@0: iQueueClient->iWs.SetPointerCursorArea(iCurrentMode,rectPointerCursorArea); sl@0: TPoint screenModeOrigin=iQueueClient->iScreen->GetDefaultScreenModeOrigin(); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+5,screenModeOrigin.iY+5); sl@0: SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+25,screenModeOrigin.iY+25); sl@0: SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+50,screenModeOrigin.iY+50); sl@0: SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+75,screenModeOrigin.iY+75); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+10,screenModeOrigin.iY+15); sl@0: SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+20,screenModeOrigin.iY+5); sl@0: SimulatePointer(TRawEvent::EButton1Down,screenModeOrigin.iX+35,screenModeOrigin.iY+40); sl@0: SimulatePointer(TRawEvent::EButton1Up,screenModeOrigin.iX+45,screenModeOrigin.iY+70); sl@0: sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,5,5,TPointerEvent::EButton1Down,rectPointerCursorArea); sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,25,25,TPointerEvent::EButton1Up,rectPointerCursorArea); sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,50,50,TPointerEvent::EButton1Down,rectPointerCursorArea); sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,75,75,TPointerEvent::EButton1Up,rectPointerCursorArea); sl@0: sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,10,15,TPointerEvent::EButton1Down,rectPointerCursorArea); sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,20,5,TPointerEvent::EButton1Up,rectPointerCursorArea); sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,35,40,TPointerEvent::EButton1Down,rectPointerCursorArea); sl@0: SimulateAndCheck(screenModeOrigin,aMode.iScreenScale,45,70,TPointerEvent::EButton1Up,rectPointerCursorArea); sl@0: } sl@0: sl@0: void CTEventTest::SendEventTest_NextSetOfEvents() sl@0: { sl@0: TTimeIntervalMicroSeconds32 initialTime,time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: SendKey(EEventKeyDown,1); sl@0: SendKey(EEventKeyDown,2); sl@0: SendEvent(EEventUser); sl@0: SendKey(EEventKeyUp,1); sl@0: SendKey(EEventKeyUp,2); sl@0: SendEvent(EEventUser+1); sl@0: SendEvent(EEventUser+2); sl@0: // sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKey(EEventKeyDown,1); sl@0: AddExpectedKey(EEventKeyDown,2); sl@0: AddExpectedEvent(EEventUser); sl@0: AddExpectedKey(EEventKeyUp,1); sl@0: AddExpectedKey(EEventKeyUp,2); sl@0: AddExpectedEvent(EEventUser+1); sl@0: AddExpectedEvent(EEventUser+2); sl@0: break; sl@0: case 1: sl@0: #if defined(SCREEN_MODE_TESTING) sl@0: if (iNumScrModes>1) sl@0: { sl@0: iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents(); sl@0: sl@0: if (SetClickType(EClickCheck)) sl@0: return; sl@0: iAddToClick=ETrue; sl@0: sl@0: iQueueClient->iScreen->SetScreenMode(1); sl@0: sl@0: iAddToClick=EFalse; sl@0: SetClickType(EClickNone); sl@0: sl@0: AddExpectedEvent(EEventScreenDeviceChanged); sl@0: SendEvent(EEventUser); sl@0: AddExpectedEvent(EEventUser); sl@0: iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents(); sl@0: if (iQueueClient->iScreen->ScreenModeEnforcement()==ESizeEnforcementPixelsAndRotation) sl@0: AddExpectedEvent(EEventFocusLost); sl@0: } sl@0: #endif sl@0: SendEvent(EEventUser+1); sl@0: AddExpectedEvent(EEventUser+1); sl@0: break; sl@0: case 2: sl@0: #if defined(SCREEN_MODE_TESTING) sl@0: if (iNumScrModes>1) sl@0: { sl@0: iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents(); sl@0: sl@0: if (SetClickType(EClickCheck)) sl@0: return; sl@0: iAddToClick=ETrue; sl@0: sl@0: iQueueClient->iScreen->SetScreenMode(0); sl@0: iQueueClient->iScreen->SetScreenMode(1); sl@0: iQueueClient->iScreen->SetScreenMode(0); sl@0: sl@0: iAddToClick=EFalse; sl@0: SetClickType(EClickNone); sl@0: sl@0: AddExpectedEvent(EEventScreenDeviceChanged); // Only one event should get queued sl@0: if (iQueueClient->iScreen->ScreenModeEnforcement()==ESizeEnforcementPixelsAndRotation) sl@0: AddExpectedEvent(EEventFocusGained); sl@0: SendEvent(EEventUser+2); sl@0: AddExpectedEvent(EEventUser+2); sl@0: iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents(); sl@0: } sl@0: #endif sl@0: SendEvent(EEventUser+3); sl@0: AddExpectedEvent(EEventUser+3); sl@0: break; sl@0: case 3: sl@0: #if defined(SCREEN_MODE_TESTING) sl@0: if (iNumScrModes>1) sl@0: { sl@0: iQueueClient->iGroup->GroupWin()->EnableScreenChangeEvents(); sl@0: iQueueClient->iGroup->GroupWin()->DisableScreenChangeEvents(); sl@0: sl@0: if (SetClickType(EClickCheck)) sl@0: return; sl@0: iAddToClick=ETrue; sl@0: sl@0: iQueueClient->iScreen->SetScreenMode(0); sl@0: sl@0: iAddToClick=EFalse; sl@0: SetClickType(EClickNone); sl@0: sl@0: SendEvent(EEventUser+1); sl@0: AddExpectedEvent(EEventUser+1); sl@0: } sl@0: #endif sl@0: SendEvent(EEventUser+4); sl@0: AddExpectedEvent(EEventUser+4); sl@0: break; sl@0: case 4: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int()+time.Int()/3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' ',1); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: break; sl@0: case 5: //To test sending a key event with iRepeats!=0 sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int()+time.Int()/3); sl@0: SendKey(EEventKey,EStdKeyHome,EKeyHome,0); sl@0: User::After(initialTime.Int()+time.Int()/3); sl@0: SendKey(EEventKey,EStdKeyEnd,EKeyEnd,12345); sl@0: User::After(initialTime.Int()+time.Int()/3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' ',1); sl@0: AddExpectedKey(EEventKey,EStdKeyHome,EKeyHome); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' ',1); sl@0: AddExpectedKey(EEventKey,EStdKeyEnd,EKeyEnd,1); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::InvisibleWindow_NextSetOfEvents() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: SimulatePointer(TRawEvent::EButton1Down,45,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,45,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,20,10); sl@0: SimulatePointer(TRawEvent::EButton1Up,20,10); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iChildWin->BaseWin()->SetVisible(EFalse); sl@0: iQueueClient->iChildWin->BaseWin()->SetVisible(ETrue); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,46,31); sl@0: SimulatePointer(TRawEvent::EButton1Up,46,31); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: break; sl@0: case 1: sl@0: SimulatePointer(TRawEvent::EButton1Down,21,11); sl@0: SimulatePointer(TRawEvent::EButton1Up,21,11); sl@0: SimulatePointer(TRawEvent::EButton1Down,44,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,44,30); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->SetVisible(EFalse); sl@0: iQueueClient->iWin->BaseWin()->SetVisible(ETrue); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,19,12); sl@0: SimulatePointer(TRawEvent::EButton1Up,19,12); sl@0: SimulatePointer(TRawEvent::EButton1Down,47,32); sl@0: SimulatePointer(TRawEvent::EButton1Up,47,32); sl@0: /*AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(44-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(44-EWinPositionX,30-EWinPositionY));*/ sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(19-EWinPositionX,12-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(19-EWinPositionX,12-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(47-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY)); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: #define TOP16A 0xAAAA0000 sl@0: #define TOP16B 0x55550000 sl@0: void CTEventTest::JavaAdditions_NextSetOfEvents() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: SimulatePointer(TRawEvent::EButton1Down,45,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,45,30); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove); sl@0: iQueueClient->iWs.Flush(); sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: SimulateButton1DownWithSimulatedMove(46,31); sl@0: #else sl@0: SimulatePointer(TRawEvent::EButton1Down,46,31); sl@0: #endif sl@0: SimulatePointer(TRawEvent::EButton1Up,46,31); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,0); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,20,10); sl@0: SimulatePointer(TRawEvent::EButton1Up,20,10); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove); sl@0: iQueueClient->iWs.Flush(); sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: SimulateButton1DownWithSimulatedMove(21,11); sl@0: #else sl@0: SimulatePointer(TRawEvent::EButton1Down,21,11); sl@0: #endif sl@0: SimulatePointer(TRawEvent::EButton1Up,21,11); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerMoveEvents); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,22,12); sl@0: SimulatePointer(TRawEvent::EButton1Up,22,12); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerGenerateSimulatedMove); sl@0: iQueueClient->iWs.Flush(); sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: SimulateButton1DownWithSimulatedMove(23,13); sl@0: #else sl@0: SimulatePointer(TRawEvent::EButton1Down,23,13); sl@0: #endif sl@0: SimulatePointer(TRawEvent::EButton1Up,23,13); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents,EPointerFilterMove); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,24,14); sl@0: SimulatePointer(TRawEvent::EButton1Up,24,14); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(45-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(45-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(21-EWinPositionX,11-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(21-EWinPositionX,11-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(21-EWinPositionX,11-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(22-EWinPositionX,12-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(22-EWinPositionX,12-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(23-EWinPositionX,13-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(23-EWinPositionX,13-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(23-EWinPositionX,13-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,14-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,14-EWinPositionY)); sl@0: break; sl@0: #if defined(__WINS__) sl@0: case 1: sl@0: { sl@0: RWindowGroup *group=iQueueClient->iGroup->GroupWin(); sl@0: group->SetOrdinalPosition(0); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'2'|TOP16A); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'2'); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWs.SetRemoveKeyCode(EFalse); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'3'|TOP16B); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'3'); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWs.SetRemoveKeyCode(ETrue); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'4'|TOP16B); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'4'); sl@0: AddExpectedKey(EEventKeyDown,'2'); sl@0: AddExpectedKey(EEventKey,'2',TOP16A>>16); sl@0: AddExpectedKey(EEventKeyUp,'2'); sl@0: AddExpectedKey(EEventKeyDown,'3'|TOP16B); sl@0: AddExpectedKey(EEventKey,'3',TOP16B>>16); sl@0: AddExpectedKey(EEventKeyUp,'3'); sl@0: AddExpectedKey(EEventKeyDown,'4'); sl@0: AddExpectedKey(EEventKey,'4',TOP16B>>16); sl@0: AddExpectedKey(EEventKeyUp,'4'); sl@0: break; sl@0: } sl@0: #endif sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::WinCap_NextSetOfEvents() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: //iQueueClient->SetChildCapture(RWindowBase::TCaptureEnabled); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,27); sl@0: SimulatePointer(TRawEvent::EButton1Up,25,12); sl@0: sl@0: sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(35-EWinPositionX,27-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,12-EWinPositionY)); sl@0: break; sl@0: sl@0: sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::XyInputType_NextSetOfEvents() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerMoveEvents|EPointerFilterDrag,EPointerGenerateSimulatedMove); sl@0: iQueueClient->iWs.Flush(); sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: SimulateButton1DownWithSimulatedMove(46,31); sl@0: #else sl@0: SimulatePointer(TRawEvent::EButton1Down,46,31); sl@0: #endif sl@0: SimulatePointer(TRawEvent::EButton1Up,46,31); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: break; //Must do something sl@0: case 1: sl@0: { sl@0: // check if RWindowGroup::SimulatePointerEvent is working (DEF131563) sl@0: RWindowGroup& group = *iQueueClient->iGroup->GroupWin(); sl@0: TRawEvent event; sl@0: event.Set(TRawEvent::EButton1Down, 10, 10); sl@0: group.SimulatePointerEvent(event); sl@0: event.Set(TRawEvent::EButton1Up, 10, 10); sl@0: group.SimulatePointerEvent(event); sl@0: if(!iIs3DPointer) sl@0: { sl@0: // simulated move will be generated sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(10 - EWinPositionX, 10 - EWinPositionY)); sl@0: } sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10 - EWinPositionX, 10 - EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10 - EWinPositionX, 10 - EWinPositionY)); sl@0: } sl@0: break; sl@0: #if defined(__WINS__) sl@0: case 2: sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: SimulateButton1DownWithSimulatedMove(45,32); sl@0: #else sl@0: SimulatePointer(TRawEvent::EButton1Down,45,32); sl@0: #endif sl@0: SimulatePointer(TRawEvent::EButton1Up,45,32); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputNone); sl@0: SimulatePointer(TRawEvent::EButton1Down,44,32); sl@0: SimulatePointer(TRawEvent::EPointerMove,43,32); sl@0: SimulatePointer(TRawEvent::EButton1Up,43,31); sl@0: SimulatePointer(TRawEvent::EButton2Down,44,33); sl@0: SimulatePointer(TRawEvent::EButton2Up,44,33); sl@0: SimulatePointer(TRawEvent::EButton3Down,43,32); sl@0: SimulatePointer(TRawEvent::EButton3Up,43,32); sl@0: SimulatePointer(TRawEvent::EPointerSwitchOn,48,32); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: #if !defined(TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA) sl@0: SimulateButton1DownWithSimulatedMove(47,32); sl@0: #else sl@0: SimulatePointer(TRawEvent::EButton1Down,47,32); sl@0: #endif sl@0: SimulatePointer(TRawEvent::EButton1Up,47,32); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(45-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(45-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(45-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(47-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(47-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY)); sl@0: break; sl@0: case 3: sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerGenerateSimulatedMove,0); sl@0: iQueueClient->iWs.Flush(); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: SimulatePointer(TRawEvent::EButton1Down,49,32); sl@0: SimulatePointer(TRawEvent::EPointerMove,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,51,32); sl@0: SimulatePointer(TRawEvent::EPointerMove,52,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,52,30); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(49-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(50-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(51-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(52-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(52-EWinPositionX,30-EWinPositionY)); sl@0: break; sl@0: case 4: sl@0: SimulatePointer(TRawEvent::EButton1Down,49,31); sl@0: SimulatePointer(TRawEvent::EButton1Up,49,31); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputMouse); sl@0: SimulatePointer(TRawEvent::EPointerMove,50,31); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,31); sl@0: SimulatePointer(TRawEvent::EPointerMove,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EPointerMove,51,31); sl@0: SimulatePointer(TRawEvent::EButton1Down,51,31); sl@0: SimulatePointer(TRawEvent::EPointerMove,51,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,51,30); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: SimulatePointer(TRawEvent::EButton1Down,52,31); sl@0: SimulatePointer(TRawEvent::EButton1Up,52,31); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(49-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(49-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(50-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(50-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(51-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(51-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(51-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(51-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(52-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(52-EWinPositionX,31-EWinPositionY)); sl@0: break; sl@0: case 5: sl@0: SimulatePointer(TRawEvent::EButton1Down,69,31); sl@0: SimulatePointer(TRawEvent::EButton1Up,69,31); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); sl@0: SimulatePointer(TRawEvent::EPointerMove,-5,-5); sl@0: SimulatePointer(TRawEvent::EButton1Down,7,8); sl@0: SimulatePointer(TRawEvent::EPointerMove,10,-3); sl@0: SimulatePointer(TRawEvent::EButton1Up,-7,-8); sl@0: SimulatePointer(TRawEvent::EPointerMove,-4,9); sl@0: SimulatePointer(TRawEvent::EButton1Down,123,456); sl@0: SimulatePointer(TRawEvent::EPointerMove,15,13); sl@0: SimulatePointer(TRawEvent::EButton1Up,-2345,-6789); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: SimulatePointer(TRawEvent::EButton1Down,62,31); sl@0: SimulatePointer(TRawEvent::EButton1Up,62,31); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(69-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(69-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(64-EWinPositionX,26-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(64-EWinPositionX,26-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(74-EWinPositionX,23-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(74-EWinPositionX,23-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(70-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(70-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(85-EWinPositionX,45-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(85-EWinPositionX,45-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(62-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(62-EWinPositionX,31-EWinPositionY)); sl@0: break; sl@0: #endif sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::MovingPointerCursor_NextSetOfEventsL() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); sl@0: iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); sl@0: iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse); sl@0: iQueueClient->iWs.Flush(); sl@0: //AddExpectedEvent(EEventFocusGained); sl@0: break; sl@0: #if defined(__WINS__) sl@0: case 1: sl@0: TheClient->iWs.SimulateXyInputType(EXYInputMouse); sl@0: iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); sl@0: iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EPointerMove,46,31); sl@0: SimulatePointer(TRawEvent::EButton1Down,46,31); sl@0: SimulatePointer(TRawEvent::EPointerMove,47,32); sl@0: SimulatePointer(TRawEvent::EButton1Up,47,32); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(46-EWinPositionX,31-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(47-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(47-EWinPositionX,32-EWinPositionY)); sl@0: break; sl@0: case 2: sl@0: TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(62,24)); sl@0: SimulatePointer(TRawEvent::EPointerMove,-5,-5); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(60,20)); sl@0: SimulatePointer(TRawEvent::EPointerMove,6,7); sl@0: SimulatePointer(TRawEvent::EButton1Down,27,38); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(55,25)); sl@0: SimulatePointer(TRawEvent::EPointerMove,4,-13); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(58,20)); sl@0: SimulatePointer(TRawEvent::EButton1Up,45,-678); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,0); sl@0: iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,0); sl@0: iQueueClient->iWs.Flush(); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(80,45)); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(57-EWinPositionX,19-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(66-EWinPositionX,27-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(66-EWinPositionX,27-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(66-EWinPositionX,27-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(59-EWinPositionX,12-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(58-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedEnterExit(EEventPointerEnter, TPoint(58-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedEnterExit(EEventPointerExit, TPoint(58-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedEnterExit(EEventPointerEnter, TPoint(80-EWinPositionX,45-EWinPositionY)); sl@0: break; sl@0: case 3: sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,EPointerFilterEnterExit); sl@0: iQueueClient->iChildWin->BaseWin()->PointerFilter(EPointerFilterEnterExit,EPointerFilterEnterExit); sl@0: iQueueClient->iWs.Flush(); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,0,70,240)); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(65,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,20,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(75,32)); sl@0: SimulatePointer(TRawEvent::EPointerMove,-1,20); sl@0: SimulatePointer(TRawEvent::EButton1Down,29,37); sl@0: SimulatePointer(TRawEvent::EPointerMove,25,-13); sl@0: SimulatePointer(TRawEvent::EButton1Up,47,-648); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(69-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(68-EWinPositionX,52-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(68-EWinPositionX,52-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(69-EWinPositionX,39-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(69-EWinPositionX,39-EWinPositionY)); sl@0: break; sl@0: case 4: sl@0: TheClient->iWs.SetPointerCursorArea(TRect(EWinPositionX+2,EWinPositionY+2,EWinPositionX+99,EWinPositionY+49)); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,-34); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: SimulatePointer(TRawEvent::EPointerMove,-77,-35); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: SimulatePointer(TRawEvent::EPointerMove,-78,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: SimulatePointer(TRawEvent::EPointerMove,-79,36); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,37); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: SimulatePointer(TRawEvent::EPointerMove,80,38); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: SimulatePointer(TRawEvent::EPointerMove,81,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,0); sl@0: SimulatePointer(TRawEvent::EPointerMove,82,-39); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(2,2)); sl@0: SimulatePointer(TRawEvent::EPointerMove,30,30); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(1,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,1,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(2,88)); sl@0: SimulatePointer(TRawEvent::EPointerMove,30,-30); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,88)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,-1); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(123,88)); sl@0: SimulatePointer(TRawEvent::EPointerMove,-30,-30); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(123,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,-1,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(123,2)); sl@0: SimulatePointer(TRawEvent::EPointerMove,-30,30); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(56,1)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,1); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,2)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(2,2)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(2,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(2,48)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,48)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(98,48)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(98,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(98,2)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(32,32)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(3,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(32,18)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,47)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(68,18)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(97,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(68,32)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,3)); sl@0: break; sl@0: case 5: sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,0,EWinPositionX+100,EWinPositionY+50)); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,35,EWinPositionX+100,EWinPositionY+50)); sl@0: SimulatePointer(TRawEvent::EPointerMove,1,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(10,55)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(15,0,EWinPositionX+100,50)); sl@0: SimulatePointer(TRawEvent::EPointerMove,1,1); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,0,50,EWinPositionY+50)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,1); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(10,10)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(15,15,EWinPositionX+100,EWinPositionY+50)); sl@0: SimulatePointer(TRawEvent::EPointerMove,1,-1); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,0,EWinPositionX+100,30)); sl@0: SimulatePointer(TRawEvent::EPointerMove,-1,0); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(100,10)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,15,95,EWinPositionY+50)); sl@0: SimulatePointer(TRawEvent::EPointerMove,-1,-1); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(57,31)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(60,0,EWinPositionX+100,EWinPositionY+50)); sl@0: SimulatePointer(TRawEvent::EPointerMove,0,-1); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(100,55)); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,0,95,50)); sl@0: SimulatePointer(TRawEvent::EPointerMove,1,-1); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(58-EWinPositionX,35-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(16-EWinPositionX,49-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(49-EWinPositionX,32-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(16-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(56-EWinPositionX,29-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(93-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(60-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(94-EWinPositionX,48-EWinPositionY)); sl@0: break; sl@0: #endif sl@0: default: sl@0: TheClient->iWs.SetPointerCursorArea(TRect(0,0,95,50)); sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::RotatedMode_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"RotatedMode SetOfEvents: %d Max=4"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); sl@0: iQueueClient->iWs.Flush(); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(10,10,51,51)); sl@0: SimulatePointer(TRawEvent::EButton1Down,5,5); sl@0: SimulatePointer(TRawEvent::EButton1Up,25,5); sl@0: SimulatePointer(TRawEvent::EButton1Down,55,5); sl@0: SimulatePointer(TRawEvent::EButton1Up,55,35); sl@0: SimulatePointer(TRawEvent::EButton1Down,55,55); sl@0: SimulatePointer(TRawEvent::EButton1Up,25,55); sl@0: SimulatePointer(TRawEvent::EButton1Down,5,55); sl@0: SimulatePointer(TRawEvent::EButton1Up,5,35); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(25-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(50-EWinPositionX,35-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,50-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(25-EWinPositionX,50-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,50-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,35-EWinPositionY)); sl@0: } sl@0: break; sl@0: case 1: sl@0: { sl@0: TInt enforc=TheClient->iScreen->ScreenModeEnforcement(); sl@0: iBlankWin->SetVisible(ETrue); sl@0: #if defined(LOGGING) sl@0: _LIT(KSet1,"AUTO Rotating Events :1st "); sl@0: INFO_PRINTF1(KSet1); sl@0: #endif sl@0: INFO_PRINTF1(_L(" Set of Events")); sl@0: if (iScreenModeTests&EDoRot90) sl@0: { sl@0: TheClient->iScreen->SetScreenMode(1); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: INFO_PRINTF1(_L(" Screen mode 1.")); sl@0: TPoint screenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin(); sl@0: #if defined(__WINS__) sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: #else sl@0: // simulate pointer at (20,20) on rotated screen by providing physical coordinates sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: #endif sl@0: INFO_PRINTF1(_L(" Sent Up and Down 90")); sl@0: } sl@0: if (iScreenModeTests&EDoRot180) sl@0: { sl@0: TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: INFO_PRINTF1(_L(" Screen mode 0")); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: INFO_PRINTF1(_L(" Upside Down")); sl@0: #if defined(__WINS__) sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,22,22); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,22,22); sl@0: #else sl@0: // simulate pointer at (22,22) on rotated screen by providing physical coordinates sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); sl@0: #endif sl@0: INFO_PRINTF1(_L(" Sent Up and Down 180")); sl@0: } sl@0: TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: INFO_PRINTF1(_L(" Normal Screen mode")); sl@0: if (iScreenModeTests&EDoRot0) sl@0: { sl@0: SimulatePointer(TRawEvent::EButton1Down,24,24); sl@0: SimulatePointer(TRawEvent::EButton1Up,24,24); sl@0: } sl@0: if (iScreenModeTests&EDoRot90) sl@0: { sl@0: if (enforc>ESizeEnforcementNone) sl@0: { sl@0: AddExpectedEvent(EEventFocusLost); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: } sl@0: else sl@0: { sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,20-EWinPositionY-iYOffset)); sl@0: } sl@0: } sl@0: if (iScreenModeTests&EDoRot180) sl@0: { sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(22-EWinPositionX,22-EWinPositionY-iYOffset)); sl@0: } sl@0: if (iScreenModeTests&EDoRot0) sl@0: { sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,24-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,24-EWinPositionY)); sl@0: } sl@0: INFO_PRINTF1(_L(" Added Expected")); sl@0: User::After(EPointerCursorUpdateGap); sl@0: iBlankWin->SetVisible(EFalse); sl@0: } sl@0: break; sl@0: #if defined(__WINS__) sl@0: case 2: sl@0: { sl@0: TInt enforc=TheClient->iScreen->ScreenModeEnforcement(); sl@0: //INFO_PRINTF1("AUTO Rotating Events "); sl@0: //INFO_PRINTF1(" :2nd Set of Events"); sl@0: TheClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(24+EWinPositionX,24+EWinPositionY)); sl@0: if (iScreenModeTests&EDoRot90) sl@0: { sl@0: TheClient->iScreen->SetScreenMode(1); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: SimulatePointer(TRawEvent::EPointerMove,1,2); sl@0: SimulatePointer(TRawEvent::EButton1Down,56,89); sl@0: SimulatePointer(TRawEvent::EPointerMove,2,-1); sl@0: SimulatePointer(TRawEvent::EButton1Up,234,456); sl@0: } sl@0: else sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(27+EWinPositionX,25+EWinPositionY)); sl@0: if (iScreenModeTests&EDoRot180) sl@0: { sl@0: TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: SimulatePointer(TRawEvent::EPointerMove,-3,4); sl@0: SimulatePointer(TRawEvent::EButton1Down,156,289); sl@0: SimulatePointer(TRawEvent::EPointerMove,-4,-3); sl@0: SimulatePointer(TRawEvent::EButton1Up,2234,3456); sl@0: } sl@0: else sl@0: TheClient->iWs.SetPointerCursorPosition(TPoint(20+EWinPositionX,26+EWinPositionY)); sl@0: TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: if (iScreenModeTests&EDoRot0) sl@0: { sl@0: SimulatePointer(TRawEvent::EButton1Down,24,24); sl@0: SimulatePointer(TRawEvent::EButton1Up,24,24); sl@0: } sl@0: TheClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: TheClient->iWs.Flush(); sl@0: if (iScreenModeTests&EDoRot90) sl@0: { sl@0: if (enforc>ESizeEnforcementNone) sl@0: { sl@0: AddExpectedEvent(EEventFocusLost); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: } sl@0: else sl@0: { sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(25,26)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25,26)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(27,25)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(27,25)); sl@0: } sl@0: } sl@0: if (iScreenModeTests&EDoRot180) sl@0: { sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(24,29)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24,29)); sl@0: AddExpectedPointer(TPointerEvent::EDrag, TPoint(20,26)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20,26)); sl@0: } sl@0: if (iScreenModeTests&EDoRot0) sl@0: { sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20,26)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20,26)); sl@0: } sl@0: } sl@0: break; sl@0: case 3: sl@0: { sl@0: #if defined(LOGGING) sl@0: _LIT(KSet2,"AUTO Rotating Events "); sl@0: INFO_PRINTF1(KSet2); sl@0: #endif sl@0: INFO_PRINTF1(_L(" :3rd Set of Events")); sl@0: if (iScreenModeTests&EDoScale) sl@0: { sl@0: INFO_PRINTF1(_L(" :Screen Scalling Supported")); sl@0: iBlankWin->SetVisible(ETrue); sl@0: iCurrentMode=iNumScrModes; sl@0: --iCurrentMode; sl@0: iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); sl@0: iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); sl@0: iQueueClient->iScreen->SetScreenMode(iCurrentMode); sl@0: TheClient->iScreen->SetAppScreenMode(iCurrentMode); sl@0: iQueueClient->iScreen->SetAppScreenMode(iCurrentMode); sl@0: iSizeMode=iQueueClient->iScreen->GetCurrentScreenModeAttributes(); sl@0: TSizeMode testMode=iSizeMode; sl@0: for (TInt xScale=2;xScale<4;xScale++) sl@0: { sl@0: INFO_PRINTF1(_L(" :New X-Scale Value")); sl@0: for (TInt yScale=2;yScale<4;yScale++) sl@0: { sl@0: INFO_PRINTF1(_L(" :New Y-Scale Value")); sl@0: testMode.iScreenScale.SetSize(xScale,yScale); sl@0: CheckPointerCursorInDifferentScreenMode(testMode,TPoint(20,30)); sl@0: } sl@0: } sl@0: User::After(EPointerCursorUpdateGap); sl@0: iBlankWin->SetVisible(EFalse); sl@0: break; sl@0: } sl@0: } sl@0: case 4: sl@0: { sl@0: if (iScreenModeTests&EDoScale) sl@0: { sl@0: TSizeMode testMode=iSizeMode; sl@0: iBlankWin->SetVisible(ETrue); sl@0: for (TInt xScale=2;xScale<4;xScale++) sl@0: { sl@0: for (TInt yScale=2;yScale<4;yScale++) sl@0: { sl@0: testMode.iScreenScale.SetSize(xScale,yScale); sl@0: CheckPointerCursorInDifferentScreenMode(testMode,TPoint(30,20)); sl@0: } sl@0: } sl@0: User::After(EPointerCursorUpdateGap); sl@0: iBlankWin->SetVisible(EFalse); sl@0: break; sl@0: } sl@0: } sl@0: #endif sl@0: default: sl@0: #if defined(__WINS__) sl@0: if (iScreenModeTests&EDoScale) sl@0: { sl@0: iQueueClient->iScreen->SetScreenMode(iCurrentMode); sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); sl@0: iQueueClient->iScreen->SetAppScreenMode(0); sl@0: TheClient->iScreen->SetAppScreenMode(0); sl@0: iQueueClient->iScreen->SetScreenMode(0); sl@0: iBlankWin->SetVisible(EFalse); sl@0: TheClient->iWs.SetAutoFlush(iTheClientFlush); sl@0: iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); sl@0: } sl@0: #endif sl@0: User::After(500000); //0.5secs, to allow other screen devices to respond to the flip events sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: sl@0: void CTEventTest::ScreenScaling_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"ScreenScaling SetOfEvents: %d (Last=3)"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: if(! (iScreenModeTests & EDoScale)) sl@0: { sl@0: User::After(500000); sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); sl@0: iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); sl@0: iBlankWin->SetVisible(ETrue); sl@0: sl@0: TInt mode = TheClient->iScreen->CurrentScreenMode(); sl@0: sl@0: iSizeMode = iQueueClient->iScreen->GetCurrentScreenModeAttributes(); sl@0: sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); sl@0: sl@0: TSizeMode szMode2 = iSizeMode; sl@0: sl@0: szMode2.iScreenScale.SetSize(2,2); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: TPoint theScreenOrigin(iQueueClient->iScreen->GetScreenModeOrigin(mode)); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(10-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,10-EWinPositionY)); sl@0: sl@0: break; sl@0: } sl@0: case 1: sl@0: { sl@0: TSizeMode szMode2 = iSizeMode; sl@0: TInt mode = TheClient->iScreen->CurrentScreenMode(); sl@0: sl@0: szMode2.iScreenScale.SetSize(2,2); sl@0: szMode2.iOrigin.SetXY(20,20); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 30+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 40+theScreenOrigin.iX, 60+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(15-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(13-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(13-EWinPositionX,10-EWinPositionY)); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 30+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 40+theScreenOrigin.iX, 50+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(30-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(40-EWinPositionX,50-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); sl@0: break; sl@0: } sl@0: case 2: sl@0: { sl@0: TInt mode = TheClient->iScreen->CurrentScreenMode(); sl@0: TRect theRect = TheClient->iWs.PointerCursorArea(); sl@0: sl@0: TSizeMode szMode2 = iSizeMode; sl@0: sl@0: //----------- scaling 2X2 sl@0: szMode2.iScreenScale.SetSize(2,2); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: sl@0: TPoint theScreenOrigin(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 50+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: //------------------------ scaling 1X2 sl@0: szMode2.iScreenScale.SetSize(1,2); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 50+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(50-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,10-EWinPositionY)); sl@0: //------------------------ scaling 2X1 sl@0: szMode2.iScreenScale.SetSize(2,1); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 20+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 50+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); sl@0: //------------------------ scaling 3X1 sl@0: sl@0: szMode2.iScreenScale.SetSize(3,1); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 21+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 75+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,20-EWinPositionY)); sl@0: //------------------------ scaling 3X2 sl@0: sl@0: szMode2.iScreenScale.SetSize(3,2); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 21+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 75+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: //------------------------ scaling 3X3 sl@0: szMode2.iScreenScale.SetSize(3,3); sl@0: sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(szMode2); sl@0: iQueueClient->iWs.SetPointerCursorArea(mode, TRect(24,10,52,52)); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: sl@0: theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 21+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 75+theScreenOrigin.iX, 33+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 30+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(25-EWinPositionX,11-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(24-EWinPositionX,10-EWinPositionY)); sl@0: //------------------------ sl@0: iQueueClient->iWs.SetPointerCursorArea(mode, theRect); sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); sl@0: TheClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetAppScreenMode(mode); sl@0: iQueueClient->iScreen->SetScreenMode(mode); sl@0: break; sl@0: } sl@0: case 3: sl@0: { sl@0: iQueueClient->iWs.SetAutoFlush(ETrue); sl@0: TInt theCurMode = iQueueClient->iScreen->CurrentScreenMode(); sl@0: TPoint theScreenOrigin; sl@0: if (iNumScrModes>2) sl@0: { sl@0: TheClient->iScreen->SetAppScreenMode(2); sl@0: iQueueClient->iScreen->SetAppScreenMode(2); sl@0: TheClient->iScreen->SetScreenMode(2); sl@0: sl@0: theScreenOrigin=iQueueClient->iScreen->GetDefaultScreenModeOrigin(); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 30+theScreenOrigin.iX,30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX,20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 40+theScreenOrigin.iX,60+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX,20+theScreenOrigin.iY); sl@0: sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, sl@0: TPoint(15-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, sl@0: TPoint(13-EWinPositionX,10-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, sl@0: TPoint(20-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, sl@0: TPoint(13-EWinPositionX,10-EWinPositionY)); sl@0: } sl@0: sl@0: TheClient->iScreen->SetAppScreenMode(0); sl@0: iQueueClient->iScreen->SetAppScreenMode(0); sl@0: iQueueClient->iScreen->SetScreenMode(0); sl@0: iTest->DelayIfFullRomL(); sl@0: sl@0: theScreenOrigin = TPoint(iQueueClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 30+theScreenOrigin.iX, 30+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Down, sl@0: 40+theScreenOrigin.iX, 50+theScreenOrigin.iY); sl@0: SimulatePointer(TRawEvent::EButton1Up, sl@0: 26+theScreenOrigin.iX, 20+theScreenOrigin.iY); sl@0: sl@0: #if defined(__WINS__) sl@0: iQueueClient->iWs.SimulateXyInputType(EXYInputDeltaMouse); sl@0: iQueueClient->iWs.SetPointerCursorPosition(TPoint(24+theScreenOrigin.iX,24+theScreenOrigin.iY)); sl@0: SimulatePointer(TRawEvent::EPointerMove,1,2); sl@0: iQueueClient->iWs.SimulateXyInputType(EXYInputPointer); sl@0: #endif sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(30-EWinPositionX,30-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(40-EWinPositionX,50-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(26-EWinPositionX,20-EWinPositionY)); sl@0: sl@0: #if defined(__WINS__) sl@0: AddExpectedPointer(TPointerEvent::EMove, TPoint(25-EWinPositionX,26-EWinPositionY)); sl@0: #endif sl@0: sl@0: iQueueClient->iScreen->SetAppScreenMode(theCurMode); sl@0: TheClient->iScreen->SetScreenMode(theCurMode); sl@0: break; sl@0: } sl@0: default: sl@0: User::After(EPointerCursorUpdateGap); sl@0: iBlankWin->SetVisible(EFalse); sl@0: TheClient->iWs.SetAutoFlush(iTheClientFlush); sl@0: iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); sl@0: iQueueClient->iScreen->SetCurrentScreenModeAttributes(iSizeMode); sl@0: User::After(500000); //0.5secs, to allow other screen devices to respond to the flip events sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: } sl@0: sl@0: void CTEventTest::AnimEvent_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"AnimEvent SetOfEvents: %d (Max=4)"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iAnim=REventAnim::NewL(iQueueClient->iWin->BaseWin(), iAnimDll); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKeyAnim(TRawEvent::EKeyDown,32,ETrue); sl@0: AddExpectedKeyAnim(TRawEvent::EKeyUp,32,ETrue); sl@0: AddExpectedKeyAnim(TRawEvent::EKeyDown,33,EFalse); sl@0: AddExpectedKeyAnim(TRawEvent::EKeyUp,33,EFalse); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,32); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,32); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,33); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,33); sl@0: TheClient->iWs.Flush(); sl@0: if (iAnim->TestFail(4)) sl@0: Failed(); sl@0: break; sl@0: case 1: sl@0: iQueueClient->iWin->BaseWin()->PointerFilter(EPointerFilterMove|EPointerFilterDrag,0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); sl@0: iQueueClient->iWs.Flush(); sl@0: TheClient->iWs.SetPointerCursorArea(TRect(10,10,51,51)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(10,10)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(25,10)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(50,10)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(50,35)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(50,50)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(25,50)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(10,50)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(10,35)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(30,30),EFalse); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(30,30),EFalse); sl@0: SimulatePointer(TRawEvent::EButton1Down,5,5); sl@0: SimulatePointer(TRawEvent::EButton1Up,25,5); sl@0: SimulatePointer(TRawEvent::EButton1Down,55,5); sl@0: SimulatePointer(TRawEvent::EButton1Up,55,35); sl@0: SimulatePointer(TRawEvent::EButton1Down,55,55); sl@0: SimulatePointer(TRawEvent::EButton1Up,25,55); sl@0: SimulatePointer(TRawEvent::EButton1Down,5,55); sl@0: SimulatePointer(TRawEvent::EButton1Up,5,35); sl@0: SimulatePointer(TRawEvent::EButton1Down,30,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,30,30); sl@0: TheClient->iWs.Flush(); sl@0: if (iAnim->TestFail(10)) sl@0: Failed(); sl@0: break; sl@0: case 2: sl@0: { sl@0: #if defined(LOGGING) sl@0: _LIT(KLog," :2nd Set of Events Modes=0x%x"); sl@0: logMessageText.Format(KLog,iScreenModeTests); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: TInt enforc=TheClient->iScreen->ScreenModeEnforcement(); sl@0: iBlankWin->SetVisible(ETrue); sl@0: TInt expectedEvents=0; sl@0: if (iScreenModeTests&EDoRot90 && enforc==ESizeEnforcementNone) sl@0: { sl@0: INFO_PRINTF1(_L(" :Rotation 90")); sl@0: TheClient->iScreen->SetScreenMode(1); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(20,20-iYOffset)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(20,20-iYOffset)); sl@0: expectedEvents+=2; sl@0: TPoint screenModeOrigin=TheClient->iScreen->GetDefaultScreenModeOrigin(); sl@0: #if defined(__WINS__) sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: #else sl@0: // simulate pointer at (20,20) on rotated screen by providing physical coordinates sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-20+screenModeOrigin.iX,20+screenModeOrigin.iY); sl@0: #endif sl@0: } sl@0: if (iScreenModeTests&EDoRot180) sl@0: { sl@0: INFO_PRINTF1(_L(" :Rotation 180")); sl@0: TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationRotated180); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(22,22-iYOffset)); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(22,22-iYOffset)); sl@0: sl@0: expectedEvents+=2; sl@0: #if defined(__WINS__) sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,22,22); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,22,22); sl@0: #else sl@0: // simulate pointer at (22,22) on rotated screen by providing physical coordinates sl@0: iTest->SimulatePointer(TRawEvent::EButton1Down,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); sl@0: iTest->SimulatePointer(TRawEvent::EButton1Up,iPhysicalScreenSize.iWidth-1-22,iPhysicalScreenSize.iHeight-1-22); sl@0: #endif sl@0: } sl@0: TheClient->iScreen->SetCurrentRotations(0,CFbsBitGc::EGraphicsOrientationNormal); sl@0: TheClient->iScreen->SetScreenMode(0); sl@0: TheClient->iWs.Flush(); sl@0: iTest->DelayIfFullRomL(); sl@0: if (iScreenModeTests&EDoRot0) sl@0: { sl@0: INFO_PRINTF1(_L(" :Rotation 0")); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Down, TPoint(24,24),EFalse); sl@0: AddExpectedPointerAnim(TRawEvent::EButton1Up, TPoint(24,24),EFalse); sl@0: expectedEvents+=2; sl@0: SimulatePointer(TRawEvent::EButton1Down,24,24); sl@0: SimulatePointer(TRawEvent::EButton1Up,24,24); sl@0: } sl@0: #if defined(LOGGING) sl@0: _LIT(KNumEvents," :Expected Number of Events=%d Actual=%d"); sl@0: logMessageText.Format(KNumEvents,expectedEvents,iAnim->GetNumEvents()); sl@0: INFO_PRINTF1(logMessageText); sl@0: _LIT(KError," :Error Value %d ('0'=OK)"); sl@0: logMessageText.Format(KError,iAnim->GetError()); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: if (iAnim->TestFail(expectedEvents)) sl@0: Failed(); sl@0: User::After(EPointerCursorUpdateGap); sl@0: iBlankWin->SetVisible(EFalse); sl@0: INFO_PRINTF1(_L(" :Finished 2nd Set")); sl@0: } sl@0: break; sl@0: case 3: sl@0: iAnim->Destroy(); iAnim=NULL; sl@0: // Create an EventPostingAnim, key down & key up events are simulated. sl@0: // The event posting anim sees the key events in turn, and creates duplicates. sl@0: // Test checks that each simulated event is received twice. sl@0: TRAPD(err, iAnim=REventAnim::NewL(iQueueClient->iWin->BaseWin(), iAnimDll, REventAnimBase::EEventPostingAnim)); sl@0: if (err!=KErrNone) sl@0: { sl@0: Failed(); sl@0: return; sl@0: } sl@0: AddExpectedKeyAnim(TRawEvent::EKeyDown,32,ETrue); sl@0: AddExpectedKeyAnim(TRawEvent::EKeyDown,32,EFalse); sl@0: AddExpectedKeyAnim(TRawEvent::EKeyUp,32,ETrue); sl@0: AddExpectedKeyAnim(TRawEvent::EKeyUp,32,EFalse); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,32); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,32); sl@0: break; sl@0: case 4: sl@0: // Simulate a key down event, which calls anim's offer raw event sl@0: // which inturn calls post key event with old and new API sl@0: // Test checks the repeat count for old and new API are as expected. sl@0: AddExpectedKeyAnim(TRawEvent::EKeyDown,45,ETrue); sl@0: sl@0: TKeyEvent event; sl@0: event.iCode='J'; sl@0: event.iScanCode=0; sl@0: event.iModifiers=0; sl@0: event.iRepeats=0; sl@0: AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers); sl@0: event.iRepeats=2; sl@0: AddExpectedKey(1, event.iScanCode, event.iCode, event.iRepeats, event.iModifiers); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,45); sl@0: break; sl@0: default: sl@0: iAnim->Destroy(); sl@0: iAnim=NULL; sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::FocusChanged_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"FocusChanged SetOfEvents: %d "); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: _LIT(AutoFocusTest,"FocusEvents"); sl@0: iQueueClient->EnableFocusChangeEvents(); sl@0: iEventTestGroup2=new(ELeave) CTWindowGroup(TheClient); sl@0: iEventTestGroup2->ConstructL(); sl@0: iEventTestGroup2->GroupWin()->SetName(AutoFocusTest); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: AddExpectedEvent(EEventFocusGroupChanged); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: } sl@0: break; sl@0: case 1: sl@0: iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(EFalse); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventFocusGroupChanged); sl@0: break; sl@0: case 2: sl@0: iEventTestGroup2->GroupWin()->EnableReceiptOfFocus(ETrue); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: AddExpectedEvent(EEventFocusGroupChanged); sl@0: break; sl@0: case 3: sl@0: iEventTestGroup2->GroupWin()->SetOrdinalPosition(999); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventFocusGroupChanged); sl@0: break; sl@0: case 4: sl@0: iEventTestGroup2->GroupWin()->SetOrdinalPosition(0); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: AddExpectedEvent(EEventFocusGroupChanged); sl@0: break; sl@0: case 5: sl@0: delete iEventTestGroup2; sl@0: iEventTestGroup2=NULL; sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: AddExpectedEvent(EEventFocusGroupChanged); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: sl@0: void CTEventTest::StopEvents_NextSetOfEventsL() sl@0: { sl@0: // we are not running tests 0,1,2 as they currently fail sl@0: if(iEventSet==0) sl@0: { sl@0: iEventSet=3; sl@0: AddExpectedEvent(EEventFocusGained); sl@0: } sl@0: TInt retVal = KErrNone; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(.... sl@0: iQueueClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOff); sl@0: TheClient->iWs.Flush(); sl@0: retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()); sl@0: TEST(retVal==KErrAlreadyExists); sl@0: if (retVal!=KErrAlreadyExists) sl@0: INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse,iQueueClient->iGroup->WinTreeNode())); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOff); sl@0: TheClient->iWs.Flush(); sl@0: retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()); sl@0: TEST(retVal==KErrAlreadyExists); sl@0: if (retVal!=KErrAlreadyExists) sl@0: INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventSwitchOff); sl@0: AddExpectedEvent(EEventSwitchOff); sl@0: break; sl@0: sl@0: case 1: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(.... sl@0: { sl@0: TKeyEvent event; sl@0: iQueueClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); sl@0: event.iCode=EKeyOff; sl@0: event.iScanCode=EKeyOff; sl@0: event.iModifiers=0; sl@0: event.iRepeats=0; sl@0: TheClient->iWs.SimulateKeyEvent(event); sl@0: TheClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); sl@0: AddExpectedEvent(EEventKeySwitchOff); sl@0: } sl@0: break; sl@0: sl@0: case 2: // doesn't work if shell gets the off events - will fail on User::LeaveIfError(.... sl@0: { sl@0: TKeyEvent event; sl@0: event.iCode=EKeyOff; sl@0: event.iScanCode=EKeyOff; sl@0: event.iModifiers=0; sl@0: event.iRepeats=0; sl@0: iQueueClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iGroup->WinTreeNode())); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOff); sl@0: TheClient->iWs.SimulateKeyEvent(event); sl@0: iTest->SimulateEvent(TRawEvent::ECaseClose); sl@0: TheClient->iWs.Flush(); sl@0: retVal = iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()); sl@0: TEST(retVal==KErrAlreadyExists); sl@0: if (retVal!=KErrAlreadyExists) sl@0: INFO_PRINTF3(_L("iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode()) return value - Expected: %d, Actual: %d"), KErrAlreadyExists, retVal); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOff); sl@0: iTest->SimulateEvent(TRawEvent::ECaseClose); sl@0: TheClient->iWs.SimulateKeyEvent(event); sl@0: TheClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse,iQueueClient->iGroup->WinTreeNode())); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iWin->WinTreeNode())); sl@0: iTest->SimulateEvent(TRawEvent::ECaseClose); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOff); sl@0: TheClient->iWs.SimulateKeyEvent(event); sl@0: TheClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(ETrue,iQueueClient->iChildWin->WinTreeNode())); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOff); sl@0: TheClient->iWs.SimulateKeyEvent(event); sl@0: iTest->SimulateEvent(TRawEvent::ECaseClose); sl@0: TheClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWs.RequestOffEvents(EFalse)); sl@0: AddExpectedEvent(EEventSwitchOff); sl@0: AddExpectedEvent(EEventKeySwitchOff); sl@0: AddExpectedEvent(EEventCaseClosed); sl@0: AddExpectedEvent(EEventSwitchOff); sl@0: AddExpectedEvent(EEventCaseClosed); sl@0: AddExpectedEvent(EEventKeySwitchOff); sl@0: AddExpectedEvent(EEventCaseClosed,iQueueClient->iWin); sl@0: AddExpectedEvent(EEventSwitchOff,iQueueClient->iWin); sl@0: AddExpectedEvent(EEventKeySwitchOff,iQueueClient->iWin); sl@0: AddExpectedEvent(EEventSwitchOff,iQueueClient->iChildWin); sl@0: AddExpectedEvent(EEventKeySwitchOff,iQueueClient->iChildWin); sl@0: AddExpectedEvent(EEventCaseClosed,iQueueClient->iChildWin); sl@0: } sl@0: break; sl@0: sl@0: case 3: sl@0: iQueueClient->iWs.Flush(); sl@0: //User::LeaveIfError(iQueueClient->iGroup->WinTreeNode()->EnableOnEvents(EEventControlAlways)); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: iTest->SimulateEvent(TRawEvent::ECaseOpen); sl@0: TheClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWin->WinTreeNode()->EnableOnEvents(EEventControlAlways)); sl@0: iTest->SimulateEvent(TRawEvent::ECaseOpen); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->WinTreeNode()->DisableOnEvents(); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: //AddExpectedEvent(EEventSwitchOn); sl@0: AddExpectedEvent(EEventCaseOpened); sl@0: AddExpectedEvent(EEventCaseOpened,iQueueClient->iWin); sl@0: AddExpectedEvent(EEventCaseOpened); sl@0: AddExpectedEvent(EEventSwitchOn,iQueueClient->iWin); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: break; sl@0: sl@0: case 4: sl@0: iQueueClient->iWs.Flush(); sl@0: // switch off the device sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOff); sl@0: // switch it back on. sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: TheClient->iWs.Flush(); sl@0: // TRawEvent::ESwitchOff never actually comes back. The tests will hang if we look for one sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: break; sl@0: sl@0: case 5: sl@0: { sl@0: TKeyEvent event; sl@0: iQueueClient->iWs.Flush(); sl@0: event.iCode=EKeyOff; sl@0: event.iScanCode=EKeyOff; sl@0: event.iModifiers=0; sl@0: event.iRepeats=0; sl@0: // switch off the device - this one seems to send it to standby rather than off sl@0: TheClient->iWs.SimulateKeyEvent(event); sl@0: // switch it back on or no further tests will complete sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: TheClient->iWs.Flush(); sl@0: // again we would expect EEventKeySwitchOff but it doesn't come back. The tests will hang if we look for one sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: } sl@0: break; sl@0: sl@0: case 6: sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: iTest->SimulateEvent(TRawEvent::ECaseOpen); sl@0: TheClient->iWs.Flush(); sl@0: User::LeaveIfError(iQueueClient->iWin->WinTreeNode()->EnableOnEvents(EEventControlAlways)); sl@0: iTest->SimulateEvent(TRawEvent::ECaseOpen); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iWin->WinTreeNode()->DisableOnEvents(); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: AddExpectedEvent(EEventCaseOpened); sl@0: AddExpectedEvent(EEventCaseOpened,iQueueClient->iWin); sl@0: AddExpectedEvent(EEventCaseOpened); sl@0: AddExpectedEvent(EEventSwitchOn,iQueueClient->iWin); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: break; sl@0: sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::VirtualKeyboard_NextSetOfEventsL() sl@0: { sl@0: const TInt noVirtualKeys=10; sl@0: const TInt keyWidth=2*EWinWidth/noVirtualKeys/3; sl@0: const TInt keyHeight=EWinHeight/2; sl@0: const TInt keySpacing=EWinWidth/noVirtualKeys; sl@0: const TInt baseChar='1'; sl@0: TInt startX=1; sl@0: TInt ii; sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); sl@0: for (ii=0;iiiWin->BaseWin()->AddKeyRect(TRect(startX,1,startX+keyWidth,keyHeight),baseChar+ii,EFalse); sl@0: startX+=keySpacing; sl@0: } sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulatePointerDownUp(EWinPositionX+1,EWinPositionY+1+iYOffset); sl@0: //TheClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKeyDownUp(baseChar); sl@0: break; sl@0: case 1: sl@0: startX=3; sl@0: for (ii=0;iiSimulatePointerDownUp(startX+EWinPositionX+1,EWinPositionY+keyHeight-1+iYOffset); sl@0: AddExpectedKeyDownUp(baseChar+ii); sl@0: startX+=keySpacing; sl@0: } sl@0: break; sl@0: case 2: sl@0: SimulatePointerDownUpWin(keySpacing+1,1); sl@0: //SimulatePointerDownUp(EWinPositionX+keySpacing+1,EWinPositionY+1); sl@0: iTest->SimulatePointerDownUp(EWinPositionX+keyWidth,EWinPositionY+1+iYOffset); sl@0: iTest->SimulatePointerDownUp(EWinPositionX+1,EWinPositionY+keyHeight-1+iYOffset); sl@0: iTest->SimulatePointerDownUp(EWinPositionX+keyWidth,EWinPositionY+keyHeight-1+iYOffset); sl@0: AddExpectedKeyDownUp(baseChar+1); sl@0: AddExpectedKeyDownUp(baseChar); sl@0: AddExpectedKeyDownUp(baseChar); sl@0: AddExpectedKeyDownUp(baseChar); sl@0: break; sl@0: case 3: sl@0: SimulatePointerDownUpWin(keySpacing+3,4); sl@0: SimulatePointerDownUpWin(0,0); //No Pointer event get through even if there are gaps sl@0: SimulatePointerDownUpWin(1,0); sl@0: SimulatePointerDownUpWin(0,1); sl@0: SimulatePointerDownUpWin(keyWidth+1,0); sl@0: SimulatePointerDownUpWin(keyWidth,0); sl@0: SimulatePointerDownUpWin(keyWidth+1,1); sl@0: SimulatePointerDownUpWin(0,keyHeight); sl@0: SimulatePointerDownUpWin(1,keyHeight); sl@0: SimulatePointerDownUpWin(0,keyHeight-1); sl@0: SimulatePointerDownUpWin(keyWidth+1,keyHeight); sl@0: SimulatePointerDownUpWin(keyWidth,keyHeight); sl@0: SimulatePointerDownUpWin(keyWidth+1,keyHeight-1); sl@0: SimulatePointerDownUpWin(2*keySpacing+3,4); sl@0: AddExpectedKeyDownUp(baseChar+1); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+0)); //No Pointer event get through even if there are gaps sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+1,EWinPositionY+0)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+1)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+0)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth,EWinPositionY+0)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+1)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+keyHeight)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+1,EWinPositionY+keyHeight)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+0,EWinPositionY+keyHeight-1)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+keyHeight)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth,EWinPositionY+keyHeight)); sl@0: AddExpectedPointerDownUpScr(TPoint(EWinPositionX+keyWidth+1,EWinPositionY+keyHeight-1)); sl@0: AddExpectedKeyDownUp(baseChar+2); sl@0: break; sl@0: case 4: sl@0: SimulatePointerWin(TRawEvent::EButton1Down,keySpacing+2,6); sl@0: SimulatePointerWin(TRawEvent::EButton1Up,2*keySpacing+1,5); sl@0: SimulatePointerWin(TRawEvent::EButton1Down,2*keySpacing+2,7); sl@0: SimulatePointer(TRawEvent::EButton1Up,0,0); sl@0: AddExpectedKeyDownUp(baseChar+1); sl@0: AddExpectedKeyDownUp(baseChar+2); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: TInt CTEventTest::ClickCommandReply(TInt aCommand,TInt aData) sl@0: { sl@0: TPckgBuf intPkg; sl@0: intPkg()=aData; sl@0: return iClick.CommandReply(aCommand,intPkg); sl@0: } sl@0: sl@0: TInt CTEventTest::CreateGroupWindow(RWindowGroup& aWinGp,TClients aClient,TInt& aWinGpId) sl@0: { sl@0: ClickCommandReply(EClickCreateGroupWin,aClient); sl@0: TInt err=aWinGp.Construct(ENullWsHandle,EFalse); sl@0: if (!err) sl@0: { sl@0: aWinGpId=aWinGp.Identifier(); sl@0: ClickCommandReply(EClickCheckGpWinId,aWinGpId); sl@0: } sl@0: return err; sl@0: } sl@0: sl@0: void CTEventTest::CloseGroupWindow(RWindowGroup& aWinGp,TInt aWinGpId) sl@0: { sl@0: ClickCommandReply(EClickCloseGroupWin,aWinGpId); sl@0: aWinGp.Close(); sl@0: } sl@0: sl@0: void CTEventTest::CloseWindow(RWindowBase& aWin,TInt aHandle,TInt aWinGpId) sl@0: { sl@0: TPckgBuf winClose; sl@0: winClose().iClientHandle=aHandle; sl@0: winClose().iWindowGroupId=aWinGpId; sl@0: iClick.CommandReply(EClickCloseWin,winClose); sl@0: aWin.Close(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0447 sl@0: sl@0: @SYMCR CR1164 sl@0: sl@0: @SYMTestCaseDesc Tests that Key Click Plug-in gets new event Information sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Do things that cause the new events to be sent into plug-in. sl@0: Creating destroying windows, pointer events. Provide test plug-in with information it needs to check events. sl@0: sl@0: @SYMTestExpectedResults When Test Plug-in is querried to see if events match what was expected it says that they were. sl@0: */ sl@0: void CTEventTest::KeyClicks_NextSetOfEvents() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"KeyClicks SetOfEvents: %d (last=13)"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: TInt events=-1; sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: if (SetClickType(EClickCheck)) sl@0: return; sl@0: iAddToClick=ETrue; sl@0: iQueueClient->iWin->BaseWin()->SetPointerGrab(EFalse); sl@0: iQueueClient->iChildWin->BaseWin()->SetPointerGrab(EFalse); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKeyDownUp(EStdKeySpace,EKeySpace); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeySpace); //3 events sl@0: events=3; sl@0: break; sl@0: case 1: sl@0: AddExpectedKeyDownUp(EStdKeyEnter,EKeyEnter); sl@0: AddExpectedKeyDownUp('0'); sl@0: AddExpectedKeyDownUp('A','a'); sl@0: AddExpectedKeyDownUp('X','x'); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyLeftShift,0,0,EModifierLeftShift|EModifierShift); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyLeftShift); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeyEnter); //3 events sl@0: iTest->SimulateKeyDownUp('0'); //3 events sl@0: iTest->SimulateKeyDownUp('A'); //3 events sl@0: iTest->SimulateKeyDownUp('X'); //3 events sl@0: iTest->SimulateKeyDownUp(EStdKeyLeftShift); //2 events sl@0: events=14; sl@0: break; sl@0: case 2: sl@0: AddExpectedKey(EEventKeyDown,EStdKeyRightShift,0,0,EModifierRightShift|EModifierShift); sl@0: AddExpectedKeyDownUp('B','B',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable); sl@0: AddExpectedKeyDownUp('W','W',0,EModifierRightShift|EModifierShift|EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyRightShift); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyRightShift); //1 event sl@0: iTest->SimulateKeyDownUp('B'); //3 events sl@0: iTest->SimulateKeyDownUp('W'); //3 events sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyRightShift); //1 event sl@0: events=8; sl@0: break; sl@0: case 3: sl@0: AddExpectedKey(EEventKeyDown,'C'); sl@0: AddExpectedKey(EEventKey,'C','c'); sl@0: AddExpectedKey(EEventKeyDown,'V'); sl@0: AddExpectedKey(EEventKey,'V','v'); sl@0: AddExpectedKey(EEventKeyUp,'C'); sl@0: AddExpectedKey(EEventKeyUp,'V'); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'C'); //2 events sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'V'); //2 events sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'C'); //1 event sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'V'); //1 event sl@0: events=6; sl@0: break; sl@0: case 4: sl@0: { sl@0: AddExpectedKey(EEventKeyDown,'D'); sl@0: AddExpectedKey(EEventKey,'D','d'); sl@0: AddExpectedKey(EEventKey,'D','d',1); sl@0: AddExpectedKey(EEventKeyUp,'D'); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'D'); //2 events sl@0: TTimeIntervalMicroSeconds32 initialTime,time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); sl@0: User::After(initialTime.Int()+time.Int()/4); //1 event sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'D'); //1 event sl@0: events=4; sl@0: } sl@0: break; sl@0: case 5: sl@0: AddExpectedPointerDownUpScr(TPoint(40,25)); sl@0: AddExpectedPointerDownUpScr(TPoint(95,30)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(20-EWinPositionX,50-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag,TPoint(45-EWinPositionX,42-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(45-EWinPositionX,42-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(98-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedPointerClick(TPointerEvent::EDrag,TPoint(68-EWinPositionX,39-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EDrag,TPoint(41-EWinPositionX,42-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(50-EWinPositionX,58-EWinPositionY)); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulatePointerDownUp(40,25+iYOffset); //2 events sl@0: iTest->SimulatePointerDownUp(95,30+iYOffset); //2 events sl@0: SimulatePointer(TRawEvent::EButton1Down,20,50); //1 event sl@0: SimulatePointer(TRawEvent::EPointerMove,45,42); //1 event sl@0: SimulatePointer(TRawEvent::EButton1Up,45,42); //1 event sl@0: SimulatePointer(TRawEvent::EButton1Down,98,15); //1 event sl@0: SimulatePointer(TRawEvent::EPointerMove,68,39); //1 event sl@0: SimulatePointer(TRawEvent::EPointerMove,41,42); //1 event sl@0: SimulatePointer(TRawEvent::EButton1Up,50,58); //1 event sl@0: events=11; sl@0: break; sl@0: case 6: sl@0: AddExpectedKey(EEventKeyDown,'E'); sl@0: AddExpectedKey(EEventKey,'E','e'); sl@0: AddExpectedPointerDownUpScr(TPoint(41,24)); sl@0: AddExpectedKey(EEventKeyUp,'E'); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(23-EWinPositionX,52-EWinPositionY)); sl@0: AddExpectedKeyDownUp('1'); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(44-EWinPositionX,45-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down,TPoint(33-EWinPositionX,53-EWinPositionY)); sl@0: AddExpectedKey(EEventKeyDown,'F'); sl@0: AddExpectedKey(EEventKey,'F','f'); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up,TPoint(34-EWinPositionX,47-EWinPositionY)); sl@0: AddExpectedKey(EEventKeyUp,'F'); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'E'); //2 events sl@0: iTest->SimulatePointerDownUp(41,24+iYOffset); //2 events sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'E'); //1 event sl@0: SimulatePointer(TRawEvent::EButton1Down,23,52); //1 event sl@0: iTest->SimulateKeyDownUp('1'); //3 events sl@0: SimulatePointer(TRawEvent::EButton1Up,44,45); //1 event sl@0: SimulatePointer(TRawEvent::EButton1Down,33,53); //1 event sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'F'); //2 events sl@0: SimulatePointer(TRawEvent::EButton1Up,34,47); //1 event sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'F'); //1 event sl@0: events=15; sl@0: break; sl@0: case 7: sl@0: AddExpectedKeyDownUp('2'); sl@0: iAddToClick=EFalse; sl@0: AddExpectedKeyDownUp('G','g'); sl@0: iAddToClick=ETrue; sl@0: AddExpectedPointerDownUpScr(TPoint(42,26)); sl@0: AddExpectedKeyDownUp('U','u'); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp('2'); //3 events sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->DisableKeyClick(ETrue); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp('G'); sl@0: iTest->SimulatePointerDownUp(42,26+iYOffset); //2 events sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->DisableKeyClick(EFalse); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp('U'); //3 events sl@0: events=8; sl@0: break; sl@0: case 8: sl@0: { sl@0: TPckgBuf pointerEventInfo; sl@0: pointerEventInfo().iClientHandle=reinterpret_cast(iQueueClient->iChildWin); sl@0: pointerEventInfo().iWinGpId=iQueueClient->iGroup->GroupWin()->Identifier(); sl@0: pointerEventInfo().iWinOrigin=iQueueClient->ChildTopLeft(); sl@0: pointerEventInfo().iParentOrigin.SetXY(EWinPositionX,EWinPositionY); sl@0: iClick.CommandReply(EClickPointerEvent,pointerEventInfo); sl@0: AddExpectedKeyDownUp('3'); sl@0: AddExpectedPointerDownUpScr(TPoint(43,26)); sl@0: AddExpectedKeyDownUp('H','h'); sl@0: iAddToClick=EFalse; sl@0: AddExpectedPointerDownUpScr(TPoint(43,27)); sl@0: AddExpectedKeyDownUp('4'); sl@0: AddExpectedPointerDownUpScr(TPoint(42,27)); sl@0: AddExpectedKeyDownUp('I','i'); sl@0: iAddToClick=ETrue; sl@0: AddExpectedPointerDownUpScr(TPoint(44,27)); sl@0: AddExpectedKeyDownUp('5'); sl@0: AddExpectedPointerDownUpScr(TPoint(44,26)); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp('3'); //3 events sl@0: iTest->SimulatePointerDownUp(43,26+iYOffset); //2 events sl@0: iClick.SetPenClick(EFalse); sl@0: iTest->SimulateKeyDownUp('H'); //3 events sl@0: iTest->SimulatePointerDownUp(43,27+iYOffset); sl@0: iClick.SetKeyClick(EFalse); sl@0: iTest->SimulateKeyDownUp('4'); sl@0: iTest->SimulatePointerDownUp(42,27+iYOffset); sl@0: iClick.SetPenClick(ETrue); sl@0: iTest->SimulateKeyDownUp('I'); sl@0: iTest->SimulatePointerDownUp(44,27+iYOffset); //2 events sl@0: iClick.SetKeyClick(ETrue); sl@0: iTest->SimulateKeyDownUp('5'); //3 events sl@0: iTest->SimulatePointerDownUp(44,26+iYOffset); //2 events sl@0: pointerEventInfo().iClientHandle=0; sl@0: pointerEventInfo().iWinGpId=0; sl@0: iClick.CommandReply(EClickPointerEvent,pointerEventInfo); sl@0: events=15; sl@0: } sl@0: break; sl@0: case 9: sl@0: { sl@0: RWindowGroup winGp(iQueueClient->iWs); sl@0: TInt winGpId; sl@0: TInt ii; sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: for (ii=0;ii<2;++ii) //events x2 sl@0: { sl@0: if (CreateGroupWindow(winGp,EQueueClient,winGpId)) //1 event sl@0: Failed(); sl@0: CloseGroupWindow(winGp,winGpId); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: } sl@0: events=4; sl@0: } sl@0: break; sl@0: case 10: sl@0: { sl@0: RWindowGroup winGp(TheClient->iWs); sl@0: RWindowGroup winGp1(iQueueClient->iWs); sl@0: RWindowGroup winGp2(iQueueClient->iWs); sl@0: TInt winGpId; sl@0: TInt winGpId1; sl@0: TInt winGpId2; sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: if (CreateGroupWindow(winGp,ETheClient,winGpId)) //1 event sl@0: Failed(); sl@0: CloseGroupWindow(winGp,winGpId); //1 event sl@0: TheClient->iWs.Flush(); sl@0: if (CreateGroupWindow(winGp1,EQueueClient,winGpId1)) //1 event sl@0: Failed(); sl@0: if (CreateGroupWindow(winGp2,EQueueClient,winGpId2)) //1 event sl@0: Failed(); sl@0: if (CreateGroupWindow(winGp,ETheClient,winGpId)) //1 event sl@0: Failed(); sl@0: CloseGroupWindow(winGp2,winGpId2); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: CloseGroupWindow(winGp,winGpId); //1 event sl@0: TheClient->iWs.Flush(); sl@0: CloseGroupWindow(winGp1,winGpId1); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: events=8; sl@0: } sl@0: break; sl@0: case 11: sl@0: { sl@0: RWindowGroup winGp(iQueueClient->iWs); sl@0: TInt winGpId; sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: if (CreateGroupWindow(winGp,EQueueClient,winGpId)) //1 event sl@0: Failed(); sl@0: RWindow win(iQueueClient->iWs); sl@0: const TInt handle=79; sl@0: if (win.Construct(winGp,handle)) sl@0: Failed(); sl@0: win.Activate(); sl@0: CloseWindow(win,handle,winGpId); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: CloseGroupWindow(winGp,winGpId); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: events=3; sl@0: } sl@0: break; sl@0: case 12: sl@0: { sl@0: RWindowGroup winGp1(iQueueClient->iWs); sl@0: RWindowGroup winGp2(TheClient->iWs); sl@0: TInt winGpId1; sl@0: TInt winGpId2; sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: if (CreateGroupWindow(winGp2,ETheClient,winGpId2)) //1 event sl@0: Failed(); sl@0: if (CreateGroupWindow(winGp1,EQueueClient,winGpId1)) //1 event sl@0: Failed(); sl@0: RWindow win1(iQueueClient->iWs); sl@0: RWindow win2(iQueueClient->iWs); sl@0: RWindow win(TheClient->iWs); sl@0: const TInt handle1a=80; sl@0: const TInt handle1b=81; sl@0: const TInt handle2a=82; sl@0: const TInt handle2b=83; sl@0: const TInt handle=84; sl@0: if (win1.Construct(winGp1,handle1a)) sl@0: Failed(); sl@0: win1.Activate(); sl@0: if (win2.Construct(win1,handle2a)) sl@0: Failed(); sl@0: win2.Activate(); sl@0: if (win.Construct(winGp2,handle)) sl@0: Failed(); sl@0: win.Activate(); sl@0: CloseWindow(win2,handle2a,winGpId1); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: if (win2.Construct(winGp1,handle2b)) sl@0: Failed(); sl@0: win2.Activate(); sl@0: CloseWindow(win1,handle1a,winGpId1); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: CloseWindow(win,handle,winGpId2); //1 event sl@0: TheClient->iWs.Flush(); sl@0: if (win1.Construct(win2,handle1b)) sl@0: Failed(); sl@0: win1.Activate(); sl@0: CloseWindow(win1,handle1b,winGpId1); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: CloseGroupWindow(winGp2,winGpId2); //1 event sl@0: TheClient->iWs.Flush(); sl@0: CloseWindow(win2,handle2b,winGpId1); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: CloseGroupWindow(winGp1,winGpId1); //1 event sl@0: iQueueClient->iWs.Flush(); sl@0: events=9; sl@0: } sl@0: break; sl@0: case 13: sl@0: { sl@0: TPckgBuf pointerEventInfo; sl@0: pointerEventInfo().iClientHandle=reinterpret_cast(iQueueClient->iWin); sl@0: pointerEventInfo().iWinGpId=iQueueClient->iGroup->GroupWin()->Identifier(); sl@0: pointerEventInfo().iWinOrigin.SetXY(EWinPositionX,EWinPositionY); sl@0: pointerEventInfo().iParentOrigin.SetXY(0,0); sl@0: iClick.CommandReply(EClickPointerEvent,pointerEventInfo); sl@0: AddExpectedPointerDownUpScr(TPoint(43,18)); sl@0: AddExpectedPointerDownUpScr(TPoint(43,17)); sl@0: AddExpectedPointerDownUpScr(TPoint(42,52)); sl@0: AddExpectedPointerDownUpScr(TPoint(24,27)); sl@0: AddExpectedPointerDownUpScr(TPoint(94,26)); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulatePointerDownUp(43,18+iYOffset); //2 events sl@0: iTest->SimulatePointerDownUp(43,17+iYOffset); //2 events sl@0: iTest->SimulatePointerDownUp(42,52+iYOffset); //2 events sl@0: iTest->SimulatePointerDownUp(24,27+iYOffset); //2 events sl@0: iTest->SimulatePointerDownUp(94,26+iYOffset); //2 events sl@0: pointerEventInfo().iClientHandle=0; sl@0: pointerEventInfo().iWinGpId=0; sl@0: iClick.CommandReply(EClickPointerEvent,pointerEventInfo); sl@0: events=10; sl@0: } sl@0: break; sl@0: default: sl@0: iAddToClick=EFalse; sl@0: if (!SetClickType(EClickNone)) sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: TInt failedAt=iClick.CommandReply(EClickFailed,TPtrC8(NULL,0)); sl@0: TInt eventsDone=iClick.CommandReply(EClickEvents,TPtrC8(NULL,0)); sl@0: if (failedAt!=0 || eventsDone!=events) //iEventSet (already incremented) sl@0: { sl@0: #if defined(LOGGING) sl@0: _LIT(KeyClickFailed,"KeyClick Failed EventSet=%d FailedAt=%d TotalEvents=%d EventsDone=%d"); sl@0: logMessageText.Format(KeyClickFailed,iEventSet-1,failedAt,events,eventsDone); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: Failed(); sl@0: } sl@0: iClick.CommandReply(EClickReset,TPtrC8(NULL,0)); sl@0: } sl@0: sl@0: void CTEventTest::CaptureLong_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"CaptureLong SetOfEvents: %d of 23"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp('A'); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKeyDownUp('A','a'); sl@0: break; sl@0: case 1: sl@0: // Test CaptureLongKey() with modifier value EModifierShift and flag value ELongCaptureNormal sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',EModifierShift,EModifierShift,2,ELongCaptureNormal); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftShift); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(1, 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftShift); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyLeftShift); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' ',0,EModifierLeftShift|EModifierShift|EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,'a',1,EModifierLongKey|EModifierLeftShift|EModifierShift|EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyLeftShift); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 2: sl@0: // Test CaptureLongKey() with modifier value EModifierFunc and flag value ELongCaptureWaitShort sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc,EModifierFunc,2,ELongCaptureWaitShort); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(1, 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc); sl@0: iTest->SimulateKeyDownUp(EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyEnter); sl@0: AddExpectedKey(EEventKey,EStdKeyEnter,'a',1,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyEnter); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc); sl@0: AddExpectedKeyDownUp(EStdKeySpace,' '); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 3: sl@0: // Test CaptureLongKey() with modifier values EModifierFunc|EModifierAlt and flag values ELongCaptureNormal|ELongCaptureRepeatEvents) sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEnter,'a',EModifierFunc|EModifierAlt,EModifierFunc|EModifierAlt,2,ELongCaptureNormal|ELongCaptureRepeatEvents); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftFunc); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyLeftAlt); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeyEnter); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyEnter); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftAlt); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeyLeftFunc); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyLeftFunc); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyLeftAlt); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyEnter); sl@0: AddExpectedKey(EEventKey,EStdKeyEnter,EKeyEnter,0,EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKey,EStdKeyEnter,'a',2,EModifierLongKey|EModifierLeftFunc|EModifierFunc|EModifierLeftAlt|EModifierAlt|EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyEnter); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyLeftAlt); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyLeftFunc); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 4: sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'Z'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(3, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'Y'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(2, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'Z'); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'Y'); sl@0: AddExpectedKey(EEventKeyDown,'Z'); sl@0: AddExpectedKey(EEventKey,'Z','z'); sl@0: AddExpectedKey(EEventKey,'Z','z',1); sl@0: AddExpectedKey(EEventKeyDown,'Y'); sl@0: AddExpectedKey(EEventKey,'Y','y'); sl@0: AddExpectedKey(EEventKey,'Y','y',1); sl@0: AddExpectedKey(EEventKeyUp,'Z'); sl@0: AddExpectedKey(EEventKeyUp,'Y'); sl@0: break; sl@0: case 5: sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'Z'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(3, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'Y'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(5, 2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'Y'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(2, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'Z'); sl@0: AddExpectedKey(EEventKeyDown,'Z'); sl@0: AddExpectedKey(EEventKey,'Z','z'); sl@0: AddExpectedKey(EEventKey,'Z','z',1); sl@0: AddExpectedKey(EEventKeyDown,'Y'); sl@0: AddExpectedKey(EEventKey,'Y','y'); sl@0: AddExpectedKey(EEventKey,'Y','y',1); sl@0: AddExpectedKey(EEventKeyUp,'Y'); sl@0: AddExpectedKey(EEventKey,'Z','z',1); sl@0: AddExpectedKey(EEventKeyUp,'Z'); sl@0: break; sl@0: case 6: sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'X'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(3, 1); sl@0: iTest->SimulateKeyDownUp(EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: if(!iTest->IsFullRomL()) sl@0: { sl@0: DelayForRepeatEvents(2, 1); sl@0: } sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'X'); sl@0: AddExpectedKey(EEventKeyDown,'X'); sl@0: AddExpectedKey(EEventKey,'X','x'); sl@0: AddExpectedKey(EEventKey,'X','x',1); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: if(!iTest->IsFullRomL()) sl@0: { sl@0: AddExpectedKey(EEventKey,'X','x',1); sl@0: } sl@0: AddExpectedKey(EEventKeyUp,'X'); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 7: sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','b',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'X'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(1, 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: User::ResetInactivityTime(); sl@0: DelayForRepeatEvents(4, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'X'); sl@0: AddExpectedKey(EEventKeyDown,'X'); sl@0: AddExpectedKey(EEventKey,'X','x'); sl@0: AddExpectedKey(EEventKey,'X','x',1); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,'b',1); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,'X','x',1); sl@0: AddExpectedKey(EEventKeyUp,'X'); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 8: sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','c',0,0,2,ELongCaptureRepeatEvents); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,'c',1); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 9: sl@0: { sl@0: TInt captureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(EKeyEscape,'e',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','d',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(5, 2); sl@0: iTest->SimulateKeyDownUp(EStdKeyEscape); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(3, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,'d',1); sl@0: AddExpectedKey(EEventKeyDown,EStdKeyEscape); sl@0: AddExpectedKey(EEventKey,EStdKeyEscape,EKeyEscape); sl@0: AddExpectedKey(EEventKeyUp,EStdKeyEscape); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(captureKey); sl@0: } sl@0: break; sl@0: case 10: sl@0: //Cancel a long capture key event whilst a repeat is underway sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal|ELongCaptureRepeatEvents); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: break; sl@0: case 11: sl@0: // Cancel a key up/down capture whilst a repeat is underway. sl@0: // This should have no effect since only key press events are sl@0: // repeated. sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns('X',0,0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'X'); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'X'); sl@0: AddExpectedKey(EEventKeyDown,'X'); sl@0: AddExpectedKey(EEventKey,'X','x'); sl@0: AddExpectedKey(EEventKey,'X','x',2); sl@0: AddExpectedKey(EEventKeyUp,'X'); sl@0: break; sl@0: case 12: sl@0: //Cancel a capture key event whilst a repeat is underway sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('y',0,0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'Y'); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'Y'); sl@0: AddExpectedKey(EEventKeyDown,'Y'); sl@0: AddExpectedKey(EEventKey,'Y','y'); sl@0: AddExpectedKey(EEventKeyUp,'Y'); sl@0: break; sl@0: case 13: sl@0: //Variation on case 12 i.e. change in the timing of the CancelCaptureKey call sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKey('z',0,0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,'Z'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(5, 2); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); sl@0: DelayForRepeatEvents(5, 2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,'Z'); sl@0: AddExpectedKey(EEventKeyDown,'Z'); sl@0: AddExpectedKey(EEventKey,'Z','z'); sl@0: AddExpectedKey(EEventKey,'Z','z',2); sl@0: AddExpectedKey(EEventKeyUp,'Z'); sl@0: break; sl@0: case 14: sl@0: { sl@0: // Cancel long capture key event when normal capture key is scheduled for different sl@0: // window group. sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ','a',0,0,2,ELongCaptureNormal); sl@0: TInt shortCaptKey = TheClient->iGroup->GroupWin()->CaptureKey(' ',0,0); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: DelayForRepeatEvents(1, 3); sl@0: sl@0: TheClient->iGroup->GroupWin()->CancelCaptureKey(shortCaptKey); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: } sl@0: break; sl@0: case 15: sl@0: // @SYMPREQ 417-61800: Check that long key events are marked with sl@0: // EModifierLongKey and short events are not. sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, 0, ELongCaptureNormal); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'M'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(1, 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'M'); sl@0: AddExpectedKey(EEventKeyDown, 'M', 0, 0, 0); sl@0: AddExpectedKey(EEventKey, 'M', 'm', 0, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, 'M', 0, 0, 0); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 16: sl@0: CheckLongkeyCaptureWithPriority(ELongkeyCaptureDiffPriority); sl@0: break; sl@0: case 17: sl@0: CheckLongkeyCaptureWithPriority(ELongkeyCaptureSamePriority); sl@0: break; sl@0: case 18: sl@0: // Test CaptureLongKey() with flag value ELongCaptureWaitShort sl@0: // when key is not held down long enough to generate a long event. sl@0: // Verify that short event is delivered when the key is released. sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('p', 'p', 0, 0, 0, ELongCaptureWaitShort); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'P'); sl@0: TheClient->iWs.Flush(); sl@0: User::After(iKeyBoardRepeatInitialDelay.Int() / 2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'P'); sl@0: TheClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown, 'P'); sl@0: AddExpectedKey(EEventKey, 'P', 'p', 0, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, 'P'); sl@0: AddExpectedKeyDownUp(EStdKeySpace, ' '); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 19: sl@0: { sl@0: // Cancel a capture key event whilst a repeat is underway for a sl@0: // different capture. This should not cancel repeating. sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('q', 0, 0); sl@0: TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureKey('r', 0, 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'Q'); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKey(captureKey2); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'Q'); sl@0: AddExpectedKey(EEventKeyDown, 'Q'); sl@0: AddExpectedKey(EEventKey, 'Q', 'q', 0, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKey, 'Q', 'q', 2, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, 'Q'); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); sl@0: } sl@0: break; sl@0: case 20: sl@0: { sl@0: // Cancel a long capture key event whilst a repeat is underway for sl@0: // a different capture. This should not cancel repeating. sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('s', 's', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents); sl@0: TInt captureKey2 = iQueueClient->iGroup->GroupWin()->CaptureLongKey('t', 't', 0, 0, 2, ELongCaptureNormal|ELongCaptureRepeatEvents); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'S'); sl@0: TheClient->iWs.Flush(); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(captureKey2); sl@0: DelayForRepeatEvents(5, 1); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'S'); sl@0: AddExpectedKey(EEventKeyDown, 'S'); sl@0: AddExpectedKey(EEventKey, 'S', 's', 0, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKey, 'S', 's', 2, EModifierLongKey | EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, 'S'); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: } sl@0: break; sl@0: case 21: sl@0: { sl@0: // Test CaptureLongKey() with a user specified initial repeat time. sl@0: // Simulate holding down the key for a period shorter than the sl@0: // specified delay. Verify that a long key event is NOT generated. sl@0: // (Note that the period is longer than the default initial repeat sl@0: // time, thus proving that CaptureLongKey() has honoured the delay sl@0: // argument.) sl@0: TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() * 4); sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'u', 'u', 0, 0, 0, ELongCaptureNormal); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'U'); sl@0: TheClient->iWs.Flush(); sl@0: User::After(delay.Int() / 2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'U'); sl@0: TheClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown, 'U'); sl@0: AddExpectedKey(EEventKey, 'U', 'u', 0, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, 'U'); sl@0: AddExpectedKeyDownUp(EStdKeySpace, ' '); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: } sl@0: break; sl@0: case 22: sl@0: { sl@0: // Test CaptureLongKey() with a user specified initial repeat time. sl@0: // Simulate holding down the key for a period longer than the sl@0: // specified delay. Verify that a long key event is generated. sl@0: // (Note that the period is shorter than the default initial repeat sl@0: // time, thus proving that CaptureLongKey() has honoured the delay sl@0: // argument.) sl@0: TTimeIntervalMicroSeconds32 delay(iKeyBoardRepeatInitialDelay.Int() / 4); sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(delay, 'v', 'v', 0, 0, 0, ELongCaptureNormal); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'V'); sl@0: TheClient->iWs.Flush(); sl@0: User::After(delay.Int() * 2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'V'); sl@0: TheClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeySpace); sl@0: AddExpectedKey(EEventKeyDown, 'V'); sl@0: AddExpectedKey(EEventKey, 'V', 'v', 0, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKey, 'V', 'v', 1, EModifierLongKey | EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, 'V'); sl@0: AddExpectedKeyDownUp(EStdKeySpace, ' '); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: } sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: /** Function used for checking CaptureLongKey() works fine with different priorities. sl@0: sl@0: If two window groups have requested capture of the same key with different priorities, sl@0: then the event should be delivered to the group that specified higher priority sl@0: (even if it is in the background). sl@0: sl@0: If two window groups have requested capture of the same key with same priorities, sl@0: then the event should be delivered to the group that requested capture most recently. sl@0: sl@0: @param aTestType Enum value specifying test with same priority or with different priority sl@0: */ sl@0: void CTEventTest::CheckLongkeyCaptureWithPriority(TLongkeyCapPriorityTests aTestType) sl@0: { sl@0: TInt ordinalPriority = TheClient->iGroup->GroupWin()->OrdinalPriority(); sl@0: TInt ordinalPosition = TheClient->iGroup->GroupWin()->OrdinalPosition(); sl@0: // Bring other window group to foreground and request capture with lower/same priority sl@0: // And request capture from iQueueClient group window with higher priority sl@0: TheClient->iGroup->GroupWin()->SetOrdinalPosition(0, 10); sl@0: TInt capKeyFrontWin = TheClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, (aTestType == ELongkeyCaptureDiffPriority ? KLongKeyCaptureLowPriority : KLongKeyCaptureHighPriority), ELongCaptureNormal); sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey('m', 'm', 0, 0, KLongKeyCaptureHighPriority, ELongCaptureNormal); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'M'); sl@0: TheClient->iWs.Flush(); sl@0: DelayForRepeatEvents(1, 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'M'); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: //Note: Button down/up events along with immediate key events are not delivered to iQueueCLient's window group sl@0: //as they are sent to foreground/focused window group sl@0: AddExpectedKey(EEventKey, 'M', 'm', 1, EModifierLongKey | EModifierAutorepeatable); sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: TheClient->iGroup->GroupWin()->CancelCaptureLongKey(capKeyFrontWin); sl@0: TheClient->iGroup->GroupWin()->SetOrdinalPosition(ordinalPosition, ordinalPriority); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: } sl@0: sl@0: /** Function used for delaying current thread so that repeat events can be generated. sl@0: sl@0: It uses iKeyBoardRepeatInitialDelay and iKeyBoardRepeatNextDelay variables to get the desired delay. sl@0: The idea is to wait for initial delay + some extra value so that first repeat is generated. sl@0: For more than one repeat events, wait will be initial delay + next delay + some extra value, and so on. sl@0: sl@0: The extra value is taken as fraction of iKeyBoardRepeatNextDelay. sl@0: sl@0: @param aNumeratorFracVal Numerator value of the fraction. sl@0: @param aDenominatorFracVal Denominator value of the fraction. sl@0: */ sl@0: void CTEventTest::DelayForRepeatEvents(TInt aNumeratorFracVal, TInt aDenominatorFracVal) sl@0: { sl@0: if (!aNumeratorFracVal || !aDenominatorFracVal) sl@0: return; sl@0: User::After(iKeyBoardRepeatInitialDelay.Int() + (iKeyBoardRepeatNextDelay.Int()*aNumeratorFracVal/aDenominatorFracVal)); sl@0: } sl@0: sl@0: #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: void CTEventTest::KeyEventTranslation_NextSetOfEventsL() sl@0: { sl@0: TTimeIntervalMicroSeconds32 initialTime; sl@0: TTimeIntervalMicroSeconds32 time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime, time); sl@0: sl@0: RWindowGroup* wg = iQueueClient->iGroup->GroupWin(); sl@0: sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"KeyEventTranslation SetOfEvents: %d of 5"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: sl@0: switch (iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp('A'); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKeyDownUp('A','a'); sl@0: break; sl@0: case 1: sl@0: // Test key event translation using CaptureKey() sl@0: iCaptureKey = wg->CaptureKey(EKeyDevice0, 0, 0); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeyDevice1); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0); sl@0: AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 0); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0); sl@0: wg->CancelCaptureKey(iCaptureKey); sl@0: break; sl@0: case 2: sl@0: // Test key event translation using CaptureKeyUpAndDowns() sl@0: iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice0, 0, 0); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeyDevice1); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, EStdKeyDevice0, 0, 0); sl@0: AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyDevice0, 0, 0); sl@0: wg->CancelCaptureKeyUpAndDowns(iCaptureKey); sl@0: break; sl@0: case 3: sl@0: // Test key event translation using CaptureLongKey() sl@0: iCaptureKey = wg->CaptureLongKey(EKeyDevice0, EKeyDevice0, 0, 0, 0, ELongCaptureNormal); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice1); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int() + time.Int() / 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice1); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0); sl@0: AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0, EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice0, 1, EModifierLongKey | EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0); sl@0: sl@0: wg->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: case 4: sl@0: // Negative test: check that the capture key code listed in the sl@0: // translation table of the Key Routing Plug-in is not translated sl@0: // in the absence of any capture request for the mapped key. sl@0: iTest->SimulateKeyDownUp(EStdKeyDevice1); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, EStdKeyDevice1, 0, 0); sl@0: AddExpectedKey(EEventKey, EStdKeyDevice1, EKeyDevice1, 0); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyDevice1, 0, 0); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::KeyEventBlocking_NextSetOfEventsL() sl@0: { sl@0: TTimeIntervalMicroSeconds32 initialTime; sl@0: TTimeIntervalMicroSeconds32 time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime, time); sl@0: sl@0: RWindowGroup* wg = iQueueClient->iGroup->GroupWin(); sl@0: sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"KeyEventBlocking SetOfEvents: %d of 5"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: sl@0: switch (iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp('A'); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKeyDownUp('A','a'); sl@0: break; sl@0: case 1: sl@0: // Simulate pressing a blocked key (Device3) while no sl@0: // key capture is in effect. sl@0: iTest->SimulateKeyDownUp(EStdKeyDevice3); sl@0: iTest->SimulateKeyDownUp('B'); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKeyDownUp('B','b'); sl@0: break; sl@0: case 2: sl@0: // Use RWindowGroup::CaptureKey() to capture EKeyDevice3 sl@0: // and simulate pressing the blocked key again. sl@0: iCaptureKey = wg->CaptureKey(EKeyDevice3, 0, 0); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeyDevice3); sl@0: iTest->SimulateKeyDownUp('B'); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 0); sl@0: AddExpectedKeyDownUp('B','b'); sl@0: wg->CancelCaptureKey(iCaptureKey); sl@0: break; sl@0: case 3: sl@0: // Repeat using CaptureKeyUpAndDowns() sl@0: iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyDevice3, 0, 0); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKeyDownUp(EStdKeyDevice3); sl@0: iTest->SimulateKeyDownUp('B'); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, EStdKeyDevice3, 0, 0); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyDevice3, 0, 0); sl@0: AddExpectedKeyDownUp('B','b'); sl@0: wg->CancelCaptureKeyUpAndDowns(iCaptureKey); sl@0: break; sl@0: case 4: sl@0: // Repeat using CaptureLongKey() sl@0: iCaptureKey = wg->CaptureLongKey(EKeyDevice3, EKeyDevice3, 0, 0, 0, ELongCaptureNormal); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyDevice3); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int() + time.Int() / 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyDevice3); sl@0: iTest->SimulateKeyDownUp('B'); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKey, EStdKeyDevice3, EKeyDevice3, 1, EModifierLongKey | EModifierAutorepeatable); sl@0: AddExpectedKeyDownUp('B','b'); sl@0: wg->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::KeyEventAppRestriction_NextSetOfEventsL() sl@0: { sl@0: TTimeIntervalMicroSeconds32 initialTime; sl@0: TTimeIntervalMicroSeconds32 time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime, time); sl@0: sl@0: RWindowGroup* wg = iQueueClient->iGroup->GroupWin(); sl@0: sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"KeyEventAppRestriction SetOfEvents: %d of 4"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: sl@0: switch (iEventSet++) sl@0: { sl@0: case 0: sl@0: // Make window group non-focusable so that it receives only sl@0: // keys that are captured and not those that are default-routed. sl@0: wg->EnableReceiptOfFocus(EFalse); sl@0: iQueueClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: break; sl@0: case 1: sl@0: // Using RWindowGroup::CaptureKey(), attempt to capture a key sl@0: // that is restricted by UID to another application. sl@0: iCaptureKey = wg->CaptureKey(EKeyF20, 0, 0); sl@0: TEST(iCaptureKey == KErrPermissionDenied); sl@0: // Now capture a key that is restricted to the current sl@0: // application's UID and simulate pressing the restricted key. sl@0: iCaptureKey = wg->CaptureKey(EKeyF21, 0, 0); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: // Can't use SimulateKeyDownUp() here due to its check that scan sl@0: // codes are not in the range corresponding to lower case letters sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 0); sl@0: wg->CancelCaptureKey(iCaptureKey); sl@0: break; sl@0: case 2: sl@0: // Repeat using CaptureKeyUpAndDowns() sl@0: iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF20, 0, 0); sl@0: TEST(iCaptureKey == KErrPermissionDenied); sl@0: iCaptureKey = wg->CaptureKeyUpAndDowns(EStdKeyF21, 0, 0); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, EStdKeyF21, 0, 0); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyF21, 0, 0); sl@0: wg->CancelCaptureKeyUpAndDowns(iCaptureKey); sl@0: break; sl@0: case 3: sl@0: // Repeat using CaptureLongKey() sl@0: iCaptureKey = wg->CaptureLongKey(EKeyF20, EKeyF20, 0, 0, 0, ELongCaptureNormal); sl@0: TEST(iCaptureKey == KErrPermissionDenied); sl@0: iCaptureKey = wg->CaptureLongKey(EKeyF21, EKeyF21, 0, 0, 0, ELongCaptureNormal); sl@0: TEST(iCaptureKey >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF21); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int() + time.Int() / 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF21); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKey, EStdKeyF21, EKeyF21, 1, EModifierLongKey | EModifierAutorepeatable); sl@0: wg->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::KeyEventAppPriority_NextSetOfEventsL() sl@0: { sl@0: TTimeIntervalMicroSeconds32 initialTime; sl@0: TTimeIntervalMicroSeconds32 time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime, time); sl@0: sl@0: RWindowGroup* wg = iQueueClient->iGroup->GroupWin(); sl@0: TInt handle1 = 0; sl@0: TInt handle2 = 0; sl@0: TInt handle3 = 0; sl@0: TInt handle4 = 0; sl@0: TInt handle5 = 0; sl@0: TInt handle6 = 0; sl@0: sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"KeyEventAppPriority SetOfEvents: %d of 5"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: sl@0: switch (iEventSet++) sl@0: { sl@0: case 0: sl@0: SpawnCaptureAppL(iCaptureApp1); sl@0: iQueueClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: break; sl@0: case 1: sl@0: // Use RWindowGroup::CaptureKey() to capture EKeyF22 sl@0: // and EKeyF23 with priority 0. Simulate pressing both sl@0: // keys. Since the current application has precedence by UID sl@0: // for capture of EKeyF22, it should receive that key sl@0: // but should not receive EKeyF23. sl@0: handle1 = wg->CaptureKey(EKeyF22, 0, 0); sl@0: handle2 = wg->CaptureKey(EKeyF23, 0, 0); sl@0: TEST(handle1 >= 0); sl@0: TEST(handle2 >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0); sl@0: wg->CancelCaptureKey(handle1); sl@0: wg->CancelCaptureKey(handle2); sl@0: break; sl@0: case 2: sl@0: // Repeat using CaptureKeyUpAndDowns() sl@0: handle1 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0); sl@0: handle2 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0); sl@0: TEST(handle1 >= 0); sl@0: TEST(handle2 >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0); sl@0: wg->CancelCaptureKeyUpAndDowns(handle1); sl@0: wg->CancelCaptureKeyUpAndDowns(handle2); sl@0: break; sl@0: case 3: sl@0: // Repeat using CaptureLongKey() sl@0: handle1 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal); sl@0: handle2 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal); sl@0: TEST(handle1 >= 0); sl@0: TEST(handle2 >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int() + time.Int() / 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int() + time.Int() / 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable); sl@0: wg->CancelCaptureLongKey(handle1); sl@0: wg->CancelCaptureLongKey(handle2); sl@0: break; sl@0: case 4: sl@0: // Repeat with additional capture requests for improved code sl@0: // coverage. (Also verifies that UID-based precedence works even sl@0: // when another app makes the most recent capture request.) sl@0: // Spawn a second capture app so that requests occur in the sl@0: // following order: sl@0: // 1. CaptureApp1, priority 1 (outstanding) sl@0: // 2. Current App, priority 0, precedence by UID sl@0: // 3. CaptureApp2, priority 1 sl@0: // Note that all three capture types are tested together here. sl@0: handle1 = wg->CaptureKey(EKeyF22, 0, 0); sl@0: handle2 = wg->CaptureKey(EKeyF23, 0, 0); sl@0: handle3 = wg->CaptureKeyUpAndDowns(EStdKeyF22, 0, 0); sl@0: handle4 = wg->CaptureKeyUpAndDowns(EStdKeyF23, 0, 0); sl@0: handle5 = wg->CaptureLongKey(EKeyF22, EKeyF22, 0, 0, 0, ELongCaptureNormal); sl@0: handle6 = wg->CaptureLongKey(EKeyF23, EKeyF23, 0, 0, 0, ELongCaptureNormal); sl@0: TEST(handle1 >= 0); sl@0: TEST(handle2 >= 0); sl@0: TEST(handle3 >= 0); sl@0: TEST(handle4 >= 0); sl@0: TEST(handle5 >= 0); sl@0: TEST(handle6 >= 0); sl@0: iQueueClient->iWs.Flush(); sl@0: sl@0: SpawnCaptureAppL(iCaptureApp2); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF22); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int() + time.Int() / 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF22); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, EStdKeyF23); sl@0: TheClient->iWs.Flush(); sl@0: User::After(initialTime.Int() + time.Int() / 3); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, EStdKeyF23); sl@0: TheClient->iWs.Flush(); sl@0: sl@0: AddExpectedKey(EEventKeyDown, EStdKeyF22, 0, 0); sl@0: AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 0); sl@0: AddExpectedKey(EEventKey, EStdKeyF22, EKeyF22, 1, EModifierLongKey | EModifierAutorepeatable); sl@0: AddExpectedKey(EEventKeyUp, EStdKeyF22, 0, 0); sl@0: wg->CancelCaptureKey(handle1); sl@0: wg->CancelCaptureKey(handle2); sl@0: wg->CancelCaptureKeyUpAndDowns(handle3); sl@0: wg->CancelCaptureKeyUpAndDowns(handle4); sl@0: wg->CancelCaptureLongKey(handle5); sl@0: wg->CancelCaptureLongKey(handle6); sl@0: break; sl@0: default: sl@0: iCaptureApp1.Kill(KErrNone); sl@0: iCaptureApp2.Kill(KErrNone); sl@0: iCaptureApp1.Close(); sl@0: iCaptureApp2.Close(); sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: /** sl@0: Spawn another application that will capture the keys EKeyF22 and sl@0: EKeyF23 with high priority. sl@0: sl@0: @param aProcess Process to create sl@0: */ sl@0: void CTEventTest::SpawnCaptureAppL(RProcess& aProcess) sl@0: { sl@0: _LIT(KCaptureApp, "tevent_captureapp.exe"); sl@0: TInt error = aProcess.Create(KCaptureApp, KNullDesC); sl@0: if (error != KErrNone) sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KLog, "Cannot create capture app - error %d"); sl@0: logMessageText.Format(KLog, error); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: User::Leave(error); sl@0: } sl@0: sl@0: // Make rendezvous request to capture app sl@0: TRequestStatus status; sl@0: aProcess.Rendezvous(status); sl@0: aProcess.Resume(); sl@0: sl@0: // Wait for capture app to make its capture requests sl@0: User::WaitForRequest(status); sl@0: TEST(status.Int() == KErrNone); sl@0: } sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: #define PASSWORD_START_OF_DAY 4 sl@0: void CTEventTest::Password_NextSetOfEvents() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordAlwaysTriggerNow); sl@0: iQueueClient->iWs.PasswordEntered(); sl@0: iTest->SimulateKeyDownUp('2'); sl@0: iQueueClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventPassword); sl@0: AddExpectedKeyDownUp('2'); sl@0: break; sl@0: case 1: sl@0: iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADayTriggerNow); sl@0: iQueueClient->iWs.PasswordEntered(); sl@0: iTest->SimulateKeyDownUp('3'); sl@0: iQueueClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventPassword); sl@0: AddExpectedKeyDownUp('3'); sl@0: break; sl@0: case 2: sl@0: { sl@0: TTime time; sl@0: time.HomeTime(); sl@0: TInt day=time.DayNoInMonth(); sl@0: if (day==0) sl@0: day=5; sl@0: time-=TTimeIntervalDays(day); sl@0: time+=TTimeIntervalHours(PASSWORD_START_OF_DAY); sl@0: User::SetHomeTime(time); sl@0: iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADayTriggerNow); sl@0: iQueueClient->iWs.PasswordEntered(); sl@0: iTest->SimulateKeyDownUp('3'); sl@0: iQueueClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventPassword); sl@0: AddExpectedKeyDownUp('3'); sl@0: time+=TTimeIntervalDays(day); sl@0: time-=TTimeIntervalHours(PASSWORD_START_OF_DAY); sl@0: User::SetHomeTime(time); sl@0: } sl@0: break; sl@0: case 3: sl@0: { sl@0: TTime time; sl@0: time.HomeTime(); sl@0: TInt day=time.DayNoInMonth(); sl@0: time-=TTimeIntervalDays(day); sl@0: time+=TTimeIntervalHours(PASSWORD_START_OF_DAY); sl@0: User::SetHomeTime(time); sl@0: iQueueClient->iWin->BaseWin()->PasswordWindow(EPasswordOnceADay); sl@0: iQueueClient->iWs.PasswordEntered(); sl@0: iTest->SimulateEvent(TRawEvent::ESwitchOn); sl@0: iTest->SimulateKeyDownUp('3'); sl@0: iQueueClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventPassword); sl@0: AddExpectedEvent(EEventSwitchOn); sl@0: AddExpectedKeyDownUp('3'); sl@0: time+=TTimeIntervalDays(day); sl@0: time-=TTimeIntervalHours(PASSWORD_START_OF_DAY); sl@0: User::SetHomeTime(time); sl@0: } sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::GroupListChanged_NextSetOfEventsL() sl@0: { sl@0: _LIT(WindowGroup1,"WindowGroupName1"); sl@0: _LIT(WindowGroup2,"WindowGroupName2"); sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: _LIT(TestGroup3,"GroupListEvents3"); sl@0: iQueueClient->EnableGroupListChangeEvents(); sl@0: iEventTestGroup3=new(ELeave) CTWindowGroup(TheClient); sl@0: iEventTestGroup3->ConstructL(); sl@0: iEventTestGroup3->GroupWin()->SetName(TestGroup3); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventFocusLost); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: } sl@0: break; sl@0: case 1: sl@0: { sl@0: _LIT(TestGroup4,"GroupListEvents4"); sl@0: iEventTestGroup4=new(ELeave) CTWindowGroup(TheClient); sl@0: iEventTestGroup4->ConstructL(); sl@0: iEventTestGroup4->GroupWin()->SetName(TestGroup4); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: } sl@0: break; sl@0: case 2: sl@0: iEventTestGroup3->GroupWin()->SetOrdinalPosition(0); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: break; sl@0: case 3: sl@0: iEventTestGroup3->GroupWin()->SetOrdinalPosition(999); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: break; sl@0: case 4: sl@0: iEventTestGroup4->GroupWin()->SetOrdinalPosition(999); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: // Testcase for defect INC135635 sl@0: // Since iWin has OrdinalPosition Zero (the front) clicking on it won't generate an sl@0: // EEventWindowGroupListChanged event as there is no change in the order of the windows sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,11-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(20-EWinPositionX,11-EWinPositionY)); sl@0: SimulatePointer(TRawEvent::EButton1Down,20,11); sl@0: SimulatePointer(TRawEvent::EButton1Up,20,11); sl@0: break; sl@0: case 5: sl@0: iEventTestGroup3->GroupWin()->SetOrdinalPosition(999); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: break; sl@0: case 6: sl@0: iEventTestGroup3->GroupWin()->SetOrdinalPosition(99); sl@0: SimulatePointer(TRawEvent::EButton1Down,20,11); sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup1); sl@0: AddExpectedPointer(TPointerEvent::EButton1Down, TPoint(20-EWinPositionX,11-EWinPositionY)); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: break; sl@0: case 7: sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup2); sl@0: SimulatePointer(TRawEvent::EButton1Up,10,20); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(10-EWinPositionX,20-EWinPositionY)); sl@0: break; sl@0: case 8: sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup1); sl@0: SimulatePointer(TRawEvent::EButton2Down,20,30); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(20-EWinPositionX,30-EWinPositionY)); sl@0: break; sl@0: case 9: sl@0: SimulatePointer(TRawEvent::EButton1Up,15,15); sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup2); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,15-EWinPositionY)); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: break; sl@0: case 10: sl@0: SimulatePointer(TRawEvent::EButton2Down,25,20); sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup2); sl@0: SimulatePointer(TRawEvent::EButton1Up,15,20); sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup1); sl@0: AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(25-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(15-EWinPositionX,20-EWinPositionY)); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: break; sl@0: case 11: sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup1); sl@0: SimulatePointer(TRawEvent::EButton2Down,12,12); sl@0: iEventTestGroup3->GroupWin()->SetName(WindowGroup2); sl@0: SimulatePointer(TRawEvent::EButton1Up,12,12); sl@0: AddExpectedPointer(TPointerEvent::EButton2Down, TPoint(12-EWinPositionX,12-EWinPositionY)); sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: AddExpectedPointer(TPointerEvent::EButton1Up, TPoint(12-EWinPositionX,12-EWinPositionY)); sl@0: break; sl@0: case 12: sl@0: delete iEventTestGroup3; sl@0: iEventTestGroup3=NULL; sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: break; sl@0: case 13: sl@0: delete iEventTestGroup4; sl@0: iEventTestGroup4=NULL; sl@0: AddExpectedEvent(EEventWindowGroupsChanged); sl@0: AddExpectedEvent(EEventWindowGroupListChanged); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: TInt CTEventTest::KeyRepeatTime() const sl@0: { sl@0: TTimeIntervalMicroSeconds32 initialTime; sl@0: TTimeIntervalMicroSeconds32 time; sl@0: TheClient->iWs.GetKeyboardRepeatRate(initialTime,time); sl@0: return(initialTime.Int()); sl@0: } sl@0: sl@0: void CTEventTest::RepeatableKeysL() sl@0: { sl@0: // repeatable key event sl@0: TKeyEvent repKeyEvent; sl@0: repKeyEvent.iCode='J'; sl@0: repKeyEvent.iScanCode=0; sl@0: repKeyEvent.iModifiers=EModifierAutorepeatable; sl@0: repKeyEvent.iRepeats=0; sl@0: sl@0: // non-repeatable key event sl@0: TKeyEvent keyEvent; sl@0: keyEvent.iCode='J'; sl@0: keyEvent.iScanCode=0; sl@0: keyEvent.iModifiers=0; sl@0: keyEvent.iRepeats=0; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event sl@0: TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event sl@0: TheClient->iWs.SimulateKeyEvent(keyEvent); // Create a non-repeatable key event sl@0: TheClient->iWs.Flush(); // Send events sl@0: AddExpectedEvent(EEventFocusGained); // Always get a focus gain at start sl@0: AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above sl@0: AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above sl@0: AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above sl@0: break; sl@0: } sl@0: case 1: sl@0: { sl@0: TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event sl@0: TheClient->iWs.SimulateKeyEvent(keyEvent); // Create a non-repeatable key event sl@0: TheClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); // Create a raw event sl@0: TheClient->iWs.Flush(); sl@0: User::After(KeyRepeatTime()*3/2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); // Create a raw event sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above sl@0: AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above sl@0: AddExpectedKey(EEventKeyDown, 'A'); sl@0: AddExpectedKey(EEventKey,'A','a'); sl@0: AddExpectedKey(EEventKey,'A','a',1); sl@0: AddExpectedKey(EEventKeyUp, 'A'); sl@0: break; sl@0: } sl@0: case 2: sl@0: { sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); // Create a raw event sl@0: TheClient->iWs.Flush(); sl@0: User::After(KeyRepeatTime()*3/2); sl@0: TheClient->iWs.SimulateKeyEvent(repKeyEvent); // Create a repeatable key event sl@0: TheClient->iWs.SimulateKeyEvent(keyEvent); // Create a non-repeatable key event sl@0: TheClient->iWs.Flush(); // Send event sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); // Create a raw event sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, 'A'); sl@0: AddExpectedKey(EEventKey,'A','a'); sl@0: AddExpectedKey(EEventKey,'A','a',1); sl@0: AddExpectedKey(1, repKeyEvent.iScanCode, repKeyEvent.iCode, repKeyEvent.iRepeats, repKeyEvent.iModifiers);// Expect the event that was created above sl@0: AddExpectedKey(1, keyEvent.iScanCode, keyEvent.iCode, keyEvent.iRepeats, keyEvent.iModifiers);// Expect the event that was created above sl@0: AddExpectedKey(EEventKeyUp, 'A'); sl@0: break; sl@0: } sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: CTBlankWindow* CTEventTest::NewBlueForgroundWindowL() sl@0: { sl@0: CTBlankWindow* window; sl@0: window=new (ELeave) CTBlankWindow; sl@0: CleanupStack::PushL(window); sl@0: window->ConstructL(*iQueueClient->iGroup); sl@0: User::LeaveIfError(window->BaseWin()->SetRequiredDisplayMode(EColor256)); sl@0: CleanupStack::Pop(window); sl@0: sl@0: window->SetColor(KRgbBlue); sl@0: window->SetExt(TPoint(40, 40), TSize(40,40)); sl@0: window->BaseWin()->SetOrdinalPosition(0); sl@0: return window; sl@0: } sl@0: sl@0: CTBlankWindow* CTEventTest::NewBlueForgroundWindow() sl@0: { sl@0: CTBlankWindow* window = NULL; sl@0: TRAPD(err, window=NewBlueForgroundWindowL()); sl@0: if (err != KErrNone) sl@0: Failed(); sl@0: return window; sl@0: } sl@0: sl@0: #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: static void CreateSurfaceAttributes(RSurfaceManager::TSurfaceCreationAttributesBuf& aBuffer , const TSize& aSize) sl@0: { sl@0: RSurfaceManager::TSurfaceCreationAttributes& b = aBuffer(); sl@0: sl@0: b.iSize.iWidth = aSize.iWidth; sl@0: b.iSize.iHeight = aSize.iHeight; sl@0: b.iBuffers = 1; // number of buffers in the surface sl@0: b.iPixelFormat = EUidPixelFormatARGB_8888; sl@0: b.iStride = aSize.iWidth * 4; // Number of bytes between start of one line and start of next sl@0: b.iOffsetToFirstBuffer = 0; // way of reserving space before the surface pixel data sl@0: b.iAlignment = 4; // alignment, 1,2,4,8 byte aligned sl@0: b.iContiguous = EFalse; sl@0: b.iMappable = ETrue; sl@0: } sl@0: sl@0: static const TInt KFullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible; sl@0: sl@0: void CTEventTest::SurfaceVisibilityChanged1_NextSetOfEventsL() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: //Setup sl@0: LOG_MESSAGE(_L("case 0")); sl@0: TInt err = iSurfaceManager.Open(); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RSurfaceManager::Open() failed", err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: iVisWins1=NewBlueForgroundWindowL(); sl@0: iVisWins1->Activate(); sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedVisibilityChange(KFullyVisible, iVisWins1); sl@0: break; sl@0: } sl@0: case 1: sl@0: { sl@0: LOG_MESSAGE(_L("case 1")); sl@0: iVisWins2=NewBlueForgroundWindowL(); // will cover iVisWins1 sl@0: iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer sl@0: iVisWins2->Activate(); sl@0: sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1); sl@0: break; sl@0: } sl@0: case 2: sl@0: { sl@0: // This case contains the actual test GRAPHICS-WSERV-2669-0015 sl@0: LOG_MESSAGE(_L("case 2")); sl@0: RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf; sl@0: CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size()); sl@0: sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: TInt err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //iVisWins1 will become visible sl@0: sl@0: AddExpectedVisibilityChange(KFullyVisible, iVisWins1); sl@0: break; sl@0: } sl@0: default: sl@0: LOG_MESSAGE(_L("default")); sl@0: if (!iSurfaceId.IsNull()) sl@0: { sl@0: iSurfaceManager.CloseSurface(iSurfaceId); sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: } sl@0: iSurfaceManager.Close(); sl@0: delete iVisWins1; sl@0: iVisWins1 = NULL; sl@0: delete iVisWins2; sl@0: iVisWins2 = NULL; sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::SurfaceVisibilityChanged2_NextSetOfEventsL() sl@0: { sl@0: switch (iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: //Win1 - bottom window sl@0: //Win2 - middle window with semi-transparent background surface, which totally obscures win1 sl@0: LOG_MESSAGE(_L("case 0")); sl@0: TInt err = iSurfaceManager.Open(); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RSurfaceManager::Open() failed", err); sl@0: User::Leave(err); sl@0: } sl@0: sl@0: iVisWins1 = NewBlueForgroundWindowL(); sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: sl@0: iVisWins2 = NewBlueForgroundWindowL(); sl@0: iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer sl@0: iVisWins2->BaseWin()->EnableVisibilityChangeEvents(); sl@0: sl@0: iVisWins1->Activate(); //obscured sl@0: iVisWins2->Activate(); //visible sl@0: sl@0: // Create surface for background window sl@0: RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf; sl@0: CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size()); sl@0: sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); //win1 and win2 both visible sl@0: sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedVisibilityChange(KFullyVisible, iVisWins2); sl@0: AddExpectedVisibilityChange(KFullyVisible, iVisWins1); sl@0: break; sl@0: } sl@0: case 1: sl@0: { sl@0: //Win3 - opaque top window which obscures win2 and win1 sl@0: LOG_MESSAGE(_L("case 1")); sl@0: iVisWins3 = NewBlueForgroundWindowL(); sl@0: iVisWins3->SetColor(KRgbRed); sl@0: iVisWins3->Activate(); sl@0: sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins2); sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible, iVisWins1); sl@0: break; sl@0: } sl@0: case 2: sl@0: { sl@0: //This case contains the actual test GRAPHICS-WSERV-2669-0016 sl@0: LOG_MESSAGE(_L("case 2")); sl@0: delete iVisWins3; sl@0: iVisWins3 = NULL; sl@0: sl@0: AddExpectedVisibilityChange(KFullyVisible, iVisWins2); sl@0: AddExpectedVisibilityChange(KFullyVisible, iVisWins1); sl@0: break; sl@0: } sl@0: default: sl@0: LOG_MESSAGE(_L("default")); sl@0: if (!iSurfaceId.IsNull()) sl@0: { sl@0: iSurfaceManager.CloseSurface(iSurfaceId); sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: } sl@0: iSurfaceManager.Close(); sl@0: delete iVisWins1; sl@0: iVisWins1 = NULL; sl@0: delete iVisWins2; sl@0: iVisWins2 = NULL; sl@0: delete iVisWins3; sl@0: iVisWins3 = NULL; sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: TInt CTEventTest::GenerateAnEvent(TAny* aEventTest) sl@0: { sl@0: CTEventTest* self = static_cast(aEventTest); sl@0: self->LogMessage(((TText8*)__FILE__), __LINE__,_L("Negative test passed OK - no event was generated.")); sl@0: //Now we must generate an event to get CTQueueTestEvent out of its wait loop sl@0: self->SimulateRepeatEvent(32); sl@0: self->AddExpectedKey(EEventKey, 32); sl@0: return KErrNone; sl@0: } sl@0: sl@0: void CTEventTest::SurfaceVisibilityChanged3_NextSetOfEventsL() sl@0: { sl@0: switch (iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: //Win1 - Bottom window sl@0: //Win2 - Top window with semi-transparent background surface. Does not overlap win1. sl@0: LOG_MESSAGE(_L("case 0")); sl@0: TInt err = iSurfaceManager.Open(); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RSurfaceManager::Open() failed", err); sl@0: User::Leave(err); sl@0: } sl@0: iTimeOutCallback = CPeriodic::NewL(CActive::EPriorityIdle); sl@0: sl@0: iVisWins1 = NewBlueForgroundWindowL(); sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: sl@0: iVisWins2 = NewBlueForgroundWindowL(); sl@0: iVisWins2->BlankWin()->SetColor(); //remove colour to ensure window does not draw to UI layer sl@0: TPoint newPos(iVisWins1->Position() + iVisWins1->Size()); sl@0: iVisWins2->SetPos(newPos); //to not overlap win1 sl@0: sl@0: iVisWins1->Activate(); //upper left sl@0: iVisWins2->Activate(); //lower right sl@0: sl@0: // Create surface for background window sl@0: RSurfaceManager::TSurfaceCreationAttributesBuf surfaceBuf; sl@0: CreateSurfaceAttributes(surfaceBuf, iVisWins2->BaseWin()->Size()); sl@0: sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: err = iSurfaceManager.CreateSurface(surfaceBuf, iSurfaceId); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RSurfaceManager::CreateSurface() error: %d", err); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: err = iVisWins2->BaseWin()->SetBackgroundSurface(iSurfaceId); sl@0: if (err != KErrNone) sl@0: { sl@0: RDebug::Printf("RWindow::SetBackgroundSurface() error: %d", err); sl@0: TEST(EFalse); sl@0: } sl@0: sl@0: iVisWins2->BaseWin()->SetSurfaceTransparency(ETrue); sl@0: sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedVisibilityChange(KFullyVisible, iVisWins1); sl@0: break; sl@0: } sl@0: case 1: sl@0: { sl@0: //This case contains the actual test GRAPHICS-WSERV-2669-0017 sl@0: LOG_MESSAGE(_L("case 1")); sl@0: iVisWins2->SetPos(iVisWins1->Position()); //Win2 now overlaps Win1, but because Win2 has sl@0: //a transparent surface Win1 is still fully visible sl@0: sl@0: //Because we don't expect any events we need to generate one to avoid waiting forever. sl@0: TCallBack timeout(GenerateAnEvent, this); sl@0: iTimeOutCallback->Start(1000000, 10000000, timeout); sl@0: break; sl@0: } sl@0: default: sl@0: LOG_MESSAGE(_L("default")); sl@0: iTimeOutCallback->Cancel(); sl@0: delete iTimeOutCallback; sl@0: iTimeOutCallback = NULL; sl@0: if (!iSurfaceId.IsNull()) sl@0: { sl@0: iSurfaceManager.CloseSurface(iSurfaceId); sl@0: iSurfaceId = TSurfaceId::CreateNullId(); sl@0: } sl@0: iSurfaceManager.Close(); sl@0: delete iVisWins1; sl@0: iVisWins1 = NULL; sl@0: delete iVisWins2; sl@0: iVisWins2 = NULL; sl@0: CActiveScheduler::Stop(); sl@0: return; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: #endif //TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: #endif //SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: sl@0: void CTEventTest::VisibilityChanged_NextSetOfEventsL() sl@0: { sl@0: const TInt fullyVisible = TWsVisibilityChangedEvent::EPartiallyVisible | TWsVisibilityChangedEvent::EFullyVisible; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: //only this case can leave sl@0: { sl@0: iQueueClient->iWin->BackedUpWin()->MaintainBackup(); sl@0: iVisWins1=NewBlueForgroundWindowL(); sl@0: iVisWins2=NewBlueForgroundWindowL(); sl@0: sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: iVisWins1->Activate(); sl@0: iVisWins2->SetColor(KRgbGreen); sl@0: iVisWins2->SetExt(TPoint(80, 80), TSize(120,120)); sl@0: iVisWins2->Activate(); sl@0: sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedVisibilityChange(fullyVisible); sl@0: } sl@0: break; sl@0: case 1: sl@0: iVisWins1->BaseWin()->SetVisible(EFalse); sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); sl@0: break; sl@0: case 2: sl@0: iVisWins1->BaseWin()->SetVisible(ETrue); sl@0: AddExpectedVisibilityChange(fullyVisible); sl@0: break; sl@0: case 3: sl@0: iVisWins2->SetExt(TPoint(0,0), TSize(120,120)); sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); sl@0: break; sl@0: case 4: sl@0: iVisWins2->BaseWin()->SetVisible(EFalse); sl@0: AddExpectedVisibilityChange(fullyVisible); sl@0: break; sl@0: case 5: sl@0: iVisWins2->BaseWin()->SetVisible(ETrue); sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); sl@0: break; sl@0: case 6: sl@0: iVisWins2->SetExt(TPoint(60,60), TSize(120,120)); sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::EPartiallyVisible); sl@0: break; sl@0: case 7: sl@0: iVisWins1->SetExt(TPoint(80,80), TSize(40,40)); sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); sl@0: break; sl@0: case 8: sl@0: iVisWins1->BaseWin()->SetOrdinalPosition(0); sl@0: AddExpectedVisibilityChange(fullyVisible); sl@0: sl@0: if(TransparencySupportedL() != KErrNone) sl@0: { sl@0: iEventSet += 2; //we shall skip set 9,10 as they work with transparency sl@0: } sl@0: break; sl@0: case 9: sl@0: { sl@0: TDisplayMode mode = EColor256; sl@0: iTransWin=CTransWindow::NewL(iQueueClient->iGroup, TRgb(255, 0, 0, 128), TRect(0,0,200,200), &mode); sl@0: iTransWin->CTWin::DrawNow(); sl@0: // it gets put at ordinal position 0 sl@0: iVisWins2->BaseWin()->SetOrdinalPosition(1); sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); sl@0: } sl@0: break; sl@0: case 10: sl@0: iVisWins1->BaseWin()->SetOrdinalPosition(1); sl@0: AddExpectedVisibilityChange(fullyVisible); sl@0: break; sl@0: case 11: sl@0: { sl@0: delete iVisWins1; sl@0: iVisWins1=NULL; sl@0: iVisWins1=NewBlueForgroundWindow(); sl@0: sl@0: iVisWins1->Activate(); sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: sl@0: AddExpectedVisibilityChange(fullyVisible); sl@0: } sl@0: break; sl@0: case 12: sl@0: { sl@0: delete iVisWins1; sl@0: iVisWins1=NULL; sl@0: iVisWins1=NewBlueForgroundWindow(); sl@0: sl@0: iVisWins1->Activate(); sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: iVisWins1->BaseWin()->SetVisible(EFalse); sl@0: sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); sl@0: } sl@0: break; sl@0: case 13: sl@0: { sl@0: delete iVisWins1; sl@0: iVisWins1=NULL; sl@0: iVisWins1=NewBlueForgroundWindow(); sl@0: sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: iVisWins1->Activate(); sl@0: sl@0: AddExpectedVisibilityChange(fullyVisible); sl@0: } sl@0: break; sl@0: case 14: sl@0: { sl@0: delete iVisWins1; sl@0: iVisWins1=NULL; sl@0: iVisWins1=NewBlueForgroundWindow(); sl@0: sl@0: iVisWins1->Activate(); sl@0: iVisWins1->BaseWin()->SetVisible(EFalse); sl@0: iVisWins1->BaseWin()->EnableVisibilityChangeEvents(); sl@0: sl@0: AddExpectedVisibilityChange(TWsVisibilityChangedEvent::ENotVisible); sl@0: } sl@0: break; sl@0: default: sl@0: delete iVisWins1; sl@0: delete iVisWins2; sl@0: iVisWins1 = NULL; sl@0: iVisWins2 = NULL; sl@0: delete iTransWin; sl@0: iTransWin = NULL; sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::CheckTimeStamp_NextSetOfEventsL() sl@0: { sl@0: iQueueClient->EventQueue()->SetCheckTimeStamp(ETrue); sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); // Create a raw event sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); // Create a raw event sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKey(EEventKeyDown,'A'); sl@0: AddExpectedKey(EEventKey,'A','a'); sl@0: AddExpectedKey(EEventKeyUp,'A','a'); sl@0: break; sl@0: case 1: sl@0: { sl@0: _LIT8(KMsgParam,"CheckTimeStamp"); sl@0: TBuf8<0x20> params(KMsgParam); sl@0: TInt err = TheClient->iWs.SendMessageToWindowGroup(iQueueClient->WindowGroupIdentifier(),TUid::Uid(123),params); sl@0: AddExpectedEvent(EEventMessageReady); sl@0: } sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: /** sl@0: * @SYMTestCaseID GRAPHICS-WSERV-0001 sl@0: * sl@0: * @SYMPREQ PREQ525 sl@0: * sl@0: * @SYMTestCaseDesc Test Capture priority of different top most windows in a Group. sl@0: * sl@0: * @SYMTestPriority Critical sl@0: * sl@0: * @SYMTestStatus Implemented sl@0: * sl@0: * @SYMTestActions Create two different top client windows under one parent window sl@0: * in a same window group. Add pointer event by clicking various position on the sl@0: * window and Simulate the pointer event. Change the pointer capture flag, capture sl@0: * priority and simulate the pointer event. sl@0: * sl@0: * @SYMTestExpectedResults In general the expected event and the window server event should sl@0: * match same event handle, type and pointer position for following cases. sl@0: * When pointer capture is disabled and capture priorities are 0, the pointer position on window1 sl@0: * window2 or parent window are same as expected. sl@0: * When pointer capture is enabled and capture priorities are 0, the pointer position on window2(which is top most now) sl@0: * is same as expected. sl@0: * When pointer capture is enabled and capture priorities of win1 is greater than win2 sl@0: * the pointer position on win1 and win2 are same as expected. sl@0: * The combination of above cases should match the general expexted result. sl@0: * sl@0: */ sl@0: void CTEventTest::PointerCapture_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"Pointer Capture SetOfEvents: %d (last=9)"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: //Create two top client windows of same group sl@0: iVisWins1=new (ELeave) CTBlankWindow; sl@0: iVisWins2=new (ELeave) CTBlankWindow; sl@0: iVisWins1->ConstructL(*iQueueClient->iGroup); sl@0: iVisWins2->ConstructL(*iQueueClient->iGroup); sl@0: iVisWins1->SetColor(KRgbBlue); sl@0: iVisWins1->SetExt(iQueueClient->ChildTopLeft(),iQueueClient->ChildSize()); sl@0: iVisWins1->Activate(); sl@0: iVisWins2->SetColor(KRgbGreen); sl@0: iVisWins2->SetExt(iQueueClient->ChildTopLeft()+TPoint(15,15),iQueueClient->ChildSize()); sl@0: iVisWins2->Activate(); sl@0: iQueueClient->iWs.Flush(); sl@0: AddExpectedEvent(EEventFocusGained); sl@0: break; sl@0: case 1: //Pointer capture are disabled and priorities are 0 sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureDisabled); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(0); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureDisabled); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(0); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); //Pointer on the first window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); //Pointer on the second window(overlaping on first window) sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); //Pointer on the second window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25)); //Pointer on the parent window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25)); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 2: //Pointer capture are enabled and priorities are 0 sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(0); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(0); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); //Pointer on the first window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); //Pointer on the second window(overlaping on first window) sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); //Pointer on the second window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); //Pointer on the parent window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 3: //Pointer capture are enabled and priorities of win1 is higher than win2 sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(1); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(0); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 4: //Pointer capture are enabled and priorities of win1 is equal to win2 sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(1); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(1); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 5: //Pointer capture are enabled and priorities of win2 is higher than win1 sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(0); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(1); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 6: //Pointer capture are enabled for all groups and priorities of win1 is higher than win2 sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(1); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(0); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 7: //Pointer capture are enabled and priorities of iWin is higher than the other windows sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(0); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(1); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20)); //Pointer on the parent window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25)); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,80,20); sl@0: SimulatePointer(TRawEvent::EButton1Up,80,20); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 8: //Pointer capture are enabled and priorities of iWin is 0 sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(1); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(0); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20),(TInt)iVisWins2); //Pointer on the parent window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25),(TInt)iVisWins2); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,80,20); sl@0: SimulatePointer(TRawEvent::EButton1Up,80,20); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: case 9: //Pointer capture are enabled and with different groups sl@0: iVisWins1->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); sl@0: iVisWins2->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); sl@0: iVisWins1->BaseWin()->SetPointerCapturePriority(0); sl@0: iVisWins2->BaseWin()->SetPointerCapturePriority(0); sl@0: iQueueClient->iWin->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); sl@0: iQueueClient->iWin->BaseWin()->SetPointerCapturePriority(1); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(25,150),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(25,150),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(150,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(150,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(80,20)); //Pointer on the parent window sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(80,20)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(35,25),(TInt)iVisWins2); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(60,50)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(50,30)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Down,TPoint(75,25)); sl@0: AddExpectedPointerCapture(TPointerEvent::EButton1Up,TPoint(75,25)); sl@0: iQueueClient->iWs.Flush(); sl@0: SimulatePointer(TRawEvent::EButton1Down,25,150); sl@0: SimulatePointer(TRawEvent::EButton1Up,25,150); sl@0: SimulatePointer(TRawEvent::EButton1Down,150,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,150,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,80,20); sl@0: SimulatePointer(TRawEvent::EButton1Up,80,20); sl@0: SimulatePointer(TRawEvent::EButton1Down,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,35,25); sl@0: SimulatePointer(TRawEvent::EButton1Down,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Up,60,50); sl@0: SimulatePointer(TRawEvent::EButton1Down,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Up,50,30); sl@0: SimulatePointer(TRawEvent::EButton1Down,75,25); sl@0: SimulatePointer(TRawEvent::EButton1Up,75,25); sl@0: break; sl@0: default: sl@0: delete iVisWins1; sl@0: delete iVisWins2; sl@0: iVisWins1=NULL; sl@0: iVisWins2=NULL; sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: /** sl@0: PDEF110849 sl@0: Allocate a pointer buffer, send it some events and then disconnect. sl@0: Now fill the event queue, causing a purge. sl@0: The purge will call void CWsPointerBuffer::DiscardPointerMoveBuffer(TUint aHandle) sl@0: in which an access violation occurred because iCurrentBuffer had not been set to NULL. sl@0: */ sl@0: void CTEventTest::PointerBufferPurge_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: TLogMessageText logMessageText; sl@0: _LIT(KSet,"PointerBufferPurge SetOfEvents: %d of 1"); sl@0: logMessageText.Format(KSet,iEventSet); sl@0: TheClient->LogMessage(logMessageText); sl@0: #endif sl@0: iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); sl@0: iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: { sl@0: RWindowBase& win = *iQueueClient->iWin->BaseWin(); sl@0: sl@0: // Cause a connect to happen sl@0: RDebug::Print(_L("PointerBufferPurge - AllocPointerMoveBuffer()")); sl@0: win.AllocPointerMoveBuffer(10, 0); sl@0: sl@0: // Allow pen events to be received sl@0: RDebug::Print(_L("PointerBufferPurge - EnablePointerMoveBuffer()")); sl@0: win.EnablePointerMoveBuffer(); sl@0: sl@0: // Simulate some pen events sl@0: RDebug::Print(_L("PointerBufferPurge - Events")); sl@0: SimulatePointer(TRawEvent::EPointerMove,10,20); sl@0: SimulatePointer(TRawEvent::EButton1Down,10,20); sl@0: SimulatePointer(TRawEvent::EPointerMove,11,21); sl@0: SimulatePointer(TRawEvent::EButton1Up,11,21); sl@0: sl@0: // Disconnect sl@0: RDebug::Print(_L("PointerBufferPurge - FreePointerMoveBuffer()")); sl@0: win.FreePointerMoveBuffer(); sl@0: sl@0: // Send sufficient events to cause a purge to happen sl@0: for (TInt i=0; iiWs.SetAutoFlush(iTheClientFlush); sl@0: iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); sl@0: } sl@0: sl@0: /** sl@0: * @SYMTestCaseID GRAPHICS-WSERV-0025 sl@0: * sl@0: * @SYMDEF DEF085009 sl@0: * sl@0: * @SYMTestCaseDesc Test removal of event handlers mid-way through processing an event. sl@0: * sl@0: * @SYMTestPriority Critical sl@0: * sl@0: * @SYMTestStatus Implemented sl@0: * sl@0: * @SYMTestActions The following tests use RRemovable anim to replicate the removal of sl@0: * event handlers mid-way through processing an event (where an event is offered to each of the sl@0: * listed event handlers). sl@0: * sl@0: * RRemovableAnim is an anim which removes itself from the event handler list sl@0: * after receiving n events, where n is the 'lifetime' of the anim measured in events received. sl@0: * By setting the lifetimes of a number of these anims, we replicate the removal of event handlers sl@0: * mid-way through processing an event. sl@0: * sl@0: * Event set 0: sl@0: * Sends 2 events e1,e2 and expects them be received by wserv event processing. sl@0: * sl@0: * Event set 1: (Simple scenario) sl@0: * Adds 3 removable anims to event handler list sl@0: * Sets lifetimes as {1000,2,5} sl@0: * Sends 6 events sl@0: * Expected events to be received by anims: {6,2,5} sl@0: * sl@0: * Event set 2: (Manual removal and reset state) sl@0: * Manually remove all anims from event handler list sl@0: * Sends 2 events sl@0: * No events expected to be received by anims sl@0: * Resets all anims ready for next test sl@0: * sl@0: * Event set 3: (Removal of multiple anims on receipt of same event) sl@0: * Adds 10 removable anims in event handler list sl@0: * Set lifetimes: {1,5,9,3,8,8,8,10,5,2} sl@0: * Sends 12 events: sl@0: * Expected number of received events for anims: {1,5,9,3,8,8,8,10,5,2} sl@0: * sl@0: * Event set 4: (Manual removal and reset state) sl@0: * Manually remove all anims from event handler list sl@0: * Sends 2 events sl@0: * No events expected to be received by anims sl@0: * Resets all anims ready for next test sl@0: * sl@0: * Event set 5: (Addition of anims to non-empty event handler list, part 1) sl@0: * Adds 6 removable anims in the event handler list sl@0: * Set lifetimes: {1,1,1,5,5,5} sl@0: * Sends 2 events: sl@0: * Expected number of received events for anims: {1,1,1,2,2,2} sl@0: * sl@0: * Event set 6: (Addition of anims to non-empty event handler list, part 2) sl@0: * Readds first 3 anims to event handler list sl@0: * Sets lifetimes of these three anims {13,24,6} sl@0: * Sends 5 events: sl@0: * Expected number of received events for anims: {5,5,5,3,3,3} sl@0: * sl@0: * Event set 7: (Addition of anims to non-empty event handler list, part 3) sl@0: * Sends 16 events: sl@0: * Expected number of received events for anims: {8,16,1,0,0,0} sl@0: * sl@0: * Event set 8: (Manual Removal and reset state) sl@0: * Manually remove all anims from event handler list sl@0: * Sends 2 events sl@0: * No events expected to be received by anims sl@0: * Resets all anims ready for next test sl@0: * sl@0: * Event set 9: (Creating anims which again generate events.) sl@0: * Create 3 anims. One anims generates events in its OfferrawEvent function. sl@0: * Check the funtionality of ProcessRawEvent in Wserv when it is called sl@0: * recursively. Also check the fix for defect INC095892. sl@0: * sl@0: * @SYMTestExpectedResults sl@0: * All events should be received by wserv event processing sl@0: * Each anim should only receive events when (number of events received by anim) <= (lifetime of anim) sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_NextSetOfEventsL() sl@0: { sl@0: #if defined(LOGGING) sl@0: INFO_PRINTF1(_L("EventHandlerRemoval SetOfEvents: (Max=8)")); sl@0: #endif sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: #if defined(LOGGING) sl@0: INFO_PRINTF1(_L("AUTO Event Handler Removal Anim Events")); sl@0: #endif sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L("No anims in event handler list")); sl@0: INFO_PRINTF1(_L(" Send 2 events")); sl@0: INFO_PRINTF1(_L(" - Expected to be received by wserv event processing")); sl@0: #endif sl@0: // Always get a focus gain at start sl@0: AddExpectedEvent(EEventFocusGained); sl@0: // All expected to be received by wserv event processing sl@0: AddExpectedKey(EEventKeyDown,32,ETrue); sl@0: AddExpectedKey(EEventKeyUp,32,ETrue); sl@0: // Send 2 events - none expected to be received by anims, sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,32); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,32); sl@0: // Flush events to wserv sl@0: TheClient->iWs.Flush(); sl@0: // Create all anims for all tests in first event set because sl@0: // first event set is only place where leaving functions can be called sl@0: EventHandlerRemoval_CreateAnimsL(10); sl@0: break; sl@0: case 1: sl@0: { sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Add 3 removable anims to event handler list")); sl@0: INFO_PRINTF1(_L(" Set lifetimes for anims: {1000,2,5}")); sl@0: INFO_PRINTF1(_L(" Send 6 events")); sl@0: INFO_PRINTF1(_L(" - Expected number of received events for anims: {6,2,5}")); sl@0: INFO_PRINTF1(_L(" All events expected to be received by wserv event processing")); sl@0: #endif sl@0: const TInt KLifetimes [] = {1000,2,5}; sl@0: EventHandlerRemoval_PrepareAnims(KLifetimes, 3); sl@0: EventHandlerRemoval_CreateExpectedEvents(6,3); sl@0: // Flush events to wserv sl@0: TheClient->iWs.Flush(); sl@0: // Check each anim has received the expected events sl@0: EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); sl@0: } sl@0: break; sl@0: case 2: sl@0: { sl@0: // Remove all anims, check removal was successful sl@0: // and reset all anims ready for next test sl@0: EventHandlerRemoval_RemoveAndResetAllAnims(); sl@0: } sl@0: break; sl@0: case 3: sl@0: { sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Add 10 removable anims in event handler list")); sl@0: INFO_PRINTF1(_L(" Set lifetimes: {1,5,9,3,8,8,8,10,5,2}")); sl@0: INFO_PRINTF1(_L(" Send 12 events")); sl@0: INFO_PRINTF1(_L(" - Expected number of received events for anims:{1,5,9,3,8,8,8,10,5,2}")); sl@0: INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); sl@0: #endif sl@0: const TInt KLifetimes [] = {1,5,9,3,8,8,8,10,5,2}; sl@0: sl@0: // Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array sl@0: EventHandlerRemoval_PrepareAnims(KLifetimes, 10); sl@0: EventHandlerRemoval_CreateExpectedEvents(12,10); sl@0: // Flush events to wserv sl@0: TheClient->iWs.Flush(); sl@0: // Check each anim has received the expected events sl@0: EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); sl@0: } sl@0: break; sl@0: case 4: sl@0: { sl@0: // Remove all anims, check removal was successful sl@0: // and reset all anims ready for next test sl@0: EventHandlerRemoval_RemoveAndResetAllAnims(); sl@0: } sl@0: break; sl@0: case 5: sl@0: { sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Add 6 removable anims in event handler list")); sl@0: INFO_PRINTF1(_L(" Set lifetimes: {1,1,1,5,5,5}")); sl@0: INFO_PRINTF1(_L(" Send 2 events")); sl@0: INFO_PRINTF1(_L(" - Expected number of received events for anims:{1,1,1,2,2,2}")); sl@0: INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); sl@0: #endif sl@0: const TInt KLifetimes [] = {1,1,1,5,5,5}; sl@0: sl@0: // Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array sl@0: EventHandlerRemoval_PrepareAnims(KLifetimes, 6); sl@0: EventHandlerRemoval_CreateExpectedEvents(2, 6); sl@0: // Flush events to wserv sl@0: TheClient->iWs.Flush(); sl@0: // Check each anim has received the expected events sl@0: EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); sl@0: } sl@0: break; sl@0: case 6: sl@0: { sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Readds first 3 removable anims to event handler list")); sl@0: INFO_PRINTF1(_L(" Set lifetimes of these three anims {13,24,6}")); sl@0: INFO_PRINTF1(_L(" Send 5 events")); sl@0: INFO_PRINTF1(_L(" - Expected number of received events for anims: {5,5,5,3,3,3}")); sl@0: INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); sl@0: #endif sl@0: const TInt KLifetimes [] = {13,24,6}; sl@0: sl@0: // Create anims, set lifetimes, add to event handlers and add to iRemovableAnims array sl@0: EventHandlerRemoval_PrepareAnims(KLifetimes, 3); sl@0: EventHandlerRemoval_CreateExpectedEvents(5, 6); sl@0: // Flush events to wserv sl@0: TheClient->iWs.Flush(); sl@0: // Check each anim has received the expected events sl@0: EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); sl@0: } sl@0: break; sl@0: case 7: sl@0: { sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Send 16 events")); sl@0: INFO_PRINTF1(_L(" - Expected number of received events for anims:{8,16,1,0,0,0}")); sl@0: INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); sl@0: #endif sl@0: EventHandlerRemoval_CreateExpectedEvents(16, 3); sl@0: // Flush events to wserv sl@0: TheClient->iWs.Flush(); sl@0: // Check each anim has received the expected events sl@0: EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); sl@0: } sl@0: break; sl@0: case 8: sl@0: { sl@0: // Remove all anims, check removal was successful sl@0: // and reset all anims ready for next test sl@0: EventHandlerRemoval_RemoveAndResetAllAnims(); sl@0: } sl@0: break; sl@0: case 9: sl@0: EventHandlerRemoval_CheckRecursionOfProcessRawEvent(); sl@0: break; sl@0: case 10: sl@0: EventHandlerRemoval_AddEventHandlerMultipleTimes(); sl@0: break; sl@0: default: sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Test postamble")); sl@0: INFO_PRINTF1(_L(" Destroy anims")); sl@0: #endif sl@0: // Destroy anims sl@0: EventHandlerRemoval_DestroyAllAnims(); sl@0: iRemovableAnims->Close(); sl@0: delete iRemovableAnims; sl@0: iRemovableAnims = NULL; sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: /** sl@0: * Creates an array of aAnimCount anims on heap sl@0: * Assigns array to iRemovableAnims for use in rest of tests sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_CreateAnimsL(TInt aAnimCount) sl@0: { sl@0: RPointerArray* removableAnims = new (ELeave) RPointerArray(); sl@0: CleanupStack::PushL(removableAnims); sl@0: for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++) sl@0: { sl@0: RRemovableAnim* anim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); sl@0: removableAnims->AppendL(anim); sl@0: } sl@0: CleanupStack::Pop(aAnimCount, (*removableAnims)[0]); sl@0: CleanupStack::Pop(removableAnims); sl@0: iRemovableAnims = removableAnims; sl@0: } sl@0: sl@0: /** sl@0: * Sets lifetimes of anims as specified in aLifeTimes sl@0: * Adds anims to event handler list sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_PrepareAnims(const TInt* aLifetimes, TInt aAnimCount) sl@0: { sl@0: for (TInt animIndex = 0; animIndex < aAnimCount; animIndex++) sl@0: { sl@0: RRemovableAnim* anim = (*iRemovableAnims)[animIndex]; sl@0: anim->SetEventHandlerLifetime(aLifetimes[animIndex]); sl@0: anim->AddToEventHandlers(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Creates aEventCount key events to be used in test sl@0: * Adds the expected event aEvent to the first aLiveAnimCount anims sl@0: * Adds expected events observed by the rest of wserv sl@0: * Simulates events on wserv sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_CreateExpectedEvents(TInt aEventCount, TInt aLiveAnimCount) sl@0: { sl@0: RArray events; sl@0: sl@0: // Add expected events to anims sl@0: for (TInt eventCount = 0; eventCount < aEventCount; eventCount++) sl@0: { sl@0: TRawEvent rawEvent; sl@0: TInt scanCode = 33 + eventCount; sl@0: // Alternate key down, key up events. sl@0: if (eventCount%2 == 0) sl@0: { sl@0: rawEvent.Set(TRawEvent::EKeyDown, scanCode); sl@0: } sl@0: else sl@0: { sl@0: rawEvent.Set(TRawEvent::EKeyUp, scanCode); sl@0: } sl@0: EventHandlerRemoval_AddExpectedEvent(rawEvent, aLiveAnimCount); sl@0: events.Append(rawEvent); sl@0: } sl@0: sl@0: // Simulates expected events sl@0: for (TInt eventCount = 0; eventCount < aEventCount; eventCount++) sl@0: { sl@0: TRawEvent event = events[eventCount]; sl@0: iTest->SimulateKey(event.Type(), event.ScanCode()); sl@0: } sl@0: sl@0: events.Close(); sl@0: } sl@0: sl@0: /** sl@0: * Adds the expected event aEvent to the first aLiveAnimCount anims sl@0: * Adds expected event observed by the rest of wserv sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_AddExpectedEvent(TRawEvent aEvent, TInt aLiveAnimCount) sl@0: { sl@0: // Add event to each of the anims sl@0: for (TInt animIndex = 0; animIndex < aLiveAnimCount; animIndex++) sl@0: { sl@0: TInt err = (*iRemovableAnims)[animIndex]->AddExpectedEvent(aEvent); sl@0: } sl@0: TInt eventType = (aEvent.Type() == TRawEvent::EKeyDown ? EEventKeyDown : EEventKeyUp); sl@0: AddExpectedKey(eventType, aEvent.ScanCode(), ETrue); sl@0: } sl@0: sl@0: /** sl@0: * Checks each anim has received the expected events sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_CheckExpectedEventsReceivedByAnims() sl@0: { sl@0: for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) sl@0: { sl@0: if (!(*iRemovableAnims)[animIndex]->TestPassed()) sl@0: { sl@0: Failed(); sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: /** sl@0: * Create three anims. In the first anim's Offer raw event generate two more events sl@0: * which will call recursively the process raw event at the server side. sl@0: * The second and third anims are just removable anims. To simulate the scenario sl@0: * for the defect INC095892. If teh fix for this is defect is not supplied then sl@0: * wserv would panic for this test case. sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_CheckRecursionOfProcessRawEvent() sl@0: { sl@0: iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); sl@0: iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); sl@0: sl@0: // Create 3 anims sl@0: RRemovableAnim* eventRecurAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); sl@0: RRemovableAnim* removableAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); sl@0: RRemovableAnim* eventAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); sl@0: sl@0: // Add these anim as event handlers and set thier respective life time sl@0: eventRecurAnim->AddToEventHandlers(); sl@0: eventRecurAnim->SetEventHandlerLifetime(4); sl@0: sl@0: removableAnim->AddToEventHandlers(); sl@0: removableAnim->SetEventHandlerLifetime(1); sl@0: sl@0: eventAnim->AddToEventHandlers(); sl@0: eventAnim->SetEventHandlerLifetime(2); sl@0: sl@0: TRawEvent rawEvent1; sl@0: TRawEvent rawEvent2; sl@0: TRawEvent rawEvent3; sl@0: rawEvent1.Set(TRawEvent::EKeyDown, 60); sl@0: rawEvent2.Set(TRawEvent::EKeyUp, 34); sl@0: rawEvent3.Set(TRawEvent::EKeyUp, 35); sl@0: sl@0: eventRecurAnim->AddExpectedEvent(rawEvent2); sl@0: eventRecurAnim->AddExpectedEvent(rawEvent3); sl@0: sl@0: removableAnim->AddExpectedEvent(rawEvent2); sl@0: sl@0: eventAnim->AddExpectedEvent(rawEvent2); sl@0: eventAnim->AddExpectedEvent(rawEvent3); sl@0: sl@0: // Add these events to iQueueClient for testing sl@0: AddExpectedKey(EEventKeyUp, 34, ETrue); sl@0: AddExpectedKey(EEventKeyUp, 35, ETrue); sl@0: sl@0: iTest->SimulateKey(rawEvent1.Type(), rawEvent1.ScanCode()); sl@0: sl@0: CleanupStack::PopAndDestroy(3, eventRecurAnim); sl@0: sl@0: TheClient->iWs.SetAutoFlush(iTheClientFlush); sl@0: iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); sl@0: } sl@0: sl@0: /** sl@0: * Manually removes all anims from event handlers array sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_ManuallyRemoveAllAnims() sl@0: { sl@0: // Manually remove all anims from event handler list sl@0: for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) sl@0: { sl@0: (*iRemovableAnims)[animIndex]->RemoveFromEventHandlers(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Manually removes all anims from event handlers array sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_ResetAllAnims() sl@0: { sl@0: // Manually remove all anims from event handler list sl@0: for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) sl@0: { sl@0: (*iRemovableAnims)[animIndex]->Reset(); sl@0: (*iRemovableAnims)[animIndex]->SetEventHandlerLifetime(0); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: * Manually removes all anims from event handler list sl@0: * Sends 2 events sl@0: * Checks that no events have been received by anims sl@0: * Resets all anims ready for next test sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_RemoveAndResetAllAnims() sl@0: { sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Manually remove all anims from event handler list")); sl@0: INFO_PRINTF1(_L(" Send 2 events: none expected to be received by anims")); sl@0: INFO_PRINTF1(_L(" All expected to be received by wserv event processing")); sl@0: #endif sl@0: // Manually remove all anims from event handler list sl@0: EventHandlerRemoval_ManuallyRemoveAllAnims(); sl@0: // All expected to be received by wserv event processing sl@0: AddExpectedKey(EEventKeyDown,32,ETrue); sl@0: AddExpectedKey(EEventKeyUp,32,ETrue); sl@0: // Send 2 events - none expected to be received by anims, sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,32); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,32); sl@0: // Flush events to wserv sl@0: TheClient->iWs.Flush(); sl@0: // Check the anims have not received any events sl@0: EventHandlerRemoval_CheckExpectedEventsReceivedByAnims(); sl@0: #if defined(DETAILED) sl@0: INFO_PRINTF1(_L(" Cleanup before next step")); sl@0: #endif sl@0: // Reset anims sl@0: EventHandlerRemoval_ResetAllAnims(); sl@0: } sl@0: sl@0: /** sl@0: * Destroys all anims in iRemovableAnims sl@0: * Resets iRemovableAnims sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_DestroyAllAnims() sl@0: { sl@0: if (iRemovableAnims) sl@0: { sl@0: // Destroy anims sl@0: for (TInt animIndex = iRemovableAnims->Count() - 1; animIndex >= 0; animIndex--) sl@0: { sl@0: RRemovableAnim* anim = (*iRemovableAnims)[animIndex]; sl@0: if (anim) sl@0: { sl@0: anim->Destroy(); sl@0: } sl@0: } sl@0: iRemovableAnims->Reset(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: SYMTestCaseID GRAPHICS-WSERV-0496 sl@0: sl@0: @SYMDEF DEF133776 sl@0: sl@0: @SYMTestCaseDesc Cancels key captures using all combinations of sl@0: RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Call each of the RWindowGroup::Capture***() APIs followed by sl@0: each of the RWindowGroup::CancelCapture***() APIs. sl@0: RWindowGroup::Capture***() APIs: sl@0: CaptureKey(TUint, TUint, TUint) sl@0: CaptureKey(TUint, TUint, TUint, TInt) sl@0: CaptureKeyUpAndDowns(TUint, TUint, TUint) sl@0: CaptureKeyUpAndDowns(TUint, TUint, TUint, TInt) sl@0: CaptureLongKey(TUint, TUint, TUint, TUint, TInt, TUint) sl@0: CaptureLongKey(TTimeIntervalMicroSeconds32, TUint, TUint, TUint, TUint, TInt, TUint) sl@0: RWindowGroup::CancelCapture***() APIs: sl@0: CancelCaptureKey() sl@0: CancelCaptureKeyUpAndDowns() sl@0: CancelCaptureLongKey() sl@0: sl@0: @SYMTestExpectedResults WServ should handle matched and mismatched Cancel sl@0: and Capture calls without panicking. sl@0: */ sl@0: void CTEventTest::MismatchedCapture_NextSetOfEventsL() sl@0: { sl@0: if (iEventSet == 0) sl@0: AddExpectedEvent(EEventFocusGained); sl@0: sl@0: if (iEventSet < (EMaxCaptureKeyApis*EMaxCancelCaptureKeyApis)) sl@0: { sl@0: TestCaptureAndCancelCapturePair(static_cast(iEventSet%EMaxCaptureKeyApis), static_cast(iEventSet/EMaxCaptureKeyApis)); sl@0: iEventSet++; sl@0: } sl@0: else sl@0: { sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: sl@0: /** Helper function that applies a key capture and then cancels it using the sl@0: passed capture and cancel RWindowGroup APIs. sl@0: sl@0: @param aCaptureApi Enum value specifying the capture API to use sl@0: @param aCancelCaptureApi Enum value specifying the cancel capture API to use sl@0: */ sl@0: void CTEventTest::TestCaptureAndCancelCapturePair(TCaptureKeyApis aCaptureApi, TCancelCaptureKeyApis aCancelCaptureApi) sl@0: { sl@0: #if defined(LOGGING) sl@0: _LIT(KCaptureKey, "CaptureKey"); sl@0: _LIT(KCaptureKeyKeyUpAndDowns, "CaptureKeyKeyUpAndDowns"); sl@0: _LIT(KCaptureLongKey, "CaptureLongKey"); sl@0: _LIT(KCancelCaptureKey, "CancelCaptureKey"); sl@0: _LIT(KCancelCaptureKeyKeyUpAndDowns, "CancelCaptureKeyKeyUpAndDowns"); sl@0: _LIT(KCancelCaptureLongKey, "CancelCaptureLongKey"); sl@0: _LIT(KLog,"TestCaptureAndCancelCapturePair: %S, %S"); sl@0: TPtrC captures[EMaxCaptureKeyApis] = {KCaptureKey(), KCaptureKey(), KCaptureKeyKeyUpAndDowns(), KCaptureKeyKeyUpAndDowns(), KCaptureLongKey(), KCaptureLongKey()}; sl@0: TPtrC cancelCaptures[EMaxCancelCaptureKeyApis] = {KCancelCaptureKey(), KCancelCaptureKeyKeyUpAndDowns(), KCancelCaptureLongKey()}; sl@0: TLogMessageText logMessageText; sl@0: logMessageText.Format(KLog, &captures[aCaptureApi], &cancelCaptures[aCancelCaptureApi]); sl@0: INFO_PRINTF1(logMessageText); sl@0: #endif // LOGGING sl@0: sl@0: // Start a key capture using one of the six RWindowGroup Capture***() APIs sl@0: switch (aCaptureApi) sl@0: { sl@0: case ECaptureKey1: sl@0: case ECaptureKey2: sl@0: // Test RWindowGroup::CaptureKey() sl@0: if (aCaptureApi == ECaptureKey1) sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('A',0,0); sl@0: else sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureKey('A',0,0,1); // priority 1 (default priority is 0) sl@0: iTest->SimulateKey(TRawEvent::EKeyDown, 'A'); sl@0: TheClient->iWs.Flush(); sl@0: User::After(KeyRepeatTime()*3/2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 'A'); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown, 'A'); sl@0: AddExpectedKey(EEventKey,'A','a'); sl@0: AddExpectedKey(EEventKey,'A','a',1); sl@0: AddExpectedKey(EEventKeyUp, 'A'); sl@0: break; sl@0: sl@0: case ECaptureKeyUpAndDowns1: sl@0: case ECaptureKeyUpAndDowns2: sl@0: // Test RWindowGroup::CaptureKeyUpAndDowns() sl@0: if (aCaptureApi == ECaptureKeyUpAndDowns1) sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0); sl@0: else sl@0: iCaptureKey=iQueueClient->iGroup->GroupWin()->CaptureKeyUpAndDowns(EStdKeySpace,0,0,1); // priority 1 (default priority is 0) sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: User::After(KeyRepeatTime()*3/2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' ',1); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: break; sl@0: sl@0: case ECaptureLongKey1: sl@0: case ECaptureLongKey2: sl@0: { sl@0: // Test RWindowGroup::CaptureLongKey() sl@0: TTimeIntervalMicroSeconds32 repeat = KeyRepeatTime(); sl@0: if (aCaptureApi == ECaptureLongKey1) sl@0: { sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(' ', 'a', 0, 0, 2, ELongCaptureNormal); sl@0: } sl@0: else sl@0: { sl@0: repeat = KeyRepeatTime()/2; sl@0: iCaptureKey = iQueueClient->iGroup->GroupWin()->CaptureLongKey(repeat, ' ', 'a', 0, 0, 2, ELongCaptureNormal); sl@0: } sl@0: iQueueClient->iWs.Flush(); sl@0: iTest->SimulateKey(TRawEvent::EKeyDown,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: User::After(KeyRepeatTime()*3/2); sl@0: iTest->SimulateKey(TRawEvent::EKeyUp,EStdKeySpace); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedKey(EEventKeyDown,EStdKeySpace); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,' '); sl@0: AddExpectedKey(EEventKey,EStdKeySpace,'a',1); sl@0: AddExpectedKey(EEventKeyUp,EStdKeySpace); sl@0: } sl@0: break; sl@0: sl@0: default: sl@0: INFO_PRINTF1(_L("Unexpected TCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()")); sl@0: TEST(EFalse); sl@0: break; sl@0: } sl@0: sl@0: if (iCaptureKey) sl@0: { sl@0: // End a capture using one of the three RWindowGroup CancelCapture***() APIs, sl@0: // for each Capture***() API each one of these will be called, therefore there will sl@0: // be one correct CancelCapture***() APIs called and two incorrect CancelCapture***() sl@0: // APIs called for each Capture***() API. sl@0: switch (aCancelCaptureApi) sl@0: { sl@0: case ECancelCaptureKey: sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); sl@0: break; sl@0: case ECancelCaptureKeyUpAndDowns: sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey); sl@0: break; sl@0: case ECancelCaptureLongKey: sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: default: sl@0: INFO_PRINTF1(_L("Unexpected TCancelCaptureKeyApis value passed to CTEventTest::TestCaptureAndCancelCapturePair()")); sl@0: TEST(EFalse); sl@0: break; sl@0: } sl@0: sl@0: // If an mistmatched CancelCapture***() API was called, call the correct one now sl@0: // to make sure the Capture/CancelCapture state is clean before the next test starts sl@0: if ((aCaptureApi/2) != aCancelCaptureApi) sl@0: { sl@0: switch (aCaptureApi) sl@0: { sl@0: case ECaptureKey1: sl@0: case ECaptureKey2: sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKey(iCaptureKey); sl@0: break; sl@0: case ECaptureKeyUpAndDowns1: sl@0: case ECaptureKeyUpAndDowns2: sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(iCaptureKey); sl@0: break; sl@0: case ECaptureLongKey1: sl@0: case ECaptureLongKey2: sl@0: iQueueClient->iGroup->GroupWin()->CancelCaptureLongKey(iCaptureKey); sl@0: break; sl@0: } sl@0: } sl@0: } sl@0: sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: /*void CTEventTest::_NextSetOfEvents() //Template for these functions sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iQueueClient->iWin->WinTreeNode()->; //Set up window sl@0: iQueueClient->iWin->BaseWin()->; sl@0: iQueueClient->iGroup->GroupWin()->; sl@0: iQueueClient->iWs.Flush(); //Make take effect sl@0: SimulateEvent(TRawEvent::); //Create an event sl@0: TheClient->iWs.Flush(); //Send event sl@0: AddExpectedEvent(EEventFocusGained); //Always get a focus gain at start sl@0: AddExpectedEvent(); //Expect the event that was created above sl@0: break; sl@0: case 1: sl@0: iQueueClient->iWs.Flush(); sl@0: SimulateEvent(TRawEvent::); sl@0: TheClient->iWs.Flush(); sl@0: AddExpectedEvent(); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: }*/ sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-CODEBASE-WSERV-0051 sl@0: sl@0: @SYMPREQ PGM027 sl@0: sl@0: @SYMTestCaseDesc Tests SetKeyboardRepeatRate API. sl@0: sl@0: @SYMTestPriority 1 sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions This test tryes to call SetKeyboardRepeatRate with invalid time values\n sl@0: sl@0: @SYMTestExpectedResults KeyRepeatRateNegTest should tests the API SetKeyboardRepeatRate return value\n sl@0: The test should pass and API should return KErrArgument. sl@0: sl@0: */ sl@0: void CTEventTest::KeyRepeatRateNegTest(TInt aInitialRepeat, TInt aRepeat) sl@0: { sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-CODEBASE-WSERV-0051")); sl@0: TInt ret=TheClient->iWs.SetKeyboardRepeatRate(TTimeIntervalMicroSeconds32(aInitialRepeat), TTimeIntervalMicroSeconds32(aRepeat)); sl@0: TEST(ret==KErrArgument); sl@0: TRAPD(err,((CTEventTestStep*)iStep)->RecordTestResultL()); sl@0: if (err!=KErrNone) sl@0: INFO_PRINTF1(_L("Failed to record test result")); sl@0: } sl@0: sl@0: void CTEventTest::RunTestsL(TBool aNeedChildWindows/*=EFalse*/) sl@0: { sl@0: iQueueClient=new(ELeave) CTQueueClient(this); sl@0: iQueueClient->SetScreenNumber(iTest->iScreenNumber); sl@0: iQueueClient->ConstructL(aNeedChildWindows); sl@0: iEventSet=0; sl@0: TRAPD(err,NextSetOfEventsL()); sl@0: if (err!=KErrNone) sl@0: { sl@0: iFailed=ETrue; sl@0: return; sl@0: } sl@0: // sl@0: CActiveScheduler::Start(); sl@0: // sl@0: TInt eventsLeft=iQueueClient->EventQueue()->EventsLeft(); sl@0: if (eventsLeft>0) sl@0: iFailed=ETrue; sl@0: delete iVisWins1; sl@0: iVisWins1 = NULL; sl@0: delete iVisWins2; sl@0: iVisWins2 = NULL; sl@0: delete iQueueClient; sl@0: iQueueClient=NULL; sl@0: } sl@0: sl@0: void CTEventTest::RunTestsRestoreAreaL(TBool aNeedChildWindows) sl@0: { sl@0: TRect area(TheClient->iWs.PointerCursorArea()); sl@0: RunTestsL(aNeedChildWindows); sl@0: TheClient->iWs.SetPointerCursorArea(area); sl@0: } sl@0: sl@0: /*void CTEventTest::QueuePurgingL() sl@0: { sl@0: RunTestsL(EFalse); sl@0: } sl@0: sl@0: void CTEventTest::SendEventL() sl@0: { sl@0: RunTestsL(EFalse); sl@0: } sl@0: sl@0: void CTEventTest::InvisibleWindowL() sl@0: { sl@0: RunTestsL(ETrue); sl@0: } sl@0: sl@0: void CTEventTest::JavaAdditionsL() sl@0: { sl@0: RunTestsL(EFalse); sl@0: }*/ sl@0: sl@0: void CTEventTest::WindowCapBugL() sl@0: { sl@0: RunTestsL(ETrue); sl@0: } sl@0: sl@0: /*void CTEventTest::XyInputTypeL() sl@0: { sl@0: RunTestsL(EFalse); sl@0: } sl@0: sl@0: void CTEventTest::MovingPointerCursorL() sl@0: { sl@0: RunTestsRestoreAreaL(ETrue); sl@0: } sl@0: sl@0: void CTEventTest::RotatedModeL() sl@0: { sl@0: RunTestsRestoreAreaL(EFalse); sl@0: }*/ sl@0: sl@0: /** sl@0: * This test creates one anim and calls AddToEventHandlers() twenty times. sl@0: * it shouldn't add the same anim to event handler if anim is already in handler. sl@0: */ sl@0: void CTEventTest::EventHandlerRemoval_AddEventHandlerMultipleTimes() sl@0: { sl@0: iTheClientFlush=TheClient->iWs.SetAutoFlush(ETrue); sl@0: iQuequeClientFlush=iQueueClient->iWs.SetAutoFlush(ETrue); sl@0: sl@0: RRemovableAnim* eventTestAnim = RRemovableAnim::NewLC(iQueueClient->iWin->BaseWin(), iAnimDll); sl@0: sl@0: // Call AddToEventHandlers() on same anim 20 times, it should add this anim in event handler only once sl@0: for (TInt count = 0; count < 20; count++) sl@0: eventTestAnim->AddToEventHandlers(); sl@0: eventTestAnim->SetEventHandlerLifetime(1); sl@0: sl@0: TRawEvent rawEvent1; sl@0: rawEvent1.Set(TRawEvent::EKeyUp, 34); sl@0: sl@0: eventTestAnim->AddExpectedEvent(rawEvent1); sl@0: sl@0: // Add these events to iQueueClient for testing sl@0: AddExpectedKey(EEventKeyUp, 34, ETrue); sl@0: sl@0: iTest->SimulateKey(TRawEvent::EKeyUp, 34); sl@0: sl@0: CleanupStack::PopAndDestroy(eventTestAnim); sl@0: TheClient->iWs.SetAutoFlush(iTheClientFlush); sl@0: iQueueClient->iWs.SetAutoFlush(iQuequeClientFlush); sl@0: } sl@0: sl@0: void CTEventTest::EventQueuePtrCrashTest() sl@0: // Code designed to hit the defect reported in INC109199 & INC105430, needs a very specific sequence of sl@0: // events and client disconnections to hit the exact problem state. sl@0: { sl@0: const TInt KNumTestEvents=6; sl@0: const TInt KMaxNumTestEvents=16; sl@0: // Number of iterations needs to be as high as the queue granularity to make sure at least sl@0: // once around we actually hit the code to change the queue size sl@0: const TInt KNumEvTestIterations=4; sl@0: const TInt KNumBaseTestSessions=KNumEvTestIterations+1; sl@0: const TInt KNumMainTestSessions=13; sl@0: const TInt KMaxNumSessions=KNumBaseTestSessions+KNumMainTestSessions+KNumEvTestIterations; sl@0: RWsSession wsSessions[KMaxNumSessions]; sl@0: RWindowGroup wGroups[KMaxNumSessions]; sl@0: for(TInt iterationLoop=0;iterationLoop=KNumBaseTestSessions) sl@0: { sl@0: TWsEvent event; sl@0: for(TInt evLoop=0;evLoopiWs.SendEventToWindowGroup(groupWin[0].Identifier(),event); sl@0: TheClient->iWs.SendEventToWindowGroup(groupWin[1].Identifier(),event); sl@0: } sl@0: sl@0: //To create a new client, although the queue is full, wserv will guarantee to initialize sl@0: //the queue size of the new queue to at least EMinQueueSize. So that it can response to sl@0: //the event. sl@0: RWsSession testWsSession; sl@0: RWindowGroup testGroupWin; sl@0: TRequestStatus testStatus; sl@0: if (aEventReadyCancel) sl@0: { sl@0: //Simulate the heap allocation failure to test expanding spaces by purge sl@0: //events from inactive clients when initialize queue size. sl@0: TInt failAt = 1; sl@0: TInt err; sl@0: do { sl@0: TheClient->iWs.HeapSetFail(RHeap::EFailNext, failAt++); sl@0: TheClient->iWs.Flush(); sl@0: err = testWsSession.Connect(); sl@0: TheClient->iWs.HeapSetFail(RHeap::ENone, 1); sl@0: } while (err == KErrNoMemory); sl@0: User::LeaveIfError(err); sl@0: } sl@0: else sl@0: { sl@0: User::LeaveIfError(testWsSession.Connect()); sl@0: } sl@0: CleanupClosePushL(testWsSession); sl@0: testGroupWin = RWindowGroup(testWsSession); sl@0: User::LeaveIfError(testGroupWin.Construct(cliHanGrpWin++)); sl@0: CleanupClosePushL(testGroupWin); sl@0: sl@0: //Send events to the newly created client. sl@0: // The Debug version of WServ puts a EEventFocusGained into the event sl@0: // before this test's custom event, so leave one slot in the queue sl@0: // for it. sl@0: #if (defined _DEBUG) sl@0: TInt testEventCount = EMinQueueSize - 1; sl@0: #else sl@0: TInt testEventCount = EMinQueueSize; sl@0: #endif sl@0: for(TInt evLoop = 0; evLoop < testEventCount; evLoop++) sl@0: { sl@0: event.SetType(3001 + evLoop); sl@0: TheClient->iWs.SendEventToWindowGroup(testGroupWin.Identifier(),event); sl@0: } sl@0: sl@0: //Check the event queue. sl@0: //Having a timer here to avoid infinitely wait for event. sl@0: TInt expectedEvent = 3001; sl@0: for(TInt evLoop = 0; evLoop < EMinQueueSize; evLoop++) sl@0: { sl@0: testWsSession.EventReady(&testStatus); sl@0: TRequestStatus timerStatus; sl@0: timer.After(timerStatus, oneSecond); sl@0: User::WaitForRequest(testStatus, timerStatus); sl@0: TEST(testStatus == 0); sl@0: if (testStatus == 0) sl@0: { sl@0: // Tests the event sl@0: testWsSession.GetEvent(event); sl@0: // WServ sometimes puts a EEventFocusGained event into the queue sl@0: // before the test's custom event, so ignore it. sl@0: if (event.Type() != EEventFocusGained) sl@0: { sl@0: TEST(event.Type() == expectedEvent); sl@0: expectedEvent++; sl@0: } sl@0: // testStatus has been completed. Cancel the timer. sl@0: timer.Cancel(); sl@0: User::WaitForRequest(timerStatus); sl@0: } sl@0: else sl@0: { sl@0: // Times out, cancel the event notification sl@0: testWsSession.EventReadyCancel(); sl@0: User::WaitForRequest(testStatus); sl@0: } sl@0: } sl@0: CleanupStack::PopAndDestroy(2*numClients + 2, &wsSession[0]); sl@0: } sl@0: CleanupStack::PopAndDestroy(&timer); sl@0: } sl@0: sl@0: void CTEventTest::SimulateRepeatEvent(TInt aScanCode, TInt aRepeats/*=0*/) sl@0: { sl@0: TRawEvent rawEvent; sl@0: if (aRepeats) sl@0: rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode, aRepeats); sl@0: else sl@0: rawEvent.Set(TRawEvent::EKeyRepeat, aScanCode); sl@0: UserSvr::AddEvent(rawEvent); sl@0: } sl@0: sl@0: void CTEventTest::RawEventRepeatTest_NextSetOfEventsL() sl@0: { sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // Tests EKeyRepeat without repeat value set. sl@0: SimulateRepeatEvent(32); sl@0: sl@0: // Tests EKeyRepeat with repeat value set to 2. sl@0: SimulateRepeatEvent(33,2); sl@0: sl@0: AddExpectedEvent(EEventFocusGained); sl@0: AddExpectedKey(EEventKey, 32); sl@0: AddExpectedKey(EEventKey, 33, 0, 2); sl@0: break; sl@0: default: sl@0: CActiveScheduler::Stop(); sl@0: break; sl@0: } sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: void CTEventTest::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: _LIT(KTest0,"General 1"); sl@0: _LIT(KTest1,"Event queue purging"); sl@0: _LIT(KTest2,"SendEvent"); sl@0: _LIT(KTest3,"SendEventToAll"); sl@0: _LIT(KTest4,"InvisibleWindow"); sl@0: _LIT(KTest5,"JavaAdditions"); sl@0: _LIT(KTest6,"WindowCaptureBug"); sl@0: _LIT(KTest7,"XYInput Types"); sl@0: _LIT(KTest8,"MovingPointerCursor"); sl@0: _LIT(KTest9,"Rotated Modes"); sl@0: _LIT(KTest10,"Anim Event"); sl@0: _LIT(KTest11,"Focus Changed"); sl@0: _LIT(KTest12,"On/Off Events"); sl@0: _LIT(KTest13,"Virtual Keyboard"); sl@0: _LIT(KTest14,"Key Clicks"); sl@0: _LIT(KTest15,"Capture Long"); sl@0: _LIT(KTest16,"Password Window"); sl@0: _LIT(KTest17,"Group List Changed"); sl@0: _LIT(KTest18,"Repeatable Key Events"); sl@0: _LIT(KTest19,"Screen Scaling"); sl@0: _LIT(KTest20,"Visibility Changed Events"); sl@0: _LIT(KTest21,"Check Time Stamp Of Events"); sl@0: _LIT(KTest22,"Pointer Capture Priority Events"); sl@0: _LIT(KTest23,"Event Handler Removal"); sl@0: _LIT(KTest24,"Event Queue ptr crash test"); sl@0: _LIT(KTest25,"Mismatched Pointer Events"); sl@0: _LIT(KTest26,"Pointer Buffer Purge"); sl@0: _LIT(KTest27,"TRawEvent test for Repeats"); sl@0: #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: _LIT(KTest28,"Translation of key events by routing plug-in"); sl@0: _LIT(KTest29,"Blocking of key events by routing plug-in"); sl@0: _LIT(KTest30,"App UID based restriction of key capture"); sl@0: _LIT(KTest31,"App UID based routing of key events"); sl@0: #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: _LIT(KTest32,"Transparent Surface Visibility Changed Events 1"); sl@0: _LIT(KTest33,"Transparent Surface Visibility Changed Events 2"); sl@0: _LIT(KTest34,"Transparent Surface Visibility Changed Events 3"); sl@0: #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: _LIT(KTest35A,"Initialize Queue Size without inactive queue"); sl@0: _LIT(KTest35B,"Initialize Queue Size with inactive queue"); sl@0: sl@0: if (!TestBase()->ConfigurationSupportsPointerEventTesting()) sl@0: { sl@0: INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing")); sl@0: TestComplete(); sl@0: return; sl@0: } sl@0: sl@0: //if (iTest->iState==1) iTest->iState=14; //Use this line to skip to a particular test sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch(iTest->iState) sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0053 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Carry out general event tests on WServ sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions General events are sent via WServ sl@0: sl@0: @SYMTestExpectedResults The events are sent without error sl@0: */ sl@0: case 0: sl@0: iTest->LogSubTest(KTest0); sl@0: General(); sl@0: ((CTEventTestStep*)iStep)->SetOverallTestStepID(_L("GRAPHICS-WSERV-0053")); sl@0: //iState=8; sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0054 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Carry out event queue purging sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Purge the event queue sl@0: sl@0: @SYMTestExpectedResults The events queue is purged without error sl@0: */ sl@0: case 1: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0054")); sl@0: iTest->LogSubTest(KTest1); sl@0: RunTestsL(); //QueuePurgingL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0055 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test that events can be sent sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events in WServ sl@0: sl@0: @SYMTestExpectedResults The events are sent without error sl@0: */ sl@0: case 2: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0055")); sl@0: iTest->LogSubTest(KTest2); sl@0: RunTestsL(); //SendEventL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0056 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send an event to all window groups sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send an event to all window groups sl@0: sl@0: @SYMTestExpectedResults The events are sent to all window groups sl@0: without error sl@0: */ sl@0: case 3: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0056")); sl@0: iTest->LogSubTest(KTest3); sl@0: General2(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0057 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events to an invisible window sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events to an invisible window sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 4: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0057")); sl@0: iTest->LogSubTest(KTest4); sl@0: RunTestsL(ETrue); //InvisibleWindowL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0058 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for java additions sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for java additions sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 5: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0058")); sl@0: iTest->LogSubTest(KTest5); sl@0: RunTestsL(); //JavaAdditionsL(); sl@0: break; sl@0: sl@0: case 6: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: iTest->LogSubTest(KTest6); sl@0: //WindowCapBugL(); //Not finished sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0059 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for x and y inputs sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for x and y inputs sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 7: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0059")); sl@0: iTest->LogSubTest(KTest7); sl@0: RunTestsL(); //XyInputTypeL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0060 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for moving pointer cursor sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for moving pointer cursor sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 8: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0060")); sl@0: iTest->LogSubTest(KTest8); sl@0: RunTestsRestoreAreaL(ETrue); //MovingPointerCursorL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0061 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for rotate mode sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for rotate mode sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 9: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0061")); sl@0: iTest->LogSubTest(KTest9); sl@0: RunTestsRestoreAreaL(EFalse); //RotatedModeL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0062 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for an anim event sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for an anim event sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 10: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0062")); sl@0: iTest->LogSubTest(KTest10); sl@0: RunTestsRestoreAreaL(EFalse); //AnimEvent(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0063 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for focus changed sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for focus changed sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 11: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0063")); sl@0: iTest->LogSubTest(KTest11); sl@0: RunTestsL(); //FocusChanged(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0064 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send stop events sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send stop events sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 12: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0064")); sl@0: iTest->LogSubTest(KTest12); sl@0: RunTestsL(ETrue); //StopEvents(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0065 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for the virtual keyboard sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for the virtual keyboard sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 13: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0065")); sl@0: iTest->LogSubTest(KTest13); sl@0: RunTestsL(); //VirtualKeyboard(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0066 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for key clicks sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send stop events sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 14: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0066")); sl@0: iTest->LogSubTest(KTest14); sl@0: { sl@0: TBool changeable; sl@0: if (iClick.IsLoaded(changeable) && !iTest->IsFullRomL()) sl@0: RunTestsL(ETrue); //KeyClicks(); sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0067 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Test RWindowGroup::CaptureLongKey() sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate long key presses and check that long key capture sl@0: and key repeat work as expected. sl@0: sl@0: @SYMTestExpectedResults The correct key events are sent to the window without sl@0: error sl@0: */ sl@0: case 15: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0067")); sl@0: iTest->LogSubTest(KTest15); sl@0: RunTestsL(ETrue); //CaptureLong(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0068 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for activating password sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for activating password sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 16: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0068")); sl@0: iTest->LogSubTest(KTest16); sl@0: if (!iTest->IsFullRomL()) sl@0: RunTestsL(); //Password(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0069 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send events for activating password sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send events for activating password sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 17: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0069")); sl@0: iTest->LogSubTest(KTest17); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0070 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send repeatable key events sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send repeatable key events sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 18: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0070")); sl@0: iTest->LogSubTest(KTest18); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0071 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send Screen Scaling events sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send Screen Scaling events sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 19: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0071")); sl@0: iTest->LogSubTest(KTest19); sl@0: if (iScreenModeTests&EDoScale) sl@0: { sl@0: RunTestsL(); sl@0: } sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0072 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send Visibility Changed events sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send Visibility Changed events sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 20: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0072")); sl@0: iTest->LogSubTest(KTest20); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0073 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Check Time Stamp Of Sent Events sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Check Time Stamp Of Sent Events sl@0: sl@0: @SYMTestExpectedResults The time stamps for the events are correct sl@0: */ sl@0: case 21: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0073")); sl@0: iTest->LogSubTest(KTest21); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0074 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send Pointer Capture Priority Events sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send Pointer Capture Priority Events sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 22: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0074")); sl@0: iTest->LogSubTest(KTest22); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0343 sl@0: sl@0: @SYMDEF DEF081259 sl@0: sl@0: @SYMTestCaseDesc Send Event Handler Removal Events sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Send Event Handler Removal Events sl@0: sl@0: @SYMTestExpectedResults The events are sent to the window without sl@0: error sl@0: */ sl@0: case 23: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0343")); sl@0: iTest->LogSubTest(KTest23); sl@0: RunTestsL(); //EventHandlerRemoval(); sl@0: break; sl@0: case 24: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0565 sl@0: */ sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0565")); sl@0: iTest->LogSubTest(KTest24); sl@0: EventQueuePtrCrashTest(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0496 sl@0: sl@0: @SYMDEF DEF133776 sl@0: sl@0: @SYMTestCaseDesc Cancels key captures using all combinations of sl@0: RWindowGroup::Capture...() and RWindowGroup::Cancel...() APIs. sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Call each of the RWindowGroup::Capture***() APIs followed by sl@0: each of the RWindowGroup::CancelCapture***() APIs. sl@0: RWindowGroup::Capture***() APIs: sl@0: CaptureKey(TUint, TUint, TUint) sl@0: CaptureKey(TUint, TUint, TUint, TInt) sl@0: CaptureKeyUpAndDowns(TUint, TUint, TUint) sl@0: CaptureKeyUpAndDowns(TUint, TUint, TUint, TInt) sl@0: CaptureLongKey(TUint, TUint, TUint, TUint, TInt, TUint) sl@0: CaptureLongKey(TTimeIntervalMicroSeconds32, TUint, TUint, TUint, TUint, TInt, TUint) sl@0: RWindowGroup::CancelCapture***() APIs: sl@0: CancelCaptureKey() sl@0: CancelCaptureKeyUpAndDowns() sl@0: CancelCaptureLongKey() sl@0: sl@0: @SYMTestExpectedResults WServ should handle matched and mismatched Cancel sl@0: and Capture calls without panicking. sl@0: */ sl@0: case 25: sl@0: // Skip this test in debug on the emulator, run it always on hardware as debug ROMs include sl@0: // a release version of the production code that doesn't panic sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0496")); sl@0: #if defined(_DEBUG) && !defined (__MARM__) sl@0: INFO_PRINTF1(_L("Skipping this test in _DEBUG on emulator to avoid debug only panics, see GRAPHICS-WSERV-0497 for the matching panic test")); sl@0: #else sl@0: iTest->LogSubTest(KTest25); sl@0: RunTestsL(); sl@0: #endif sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0444 sl@0: sl@0: @SYMDEF PDEF110849 sl@0: sl@0: @SYMTestCaseDesc Pointer Buffer Exception After Event Queue Purge sl@0: sl@0: @SYMTestPriority High sl@0: sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Connect to pointer buffer, send it some pointer events and disconnect. sl@0: Now send enough events to cause an event queue purge. The purge will sl@0: attempt to empty the pointer buffer, but will fail because we have disconnected. sl@0: sl@0: @SYMTestExpectedResults The purge will realise it does not need to empty the pointer buffer and sl@0: so there will not be an access violation - exception. sl@0: sl@0: */ sl@0: case 26: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0444")); sl@0: iTest->LogSubTest(KTest26); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0484 sl@0: @SYMDEF PDEF120721 sl@0: @SYMTestCaseDesc Window server guarantees to initialize the queue size of the new queue to sl@0: at least EMinQueueSize. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Create multiple clients to connect to window server. sl@0: Send enough events to make the event queue full. sl@0: Create a new client to connect to window server. sl@0: Send events to the new client and test that the new client sl@0: can get the events. sl@0: @SYMTestExpectedResults Window server guarantees to initialize the size of the new event sl@0: queue to EMinQueueSize, so that window server will not lock up sl@0: due to the full of global event queue. sl@0: sl@0: */ sl@0: case 27: sl@0: iTest->LogSubTest(KTest27); sl@0: RunTestsL(); sl@0: break; sl@0: sl@0: #ifndef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0751, GRAPHICS-WSERV-0752, GRAPHICS-WSERV-0753 sl@0: @SYMPREQ 417-61800 sl@0: @SYMTestCaseDesc Test translation of key events by Key Event Routing plug-in sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Use RWindowGroup::CaptureKey() to capture pseudo key sl@0: Device0 (key code EKeyDevice0, scan code EStdKeyDevice0). sl@0: Simulate pressing key Device1. sl@0: Repeat using CaptureKeyUpAndDowns(). sl@0: Repeat using CaptureLongKey(). sl@0: Repeat without any capture requests. sl@0: @SYMTestExpectedResults sl@0: The key event delivered contains the key or scan code for sl@0: Device0, if captured. When using CaptureKey() and sl@0: CaptureLongKey(), only the key code is translated. Using sl@0: CaptureKeyUpAndDowns(), only the scan code is translated. sl@0: sl@0: Note: this test requires an entry in the translation table of the Key Routing sl@0: Plug-in to map Device0 to Device1 at capture request time. sl@0: */ sl@0: case 28: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0751")); sl@0: iTest->LogSubTest(KTest28); sl@0: RunTestsL(); sl@0: break; sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0760, GRAPHICS-WSERV-0761, GRAPHICS-WSERV-0762 sl@0: @SYMPREQ 417-61800 sl@0: @SYMTestCaseDesc Test blocking of key events by Key Event Routing plug-in sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Simulate pressing a blocked key (Device3) while no sl@0: key capture is in effect. sl@0: Use RWindowGroup::CaptureKey() to capture EKeyDevice3 sl@0: and simulate pressing the blocked key again. sl@0: Repeat using CaptureKeyUpAndDowns(). sl@0: Repeat using CaptureLongKey(). sl@0: @SYMTestExpectedResults sl@0: The blocked key event is only delivered when captured and sl@0: is not routed to the focussed window group by default. sl@0: sl@0: Note: this test requires entries in the Blocked Key Table of the Reference sl@0: Key Routing Plug-in for EKeyDevice3 and EStdKeyDevice3. sl@0: */ sl@0: case 29: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0760")); sl@0: iTest->LogSubTest(KTest29); sl@0: RunTestsL(); sl@0: break; sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0754, GRAPHICS-WSERV-0755, GRAPHICS-WSERV-0756 sl@0: @SYMPREQ 417-61800 sl@0: @SYMTestCaseDesc Test application UID-based restriction of key capture by sl@0: Key Event Routing plug-in. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Attempt to capture a key that is restricted by UID sl@0: to another application. sl@0: Use RWindowGroup::CaptureKey() to capture a key that is sl@0: restricted to the current application's UID. sl@0: Simulate pressing the second key. sl@0: Repeat using CaptureKeyUpAndDowns(). sl@0: Repeat using CaptureLongKey(). sl@0: @SYMTestExpectedResults sl@0: Capture of the first key fails with KErrPermissionDenied. sl@0: Capture of the second key succeeds and the key event is sl@0: delivered. sl@0: sl@0: Note: this test requires entries in the Restricted Key Table of the Reference sl@0: Key Routing Plug-in for the chosen keys. sl@0: */ sl@0: case 30: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0754")); sl@0: iTest->LogSubTest(KTest30); sl@0: RunTestsL(); sl@0: break; sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0757, GRAPHICS-WSERV-0758, GRAPHICS-WSERV-0759 sl@0: @SYMPREQ 417-61800 sl@0: @SYMTestCaseDesc Test application UID-based routing of key events by sl@0: Key Event Routing plug-in. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Invoke another application to capture two different keys sl@0: with high priority using each of RWindowGroup::CaptureKey(), sl@0: CaptureKeyUpAndDowns() and CaptureLongKey(). One key of sl@0: each pair has precedence for capture by the current sl@0: application's UID (i.e. this test). sl@0: In the current application, use RWindowGroup::CaptureKey() sl@0: to capture both keys with lower priority. sl@0: Simulate pressing the keys. sl@0: Repeat using CaptureKeyUpAndDowns(). sl@0: Repeat using CaptureLongKey(). sl@0: @SYMTestExpectedResults sl@0: The key event with UID-based precedence is delivered to sl@0: the current application but the other key is not. sl@0: sl@0: Note: this test requires entries in the Priority Application Table of the sl@0: Reference Key Routing Plug-in for the chosen key. sl@0: */ sl@0: case 31: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0757")); sl@0: iTest->LogSubTest(KTest31); sl@0: RunTestsL(); sl@0: break; sl@0: sl@0: #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-2669-0015 sl@0: @SYMREQ REQ13202: Possibility for external layers to appear above UI layer sl@0: @SYMTestCaseDesc Window obscured by transparent surface window receives sl@0: (EPartiallyVisible | EFullyVisible) when surface is made semi-transparent. sl@0: @SYMTestPriority 2 sl@0: @SYMPrerequisites Win1 – bottom window sl@0: Win2 – middle window with background surface, which totally obscures win1 sl@0: @SYMTestActions Call SetSurfaceTransparency(ETrue) on win2 sl@0: @SYMTestExpectedResults Win1 receives visibility event sl@0: */ sl@0: case 32: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0015")); sl@0: iTest->LogSubTest(KTest32); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-2669-0016 sl@0: @SYMREQ REQ13202: Possibility for external layers to appear above UI layer sl@0: @SYMTestCaseDesc Window obscured by semi-transparent surface window receives sl@0: (EPartiallyVisible | EFullyVisible) when obscuring window is deleted sl@0: @SYMTestPriority 2 sl@0: @SYMPrerequisites Win1 – bottom window sl@0: Win2 – middle window with semi-transparent background surface, which totally obscures win1 sl@0: Win3 – top window which totally obscures win2, and is opaque sl@0: @SYMTestActions Delete win3 sl@0: @SYMTestExpectedResults Both win1 and win2 receive visibility events sl@0: */ sl@0: case 33: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0016")); sl@0: iTest->LogSubTest(KTest33); sl@0: RunTestsL(); sl@0: break; sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-2669-0017 sl@0: @SYMREQ REQ13202: Possibility for external layers to appear above UI layer sl@0: @SYMTestCaseDesc Window does not receive any visibiliy event when a semi-transparent sl@0: surface is moved onto/above it. sl@0: @SYMTestPriority 2 sl@0: @SYMPrerequisites Win1 – bottom window sl@0: Win2 – top window which does not overlap win1 sl@0: @SYMTestActions Move win2 to overlap win1 sl@0: @SYMTestExpectedResults No visibility event is received (win1 is still fully visible) sl@0: */ sl@0: case 34: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-2669-0017")); sl@0: iTest->LogSubTest(KTest34); sl@0: RunTestsL(); sl@0: break; sl@0: #endif // SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: #endif // TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-0559 sl@0: @SYMDEF INC140850 sl@0: @SYMTestCaseDesc To check Wserv passes correct repeat value for TRawEvent of type EKeyRepeat. sl@0: @SYMTestPriority High sl@0: @SYMTestStatus Implemented sl@0: @SYMTestActions Simulate TRawEvent of type EKeyRepeat without Repeat value set. sl@0: Simulate the above with repeat value set to 2. sl@0: @SYMTestExpectedResults Simulated events should match expected events added to the array. sl@0: */ sl@0: sl@0: #ifdef TEST_GRAPHICS_WSERV_TAUTOSERVER_NONNGA sl@0: case 28: sl@0: #else sl@0: #ifdef SYMBIAN_GRAPHICS_WSERV_QT_EFFECTS sl@0: case 35: sl@0: #else sl@0: case 32: sl@0: #endif sl@0: #endif sl@0: // This test was moved to be the last test in the test suite, because it sometimes leaves events in the event queue, sl@0: //it can affect the results of other tests. This test case should be the last test in the test suite. sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0484")); sl@0: iTest->LogSubTest(KTest35A); sl@0: InitializeQueueSizeTestL(EFalse); sl@0: iTest->LogSubTest(KTest35B); sl@0: InitializeQueueSizeTestL(ETrue); sl@0: break; sl@0: sl@0: default: sl@0: ((CTEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: ((CTEventTestStep*)iStep)->CloseTMSGraphicsStep(); sl@0: TestComplete(); sl@0: break; sl@0: } sl@0: ((CTEventTestStep*)iStep)->RecordTestResultL(); sl@0: if (iFailed) sl@0: { sl@0: TEST(EFalse); sl@0: iFailed=EFalse; sl@0: } sl@0: ++iTest->iState; sl@0: } sl@0: sl@0: __WS_CONSTRUCT_STEP__(EventTest) sl@0: