Update contrib.
1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Multi pointer and Z-coordinate test code
21 @internalComponent - Internal Symbian test code
24 #ifndef __INIPARSER_H__
25 #define __INIPARSER_H__
26 #endif // __INIPARSER_H__
28 #include "PARSEINIDATA.H"
29 #include "tmultiptrevent.h"
33 //#define FAILLOG 1 // Uncomment this code to get detailed log
34 #define TESTMULTIPOINTER 1 // Comment this line to get detailed log without testing
36 _LIT(KMultiPtrPluginDll, "multiptrclick.dll");
38 const TInt KErrDescSize = 128;
39 const TInt KMaxQueueSize = 32; // Queue size of wserv. In any test we cannot test more than MaxQueueSize events.
41 LOCAL_C void DestroyAnim(TAny* aAnim)
43 (static_cast<RMultiPointerAnim*>(aAnim))->Destroy();
47 //CTMultiPtrEventBuffer
48 CTMultiPtrEventBuffer::CTMultiPtrEventBuffer(RWsSession *aWs, CTMultiPtrEventTest *aTest, CTMultiPtrEventClient* aClient)
49 : CTEvent(aWs), iTest(aTest), iClient(aClient)
53 void CTMultiPtrEventBuffer::ConstructL()
55 CTEventBase::Construct();
56 iEventBuffer.SetLengthL(EEventBufferSize);
57 iMovePtsBuffer.SetLengthL(EMovePtsBuffer);
60 void CTMultiPtrEventBuffer::AddExpectedEvent(TWsEvent &aEvent)
62 iEventBuffer.Add(&aEvent);
65 void CTMultiPtrEventBuffer::AddExpectedMovePtEvent(TPoint &aMovePt)
67 iMovePtsBuffer.Add(&aMovePt);
70 TInt CTMultiPtrEventBuffer::EventsRemaining()
72 return iEventBuffer.Count();
75 void CTMultiPtrEventBuffer::GetMoveBufferAndCompareL()
77 TBuf8<EMovePtsBuffer*sizeof(TPoint)> buf;
78 iClient->ParentWin()->BaseWin()->RetrievePointerMoveBuffer(buf);
80 TUint bufferSize = buf.Length();
81 TUint numLoop = bufferSize/sizeof(TPoint);
83 if (iMovePtsBuffer.Count() != numLoop)
86 TLogMessageText logText;
87 _LIT(KPointerNumber, "Actual number of move/drag buffer points from Wserv = %d Expected number of move/drag buffer points = %d ");
88 logText.Format(KPointerNumber, numLoop, iMovePtsBuffer.Count());
89 iTest->LOG_MESSAGE(logText);
96 TUint8* BasePtr = const_cast<TUint8*>(buf.Ptr());
97 for (TUint count = 0; count < numLoop; count++)
99 wsPoint = *(reinterpret_cast<TPoint*>(BasePtr));
100 iMovePtsBuffer.Remove(&expPoint);
101 if (wsPoint != expPoint)
104 TLogMessageText logText;
105 _LIT(KMoveBufferPoint, "Actual move/drag buffer point from Wserv = ([%d], [%d]) Expected move/drag buffer point = ([%d], [%d])");
106 logText.Format(KMoveBufferPoint, wsPoint.iX, wsPoint.iY, expPoint.iX, expPoint.iY);
107 iTest->LOG_MESSAGE(logText);
111 BasePtr = BasePtr + sizeof(TPoint);
116 #define TESTXL(expr1, oper, expr2, event, expected) \
117 TestL(expr1 oper expr2, expr1, expr2, #oper, #expr1 ## #oper ## #expr2, \
118 event, expected, __FILE__, __LINE__);
120 // Main function which gets the event, checks with the event in buffer
121 // Then calls function NextSetOfEventsL for running other tests of a particualar test case
122 void CTMultiPtrEventBuffer::doRunL()
124 // Get the event from wserv
126 iWs->GetEvent(wsEvent);
128 TWsEvent expectedEvent;
129 TInt wsType=wsEvent.Type();
130 if (wsEvent.Type()==EEventNull)
132 TESTXL(wsEvent.Handle(), ==, 0, &wsEvent, NULL);
135 // This code is for running successive anim test code
136 if (wsEvent.Type()==EEventPointer && wsEvent.Pointer()->iType==TPointerEvent::ESwitchOn)
138 // if this is called accidentally
139 if (iEventBuffer.Count()==0 && wsType==EEventFocusGained)
142 iEventBuffer.Remove(&expectedEvent);
145 if (wsEvent.Type() == EEventPointerBufferReady)
147 GetMoveBufferAndCompareL();
149 TLogMessageText logText;
150 _LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d ");
151 logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle());
152 iTest->LOG_MESSAGE(logText);
154 #if defined(TESTMULTIPOINTER)
155 TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent);
160 // Test wsEvent and expected event have same handle, position and type.
163 TLogMessageText logText;
164 _LIT(KEventCountCheck, "Checking event number = %d");
165 logText.Format(KEventCountCheck, iEventCount);
166 iTest->LOG_MESSAGE(logText);
167 _LIT(KEventType, "Actual Event type from Wserv = %d Expected Event Type = %d ");
168 logText.Format(KEventType, wsEvent.Type(), expectedEvent.Type());
169 iTest->LOG_MESSAGE(logText);
173 #if defined(TESTMULTIPOINTER)
174 TESTXL(wsEvent.Type(), ==, expectedEvent.Type(), &wsEvent, &expectedEvent);
176 // Test pointer number for Enter/Exit events
177 if (wsType == EEventPointerEnter || wsType == EEventPointerExit)
180 TLogMessageText logText;
181 _LIT(KPointerNumber, "Actual PointerNumber for Enter/Exit event from Wserv = %d Expected PointerNumber for Enter/Exit event = %d ");
182 logText.Format(KPointerNumber, *wsEvent.Int(), *expectedEvent.Int());
183 iTest->LOG_MESSAGE(logText);
185 #if defined(TESTMULTIPOINTER)
186 TESTXL(*wsEvent.Int(), ==, *expectedEvent.Int(), &wsEvent, &expectedEvent);
190 // Test only if it is a Pointer event
191 if (wsType==EEventPointer)
193 TAdvancedPointerEvent* expectedPointerEvent=expectedEvent.Pointer();
194 TAdvancedPointerEvent* actualPointerEvent=wsEvent.Pointer();
196 TLogMessageText logText;
197 _LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d ");
198 logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle());
199 iTest->LOG_MESSAGE(logText);
201 #if defined(TESTMULTIPOINTER)
202 TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent);
205 _LIT(KPointerType, "Actual PointerType from Wserv = %d Expected PointerType = %d ");
206 logText.Format(KPointerType, actualPointerEvent->iType, expectedPointerEvent->iType);
207 iTest->LOG_MESSAGE(logText);
209 #if defined(TESTMULTIPOINTER)
210 TESTXL(actualPointerEvent->iType, ==, expectedPointerEvent->iType, &wsEvent, &expectedEvent);
213 _LIT(KPointerPosition, "Actual PointerPosition from Wserv = (%d, %d) Expected PointerPosition = (%d, %d) ");
214 logText.Format(KPointerPosition, actualPointerEvent->iPosition.iX, actualPointerEvent->iPosition.iY, expectedPointerEvent->iPosition.iX, expectedPointerEvent->iPosition.iY);
215 iTest->LOG_MESSAGE(logText);
217 #if defined(TESTMULTIPOINTER)
218 TESTXL(actualPointerEvent->iPosition, ==, expectedPointerEvent->iPosition, &wsEvent, &expectedEvent);
221 _LIT(KPointerNumber, "Actual PointerNumber from Wserv = %d Expected PointerNumber = %d ");
222 logText.Format(KPointerNumber, actualPointerEvent->PointerNumber(), expectedPointerEvent->PointerNumber());
223 iTest->LOG_MESSAGE(logText);
225 #if defined(TESTMULTIPOINTER)
226 TESTXL(actualPointerEvent->PointerNumber(), ==, expectedPointerEvent->PointerNumber(), &wsEvent, &expectedEvent);
229 _LIT(KPointerProximity, "Actual PointerProximity from Wserv = %d Expected PointerProximity = %d ");
230 logText.Format(KPointerProximity, actualPointerEvent->Proximity(), expectedPointerEvent->Proximity());
231 iTest->LOG_MESSAGE(logText);
233 #if defined(TESTMULTIPOINTER)
234 TESTXL(actualPointerEvent->Proximity(), ==, expectedPointerEvent->Proximity(), &wsEvent, &expectedEvent);
237 _LIT(KPointerPressure, "Actual PointerPressure from Wserv = %d Expected PointerPressure = %d ");
238 logText.Format(KPointerPressure, actualPointerEvent->Pressure(), expectedPointerEvent->Pressure());
239 iTest->LOG_MESSAGE(logText);
241 #if defined(TESTMULTIPOINTER)
242 TESTXL(actualPointerEvent->Pressure(), ==, expectedPointerEvent->Pressure(), &wsEvent, &expectedEvent);
245 _LIT(KPointerModifier, "Actual Modifier value from Wserv = 0x%08x Expected Modfier value = 0x%08x ");
246 logText.Format(KPointerModifier, actualPointerEvent->iModifiers, expectedPointerEvent->iModifiers);
247 iTest->LOG_MESSAGE(logText);
249 #if defined(TESTMULTIPOINTER)
250 TESTXL((actualPointerEvent->iModifiers&expectedPointerEvent->iModifiers), ==, expectedPointerEvent->iModifiers, &wsEvent, &expectedEvent);
254 // Call NextSetOfEvents() only for primary client
255 if (iEventBuffer.Count()==0 && !iClient->IsSecondaryClient())
257 iTest->NextSetOfEventsL(); // Cannot Leave
260 // If this is for secondary client and active scheduler(nested loop) has started, this code stops that scheduler
261 if (iEventBuffer.Count()==0 && iClient->IsSecondaryClient() && iNestedLoopStarted)
263 iNestedLoopStarted = EFalse;
264 CActiveScheduler::Stop();
268 void CTMultiPtrEventBuffer::TestL(TInt aTest)
273 User::Leave(ETestFailed);
277 static void DumpEvent(const char *aName, const TWsEvent *aEvent)
279 // aEvent may be NULL - if it isn't NULL, we print it's data.
282 RDebug::Printf("%s:", aName);
283 RDebug::Printf("handle = %u", aEvent->Handle());
284 RDebug::Printf("type() = %d", aEvent->Type());
285 if (aEvent->Type() == EEventPointer)
287 TAdvancedPointerEvent *pointer = aEvent->Pointer();
288 RDebug::Printf("pointer type = %d, position = (%d, %d)",
289 pointer->iType, pointer->iPosition.iX, pointer->iPosition.iY);
290 RDebug::Printf("PointerNumber() = %d, proximity=%d, pressure=%d",
291 pointer->PointerNumber(), pointer->Proximity(), pointer->Pressure());
292 RDebug::Printf("modifiers = 0x%08x", pointer->iModifiers);
296 RDebug::Printf("Not a pointer event, event type");
301 // aEvent is NULL, just let us know it is.
302 RDebug::Printf("%s: is NULL which means not applicapable");
306 void CTMultiPtrEventBuffer::TestL(TInt aTest, TInt aVal1, TInt aVal2, const char *aOper, const char *aTestStr,
307 const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine)
311 RDebug::Printf("Expression %d %s %d [%s] (=%d) failed [call from %s:%d]", aVal1, aOper, aVal2, aTestStr, aTest, aFile, aLine);
312 DumpEvent("actual", aEvent);
313 DumpEvent("expected", aExpected);
315 User::Leave(ETestFailed);
320 void CTMultiPtrEventBuffer::TestL(TInt aTest, TPoint aVal1, TPoint aVal2, const char *oper, const char *aTestStr,
321 const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine)
325 RDebug::Printf("Expression (%d, %d) %s (%d, %d) [%s] (=%d) failed [call from %s:%d]",
326 aVal1.iX, aVal1.iY, oper, aVal2.iX, aVal2.iY, aTestStr, aTest, aFile, aLine);
327 DumpEvent("actual", aEvent);
328 DumpEvent("expected", aExpected);
330 User::Leave(ETestFailed);
334 //CTMultiPtrEventClient
335 CTMultiPtrEventClient::CTMultiPtrEventClient(CTMultiPtrEventTest *aTest, TBool aSecondaryClient)
336 : iTest(aTest), iSecondaryClient(aSecondaryClient)
340 CTMultiPtrEventClient::~CTMultiPtrEventClient()
342 if (iWinAutoFocus1 || iWinAutoFocus2 || iGroupWinAutoFocus2 || iGroupWinAutoFocus1)
344 DeleteGroupBlankWin();
350 void CTMultiPtrEventClient::ConstructL()
352 CTClient::ConstructL();
354 // Create a group window and assign it iGroup
355 iGroup = new(ELeave) CTWindowGroup(this);
356 iGroup->ConstructL();
358 iParentWinSize = iScreen->SizeInPixels();
359 iParentWinPos = TPoint();
361 // Change the parent window size and position for secondary client
362 if (iSecondaryClient)
364 iParentWinSize.iWidth /= 2;
365 iParentWinPos.iX = iParentWinSize.iWidth;
368 // Create window/s for this client so that events can come to this client
369 iParentWin=new(ELeave) CTBlankWindow();
370 iParentWin->ConstructL(*iGroup);
371 iParentWin->SetExt(iParentWinPos, iParentWinSize);
372 iParentWin->SetColor(KRgbRed);
373 if (iTest->TestBase()->iState != 12)
375 iParentWin->BaseWin()->EnableAdvancedPointers();
377 iParentWin->Activate();
379 // Don't create child window for secodary client
380 if (!iSecondaryClient)
382 iChildWinSize = TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight);
383 iChildWinPos = TPoint(iParentWinSize.iWidth/2,0);
385 iChildWin=new(ELeave) CTBlankWindow();
386 iChildWin->ConstructL(*iGroup);
387 iChildWin->SetExt(iChildWinPos, iChildWinSize);
388 iChildWin->SetColor(KRgbRed);
389 iChildWin->BaseWin()->EnableAdvancedPointers();
390 iChildWin->Activate();
394 void CTMultiPtrEventClient::CalculatePtrPosAndSet3Ddata(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TUint aModifiers, TInt aZ, TUint8 aPointerNumber, TUint aHandle)
396 // If in future you need to change parent position then put this in corresponding if statements
397 aEvent.Pointer()->iParentPosition = aPos;
399 // This is for Auto foreground test
400 if (iTest->TestBase()->iState == 11)
402 if (TRect(iWinPosAutoFocus1, iWinSizeAutoFocus1).Contains(aPos))
404 aPos -= iWinPosAutoFocus1;
405 aEvent.SetHandle((TUint)iWinAutoFocus1);
407 else if (TRect(iWinPosAutoFocus2, iWinSizeAutoFocus2).Contains(aPos))
409 aPos -= iWinPosAutoFocus2;
410 aEvent.SetHandle((TUint)iWinAutoFocus2);
415 // Here simulated pointer position is w.r.t to 0,0
416 // Actual pointer position is w.r.t windowPosition
417 if (iSecondaryClient)
419 if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth, iParentWinSize.iHeight)).Contains(aPos))
421 // Since for secondary client parent window is at half of screensize
422 aPos -= iParentWinPos;
423 aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle);
428 // If sent position is on blankWindow then
429 if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight)).Contains(aPos))
431 aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle);
433 else // else the pointer event occured on child window
435 // if aPos < 0 then position has been generated in test code and should not be adjusted
438 aPos -= iChildWinPos;
440 aEvent.SetHandle((aHandle == 0) ? (TUint)iChildWin : aHandle);
445 aEvent.Pointer()->iType = aType;
446 aEvent.Pointer()->iPosition = aPos;
447 if(iExpectNonAdvancedPointerEvents)
449 aEvent.Pointer()->iModifiers = aModifiers;
453 aEvent.Pointer()->iModifiers = aModifiers|EModifierAdvancedPointerEvent;
454 aEvent.SetPointerNumber(aPointerNumber);
455 aEvent.SetPointerZ(aZ);
459 void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle)
461 AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle);
464 void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle)
467 ptrEvent.SetType(EEventPointer);
468 if (aType != TPointerEvent::ESwitchOn)
470 CalculatePtrPosAndSet3Ddata(ptrEvent, aType, aPos, aModifier, aZ, aPointerNumber, aHandle);
472 static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent);
475 void CTMultiPtrEventClient::AddExpectedWsEvent(TEventCode aType, TInt aPointerNumber, TUint aHandle)
478 ptrEvent.SetType(aType);
479 if (aType == EEventPointerEnter || aType == EEventPointerExit)
481 *ptrEvent.Int() = aPointerNumber;
483 if (aType == EEventPointerBufferReady)
485 ptrEvent.SetHandle(aHandle);
487 static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent);
490 void CTMultiPtrEventClient::AddExpectedMovePoint(TPoint aPos)
492 static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedMovePtEvent(aPos);
495 // Create and store CTMultiPtrEventBuffer in iEventHandler
496 void CTMultiPtrEventClient::ConstructEventHandlerL()
498 CTMultiPtrEventBuffer* eventBufferAndHandler = new(ELeave) CTMultiPtrEventBuffer(&iWs, iTest, this);
499 eventBufferAndHandler->ConstructL();
500 iEventHandler = eventBufferAndHandler;
503 // Create groupwindow and blank window for AutoFocus tests
504 void CTMultiPtrEventClient::ConstructGroupBlankWinL()
506 iWinPosAutoFocus1 = TPoint(10,10);
507 iWinSizeAutoFocus1 = TSize(40,40);
509 iWinPosAutoFocus2 = TPoint(50,50);
510 iWinSizeAutoFocus2 = TSize(80,80);
512 iGroupWinAutoFocus1 = new(ELeave) CTWindowGroup(this);
513 iGroupWinAutoFocus1->ConstructL();
514 iGroupWinAutoFocus1->GroupWin()->AutoForeground(ETrue);
515 iGroupWinAutoFocus1->GroupWin()->EnableFocusChangeEvents();
517 iGroupWinAutoFocus2 = new(ELeave) CTWindowGroup(this);
518 iGroupWinAutoFocus2->ConstructL();
519 iGroupWinAutoFocus2->GroupWin()->AutoForeground(ETrue);
520 iGroupWinAutoFocus2->GroupWin()->EnableFocusChangeEvents();
522 iWinAutoFocus1=new(ELeave) CTBlankWindow();
523 iWinAutoFocus1->ConstructL(*iGroupWinAutoFocus1);
524 iWinAutoFocus1->SetExt(iWinPosAutoFocus1, iWinSizeAutoFocus1);
525 iWinAutoFocus1->SetColor(KRgbDarkYellow);
526 iWinAutoFocus1->BaseWin()->EnableAdvancedPointers();
527 iWinAutoFocus1->Activate();
529 iWinAutoFocus2=new(ELeave) CTBlankWindow();
530 iWinAutoFocus2->ConstructL(*iGroupWinAutoFocus2);
531 iWinAutoFocus2->SetExt(iWinPosAutoFocus2, iWinSizeAutoFocus2);
532 iWinAutoFocus2->SetColor(KRgbDarkCyan);
533 iWinAutoFocus2->BaseWin()->EnableAdvancedPointers();
534 iWinAutoFocus2->Activate();
537 void CTMultiPtrEventClient::DeleteGroupBlankWin()
539 delete iWinAutoFocus2;
540 iWinAutoFocus2 = NULL;
541 delete iGroupWinAutoFocus2;
542 iGroupWinAutoFocus2 = NULL;
543 delete iWinAutoFocus1;
544 iWinAutoFocus1 = NULL;
545 delete iGroupWinAutoFocus1;
546 iGroupWinAutoFocus1 = NULL;
549 TBool CTMultiPtrEventClient::CheckOrdinalPosition(TInt aAutoFocusWin)
551 if (aAutoFocusWin == 1)
553 return iWinAutoFocus1->BaseWin()->OrdinalPosition() == 0;
557 return iWinAutoFocus2->BaseWin()->OrdinalPosition() == 0;
561 //CTMultiPtrEventTest
562 CTMultiPtrEventTest::CTMultiPtrEventTest(CTestStep* aStep)
563 : CTWsGraphicsBase(aStep)
567 CTMultiPtrEventTest::~CTMultiPtrEventTest()
569 ((CTMultiPtrEventTestStep*)iStep)->CloseTMSGraphicsStep();
570 delete iMultiPtrEventClient;
571 DestroyAnimDllAndAnim();
572 if (iPtrPluginLoaded)
585 void CTMultiPtrEventTest::ConstructL()
587 // Here check if the HAL configuration are correct if not then finish the test case
588 TInt ret = HAL::Get(HALData::EPointerMaxPointers, iMaxDevPointers);
589 if (ret != KErrNone || iMaxDevPointers < 2 || iMaxDevPointers > 8)
591 TLogMessageText logText1;
592 _LIT(KWrongHALConfig, "HAL configuration are incorrect. \n");
593 logText1.Append(KWrongHALConfig);
594 LOG_MESSAGE(logText1);
599 // Get the data by using HAL api
600 User::LeaveIfError(HAL::Get(HALData::EPointerMaxPointers,iMaxDevPointers));
601 User::LeaveIfError(HAL::Get(HALData::EPointerNumberOfPointers,iMaxUiPointers));
602 User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxPressure, iMaxPressure));
603 User::LeaveIfError(HAL::Get(HALData::EPointer3DPressureStep, iPressureStep));
604 User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxProximity, iMaxProximity));
605 User::LeaveIfError(HAL::Get(HALData::EPointer3DProximityStep, iProximityStep));
607 _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini");
608 CIniData* iniData = CIniData::NewL(KWsIniFile, ' ');
609 _LIT( KWsiniYShifting, "YSHIFTING");
610 iniData->FindVar(KWsiniYShifting, iYOffset);
612 TheClient->iScreen->SetAppScreenMode(0);
613 TheClient->iScreen->SetScreenMode(0);
614 iPhysicalScreenSize = TheClient->iScreen->SizeInPixels();
616 TheGc->Activate(*BaseWin->Win());
617 TheGc->SetBrushColor(TRgb::Gray16(12));
618 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
619 TheGc->SetPenStyle(CGraphicsContext::ENullPen);
620 TheGc->DrawRect(TRect(BaseWin->Win()->Size()));
623 TheGc->Activate(*TestWin->Win());
624 TheGc->SetBrushColor(TRgb::Gray16(4));
625 TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
626 TheGc->SetPenStyle(CGraphicsContext::ENullPen);
627 TheGc->DrawRect(TRect(TestWin->Win()->Size()));
630 TheClient->iWs.Flush();
633 // Create raw event setting type, X, Y, Z and pointernumber for rawevent
634 // use UserSvr for simulating the event
635 void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber)
638 rawEvent.Set(aType, aX, aY+iYOffset, aPointerNumber);
639 UserSvr::AddEvent(rawEvent);
642 void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber)
645 rawEvent.Set(aType, aX, aY+iYOffset, aZ, aPointerNumber);
646 UserSvr::AddEvent(rawEvent);
649 // Simulate multipointer down and up event
650 void CTMultiPtrEventTest::SimulatePointerDownUp(TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber)
652 SimulatePointerEvent(TRawEvent::EButton1Down, aX, aY, aZ, aPointerNumber);
653 SimulatePointerEvent(TRawEvent::EButton1Up, aX, aY, aZ, aPointerNumber);
656 void CTMultiPtrEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
658 TPckgBuf<TWsEvent> evtPkg;
659 TWsEvent& event=evtPkg();
660 if (aEventCode==EEventKey && aCode==0)
662 event.SetType(aEventCode);
663 event.SetHandle((TUint)iMultiPtrEventClient->iGroup);
664 event.Key()->iCode=aCode;
665 event.Key()->iScanCode=aScanCode;
666 event.Key()->iModifiers=aModifiers;
667 event.Key()->iRepeats=aRepeats;
668 iMultiPtrEventClient->EventBuffer()->AddExpectedEvent(event);
671 void CTMultiPtrEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
673 __ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital));
674 AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,aModifiers);
675 AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers);
676 AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,aModifiers);
679 void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle)
681 AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle);
684 void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle, TBool aSecondaryClient)
686 if (aSecondaryClient)
688 iSecMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle);
692 iMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle);
696 void CTMultiPtrEventTest::SetExpectNonAdvancedPointerEvents(TBool aSecondaryClient)
698 if (aSecondaryClient)
700 iSecMultiPtrEventClient->SetExpectNonAdvancedPointerEvents();
704 iMultiPtrEventClient->SetExpectNonAdvancedPointerEvents();
708 void CTMultiPtrEventTest::ClearExpectNonAdvancedPointerEvents(TBool aSecondaryClient)
710 if (aSecondaryClient)
712 iSecMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents();
716 iMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents();
720 void CTMultiPtrEventTest::AddExpectedPointerDownUp(TPoint aPos, TInt aZ, TUint8 aPointerNumber)
722 AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPos, aZ, 0, aPointerNumber);
723 AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, aZ, 0, aPointerNumber);
726 void CTMultiPtrEventTest::AddExpectedWsEvent(TEventCode aType, TBool aSecondaryClient, TInt aPointerNumber, TUint aHandle)
728 if (aSecondaryClient)
730 iSecMultiPtrEventClient->AddExpectedWsEvent(aType);
734 iMultiPtrEventClient->AddExpectedWsEvent(aType, aPointerNumber, aHandle);
738 void CTMultiPtrEventTest::TestDragForMultiPointer(TPoint aPtrPos, TInt aPrValue, TUint8 aPointerNumber)
740 SimulatePointerEvent(TRawEvent::EButton1Down, aPtrPos.iX, aPtrPos.iY, aPrValue, aPointerNumber);
741 SimulatePointerEvent(TRawEvent::EPointerMove, aPtrPos.iX+2, aPtrPos.iY+1, aPrValue, aPointerNumber);
742 SimulatePointerEvent(TRawEvent::EButton1Up, aPtrPos.iX+2, aPtrPos.iY+1, 0, aPointerNumber);
743 AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPtrPos, aPrValue, 0, aPointerNumber);
744 aPtrPos.iX += 2; aPtrPos.iY += 1;
745 AddExpectedPointerEvent(TPointerEvent::EDrag, aPtrPos, aPrValue, 0, aPointerNumber);
746 AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPtrPos, 0, 0, aPointerNumber);
749 void CTMultiPtrEventTest::SimulateAndAddLoneUpEvents(TInt aNumSimulation, TInt aNumAddition, TPoint aPos)
751 for (TInt count = 0; count < aNumSimulation; count++)
753 SimulatePointerEvent(TRawEvent::EButton1Up, aPos.iX, aPos.iY, 0, 0);
755 for (TInt count = 0; count < aNumAddition; count++)
757 AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, 0, 0, 0);
761 void CTMultiPtrEventTest::TestFilteringForMultiPointer(TBool aFiltering)
765 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
766 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
768 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
770 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
771 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
774 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, ptrNum);
776 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
782 TPoint interPt = ptrPos;
783 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
785 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+2, interPt.iY+1, 0, ptrNum);
786 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+4, interPt.iY+2, 0, ptrNum);
787 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+6, interPt.iY+3, 0, ptrNum);
790 interPt.iX += 6; interPt.iY += 3;
791 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, ptrNum);
800 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
804 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
805 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, ptrNum);
812 void CTMultiPtrEventTest::TestGrabbingForMultiPointer(TBool aGrabbing)
816 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
817 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
819 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
821 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
822 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
823 ptrPos.iX += xInc/3; // Ensure all Button1Down events are on iParentWin
828 ptrPos.iX += iPhysicalScreenSize.iWidth/2; // Ensure all Drag and Button1Up events are on iChildWin
829 ptrPos.iY += iPhysicalScreenSize.iHeight/2;
830 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
832 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
835 // CalculatePtrPosAndSet3Ddata will subtract iChildWinPos from ptrPos if pointer event occured on child window. Thus we add iChildWinPos here.
836 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin());
840 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum);
847 ptrPos.iX += iPhysicalScreenSize.iWidth/2;
848 ptrPos.iY += iPhysicalScreenSize.iHeight/2;
849 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
851 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
854 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin());
858 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
865 void CTMultiPtrEventTest::TestCapturingForMultiPointer(TBool aAllWinGroups)
869 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
870 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
872 // These are some typical values which are used only for testing purposes.
877 SetThresholdValues(-20,-50,4000,2000);
879 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerMoveEvents, 0);
883 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
885 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -30, ptrNum);
886 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -30, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
887 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum);
888 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -10, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
889 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
890 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
891 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum);
892 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 5000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
893 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum);
894 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
895 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum);
896 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
897 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
898 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
899 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, -60, ptrNum);
900 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -60, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
901 ptrPos.iX += xInc/3; // Ensure all Pointer events are on iParentWin
907 ptrPos.iX = iPhysicalScreenSize.iWidth/2 + xInc/3;
910 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
912 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum);
913 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), -10, 0, ptrNum, (TInt)iWinForCapturing);
914 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
915 AddExpectedPointerEvent(TPointerEvent::EButton1Down, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing);
916 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum);
917 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 5000, 0, ptrNum, (TInt)iWinForCapturing);
918 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum);
919 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing);
920 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum);
921 AddExpectedPointerEvent(TPointerEvent::EDrag, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing);
922 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
923 AddExpectedPointerEvent(TPointerEvent::EButton1Up, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing);
924 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
925 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing);
932 void CTMultiPtrEventTest::SetAutoFlush()
934 iTheClientFlush = TheClient->iWs.SetAutoFlush(ETrue);
935 iClientFlush = iMultiPtrEventClient->iWs.SetAutoFlush(ETrue);
938 void CTMultiPtrEventTest::ResetFlushStopAS()
940 if (iActiveSchedulerStarted)
942 iActiveSchedulerStarted = EFalse;
943 CActiveScheduler::Stop();
945 TheClient->iWs.SetAutoFlush(iTheClientFlush);
946 iMultiPtrEventClient->iWs.SetAutoFlush(iClientFlush);
949 // Common function for all test cases
950 void CTMultiPtrEventTest::RunTestsL()
952 // Create CTMultiPtrEventClient for each test case and call NextSetOfEventsL()
953 iMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this);
954 iMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber);
955 iMultiPtrEventClient->ConstructL();
959 // Create secondary client for test case number 3
960 if (iTest->iState == 3)
962 iSecMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this, 1);
963 iSecMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber);
964 iSecMultiPtrEventClient->ConstructL();
967 TRAPD(err, NextSetOfEventsL());
973 // Start nested activescheduler if it is not failed for the first attempt
976 iActiveSchedulerStarted = ETrue;
977 CActiveScheduler::Start();
981 TInt eventsRem = iMultiPtrEventClient->EventBuffer()->EventsRemaining();
987 // Delete secondary client for test case number 3
988 if (iTest->iState == 3)
990 delete iSecMultiPtrEventClient;
991 iSecMultiPtrEventClient = NULL;
994 delete iMultiPtrEventClient;
995 iMultiPtrEventClient = NULL;
998 // Common function for all tests
999 // Important point to remember is that this function should not leave when running tests
1000 void CTMultiPtrEventTest::NextSetOfEventsL()
1002 // For each test case calls its respective tests
1004 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
1005 switch (iTest->iState)
1009 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0036
1011 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0036"));
1012 MultiPointerEvents();
1015 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0014"));
1016 PurgingMultiPointerEvents();
1019 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0013"));
1020 MultiPointerEventsForAnimsL();
1023 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0011"));
1024 GetRemainingEventsFromSecondaryClient(); // Does nothing for first time
1025 MultiClientMultiPointerEvents();
1028 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0027"));
1029 MultiPointerEventsForPointerClickL();
1032 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0028"));
1033 MultiPointerEventsInDiffScreenModes();
1036 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0025"));
1037 FilteringMultiPointerEvents();
1040 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0021"));
1041 GrabbingMultiPointerEvents();
1044 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0031"));
1045 VirtualKeyBoardForMultiplePointers();
1048 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0032"));
1049 DoubleClickForMultiplePointers();
1052 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0015"));
1053 MultiPointerOutOfRangeEvents();
1056 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0026"));
1057 AutoForeGroundForMultiplePointersL();
1060 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0029"));
1061 EmulationRulesForMultiplePointers();
1064 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034"));
1065 CloseProximityAndHighPressureEventsL();
1068 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0017"));
1069 OutOfBoundValueTesting();
1072 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0019"));
1073 CapturingMultiPointerEvents();
1076 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0035"));
1077 NegativeTestsForProximityPressureEventsL();
1080 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034"));
1081 PointerRepeatEventForMultiplePointers();
1083 // Any new test case should be added here.
1084 // because some of the above tests use testcase number for certain checks
1086 ((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
1087 AutoPanic(EAutoPanicWrongTest);
1089 ((CTMultiPtrEventTestStep*)iStep)->RecordTestResultL();
1093 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0033
1096 @SYMTestPriority High
1097 @SYMTestCaseDesc To check Wserv sends Pointer Repeat Events for all pointers.
1098 @SYMTestStatus Implemented
1100 @SYMTestActions Simulate events being passed to the client by implementing each discrete test
1101 over 4 seperate test cases.
1102 In the first test case simulate EButton1Down and add event to a TWsEvent buffer.
1103 In the second test case call RequestPointerRepeatEvent on the base window passing
1104 in a time interval, a rectangle (the 'hitbox') and pointer number.
1105 Add EButtonRepeat to TWsEvent buffer.
1106 In the third test case simulate EPointerMove event within the hitbox, then simulate
1107 an elapsed period of time longer that specified interval. Add only a EButtonRepeat
1109 In the final test case simulate EButton1Up and add event to TWsEvent buffer.
1111 Repeat steps for the second discrete test, however, in the third test case simulate
1112 EPointerMove event outside the hitbox. In addition add EDrag to TWsEvent buffer
1113 instead of EButtonRepeat.
1115 A third discrete test will be executed over two test cases and will test
1116 CancelPointerRepeatEventRequest API.
1118 @SYMTestExpectedResults The received events must match the events added to the buffer except where EPointerMove
1119 events should be filtered out. In addition, EButtonRepeat will be generated by wserv
1120 after calling RequestPointerRepeatEvent and time interval specified has elapsed.
1123 void CTMultiPtrEventTest::PointerRepeatEventForMultiplePointers()
1125 // Test PointerRepeatEvent for Multiple Pointers
1126 TLogMessageText logText;
1127 _LIT(KSet, "PointerRepeatEventForMultiplePointers SetOfEvents: %d of 10");
1128 logText.AppendFormat(KSet, iEventSet);
1129 LOG_MESSAGE(logText);
1134 AddExpectedWsEvent(EEventFocusGained);
1136 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
1140 // Ensure all pointers are on iParentWin
1141 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers/3;
1142 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers/3;
1146 // Test cases 0 - 3 represent first discrete test for PointerRepeatEvents
1148 // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client.
1149 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
1150 INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers."));
1151 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1153 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1154 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
1160 // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'.
1161 INFO_PRINTF1(_L("Simulate PointerRepeatEvent request for all pointers."));
1163 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1165 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum);
1166 User::After(200000);
1167 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum);
1173 // Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and pointer remaining within the 'hitbox'.
1174 INFO_PRINTF1(_L("Simulate additional PointerRepeatEvent request for all pointers."));
1175 // New coordinates will be used for a simulated EPointerMove. This event will be filtered out, however, EButtonRepeat will occur at new coordinates
1178 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1180 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum);
1181 // EPointerMove event is filtered out by TWsPointer::PointerRepeatPurgeCheck
1182 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1183 User::After(200000);
1184 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum);
1190 INFO_PRINTF1(_L("Simulate EButton1Up for all pointers."));
1193 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1195 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1196 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
1201 // Test cases 4 - 7 represent second second discrete test for PointerRepeatEvents
1203 // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client.
1204 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
1205 INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers."));
1207 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1209 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1210 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
1216 // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'.
1217 INFO_PRINTF1(_L("Call RequestPointerRepeatEvent for all pointers."));
1219 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1221 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); // hitbox size reduced
1222 User::After(200000);
1223 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum);
1229 // Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and event remaining within the 'hitbox' rect.
1230 // EPointerMove will take pointer out of the hitbox so should not be filtered. PointerRepeatEvent should be cancelled.
1231 INFO_PRINTF1(_L("Simulate a PointerMove event for all pointers to a coordinate outside the hitbox."));
1232 // New coordinates will be used for a simulated EPointerMove outisde the hitbox.
1233 ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc;
1235 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1237 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum);
1238 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1239 User::After(200000);
1240 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum);
1244 INFO_PRINTF1(_L("Simulate EButton1Up for all pointers."));
1246 ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc;
1248 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1250 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1251 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
1254 // Test cases 8 and 9 represent third discrete test for PointerRepeatEvents
1256 // Simulate EButton1Down events only. This is in order to simulate the event being passed to the client.
1257 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
1258 INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers."));
1260 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1262 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1263 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
1269 // No simulated events. This test case is to explicity call RWindowBase::CancelPointerRepeatEventRequest(const TUint8 aPointerNumber)
1270 INFO_PRINTF1(_L("Call RequestPointerRepeatEvent and CancelPointerRepeatEventRequest for all pointers."));
1272 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1274 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum);
1275 iMultiPtrEventClient->ParentWin()->BaseWin()->CancelPointerRepeatEventRequest(ptrNum);
1279 INFO_PRINTF1(_L("Simulate EButton1Up for all pointers."));
1282 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1284 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1285 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
1297 void CTMultiPtrEventTest::TestErrorCodeL(TInt aExpErrCode, TInt aActualErrCode)
1299 if (aExpErrCode != aActualErrCode)
1301 TLogMessageText logText;
1302 _LIT(KError, "Expected Error code = %d Actual Actual Error code %d");
1303 logText.AppendFormat(KError, aExpErrCode, aActualErrCode);
1304 LOG_MESSAGE(logText);
1305 User::Leave(ETestFailed);
1309 void CTMultiPtrEventTest::NegativeTestingOfProximityPressureAPIsL()
1311 // First send -10 for EnterCloseProximity and -5 for ExitCLoseProximity, it should return KErrArgument
1312 // Then send 20 and 10 which should return KErrNone
1313 // Then sent 10 and 20 which should return KErrArgument
1315 retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-10, -5);
1316 TestErrorCodeL(KErrArgument, retVal);
1318 retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(20, 10);
1319 TestErrorCodeL(KErrNone, retVal);
1321 retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(10, 20);
1322 TestErrorCodeL(KErrArgument, retVal);
1324 // Repeat the above for EnterHighPressure and ExitHighPressure with these values
1325 // -10 and -5 it should return KErrArgument
1326 // -5 and -10 it should return KErrNone
1327 retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-10, -5);
1328 TestErrorCodeL(KErrArgument, retVal);
1330 retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-5, -10);
1331 TestErrorCodeL(KErrNone, retVal);
1334 void CTMultiPtrEventTest::SimulateProximityAndPressureEvents(TInt aCloseProxEnterValue, TInt aCloseProxExitValue, TInt aHighPresEnterValue, TInt aHighPresExitValue)
1336 TPoint ptrPos(10,10);
1337 // Simulate EPointerMove with proximity value > EnterCloseProximity threshold
1338 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1340 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxEnterValue, ptrNum);
1341 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, aCloseProxEnterValue, 0, ptrNum);
1344 // Simulate EPointerMove with proximity value < ExitCloseProximity threshold
1345 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1347 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum);
1348 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum);
1351 // Simulate EBUtton1Down with presure value > EnterHighPressure threshold
1352 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1354 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, aHighPresEnterValue, ptrNum);
1355 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, aHighPresEnterValue, 0, ptrNum);
1356 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, aHighPresEnterValue, 0, ptrNum);
1359 // Simulate EPointerMove with presure value < ExitHighPressure threshold
1360 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1362 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aHighPresExitValue, ptrNum);
1363 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, aHighPresExitValue, 0, ptrNum);
1366 // Finally simulate Ebutton1Up with proximity value < ExitCloseProximity
1367 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1369 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum);
1370 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, aCloseProxExitValue, 0, ptrNum);
1371 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum);
1376 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0035
1378 @SYMREQ REQ10887, REQ10886
1379 @SYMTestPriority High
1380 @SYMTestCaseDesc Negative tests for close Proximity and high Pressure events.
1381 @SYMTestStatus Implemented
1383 @SYMTestActions Set CloseProximity and HighPressure thresholds with positive and negative values.
1384 Simulate Enter/ExitCloseProximity and Enter/ExitHighPressure events.
1385 @SYMTestExpectedResults The received events must match the simulated pointer events
1387 void CTMultiPtrEventTest::NegativeTestsForProximityPressureEventsL()
1389 TLogMessageText logText;
1390 _LIT(KSet, "Negative tests for pressure and proximity events: %d of 3");
1391 logText.AppendFormat(KSet, iEventSet);
1392 LOG_MESSAGE(logText);
1397 NegativeTestingOfProximityPressureAPIsL();
1398 AddExpectedWsEvent(EEventFocusGained);
1400 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
1404 // This is to check close proximity threshold API can be given +ve values
1405 // and high pressure threshold API can begiven -ve values
1406 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20);
1407 iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50);
1408 SimulateProximityAndPressureEvents(60, 10, -10, -60);
1411 // Repeat the above with +ve values
1412 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20);
1413 iMultiPtrEventClient->iWs.SetHighPressureThresholds(50, 20);
1414 SimulateProximityAndPressureEvents(60, 10, 60, 10);
1417 // Repeat the above -ve values
1418 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-20, -50);
1419 iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50);
1420 SimulateProximityAndPressureEvents(-10, -60, -10, -60);
1423 SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt);
1432 void CTMultiPtrEventTest::CreateGroupWinForCapturingL()
1434 iGroupWinForCapturing = new(ELeave) CTWindowGroup(iMultiPtrEventClient);
1435 iGroupWinForCapturing->ConstructL();
1436 iGroupWinForCapturing->GroupWin()->AutoForeground(ETrue);
1437 iGroupWinForCapturing->GroupWin()->EnableFocusChangeEvents();
1439 iWinForCapturing = new(ELeave) CTBlankWindow();
1440 iWinForCapturing->ConstructL(*iGroupWinForCapturing);
1441 iWinForCapturing->SetExt(TPoint(), TSize(iPhysicalScreenSize.iWidth/2, iPhysicalScreenSize.iHeight));
1442 iWinForCapturing->SetColor(KRgbBlue);
1443 iWinForCapturing->BaseWin()->EnableAdvancedPointers();
1444 iWinForCapturing->Activate();
1447 void CTMultiPtrEventTest::DeleteGroupWinForCapturing()
1449 if (iWinForCapturing)
1451 delete iWinForCapturing;
1452 iWinForCapturing = NULL;
1454 if (iGroupWinForCapturing)
1456 delete iGroupWinForCapturing;
1457 iGroupWinForCapturing = NULL;
1462 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0019
1464 @SYMREQ REQ9677,REQ9683,
1465 @SYMTestPriority High
1466 @SYMTestCaseDesc Checks Wserv supports Capturing in case of multi pointer events.
1467 @SYMTestStatus Implemented
1469 @SYMTestActions Create a window with group window as its parent.
1470 Create another window with same parent and partially overlapping the first one.
1471 SetPointerCapture for second window with TCaptureEnabled flag.
1472 Simulate TRawEvent::EButton1Down from each pointer the device supports
1474 Repeat the above with TCaptureFlagAllGroups flag for SetPointerCapture
1475 and creating windows from different window group
1477 @SYMTestExpectedResults Even if events were simulated on first window events are delivered to
1478 second window as it is capturing.
1479 With TCaptureFlagAllGroups flag set events are delivered to window which is
1480 capturing even if events were simulated on a window from different group
1483 void CTMultiPtrEventTest::CapturingMultiPointerEvents()
1485 // Test Capturing of multi pointer events
1486 // 1. Test Wserv supports Capturing in case of multi-pointer events
1487 // 2. Test pointer events are delivered correctly when Capturing is disabled.
1488 TLogMessageText logText;
1489 _LIT(KSet, "CapturingMultiPtrEvents SetOfEvents: %d of 3");
1490 logText.AppendFormat(KSet, iEventSet);
1491 LOG_MESSAGE(logText);
1497 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
1505 INFO_PRINTF1(_L("Ensure pointer state is Out of Range"));
1506 AddExpectedWsEvent(EEventFocusGained);
1507 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1509 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1510 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
1511 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1512 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, ptrNum);
1516 INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, within window group"));
1517 iMultiPtrEventClient->ChildWin()->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
1518 TestCapturingForMultiPointer(EFalse);
1521 INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, from different window groups"));
1522 TRAPD(err, CreateGroupWinForCapturingL()); // it cannot leave so trap and fail
1523 if (err != KErrNone)
1527 AddExpectedWsEvent(EEventFocusLost); // First group window losing focus because of second group creation
1528 AddExpectedWsEvent(EEventFocusGained); // Second group window creation
1530 iWinForCapturing->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups);
1531 TestCapturingForMultiPointer(ETrue);
1534 DeleteGroupWinForCapturing();
1542 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0017
1544 @SYMREQ Negative Testing
1545 @SYMTestPriority High
1546 @SYMTestCaseDesc Out of bound value testing
1547 @SYMTestStatus Implemented
1549 @SYMTestActions Simulate raw events of TRawEvent with pointer number greater than EPointerMaxPointers
1551 @SYMTestExpectedResults The received events must match the events added to the buffer and check that out of bound events are ignored.
1554 void CTMultiPtrEventTest::OutOfBoundValueTesting()
1556 // Test Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers.
1557 TLogMessageText logText;
1558 _LIT(KSet, "OutOfBoundValueTesting SetOfEvents: %d of 1");
1559 logText.AppendFormat(KSet, iEventSet);
1560 LOG_MESSAGE(logText);
1565 AddExpectedWsEvent(EEventFocusGained);
1567 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
1571 TInt ptrNumOutOfBounds;
1576 INFO_PRINTF1(_L("Checks Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers."));
1578 ptrNum = iMaxDevPointers-1; // Max value for ptrNum
1579 ptrNumOutOfBounds = iMaxDevPointers; // Invalid ptrNum as pointer numbers are zero indexed
1581 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1582 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNumOutOfBounds);
1583 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum);
1584 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds);
1585 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum);
1586 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds);
1587 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
1588 ptrPos.iX += 10; ptrPos.iY += 10;
1589 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum);
1590 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
1599 void CTMultiPtrEventTest::SetThresholdValues(TInt aEnterCloseProx, TInt aExitCloseProx, TInt aEnterHighPres, TInt aExitHighPres)
1601 iEnterCloseProximityThreshold = aEnterCloseProx;
1602 iExitCloseProximityThreshold = aExitCloseProx;
1603 iEnterHighPressureThreshold = aEnterHighPres;
1604 iExitHighPressureThreshold = aExitHighPres;
1606 iMultiPtrEventClient->iWs.SetCloseProximityThresholds(iEnterCloseProximityThreshold,iExitCloseProximityThreshold);
1607 iMultiPtrEventClient->iWs.SetHighPressureThresholds(iEnterHighPressureThreshold,iExitHighPressureThreshold);
1610 void CTMultiPtrEventTest::TestCloseProximityHighPressureAPIsL()
1612 // These are some typical values which are used only for testing purposes.
1617 SetThresholdValues(-20,-50,4000,2000);
1619 if (iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold() != iEnterCloseProximityThreshold)
1621 TLogMessageText logText;
1622 _LIT(KError, "Expected EnterCloseProximityThreshold = %d Actual EnterCloseProximityThreshold %d");
1623 logText.AppendFormat(KError, iEnterCloseProximityThreshold, iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold());
1624 LOG_MESSAGE(logText);
1625 User::Leave(ETestFailed);
1628 if (iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold() != iExitCloseProximityThreshold)
1630 TLogMessageText logText;
1631 _LIT(KError, "Expected ExitCloseProximityThreshold = %d Actual ExitCloseProximityThreshold %d");
1632 logText.AppendFormat(KError, iExitCloseProximityThreshold, iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold());
1633 LOG_MESSAGE(logText);
1634 User::Leave(ETestFailed);
1637 if (iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold() != iEnterHighPressureThreshold)
1639 TLogMessageText logText;
1640 _LIT(KError, "Expected EnterHighPressureThreshold = %d Actual EnterHighPressureThreshold %d");
1641 logText.AppendFormat(KError, iEnterHighPressureThreshold, iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold());
1642 LOG_MESSAGE(logText);
1643 User::Leave(ETestFailed);
1646 if (iMultiPtrEventClient->iWs.GetExitHighPressureThreshold() != iExitHighPressureThreshold)
1648 TLogMessageText logText;
1649 _LIT(KError, "Expected ExitHighPressureThreshold = %d Actual ExitHighPressureThreshold %d");
1650 logText.AppendFormat(KError, iExitHighPressureThreshold, iMultiPtrEventClient->iWs.GetExitHighPressureThreshold());
1651 LOG_MESSAGE(logText);
1652 User::Leave(ETestFailed);
1657 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0034
1659 @SYMREQ REQ10887,REQ10886
1660 @SYMTestPriority High
1661 @SYMTestCaseDesc Tests close Proximity and high Pressure event types.
1662 @SYMTestStatus Implemented
1664 @SYMTestActions Set CloseProximity and HighPressure thresholds and simulate events with different Z values
1665 @SYMTestExpectedResults The received events must match the simulated pointer events
1667 void CTMultiPtrEventTest::CloseProximityAndHighPressureEventsL()
1669 TLogMessageText logText;
1670 _LIT(KSet, "Close Proximity and High Pressure events: %d of 11");
1671 logText.AppendFormat(KSet, iEventSet);
1672 LOG_MESSAGE(logText);
1677 TestCloseProximityHighPressureAPIsL();
1678 AddExpectedWsEvent(EEventFocusGained);
1680 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
1682 TPoint ptrPos(10,10);
1689 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
1690 // One whole cycle of events
1691 // Simulate out-of-range from all pointers and don't expect out-of-range events
1692 // since all the pointers are already in same state
1693 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1695 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1698 // Simulate moves with proximity value < EEnterCloseProximity
1700 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1702 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1703 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
1706 // Simulate moves with proximity value > EEnterCloseProximity
1708 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1710 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1711 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum);
1714 // Simulate EButton1Down with pressure value < EEnterHighPressure
1716 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1718 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1719 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
1722 // Simulate moves with pressure value > EEnterHighPressure
1724 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1726 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1727 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
1730 // Simulate moves with pressure value < EExitHighPressure
1732 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1734 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1735 AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, prValue, 0, ptrNum);
1738 // Simulate EButton1Up with proximity value > EEnterCloseProximity
1740 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1742 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1743 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1746 // Simulate moves with proximity value < EExitCloseProximity
1748 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1750 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1751 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
1755 // Simulate events to meet all scenarios
1756 // Simulate EButton1Down with pressure value < EEnterHighPressure
1758 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1760 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1761 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
1764 // Simulate EButton1Up with proximity value < EExitCloseProximity
1766 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1768 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1769 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1770 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
1773 // Simulate EButton1Down with pressure value > EEnterHighPressure
1775 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1777 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1778 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
1779 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
1782 // Simulate EButton1Up with proximity value < EExitCloseProximity
1784 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1786 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1787 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1788 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
1792 // Simulate moves with proximity value > EEnterCloseProximity
1794 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1796 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1797 AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum);
1800 // Simulate EButton1Down with pressure value > EEnterHighPressure
1802 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1804 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1805 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
1806 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
1809 // Simulate EButton1Up with proximity value > EExitCloseProximity
1810 proxValue = -40; // When you coming up, EEnterCloseProximity is of no use
1811 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1813 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1814 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1817 // Simulate out-of-range events
1818 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1820 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1821 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
1825 // From out-of-range state to EButton1Down
1826 // Simulate EButton1Down with pressure value < EEnterHighPressure
1828 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1830 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1831 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
1834 // Simulate EButton1Up with proximity value > EExitCloseProximity
1836 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1838 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1839 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1842 // Simulate out-of-range events
1843 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1845 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1846 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
1849 // Simulate EButton1Down with pressure value > EEnterHighPressure
1851 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1853 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1854 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
1855 AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
1858 // Simulate EButton1Up with proximity value > EExitCloseProximity
1860 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1862 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1863 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1866 // Simulate out-of-range events
1867 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1869 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1870 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
1874 // Simulate EButton1Dowm with pressure value < EEnterHighPressure
1876 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1878 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1879 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
1882 // Simulate EButton1Up with proximity value < EExitCloseProximity
1884 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1886 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1887 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1888 AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
1891 // Simulate out-of-range from Up/OutOfCloseProximity
1892 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1894 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1895 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
1899 // Purging of proximity and pressure events
1900 // Simulate EnterCloseProximity and ExitCloseProximity events which will be purged
1901 // when you send Button1Up events for KMaxQueueSize
1903 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
1905 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1908 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
1910 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1912 for (TInt count = 0; count < KMaxQueueSize; count++)
1914 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0);
1915 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0);
1919 // Simulate EnterCloseProximity for 4 pointers.
1920 // As we cannot create lone ExitCloseProximity events, so create just moves from next 4 pointers
1921 // Simulate out-of-range for these events on thier respective pointers
1922 // Then simulate EButton1Up events which will purge EnterCloseProximity and move events
1923 // which checks that lone EnterCloseProximity and lone move events will be purged
1925 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
1927 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1928 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1929 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
1932 for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++)
1934 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1935 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1936 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
1938 for (TInt count = 0; count < KMaxQueueSize-iMaxDevPointers; count++)
1940 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0);
1941 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0);
1945 // Bring all other pointers to Up state, becasue of previous test
1946 // Then simulate out-of-range twice for all the pointers
1947 // Then simulate Button1Up which will cause purging of successive out-of-range events
1950 for (TInt ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
1953 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
1954 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
1956 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
1959 // Wserv does nothing if current state is outofrange and if receives again EOutOfRange event which is practically not possible
1960 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1961 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
1962 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
1964 for (TInt count = 0; count < KMaxQueueSize-tempCount; count++)
1966 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0);
1967 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0);
1971 // Simulate EButton1Down with pressure value > EnterHIghPressure threshold
1972 // which will cause EButton1Down and EnterHighPressure to be filled in queue
1973 // Simulate ExitHighPressure and EButton1Up events for 2 pointers
1974 // Then simulate EButton1Up events from pointer0 so that all of the above events are purged
1976 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
1978 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1981 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
1983 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
1984 // Here these events are purged becasue their correpsonding down event would have been purged
1985 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
1987 // All the above events get purged by this
1988 for (TInt count = 0; count < KMaxQueueSize; count++)
1990 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
1991 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
1995 // Simulate EButton1Down for 2 pointers, which will generate Button1Down and EnterHighPressure
1996 // Simulate Ebutton1Up events for MaxQueueSize from last pointer so that all the above events are purged
1998 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrNum < 2); ptrNum++)
2000 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
2003 // This will cause above down and enterhighpressure events to be purged
2004 // When pointer is in outofrange state and when EButton1Up event is sent Wserv sends EnterCloseProximity
2005 // EnterCloseProximity cannot be purged unless the next event is EExitCloseProximity or EOutOfRange
2006 for (TInt count = 0; count < KMaxQueueSize; count++)
2008 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, iMaxDevPointers-1);
2009 AddExpectedPointerEvent((count ? TPointerEvent::EButton1Up : TPointerEvent::EEnterCloseProximity), ptrPos, 0, 0, iMaxDevPointers-1);
2012 // As the first 2 pointers are in down state, and if we send the move events with prValue = 1000
2013 // This will generate the exithigh pressure events, which will be ignored
2014 // This will also generate the Ebutton1Up event which will also be ignored
2016 for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrNum < 2); ptrNum++)
2018 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
2019 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2023 // This is to just bring all the pointers to out-of-range state
2024 // to make all pointers in valid state for other test to run
2025 // Wserv processes EOutOfRange events only when its current state is not in outofrange.
2026 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers && ptrNum < 2; ptrNum++)
2028 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2029 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum);
2031 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, iMaxDevPointers-1);
2032 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, iMaxDevPointers-1);
2035 SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt);
2043 void CTMultiPtrEventTest::CreateAnimDllAndAnimL()
2045 iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs);
2046 User::LeaveIfError(iAnimDll->Load(KAnimDLLName));
2047 iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll);
2050 void CTMultiPtrEventTest::DestroyAnimDllAndAnim()
2059 iAnimDll->Destroy();
2064 void CTMultiPtrEventTest::CreateGroupWinL()
2066 iGroupWinForEmul = new(ELeave) CTWindowGroup(iMultiPtrEventClient);
2067 iGroupWinForEmul->ConstructL();
2068 iGroupWinForEmul->GroupWin()->AutoForeground(ETrue);
2069 iGroupWinForEmul->GroupWin()->EnableFocusChangeEvents();
2071 iWinForEmul = new(ELeave) CTBlankWindow();
2072 iWinForEmul->ConstructL(*iGroupWinForEmul);
2073 iWinForEmul->SetExt(TPoint(50,50), TSize(80,80));
2074 iWinForEmul->SetColor(KRgbDarkYellow);
2075 iWinForEmul->Activate();
2078 void CTMultiPtrEventTest::DeleteGroupWin()
2085 if (iGroupWinForEmul)
2087 delete iGroupWinForEmul;
2088 iGroupWinForEmul = NULL;
2093 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0029
2096 @SYMTestPriority High
2097 @SYMTestCaseDesc Tests the emulation rules for Apps, Anims, Autofocus and Buffered delivery
2098 @SYMTestStatus Implemented
2100 @SYMTestActions Simulate event to make a pointer primary. EnableAdvancedPointers API is not called. And then simulate events from other pointers
2101 @SYMTestExpectedResults The events from other pointer are not received
2103 void CTMultiPtrEventTest::EmulationRulesForMultiplePointers()
2105 TLogMessageText logText;
2106 _LIT(KSet, "Emulation rules set of events: %d of 15");
2107 logText.AppendFormat(KSet, iEventSet);
2108 LOG_MESSAGE(logText);
2112 SetExpectNonAdvancedPointerEvents();
2114 AddExpectedWsEvent(EEventFocusGained);
2116 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
2118 TPoint ptrPos(10,10);
2119 TInt proxValue = -iProximityStep;
2120 TInt prValue = iPressureStep;
2125 // This event is for simulated/primary pointer
2126 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
2127 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
2128 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2130 // Parent window has not called EnableAdvancedPointers API
2131 // So even if we simulate moves and out-of-range these are not delivered to client
2132 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
2134 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2135 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2139 // Since the primary pointer is 0, simulate EButton1Down for making pointer 1 as primary
2140 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2141 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2143 // Simulate move or Ebutton1Down from pointer0 they are NOT sent back to client
2144 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
2145 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2146 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2148 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2149 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2150 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2151 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2154 // Simulate EButton1Down from pointer0 to make it primary
2155 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2156 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, 0);
2158 // Move from pointer1
2159 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2161 // Take the zero pointer out-of-range, this will not result in Pointer 1 becoming primary
2162 // and out-of-range event is sent to client
2163 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2164 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
2165 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2166 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, 0);
2168 // Send moves from pointer1, but these are not sent to the Client.
2171 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2172 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2174 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2175 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2177 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2178 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2181 // Simulate EButton1Down from pointer0 to make it primary
2182 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2183 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2185 // Simulate EButton1Down from pointer1, which is not sent to client
2186 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2188 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2189 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2191 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2192 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2194 // Drag events are not sent becasue pointer1 has NOT become primary
2197 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1);
2199 // Simulate up from pointer1, still not primary, so event is not sent
2200 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2202 // Simulate out-of-range from pointer1, still not primary, so event is not sent
2203 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2205 // Now moves from out-of-range to move state
2208 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1);
2209 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2211 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2212 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2215 // pointer0 sends move (becomes primary)
2216 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2217 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2219 // pointer0 sends down
2220 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2221 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2223 // pointer1 sends down, doesn't become primary
2224 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2226 // pointer0 sends up, stays primary
2227 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2228 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2230 // pointer2, pointer3 and pointer4 sends move with proximity -5, -10, -15
2231 for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++, proxValue -= iProximityStep)
2233 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2236 // pointer0 sends out-of-range, loses primary pointer, But NO events are sent
2237 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2238 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2240 // Send moves for pointer2, pointer3 and pointer4.
2241 // None of the evnst are sent
2243 for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++)
2247 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2250 // Drag from pointer1, NOT sent, since it is not primary
2251 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, 1);
2253 // Send out-of-range from all pointers
2254 for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++)
2256 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2259 // As the pointer1 is down, this will not become primary even if EButton1Up is called
2260 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2262 // And now sending out-of-range will also not send the event to client as it is not primary
2263 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2266 // Test cases 5 - 7 represent one discrete test for PointerRepeatEvents
2267 // Case 5 simulates EButton1Down events only. This is to ensure the event is delivered to the client.
2268 // If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
2271 // pointer0 sends down (become primary)
2272 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2273 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2275 // pointer1 sends down, doesn't become primary
2276 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2278 // pointer4 sends down
2279 if (4 < iMaxDevPointers)
2281 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 4);
2286 // Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'.
2287 // Legacy API called which does not specify a pointer number. EButtonRepeat should be generated for primary pointer only.
2288 iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(20,20)));
2289 User::After(200000);
2290 AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber);
2293 // pointer0 sends up
2294 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2295 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber);
2297 // pointer2 sends out-of-range
2298 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, 0);
2299 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber);
2301 // Send up and out-of-range for pointer1 and 4
2302 SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 1);
2303 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2305 if (4 < iMaxDevPointers)
2307 SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 4);
2308 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 4);
2312 // Autofocus does not work for other than primary pointers
2313 // Create group window which will send focus lost and gained
2314 TRAPD(err, CreateGroupWinL()); // it cannot leave so trap and fail
2315 if (err != KErrNone)
2319 AddExpectedWsEvent(EEventFocusLost);
2320 AddExpectedWsEvent(EEventFocusGained);
2322 // Simulate Epointer down which will send focuslost, focusgained and focusgroupchanged events
2323 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2324 AddExpectedWsEvent(EEventFocusLost);
2325 AddExpectedWsEvent(EEventFocusGained);
2326 AddExpectedWsEvent(EEventFocusGroupChanged);
2327 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2329 // Now simulate EButton1Down from first or second pointer on second group
2330 // This should not reflect the autofocus
2333 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2334 if (2 < iMaxDevPointers)
2336 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 2);
2338 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2339 if (2 < iMaxDevPointers)
2341 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 2);
2343 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2344 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2345 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2346 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2349 // First thing to do in this case is to delete the group window created
2352 TRAP(err, CreateAnimDllAndAnimL()); // it cannot leave so trap and fail
2353 if (err != KErrNone)
2358 // This is the first event which makes first pointer as primary
2359 // When the last argument is EFalse, it means that the event is not consumed by Anim
2360 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, 0, 0, 0, EFalse);
2361 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2362 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2364 // Now simulate moves from other pointers and these events are not sent to anim
2365 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
2367 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2368 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2371 // This is to reset the primary pointer
2372 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse);
2373 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2374 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2376 // Now simulate EButton1Down, which will make it as primary
2377 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 1, EFalse);
2378 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2379 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2381 // Simulate move or Ebutton1Down from any other prointer they are not sent back to client
2382 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
2383 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2384 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2386 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 1, EFalse);
2387 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2388 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2390 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 1, EFalse);
2391 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2392 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2394 // Set the primary pointer to Zero
2395 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 0, EFalse);
2396 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2397 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2399 // Move from second pointer
2400 // As EnableMultiPointer is not called and this is not a primary pointer so this event
2401 // will cause the pointer 1 into move state
2402 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2404 // Take the zero pointer out-of-range
2405 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 0, EFalse);
2406 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2407 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2409 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse);
2410 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2411 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2413 // These moves will not be sent
2417 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2418 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2419 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2421 TestAndDisplayAnimError();
2423 _LIT(KEventsChecked, "Events checked at server side = %d");
2424 logText.Format(KEventsChecked, 10);
2425 LOG_MESSAGE(logText);
2428 DestroyAnimDllAndAnim();
2430 // Test for PointerMove buffers
2431 // AllocPointerMoveBuffer, EnablePointerMoveBuffer and then simulate few moves
2432 // Add these moves to another points buffer for testing
2433 // Simulate moves from other pointers, these should not be delivered to clients.
2434 iMultiPtrEventClient->ParentWin()->BaseWin()->AllocPointerMoveBuffer(10, 0);
2435 iMultiPtrEventClient->ParentWin()->BaseWin()->EnablePointerMoveBuffer();
2437 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2438 AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin());
2439 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos); // If this position is above some other window then we need to consider its window postion also
2442 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2443 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
2446 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2447 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
2449 // These events should not be added to buffer
2450 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
2452 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2455 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2456 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2460 // Repeat the above for drag events
2461 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2462 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2464 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2465 AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin());
2466 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
2469 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2470 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
2473 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
2474 iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
2476 // These events should not be added to buffer
2477 for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
2479 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2482 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2483 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2484 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2487 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2488 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2489 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2490 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2493 iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer();
2494 iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer();
2496 // Pointer Cursor Position test
2497 // This event is for simulating primary pointer
2498 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
2499 // Here I am not adding the event because this event is deleted by another move of same pointer
2500 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
2506 iMultiPtrEventClient->iWs.SetPointerCursorPosition(TPoint(20,20));
2507 if (TPoint(20,20) != iMultiPtrEventClient->iWs.PointerCursorPosition())
2513 // Now simulate moves from other pointer, this should not have any effect on pointer cursor position
2514 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2516 // Now move the primary pointer, and check the pointer cursor position which should be same as position used for move
2519 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
2520 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2521 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
2527 // Send out-of-range event which will not lead to pointer 1 becoming primary
2528 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2529 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2531 // Now check the pointer cursor position, which should be same
2532 // as primary even if there is other pointer in up state, but that is not primary
2533 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
2539 // This is to bring the pointer1 to out-of-range state
2540 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2542 // then send move event and then again check the pointer cursor position
2545 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2546 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2547 if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
2553 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2554 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2556 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2557 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2561 // Pointer Cursor Area test-1
2562 iOrigPtrCursorArea = iMultiPtrEventClient->iWs.PointerCursorArea();
2563 TRect ptrCurArea(0,0,40,40);
2564 iMultiPtrEventClient->iWs.SetPointerCursorArea(ptrCurArea);
2566 // Simulate move from pointer0 in PointerCursorArea
2567 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
2568 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2570 // Simulate move from other pointer, This should have no effect
2571 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2572 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2574 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2575 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2577 // Repeat the above with moves outside pointer cursor area
2580 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
2581 TPoint pointInCurArea(39, 39);
2582 AddExpectedPointerEvent(TPointerEvent::EMove, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2584 // Simulate move from other pointer, This should have no effect
2585 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
2586 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2588 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2589 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2594 // Pointer Cursor Area test-2
2595 // repeat the above test with button1 down
2596 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2597 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2599 // Simulate move from other pointer, This should have no effect
2600 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2601 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2602 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2604 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2605 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2607 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2608 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2610 // Repeat the above with moves outside pointer cursor area
2613 TPoint pointInCurArea(39, 39);
2614 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
2615 AddExpectedPointerEvent(TPointerEvent::EButton1Down, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2617 // Simulate move from other pointer, This should have no effect
2618 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
2619 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
2620 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
2622 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
2623 AddExpectedPointerEvent(TPointerEvent::EButton1Up, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2625 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
2626 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
2630 ClearExpectNonAdvancedPointerEvents();
2631 iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea);
2639 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0026
2641 @SYMREQ REQ9677, REQ9683
2642 @SYMTestPriority High
2643 @SYMTestCaseDesc Checks Wserv supports Autofocus for multiple pointers
2644 @SYMTestStatus Implemented
2646 @SYMTestActions Create 2 group window and respective client windows for it. And simulate EButton1Down on each window consecutively
2647 @SYMTestExpectedResults The received events must match the simulated pointer events
2649 void CTMultiPtrEventTest::AutoForeGroundForMultiplePointersL()
2651 TLogMessageText logText;
2652 _LIT(KSet, "Multiple pointer Auto foreground events: %d of 2");
2653 logText.AppendFormat(KSet, iEventSet);
2654 LOG_MESSAGE(logText);
2659 AddExpectedWsEvent(EEventFocusGained); // This if for the main groupwindow
2660 iMultiPtrEventClient->ConstructGroupBlankWinL();
2662 // These are for child group window creation
2663 AddExpectedWsEvent(EEventFocusLost); // This if for the main groupwindow losing focus
2664 AddExpectedWsEvent(EEventFocusGained); // First group window of this test creation
2666 AddExpectedWsEvent(EEventFocusLost); // First group window losing focus because of second group creation
2667 AddExpectedWsEvent(EEventFocusGained); // Second group window creation
2668 AddExpectedWsEvent(EEventFocusGroupChanged); // First group window's Enable Focus changed flag is set
2670 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
2672 TPoint win1PtrPos(20,20);
2673 TPoint win2PtrPos(60,60);
2679 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
2681 if ((ptrNum & 1) == 0)
2683 ptrPos = win1PtrPos;
2688 ptrPos = win2PtrPos;
2691 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2692 AddExpectedWsEvent(EEventFocusLost); // Second group window losing focus
2693 AddExpectedWsEvent(EEventFocusGained); // First group window gaining focus
2695 { // First group window has already received EEventFocusGroupChanged
2696 AddExpectedWsEvent(EEventFocusGroupChanged); // Second group window's Enable Focus changed flag is set
2698 // In the queue only once EEventFocusGroupChanged is sent
2699 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
2701 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2702 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
2704 // These events are to clear out the pointer state
2705 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2706 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum);
2708 if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin))
2716 for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++)
2718 if ((ptrNum & 1) == 0)
2720 ptrPos = win1PtrPos;
2725 ptrPos = win2PtrPos;
2728 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2729 AddExpectedWsEvent(EEventFocusLost); // Second group window losing focus
2730 AddExpectedWsEvent(EEventFocusGained); // First group window gaining focus
2731 if (ptrNum == iMaxDevPointers/2) // first loop
2733 // When ever a group window changes focus, For all the group/client windows which have
2734 // registered for receiving group window changes recive EEventFocusGroupChanged
2735 // EEventFocusGroupChanged is sent only once in one queue
2736 AddExpectedWsEvent(EEventFocusGroupChanged);
2737 AddExpectedWsEvent(EEventFocusGroupChanged);
2739 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
2741 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
2742 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
2744 // These events are to clear out the pointer state
2745 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2746 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum);
2747 if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin))
2755 iMultiPtrEventClient->DeleteGroupBlankWin();
2764 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0015
2767 @SYMTestPriority High
2768 @SYMTestCaseDesc Checks Wserv supports out-of-range and pointer Enter/Exit events.
2769 @SYMTestStatus Implemented
2771 @SYMTestActions Simulate moves and EPointer3DOutOfRange from different pointers
2772 @SYMTestExpectedResults The received events must match the simulated pointer events
2774 void CTMultiPtrEventTest::MultiPointerOutOfRangeEvents()
2776 TLogMessageText logText;
2777 _LIT(KSet, "OutOfRange & Enter/Exit events: %d of 4");
2778 logText.AppendFormat(KSet, iEventSet);
2779 LOG_MESSAGE(logText);
2784 AddExpectedWsEvent(EEventFocusGained);
2786 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
2788 TPoint ptrPos(10,10);
2789 TInt proxValue = -iProximityStep;
2793 // Simulate moves and EPointer3DOutOfRange from all pointers
2794 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
2795 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
2797 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2798 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
2800 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2801 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
2802 // Here I am not enabling the enter/exit events filter so not getting those
2806 // Repeat the above by enabling the enter/exit events
2807 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0);
2808 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
2810 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2811 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
2812 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
2814 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2815 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum);
2816 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
2820 // Check the moves from one window to other
2821 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
2824 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2825 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
2826 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
2828 ptrPos.iX = (iMultiPtrEventClient->ParentWin()->Size().iWidth)/2 + 10;
2829 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2830 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); // move and enter of child window is filtered out
2834 // Since all the pointers are now on child and when we change the pointer filter
2835 // wserv sends enter event to all pointers
2836 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0);
2837 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
2839 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
2841 for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
2843 ptrPos.iX = ptrPos.iY =10;
2844 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
2845 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum);
2846 AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
2847 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
2849 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
2850 AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum);
2851 AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
2863 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0032
2866 @SYMTestPriority High
2867 @SYMTestCaseDesc Checks Wserv supports Double click events for multi pointer events.
2868 @SYMTestStatus Implemented
2870 @SYMTestActions Simulate double click events from different pointers
2871 @SYMTestExpectedResults The received events must match the simulated pointer events
2873 void CTMultiPtrEventTest::DoubleClickForMultiplePointers()
2875 // Logic involved, double click settings are global no need to test them
2876 // Check that double click events are sent by wserv for all pointers
2877 TLogMessageText logText;
2878 _LIT(KSet, "Double click settings and events: %d of 1");
2879 logText.AppendFormat(KSet, iEventSet);
2880 LOG_MESSAGE(logText);
2885 AddExpectedWsEvent(EEventFocusGained);
2887 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
2889 TPoint ptrPos(10,10);
2893 for (TInt ptrNum = 0; ptrNum < Min(iMaxDevPointers, 7); ptrNum++)
2895 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
2896 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
2897 AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
2898 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, EModifierDoubleClick, ptrNum);
2899 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
2912 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0031
2915 @SYMTestPriority High
2916 @SYMTestCaseDesc Checks Wserv supports Virtual keyboard for multi pointer events.
2917 @SYMTestStatus Implemented
2919 @SYMTestActions Create virtual keyboard by AddKeyRect() to a window and simulate pointer events from all pointers
2920 @SYMTestExpectedResults The received events must match the simulated Key events
2922 void CTMultiPtrEventTest::VirtualKeyBoardForMultiplePointers()
2924 TLogMessageText logText;
2925 _LIT(KSet, "VirtualKeyboard SetOfEvents: %d of 8");
2926 logText.AppendFormat(KSet, iEventSet);
2927 LOG_MESSAGE(logText);
2929 // Create virtual keyboard for 8 keys on parent window
2930 // give a 5 pixel spacing at start/end and in between keys
2931 const TInt noVirtualKeys = iMaxDevPointers;
2932 const TInt keySpacing = 5;
2933 const TInt keyWidth = ((iPhysicalScreenSize.iWidth/2) - ((noVirtualKeys+1)*keySpacing))/noVirtualKeys;
2934 const TInt keyHeight = keyWidth/2;
2935 TInt startX = keySpacing;
2936 const TInt baseChar ='A';
2941 for (TInt count=0; count < noVirtualKeys; count++)
2943 iMultiPtrEventClient->ParentWin()->BaseWin()->AddKeyRect(TRect(startX, keySpacing, startX+keyWidth, keySpacing+keyHeight), baseChar+count,EFalse);
2944 startX+=(keyWidth+keySpacing);
2946 AddExpectedWsEvent(EEventFocusGained);
2949 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
2950 TPoint ptrPos(keySpacing+(keyWidth/2), keySpacing+(keyHeight/2));
2953 if (iEventSet < iMaxDevPointers)
2955 for (; ptrPos.iX < (iPhysicalScreenSize.iWidth/2)-5; ptrPos.iX += (keySpacing+keyWidth), count++)
2957 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, iEventSet);
2958 AddExpectedKeyDownUp(baseChar+count);
2971 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0021
2973 @SYMREQ REQ9677,REQ9683,
2974 @SYMTestPriority High
2975 @SYMTestCaseDesc Checks Wserv supports Grabbing in case of multi pointer events.
2976 @SYMTestStatus Implemented
2978 @SYMTestActions Simulate EButton1Down events on iParentWin. Simulate Drag and Button1Up events on iChildWin.
2979 SetPointerGrab is called on iParentWin for first test and disabled for the second.
2980 @SYMTestExpectedResults The Drag and Button1Up events contain a handle to iParentWin when Grabbing active.
2981 The Drag and Button1Up events contain a handle to iChildWin when Grabbing disabled.
2983 void CTMultiPtrEventTest::GrabbingMultiPointerEvents()
2985 // Test Grabbing of multi pointer events
2986 // 1. Test Wserv supports Grabbing in case of multi-pointer events
2987 // 2. Test pointer events are delivered correctly when Grabbing is disabled.
2988 TLogMessageText logText;
2989 _LIT(KSet, "GrabbingMultiPtrEvents SetOfEvents: %d of 2");
2990 logText.AppendFormat(KSet, iEventSet);
2991 LOG_MESSAGE(logText);
2998 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
3005 INFO_PRINTF1(_L("Check Wserv supports Grabbing in case of multi-pointer events"));
3006 // Check pointer events are delivered to the window where the EButton1Down event occured,
3007 // even if subsequent events are simulated outside this window.
3008 AddExpectedWsEvent(EEventFocusGained);
3009 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
3010 iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(ETrue);
3011 TestGrabbingForMultiPointer(ETrue);
3014 INFO_PRINTF1(_L("Check pointer events are delivered correctly when Grabbing is disabled."));
3015 // Check pointer events are delivered to the window on which they occured.
3016 iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(EFalse);
3017 TestGrabbingForMultiPointer(EFalse);
3027 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0025
3029 @SYMREQ REQ9677,REQ9683,
3030 @SYMTestPriority High
3031 @SYMTestCaseDesc Checks Wserv supports Filtering in case of multi pointer events.
3032 @SYMTestStatus Implemented
3034 @SYMTestActions Simulate Move and Drag events. Add only Button1Up and Button1Down to TWsEvent buffer.
3035 Disable Filtering and repeat test with the addition of Move and Drag events to TWsEvent buffer.
3036 @SYMTestExpectedResults The received events must match the expected simulated raw events
3037 The received events must match the simulated raw events
3039 void CTMultiPtrEventTest::FilteringMultiPointerEvents()
3041 // Test Filtering of multi pointer events
3042 // 1. Test pointer move and drag events are filtered correctly by Wserv
3043 // 2. Test pointer events are delivered correctly when Filtered is disabled.
3044 TLogMessageText logText;
3045 _LIT(KSet, "FilteringMultiPtrEvents SetOfEvents: %d of 2");
3046 logText.AppendFormat(KSet, iEventSet);
3047 LOG_MESSAGE(logText);
3054 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
3061 INFO_PRINTF1(_L("Check pointer move and drag events are filtered with multi-pointer events"));
3062 // Check pointer move and drag events are filtered by Wserv
3063 AddExpectedWsEvent(EEventFocusGained);
3065 // Ensure default values are set i.e. Drag and Move events are filtered out and not delivered to the client.
3066 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove,
3067 EPointerFilterDrag|EPointerFilterMove);
3068 TestFilteringForMultiPointer(ETrue);
3071 INFO_PRINTF1(_L("Check pointer move and drag events are not filtered, with multi-pointer events, when filtering is disabled"));
3072 // Check move and drag events are not filtered by Wserv when filtering is disabled
3074 // Enable Drag and Move events
3075 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove, 0);
3076 TestFilteringForMultiPointer(EFalse);
3085 void CTMultiPtrEventTest::SetDefaultScreenMode()
3087 iMultiPtrEventClient->iScreen->SetAppScreenMode(0);
3088 TheClient->iScreen->SetAppScreenMode(0);
3089 iMultiPtrEventClient->iScreen->SetScreenMode(0);
3090 iMultiPtrEventClient->iScreen->SetCurrentRotations(0, CFbsBitGc::EGraphicsOrientationNormal);
3093 TPoint PhysicalToLogical(TPoint aPhysicalPt, TPoint aOrigin, TSize aSize)
3095 return PhysicalToLogical(aPhysicalPt-aOrigin, aSize);
3098 TPoint CTMultiPtrEventTest::GetPointerPostionOnRotatedMode(TPoint aPointerPos, CFbsBitGc::TGraphicsOrientation aRotation)
3100 if (aRotation == CFbsBitGc::EGraphicsOrientationNormal)
3104 else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated90)
3106 // here width is actually height in rotated mode
3107 return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iY - 1, aPointerPos.iX);
3109 else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated180)
3111 return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iX - 1, iPhysicalScreenSize.iHeight - aPointerPos.iY - 1);
3113 else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated270)
3115 // here width is actually height in rotated mode
3116 return TPoint(aPointerPos.iY, iPhysicalScreenSize.iHeight - aPointerPos.iX -1);
3122 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0028
3124 @SYMREQ REQ9677, REQ9683
3125 @SYMTestPriority High
3126 @SYMTestCaseDesc To check Wserv sends multi pointer events in Different screen modes
3127 @SYMTestStatus Implemented
3129 @SYMTestActions Simulate multi pointer events in Different screenmodes
3130 @SYMTestExpectedResults The received events must match the simulated raw events
3132 void CTMultiPtrEventTest::MultiPointerEventsInDiffScreenModes()
3134 // Logic inloved, For a particular screen mode check pointer down/up, moves and drags
3135 // for different pointers and for different co-ordinates.
3136 // For each screen mode check these events on diffferent rotation that screen mode supports
3137 // During the last switch case increment the screenmode
3138 TLogMessageText logText;
3139 _LIT(KSet, "Multi pointer events in screenmode(%d): %d of 2");
3140 logText.AppendFormat(KSet, iCurrentScreenMode+1, iEventSet);
3141 LOG_MESSAGE(logText);
3143 TInt numScrMode = iMultiPtrEventClient->iScreen->NumScreenModes();
3144 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
3146 if (!iEventSet && !iChangeScreenMode)
3149 iChangeScreenMode = ETrue;
3150 AddExpectedWsEvent(EEventFocusGained);
3154 if (iChangeScreenMode)
3156 if (iCurrentScreenMode >= numScrMode)
3159 SetDefaultScreenMode();
3166 if (iChangeScreenMode)
3168 iMultiPtrEventClient->iScreen->SetAppScreenMode(iCurrentScreenMode);
3169 TheClient->iScreen->SetAppScreenMode(iCurrentScreenMode);
3170 iMultiPtrEventClient->iScreen->SetScreenMode(iCurrentScreenMode);
3171 iChangeScreenMode = EFalse;
3174 CArrayFixFlat<TInt>* rotations = NULL;
3176 rotations = new(ELeave) CArrayFixFlat<TInt>(1);
3177 iMultiPtrEventClient->iScreen->GetRotationsList(iCurrentScreenMode, rotations));
3178 if (err != KErrNone)
3190 #if !defined(__WINS__)
3191 TPoint ptrRotatedPos;
3192 TPoint ptrNormalPos;
3200 // Since screenmode positioning and screenmode scaling is not supported in NGA wserv2
3201 // but it is supported in Non NGA. But for NGA it will return (0,0) as origin and (1,1) as scale.
3202 TPoint screenOrigin(iMultiPtrEventClient->iScreen->GetDefaultScreenModeOrigin());
3203 TPoint scaledScreenOrigin(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScaledOrigin());
3204 TSize scale(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScale());
3209 // Simulate Pointer down/up for different rotations of a screenmode
3210 for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++)
3212 CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]);
3213 iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation);
3215 #if !defined(__WINS__)
3216 ptrNormalPos = screenOrigin;
3217 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
3218 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
3219 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
3220 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3222 ptrNormalPos.iX += 10;
3223 ptrNormalPos.iY += 5;
3224 ptrNum = iMaxDevPointers/2;
3225 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
3226 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
3227 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
3228 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3230 ptrNormalPos.iX += 5;
3231 ptrNormalPos.iY += 10;
3232 ptrNum = iMaxDevPointers-1;
3233 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
3234 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
3235 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
3236 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3239 // This is not needed for NGA, becasue NGA wserv does not support positioning and scaling
3240 // but for early access we are deliverying for NonNGA so we need it.
3241 ptrPhyPos = screenOrigin;
3242 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
3243 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
3244 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3247 ptrNum = iMaxDevPointers/2;
3248 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
3249 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
3250 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3253 ptrNum = iMaxDevPointers-1;
3254 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
3255 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
3256 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3262 // Simulate moves for different rotations of a screenmode with different Proximity
3263 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0);
3264 for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++)
3266 CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]);
3267 iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation);
3269 #if !defined(__WINS__)
3270 ptrNormalPos = screenOrigin;
3271 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
3272 proxValue = -iProximityStep;
3273 SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum);
3274 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
3275 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
3276 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
3277 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3279 ptrNormalPos.iX += 10;
3280 ptrNormalPos.iY += 5;
3281 ptrNum = iMaxDevPointers/2;
3282 if (proxValue-iProximityStep > iMaxProximity)
3284 proxValue -= iProximityStep;
3286 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
3287 SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum);
3288 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
3289 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
3290 SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
3291 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3294 ptrPhyPos = screenOrigin;
3295 proxValue = -iProximityStep;
3296 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
3297 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum);
3298 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
3299 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
3300 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3304 ptrNum = iMaxDevPointers/2;
3305 if (proxValue-iProximityStep > iMaxProximity)
3307 proxValue -= iProximityStep;
3309 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
3310 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum);
3311 AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
3312 SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
3313 AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
3320 // Simulate drags for different rotations of a screenmode
3321 #if !defined(__WINS__)
3323 TPoint intRotatedPt;
3328 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0);
3329 for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++)
3331 CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]);
3332 iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation);
3333 #if !defined(__WINS__)
3334 ptrNormalPos = screenOrigin;
3335 intNormalPt.iX = ptrNormalPos.iX+4;
3336 intNormalPt.iY = ptrNormalPos.iY+5;
3337 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
3338 intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation);
3339 SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
3340 SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
3341 SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
3342 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
3343 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
3344 TPoint intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale);
3345 AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum);
3346 AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum);
3348 ptrNormalPos.iX += 10;
3349 ptrNormalPos.iY += 5;
3350 ptrNum = iMaxDevPointers-1;
3351 intNormalPt.iX = ptrNormalPos.iX+5;
3352 intNormalPt.iY = ptrNormalPos.iY+4;
3353 ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
3354 intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation);
3355 SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
3356 SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
3357 SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
3358 ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
3359 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
3360 intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale);
3361 AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum);
3362 AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum);
3366 ptrPhyPos = screenOrigin;
3367 interPhyPt.iX = ptrPhyPos.iX+4;
3368 interPhyPt.iY = ptrPhyPos.iY+5;
3369 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
3370 interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale);
3371 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
3372 SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
3373 SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
3374 interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale);
3375 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
3376 AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum);
3377 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum);
3381 ptrNum = iMaxDevPointers-1;
3382 interPhyPt.iX = ptrPhyPos.iX+5;
3383 interPhyPt.iY = ptrPhyPos.iY+4;
3385 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
3386 SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
3387 SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
3389 ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
3390 interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale);
3391 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
3392 AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum);
3393 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum);
3398 iChangeScreenMode = ETrue;
3400 iCurrentScreenMode++;
3412 Checks if pointer click plugin has an error when testing its events
3413 If so then it gets the error deescription and displays the same
3415 void CTMultiPtrEventTest::TestAndDisplayPtrClickError()
3417 TPckgBuf<TInt> intPkg;
3418 TInt retErr = iClick.CommandReply(EMultiPtrClickEventError, intPkg);
3419 if (retErr != KErrNone)
3421 _LIT(KError, "Failed in Pointer click plugin");
3422 LOG_MESSAGE(KError);
3423 // Error is ignored here, becasue this function should not leave
3424 TRAPD(errMem, iErrDesc = iHeap->AllocL(KErrDescSize));
3425 if (errMem == KErrNone)
3427 intPkg() = reinterpret_cast<TUint8*>(iErrDesc) - iChunk.Base() ;
3429 // get the error desccription, print it out and stop the tests
3430 TInt retVal = iClick.CommandReply(EADllMultiPtrEventErrorDesc, intPkg);
3431 if (retVal > KErrNone)
3433 TPtr8 memPtr2(reinterpret_cast<TUint8*>(iErrDesc), retVal, retVal);
3434 HBufC16* buf16 = NULL;
3435 TRAPD(err, buf16 = HBufC16::NewL(retVal)); // Error is ignored here
3436 if (err == KErrNone)
3438 buf16->Des().Copy(memPtr2);
3439 LOG_MESSAGE(buf16->Des());
3443 iHeap->Free(iErrDesc);
3447 iClick.CommandReply(EMultiPtrClickEventReset, intPkg);
3450 void CTMultiPtrEventTest::AddExpectedMultiPtrClickEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle)
3452 TPckgBuf<TWsEvent> evtPkg;
3453 TWsEvent& event=evtPkg();
3454 event.SetType(EEventPointer);
3455 iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle);
3457 // change the parent position here as they r with respect to screen corodinates.
3458 event.Pointer()->iParentPosition = aPos;
3460 iClick.CommandReply(EMultiPtrClickEventAdd, evtPkg);
3461 AddExpectedMultiPtrClickOtherEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle);
3464 void CTMultiPtrEventTest::AddExpectedMultiPtrClickOtherEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle)
3467 event.SetType(EEventPointer);
3468 iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle);
3470 TPointerEventData otherEvent;
3471 otherEvent.iClientHandle = event.Handle();
3472 otherEvent.iCurrentPos = aPos;
3473 otherEvent.iPointerEvent = *event.Pointer();
3475 TPckgBuf<TPointerEventData> evtPkg(otherEvent);
3476 iClick.CommandReply(EMultiPtrOtherEventAdd, evtPkg);
3480 Function of creating
3481 1. Pointer click plugin
3482 2. RChunk for transfering error description from pointer click plugin to current test
3483 3. RHeap for allocating memory in RChunk
3485 void CTMultiPtrEventTest::CreatePointerClickPluginL()
3487 // tranfer this to another function
3488 iClick=RSoundPlugIn(TheClient->iWs);
3489 User::LeaveIfError(iClick.Construct(TUid::Uid(MULTIPTR_CLICK_THIRD_UID)));
3490 TBool ptrPluginLoadable = EFalse;
3491 iClick.IsLoaded(ptrPluginLoadable);
3492 if (ptrPluginLoadable)
3494 User::LeaveIfError(iClick.Load(KMultiPtrPluginDll));
3495 iPtrPluginLoaded = ETrue;
3497 iClick.SetPenClick(ETrue);
3498 iHeap = UserHeap::ChunkHeap(&KMultiPtrClickChunk, 128, 256, 10);
3501 User::LeaveNoMemory();
3503 User::LeaveIfError(iChunk.OpenGlobal(KMultiPtrClickChunk, ETrue));
3507 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0027
3509 @SYMREQ REQ9677, REQ9683
3510 @SYMTestPriority High
3511 @SYMTestCaseDesc To check Wserv sends multi pointer events to PointerClickPlugin
3512 @SYMTestStatus Implemented
3514 @SYMTestActions Simulate multi pointer events for PointerClickPlugin
3515 @SYMTestExpectedResults The received events must match the simulated raw events
3517 void CTMultiPtrEventTest::MultiPointerEventsForPointerClickL()
3519 TLogMessageText logText;
3520 _LIT(KSet, "Multi pointer events for PointerClickPlugin: %d of 4");
3521 logText.AppendFormat(KSet, iEventSet);
3522 LOG_MESSAGE(logText);
3524 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
3534 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
3535 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
3540 // Creates RSoundPlugin, loads the plugin DLL, create RChunk and RHeap
3541 CreatePointerClickPluginL();
3542 AddExpectedWsEvent(EEventFocusGained);
3543 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
3545 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
3546 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
3547 AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
3548 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
3552 TestAndDisplayPtrClickError();
3555 // Simulate moves from different pointer with different pressure
3556 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0);
3557 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove,0);
3559 prValue = iPressureStep;
3560 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
3562 AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
3563 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum);
3564 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum);
3565 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
3566 AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
3567 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
3568 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
3572 TestAndDisplayPtrClickError();
3575 // Simulate moves from different pointer with different proximity
3577 proxValue = -iProximityStep;
3578 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
3580 AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
3581 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum);
3582 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum);
3583 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
3584 AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
3585 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
3586 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
3590 TestAndDisplayPtrClickError();
3594 // Simulate drags from all pointers
3595 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0);
3596 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0);
3599 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
3601 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
3602 interPt.iX = ptrPos.iX+1;
3603 interPt.iY = ptrPos.iY+2;
3604 AddExpectedMultiPtrClickEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
3605 AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
3607 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
3608 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
3609 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
3611 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
3612 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
3613 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
3618 TestAndDisplayPtrClickError();
3624 iPtrPluginLoaded = EFalse;
3635 void CTMultiPtrEventTest::GetRemainingEventsFromSecondaryClient()
3637 if (iSecMultiPtrEventClient->EventBuffer()->EventsRemaining() != 0)
3639 iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(ETrue);
3640 CActiveScheduler::Start();
3645 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0011
3647 @SYMREQ REQ9677,REQ9674,
3648 @SYMTestPriority High
3649 @SYMTestCaseDesc To check Wserv sends Multi Pointer events to correct clients
3650 @SYMTestStatus Implemented
3652 @SYMTestActions Simulate multi pointer events on windows from different client.
3653 @SYMTestExpectedResults The received events must match the simulated raw events
3655 void CTMultiPtrEventTest::MultiClientMultiPointerEvents()
3657 // Logic for this test code
3658 // Create a secondary client when running this test
3659 // Simulate events for both main client and secondary simulataneously
3660 // Get events from DoRunL() of event buffer class
3661 // Before running next set of events, get all the events from secondary client
3662 // If test fails on any client make sure both active scheduler are stopped
3663 TLogMessageText logText;
3664 _LIT(KSet, "Multi pointer events for Multi client: %d of 5");
3665 logText.AppendFormat(KSet, iEventSet);
3666 LOG_MESSAGE(logText);
3668 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
3669 iSecMultiPtrEventClient->EventBuffer()->SetEventCount(0);
3673 iSecClientFlush = iSecMultiPtrEventClient->iWs.SetAutoFlush(ETrue);
3680 TInt xInc = (iPhysicalScreenSize.iWidth/2)/iMaxDevPointers;
3681 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
3682 TPoint secPt(iPhysicalScreenSize.iWidth/2,0);
3683 TInt ptrSecNum = iMaxDevPointers-1;
3690 // These events are generated when primary client is created and its group
3691 // window constructed and then when button down for primary client is called
3692 AddExpectedWsEvent(EEventFocusGained);
3693 AddExpectedWsEvent(EEventFocusLost);
3694 AddExpectedWsEvent(EEventFocusGained);
3696 // Simulate pointer down/up events for primary client from 0,1,3... pointers and 6,5,4... pointers for secondary client
3697 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
3699 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
3700 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
3702 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
3703 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
3709 ptrPos.iX = iPhysicalScreenSize.iWidth/2;
3712 // These events are generated when secondary cleint is created and then when
3713 // button down for primary client is called, then when SetOrdinalPosition is
3714 // called on secondary cleint's group window
3715 AddExpectedWsEvent(EEventFocusGained, ETrue);
3716 AddExpectedWsEvent(EEventFocusLost, ETrue);
3717 iSecMultiPtrEventClient->iGroup->GroupWin()->SetOrdinalPosition(0, 1);
3718 AddExpectedWsEvent(EEventFocusGained, ETrue);
3720 AddExpectedWsEvent(EEventFocusLost);
3722 for (ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++)
3724 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
3725 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3727 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
3728 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3735 // Simulate move events from primary and secondary client simultaneously with pressure
3736 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
3737 iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
3740 prValue = iPressureStep;
3742 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
3744 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
3745 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
3749 SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, prValue, ptrSecNum);
3750 AddExpectedPointerEvent(TPointerEvent::EMove, secPt, prValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3756 // Simulate move events from primary and secondary client simultaneously with proximity
3758 proxValue = -iProximityStep;
3760 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
3762 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
3763 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
3767 SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, proxValue, ptrSecNum);
3768 AddExpectedPointerEvent(TPointerEvent::EMove, secPt, proxValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3775 // Simulate drag events on different clients window one after the other
3776 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
3777 iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
3780 secPt.iX = iPhysicalScreenSize.iWidth/2;
3782 ptrSecNum = iMaxDevPointers-1;
3784 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
3786 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
3787 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
3788 interPt.iX = ptrPos.iX+2;
3789 interPt.iY = ptrPos.iY+1;
3790 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
3791 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
3792 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
3793 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
3797 SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum);
3798 AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3799 interPt.iX = secPt.iX+2;
3800 interPt.iY = secPt.iY+1;
3801 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum);
3802 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3803 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum);
3804 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3812 // Simulate drag events on different clients, but interleaved each other
3814 secPt.iX = iPhysicalScreenSize.iWidth/2;
3816 ptrSecNum = iMaxDevPointers-1;
3819 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
3821 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
3822 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
3826 SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum);
3827 AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3833 secPt.iX = iPhysicalScreenSize.iWidth/2;
3835 ptrSecNum = iMaxDevPointers-1;
3836 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
3838 interPt.iX = ptrPos.iX+2;
3839 interPt.iY = ptrPos.iY+1;
3840 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
3841 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
3846 interPt.iX = secPt.iX+2;
3847 interPt.iY = secPt.iY+1;
3848 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum);
3849 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3855 secPt.iX = iPhysicalScreenSize.iWidth/2;
3857 ptrSecNum = iMaxDevPointers-1;
3858 for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
3860 interPt.iX = ptrPos.iX+2;
3861 interPt.iY = ptrPos.iY+1;
3862 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
3863 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
3867 interPt.iX = secPt.iX+2;
3868 interPt.iY = secPt.iY+1;
3869 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum);
3870 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
3878 iSecMultiPtrEventClient->iWs.SetAutoFlush(iSecClientFlush);
3882 _LIT(KEventsAdded, "Events added to Primary client's buffer = %d");
3883 logText.Format(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining());
3884 LOG_MESSAGE(logText);
3885 _LIT(KEventsAdded1, "Events added to Secondary client's buffer = %d");
3886 logText.Format(KEventsAdded1, iSecMultiPtrEventClient->EventBuffer()->EventsRemaining());
3887 LOG_MESSAGE(logText);
3891 // RMultiPointerAnim
3892 RMultiPointerAnim* RMultiPointerAnim::NewL(RWindowBase* aWin, RAnimDll* aDll)
3894 RMultiPointerAnim* self=new(ELeave) RMultiPointerAnim(aDll);
3895 CleanupStack::PushL(TCleanupItem(DestroyAnim,self));
3896 User::LeaveIfError(self->Construct(*aWin, EAnimTypeMultiPointer, TPtrC8()));
3897 CleanupStack::Pop(self);
3901 TInt RMultiPointerAnim::AddExpectedAnimPointerEvent(TRawEvent::TType aType, TPoint aPos, TInt aZ, TUint /*aModifier*/, TUint8 aPointerNumber, TBool aEat /*= ETrue*/)
3904 rawEvent.Set(aType, aPos.iX, aPos.iY, aZ, aPointerNumber);
3905 TAnimRawEvent animEvent;
3906 animEvent.iRawEvent = rawEvent;
3907 animEvent.iEat = aEat;
3908 TPckgBuf<TAnimRawEvent> param;
3910 return CommandReply(EADllAddExpectedMultiPtrEvent, param);
3913 void CTMultiPtrEventTest::TestAndDisplayAnimError()
3915 TInt err = iAnim->CommandReply(EADllMultiPtrEventError);
3916 if (err != KErrNone)
3918 _LIT(KError, "Failed in Anim dll");
3919 LOG_MESSAGE(KError);
3923 ipcArgs.Set(KIpcSlot,&errDesc);
3924 // get the error desccription, print it out and stop the tests
3925 TInt retVal = iAnim->CommandReply(EADllMultiPtrEventErrorDesc, KNullDesC8, ipcArgs);
3926 if (retVal == KErrNone)
3928 LOG_MESSAGE(errDesc);
3932 iAnim->CommandReply(EADllMultiPtrEventReset);
3936 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0013
3938 @SYMREQ REQ9677,REQ9683,
3939 @SYMTestPriority High
3940 @SYMTestCaseDesc To check Wserv sends Multi Pointer events to Anims
3941 @SYMTestStatus Implemented
3943 @SYMTestActions Simulate multi pointer events for anims
3944 @SYMTestExpectedResults The received events must match the simulated raw events
3946 void CTMultiPtrEventTest::MultiPointerEventsForAnimsL()
3948 // The logic behind these tests is
3949 // Create an anim, which creates animation at server side(which swicthes raw event handling on)
3950 // Add the required events to the animtaion at server side buffer
3951 // Simulate those events and check simulated events are same as required at server side
3952 // If any test fail, error description is got from server and displayed in the log file
3953 TLogMessageText logText;
3954 _LIT(KSet, "Multi pointer events for Anims: %d of 3");
3955 logText.AppendFormat(KSet, iEventSet);
3956 LOG_MESSAGE(logText);
3957 _LIT(KEventsChecked, "Events checked at server side = %d");
3959 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
3963 iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs);
3964 User::LeaveIfError(iAnimDll->Load(KAnimDLLName));
3971 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
3972 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
3977 // Simulate downup events for all pointers
3978 iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll);
3979 AddExpectedWsEvent(EEventFocusGained);
3980 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
3982 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum);
3983 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum);
3984 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
3988 TestAndDisplayAnimError();
3989 logText.Format(KEventsChecked, iMaxDevPointers*2);
3990 LOG_MESSAGE(logText);
3993 // Simulate moves from different pointer with different pressure
3994 // Here there is no need for events to be exaclty on the anim window.
3995 // becasue when the animtaions ask for events it will be delivered all the events
3996 // irrespective of where they occured.
3998 prValue = iPressureStep;
3999 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4001 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, prValue, 0, ptrNum);
4002 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum);
4003 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum);
4004 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
4005 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
4009 TestAndDisplayAnimError();
4011 // This is for just to add run the next test
4012 SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0);
4014 logText.Format(KEventsChecked, iMaxDevPointers*3);
4015 LOG_MESSAGE(logText);
4018 // Simulate moves from different pointer with different proximity
4020 proxValue = -iProximityStep;
4021 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4023 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, proxValue, 0, ptrNum);
4024 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum);
4025 iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum);
4026 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
4027 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
4031 TestAndDisplayAnimError();
4033 // This is for just to add run the next test
4034 SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0);
4036 logText.Format(KEventsChecked, iMaxDevPointers*3);
4037 LOG_MESSAGE(logText);
4040 DestroyAnimDllAndAnim();
4050 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0014
4052 @SYMREQ REQ9677,REQ9683,
4053 @SYMTestPriority High
4054 @SYMTestCaseDesc To check Wserv purges multi pointer events with standard rules
4055 @SYMTestStatus Implemented
4057 @SYMTestActions Simulate raw events to be purged
4058 @SYMTestExpectedResults The purged events should not be delivered to client
4060 void CTMultiPtrEventTest::PurgingMultiPointerEvents()
4062 // Test purging of multi pointer events
4063 // 1. Test down/up pairs are purged
4064 // 2. Test moves events are purged
4065 // 3. Test drag events are purged
4066 // 4. Test lone down events are purged
4067 // 5. And finally test lone up events are also purged
4068 TLogMessageText logText;
4069 _LIT(KSet, "Purging of multi pointer events: %d of 6");
4070 logText.AppendFormat(KSet, iEventSet);
4071 LOG_MESSAGE(logText);
4073 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
4074 TInt xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize;
4075 TInt yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize;
4076 TPoint ptrPos(xInc,yInc);
4086 // Point to note is that Kernel has an event queue size of 40
4087 // So make sure that you don't send more than 40 events
4091 // Simulate pointer down/up events for all pointers
4092 // Simulate many up events from any pointer which will purge down/up events
4093 AddExpectedWsEvent(EEventFocusGained);
4094 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
4096 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
4098 SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize-1, ptrPos);
4101 // Repeat the same for Move events
4102 // Simulate moves for all pointers with different pressure and proximity value
4103 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
4104 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
4105 prValue = iPressureStep;
4106 for (ptrNum = 0; (ptrNum < iMaxDevPointers && prValue < iMaxPressure && ptrNum < 4); ptrNum++,prValue+=iPressureStep)
4108 ptrPos.iX += xInc/2;
4109 ptrPos.iY += yInc/2;
4110 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
4114 proxValue = -iProximityStep;
4115 for (ptrNum = 0; (ptrNum < iMaxDevPointers && proxValue > iMaxProximity && ptrNum < 4); ptrNum++,proxValue-=iProximityStep)
4117 ptrPos.iX += xInc/2;
4118 ptrPos.iY += yInc/2;
4119 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
4121 SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos);
4125 // Repeat the same for drag events
4126 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
4127 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
4130 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
4132 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4133 ptrPos.iX += xInc/2;
4134 ptrPos.iY += yInc/2;
4138 TPoint interPt = ptrPos;
4139 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
4143 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
4144 ptrPos.iX += xInc/2;
4145 ptrPos.iY += yInc/2;
4151 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
4155 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
4156 ptrPos.iX += xInc/2;
4157 ptrPos.iY += yInc/2;
4160 SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos);
4164 // Repeat the same for lone down events
4167 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++)
4169 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4170 ptrPos.iX += xInc/2;
4171 ptrPos.iY += yInc/2;
4173 SimulateAndAddLoneUpEvents(KMaxQueueSize+1, KMaxQueueSize, ptrPos);
4175 // Before this we had to send dummy 7 EButton1Up events from 1 to 7 pointers so that iLastUnmatchedDown1
4176 // variable to be reset and that consecutive events was not sent to client. But now EPointer3DOutOfRange
4177 // resets all the variables.
4178 for (ptrNum = 1; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++)
4180 SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4184 // Finally for even lone up events, check that when you send events more then the queuesize
4185 // the events are not sent back and they are ignored in wserv
4188 for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
4190 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4191 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
4192 ptrPos.iX += xInc/2;
4193 ptrPos.iY += yInc/2;
4197 for (TInt count = 0; count < KMaxQueueSize; count++)
4199 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
4200 // For all up events more then KMaxQueueSize, wserv igoners then as the queue if full
4201 if (count < (KMaxQueueSize - iMaxDevPointers))
4203 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
4208 // Check PurgePointerEvents works with multi pointer events
4211 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4213 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4214 ptrPos.iX += xInc/2;
4215 ptrPos.iY += yInc/2;
4219 iMultiPtrEventClient->iWs.PurgePointerEvents();
4220 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
4221 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
4230 void CTMultiPtrEventTest::MultiPointerEvents()
4232 TLogMessageText logText;
4233 _LIT(KSet, "MultiPtrEvents SetOfEvents: %d of 9");
4234 logText.AppendFormat(KSet, iEventSet);
4235 LOG_MESSAGE(logText);
4241 iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
4247 TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
4248 TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
4254 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0001
4256 @SYMREQ REQ9674,REQ9687,
4257 @SYMTestPriority High
4258 @SYMTestCaseDesc Checks Wserv sends multi touch pointer events received by it
4259 @SYMTestStatus Implemented
4261 @SYMTestActions Simulate raw events from different pointers
4262 @SYMTestExpectedResults The received events must match the simulated raw events
4264 INFO_PRINTF1(_L("Simulate pointer events from all pointers"));
4265 INFO_PRINTF1(_L("Test pattern is PointerDown0/PointerUp0, PointerDown1/PointerUp1, PointerDown2/PointerUp2..."));
4266 // Test pattern is down0/up0, down1/up1, down2/up2, down3/up3....
4267 AddExpectedWsEvent(EEventFocusGained);
4268 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4270 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
4271 AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
4278 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0003
4280 @SYMREQ REQ9674,REQ9687,
4281 @SYMTestPriority High
4282 @SYMTestCaseDesc To check Wserv sends simultaneous multi touch pointer events
4283 @SYMTestStatus Implemented
4285 @SYMTestActions Simulate simultaneous raw events from different pointers
4286 @SYMTestExpectedResults The received events must match the simulated raw events
4288 INFO_PRINTF1(_L("Test pattern PointerDown0/PointerDown1/PointerDown2/... PointerUp0/PointerUp1/PointerUp2..."));
4289 // Test pattern is pointer0Down/pointer1Down/pointer2Down/pointer3Down.... pointer0Up/pointer1Up/pointer2Up/pointer3Up....
4291 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4293 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4294 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
4300 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4302 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4303 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
4310 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0005
4313 @SYMTestPriority High
4314 @SYMTestCaseDesc To check Wserv sends the multi touch pointer events received
4315 by it along with the Pressure or Proximity
4316 @SYMTestStatus Implemented
4318 @SYMTestActions Simulate raw events with pressure and proximity from different pointers
4319 @SYMTestExpectedResults The received events must match the simulated raw events
4321 // Simulate Button1Down with differet pressure
4322 // Simulate Button1Up with zero pressure
4323 INFO_PRINTF1(_L("Simulate pointer events with different pressure values"));
4325 prValue = iPressureStep;
4326 for (; (prValue <= iMaxPressure && ptrPos.iX < iPhysicalScreenSize.iWidth && ptrPos.iY < iPhysicalScreenSize.iHeight); prValue+=iPressureStep)
4328 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0);
4329 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
4330 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0);
4331 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
4336 // Test with max pressure it might be that the width may cross the physical screen size
4338 prValue = iMaxPressure;
4339 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0);
4340 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
4341 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0);
4342 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
4345 // Simulate EPointerMove with different pressure values and for differernt pointers
4346 INFO_PRINTF1(_L("Simulate pointer events with different pressure values and from different pointers"));
4348 prValue = iPressureStep;
4350 // Enable move events
4351 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
4352 iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
4354 // Right now when 2 or more moves occur, wserv deletes all the moves except the last one.
4355 // So test only one move per Pointer and then one set of button down and button up
4356 // Then repeat the same for different pressure values
4357 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4359 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
4360 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
4366 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4368 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
4369 AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
4374 // Test moves with different pressure
4376 if ((prValue+iPressureStep) <= iMaxPressure)
4378 prValue += iPressureStep;
4381 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
4382 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
4385 INFO_PRINTF1(_L("Simulate pointer events with different proximity values"));
4386 // Repeat the same test of case 3 for different proximity values
4389 proxValue = -iProximityStep;
4390 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4392 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
4393 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
4399 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4401 SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
4402 AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
4408 if ((proxValue-iProximityStep) > iMaxProximity)
4410 proxValue -= iProximityStep;
4413 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
4414 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
4418 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0007
4421 @SYMTestPriority High
4422 @SYMTestCaseDesc To check Wserv sends move/drags of different pointers
4423 @SYMTestStatus Implemented
4425 @SYMTestActions Simulate raw move and drag events from different pointers
4426 @SYMTestExpectedResults The received events must match the simulated raw events
4428 INFO_PRINTF1(_L("Simulate pointer drag events"));
4430 iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
4432 // Simulate EButton1Down and then one move and then EButton1Up event
4433 // which will lead to corresponding drag, do it for all the pointers
4434 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4436 TestDragForMultiPointer(ptrPos, 0, ptrNum);
4437 ptrPos.iX += xInc/2;
4438 ptrPos.iY += yInc/2;
4441 // Check the drag with different pressure value with different pointer
4442 prValue = iPressureStep;
4445 if ((prValue+iPressureStep) <= iMaxPressure)
4447 prValue += iPressureStep;
4450 TestDragForMultiPointer(ptrPos, prValue, ptrNum);
4455 @SYMTestCaseID GRAPHICS-WSERV-ADVANCEDPOINTER-0009
4457 @SYMREQ REQ9677, REQ9674
4458 @SYMTestPriority High
4459 @SYMTestCaseDesc To check Wserv sends simultaneous move/drags of different pointers
4460 @SYMTestStatus Implemented
4462 @SYMTestActions Simulate simulatneous raw move and drag events from different pointers
4463 @SYMTestExpectedResults The received events must match the simulated raw events
4465 INFO_PRINTF1(_L("Simulate pointer drag events in different pattern"));
4466 // Dragging done in this pattern
4467 // pointer0Down/pointer1Down/pointer2Down/pointer3Down... pointer0Up/pointer1Up/pointer2Up/pointer3Up....
4470 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4472 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4473 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
4474 ptrPos.iX += xInc/2;
4475 ptrPos.iY += yInc/2;
4479 TPoint interPt = ptrPos;
4480 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4484 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
4485 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
4486 ptrPos.iX += xInc/2;
4487 ptrPos.iY += yInc/2;
4493 for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
4497 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
4498 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
4499 ptrPos.iX += xInc/2;
4500 ptrPos.iY += yInc/2;
4507 // Mixing of drag and moves of different pointers
4509 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
4511 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4512 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
4513 ptrPos.iX += xInc/2;
4514 ptrPos.iY += yInc/2;
4517 TPoint interPt = ptrPos;
4518 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
4522 SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
4523 AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
4524 ptrPos.iX += xInc/2;
4525 ptrPos.iY += yInc/2;
4531 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
4535 SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
4536 AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
4537 ptrPos.iX += xInc/2;
4538 ptrPos.iY += yInc/2;
4543 prValue = iPressureStep;
4544 for (ptrNum = 0; ptrNum < iMaxDevPointers/2 && prValue < iMaxPressure; ptrNum++, prValue+=iPressureStep)
4546 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
4547 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
4555 INFO_PRINTF1(_L("Check intermediate Moves and Drags are deleted except last event"));
4556 // Check if intermediate move and drag events are deleted
4557 // The deletion is done with respect to same pointer and same window
4558 xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize;
4559 yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize;
4564 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
4566 // Make sure that ptrPos does not go out of screen area, i,e the loop count should not exceed 4
4567 for (count = proxValue = 0; proxValue > iMaxProximity && count < 4; proxValue=proxValue-(4*iProximityStep), count++)
4569 ptrPos.iX += xInc/2;
4570 ptrPos.iY += yInc/2;
4571 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
4573 // Since the for loop increments the variables at the end
4574 proxValue = proxValue + (4*iProximityStep);
4575 AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
4580 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
4582 ptrPos.iX += xInc/2;
4583 ptrPos.iY += yInc/2;
4584 SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4585 AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
4590 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
4592 // Make sure that ptrPos does not go out of screen area, i,e the loop count shuld not exceed 4
4593 for (count = prValue = 0; prValue < iMaxPressure && count < 4; prValue=prValue+(4*iPressureStep), count++)
4595 ptrPos.iX += xInc/2;
4596 ptrPos.iY += yInc/2;
4597 SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
4599 prValue = prValue-(4*iPressureStep);
4600 AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, prValue, 0, ptrNum);
4605 for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
4607 ptrPos.iX += xInc/2;
4608 ptrPos.iY += yInc/2;
4609 SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
4610 AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
4622 // Logs number of events added to test buffer for comaparison
4623 void CTMultiPtrEventTest::LogEventsAdded()
4625 TLogMessageText logText1;
4626 _LIT(KEventsAdded, "Events added to buffer = %d");
4627 logText1.AppendFormat(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining());
4628 LOG_MESSAGE(logText1);
4631 // If any of the Tests fails, bring the wserv in a consistent state for other test to run,
4632 // stop ActiveScheduler and display some logs where the fail occured.
4633 void CTMultiPtrEventTest::Failed()
4635 switch (iTest->iState)
4637 case 2: // Anim tests
4638 DestroyAnimDllAndAnim();
4640 case 3: // MultiClient tests
4641 if (iMultiPtrEventClient->EventBuffer()->NestedLoopState())
4643 iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(EFalse);
4644 CActiveScheduler::Stop();
4647 case 4: //PtrClick tests
4648 if (iPtrPluginLoaded)
4650 iPtrPluginLoaded = EFalse;
4661 case 5: //Screen mode tests
4662 SetDefaultScreenMode();
4665 iMultiPtrEventClient->DeleteGroupBlankWin();
4667 case 12: //Emulation tests, iEventSet is incremented in main switch case.
4674 DestroyAnimDllAndAnim();
4678 iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer();
4679 iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer();
4683 iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea);
4692 DeleteGroupWinForCapturing();
4697 SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt);
4703 if (iActiveSchedulerStarted)
4705 iActiveSchedulerStarted = EFalse;
4706 CActiveScheduler::Stop();
4709 // Display the test case number, subtest case number and number of events left in the buffer which can be used to
4710 // find out which event actually caused the failure when any test fails
4711 TLogMessageText logText1;
4712 _LIT(KEventsAdded, "Test case number %d Sub test case number %d Events remaining in the buffer %d \n");
4713 logText1.AppendFormat(KEventsAdded, iTest->iState, iEventSet, iMultiPtrEventClient->EventBuffer()->EventsRemaining());
4714 LOG_MESSAGE(logText1);
4715 RDebug::Printf("Test case number %d Sub test case number %d Events remaining in the buffer %d \n", iTest->iState, iEventSet, iMultiPtrEventClient->EventBuffer()->EventsRemaining());
4720 // This function is called by TestExecute Framework, through which all the testcases are run
4721 void CTMultiPtrEventTest::RunTestCaseL(TInt /*aCurTestCase*/)
4723 _LIT(KTest0, "MultiPointerEvents with Pressure and Proximity");
4724 _LIT(KTest1, "Purging Of MultiPointerEvents");
4725 _LIT(KTest2, "MultiPointerEvents for Anims");
4726 _LIT(KTest3, "MultiPointerEvents from multi client");
4727 _LIT(KTest4, "MultiPointerEvents for pointer click plugin");
4728 _LIT(KTest5, "MultiPointerEvents In Different ScreenModes");
4729 _LIT(KTest6, "Filtering Of MultiPointerEvents");
4730 _LIT(KTest7, "Grabbing Of MultiPointerEvents");
4731 _LIT(KTest8, "VirtualKeyboard for Multiple Pointers");
4732 _LIT(KTest9, "DoubleClick events for Multiple Pointer");
4733 _LIT(KTest10, "OutOfRange & EnterExit for Multiple Pointer");
4734 _LIT(KTest11, "Auto foreground for Multiple Pointer");
4735 _LIT(KTest12, "Emulation rules for Mulitple Pointers");
4736 _LIT(KTest13, "Close proximity and High Pressure events");
4737 _LIT(KTest14, "Out of bound value testing");
4738 _LIT(KTest15, "Capturing Of MultiPointerEvents");
4739 _LIT(KTest16, "Negative testing for Proximity and Pressure events");
4740 _LIT(KTest17, "PointerRepeatEvent for Multiple Pointers");
4742 if (!TestBase()->ConfigurationSupportsPointerEventTesting())
4744 INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
4749 switch(iTest->iState)
4752 iTest->LogSubTest(KTest0);
4756 iTest->LogSubTest(KTest1);
4760 iTest->LogSubTest(KTest2);
4764 iTest->LogSubTest(KTest3);
4768 iTest->LogSubTest(KTest4);
4772 iTest->LogSubTest(KTest5);
4776 iTest->LogSubTest(KTest6);
4780 iTest->LogSubTest(KTest7);
4784 iTest->LogSubTest(KTest8);
4788 iTest->LogSubTest(KTest9);
4792 iTest->LogSubTest(KTest10);
4796 iTest->LogSubTest(KTest11);
4800 iTest->LogSubTest(KTest12);
4804 iTest->LogSubTest(KTest13);
4808 iTest->LogSubTest(KTest14);
4812 iTest->LogSubTest(KTest15);
4816 iTest->LogSubTest(KTest16);
4820 iTest->LogSubTest(KTest17);
4824 // Keep this code in last case statement for main test completion
4828 AutoPanic(EAutoPanicWrongTest);
4840 // Macro which is used for construction of CTMultiPtrEventTestStep object
4841 // and also used to call CreateTestL() which creates CTMultiPtrEventTest and CTestBase objects
4842 __WS_CONSTRUCT_STEP__(MultiPtrEventTest)