sl@0: // Copyright (c) 2008-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: // Multi pointer and Z-coordinate test code 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 "tmultiptrevent.h" sl@0: #include sl@0: #include sl@0: sl@0: //#define FAILLOG 1 // Uncomment this code to get detailed log sl@0: #define TESTMULTIPOINTER 1 // Comment this line to get detailed log without testing sl@0: sl@0: _LIT(KMultiPtrPluginDll, "multiptrclick.dll"); sl@0: sl@0: const TInt KErrDescSize = 128; sl@0: const TInt KMaxQueueSize = 32; // Queue size of wserv. In any test we cannot test more than MaxQueueSize events. 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: //CTMultiPtrEventBuffer sl@0: CTMultiPtrEventBuffer::CTMultiPtrEventBuffer(RWsSession *aWs, CTMultiPtrEventTest *aTest, CTMultiPtrEventClient* aClient) sl@0: : CTEvent(aWs), iTest(aTest), iClient(aClient) sl@0: { sl@0: } sl@0: sl@0: void CTMultiPtrEventBuffer::ConstructL() sl@0: { sl@0: CTEventBase::Construct(); sl@0: iEventBuffer.SetLengthL(EEventBufferSize); sl@0: iMovePtsBuffer.SetLengthL(EMovePtsBuffer); sl@0: } sl@0: sl@0: void CTMultiPtrEventBuffer::AddExpectedEvent(TWsEvent &aEvent) sl@0: { sl@0: iEventBuffer.Add(&aEvent); sl@0: } sl@0: sl@0: void CTMultiPtrEventBuffer::AddExpectedMovePtEvent(TPoint &aMovePt) sl@0: { sl@0: iMovePtsBuffer.Add(&aMovePt); sl@0: } sl@0: sl@0: TInt CTMultiPtrEventBuffer::EventsRemaining() sl@0: { sl@0: return iEventBuffer.Count(); sl@0: } sl@0: sl@0: void CTMultiPtrEventBuffer::GetMoveBufferAndCompareL() sl@0: { sl@0: TBuf8 buf; sl@0: iClient->ParentWin()->BaseWin()->RetrievePointerMoveBuffer(buf); sl@0: sl@0: TUint bufferSize = buf.Length(); sl@0: TUint numLoop = bufferSize/sizeof(TPoint); sl@0: sl@0: if (iMovePtsBuffer.Count() != numLoop) sl@0: { sl@0: #if defined(FAILLOG) sl@0: TLogMessageText logText; sl@0: _LIT(KPointerNumber, "Actual number of move/drag buffer points from Wserv = %d Expected number of move/drag buffer points = %d "); sl@0: logText.Format(KPointerNumber, numLoop, iMovePtsBuffer.Count()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: TestL(EFalse); sl@0: } sl@0: sl@0: TPoint wsPoint; sl@0: TPoint expPoint; sl@0: TUint8* BasePtr = const_cast(buf.Ptr()); sl@0: for (TUint count = 0; count < numLoop; count++) sl@0: { sl@0: wsPoint = *(reinterpret_cast(BasePtr)); sl@0: iMovePtsBuffer.Remove(&expPoint); sl@0: if (wsPoint != expPoint) sl@0: { sl@0: #if defined(FAILLOG) sl@0: TLogMessageText logText; sl@0: _LIT(KMoveBufferPoint, "Actual move/drag buffer point from Wserv = ([%d], [%d]) Expected move/drag buffer point = ([%d], [%d])"); sl@0: logText.Format(KMoveBufferPoint, wsPoint.iX, wsPoint.iY, expPoint.iX, expPoint.iY); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: TestL(EFalse); sl@0: } sl@0: BasePtr = BasePtr + sizeof(TPoint); sl@0: } sl@0: } sl@0: sl@0: sl@0: #define TESTXL(expr1, oper, expr2, event, expected) \ sl@0: TestL(expr1 oper expr2, expr1, expr2, #oper, #expr1 ## #oper ## #expr2, \ sl@0: event, expected, __FILE__, __LINE__); sl@0: sl@0: // Main function which gets the event, checks with the event in buffer sl@0: // Then calls function NextSetOfEventsL for running other tests of a particualar test case sl@0: void CTMultiPtrEventBuffer::doRunL() sl@0: { sl@0: // Get the event from wserv sl@0: TWsEvent wsEvent; sl@0: iWs->GetEvent(wsEvent); sl@0: sl@0: TWsEvent expectedEvent; sl@0: TInt wsType=wsEvent.Type(); sl@0: if (wsEvent.Type()==EEventNull) sl@0: { sl@0: TESTXL(wsEvent.Handle(), ==, 0, &wsEvent, NULL); sl@0: goto End; sl@0: } sl@0: // This code is for running successive anim test code sl@0: if (wsEvent.Type()==EEventPointer && wsEvent.Pointer()->iType==TPointerEvent::ESwitchOn) sl@0: goto End; sl@0: // if this is called accidentally sl@0: if (iEventBuffer.Count()==0 && wsType==EEventFocusGained) sl@0: goto End; sl@0: sl@0: iEventBuffer.Remove(&expectedEvent); sl@0: iEventCount++; sl@0: sl@0: if (wsEvent.Type() == EEventPointerBufferReady) sl@0: { sl@0: GetMoveBufferAndCompareL(); sl@0: #if defined(FAILLOG) sl@0: TLogMessageText logText; sl@0: _LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d "); sl@0: logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent); sl@0: #endif sl@0: goto End; sl@0: } sl@0: sl@0: // Test wsEvent and expected event have same handle, position and type. sl@0: #if defined(FAILLOG) sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KEventCountCheck, "Checking event number = %d"); sl@0: logText.Format(KEventCountCheck, iEventCount); sl@0: iTest->LOG_MESSAGE(logText); sl@0: _LIT(KEventType, "Actual Event type from Wserv = %d Expected Event Type = %d "); sl@0: logText.Format(KEventType, wsEvent.Type(), expectedEvent.Type()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: } sl@0: #endif sl@0: sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(wsEvent.Type(), ==, expectedEvent.Type(), &wsEvent, &expectedEvent); sl@0: #endif sl@0: // Test pointer number for Enter/Exit events sl@0: if (wsType == EEventPointerEnter || wsType == EEventPointerExit) sl@0: { sl@0: #if defined(FAILLOG) sl@0: TLogMessageText logText; sl@0: _LIT(KPointerNumber, "Actual PointerNumber for Enter/Exit event from Wserv = %d Expected PointerNumber for Enter/Exit event = %d "); sl@0: logText.Format(KPointerNumber, *wsEvent.Int(), *expectedEvent.Int()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(*wsEvent.Int(), ==, *expectedEvent.Int(), &wsEvent, &expectedEvent); sl@0: #endif sl@0: } sl@0: sl@0: // Test only if it is a Pointer event sl@0: if (wsType==EEventPointer) sl@0: { sl@0: TAdvancedPointerEvent* expectedPointerEvent=expectedEvent.Pointer(); sl@0: TAdvancedPointerEvent* actualPointerEvent=wsEvent.Pointer(); sl@0: #if defined(FAILLOG) sl@0: TLogMessageText logText; sl@0: _LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d "); sl@0: logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent); sl@0: #endif sl@0: #if defined(FAILLOG) sl@0: _LIT(KPointerType, "Actual PointerType from Wserv = %d Expected PointerType = %d "); sl@0: logText.Format(KPointerType, actualPointerEvent->iType, expectedPointerEvent->iType); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(actualPointerEvent->iType, ==, expectedPointerEvent->iType, &wsEvent, &expectedEvent); sl@0: #endif sl@0: #if defined(FAILLOG) sl@0: _LIT(KPointerPosition, "Actual PointerPosition from Wserv = (%d, %d) Expected PointerPosition = (%d, %d) "); sl@0: logText.Format(KPointerPosition, actualPointerEvent->iPosition.iX, actualPointerEvent->iPosition.iY, expectedPointerEvent->iPosition.iX, expectedPointerEvent->iPosition.iY); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(actualPointerEvent->iPosition, ==, expectedPointerEvent->iPosition, &wsEvent, &expectedEvent); sl@0: #endif sl@0: #if defined(FAILLOG) sl@0: _LIT(KPointerNumber, "Actual PointerNumber from Wserv = %d Expected PointerNumber = %d "); sl@0: logText.Format(KPointerNumber, actualPointerEvent->PointerNumber(), expectedPointerEvent->PointerNumber()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(actualPointerEvent->PointerNumber(), ==, expectedPointerEvent->PointerNumber(), &wsEvent, &expectedEvent); sl@0: #endif sl@0: #if defined(FAILLOG) sl@0: _LIT(KPointerProximity, "Actual PointerProximity from Wserv = %d Expected PointerProximity = %d "); sl@0: logText.Format(KPointerProximity, actualPointerEvent->Proximity(), expectedPointerEvent->Proximity()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(actualPointerEvent->Proximity(), ==, expectedPointerEvent->Proximity(), &wsEvent, &expectedEvent); sl@0: #endif sl@0: #if defined(FAILLOG) sl@0: _LIT(KPointerPressure, "Actual PointerPressure from Wserv = %d Expected PointerPressure = %d "); sl@0: logText.Format(KPointerPressure, actualPointerEvent->Pressure(), expectedPointerEvent->Pressure()); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL(actualPointerEvent->Pressure(), ==, expectedPointerEvent->Pressure(), &wsEvent, &expectedEvent); sl@0: #endif sl@0: #if defined(FAILLOG) sl@0: _LIT(KPointerModifier, "Actual Modifier value from Wserv = 0x%08x Expected Modfier value = 0x%08x "); sl@0: logText.Format(KPointerModifier, actualPointerEvent->iModifiers, expectedPointerEvent->iModifiers); sl@0: iTest->LOG_MESSAGE(logText); sl@0: #endif sl@0: #if defined(TESTMULTIPOINTER) sl@0: TESTXL((actualPointerEvent->iModifiers&expectedPointerEvent->iModifiers), ==, expectedPointerEvent->iModifiers, &wsEvent, &expectedEvent); sl@0: #endif sl@0: } sl@0: End: sl@0: // Call NextSetOfEvents() only for primary client sl@0: if (iEventBuffer.Count()==0 && !iClient->IsSecondaryClient()) sl@0: { sl@0: iTest->NextSetOfEventsL(); // Cannot Leave sl@0: } sl@0: sl@0: // If this is for secondary client and active scheduler(nested loop) has started, this code stops that scheduler sl@0: if (iEventBuffer.Count()==0 && iClient->IsSecondaryClient() && iNestedLoopStarted) sl@0: { sl@0: iNestedLoopStarted = EFalse; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventBuffer::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: static void DumpEvent(const char *aName, const TWsEvent *aEvent) sl@0: { sl@0: // aEvent may be NULL - if it isn't NULL, we print it's data. sl@0: if (aEvent) sl@0: { sl@0: RDebug::Printf("%s:", aName); sl@0: RDebug::Printf("handle = %u", aEvent->Handle()); sl@0: RDebug::Printf("type() = %d", aEvent->Type()); sl@0: if (aEvent->Type() == EEventPointer) sl@0: { sl@0: TAdvancedPointerEvent *pointer = aEvent->Pointer(); sl@0: RDebug::Printf("pointer type = %d, position = (%d, %d)", sl@0: pointer->iType, pointer->iPosition.iX, pointer->iPosition.iY); sl@0: RDebug::Printf("PointerNumber() = %d, proximity=%d, pressure=%d", sl@0: pointer->PointerNumber(), pointer->Proximity(), pointer->Pressure()); sl@0: RDebug::Printf("modifiers = 0x%08x", pointer->iModifiers); sl@0: } sl@0: else sl@0: { sl@0: RDebug::Printf("Not a pointer event, event type"); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: // aEvent is NULL, just let us know it is. sl@0: RDebug::Printf("%s: is NULL which means not applicapable"); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventBuffer::TestL(TInt aTest, TInt aVal1, TInt aVal2, const char *aOper, const char *aTestStr, sl@0: const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine) sl@0: { sl@0: if (!aTest) sl@0: { sl@0: RDebug::Printf("Expression %d %s %d [%s] (=%d) failed [call from %s:%d]", aVal1, aOper, aVal2, aTestStr, aTest, aFile, aLine); sl@0: DumpEvent("actual", aEvent); sl@0: DumpEvent("expected", aExpected); sl@0: iTest->Failed(); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CTMultiPtrEventBuffer::TestL(TInt aTest, TPoint aVal1, TPoint aVal2, const char *oper, const char *aTestStr, sl@0: const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine) sl@0: { sl@0: if (!aTest) sl@0: { sl@0: RDebug::Printf("Expression (%d, %d) %s (%d, %d) [%s] (=%d) failed [call from %s:%d]", sl@0: aVal1.iX, aVal1.iY, oper, aVal2.iX, aVal2.iY, aTestStr, aTest, aFile, aLine); sl@0: DumpEvent("actual", aEvent); sl@0: DumpEvent("expected", aExpected); sl@0: iTest->Failed(); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: } sl@0: sl@0: //CTMultiPtrEventClient sl@0: CTMultiPtrEventClient::CTMultiPtrEventClient(CTMultiPtrEventTest *aTest, TBool aSecondaryClient) sl@0: : iTest(aTest), iSecondaryClient(aSecondaryClient) sl@0: { sl@0: } sl@0: sl@0: CTMultiPtrEventClient::~CTMultiPtrEventClient() sl@0: { sl@0: if (iWinAutoFocus1 || iWinAutoFocus2 || iGroupWinAutoFocus2 || iGroupWinAutoFocus1) sl@0: { sl@0: DeleteGroupBlankWin(); sl@0: } sl@0: delete iChildWin; sl@0: delete iParentWin; sl@0: } sl@0: sl@0: void CTMultiPtrEventClient::ConstructL() sl@0: { sl@0: CTClient::ConstructL(); sl@0: sl@0: // Create a group window and assign it iGroup sl@0: iGroup = new(ELeave) CTWindowGroup(this); sl@0: iGroup->ConstructL(); sl@0: sl@0: iParentWinSize = iScreen->SizeInPixels(); sl@0: iParentWinPos = TPoint(); sl@0: sl@0: // Change the parent window size and position for secondary client sl@0: if (iSecondaryClient) sl@0: { sl@0: iParentWinSize.iWidth /= 2; sl@0: iParentWinPos.iX = iParentWinSize.iWidth; sl@0: } sl@0: sl@0: // Create window/s for this client so that events can come to this client sl@0: iParentWin=new(ELeave) CTBlankWindow(); sl@0: iParentWin->ConstructL(*iGroup); sl@0: iParentWin->SetExt(iParentWinPos, iParentWinSize); sl@0: iParentWin->SetColor(KRgbRed); sl@0: if (iTest->TestBase()->iState != 12) sl@0: { sl@0: iParentWin->BaseWin()->EnableAdvancedPointers(); sl@0: } sl@0: iParentWin->Activate(); sl@0: sl@0: // Don't create child window for secodary client sl@0: if (!iSecondaryClient) sl@0: { sl@0: iChildWinSize = TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight); sl@0: iChildWinPos = TPoint(iParentWinSize.iWidth/2,0); sl@0: sl@0: iChildWin=new(ELeave) CTBlankWindow(); sl@0: iChildWin->ConstructL(*iGroup); sl@0: iChildWin->SetExt(iChildWinPos, iChildWinSize); sl@0: iChildWin->SetColor(KRgbRed); sl@0: iChildWin->BaseWin()->EnableAdvancedPointers(); sl@0: iChildWin->Activate(); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventClient::CalculatePtrPosAndSet3Ddata(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TUint aModifiers, TInt aZ, TUint8 aPointerNumber, TUint aHandle) sl@0: { sl@0: // If in future you need to change parent position then put this in corresponding if statements sl@0: aEvent.Pointer()->iParentPosition = aPos; sl@0: sl@0: // This is for Auto foreground test sl@0: if (iTest->TestBase()->iState == 11) sl@0: { sl@0: if (TRect(iWinPosAutoFocus1, iWinSizeAutoFocus1).Contains(aPos)) sl@0: { sl@0: aPos -= iWinPosAutoFocus1; sl@0: aEvent.SetHandle((TUint)iWinAutoFocus1); sl@0: } sl@0: else if (TRect(iWinPosAutoFocus2, iWinSizeAutoFocus2).Contains(aPos)) sl@0: { sl@0: aPos -= iWinPosAutoFocus2; sl@0: aEvent.SetHandle((TUint)iWinAutoFocus2); sl@0: } sl@0: goto SETOTHERDATA; sl@0: } sl@0: sl@0: // Here simulated pointer position is w.r.t to 0,0 sl@0: // Actual pointer position is w.r.t windowPosition sl@0: if (iSecondaryClient) sl@0: { sl@0: if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth, iParentWinSize.iHeight)).Contains(aPos)) sl@0: { sl@0: // Since for secondary client parent window is at half of screensize sl@0: aPos -= iParentWinPos; sl@0: aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: // If sent position is on blankWindow then sl@0: if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight)).Contains(aPos)) sl@0: { sl@0: aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle); sl@0: } sl@0: else // else the pointer event occured on child window sl@0: { sl@0: // if aPos < 0 then position has been generated in test code and should not be adjusted sl@0: if (aPos.iX >= 0) sl@0: { sl@0: aPos -= iChildWinPos; sl@0: } sl@0: aEvent.SetHandle((aHandle == 0) ? (TUint)iChildWin : aHandle); sl@0: } sl@0: } sl@0: sl@0: SETOTHERDATA: sl@0: aEvent.Pointer()->iType = aType; sl@0: aEvent.Pointer()->iPosition = aPos; sl@0: if(iExpectNonAdvancedPointerEvents) sl@0: { sl@0: aEvent.Pointer()->iModifiers = aModifiers; sl@0: } sl@0: else sl@0: { sl@0: aEvent.Pointer()->iModifiers = aModifiers|EModifierAdvancedPointerEvent; sl@0: aEvent.SetPointerNumber(aPointerNumber); sl@0: aEvent.SetPointerZ(aZ); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle) sl@0: { sl@0: AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle); sl@0: } sl@0: sl@0: void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle) sl@0: { sl@0: TWsEvent ptrEvent; sl@0: ptrEvent.SetType(EEventPointer); sl@0: if (aType != TPointerEvent::ESwitchOn) sl@0: { sl@0: CalculatePtrPosAndSet3Ddata(ptrEvent, aType, aPos, aModifier, aZ, aPointerNumber, aHandle); sl@0: } sl@0: static_cast(iEventHandler)->AddExpectedEvent(ptrEvent); sl@0: } sl@0: sl@0: void CTMultiPtrEventClient::AddExpectedWsEvent(TEventCode aType, TInt aPointerNumber, TUint aHandle) sl@0: { sl@0: TWsEvent ptrEvent; sl@0: ptrEvent.SetType(aType); sl@0: if (aType == EEventPointerEnter || aType == EEventPointerExit) sl@0: { sl@0: *ptrEvent.Int() = aPointerNumber; sl@0: } sl@0: if (aType == EEventPointerBufferReady) sl@0: { sl@0: ptrEvent.SetHandle(aHandle); sl@0: } sl@0: static_cast(iEventHandler)->AddExpectedEvent(ptrEvent); sl@0: } sl@0: sl@0: void CTMultiPtrEventClient::AddExpectedMovePoint(TPoint aPos) sl@0: { sl@0: static_cast(iEventHandler)->AddExpectedMovePtEvent(aPos); sl@0: } sl@0: sl@0: // Create and store CTMultiPtrEventBuffer in iEventHandler sl@0: void CTMultiPtrEventClient::ConstructEventHandlerL() sl@0: { sl@0: CTMultiPtrEventBuffer* eventBufferAndHandler = new(ELeave) CTMultiPtrEventBuffer(&iWs, iTest, this); sl@0: eventBufferAndHandler->ConstructL(); sl@0: iEventHandler = eventBufferAndHandler; sl@0: } sl@0: sl@0: // Create groupwindow and blank window for AutoFocus tests sl@0: void CTMultiPtrEventClient::ConstructGroupBlankWinL() sl@0: { sl@0: iWinPosAutoFocus1 = TPoint(10,10); sl@0: iWinSizeAutoFocus1 = TSize(40,40); sl@0: sl@0: iWinPosAutoFocus2 = TPoint(50,50); sl@0: iWinSizeAutoFocus2 = TSize(80,80); sl@0: sl@0: iGroupWinAutoFocus1 = new(ELeave) CTWindowGroup(this); sl@0: iGroupWinAutoFocus1->ConstructL(); sl@0: iGroupWinAutoFocus1->GroupWin()->AutoForeground(ETrue); sl@0: iGroupWinAutoFocus1->GroupWin()->EnableFocusChangeEvents(); sl@0: sl@0: iGroupWinAutoFocus2 = new(ELeave) CTWindowGroup(this); sl@0: iGroupWinAutoFocus2->ConstructL(); sl@0: iGroupWinAutoFocus2->GroupWin()->AutoForeground(ETrue); sl@0: iGroupWinAutoFocus2->GroupWin()->EnableFocusChangeEvents(); sl@0: sl@0: iWinAutoFocus1=new(ELeave) CTBlankWindow(); sl@0: iWinAutoFocus1->ConstructL(*iGroupWinAutoFocus1); sl@0: iWinAutoFocus1->SetExt(iWinPosAutoFocus1, iWinSizeAutoFocus1); sl@0: iWinAutoFocus1->SetColor(KRgbDarkYellow); sl@0: iWinAutoFocus1->BaseWin()->EnableAdvancedPointers(); sl@0: iWinAutoFocus1->Activate(); sl@0: sl@0: iWinAutoFocus2=new(ELeave) CTBlankWindow(); sl@0: iWinAutoFocus2->ConstructL(*iGroupWinAutoFocus2); sl@0: iWinAutoFocus2->SetExt(iWinPosAutoFocus2, iWinSizeAutoFocus2); sl@0: iWinAutoFocus2->SetColor(KRgbDarkCyan); sl@0: iWinAutoFocus2->BaseWin()->EnableAdvancedPointers(); sl@0: iWinAutoFocus2->Activate(); sl@0: } sl@0: sl@0: void CTMultiPtrEventClient::DeleteGroupBlankWin() sl@0: { sl@0: delete iWinAutoFocus2; sl@0: iWinAutoFocus2 = NULL; sl@0: delete iGroupWinAutoFocus2; sl@0: iGroupWinAutoFocus2 = NULL; sl@0: delete iWinAutoFocus1; sl@0: iWinAutoFocus1 = NULL; sl@0: delete iGroupWinAutoFocus1; sl@0: iGroupWinAutoFocus1 = NULL; sl@0: } sl@0: sl@0: TBool CTMultiPtrEventClient::CheckOrdinalPosition(TInt aAutoFocusWin) sl@0: { sl@0: if (aAutoFocusWin == 1) sl@0: { sl@0: return iWinAutoFocus1->BaseWin()->OrdinalPosition() == 0; sl@0: } sl@0: else sl@0: { sl@0: return iWinAutoFocus2->BaseWin()->OrdinalPosition() == 0; sl@0: } sl@0: } sl@0: sl@0: //CTMultiPtrEventTest sl@0: CTMultiPtrEventTest::CTMultiPtrEventTest(CTestStep* aStep) sl@0: : CTWsGraphicsBase(aStep) sl@0: { sl@0: } sl@0: sl@0: CTMultiPtrEventTest::~CTMultiPtrEventTest() sl@0: { sl@0: ((CTMultiPtrEventTestStep*)iStep)->CloseTMSGraphicsStep(); sl@0: delete iMultiPtrEventClient; sl@0: DestroyAnimDllAndAnim(); sl@0: if (iPtrPluginLoaded) sl@0: { sl@0: iClick.Unload(); sl@0: } sl@0: iClick.Close(); sl@0: if (iHeap) sl@0: { sl@0: iHeap->Close(); sl@0: iChunk.Close(); sl@0: } sl@0: DeleteGroupWin(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::ConstructL() sl@0: { sl@0: // Here check if the HAL configuration are correct if not then finish the test case sl@0: TInt ret = HAL::Get(HALData::EPointerMaxPointers, iMaxDevPointers); sl@0: if (ret != KErrNone || iMaxDevPointers < 2 || iMaxDevPointers > 8) sl@0: { sl@0: TLogMessageText logText1; sl@0: _LIT(KWrongHALConfig, "HAL configuration are incorrect. \n"); sl@0: logText1.Append(KWrongHALConfig); sl@0: LOG_MESSAGE(logText1); sl@0: TEST(EFalse); sl@0: User::Leave(ret); sl@0: } sl@0: sl@0: // Get the data by using HAL api sl@0: User::LeaveIfError(HAL::Get(HALData::EPointerMaxPointers,iMaxDevPointers)); sl@0: User::LeaveIfError(HAL::Get(HALData::EPointerNumberOfPointers,iMaxUiPointers)); sl@0: User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxPressure, iMaxPressure)); sl@0: User::LeaveIfError(HAL::Get(HALData::EPointer3DPressureStep, iPressureStep)); sl@0: User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxProximity, iMaxProximity)); sl@0: User::LeaveIfError(HAL::Get(HALData::EPointer3DProximityStep, iProximityStep)); 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); sl@0: iPhysicalScreenSize = TheClient->iScreen->SizeInPixels(); sl@0: 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: 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: sl@0: TheClient->iWs.Flush(); sl@0: } sl@0: sl@0: // Create raw event setting type, X, Y, Z and pointernumber for rawevent sl@0: // use UserSvr for simulating the event sl@0: void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber) sl@0: { sl@0: TRawEvent rawEvent; sl@0: rawEvent.Set(aType, aX, aY+iYOffset, aPointerNumber); sl@0: UserSvr::AddEvent(rawEvent); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber) sl@0: { sl@0: TRawEvent rawEvent; sl@0: rawEvent.Set(aType, aX, aY+iYOffset, aZ, aPointerNumber); sl@0: UserSvr::AddEvent(rawEvent); sl@0: } sl@0: sl@0: // Simulate multipointer down and up event sl@0: void CTMultiPtrEventTest::SimulatePointerDownUp(TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, aX, aY, aZ, aPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, aX, aY, aZ, aPointerNumber); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/) 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((TUint)iMultiPtrEventClient->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: iMultiPtrEventClient->EventBuffer()->AddExpectedEvent(event); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/) sl@0: { sl@0: __ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital)); sl@0: AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,aModifiers); sl@0: AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers); sl@0: AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,aModifiers); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle) sl@0: { sl@0: AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle, TBool aSecondaryClient) sl@0: { sl@0: if (aSecondaryClient) sl@0: { sl@0: iSecMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle); sl@0: } sl@0: else sl@0: { sl@0: iMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::SetExpectNonAdvancedPointerEvents(TBool aSecondaryClient) sl@0: { sl@0: if (aSecondaryClient) sl@0: { sl@0: iSecMultiPtrEventClient->SetExpectNonAdvancedPointerEvents(); sl@0: } sl@0: else sl@0: { sl@0: iMultiPtrEventClient->SetExpectNonAdvancedPointerEvents(); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::ClearExpectNonAdvancedPointerEvents(TBool aSecondaryClient) sl@0: { sl@0: if (aSecondaryClient) sl@0: { sl@0: iSecMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents(); sl@0: } sl@0: else sl@0: { sl@0: iMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents(); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedPointerDownUp(TPoint aPos, TInt aZ, TUint8 aPointerNumber) sl@0: { sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPos, aZ, 0, aPointerNumber); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, aZ, 0, aPointerNumber); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedWsEvent(TEventCode aType, TBool aSecondaryClient, TInt aPointerNumber, TUint aHandle) sl@0: { sl@0: if (aSecondaryClient) sl@0: { sl@0: iSecMultiPtrEventClient->AddExpectedWsEvent(aType); sl@0: } sl@0: else sl@0: { sl@0: iMultiPtrEventClient->AddExpectedWsEvent(aType, aPointerNumber, aHandle); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::TestDragForMultiPointer(TPoint aPtrPos, TInt aPrValue, TUint8 aPointerNumber) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, aPtrPos.iX, aPtrPos.iY, aPrValue, aPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, aPtrPos.iX+2, aPtrPos.iY+1, aPrValue, aPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, aPtrPos.iX+2, aPtrPos.iY+1, 0, aPointerNumber); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPtrPos, aPrValue, 0, aPointerNumber); sl@0: aPtrPos.iX += 2; aPtrPos.iY += 1; sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, aPtrPos, aPrValue, 0, aPointerNumber); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPtrPos, 0, 0, aPointerNumber); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::SimulateAndAddLoneUpEvents(TInt aNumSimulation, TInt aNumAddition, TPoint aPos) sl@0: { sl@0: for (TInt count = 0; count < aNumSimulation; count++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, aPos.iX, aPos.iY, 0, 0); sl@0: } sl@0: for (TInt count = 0; count < aNumAddition; count++) sl@0: { sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, 0, 0, 0); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::TestFilteringForMultiPointer(TBool aFiltering) sl@0: { sl@0: TPoint ptrPos; sl@0: TInt ptrNum; sl@0: TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; sl@0: sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: if(!aFiltering) sl@0: { sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, ptrNum); sl@0: } sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: TPoint interPt = ptrPos; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+2, interPt.iY+1, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+4, interPt.iY+2, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+6, interPt.iY+3, 0, ptrNum); sl@0: if(!aFiltering) sl@0: { sl@0: interPt.iX += 6; interPt.iY += 3; sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, ptrNum); sl@0: } sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: interPt = ptrPos; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: interPt.iX += 6; sl@0: interPt.iY += 3; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::TestGrabbingForMultiPointer(TBool aGrabbing) sl@0: { sl@0: TPoint ptrPos; sl@0: TInt ptrNum; sl@0: TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; sl@0: sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); sl@0: ptrPos.iX += xInc/3; // Ensure all Button1Down events are on iParentWin sl@0: ptrPos.iY += yInc/3; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: ptrPos.iX += iPhysicalScreenSize.iWidth/2; // Ensure all Drag and Button1Up events are on iChildWin sl@0: ptrPos.iY += iPhysicalScreenSize.iHeight/2; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: if(aGrabbing) sl@0: { sl@0: // CalculatePtrPosAndSet3Ddata will subtract iChildWinPos from ptrPos if pointer event occured on child window. Thus we add iChildWinPos here. sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin()); sl@0: } sl@0: else sl@0: { sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum); sl@0: } sl@0: ptrPos.iX += xInc/3; sl@0: ptrPos.iY += yInc/3; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: ptrPos.iX += iPhysicalScreenSize.iWidth/2; sl@0: ptrPos.iY += iPhysicalScreenSize.iHeight/2; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: if(aGrabbing) sl@0: { sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin()); sl@0: } sl@0: else sl@0: { sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); sl@0: } sl@0: ptrPos.iX += xInc/3; sl@0: ptrPos.iY += yInc/3; sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::TestCapturingForMultiPointer(TBool aAllWinGroups) sl@0: { sl@0: TPoint ptrPos; sl@0: TInt ptrNum = 0; sl@0: TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; sl@0: sl@0: // These are some typical values which are used only for testing purposes. sl@0: // 20mm to screen sl@0: // 50mm to screen sl@0: // 4N of pressure sl@0: // 2N of pressure sl@0: SetThresholdValues(-20,-50,4000,2000); sl@0: sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerMoveEvents, 0); sl@0: sl@0: if(!aAllWinGroups) sl@0: { sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -30, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -30, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -10, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 5000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, -60, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -60, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin()); sl@0: ptrPos.iX += xInc/3; // Ensure all Pointer events are on iParentWin sl@0: ptrPos.iY += yInc/3; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ptrPos.iX = iPhysicalScreenSize.iWidth/2 + xInc/3; sl@0: ptrPos.iY = 0; sl@0: sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), -10, 0, ptrNum, (TInt)iWinForCapturing); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 5000, 0, ptrNum, (TInt)iWinForCapturing); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing); sl@0: ptrPos.iX += xInc/3; sl@0: ptrPos.iY += yInc/3; sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::SetAutoFlush() sl@0: { sl@0: iTheClientFlush = TheClient->iWs.SetAutoFlush(ETrue); sl@0: iClientFlush = iMultiPtrEventClient->iWs.SetAutoFlush(ETrue); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::ResetFlushStopAS() sl@0: { sl@0: if (iActiveSchedulerStarted) sl@0: { sl@0: iActiveSchedulerStarted = EFalse; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: TheClient->iWs.SetAutoFlush(iTheClientFlush); sl@0: iMultiPtrEventClient->iWs.SetAutoFlush(iClientFlush); sl@0: } sl@0: sl@0: // Common function for all test cases sl@0: void CTMultiPtrEventTest::RunTestsL() sl@0: { sl@0: // Create CTMultiPtrEventClient for each test case and call NextSetOfEventsL() sl@0: iMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this); sl@0: iMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber); sl@0: iMultiPtrEventClient->ConstructL(); sl@0: sl@0: iEventSet=0; sl@0: sl@0: // Create secondary client for test case number 3 sl@0: if (iTest->iState == 3) sl@0: { sl@0: iSecMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this, 1); sl@0: iSecMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber); sl@0: iSecMultiPtrEventClient->ConstructL(); sl@0: } sl@0: sl@0: TRAPD(err, NextSetOfEventsL()); sl@0: if (err != KErrNone) sl@0: { sl@0: iFailed = ETrue; sl@0: } sl@0: sl@0: // Start nested activescheduler if it is not failed for the first attempt sl@0: if (!iFailed) sl@0: { sl@0: iActiveSchedulerStarted = ETrue; sl@0: CActiveScheduler::Start(); sl@0: } sl@0: sl@0: // sl@0: TInt eventsRem = iMultiPtrEventClient->EventBuffer()->EventsRemaining(); sl@0: if (eventsRem > 0) sl@0: { sl@0: iFailed=ETrue; sl@0: } sl@0: sl@0: // Delete secondary client for test case number 3 sl@0: if (iTest->iState == 3) sl@0: { sl@0: delete iSecMultiPtrEventClient; sl@0: iSecMultiPtrEventClient = NULL; sl@0: } sl@0: sl@0: delete iMultiPtrEventClient; sl@0: iMultiPtrEventClient = NULL; sl@0: } sl@0: sl@0: // Common function for all tests sl@0: // Important point to remember is that this function should not leave when running tests sl@0: void CTMultiPtrEventTest::NextSetOfEventsL() sl@0: { sl@0: // For each test case calls its respective tests sl@0: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName); sl@0: switch (iTest->iState) sl@0: { sl@0: case 0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0036 sl@0: */ sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0036")); sl@0: MultiPointerEvents(); sl@0: break; sl@0: case 1: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0014")); sl@0: PurgingMultiPointerEvents(); sl@0: break; sl@0: case 2: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0013")); sl@0: MultiPointerEventsForAnimsL(); sl@0: break; sl@0: case 3: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0011")); sl@0: GetRemainingEventsFromSecondaryClient(); // Does nothing for first time sl@0: MultiClientMultiPointerEvents(); sl@0: break; sl@0: case 4: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0027")); sl@0: MultiPointerEventsForPointerClickL(); sl@0: break; sl@0: case 5: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0028")); sl@0: MultiPointerEventsInDiffScreenModes(); sl@0: break; sl@0: case 6: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0025")); sl@0: FilteringMultiPointerEvents(); sl@0: break; sl@0: case 7: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0021")); sl@0: GrabbingMultiPointerEvents(); sl@0: break; sl@0: case 8: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0031")); sl@0: VirtualKeyBoardForMultiplePointers(); sl@0: break; sl@0: case 9: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0032")); sl@0: DoubleClickForMultiplePointers(); sl@0: break; sl@0: case 10: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0015")); sl@0: MultiPointerOutOfRangeEvents(); sl@0: break; sl@0: case 11: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0026")); sl@0: AutoForeGroundForMultiplePointersL(); sl@0: break; sl@0: case 12: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0029")); sl@0: EmulationRulesForMultiplePointers(); sl@0: break; sl@0: case 13: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034")); sl@0: CloseProximityAndHighPressureEventsL(); sl@0: break; sl@0: case 14: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0017")); sl@0: OutOfBoundValueTesting(); sl@0: break; sl@0: case 15: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0019")); sl@0: CapturingMultiPointerEvents(); sl@0: break; sl@0: case 16: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0035")); sl@0: NegativeTestsForProximityPressureEventsL(); sl@0: break; sl@0: case 17: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034")); sl@0: PointerRepeatEventForMultiplePointers(); sl@0: break; sl@0: // Any new test case should be added here. sl@0: // because some of the above tests use testcase number for certain checks sl@0: default: sl@0: ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName); sl@0: AutoPanic(EAutoPanicWrongTest); sl@0: } sl@0: ((CTMultiPtrEventTestStep*)iStep)->RecordTestResultL(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0033 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends Pointer Repeat Events for all pointers. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate events being passed to the client by implementing each discrete test sl@0: over 4 seperate test cases. sl@0: In the first test case simulate EButton1Down and add event to a TWsEvent buffer. sl@0: In the second test case call RequestPointerRepeatEvent on the base window passing sl@0: in a time interval, a rectangle (the 'hitbox') and pointer number. sl@0: Add EButtonRepeat to TWsEvent buffer. sl@0: In the third test case simulate EPointerMove event within the hitbox, then simulate sl@0: an elapsed period of time longer that specified interval. Add only a EButtonRepeat sl@0: to TWsEvent buffer. sl@0: In the final test case simulate EButton1Up and add event to TWsEvent buffer. sl@0: sl@0: Repeat steps for the second discrete test, however, in the third test case simulate sl@0: EPointerMove event outside the hitbox. In addition add EDrag to TWsEvent buffer sl@0: instead of EButtonRepeat. sl@0: sl@0: A third discrete test will be executed over two test cases and will test sl@0: CancelPointerRepeatEventRequest API. sl@0: sl@0: @SYMTestExpectedResults The received events must match the events added to the buffer except where EPointerMove sl@0: events should be filtered out. In addition, EButtonRepeat will be generated by wserv sl@0: after calling RequestPointerRepeatEvent and time interval specified has elapsed. sl@0: sl@0: */ sl@0: void CTMultiPtrEventTest::PointerRepeatEventForMultiplePointers() sl@0: { sl@0: // Test PointerRepeatEvent for Multiple Pointers sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "PointerRepeatEventForMultiplePointers SetOfEvents: %d of 10"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos; sl@0: TInt ptrNum; sl@0: // Ensure all pointers are on iParentWin sl@0: TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers/3; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers/3; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: // Test cases 0 - 3 represent first discrete test for PointerRepeatEvents sl@0: case 0: sl@0: // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. sl@0: // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. sl@0: INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: case 1: sl@0: // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'. sl@0: INFO_PRINTF1(_L("Simulate PointerRepeatEvent request for all pointers.")); sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum); sl@0: User::After(200000); sl@0: AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: case 2: sl@0: // Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and pointer remaining within the 'hitbox'. sl@0: INFO_PRINTF1(_L("Simulate additional PointerRepeatEvent request for all pointers.")); sl@0: // New coordinates will be used for a simulated EPointerMove. This event will be filtered out, however, EButtonRepeat will occur at new coordinates sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum); sl@0: // EPointerMove event is filtered out by TWsPointer::PointerRepeatPurgeCheck sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: User::After(200000); sl@0: AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: case 3: sl@0: INFO_PRINTF1(_L("Simulate EButton1Up for all pointers.")); sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: // Test cases 4 - 7 represent second second discrete test for PointerRepeatEvents sl@0: case 4: sl@0: // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. sl@0: // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. sl@0: INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: case 5: sl@0: // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'. sl@0: INFO_PRINTF1(_L("Call RequestPointerRepeatEvent for all pointers.")); sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); // hitbox size reduced sl@0: User::After(200000); sl@0: AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: case 6: sl@0: // Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and event remaining within the 'hitbox' rect. sl@0: // EPointerMove will take pointer out of the hitbox so should not be filtered. PointerRepeatEvent should be cancelled. sl@0: INFO_PRINTF1(_L("Simulate a PointerMove event for all pointers to a coordinate outside the hitbox.")); sl@0: // New coordinates will be used for a simulated EPointerMove outisde the hitbox. sl@0: ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc; sl@0: ptrPos.iY = 0; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: User::After(200000); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum); sl@0: } sl@0: break; sl@0: case 7: sl@0: INFO_PRINTF1(_L("Simulate EButton1Up for all pointers.")); sl@0: ptrNum = 0; sl@0: ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc; sl@0: ptrPos.iY = 0; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); sl@0: } sl@0: break; sl@0: // Test cases 8 and 9 represent third discrete test for PointerRepeatEvents sl@0: case 8: sl@0: // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. sl@0: // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. sl@0: INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: case 9: sl@0: // No simulated events. This test case is to explicity call RWindowBase::CancelPointerRepeatEventRequest(const TUint8 aPointerNumber) sl@0: INFO_PRINTF1(_L("Call RequestPointerRepeatEvent and CancelPointerRepeatEventRequest for all pointers.")); sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->CancelPointerRepeatEventRequest(ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: INFO_PRINTF1(_L("Simulate EButton1Up for all pointers.")); sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); sl@0: ptrPos.iX+=xInc; sl@0: ptrPos.iY+=yInc; sl@0: } sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::TestErrorCodeL(TInt aExpErrCode, TInt aActualErrCode) sl@0: { sl@0: if (aExpErrCode != aActualErrCode) sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KError, "Expected Error code = %d Actual Actual Error code %d"); sl@0: logText.AppendFormat(KError, aExpErrCode, aActualErrCode); sl@0: LOG_MESSAGE(logText); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::NegativeTestingOfProximityPressureAPIsL() sl@0: { sl@0: // First send -10 for EnterCloseProximity and -5 for ExitCLoseProximity, it should return KErrArgument sl@0: // Then send 20 and 10 which should return KErrNone sl@0: // Then sent 10 and 20 which should return KErrArgument sl@0: TInt retVal; sl@0: retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-10, -5); sl@0: TestErrorCodeL(KErrArgument, retVal); sl@0: sl@0: retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(20, 10); sl@0: TestErrorCodeL(KErrNone, retVal); sl@0: sl@0: retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(10, 20); sl@0: TestErrorCodeL(KErrArgument, retVal); sl@0: sl@0: // Repeat the above for EnterHighPressure and ExitHighPressure with these values sl@0: // -10 and -5 it should return KErrArgument sl@0: // -5 and -10 it should return KErrNone sl@0: retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-10, -5); sl@0: TestErrorCodeL(KErrArgument, retVal); sl@0: sl@0: retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-5, -10); sl@0: TestErrorCodeL(KErrNone, retVal); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::SimulateProximityAndPressureEvents(TInt aCloseProxEnterValue, TInt aCloseProxExitValue, TInt aHighPresEnterValue, TInt aHighPresExitValue) sl@0: { sl@0: TPoint ptrPos(10,10); sl@0: // Simulate EPointerMove with proximity value > EnterCloseProximity threshold sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxEnterValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, aCloseProxEnterValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EPointerMove with proximity value < ExitCloseProximity threshold sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EBUtton1Down with presure value > EnterHighPressure threshold sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, aHighPresEnterValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, aHighPresEnterValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, aHighPresEnterValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EPointerMove with presure value < ExitHighPressure threshold sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aHighPresExitValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, aHighPresExitValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Finally simulate Ebutton1Up with proximity value < ExitCloseProximity sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, aCloseProxExitValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0035 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ10887, REQ10886 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Negative tests for close Proximity and high Pressure events. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Set CloseProximity and HighPressure thresholds with positive and negative values. sl@0: Simulate Enter/ExitCloseProximity and Enter/ExitHighPressure events. sl@0: @SYMTestExpectedResults The received events must match the simulated pointer events sl@0: */ sl@0: void CTMultiPtrEventTest::NegativeTestsForProximityPressureEventsL() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Negative tests for pressure and proximity events: %d of 3"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: NegativeTestingOfProximityPressureAPIsL(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // This is to check close proximity threshold API can be given +ve values sl@0: // and high pressure threshold API can begiven -ve values sl@0: iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20); sl@0: iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50); sl@0: SimulateProximityAndPressureEvents(60, 10, -10, -60); sl@0: break; sl@0: case 1: sl@0: // Repeat the above with +ve values sl@0: iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20); sl@0: iMultiPtrEventClient->iWs.SetHighPressureThresholds(50, 20); sl@0: SimulateProximityAndPressureEvents(60, 10, 60, 10); sl@0: break; sl@0: case 2: sl@0: // Repeat the above -ve values sl@0: iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-20, -50); sl@0: iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50); sl@0: SimulateProximityAndPressureEvents(-10, -60, -10, -60); sl@0: break; sl@0: default: sl@0: SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt); sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: sl@0: void CTMultiPtrEventTest::CreateGroupWinForCapturingL() sl@0: { sl@0: iGroupWinForCapturing = new(ELeave) CTWindowGroup(iMultiPtrEventClient); sl@0: iGroupWinForCapturing->ConstructL(); sl@0: iGroupWinForCapturing->GroupWin()->AutoForeground(ETrue); sl@0: iGroupWinForCapturing->GroupWin()->EnableFocusChangeEvents(); sl@0: sl@0: iWinForCapturing = new(ELeave) CTBlankWindow(); sl@0: iWinForCapturing->ConstructL(*iGroupWinForCapturing); sl@0: iWinForCapturing->SetExt(TPoint(), TSize(iPhysicalScreenSize.iWidth/2, iPhysicalScreenSize.iHeight)); sl@0: iWinForCapturing->SetColor(KRgbBlue); sl@0: iWinForCapturing->BaseWin()->EnableAdvancedPointers(); sl@0: iWinForCapturing->Activate(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::DeleteGroupWinForCapturing() sl@0: { sl@0: if (iWinForCapturing) sl@0: { sl@0: delete iWinForCapturing; sl@0: iWinForCapturing = NULL; sl@0: } sl@0: if (iGroupWinForCapturing) sl@0: { sl@0: delete iGroupWinForCapturing; sl@0: iGroupWinForCapturing = NULL; sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0019 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677,REQ9683, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv supports Capturing in case of multi pointer events. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create a window with group window as its parent. sl@0: Create another window with same parent and partially overlapping the first one. sl@0: SetPointerCapture for second window with TCaptureEnabled flag. sl@0: Simulate TRawEvent::EButton1Down from each pointer the device supports sl@0: sl@0: Repeat the above with TCaptureFlagAllGroups flag for SetPointerCapture sl@0: and creating windows from different window group sl@0: sl@0: @SYMTestExpectedResults Even if events were simulated on first window events are delivered to sl@0: second window as it is capturing. sl@0: With TCaptureFlagAllGroups flag set events are delivered to window which is sl@0: capturing even if events were simulated on a window from different group sl@0: sl@0: */ sl@0: void CTMultiPtrEventTest::CapturingMultiPointerEvents() sl@0: { sl@0: // Test Capturing of multi pointer events sl@0: // 1. Test Wserv supports Capturing in case of multi-pointer events sl@0: // 2. Test pointer events are delivered correctly when Capturing is disabled. sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "CapturingMultiPtrEvents SetOfEvents: %d of 3"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos; sl@0: TInt ptrNum; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: INFO_PRINTF1(_L("Ensure pointer state is Out of Range")); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, ptrNum); sl@0: } sl@0: break; sl@0: case 1: sl@0: INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, within window group")); sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled); sl@0: TestCapturingForMultiPointer(EFalse); sl@0: break; sl@0: case 2: sl@0: INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, from different window groups")); sl@0: TRAPD(err, CreateGroupWinForCapturingL()); // it cannot leave so trap and fail sl@0: if (err != KErrNone) sl@0: { sl@0: Failed(); sl@0: } sl@0: AddExpectedWsEvent(EEventFocusLost); // First group window losing focus because of second group creation sl@0: AddExpectedWsEvent(EEventFocusGained); // Second group window creation sl@0: sl@0: iWinForCapturing->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups); sl@0: TestCapturingForMultiPointer(ETrue); sl@0: break; sl@0: default: sl@0: DeleteGroupWinForCapturing(); sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0017 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ Negative Testing sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Out of bound value testing sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate raw events of TRawEvent with pointer number greater than EPointerMaxPointers sl@0: sl@0: @SYMTestExpectedResults The received events must match the events added to the buffer and check that out of bound events are ignored. sl@0: sl@0: */ sl@0: void CTMultiPtrEventTest::OutOfBoundValueTesting() sl@0: { sl@0: // Test Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers. sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "OutOfBoundValueTesting SetOfEvents: %d of 1"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos; sl@0: TInt ptrNum; sl@0: TInt ptrNumOutOfBounds; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: INFO_PRINTF1(_L("Checks Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers.")); sl@0: ptrPos.SetXY(0,0); sl@0: ptrNum = iMaxDevPointers-1; // Max value for ptrNum sl@0: ptrNumOutOfBounds = iMaxDevPointers; // Invalid ptrNum as pointer numbers are zero indexed sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNumOutOfBounds); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum); sl@0: ptrPos.iX += 10; ptrPos.iY += 10; sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum); sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::SetThresholdValues(TInt aEnterCloseProx, TInt aExitCloseProx, TInt aEnterHighPres, TInt aExitHighPres) sl@0: { sl@0: iEnterCloseProximityThreshold = aEnterCloseProx; sl@0: iExitCloseProximityThreshold = aExitCloseProx; sl@0: iEnterHighPressureThreshold = aEnterHighPres; sl@0: iExitHighPressureThreshold = aExitHighPres; sl@0: sl@0: iMultiPtrEventClient->iWs.SetCloseProximityThresholds(iEnterCloseProximityThreshold,iExitCloseProximityThreshold); sl@0: iMultiPtrEventClient->iWs.SetHighPressureThresholds(iEnterHighPressureThreshold,iExitHighPressureThreshold); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::TestCloseProximityHighPressureAPIsL() sl@0: { sl@0: // These are some typical values which are used only for testing purposes. sl@0: // 20mm to screen sl@0: // 50mm to screen sl@0: // 4N of pressure sl@0: // 2N of pressure sl@0: SetThresholdValues(-20,-50,4000,2000); sl@0: sl@0: if (iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold() != iEnterCloseProximityThreshold) sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KError, "Expected EnterCloseProximityThreshold = %d Actual EnterCloseProximityThreshold %d"); sl@0: logText.AppendFormat(KError, iEnterCloseProximityThreshold, iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold()); sl@0: LOG_MESSAGE(logText); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: sl@0: if (iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold() != iExitCloseProximityThreshold) sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KError, "Expected ExitCloseProximityThreshold = %d Actual ExitCloseProximityThreshold %d"); sl@0: logText.AppendFormat(KError, iExitCloseProximityThreshold, iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold()); sl@0: LOG_MESSAGE(logText); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: sl@0: if (iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold() != iEnterHighPressureThreshold) sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KError, "Expected EnterHighPressureThreshold = %d Actual EnterHighPressureThreshold %d"); sl@0: logText.AppendFormat(KError, iEnterHighPressureThreshold, iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold()); sl@0: LOG_MESSAGE(logText); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: sl@0: if (iMultiPtrEventClient->iWs.GetExitHighPressureThreshold() != iExitHighPressureThreshold) sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KError, "Expected ExitHighPressureThreshold = %d Actual ExitHighPressureThreshold %d"); sl@0: logText.AppendFormat(KError, iExitHighPressureThreshold, iMultiPtrEventClient->iWs.GetExitHighPressureThreshold()); sl@0: LOG_MESSAGE(logText); sl@0: User::Leave(ETestFailed); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0034 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ10887,REQ10886 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Tests close Proximity and high Pressure event types. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Set CloseProximity and HighPressure thresholds and simulate events with different Z values sl@0: @SYMTestExpectedResults The received events must match the simulated pointer events sl@0: */ sl@0: void CTMultiPtrEventTest::CloseProximityAndHighPressureEventsL() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Close Proximity and High Pressure events: %d of 11"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: TestCloseProximityHighPressureAPIsL(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos(10,10); sl@0: TInt proxValue; sl@0: TInt prValue; sl@0: TInt tempCount; sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: // One whole cycle of events sl@0: // Simulate out-of-range from all pointers and don't expect out-of-range events sl@0: // since all the pointers are already in same state sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate moves with proximity value < EEnterCloseProximity sl@0: proxValue = -30; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate moves with proximity value > EEnterCloseProximity sl@0: proxValue = -10; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Down with pressure value < EEnterHighPressure sl@0: prValue = 1000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate moves with pressure value > EEnterHighPressure sl@0: prValue = 5000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate moves with pressure value < EExitHighPressure sl@0: prValue = 1000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Up with proximity value > EEnterCloseProximity sl@0: proxValue = -10; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate moves with proximity value < EExitCloseProximity sl@0: proxValue = -60; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 1: sl@0: // Simulate events to meet all scenarios sl@0: // Simulate EButton1Down with pressure value < EEnterHighPressure sl@0: prValue = 1000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Up with proximity value < EExitCloseProximity sl@0: proxValue = -60; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Down with pressure value > EEnterHighPressure sl@0: prValue = 5000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Up with proximity value < EExitCloseProximity sl@0: proxValue = -60; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 2: sl@0: // Simulate moves with proximity value > EEnterCloseProximity sl@0: proxValue = -10; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Down with pressure value > EEnterHighPressure sl@0: prValue = 5000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Up with proximity value > EExitCloseProximity sl@0: proxValue = -40; // When you coming up, EEnterCloseProximity is of no use sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate out-of-range events sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 3: sl@0: // From out-of-range state to EButton1Down sl@0: // Simulate EButton1Down with pressure value < EEnterHighPressure sl@0: prValue = 1000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Up with proximity value > EExitCloseProximity sl@0: proxValue = -40; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate out-of-range events sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Down with pressure value > EEnterHighPressure sl@0: prValue = 5000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Up with proximity value > EExitCloseProximity sl@0: proxValue = -40; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate out-of-range events sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 4: sl@0: // Simulate EButton1Dowm with pressure value < EEnterHighPressure sl@0: prValue = 1000; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate EButton1Up with proximity value < EExitCloseProximity sl@0: proxValue = -60; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: // Simulate out-of-range from Up/OutOfCloseProximity sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 5: sl@0: // Purging of proximity and pressure events sl@0: // Simulate EnterCloseProximity and ExitCloseProximity events which will be purged sl@0: // when you send Button1Up events for KMaxQueueSize sl@0: proxValue = -10; sl@0: for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: } sl@0: proxValue = -60; sl@0: for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: } sl@0: for (TInt count = 0; count < KMaxQueueSize; count++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0); sl@0: } sl@0: break; sl@0: case 6: sl@0: // Simulate EnterCloseProximity for 4 pointers. sl@0: // As we cannot create lone ExitCloseProximity events, so create just moves from next 4 pointers sl@0: // Simulate out-of-range for these events on thier respective pointers sl@0: // Then simulate EButton1Up events which will purge EnterCloseProximity and move events sl@0: // which checks that lone EnterCloseProximity and lone move events will be purged sl@0: proxValue = -10; sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: proxValue = -60; sl@0: for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: for (TInt count = 0; count < KMaxQueueSize-iMaxDevPointers; count++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0); sl@0: } sl@0: break; sl@0: case 7: sl@0: // Bring all other pointers to Up state, becasue of previous test sl@0: // Then simulate out-of-range twice for all the pointers sl@0: // Then simulate Button1Up which will cause purging of successive out-of-range events sl@0: proxValue = -60; sl@0: tempCount = 0; sl@0: for (TInt ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: tempCount++; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: tempCount++; sl@0: // Wserv does nothing if current state is outofrange and if receives again EOutOfRange event which is practically not possible sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: for (TInt count = 0; count < KMaxQueueSize-tempCount; count++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0); sl@0: } sl@0: break; sl@0: case 8: sl@0: // Simulate EButton1Down with pressure value > EnterHIghPressure threshold sl@0: // which will cause EButton1Down and EnterHighPressure to be filled in queue sl@0: // Simulate ExitHighPressure and EButton1Up events for 2 pointers sl@0: // Then simulate EButton1Up events from pointer0 so that all of the above events are purged sl@0: prValue = 5000; sl@0: for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: } sl@0: prValue = 1000; sl@0: for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: // Here these events are purged becasue their correpsonding down event would have been purged sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: } sl@0: // All the above events get purged by this sl@0: for (TInt count = 0; count < KMaxQueueSize; count++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); sl@0: } sl@0: break; sl@0: case 9: sl@0: // Simulate EButton1Down for 2 pointers, which will generate Button1Down and EnterHighPressure sl@0: // Simulate Ebutton1Up events for MaxQueueSize from last pointer so that all the above events are purged sl@0: prValue = 5000; sl@0: for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrNum < 2); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: } sl@0: sl@0: // This will cause above down and enterhighpressure events to be purged sl@0: // When pointer is in outofrange state and when EButton1Up event is sent Wserv sends EnterCloseProximity sl@0: // EnterCloseProximity cannot be purged unless the next event is EExitCloseProximity or EOutOfRange sl@0: for (TInt count = 0; count < KMaxQueueSize; count++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, iMaxDevPointers-1); sl@0: AddExpectedPointerEvent((count ? TPointerEvent::EButton1Up : TPointerEvent::EEnterCloseProximity), ptrPos, 0, 0, iMaxDevPointers-1); sl@0: } sl@0: sl@0: // As the first 2 pointers are in down state, and if we send the move events with prValue = 1000 sl@0: // This will generate the exithigh pressure events, which will be ignored sl@0: // This will also generate the Ebutton1Up event which will also be ignored sl@0: prValue = 1000; sl@0: for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrNum < 2); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 10: sl@0: // This is to just bring all the pointers to out-of-range state sl@0: // to make all pointers in valid state for other test to run sl@0: // Wserv processes EOutOfRange events only when its current state is not in outofrange. sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers && ptrNum < 2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum); sl@0: } sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, iMaxDevPointers-1); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, iMaxDevPointers-1); sl@0: break; sl@0: default: sl@0: SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt); sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::CreateAnimDllAndAnimL() sl@0: { sl@0: iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs); sl@0: User::LeaveIfError(iAnimDll->Load(KAnimDLLName)); sl@0: iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::DestroyAnimDllAndAnim() sl@0: { sl@0: if (iAnim) sl@0: { sl@0: iAnim->Destroy(); sl@0: iAnim = NULL; sl@0: } sl@0: if (iAnimDll) sl@0: { sl@0: iAnimDll->Destroy(); sl@0: iAnimDll = NULL; sl@0: } sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::CreateGroupWinL() sl@0: { sl@0: iGroupWinForEmul = new(ELeave) CTWindowGroup(iMultiPtrEventClient); sl@0: iGroupWinForEmul->ConstructL(); sl@0: iGroupWinForEmul->GroupWin()->AutoForeground(ETrue); sl@0: iGroupWinForEmul->GroupWin()->EnableFocusChangeEvents(); sl@0: sl@0: iWinForEmul = new(ELeave) CTBlankWindow(); sl@0: iWinForEmul->ConstructL(*iGroupWinForEmul); sl@0: iWinForEmul->SetExt(TPoint(50,50), TSize(80,80)); sl@0: iWinForEmul->SetColor(KRgbDarkYellow); sl@0: iWinForEmul->Activate(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::DeleteGroupWin() sl@0: { sl@0: if (iWinForEmul) sl@0: { sl@0: delete iWinForEmul; sl@0: iWinForEmul = NULL; sl@0: } sl@0: if (iGroupWinForEmul) sl@0: { sl@0: delete iGroupWinForEmul; sl@0: iGroupWinForEmul = NULL; sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0029 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9688 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Tests the emulation rules for Apps, Anims, Autofocus and Buffered delivery sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate event to make a pointer primary. EnableAdvancedPointers API is not called. And then simulate events from other pointers sl@0: @SYMTestExpectedResults The events from other pointer are not received sl@0: */ sl@0: void CTMultiPtrEventTest::EmulationRulesForMultiplePointers() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Emulation rules set of events: %d of 15"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetExpectNonAdvancedPointerEvents(); sl@0: SetAutoFlush(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos(10,10); sl@0: TInt proxValue = -iProximityStep; sl@0: TInt prValue = iPressureStep; sl@0: TInt ptrNum = 0; sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // This event is for simulated/primary pointer sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Parent window has not called EnableAdvancedPointers API sl@0: // So even if we simulate moves and out-of-range these are not delivered to client sl@0: for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 1: sl@0: // Since the primary pointer is 0, simulate EButton1Down for making pointer 1 as primary sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Simulate move or Ebutton1Down from pointer0 they are NOT sent back to client sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: break; sl@0: case 2: sl@0: // Simulate EButton1Down from pointer0 to make it primary sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, 0); sl@0: sl@0: // Move from pointer1 sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: sl@0: // Take the zero pointer out-of-range, this will not result in Pointer 1 becoming primary sl@0: // and out-of-range event is sent to client sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, 0); sl@0: sl@0: // Send moves from pointer1, but these are not sent to the Client. sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: break; sl@0: case 3: sl@0: // Simulate EButton1Down from pointer0 to make it primary sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Simulate EButton1Down from pointer1, which is not sent to client sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Drag events are not sent becasue pointer1 has NOT become primary sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: // Simulate up from pointer1, still not primary, so event is not sent sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: // Simulate out-of-range from pointer1, still not primary, so event is not sent sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: // Now moves from out-of-range to move state sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: break; sl@0: case 4: sl@0: // pointer0 sends move (becomes primary) sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // pointer0 sends down sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // pointer1 sends down, doesn't become primary sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: // pointer0 sends up, stays primary sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // pointer2, pointer3 and pointer4 sends move with proximity -5, -10, -15 sl@0: for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++, proxValue -= iProximityStep) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: } sl@0: sl@0: // pointer0 sends out-of-range, loses primary pointer, But NO events are sent sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Send moves for pointer2, pointer3 and pointer4. sl@0: // None of the evnst are sent sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 5; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: } sl@0: sl@0: // Drag from pointer1, NOT sent, since it is not primary sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, 1); sl@0: sl@0: // Send out-of-range from all pointers sl@0: for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: } sl@0: sl@0: // As the pointer1 is down, this will not become primary even if EButton1Up is called sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: // And now sending out-of-range will also not send the event to client as it is not primary sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: break; sl@0: case 5: sl@0: // Test cases 5 - 7 represent one discrete test for PointerRepeatEvents sl@0: // Case 5 simulates EButton1Down events only. This is to ensure the event is delivered to the client. sl@0: // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed. sl@0: ptrPos.SetXY(0,0); sl@0: sl@0: // pointer0 sends down (become primary) sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // pointer1 sends down, doesn't become primary sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: // pointer4 sends down sl@0: if (4 < iMaxDevPointers) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 4); sl@0: } sl@0: break; sl@0: case 6: sl@0: ptrPos.SetXY(0,0); sl@0: // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'. sl@0: // Legacy API called which does not specify a pointer number. EButtonRepeat should be generated for primary pointer only. sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(20,20))); sl@0: User::After(200000); sl@0: AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: break; sl@0: case 7: sl@0: // pointer0 sends up sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // pointer2 sends out-of-range sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Send up and out-of-range for pointer1 and 4 sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 1); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: if (4 < iMaxDevPointers) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 4); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 4); sl@0: } sl@0: break; sl@0: case 8: sl@0: // Autofocus does not work for other than primary pointers sl@0: // Create group window which will send focus lost and gained sl@0: TRAPD(err, CreateGroupWinL()); // it cannot leave so trap and fail sl@0: if (err != KErrNone) sl@0: { sl@0: Failed(); sl@0: } sl@0: AddExpectedWsEvent(EEventFocusLost); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: sl@0: // Simulate Epointer down which will send focuslost, focusgained and focusgroupchanged events sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedWsEvent(EEventFocusLost); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: AddExpectedWsEvent(EEventFocusGroupChanged); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Now simulate EButton1Down from first or second pointer on second group sl@0: // This should not reflect the autofocus sl@0: ptrPos.iX = 60; sl@0: ptrPos.iY = 60; sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: if (2 < iMaxDevPointers) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 2); sl@0: } sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: if (2 < iMaxDevPointers) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 2); sl@0: } sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: break; sl@0: case 9: sl@0: // First thing to do in this case is to delete the group window created sl@0: DeleteGroupWin(); sl@0: sl@0: TRAP(err, CreateAnimDllAndAnimL()); // it cannot leave so trap and fail sl@0: if (err != KErrNone) sl@0: { sl@0: Failed(); sl@0: } sl@0: sl@0: // This is the first event which makes first pointer as primary sl@0: // When the last argument is EFalse, it means that the event is not consumed by Anim sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, 0, 0, 0, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: sl@0: // Now simulate moves from other pointers and these events are not sent to anim sl@0: for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: } sl@0: sl@0: // This is to reset the primary pointer sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: sl@0: // Now simulate EButton1Down, which will make it as primary sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 1, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: // Simulate move or Ebutton1Down from any other prointer they are not sent back to client sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 1, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 1, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: // Set the primary pointer to Zero sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 0, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: sl@0: // Move from second pointer sl@0: // As EnableMultiPointer is not called and this is not a primary pointer so this event sl@0: // will cause the pointer 1 into move state sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: sl@0: // Take the zero pointer out-of-range sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 0, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: sl@0: // These moves will not be sent sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: TestAndDisplayAnimError(); sl@0: sl@0: _LIT(KEventsChecked, "Events checked at server side = %d"); sl@0: logText.Format(KEventsChecked, 10); sl@0: LOG_MESSAGE(logText); sl@0: break; sl@0: case 10: sl@0: DestroyAnimDllAndAnim(); sl@0: sl@0: // Test for PointerMove buffers sl@0: // AllocPointerMoveBuffer, EnablePointerMoveBuffer and then simulate few moves sl@0: // Add these moves to another points buffer for testing sl@0: // Simulate moves from other pointers, these should not be delivered to clients. sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->AllocPointerMoveBuffer(10, 0); sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->EnablePointerMoveBuffer(); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin()); sl@0: iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); // If this position is above some other window then we need to consider its window postion also sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); sl@0: sl@0: // These events should not be added to buffer sl@0: for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 11: sl@0: // Repeat the above for drag events sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin()); sl@0: iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); sl@0: sl@0: // These events should not be added to buffer sl@0: for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += 10; sl@0: ptrPos.iY += 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: } sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: break; sl@0: case 12: sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer(); sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer(); sl@0: sl@0: // Pointer Cursor Position test sl@0: // This event is for simulating primary pointer sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: // Here I am not adding the event because this event is deleted by another move of same pointer sl@0: if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) sl@0: { sl@0: TEST(EFalse); sl@0: Failed(); sl@0: } sl@0: sl@0: iMultiPtrEventClient->iWs.SetPointerCursorPosition(TPoint(20,20)); sl@0: if (TPoint(20,20) != iMultiPtrEventClient->iWs.PointerCursorPosition()) sl@0: { sl@0: TEST(EFalse); sl@0: Failed(); sl@0: } sl@0: sl@0: // Now simulate moves from other pointer, this should not have any effect on pointer cursor position sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: sl@0: // Now move the primary pointer, and check the pointer cursor position which should be same as position used for move sl@0: ptrPos.iX = 30; sl@0: ptrPos.iY = 30; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) sl@0: { sl@0: TEST(EFalse); sl@0: Failed(); sl@0: } sl@0: sl@0: // Send out-of-range event which will not lead to pointer 1 becoming primary sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Now check the pointer cursor position, which should be same sl@0: // as primary even if there is other pointer in up state, but that is not primary sl@0: if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) sl@0: { sl@0: TEST(EFalse); sl@0: Failed(); sl@0: } sl@0: sl@0: // This is to bring the pointer1 to out-of-range state sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: // then send move event and then again check the pointer cursor position sl@0: ptrPos.iX = 20; sl@0: ptrPos.iY = 20; sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition()) sl@0: { sl@0: TEST(EFalse); sl@0: Failed(); sl@0: } sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: break; sl@0: case 13: sl@0: { sl@0: // Pointer Cursor Area test-1 sl@0: iOrigPtrCursorArea = iMultiPtrEventClient->iWs.PointerCursorArea(); sl@0: TRect ptrCurArea(0,0,40,40); sl@0: iMultiPtrEventClient->iWs.SetPointerCursorArea(ptrCurArea); sl@0: sl@0: // Simulate move from pointer0 in PointerCursorArea sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Simulate move from other pointer, This should have no effect sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Repeat the above with moves outside pointer cursor area sl@0: ptrPos.iX = 50; sl@0: ptrPos.iY = 50; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0); sl@0: TPoint pointInCurArea(39, 39); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Simulate move from other pointer, This should have no effect sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: } sl@0: break; sl@0: case 14: sl@0: { sl@0: // Pointer Cursor Area test-2 sl@0: // repeat the above test with button1 down sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Simulate move from other pointer, This should have no effect sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Repeat the above with moves outside pointer cursor area sl@0: ptrPos.iX = 50; sl@0: ptrPos.iY = 50; sl@0: TPoint pointInCurArea(39, 39); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: // Simulate move from other pointer, This should have no effect sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1); sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber); sl@0: } sl@0: break; sl@0: default: sl@0: ClearExpectNonAdvancedPointerEvents(); sl@0: iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea); sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0026 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677, REQ9683 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv supports Autofocus for multiple pointers sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create 2 group window and respective client windows for it. And simulate EButton1Down on each window consecutively sl@0: @SYMTestExpectedResults The received events must match the simulated pointer events sl@0: */ sl@0: void CTMultiPtrEventTest::AutoForeGroundForMultiplePointersL() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Multiple pointer Auto foreground events: %d of 2"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: AddExpectedWsEvent(EEventFocusGained); // This if for the main groupwindow sl@0: iMultiPtrEventClient->ConstructGroupBlankWinL(); sl@0: sl@0: // These are for child group window creation sl@0: AddExpectedWsEvent(EEventFocusLost); // This if for the main groupwindow losing focus sl@0: AddExpectedWsEvent(EEventFocusGained); // First group window of this test creation sl@0: sl@0: AddExpectedWsEvent(EEventFocusLost); // First group window losing focus because of second group creation sl@0: AddExpectedWsEvent(EEventFocusGained); // Second group window creation sl@0: AddExpectedWsEvent(EEventFocusGroupChanged); // First group window's Enable Focus changed flag is set sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint win1PtrPos(20,20); sl@0: TPoint win2PtrPos(60,60); sl@0: TPoint ptrPos; sl@0: TInt autoFocusWin; sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: if ((ptrNum & 1) == 0) sl@0: { sl@0: ptrPos = win1PtrPos; sl@0: autoFocusWin = 1; sl@0: } sl@0: else sl@0: { sl@0: ptrPos = win2PtrPos; sl@0: autoFocusWin = 0; sl@0: } sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedWsEvent(EEventFocusLost); // Second group window losing focus sl@0: AddExpectedWsEvent(EEventFocusGained); // First group window gaining focus sl@0: if (ptrNum == 0) sl@0: { // First group window has already received EEventFocusGroupChanged sl@0: AddExpectedWsEvent(EEventFocusGroupChanged); // Second group window's Enable Focus changed flag is set sl@0: } sl@0: // In the queue only once EEventFocusGroupChanged is sent sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: sl@0: // These events are to clear out the pointer state sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum); sl@0: sl@0: if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin)) sl@0: { sl@0: TEST(EFalse); sl@0: Failed(); sl@0: } sl@0: } sl@0: break; sl@0: case 1: sl@0: for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: if ((ptrNum & 1) == 0) sl@0: { sl@0: ptrPos = win1PtrPos; sl@0: autoFocusWin = 1; sl@0: } sl@0: else sl@0: { sl@0: ptrPos = win2PtrPos; sl@0: autoFocusWin = 0; sl@0: } sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedWsEvent(EEventFocusLost); // Second group window losing focus sl@0: AddExpectedWsEvent(EEventFocusGained); // First group window gaining focus sl@0: if (ptrNum == iMaxDevPointers/2) // first loop sl@0: { sl@0: // When ever a group window changes focus, For all the group/client windows which have sl@0: // registered for receiving group window changes recive EEventFocusGroupChanged sl@0: // EEventFocusGroupChanged is sent only once in one queue sl@0: AddExpectedWsEvent(EEventFocusGroupChanged); sl@0: AddExpectedWsEvent(EEventFocusGroupChanged); sl@0: } sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: sl@0: // These events are to clear out the pointer state sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum); sl@0: if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin)) sl@0: { sl@0: TEST(EFalse); sl@0: Failed(); sl@0: } sl@0: } sl@0: break; sl@0: default: sl@0: iMultiPtrEventClient->DeleteGroupBlankWin(); sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0015 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9684 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv supports out-of-range and pointer Enter/Exit events. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate moves and EPointer3DOutOfRange from different pointers sl@0: @SYMTestExpectedResults The received events must match the simulated pointer events sl@0: */ sl@0: void CTMultiPtrEventTest::MultiPointerOutOfRangeEvents() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "OutOfRange & Enter/Exit events: %d of 4"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos(10,10); sl@0: TInt proxValue = -iProximityStep; sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // Simulate moves and EPointer3DOutOfRange from all pointers sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: // Here I am not enabling the enter/exit events filter so not getting those sl@0: } sl@0: break; sl@0: case 1: sl@0: // Repeat the above by enabling the enter/exit events sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0); sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 2: sl@0: // Check the moves from one window to other sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) sl@0: { sl@0: ptrPos.iX = 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: sl@0: ptrPos.iX = (iMultiPtrEventClient->ParentWin()->Size().iWidth)/2 + 10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); // move and enter of child window is filtered out sl@0: } sl@0: break; sl@0: case 3: sl@0: // Since all the pointers are now on child and when we change the pointer filter sl@0: // wserv sends enter event to all pointers sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0); sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) sl@0: { sl@0: AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); sl@0: } sl@0: for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2) sl@0: { sl@0: ptrPos.iX = ptrPos.iY =10; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); sl@0: AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum); sl@0: AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0032 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv supports Double click events for multi pointer events. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate double click events from different pointers sl@0: @SYMTestExpectedResults The received events must match the simulated pointer events sl@0: */ sl@0: void CTMultiPtrEventTest::DoubleClickForMultiplePointers() sl@0: { sl@0: // Logic involved, double click settings are global no need to test them sl@0: // Check that double click events are sent by wserv for all pointers sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Double click settings and events: %d of 1"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos(10,10); sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: for (TInt ptrNum = 0; ptrNum < Min(iMaxDevPointers, 7); ptrNum++) sl@0: { sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrPos, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, EModifierDoubleClick, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: } sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0031 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv supports Virtual keyboard for multi pointer events. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Create virtual keyboard by AddKeyRect() to a window and simulate pointer events from all pointers sl@0: @SYMTestExpectedResults The received events must match the simulated Key events sl@0: */ sl@0: void CTMultiPtrEventTest::VirtualKeyBoardForMultiplePointers() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "VirtualKeyboard SetOfEvents: %d of 8"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: // Create virtual keyboard for 8 keys on parent window sl@0: // give a 5 pixel spacing at start/end and in between keys sl@0: const TInt noVirtualKeys = iMaxDevPointers; sl@0: const TInt keySpacing = 5; sl@0: const TInt keyWidth = ((iPhysicalScreenSize.iWidth/2) - ((noVirtualKeys+1)*keySpacing))/noVirtualKeys; sl@0: const TInt keyHeight = keyWidth/2; sl@0: TInt startX = keySpacing; sl@0: const TInt baseChar ='A'; sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: for (TInt count=0; count < noVirtualKeys; count++) sl@0: { sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->AddKeyRect(TRect(startX, keySpacing, startX+keyWidth, keySpacing+keyHeight), baseChar+count,EFalse); sl@0: startX+=(keyWidth+keySpacing); sl@0: } sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: TPoint ptrPos(keySpacing+(keyWidth/2), keySpacing+(keyHeight/2)); sl@0: sl@0: TInt count = 0; sl@0: if (iEventSet < iMaxDevPointers) sl@0: { sl@0: for (; ptrPos.iX < (iPhysicalScreenSize.iWidth/2)-5; ptrPos.iX += (keySpacing+keyWidth), count++) sl@0: { sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, iEventSet); sl@0: AddExpectedKeyDownUp(baseChar+count); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ResetFlushStopAS(); sl@0: } sl@0: iEventSet++; sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0021 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677,REQ9683, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv supports Grabbing in case of multi pointer events. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate EButton1Down events on iParentWin. Simulate Drag and Button1Up events on iChildWin. sl@0: SetPointerGrab is called on iParentWin for first test and disabled for the second. sl@0: @SYMTestExpectedResults The Drag and Button1Up events contain a handle to iParentWin when Grabbing active. sl@0: The Drag and Button1Up events contain a handle to iChildWin when Grabbing disabled. sl@0: */ sl@0: void CTMultiPtrEventTest::GrabbingMultiPointerEvents() sl@0: { sl@0: // Test Grabbing of multi pointer events sl@0: // 1. Test Wserv supports Grabbing in case of multi-pointer events sl@0: // 2. Test pointer events are delivered correctly when Grabbing is disabled. sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "GrabbingMultiPtrEvents SetOfEvents: %d of 2"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: } sl@0: sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: INFO_PRINTF1(_L("Check Wserv supports Grabbing in case of multi-pointer events")); sl@0: // Check pointer events are delivered to the window where the EButton1Down event occured, sl@0: // even if subsequent events are simulated outside this window. sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(ETrue); sl@0: TestGrabbingForMultiPointer(ETrue); sl@0: break; sl@0: case 1: sl@0: INFO_PRINTF1(_L("Check pointer events are delivered correctly when Grabbing is disabled.")); sl@0: // Check pointer events are delivered to the window on which they occured. sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(EFalse); sl@0: TestGrabbingForMultiPointer(EFalse); sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0025 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677,REQ9683, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv supports Filtering in case of multi pointer events. sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate Move and Drag events. Add only Button1Up and Button1Down to TWsEvent buffer. sl@0: Disable Filtering and repeat test with the addition of Move and Drag events to TWsEvent buffer. sl@0: @SYMTestExpectedResults The received events must match the expected simulated raw events sl@0: The received events must match the simulated raw events sl@0: */ sl@0: void CTMultiPtrEventTest::FilteringMultiPointerEvents() sl@0: { sl@0: // Test Filtering of multi pointer events sl@0: // 1. Test pointer move and drag events are filtered correctly by Wserv sl@0: // 2. Test pointer events are delivered correctly when Filtered is disabled. sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "FilteringMultiPtrEvents SetOfEvents: %d of 2"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: } sl@0: sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: INFO_PRINTF1(_L("Check pointer move and drag events are filtered with multi-pointer events")); sl@0: // Check pointer move and drag events are filtered by Wserv sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: sl@0: // Ensure default values are set i.e. Drag and Move events are filtered out and not delivered to the client. sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove, sl@0: EPointerFilterDrag|EPointerFilterMove); sl@0: TestFilteringForMultiPointer(ETrue); sl@0: break; sl@0: case 1: sl@0: INFO_PRINTF1(_L("Check pointer move and drag events are not filtered, with multi-pointer events, when filtering is disabled")); sl@0: // Check move and drag events are not filtered by Wserv when filtering is disabled sl@0: sl@0: // Enable Drag and Move events sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove, 0); sl@0: TestFilteringForMultiPointer(EFalse); sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::SetDefaultScreenMode() sl@0: { sl@0: iMultiPtrEventClient->iScreen->SetAppScreenMode(0); sl@0: TheClient->iScreen->SetAppScreenMode(0); sl@0: iMultiPtrEventClient->iScreen->SetScreenMode(0); sl@0: iMultiPtrEventClient->iScreen->SetCurrentRotations(0, CFbsBitGc::EGraphicsOrientationNormal); sl@0: } sl@0: sl@0: TPoint PhysicalToLogical(TPoint aPhysicalPt, TPoint aOrigin, TSize aSize) sl@0: { sl@0: return PhysicalToLogical(aPhysicalPt-aOrigin, aSize); sl@0: } sl@0: sl@0: TPoint CTMultiPtrEventTest::GetPointerPostionOnRotatedMode(TPoint aPointerPos, CFbsBitGc::TGraphicsOrientation aRotation) sl@0: { sl@0: if (aRotation == CFbsBitGc::EGraphicsOrientationNormal) sl@0: { sl@0: return aPointerPos; sl@0: } sl@0: else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated90) sl@0: { sl@0: // here width is actually height in rotated mode sl@0: return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iY - 1, aPointerPos.iX); sl@0: } sl@0: else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated180) sl@0: { sl@0: return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iX - 1, iPhysicalScreenSize.iHeight - aPointerPos.iY - 1); sl@0: } sl@0: else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated270) sl@0: { sl@0: // here width is actually height in rotated mode sl@0: return TPoint(aPointerPos.iY, iPhysicalScreenSize.iHeight - aPointerPos.iX -1); sl@0: } sl@0: return TPoint(0,0); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0028 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677, REQ9683 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends multi pointer events in Different screen modes sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate multi pointer events in Different screenmodes sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: void CTMultiPtrEventTest::MultiPointerEventsInDiffScreenModes() sl@0: { sl@0: // Logic inloved, For a particular screen mode check pointer down/up, moves and drags sl@0: // for different pointers and for different co-ordinates. sl@0: // For each screen mode check these events on diffferent rotation that screen mode supports sl@0: // During the last switch case increment the screenmode sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Multi pointer events in screenmode(%d): %d of 2"); sl@0: logText.AppendFormat(KSet, iCurrentScreenMode+1, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: TInt numScrMode = iMultiPtrEventClient->iScreen->NumScreenModes(); sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: if (!iEventSet && !iChangeScreenMode) sl@0: { sl@0: SetAutoFlush(); sl@0: iChangeScreenMode = ETrue; sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: } sl@0: else sl@0: { sl@0: if (iChangeScreenMode) sl@0: { sl@0: if (iCurrentScreenMode >= numScrMode) sl@0: { sl@0: EndFun: sl@0: SetDefaultScreenMode(); sl@0: ResetFlushStopAS(); sl@0: return; sl@0: } sl@0: } sl@0: } sl@0: sl@0: if (iChangeScreenMode) sl@0: { sl@0: iMultiPtrEventClient->iScreen->SetAppScreenMode(iCurrentScreenMode); sl@0: TheClient->iScreen->SetAppScreenMode(iCurrentScreenMode); sl@0: iMultiPtrEventClient->iScreen->SetScreenMode(iCurrentScreenMode); sl@0: iChangeScreenMode = EFalse; sl@0: } sl@0: sl@0: CArrayFixFlat* rotations = NULL; sl@0: TRAPD(err, sl@0: rotations = new(ELeave) CArrayFixFlat(1); sl@0: iMultiPtrEventClient->iScreen->GetRotationsList(iCurrentScreenMode, rotations)); sl@0: if (err != KErrNone) sl@0: { sl@0: if (iEventSet) sl@0: { sl@0: goto EndFun; sl@0: } sl@0: else sl@0: { sl@0: return; sl@0: } sl@0: } sl@0: sl@0: #if !defined(__WINS__) sl@0: TPoint ptrRotatedPos; sl@0: TPoint ptrNormalPos; sl@0: #else sl@0: TPoint ptrPhyPos; sl@0: #endif sl@0: TPoint ptrLogPos; sl@0: sl@0: TInt ptrNum = 0; sl@0: TInt proxValue = 0; sl@0: // Since screenmode positioning and screenmode scaling is not supported in NGA wserv2 sl@0: // but it is supported in Non NGA. But for NGA it will return (0,0) as origin and (1,1) as scale. sl@0: TPoint screenOrigin(iMultiPtrEventClient->iScreen->GetDefaultScreenModeOrigin()); sl@0: TPoint scaledScreenOrigin(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScaledOrigin()); sl@0: TSize scale(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScale()); sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // Simulate Pointer down/up for different rotations of a screenmode sl@0: for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++) sl@0: { sl@0: CFbsBitGc::TGraphicsOrientation newOrientation = static_cast(rotations[0][rotCou]); sl@0: iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation); sl@0: sl@0: #if !defined(__WINS__) sl@0: ptrNormalPos = screenOrigin; sl@0: ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); sl@0: SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); sl@0: ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: sl@0: ptrNormalPos.iX += 10; sl@0: ptrNormalPos.iY += 5; sl@0: ptrNum = iMaxDevPointers/2; sl@0: ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); sl@0: SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); sl@0: ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: sl@0: ptrNormalPos.iX += 5; sl@0: ptrNormalPos.iY += 10; sl@0: ptrNum = iMaxDevPointers-1; sl@0: ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); sl@0: SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); sl@0: ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: ptrNum = 0; sl@0: #else sl@0: // This is not needed for NGA, becasue NGA wserv does not support positioning and scaling sl@0: // but for early access we are deliverying for NonNGA so we need it. sl@0: ptrPhyPos = screenOrigin; sl@0: ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); sl@0: SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: ptrPhyPos.iX += 10; sl@0: ptrPhyPos.iY += 5; sl@0: ptrNum = iMaxDevPointers/2; sl@0: ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); sl@0: SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: ptrPhyPos.iX += 5; sl@0: ptrPhyPos.iY += 10; sl@0: ptrNum = iMaxDevPointers-1; sl@0: ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); sl@0: SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: ptrNum = 0; sl@0: #endif sl@0: } sl@0: break; sl@0: case 1: sl@0: // Simulate moves for different rotations of a screenmode with different Proximity sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0); sl@0: for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++) sl@0: { sl@0: CFbsBitGc::TGraphicsOrientation newOrientation = static_cast(rotations[0][rotCou]); sl@0: iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation); sl@0: sl@0: #if !defined(__WINS__) sl@0: ptrNormalPos = screenOrigin; sl@0: ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); sl@0: proxValue = -iProximityStep; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum); sl@0: ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); sl@0: SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: sl@0: ptrNormalPos.iX += 10; sl@0: ptrNormalPos.iY += 5; sl@0: ptrNum = iMaxDevPointers/2; sl@0: if (proxValue-iProximityStep > iMaxProximity) sl@0: { sl@0: proxValue -= iProximityStep; sl@0: } sl@0: ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum); sl@0: ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); sl@0: SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: ptrNum = 0; sl@0: #else sl@0: ptrPhyPos = screenOrigin; sl@0: proxValue = -iProximityStep; sl@0: ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); sl@0: SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: sl@0: ptrPhyPos.iX += 10; sl@0: ptrPhyPos.iY += 5; sl@0: ptrNum = iMaxDevPointers/2; sl@0: if (proxValue-iProximityStep > iMaxProximity) sl@0: { sl@0: proxValue -= iProximityStep; sl@0: } sl@0: ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum); sl@0: SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum); sl@0: ptrNum = 0; sl@0: #endif sl@0: } sl@0: break; sl@0: case 2: sl@0: { sl@0: // Simulate drags for different rotations of a screenmode sl@0: #if !defined(__WINS__) sl@0: TPoint intNormalPt; sl@0: TPoint intRotatedPt; sl@0: #else sl@0: TPoint interPhyPt; sl@0: TPoint interLogPt; sl@0: #endif sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0); sl@0: for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++) sl@0: { sl@0: CFbsBitGc::TGraphicsOrientation newOrientation = static_cast(rotations[0][rotCou]); sl@0: iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation); sl@0: #if !defined(__WINS__) sl@0: ptrNormalPos = screenOrigin; sl@0: intNormalPt.iX = ptrNormalPos.iX+4; sl@0: intNormalPt.iY = ptrNormalPos.iY+5; sl@0: ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); sl@0: intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); sl@0: ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); sl@0: TPoint intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum); sl@0: sl@0: ptrNormalPos.iX += 10; sl@0: ptrNormalPos.iY += 5; sl@0: ptrNum = iMaxDevPointers-1; sl@0: intNormalPt.iX = ptrNormalPos.iX+5; sl@0: intNormalPt.iY = ptrNormalPos.iY+4; sl@0: ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation); sl@0: intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum); sl@0: ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); sl@0: intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum); sl@0: sl@0: ptrNum = 0; sl@0: #else sl@0: ptrPhyPos = screenOrigin; sl@0: interPhyPt.iX = ptrPhyPos.iX+4; sl@0: interPhyPt.iY = ptrPhyPos.iY+5; sl@0: ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); sl@0: interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale); sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); sl@0: interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum); sl@0: sl@0: ptrPhyPos.iX += 10; sl@0: ptrPhyPos.iY += 5; sl@0: ptrNum = iMaxDevPointers-1; sl@0: interPhyPt.iX = ptrPhyPos.iX+5; sl@0: interPhyPt.iY = ptrPhyPos.iY+4; sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum); sl@0: sl@0: ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale); sl@0: interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum); sl@0: ptrNum = 0; sl@0: #endif sl@0: } sl@0: } sl@0: iChangeScreenMode = ETrue; sl@0: iEventSet = 0; sl@0: iCurrentScreenMode++; sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: sl@0: delete rotations; sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: /* sl@0: Checks if pointer click plugin has an error when testing its events sl@0: If so then it gets the error deescription and displays the same sl@0: */ sl@0: void CTMultiPtrEventTest::TestAndDisplayPtrClickError() sl@0: { sl@0: TPckgBuf intPkg; sl@0: TInt retErr = iClick.CommandReply(EMultiPtrClickEventError, intPkg); sl@0: if (retErr != KErrNone) sl@0: { sl@0: _LIT(KError, "Failed in Pointer click plugin"); sl@0: LOG_MESSAGE(KError); sl@0: // Error is ignored here, becasue this function should not leave sl@0: TRAPD(errMem, iErrDesc = iHeap->AllocL(KErrDescSize)); sl@0: if (errMem == KErrNone) sl@0: { sl@0: intPkg() = reinterpret_cast(iErrDesc) - iChunk.Base() ; sl@0: sl@0: // get the error desccription, print it out and stop the tests sl@0: TInt retVal = iClick.CommandReply(EADllMultiPtrEventErrorDesc, intPkg); sl@0: if (retVal > KErrNone) sl@0: { sl@0: TPtr8 memPtr2(reinterpret_cast(iErrDesc), retVal, retVal); sl@0: HBufC16* buf16 = NULL; sl@0: TRAPD(err, buf16 = HBufC16::NewL(retVal)); // Error is ignored here sl@0: if (err == KErrNone) sl@0: { sl@0: buf16->Des().Copy(memPtr2); sl@0: LOG_MESSAGE(buf16->Des()); sl@0: delete buf16; sl@0: } sl@0: } sl@0: iHeap->Free(iErrDesc); sl@0: } sl@0: Failed(); sl@0: } sl@0: iClick.CommandReply(EMultiPtrClickEventReset, intPkg); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedMultiPtrClickEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle) sl@0: { sl@0: TPckgBuf evtPkg; sl@0: TWsEvent& event=evtPkg(); sl@0: event.SetType(EEventPointer); sl@0: iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle); sl@0: sl@0: // change the parent position here as they r with respect to screen corodinates. sl@0: event.Pointer()->iParentPosition = aPos; sl@0: sl@0: iClick.CommandReply(EMultiPtrClickEventAdd, evtPkg); sl@0: AddExpectedMultiPtrClickOtherEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::AddExpectedMultiPtrClickOtherEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle) sl@0: { sl@0: TWsEvent event; sl@0: event.SetType(EEventPointer); sl@0: iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle); sl@0: sl@0: TPointerEventData otherEvent; sl@0: otherEvent.iClientHandle = event.Handle(); sl@0: otherEvent.iCurrentPos = aPos; sl@0: otherEvent.iPointerEvent = *event.Pointer(); sl@0: sl@0: TPckgBuf evtPkg(otherEvent); sl@0: iClick.CommandReply(EMultiPtrOtherEventAdd, evtPkg); sl@0: } sl@0: sl@0: /* sl@0: Function of creating sl@0: 1. Pointer click plugin sl@0: 2. RChunk for transfering error description from pointer click plugin to current test sl@0: 3. RHeap for allocating memory in RChunk sl@0: */ sl@0: void CTMultiPtrEventTest::CreatePointerClickPluginL() sl@0: { sl@0: // tranfer this to another function sl@0: iClick=RSoundPlugIn(TheClient->iWs); sl@0: User::LeaveIfError(iClick.Construct(TUid::Uid(MULTIPTR_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(KMultiPtrPluginDll)); sl@0: iPtrPluginLoaded = ETrue; sl@0: } sl@0: iClick.SetPenClick(ETrue); sl@0: iHeap = UserHeap::ChunkHeap(&KMultiPtrClickChunk, 128, 256, 10); sl@0: if (iHeap == NULL) sl@0: { sl@0: User::LeaveNoMemory(); sl@0: } sl@0: User::LeaveIfError(iChunk.OpenGlobal(KMultiPtrClickChunk, ETrue)); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0027 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677, REQ9683 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends multi pointer events to PointerClickPlugin sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate multi pointer events for PointerClickPlugin sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: void CTMultiPtrEventTest::MultiPointerEventsForPointerClickL() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Multi pointer events for PointerClickPlugin: %d of 4"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: } sl@0: sl@0: TPoint ptrPos; sl@0: TInt ptrNum = 0; sl@0: TInt prValue = 0; sl@0: TInt proxValue = 0; sl@0: TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // Creates RSoundPlugin, loads the plugin DLL, create RChunk and RHeap sl@0: CreatePointerClickPluginL(); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrPos, 0, ptrNum); sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: TestAndDisplayPtrClickError(); sl@0: break; sl@0: case 1: sl@0: // Simulate moves from different pointer with different pressure sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0); sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove,0); sl@0: ptrPos.SetXY(0,0); sl@0: prValue = iPressureStep; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum); sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrPos, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: TestAndDisplayPtrClickError(); sl@0: break; sl@0: case 2: sl@0: // Simulate moves from different pointer with different proximity sl@0: ptrPos.SetXY(0,0); sl@0: proxValue = -iProximityStep; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum); sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrPos, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: TestAndDisplayPtrClickError(); sl@0: break; sl@0: case 3: sl@0: { sl@0: // Simulate drags from all pointers sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0); sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0); sl@0: ptrPos.SetXY(0,0); sl@0: TPoint interPt; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: interPt.iX = ptrPos.iX+1; sl@0: interPt.iY = ptrPos.iY+2; sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); sl@0: AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); sl@0: sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); sl@0: sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: TestAndDisplayPtrClickError(); sl@0: } sl@0: break; sl@0: default: sl@0: iClick.Unload(); sl@0: iClick.Close(); sl@0: iPtrPluginLoaded = EFalse; sl@0: iHeap->Close(); sl@0: iHeap = NULL; sl@0: iChunk.Close(); sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::GetRemainingEventsFromSecondaryClient() sl@0: { sl@0: if (iSecMultiPtrEventClient->EventBuffer()->EventsRemaining() != 0) sl@0: { sl@0: iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(ETrue); sl@0: CActiveScheduler::Start(); sl@0: } sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0011 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677,REQ9674, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends Multi Pointer events to correct clients sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate multi pointer events on windows from different client. sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: void CTMultiPtrEventTest::MultiClientMultiPointerEvents() sl@0: { sl@0: // Logic for this test code sl@0: // Create a secondary client when running this test sl@0: // Simulate events for both main client and secondary simulataneously sl@0: // Get events from DoRunL() of event buffer class sl@0: // Before running next set of events, get all the events from secondary client sl@0: // If test fails on any client make sure both active scheduler are stopped sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Multi pointer events for Multi client: %d of 5"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: iSecMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: iSecClientFlush = iSecMultiPtrEventClient->iWs.SetAutoFlush(ETrue); sl@0: } sl@0: sl@0: TPoint ptrPos; sl@0: TInt ptrNum = 0; sl@0: TInt prValue = 0; sl@0: TInt proxValue = 0; sl@0: TInt xInc = (iPhysicalScreenSize.iWidth/2)/iMaxDevPointers; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; sl@0: TPoint secPt(iPhysicalScreenSize.iWidth/2,0); sl@0: TInt ptrSecNum = iMaxDevPointers-1; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: ptrPos.SetXY(0,0); sl@0: sl@0: // These events are generated when primary client is created and its group sl@0: // window constructed and then when button down for primary client is called sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: AddExpectedWsEvent(EEventFocusLost); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: sl@0: // Simulate pointer down/up events for primary client from 0,1,3... pointers and 6,5,4... pointers for secondary client sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: sl@0: ptrPos.iX = iPhysicalScreenSize.iWidth/2; sl@0: ptrPos.iY = 0; sl@0: sl@0: // These events are generated when secondary cleint is created and then when sl@0: // button down for primary client is called, then when SetOrdinalPosition is sl@0: // called on secondary cleint's group window sl@0: AddExpectedWsEvent(EEventFocusGained, ETrue); sl@0: AddExpectedWsEvent(EEventFocusLost, ETrue); sl@0: iSecMultiPtrEventClient->iGroup->GroupWin()->SetOrdinalPosition(0, 1); sl@0: AddExpectedWsEvent(EEventFocusGained, ETrue); sl@0: sl@0: AddExpectedWsEvent(EEventFocusLost); sl@0: sl@0: for (ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: break; sl@0: case 1: sl@0: // Simulate move events from primary and secondary client simultaneously with pressure sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: prValue = iPressureStep; sl@0: sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, prValue, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, secPt, prValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: secPt.iX += xInc; sl@0: secPt.iY += yInc; sl@0: } sl@0: break; sl@0: case 2: sl@0: // Simulate move events from primary and secondary client simultaneously with proximity sl@0: ptrPos.SetXY(0,0); sl@0: proxValue = -iProximityStep; sl@0: sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, proxValue, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, secPt, proxValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: secPt.iX += xInc; sl@0: secPt.iY += yInc; sl@0: } sl@0: break; sl@0: case 3: sl@0: { sl@0: // Simulate drag events on different clients window one after the other sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); sl@0: iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: secPt.iX = iPhysicalScreenSize.iWidth/2; sl@0: secPt.iY = 0; sl@0: ptrSecNum = iMaxDevPointers-1; sl@0: TPoint interPt; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: interPt.iX = ptrPos.iX+2; sl@0: interPt.iY = ptrPos.iY+1; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: interPt.iX = secPt.iX+2; sl@0: interPt.iY = secPt.iY+1; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: secPt.iX += xInc; sl@0: secPt.iY += yInc; sl@0: } sl@0: } sl@0: break; sl@0: case 4: sl@0: { sl@0: // Simulate drag events on different clients, but interleaved each other sl@0: ptrPos.SetXY(0,0); sl@0: secPt.iX = iPhysicalScreenSize.iWidth/2; sl@0: secPt.iY = 0; sl@0: ptrSecNum = iMaxDevPointers-1; sl@0: TPoint interPt; sl@0: sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: secPt.iX += xInc; sl@0: secPt.iY += yInc; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: secPt.iX = iPhysicalScreenSize.iWidth/2; sl@0: secPt.iY = 0; sl@0: ptrSecNum = iMaxDevPointers-1; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) sl@0: { sl@0: interPt.iX = ptrPos.iX+2; sl@0: interPt.iY = ptrPos.iY+1; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: sl@0: sl@0: interPt.iX = secPt.iX+2; sl@0: interPt.iY = secPt.iY+1; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: secPt.iX += xInc; sl@0: secPt.iY += yInc; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: secPt.iX = iPhysicalScreenSize.iWidth/2; sl@0: secPt.iY = 0; sl@0: ptrSecNum = iMaxDevPointers-1; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--) sl@0: { sl@0: interPt.iX = ptrPos.iX+2; sl@0: interPt.iY = ptrPos.iY+1; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: sl@0: interPt.iX = secPt.iX+2; sl@0: interPt.iY = secPt.iY+1; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue); sl@0: secPt.iX += xInc; sl@0: secPt.iY += yInc; sl@0: } sl@0: } sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: iSecMultiPtrEventClient->iWs.SetAutoFlush(iSecClientFlush); sl@0: break; sl@0: } sl@0: sl@0: _LIT(KEventsAdded, "Events added to Primary client's buffer = %d"); sl@0: logText.Format(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); sl@0: LOG_MESSAGE(logText); sl@0: _LIT(KEventsAdded1, "Events added to Secondary client's buffer = %d"); sl@0: logText.Format(KEventsAdded1, iSecMultiPtrEventClient->EventBuffer()->EventsRemaining()); sl@0: LOG_MESSAGE(logText); sl@0: } sl@0: sl@0: sl@0: // RMultiPointerAnim sl@0: RMultiPointerAnim* RMultiPointerAnim::NewL(RWindowBase* aWin, RAnimDll* aDll) sl@0: { sl@0: RMultiPointerAnim* self=new(ELeave) RMultiPointerAnim(aDll); sl@0: CleanupStack::PushL(TCleanupItem(DestroyAnim,self)); sl@0: User::LeaveIfError(self->Construct(*aWin, EAnimTypeMultiPointer, TPtrC8())); sl@0: CleanupStack::Pop(self); sl@0: return self; sl@0: } sl@0: sl@0: TInt RMultiPointerAnim::AddExpectedAnimPointerEvent(TRawEvent::TType aType, TPoint aPos, TInt aZ, TUint /*aModifier*/, TUint8 aPointerNumber, TBool aEat /*= ETrue*/) sl@0: { sl@0: TRawEvent rawEvent; sl@0: rawEvent.Set(aType, aPos.iX, aPos.iY, aZ, aPointerNumber); sl@0: TAnimRawEvent animEvent; sl@0: animEvent.iRawEvent = rawEvent; sl@0: animEvent.iEat = aEat; sl@0: TPckgBuf param; sl@0: param()=animEvent; sl@0: return CommandReply(EADllAddExpectedMultiPtrEvent, param); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::TestAndDisplayAnimError() sl@0: { sl@0: TInt err = iAnim->CommandReply(EADllMultiPtrEventError); sl@0: if (err != KErrNone) sl@0: { sl@0: _LIT(KError, "Failed in Anim dll"); sl@0: LOG_MESSAGE(KError); sl@0: TBuf<255> errDesc; sl@0: errDesc.SetMax(); sl@0: TIpcArgs ipcArgs; sl@0: ipcArgs.Set(KIpcSlot,&errDesc); sl@0: // get the error desccription, print it out and stop the tests sl@0: TInt retVal = iAnim->CommandReply(EADllMultiPtrEventErrorDesc, KNullDesC8, ipcArgs); sl@0: if (retVal == KErrNone) sl@0: { sl@0: LOG_MESSAGE(errDesc); sl@0: } sl@0: Failed(); sl@0: } sl@0: iAnim->CommandReply(EADllMultiPtrEventReset); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0013 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677,REQ9683, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends Multi Pointer events to Anims sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate multi pointer events for anims sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: void CTMultiPtrEventTest::MultiPointerEventsForAnimsL() sl@0: { sl@0: // The logic behind these tests is sl@0: // Create an anim, which creates animation at server side(which swicthes raw event handling on) sl@0: // Add the required events to the animtaion at server side buffer sl@0: // Simulate those events and check simulated events are same as required at server side sl@0: // If any test fail, error description is got from server and displayed in the log file sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Multi pointer events for Anims: %d of 3"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: _LIT(KEventsChecked, "Events checked at server side = %d"); sl@0: sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs); sl@0: User::LeaveIfError(iAnimDll->Load(KAnimDLLName)); sl@0: } sl@0: sl@0: TPoint ptrPos; sl@0: TInt ptrNum = 0; sl@0: TInt prValue = 0; sl@0: TInt proxValue = 0; sl@0: TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // Simulate downup events for all pointers sl@0: iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll); sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum); sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum); sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: TestAndDisplayAnimError(); sl@0: logText.Format(KEventsChecked, iMaxDevPointers*2); sl@0: LOG_MESSAGE(logText); sl@0: break; sl@0: case 1: sl@0: // Simulate moves from different pointer with different pressure sl@0: // Here there is no need for events to be exaclty on the anim window. sl@0: // becasue when the animtaions ask for events it will be delivered all the events sl@0: // irrespective of where they occured. sl@0: ptrPos.SetXY(0,0); sl@0: prValue = iPressureStep; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, prValue, 0, ptrNum); sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum); sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: TestAndDisplayAnimError(); sl@0: sl@0: // This is for just to add run the next test sl@0: SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0); sl@0: sl@0: logText.Format(KEventsChecked, iMaxDevPointers*3); sl@0: LOG_MESSAGE(logText); sl@0: break; sl@0: case 2: sl@0: // Simulate moves from different pointer with different proximity sl@0: ptrPos.SetXY(0,0); sl@0: proxValue = -iProximityStep; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, proxValue, 0, ptrNum); sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum); sl@0: iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum); sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: TestAndDisplayAnimError(); sl@0: sl@0: // This is for just to add run the next test sl@0: SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0); sl@0: sl@0: logText.Format(KEventsChecked, iMaxDevPointers*3); sl@0: LOG_MESSAGE(logText); sl@0: break; sl@0: default: sl@0: DestroyAnimDllAndAnim(); sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0014 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677,REQ9683, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv purges multi pointer events with standard rules sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate raw events to be purged sl@0: @SYMTestExpectedResults The purged events should not be delivered to client sl@0: */ sl@0: void CTMultiPtrEventTest::PurgingMultiPointerEvents() sl@0: { sl@0: // Test purging of multi pointer events sl@0: // 1. Test down/up pairs are purged sl@0: // 2. Test moves events are purged sl@0: // 3. Test drag events are purged sl@0: // 4. Test lone down events are purged sl@0: // 5. And finally test lone up events are also purged sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "Purging of multi pointer events: %d of 6"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: TInt xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize; sl@0: TPoint ptrPos(xInc,yInc); sl@0: TInt ptrNum = 0; sl@0: TInt prValue = 0; sl@0: TInt proxValue = 0; sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: } sl@0: sl@0: // Point to note is that Kernel has an event queue size of 40 sl@0: // So make sure that you don't send more than 40 events sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: // Simulate pointer down/up events for all pointers sl@0: // Simulate many up events from any pointer which will purge down/up events sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) sl@0: { sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: } sl@0: SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize-1, ptrPos); sl@0: break; sl@0: case 1: sl@0: // Repeat the same for Move events sl@0: // Simulate moves for all pointers with different pressure and proximity value sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: prValue = iPressureStep; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && prValue < iMaxPressure && ptrNum < 4); ptrNum++,prValue+=iPressureStep) sl@0: { sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: } sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: proxValue = -iProximityStep; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && proxValue > iMaxProximity && ptrNum < 4); ptrNum++,proxValue-=iProximityStep) sl@0: { sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: } sl@0: SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos); sl@0: break; sl@0: case 2: sl@0: { sl@0: // Repeat the same for drag events sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: TPoint interPt = ptrPos; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) sl@0: { sl@0: interPt.iX += 2; sl@0: interPt.iY += 1; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: interPt = ptrPos; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++) sl@0: { sl@0: interPt.iX += 2; sl@0: interPt.iY += 1; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos); sl@0: } sl@0: break; sl@0: case 3: sl@0: // Repeat the same for lone down events sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: SimulateAndAddLoneUpEvents(KMaxQueueSize+1, KMaxQueueSize, ptrPos); sl@0: sl@0: // Before this we had to send dummy 7 EButton1Up events from 1 to 7 pointers so that iLastUnmatchedDown1 sl@0: // variable to be reset and that consecutive events was not sent to client. But now EPointer3DOutOfRange sl@0: // resets all the variables. sl@0: for (ptrNum = 1; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: } sl@0: break; sl@0: case 4: sl@0: // Finally for even lone up events, check that when you send events more then the queuesize sl@0: // the events are not sent back and they are ignored in wserv sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (TInt count = 0; count < KMaxQueueSize; count++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: // For all up events more then KMaxQueueSize, wserv igoners then as the queue if full sl@0: if (count < (KMaxQueueSize - iMaxDevPointers)) sl@0: { sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); sl@0: } sl@0: } sl@0: break; sl@0: case 5: sl@0: // Check PurgePointerEvents works with multi pointer events sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: iMultiPtrEventClient->iWs.PurgePointerEvents(); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: void CTMultiPtrEventTest::MultiPointerEvents() sl@0: { sl@0: TLogMessageText logText; sl@0: _LIT(KSet, "MultiPtrEvents SetOfEvents: %d of 9"); sl@0: logText.AppendFormat(KSet, iEventSet); sl@0: LOG_MESSAGE(logText); sl@0: sl@0: if (!iEventSet) sl@0: { sl@0: SetAutoFlush(); sl@0: } sl@0: iMultiPtrEventClient->EventBuffer()->SetEventCount(0); sl@0: sl@0: TPoint ptrPos; sl@0: TInt ptrNum = 0; sl@0: TInt prValue = 0; sl@0: TInt proxValue = 0; sl@0: TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers; sl@0: TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers; sl@0: sl@0: switch(iEventSet++) sl@0: { sl@0: case 0: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0001 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9674,REQ9687, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc Checks Wserv sends multi touch pointer events received by it sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate raw events from different pointers sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: INFO_PRINTF1(_L("Simulate pointer events from all pointers")); sl@0: INFO_PRINTF1(_L("Test pattern is PointerDown0/PointerUp0, PointerDown1/PointerUp1, PointerDown2/PointerUp2...")); sl@0: // Test pattern is down0/up0, down1/up1, down2/up2, down3/up3.... sl@0: AddExpectedWsEvent(EEventFocusGained); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrPos, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: break; sl@0: case 1: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0003 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9674,REQ9687, sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends simultaneous multi touch pointer events sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate simultaneous raw events from different pointers sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: INFO_PRINTF1(_L("Test pattern PointerDown0/PointerDown1/PointerDown2/... PointerUp0/PointerUp1/PointerUp2...")); sl@0: // Test pattern is pointer0Down/pointer1Down/pointer2Down/pointer3Down.... pointer0Up/pointer1Up/pointer2Up/pointer3Up.... sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: break; sl@0: case 2: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0005 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9676 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends the multi touch pointer events received sl@0: by it along with the Pressure or Proximity sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate raw events with pressure and proximity from different pointers sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: // Simulate Button1Down with differet pressure sl@0: // Simulate Button1Up with zero pressure sl@0: INFO_PRINTF1(_L("Simulate pointer events with different pressure values")); sl@0: ptrPos.SetXY(0,0); sl@0: prValue = iPressureStep; sl@0: for (; (prValue <= iMaxPressure && ptrPos.iX < iPhysicalScreenSize.iWidth && ptrPos.iY < iPhysicalScreenSize.iHeight); prValue+=iPressureStep) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: sl@0: // Test with max pressure it might be that the width may cross the physical screen size sl@0: ptrPos.SetXY(0,0); sl@0: prValue = iMaxPressure; sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0); sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0); sl@0: break; sl@0: case 3: sl@0: // Simulate EPointerMove with different pressure values and for differernt pointers sl@0: INFO_PRINTF1(_L("Simulate pointer events with different pressure values and from different pointers")); sl@0: ptrPos.SetXY(0,0); sl@0: prValue = iPressureStep; sl@0: sl@0: // Enable move events sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0); sl@0: sl@0: // Right now when 2 or more moves occur, wserv deletes all the moves except the last one. sl@0: // So test only one move per Pointer and then one set of button down and button up sl@0: // Then repeat the same for different pressure values sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrPos, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: sl@0: // Test moves with different pressure sl@0: ptrPos.SetXY(0,0); sl@0: if ((prValue+iPressureStep) <= iMaxPressure) sl@0: { sl@0: prValue += iPressureStep; sl@0: } sl@0: ptrNum = 0; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); sl@0: break; sl@0: case 4: sl@0: INFO_PRINTF1(_L("Simulate pointer events with different proximity values")); sl@0: // Repeat the same test of case 3 for different proximity values sl@0: ptrPos.SetXY(0,0); sl@0: sl@0: proxValue = -iProximityStep; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerDownUp(ptrPos, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: if ((proxValue-iProximityStep) > iMaxProximity) sl@0: { sl@0: proxValue -= iProximityStep; sl@0: } sl@0: ptrNum = 0; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: break; sl@0: case 5: sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0007 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends move/drags of different pointers sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate raw move and drag events from different pointers sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: INFO_PRINTF1(_L("Simulate pointer drag events")); sl@0: ptrPos.SetXY(0,0); sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0); sl@0: sl@0: // Simulate EButton1Down and then one move and then EButton1Up event sl@0: // which will lead to corresponding drag, do it for all the pointers sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: TestDragForMultiPointer(ptrPos, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: sl@0: // Check the drag with different pressure value with different pointer sl@0: prValue = iPressureStep; sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: if ((prValue+iPressureStep) <= iMaxPressure) sl@0: { sl@0: prValue += iPressureStep; sl@0: } sl@0: ptrNum = 0; sl@0: TestDragForMultiPointer(ptrPos, prValue, ptrNum); sl@0: break; sl@0: case 6: sl@0: { sl@0: /** sl@0: @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0009 sl@0: @SYMPREQ PREQ1226 sl@0: @SYMREQ REQ9677, REQ9674 sl@0: @SYMTestPriority High sl@0: @SYMTestCaseDesc To check Wserv sends simultaneous move/drags of different pointers sl@0: @SYMTestStatus Implemented sl@0: sl@0: @SYMTestActions Simulate simulatneous raw move and drag events from different pointers sl@0: @SYMTestExpectedResults The received events must match the simulated raw events sl@0: */ sl@0: INFO_PRINTF1(_L("Simulate pointer drag events in different pattern")); sl@0: // Dragging done in this pattern sl@0: // pointer0Down/pointer1Down/pointer2Down/pointer3Down... pointer0Up/pointer1Up/pointer2Up/pointer3Up.... sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: TPoint interPt = ptrPos; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: interPt.iX += 2; sl@0: interPt.iY += 1; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: interPt = ptrPos; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++) sl@0: { sl@0: interPt.iX += 2; sl@0: interPt.iY += 1; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: break; sl@0: } sl@0: case 7: sl@0: { sl@0: // Mixing of drag and moves of different pointers sl@0: ptrPos.SetXY(0,0); sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: } sl@0: ptrPos.SetXY(0,0); sl@0: TPoint interPt = ptrPos; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: interPt.iX += 2; sl@0: interPt.iY += 1; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: interPt = ptrPos; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: interPt.iX += 2; sl@0: interPt.iY += 1; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum); sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: interPt = ptrPos; sl@0: } sl@0: sl@0: ptrPos.SetXY(0,0); sl@0: prValue = iPressureStep; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2 && prValue < iMaxPressure; ptrNum++, prValue+=iPressureStep) sl@0: { sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum); sl@0: ptrPos.iX += xInc; sl@0: ptrPos.iY += yInc; sl@0: } sl@0: } sl@0: break; sl@0: case 8: sl@0: { sl@0: INFO_PRINTF1(_L("Check intermediate Moves and Drags are deleted except last event")); sl@0: // Check if intermediate move and drag events are deleted sl@0: // The deletion is done with respect to same pointer and same window sl@0: xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize; sl@0: yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize; sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: TInt count = 0; sl@0: sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: // Make sure that ptrPos does not go out of screen area, i,e the loop count should not exceed 4 sl@0: for (count = proxValue = 0; proxValue > iMaxProximity && count < 4; proxValue=proxValue-(4*iProximityStep), count++) sl@0: { sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum); sl@0: } sl@0: // Since the for loop increments the variables at the end sl@0: proxValue = proxValue + (4*iProximityStep); sl@0: AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum); sl@0: } sl@0: sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum); sl@0: } sl@0: sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: // Make sure that ptrPos does not go out of screen area, i,e the loop count shuld not exceed 4 sl@0: for (count = prValue = 0; prValue < iMaxPressure && count < 4; prValue=prValue+(4*iPressureStep), count++) sl@0: { sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum); sl@0: } sl@0: prValue = prValue-(4*iPressureStep); sl@0: AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, prValue, 0, ptrNum); sl@0: } sl@0: sl@0: ptrPos.iX = xInc; sl@0: ptrPos.iY = yInc; sl@0: for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++) sl@0: { sl@0: ptrPos.iX += xInc/2; sl@0: ptrPos.iY += yInc/2; sl@0: SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum); sl@0: AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum); sl@0: } sl@0: } sl@0: break; sl@0: default: sl@0: ResetFlushStopAS(); sl@0: break; sl@0: } sl@0: sl@0: LogEventsAdded(); sl@0: } sl@0: sl@0: // Logs number of events added to test buffer for comaparison sl@0: void CTMultiPtrEventTest::LogEventsAdded() sl@0: { sl@0: TLogMessageText logText1; sl@0: _LIT(KEventsAdded, "Events added to buffer = %d"); sl@0: logText1.AppendFormat(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); sl@0: LOG_MESSAGE(logText1); sl@0: } sl@0: sl@0: // If any of the Tests fails, bring the wserv in a consistent state for other test to run, sl@0: // stop ActiveScheduler and display some logs where the fail occured. sl@0: void CTMultiPtrEventTest::Failed() sl@0: { sl@0: switch (iTest->iState) sl@0: { sl@0: case 2: // Anim tests sl@0: DestroyAnimDllAndAnim(); sl@0: break; sl@0: case 3: // MultiClient tests sl@0: if (iMultiPtrEventClient->EventBuffer()->NestedLoopState()) sl@0: { sl@0: iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(EFalse); sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: break; sl@0: case 4: //PtrClick tests sl@0: if (iPtrPluginLoaded) sl@0: { sl@0: iPtrPluginLoaded = EFalse; sl@0: iClick.Unload(); sl@0: iClick.Close(); sl@0: } sl@0: if (iHeap) sl@0: { sl@0: iHeap->Close(); sl@0: iHeap = NULL; sl@0: iChunk.Close(); sl@0: } sl@0: break; sl@0: case 5: //Screen mode tests sl@0: SetDefaultScreenMode(); sl@0: break; sl@0: case 11: sl@0: iMultiPtrEventClient->DeleteGroupBlankWin(); sl@0: break; sl@0: case 12: //Emulation tests, iEventSet is incremented in main switch case. sl@0: switch (iEventSet) sl@0: { sl@0: case 9: sl@0: DeleteGroupWin(); sl@0: break; sl@0: case 10: sl@0: DestroyAnimDllAndAnim(); sl@0: break; sl@0: case 11: sl@0: case 12: sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer(); sl@0: iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer(); sl@0: break; sl@0: case 14: sl@0: case 15: sl@0: iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea); sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: break; sl@0: case 15: sl@0: if (iEventSet > 1) sl@0: { sl@0: DeleteGroupWinForCapturing(); sl@0: } sl@0: break; sl@0: case 13: sl@0: case 16: sl@0: SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt); sl@0: break; sl@0: default: sl@0: break; sl@0: } sl@0: sl@0: if (iActiveSchedulerStarted) sl@0: { sl@0: iActiveSchedulerStarted = EFalse; sl@0: CActiveScheduler::Stop(); sl@0: } sl@0: sl@0: // Display the test case number, subtest case number and number of events left in the buffer which can be used to sl@0: // find out which event actually caused the failure when any test fails sl@0: TLogMessageText logText1; sl@0: _LIT(KEventsAdded, "Test case number %d Sub test case number %d Events remaining in the buffer %d \n"); sl@0: logText1.AppendFormat(KEventsAdded, iTest->iState, iEventSet, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); sl@0: LOG_MESSAGE(logText1); sl@0: RDebug::Printf("Test case number %d Sub test case number %d Events remaining in the buffer %d \n", iTest->iState, iEventSet, iMultiPtrEventClient->EventBuffer()->EventsRemaining()); sl@0: sl@0: iFailed=ETrue; sl@0: } sl@0: sl@0: // This function is called by TestExecute Framework, through which all the testcases are run sl@0: void CTMultiPtrEventTest::RunTestCaseL(TInt /*aCurTestCase*/) sl@0: { sl@0: _LIT(KTest0, "MultiPointerEvents with Pressure and Proximity"); sl@0: _LIT(KTest1, "Purging Of MultiPointerEvents"); sl@0: _LIT(KTest2, "MultiPointerEvents for Anims"); sl@0: _LIT(KTest3, "MultiPointerEvents from multi client"); sl@0: _LIT(KTest4, "MultiPointerEvents for pointer click plugin"); sl@0: _LIT(KTest5, "MultiPointerEvents In Different ScreenModes"); sl@0: _LIT(KTest6, "Filtering Of MultiPointerEvents"); sl@0: _LIT(KTest7, "Grabbing Of MultiPointerEvents"); sl@0: _LIT(KTest8, "VirtualKeyboard for Multiple Pointers"); sl@0: _LIT(KTest9, "DoubleClick events for Multiple Pointer"); sl@0: _LIT(KTest10, "OutOfRange & EnterExit for Multiple Pointer"); sl@0: _LIT(KTest11, "Auto foreground for Multiple Pointer"); sl@0: _LIT(KTest12, "Emulation rules for Mulitple Pointers"); sl@0: _LIT(KTest13, "Close proximity and High Pressure events"); sl@0: _LIT(KTest14, "Out of bound value testing"); sl@0: _LIT(KTest15, "Capturing Of MultiPointerEvents"); sl@0: _LIT(KTest16, "Negative testing for Proximity and Pressure events"); sl@0: _LIT(KTest17, "PointerRepeatEvent for Multiple Pointers"); 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: switch(iTest->iState) sl@0: { sl@0: case 0: sl@0: iTest->LogSubTest(KTest0); sl@0: RunTestsL(); sl@0: break; sl@0: case 1: sl@0: iTest->LogSubTest(KTest1); sl@0: RunTestsL(); sl@0: break; sl@0: case 2: sl@0: iTest->LogSubTest(KTest2); sl@0: RunTestsL(); sl@0: break; sl@0: case 3: sl@0: iTest->LogSubTest(KTest3); sl@0: RunTestsL(); sl@0: break; sl@0: case 4: sl@0: iTest->LogSubTest(KTest4); sl@0: RunTestsL(); sl@0: break; sl@0: case 5: sl@0: iTest->LogSubTest(KTest5); sl@0: RunTestsL(); sl@0: break; sl@0: case 6: sl@0: iTest->LogSubTest(KTest6); sl@0: RunTestsL(); sl@0: break; sl@0: case 7: sl@0: iTest->LogSubTest(KTest7); sl@0: RunTestsL(); sl@0: break; sl@0: case 8: sl@0: iTest->LogSubTest(KTest8); sl@0: RunTestsL(); sl@0: break; sl@0: case 9: sl@0: iTest->LogSubTest(KTest9); sl@0: RunTestsL(); sl@0: break; sl@0: case 10: sl@0: iTest->LogSubTest(KTest10); sl@0: RunTestsL(); sl@0: break; sl@0: case 11: sl@0: iTest->LogSubTest(KTest11); sl@0: RunTestsL(); sl@0: break; sl@0: case 12: sl@0: iTest->LogSubTest(KTest12); sl@0: RunTestsL(); sl@0: break; sl@0: case 13: sl@0: iTest->LogSubTest(KTest13); sl@0: RunTestsL(); sl@0: break; sl@0: case 14: sl@0: iTest->LogSubTest(KTest14); sl@0: RunTestsL(); sl@0: break; sl@0: case 15: sl@0: iTest->LogSubTest(KTest15); sl@0: RunTestsL(); sl@0: break; sl@0: case 16: sl@0: iTest->LogSubTest(KTest16); sl@0: RunTestsL(); sl@0: break; sl@0: case 17: sl@0: iTest->LogSubTest(KTest17); sl@0: RunTestsL(); sl@0: break; sl@0: case 18: sl@0: // Keep this code in last case statement for main test completion sl@0: TestComplete(); sl@0: break; sl@0: default: sl@0: AutoPanic(EAutoPanicWrongTest); sl@0: } sl@0: sl@0: // 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: // Macro which is used for construction of CTMultiPtrEventTestStep object sl@0: // and also used to call CreateTestL() which creates CTMultiPtrEventTest and CTestBase objects sl@0: __WS_CONSTRUCT_STEP__(MultiPtrEventTest)