os/graphics/windowing/windowserver/test/tauto/tmultiptrevent.cpp
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Multi pointer and Z-coordinate test code
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @test
sl@0
    21
 @internalComponent - Internal Symbian test code 
sl@0
    22
*/
sl@0
    23
sl@0
    24
#ifndef __INIPARSER_H__
sl@0
    25
#define __INIPARSER_H__
sl@0
    26
#endif // __INIPARSER_H__
sl@0
    27
sl@0
    28
#include "PARSEINIDATA.H"
sl@0
    29
#include "tmultiptrevent.h"
sl@0
    30
#include <e32cmn.h>
sl@0
    31
#include <hal.h>
sl@0
    32
sl@0
    33
//#define FAILLOG 1			// Uncomment this code to get detailed log
sl@0
    34
#define TESTMULTIPOINTER 1	// Comment this line to get detailed log without testing
sl@0
    35
sl@0
    36
_LIT(KMultiPtrPluginDll, "multiptrclick.dll");
sl@0
    37
sl@0
    38
const TInt KErrDescSize = 128;
sl@0
    39
const TInt KMaxQueueSize = 32;	// Queue size of wserv. In any test we cannot test more than MaxQueueSize events. 
sl@0
    40
sl@0
    41
LOCAL_C void DestroyAnim(TAny* aAnim)
sl@0
    42
	{
sl@0
    43
	(static_cast<RMultiPointerAnim*>(aAnim))->Destroy();
sl@0
    44
	}
sl@0
    45
sl@0
    46
sl@0
    47
//CTMultiPtrEventBuffer
sl@0
    48
CTMultiPtrEventBuffer::CTMultiPtrEventBuffer(RWsSession *aWs, CTMultiPtrEventTest *aTest, CTMultiPtrEventClient* aClient) 
sl@0
    49
	: CTEvent(aWs), iTest(aTest), iClient(aClient)
sl@0
    50
	{
sl@0
    51
	}
sl@0
    52
sl@0
    53
void CTMultiPtrEventBuffer::ConstructL()
sl@0
    54
	{
sl@0
    55
	CTEventBase::Construct();
sl@0
    56
	iEventBuffer.SetLengthL(EEventBufferSize);
sl@0
    57
	iMovePtsBuffer.SetLengthL(EMovePtsBuffer);
sl@0
    58
	}
sl@0
    59
sl@0
    60
void CTMultiPtrEventBuffer::AddExpectedEvent(TWsEvent &aEvent)
sl@0
    61
	{
sl@0
    62
	iEventBuffer.Add(&aEvent);
sl@0
    63
	}
sl@0
    64
sl@0
    65
void CTMultiPtrEventBuffer::AddExpectedMovePtEvent(TPoint &aMovePt)
sl@0
    66
	{
sl@0
    67
	iMovePtsBuffer.Add(&aMovePt);
sl@0
    68
	}
sl@0
    69
sl@0
    70
TInt CTMultiPtrEventBuffer::EventsRemaining()
sl@0
    71
	{
sl@0
    72
	return iEventBuffer.Count();
sl@0
    73
	}
sl@0
    74
sl@0
    75
void CTMultiPtrEventBuffer::GetMoveBufferAndCompareL()
sl@0
    76
	{
sl@0
    77
	TBuf8<EMovePtsBuffer*sizeof(TPoint)> buf;
sl@0
    78
	iClient->ParentWin()->BaseWin()->RetrievePointerMoveBuffer(buf);
sl@0
    79
	
sl@0
    80
	TUint bufferSize = buf.Length();
sl@0
    81
	TUint numLoop = bufferSize/sizeof(TPoint);
sl@0
    82
	
sl@0
    83
	if (iMovePtsBuffer.Count() != numLoop)
sl@0
    84
		{
sl@0
    85
#if defined(FAILLOG)
sl@0
    86
		TLogMessageText logText;
sl@0
    87
		_LIT(KPointerNumber, "Actual number of move/drag buffer points from Wserv = %d Expected number of move/drag buffer points = %d ");
sl@0
    88
		logText.Format(KPointerNumber, numLoop, iMovePtsBuffer.Count());
sl@0
    89
		iTest->LOG_MESSAGE(logText);
sl@0
    90
#endif
sl@0
    91
		TestL(EFalse);
sl@0
    92
		}
sl@0
    93
	
sl@0
    94
	TPoint wsPoint;
sl@0
    95
	TPoint expPoint;
sl@0
    96
	TUint8* BasePtr = const_cast<TUint8*>(buf.Ptr());
sl@0
    97
	for (TUint count = 0; count < numLoop; count++)
sl@0
    98
		{
sl@0
    99
		wsPoint = *(reinterpret_cast<TPoint*>(BasePtr));
sl@0
   100
		iMovePtsBuffer.Remove(&expPoint);
sl@0
   101
		if (wsPoint != expPoint)
sl@0
   102
			{
sl@0
   103
#if defined(FAILLOG)
sl@0
   104
			TLogMessageText logText;
sl@0
   105
			_LIT(KMoveBufferPoint, "Actual move/drag buffer point from Wserv = ([%d], [%d]) Expected move/drag buffer point = ([%d], [%d])");
sl@0
   106
			logText.Format(KMoveBufferPoint, wsPoint.iX, wsPoint.iY, expPoint.iX, expPoint.iY);
sl@0
   107
			iTest->LOG_MESSAGE(logText);
sl@0
   108
#endif
sl@0
   109
			TestL(EFalse);
sl@0
   110
			}
sl@0
   111
		BasePtr = BasePtr + sizeof(TPoint);
sl@0
   112
		}
sl@0
   113
	}
sl@0
   114
sl@0
   115
sl@0
   116
#define TESTXL(expr1, oper, expr2, event, expected) \
sl@0
   117
    TestL(expr1 oper expr2, expr1, expr2, #oper, #expr1 ## #oper ## #expr2, \
sl@0
   118
            event, expected, __FILE__, __LINE__);
sl@0
   119
sl@0
   120
// Main function which gets the event, checks with the event in buffer
sl@0
   121
// Then calls function NextSetOfEventsL for running other tests of a particualar test case
sl@0
   122
void CTMultiPtrEventBuffer::doRunL()
sl@0
   123
	{
sl@0
   124
	// Get the event from wserv
sl@0
   125
	TWsEvent wsEvent;
sl@0
   126
	iWs->GetEvent(wsEvent);
sl@0
   127
sl@0
   128
	TWsEvent expectedEvent;
sl@0
   129
	TInt wsType=wsEvent.Type();
sl@0
   130
	if (wsEvent.Type()==EEventNull)
sl@0
   131
		{
sl@0
   132
		TESTXL(wsEvent.Handle(), ==, 0, &wsEvent, NULL);
sl@0
   133
		goto End;
sl@0
   134
		}
sl@0
   135
	// This code is for running successive anim test code 
sl@0
   136
	if (wsEvent.Type()==EEventPointer && wsEvent.Pointer()->iType==TPointerEvent::ESwitchOn)
sl@0
   137
		goto End;
sl@0
   138
	// if this is called accidentally
sl@0
   139
	if (iEventBuffer.Count()==0 && wsType==EEventFocusGained)
sl@0
   140
		goto End;
sl@0
   141
sl@0
   142
	iEventBuffer.Remove(&expectedEvent);
sl@0
   143
	iEventCount++;
sl@0
   144
sl@0
   145
	if (wsEvent.Type() == EEventPointerBufferReady)
sl@0
   146
		{
sl@0
   147
		GetMoveBufferAndCompareL();
sl@0
   148
#if defined(FAILLOG)
sl@0
   149
		TLogMessageText logText;
sl@0
   150
		_LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d ");
sl@0
   151
		logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle());
sl@0
   152
		iTest->LOG_MESSAGE(logText);
sl@0
   153
#endif
sl@0
   154
#if defined(TESTMULTIPOINTER)
sl@0
   155
		TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent);
sl@0
   156
#endif
sl@0
   157
		goto End;
sl@0
   158
		}
sl@0
   159
sl@0
   160
	// Test wsEvent and expected event have same handle, position and type.
sl@0
   161
#if defined(FAILLOG)
sl@0
   162
	{
sl@0
   163
	TLogMessageText logText;
sl@0
   164
	_LIT(KEventCountCheck, "Checking event number = %d");
sl@0
   165
	logText.Format(KEventCountCheck, iEventCount);
sl@0
   166
	iTest->LOG_MESSAGE(logText);
sl@0
   167
	_LIT(KEventType, "Actual Event type from Wserv = %d Expected Event Type = %d ");
sl@0
   168
	logText.Format(KEventType, wsEvent.Type(), expectedEvent.Type());
sl@0
   169
	iTest->LOG_MESSAGE(logText);
sl@0
   170
	}
sl@0
   171
#endif
sl@0
   172
sl@0
   173
#if defined(TESTMULTIPOINTER)
sl@0
   174
	TESTXL(wsEvent.Type(), ==, expectedEvent.Type(), &wsEvent, &expectedEvent);
sl@0
   175
#endif
sl@0
   176
	// Test pointer number for Enter/Exit events
sl@0
   177
	if (wsType == EEventPointerEnter || wsType == EEventPointerExit)
sl@0
   178
		{
sl@0
   179
#if defined(FAILLOG)
sl@0
   180
		TLogMessageText logText;
sl@0
   181
		_LIT(KPointerNumber, "Actual PointerNumber for Enter/Exit event from Wserv = %d Expected PointerNumber for Enter/Exit event = %d ");
sl@0
   182
		logText.Format(KPointerNumber, *wsEvent.Int(), *expectedEvent.Int());
sl@0
   183
		iTest->LOG_MESSAGE(logText);
sl@0
   184
#endif
sl@0
   185
#if defined(TESTMULTIPOINTER)
sl@0
   186
		TESTXL(*wsEvent.Int(), ==, *expectedEvent.Int(), &wsEvent, &expectedEvent);
sl@0
   187
#endif
sl@0
   188
		}
sl@0
   189
sl@0
   190
	// Test only if it is a Pointer event
sl@0
   191
	if (wsType==EEventPointer)
sl@0
   192
		{
sl@0
   193
		TAdvancedPointerEvent* expectedPointerEvent=expectedEvent.Pointer();
sl@0
   194
		TAdvancedPointerEvent* actualPointerEvent=wsEvent.Pointer();
sl@0
   195
#if defined(FAILLOG)
sl@0
   196
		TLogMessageText logText;
sl@0
   197
		_LIT(KEventHandle, "Actual Window Handle from Wserv = %d Expected Window Handle = %d ");
sl@0
   198
		logText.Format(KEventHandle, wsEvent.Handle(), expectedEvent.Handle());
sl@0
   199
		iTest->LOG_MESSAGE(logText);
sl@0
   200
#endif
sl@0
   201
#if defined(TESTMULTIPOINTER)
sl@0
   202
		TESTXL(wsEvent.Handle(), ==, expectedEvent.Handle(), &wsEvent, &expectedEvent);
sl@0
   203
#endif
sl@0
   204
#if defined(FAILLOG)
sl@0
   205
		_LIT(KPointerType, "Actual PointerType from Wserv = %d Expected PointerType = %d ");
sl@0
   206
		logText.Format(KPointerType, actualPointerEvent->iType, expectedPointerEvent->iType);
sl@0
   207
		iTest->LOG_MESSAGE(logText);
sl@0
   208
#endif
sl@0
   209
#if defined(TESTMULTIPOINTER)
sl@0
   210
		TESTXL(actualPointerEvent->iType, ==, expectedPointerEvent->iType, &wsEvent, &expectedEvent);
sl@0
   211
#endif
sl@0
   212
#if defined(FAILLOG)
sl@0
   213
		_LIT(KPointerPosition, "Actual PointerPosition from Wserv = (%d, %d) Expected PointerPosition = (%d, %d) ");
sl@0
   214
		logText.Format(KPointerPosition, actualPointerEvent->iPosition.iX, actualPointerEvent->iPosition.iY, expectedPointerEvent->iPosition.iX, expectedPointerEvent->iPosition.iY);
sl@0
   215
		iTest->LOG_MESSAGE(logText);
sl@0
   216
#endif
sl@0
   217
#if defined(TESTMULTIPOINTER)		
sl@0
   218
		TESTXL(actualPointerEvent->iPosition, ==, expectedPointerEvent->iPosition, &wsEvent, &expectedEvent);
sl@0
   219
#endif		
sl@0
   220
#if defined(FAILLOG)
sl@0
   221
		_LIT(KPointerNumber, "Actual PointerNumber from Wserv = %d Expected PointerNumber = %d ");
sl@0
   222
		logText.Format(KPointerNumber, actualPointerEvent->PointerNumber(), expectedPointerEvent->PointerNumber());
sl@0
   223
		iTest->LOG_MESSAGE(logText);
sl@0
   224
#endif
sl@0
   225
#if defined(TESTMULTIPOINTER)		
sl@0
   226
		TESTXL(actualPointerEvent->PointerNumber(), ==, expectedPointerEvent->PointerNumber(), &wsEvent, &expectedEvent);
sl@0
   227
#endif
sl@0
   228
#if defined(FAILLOG)
sl@0
   229
		_LIT(KPointerProximity, "Actual PointerProximity from Wserv = %d Expected PointerProximity = %d ");
sl@0
   230
		logText.Format(KPointerProximity, actualPointerEvent->Proximity(), expectedPointerEvent->Proximity());
sl@0
   231
		iTest->LOG_MESSAGE(logText);
sl@0
   232
#endif
sl@0
   233
#if defined(TESTMULTIPOINTER)		
sl@0
   234
		TESTXL(actualPointerEvent->Proximity(), ==, expectedPointerEvent->Proximity(), &wsEvent, &expectedEvent);
sl@0
   235
#endif		
sl@0
   236
#if defined(FAILLOG)
sl@0
   237
		_LIT(KPointerPressure, "Actual PointerPressure from Wserv = %d Expected PointerPressure = %d ");
sl@0
   238
		logText.Format(KPointerPressure, actualPointerEvent->Pressure(), expectedPointerEvent->Pressure());
sl@0
   239
		iTest->LOG_MESSAGE(logText);
sl@0
   240
#endif
sl@0
   241
#if defined(TESTMULTIPOINTER)		
sl@0
   242
		TESTXL(actualPointerEvent->Pressure(), ==, expectedPointerEvent->Pressure(), &wsEvent, &expectedEvent);
sl@0
   243
#endif
sl@0
   244
#if defined(FAILLOG)
sl@0
   245
		_LIT(KPointerModifier, "Actual Modifier value from Wserv = 0x%08x Expected Modfier value = 0x%08x ");
sl@0
   246
		logText.Format(KPointerModifier, actualPointerEvent->iModifiers, expectedPointerEvent->iModifiers);
sl@0
   247
		iTest->LOG_MESSAGE(logText);
sl@0
   248
#endif
sl@0
   249
#if defined(TESTMULTIPOINTER)		
sl@0
   250
		TESTXL((actualPointerEvent->iModifiers&expectedPointerEvent->iModifiers), ==, expectedPointerEvent->iModifiers, &wsEvent, &expectedEvent);
sl@0
   251
#endif		
sl@0
   252
		}
sl@0
   253
End:
sl@0
   254
	// Call NextSetOfEvents() only for primary client
sl@0
   255
	if (iEventBuffer.Count()==0 && !iClient->IsSecondaryClient())	
sl@0
   256
		{
sl@0
   257
		iTest->NextSetOfEventsL();		// Cannot Leave
sl@0
   258
		}
sl@0
   259
	
sl@0
   260
	// If this is for secondary client and active scheduler(nested loop) has started, this code stops that scheduler
sl@0
   261
	if (iEventBuffer.Count()==0 && iClient->IsSecondaryClient() && iNestedLoopStarted)
sl@0
   262
		{
sl@0
   263
		iNestedLoopStarted = EFalse;
sl@0
   264
		CActiveScheduler::Stop();
sl@0
   265
		}
sl@0
   266
	}
sl@0
   267
sl@0
   268
void CTMultiPtrEventBuffer::TestL(TInt aTest)
sl@0
   269
	{
sl@0
   270
	if (!aTest)
sl@0
   271
		{
sl@0
   272
		iTest->Failed();
sl@0
   273
		User::Leave(ETestFailed);
sl@0
   274
		}
sl@0
   275
	}
sl@0
   276
sl@0
   277
static void DumpEvent(const char *aName, const TWsEvent *aEvent)
sl@0
   278
    {
sl@0
   279
    // aEvent may be NULL - if it isn't NULL, we print it's data.
sl@0
   280
    if (aEvent)
sl@0
   281
        {
sl@0
   282
        RDebug::Printf("%s:", aName);
sl@0
   283
        RDebug::Printf("handle = %u", aEvent->Handle());
sl@0
   284
        RDebug::Printf("type() = %d", aEvent->Type());
sl@0
   285
        if (aEvent->Type() == EEventPointer)
sl@0
   286
            {
sl@0
   287
            TAdvancedPointerEvent *pointer = aEvent->Pointer();
sl@0
   288
            RDebug::Printf("pointer type = %d, position = (%d, %d)", 
sl@0
   289
                    pointer->iType, pointer->iPosition.iX, pointer->iPosition.iY);
sl@0
   290
            RDebug::Printf("PointerNumber() = %d, proximity=%d, pressure=%d", 
sl@0
   291
                    pointer->PointerNumber(), pointer->Proximity(), pointer->Pressure());
sl@0
   292
            RDebug::Printf("modifiers = 0x%08x", pointer->iModifiers);
sl@0
   293
            }
sl@0
   294
        else
sl@0
   295
            {
sl@0
   296
            RDebug::Printf("Not a pointer event, event type");
sl@0
   297
            }
sl@0
   298
        }
sl@0
   299
    else
sl@0
   300
        {
sl@0
   301
        // aEvent is NULL, just let us know it is. 
sl@0
   302
        RDebug::Printf("%s: is NULL which means not applicapable");
sl@0
   303
        }
sl@0
   304
    }
sl@0
   305
sl@0
   306
void CTMultiPtrEventBuffer::TestL(TInt aTest, TInt aVal1, TInt aVal2, const char *aOper, const char *aTestStr, 
sl@0
   307
        const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine)
sl@0
   308
    {
sl@0
   309
    if (!aTest)
sl@0
   310
        {
sl@0
   311
        RDebug::Printf("Expression %d %s %d [%s] (=%d) failed [call from %s:%d]", aVal1, aOper, aVal2, aTestStr, aTest, aFile, aLine);
sl@0
   312
        DumpEvent("actual", aEvent);
sl@0
   313
        DumpEvent("expected", aExpected);
sl@0
   314
        iTest->Failed();
sl@0
   315
        User::Leave(ETestFailed);
sl@0
   316
        }
sl@0
   317
    }
sl@0
   318
sl@0
   319
sl@0
   320
void CTMultiPtrEventBuffer::TestL(TInt aTest, TPoint aVal1, TPoint aVal2, const char *oper, const char *aTestStr, 
sl@0
   321
        const TWsEvent *aEvent, const TWsEvent *aExpected, const char *aFile, TUint aLine)
sl@0
   322
    {
sl@0
   323
    if (!aTest)
sl@0
   324
        {
sl@0
   325
        RDebug::Printf("Expression (%d, %d) %s (%d, %d) [%s] (=%d) failed [call from %s:%d]", 
sl@0
   326
                aVal1.iX, aVal1.iY, oper, aVal2.iX, aVal2.iY, aTestStr, aTest, aFile, aLine);
sl@0
   327
        DumpEvent("actual", aEvent);
sl@0
   328
        DumpEvent("expected", aExpected);
sl@0
   329
        iTest->Failed();
sl@0
   330
        User::Leave(ETestFailed);
sl@0
   331
        }
sl@0
   332
    }
sl@0
   333
sl@0
   334
//CTMultiPtrEventClient
sl@0
   335
CTMultiPtrEventClient::CTMultiPtrEventClient(CTMultiPtrEventTest *aTest, TBool aSecondaryClient) 
sl@0
   336
	: iTest(aTest), iSecondaryClient(aSecondaryClient)
sl@0
   337
	{
sl@0
   338
	}
sl@0
   339
sl@0
   340
CTMultiPtrEventClient::~CTMultiPtrEventClient()
sl@0
   341
	{
sl@0
   342
	if (iWinAutoFocus1 || iWinAutoFocus2 || iGroupWinAutoFocus2 || iGroupWinAutoFocus1)
sl@0
   343
		{
sl@0
   344
		DeleteGroupBlankWin();
sl@0
   345
		}
sl@0
   346
	delete iChildWin;
sl@0
   347
	delete iParentWin;
sl@0
   348
	}
sl@0
   349
sl@0
   350
void CTMultiPtrEventClient::ConstructL()
sl@0
   351
	{
sl@0
   352
	CTClient::ConstructL();
sl@0
   353
	
sl@0
   354
	// Create a group window and assign it iGroup
sl@0
   355
	iGroup = new(ELeave) CTWindowGroup(this);
sl@0
   356
	iGroup->ConstructL();
sl@0
   357
	
sl@0
   358
	iParentWinSize = iScreen->SizeInPixels();
sl@0
   359
	iParentWinPos = TPoint();
sl@0
   360
	
sl@0
   361
	// Change the parent window size and position for secondary client
sl@0
   362
	if (iSecondaryClient)
sl@0
   363
		{
sl@0
   364
		iParentWinSize.iWidth /= 2; 
sl@0
   365
		iParentWinPos.iX = iParentWinSize.iWidth;
sl@0
   366
		}
sl@0
   367
	
sl@0
   368
	// Create window/s for this client so that events can come to this client
sl@0
   369
	iParentWin=new(ELeave) CTBlankWindow();
sl@0
   370
	iParentWin->ConstructL(*iGroup);
sl@0
   371
	iParentWin->SetExt(iParentWinPos, iParentWinSize);
sl@0
   372
	iParentWin->SetColor(KRgbRed);
sl@0
   373
	if (iTest->TestBase()->iState != 12)
sl@0
   374
		{
sl@0
   375
		iParentWin->BaseWin()->EnableAdvancedPointers();
sl@0
   376
		}
sl@0
   377
	iParentWin->Activate();
sl@0
   378
	
sl@0
   379
	// Don't create child window for secodary client
sl@0
   380
	if (!iSecondaryClient)
sl@0
   381
		{
sl@0
   382
		iChildWinSize = TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight);
sl@0
   383
		iChildWinPos = TPoint(iParentWinSize.iWidth/2,0);
sl@0
   384
		
sl@0
   385
		iChildWin=new(ELeave) CTBlankWindow();
sl@0
   386
		iChildWin->ConstructL(*iGroup);
sl@0
   387
		iChildWin->SetExt(iChildWinPos, iChildWinSize);
sl@0
   388
		iChildWin->SetColor(KRgbRed);
sl@0
   389
		iChildWin->BaseWin()->EnableAdvancedPointers();
sl@0
   390
		iChildWin->Activate();
sl@0
   391
		}
sl@0
   392
	}
sl@0
   393
sl@0
   394
void CTMultiPtrEventClient::CalculatePtrPosAndSet3Ddata(TWsEvent& aEvent, TPointerEvent::TType aType, TPoint aPos, TUint aModifiers, TInt aZ, TUint8 aPointerNumber, TUint aHandle)
sl@0
   395
	{
sl@0
   396
	// If in future you need to change parent position then put this in corresponding if statements
sl@0
   397
	aEvent.Pointer()->iParentPosition = aPos;
sl@0
   398
	
sl@0
   399
	// This is for Auto foreground test
sl@0
   400
	if (iTest->TestBase()->iState == 11)
sl@0
   401
		{
sl@0
   402
		if (TRect(iWinPosAutoFocus1, iWinSizeAutoFocus1).Contains(aPos))
sl@0
   403
			{
sl@0
   404
			aPos -= iWinPosAutoFocus1;
sl@0
   405
			aEvent.SetHandle((TUint)iWinAutoFocus1);
sl@0
   406
			}
sl@0
   407
		else if (TRect(iWinPosAutoFocus2, iWinSizeAutoFocus2).Contains(aPos))
sl@0
   408
			{
sl@0
   409
			aPos -= iWinPosAutoFocus2;
sl@0
   410
			aEvent.SetHandle((TUint)iWinAutoFocus2);
sl@0
   411
			}
sl@0
   412
		goto SETOTHERDATA;
sl@0
   413
		}
sl@0
   414
sl@0
   415
	// Here simulated pointer position is w.r.t to 0,0
sl@0
   416
	// Actual pointer position is w.r.t windowPosition
sl@0
   417
	if (iSecondaryClient)
sl@0
   418
		{
sl@0
   419
		if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth, iParentWinSize.iHeight)).Contains(aPos))
sl@0
   420
			{
sl@0
   421
			// Since for secondary client parent window is at half of screensize
sl@0
   422
			aPos -= iParentWinPos;
sl@0
   423
			aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle);
sl@0
   424
			}
sl@0
   425
		}
sl@0
   426
	else
sl@0
   427
		{
sl@0
   428
		// If sent position is on blankWindow then
sl@0
   429
		if (TRect(iParentWinPos, TSize(iParentWinSize.iWidth/2, iParentWinSize.iHeight)).Contains(aPos))
sl@0
   430
			{
sl@0
   431
			aEvent.SetHandle((aHandle == 0) ? (TUint)iParentWin : aHandle);
sl@0
   432
			}
sl@0
   433
		else // else the pointer event occured on child window
sl@0
   434
			{
sl@0
   435
			// if aPos < 0 then position has been generated in test code and should not be adjusted
sl@0
   436
			if (aPos.iX >= 0)
sl@0
   437
				{
sl@0
   438
				aPos -= iChildWinPos;	
sl@0
   439
				}
sl@0
   440
			aEvent.SetHandle((aHandle == 0) ? (TUint)iChildWin : aHandle);
sl@0
   441
			}
sl@0
   442
		}
sl@0
   443
	
sl@0
   444
SETOTHERDATA:	
sl@0
   445
	aEvent.Pointer()->iType = aType;
sl@0
   446
	aEvent.Pointer()->iPosition = aPos;
sl@0
   447
	if(iExpectNonAdvancedPointerEvents)
sl@0
   448
		{
sl@0
   449
		aEvent.Pointer()->iModifiers = aModifiers;		
sl@0
   450
		}
sl@0
   451
	else
sl@0
   452
		{
sl@0
   453
		aEvent.Pointer()->iModifiers = aModifiers|EModifierAdvancedPointerEvent;
sl@0
   454
		aEvent.SetPointerNumber(aPointerNumber);
sl@0
   455
		aEvent.SetPointerZ(aZ);
sl@0
   456
		}
sl@0
   457
	}
sl@0
   458
sl@0
   459
void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle)
sl@0
   460
	{
sl@0
   461
	AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle);
sl@0
   462
	}
sl@0
   463
sl@0
   464
void CTMultiPtrEventClient::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle)
sl@0
   465
	{
sl@0
   466
	TWsEvent ptrEvent;
sl@0
   467
	ptrEvent.SetType(EEventPointer);
sl@0
   468
	if (aType != TPointerEvent::ESwitchOn)
sl@0
   469
		{
sl@0
   470
		CalculatePtrPosAndSet3Ddata(ptrEvent, aType, aPos, aModifier, aZ, aPointerNumber, aHandle);
sl@0
   471
		}
sl@0
   472
	static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent);
sl@0
   473
	}
sl@0
   474
sl@0
   475
void CTMultiPtrEventClient::AddExpectedWsEvent(TEventCode aType, TInt aPointerNumber, TUint aHandle)
sl@0
   476
	{
sl@0
   477
	TWsEvent ptrEvent;
sl@0
   478
	ptrEvent.SetType(aType);
sl@0
   479
	if (aType == EEventPointerEnter || aType == EEventPointerExit)
sl@0
   480
		{
sl@0
   481
		*ptrEvent.Int() = aPointerNumber;
sl@0
   482
		}
sl@0
   483
	if (aType == EEventPointerBufferReady)
sl@0
   484
		{
sl@0
   485
		ptrEvent.SetHandle(aHandle);
sl@0
   486
		}
sl@0
   487
	static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedEvent(ptrEvent);
sl@0
   488
	}
sl@0
   489
sl@0
   490
void CTMultiPtrEventClient::AddExpectedMovePoint(TPoint aPos)
sl@0
   491
	{
sl@0
   492
	static_cast<CTMultiPtrEventBuffer*>(iEventHandler)->AddExpectedMovePtEvent(aPos);
sl@0
   493
	}
sl@0
   494
sl@0
   495
// Create and store CTMultiPtrEventBuffer in iEventHandler
sl@0
   496
void CTMultiPtrEventClient::ConstructEventHandlerL()
sl@0
   497
	{
sl@0
   498
	CTMultiPtrEventBuffer* eventBufferAndHandler = new(ELeave) CTMultiPtrEventBuffer(&iWs, iTest, this);
sl@0
   499
	eventBufferAndHandler->ConstructL();
sl@0
   500
	iEventHandler = eventBufferAndHandler;
sl@0
   501
	}
sl@0
   502
sl@0
   503
// Create groupwindow and blank window for AutoFocus tests
sl@0
   504
void CTMultiPtrEventClient::ConstructGroupBlankWinL()
sl@0
   505
	{
sl@0
   506
	iWinPosAutoFocus1 = TPoint(10,10);
sl@0
   507
	iWinSizeAutoFocus1 = TSize(40,40);
sl@0
   508
	
sl@0
   509
	iWinPosAutoFocus2 = TPoint(50,50);
sl@0
   510
	iWinSizeAutoFocus2 = TSize(80,80);
sl@0
   511
	
sl@0
   512
	iGroupWinAutoFocus1 = new(ELeave) CTWindowGroup(this);
sl@0
   513
	iGroupWinAutoFocus1->ConstructL();
sl@0
   514
	iGroupWinAutoFocus1->GroupWin()->AutoForeground(ETrue);
sl@0
   515
	iGroupWinAutoFocus1->GroupWin()->EnableFocusChangeEvents();
sl@0
   516
	
sl@0
   517
	iGroupWinAutoFocus2 = new(ELeave) CTWindowGroup(this);
sl@0
   518
	iGroupWinAutoFocus2->ConstructL();
sl@0
   519
	iGroupWinAutoFocus2->GroupWin()->AutoForeground(ETrue);
sl@0
   520
	iGroupWinAutoFocus2->GroupWin()->EnableFocusChangeEvents();
sl@0
   521
	
sl@0
   522
	iWinAutoFocus1=new(ELeave) CTBlankWindow();
sl@0
   523
	iWinAutoFocus1->ConstructL(*iGroupWinAutoFocus1);
sl@0
   524
	iWinAutoFocus1->SetExt(iWinPosAutoFocus1, iWinSizeAutoFocus1);
sl@0
   525
	iWinAutoFocus1->SetColor(KRgbDarkYellow);
sl@0
   526
	iWinAutoFocus1->BaseWin()->EnableAdvancedPointers();
sl@0
   527
	iWinAutoFocus1->Activate();
sl@0
   528
	
sl@0
   529
	iWinAutoFocus2=new(ELeave) CTBlankWindow();
sl@0
   530
	iWinAutoFocus2->ConstructL(*iGroupWinAutoFocus2);
sl@0
   531
	iWinAutoFocus2->SetExt(iWinPosAutoFocus2, iWinSizeAutoFocus2);
sl@0
   532
	iWinAutoFocus2->SetColor(KRgbDarkCyan);
sl@0
   533
	iWinAutoFocus2->BaseWin()->EnableAdvancedPointers();
sl@0
   534
	iWinAutoFocus2->Activate();
sl@0
   535
	}
sl@0
   536
sl@0
   537
void CTMultiPtrEventClient::DeleteGroupBlankWin()
sl@0
   538
	{
sl@0
   539
	delete iWinAutoFocus2;
sl@0
   540
	iWinAutoFocus2 = NULL;
sl@0
   541
	delete iGroupWinAutoFocus2;
sl@0
   542
	iGroupWinAutoFocus2 = NULL;
sl@0
   543
	delete iWinAutoFocus1;
sl@0
   544
	iWinAutoFocus1 = NULL;
sl@0
   545
	delete iGroupWinAutoFocus1;
sl@0
   546
	iGroupWinAutoFocus1 = NULL;
sl@0
   547
	}
sl@0
   548
sl@0
   549
TBool CTMultiPtrEventClient::CheckOrdinalPosition(TInt aAutoFocusWin)
sl@0
   550
	{
sl@0
   551
	if (aAutoFocusWin == 1)
sl@0
   552
		{
sl@0
   553
		return iWinAutoFocus1->BaseWin()->OrdinalPosition() == 0;
sl@0
   554
		}
sl@0
   555
	else
sl@0
   556
		{
sl@0
   557
		return iWinAutoFocus2->BaseWin()->OrdinalPosition() == 0;
sl@0
   558
		}
sl@0
   559
	}
sl@0
   560
sl@0
   561
//CTMultiPtrEventTest
sl@0
   562
CTMultiPtrEventTest::CTMultiPtrEventTest(CTestStep* aStep)
sl@0
   563
	: CTWsGraphicsBase(aStep)
sl@0
   564
	{
sl@0
   565
	}
sl@0
   566
sl@0
   567
CTMultiPtrEventTest::~CTMultiPtrEventTest()
sl@0
   568
	{
sl@0
   569
	((CTMultiPtrEventTestStep*)iStep)->CloseTMSGraphicsStep();
sl@0
   570
	delete iMultiPtrEventClient;
sl@0
   571
	DestroyAnimDllAndAnim();	
sl@0
   572
	if (iPtrPluginLoaded)
sl@0
   573
		{
sl@0
   574
		iClick.Unload();
sl@0
   575
		}
sl@0
   576
	iClick.Close();
sl@0
   577
	if (iHeap)
sl@0
   578
		{
sl@0
   579
		iHeap->Close();
sl@0
   580
		iChunk.Close();
sl@0
   581
		}
sl@0
   582
	DeleteGroupWin();
sl@0
   583
	}
sl@0
   584
sl@0
   585
void CTMultiPtrEventTest::ConstructL()
sl@0
   586
	{
sl@0
   587
	// Here check if the HAL configuration are correct if not then finish the test case
sl@0
   588
	TInt ret = HAL::Get(HALData::EPointerMaxPointers, iMaxDevPointers);
sl@0
   589
	if (ret != KErrNone || iMaxDevPointers < 2 || iMaxDevPointers > 8)
sl@0
   590
		{
sl@0
   591
		TLogMessageText logText1;
sl@0
   592
		_LIT(KWrongHALConfig, "HAL configuration are incorrect. \n");
sl@0
   593
		logText1.Append(KWrongHALConfig);
sl@0
   594
		LOG_MESSAGE(logText1);
sl@0
   595
		TEST(EFalse);
sl@0
   596
		User::Leave(ret);
sl@0
   597
		}
sl@0
   598
	
sl@0
   599
	// Get the data by using HAL api
sl@0
   600
  	User::LeaveIfError(HAL::Get(HALData::EPointerMaxPointers,iMaxDevPointers));
sl@0
   601
  	User::LeaveIfError(HAL::Get(HALData::EPointerNumberOfPointers,iMaxUiPointers));
sl@0
   602
  	User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxPressure, iMaxPressure));
sl@0
   603
  	User::LeaveIfError(HAL::Get(HALData::EPointer3DPressureStep, iPressureStep));
sl@0
   604
  	User::LeaveIfError(HAL::Get(HALData::EPointer3DMaxProximity, iMaxProximity));
sl@0
   605
  	User::LeaveIfError(HAL::Get(HALData::EPointer3DProximityStep, iProximityStep));
sl@0
   606
	
sl@0
   607
    _LIT(KWsIniFile, "z:\\system\\data\\wsini.ini");
sl@0
   608
    CIniData* iniData = CIniData::NewL(KWsIniFile, ' ');
sl@0
   609
    _LIT( KWsiniYShifting, "YSHIFTING");
sl@0
   610
    iniData->FindVar(KWsiniYShifting, iYOffset);
sl@0
   611
    delete iniData;
sl@0
   612
	TheClient->iScreen->SetAppScreenMode(0);
sl@0
   613
	TheClient->iScreen->SetScreenMode(0);
sl@0
   614
	iPhysicalScreenSize = TheClient->iScreen->SizeInPixels();
sl@0
   615
	
sl@0
   616
	TheGc->Activate(*BaseWin->Win());
sl@0
   617
	TheGc->SetBrushColor(TRgb::Gray16(12));
sl@0
   618
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
   619
	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
sl@0
   620
	TheGc->DrawRect(TRect(BaseWin->Win()->Size()));
sl@0
   621
	TheGc->Deactivate();
sl@0
   622
	
sl@0
   623
	TheGc->Activate(*TestWin->Win());
sl@0
   624
	TheGc->SetBrushColor(TRgb::Gray16(4));
sl@0
   625
	TheGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
   626
	TheGc->SetPenStyle(CGraphicsContext::ENullPen);
sl@0
   627
	TheGc->DrawRect(TRect(TestWin->Win()->Size()));
sl@0
   628
	TheGc->Deactivate();
sl@0
   629
	
sl@0
   630
	TheClient->iWs.Flush();
sl@0
   631
	}
sl@0
   632
sl@0
   633
// Create raw event setting type, X, Y, Z and pointernumber for rawevent
sl@0
   634
// use UserSvr for simulating the event
sl@0
   635
void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TUint8 aPointerNumber)
sl@0
   636
	{
sl@0
   637
	TRawEvent rawEvent;
sl@0
   638
	rawEvent.Set(aType, aX, aY+iYOffset, aPointerNumber);
sl@0
   639
	UserSvr::AddEvent(rawEvent);
sl@0
   640
	}
sl@0
   641
sl@0
   642
void CTMultiPtrEventTest::SimulatePointerEvent(TRawEvent::TType aType, TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber)
sl@0
   643
	{
sl@0
   644
	TRawEvent rawEvent;
sl@0
   645
	rawEvent.Set(aType, aX, aY+iYOffset, aZ, aPointerNumber);
sl@0
   646
	UserSvr::AddEvent(rawEvent);
sl@0
   647
	}
sl@0
   648
sl@0
   649
// Simulate multipointer down and up event
sl@0
   650
void CTMultiPtrEventTest::SimulatePointerDownUp(TInt aX, TInt aY, TInt aZ, TUint8 aPointerNumber)
sl@0
   651
	{
sl@0
   652
	SimulatePointerEvent(TRawEvent::EButton1Down, aX, aY, aZ, aPointerNumber);
sl@0
   653
	SimulatePointerEvent(TRawEvent::EButton1Up, aX, aY, aZ, aPointerNumber);
sl@0
   654
	}
sl@0
   655
sl@0
   656
void CTMultiPtrEventTest::AddExpectedKey(TInt aEventCode, TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
sl@0
   657
	{
sl@0
   658
	TPckgBuf<TWsEvent> evtPkg;
sl@0
   659
	TWsEvent& event=evtPkg();
sl@0
   660
	if (aEventCode==EEventKey && aCode==0)
sl@0
   661
		aCode=aScanCode;
sl@0
   662
	event.SetType(aEventCode);
sl@0
   663
	event.SetHandle((TUint)iMultiPtrEventClient->iGroup);
sl@0
   664
	event.Key()->iCode=aCode;
sl@0
   665
	event.Key()->iScanCode=aScanCode;
sl@0
   666
	event.Key()->iModifiers=aModifiers;
sl@0
   667
	event.Key()->iRepeats=aRepeats;
sl@0
   668
	iMultiPtrEventClient->EventBuffer()->AddExpectedEvent(event);
sl@0
   669
	}
sl@0
   670
sl@0
   671
void CTMultiPtrEventTest::AddExpectedKeyDownUp(TInt aScanCode, TInt aCode/*=0*/, TInt aRepeats/*=0*/, TUint aModifiers/*=0*/)
sl@0
   672
	{
sl@0
   673
	__ASSERT_DEBUG(aScanCode<'a' || aScanCode>'z',AutoPanic(EAutoPanicScanCapital));
sl@0
   674
	AddExpectedKey(EEventKeyDown,aScanCode,0,aRepeats,aModifiers);
sl@0
   675
	AddExpectedKey(EEventKey,aScanCode,aCode,aRepeats,aModifiers);
sl@0
   676
	AddExpectedKey(EEventKeyUp,aScanCode,0,aRepeats,aModifiers);
sl@0
   677
	}
sl@0
   678
sl@0
   679
void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TUint8 aPointerNumber, TUint aHandle)
sl@0
   680
	{
sl@0
   681
	AddExpectedPointerEvent(aType, aPos, 0, 0, aPointerNumber, aHandle);
sl@0
   682
	}
sl@0
   683
sl@0
   684
void CTMultiPtrEventTest::AddExpectedPointerEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle, TBool aSecondaryClient)
sl@0
   685
	{
sl@0
   686
	if (aSecondaryClient)
sl@0
   687
		{
sl@0
   688
		iSecMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle);
sl@0
   689
		}
sl@0
   690
	else
sl@0
   691
		{
sl@0
   692
		iMultiPtrEventClient->AddExpectedPointerEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle);
sl@0
   693
		}
sl@0
   694
	}
sl@0
   695
sl@0
   696
void CTMultiPtrEventTest::SetExpectNonAdvancedPointerEvents(TBool aSecondaryClient)
sl@0
   697
	{
sl@0
   698
	if (aSecondaryClient)
sl@0
   699
		{
sl@0
   700
		iSecMultiPtrEventClient->SetExpectNonAdvancedPointerEvents();
sl@0
   701
		}
sl@0
   702
	else
sl@0
   703
		{
sl@0
   704
		iMultiPtrEventClient->SetExpectNonAdvancedPointerEvents();
sl@0
   705
		}
sl@0
   706
	}
sl@0
   707
sl@0
   708
void CTMultiPtrEventTest::ClearExpectNonAdvancedPointerEvents(TBool aSecondaryClient)
sl@0
   709
	{
sl@0
   710
	if (aSecondaryClient)
sl@0
   711
		{
sl@0
   712
		iSecMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents();
sl@0
   713
		}
sl@0
   714
	else
sl@0
   715
		{
sl@0
   716
		iMultiPtrEventClient->ClearExpectNonAdvancedPointerEvents();
sl@0
   717
		}
sl@0
   718
	}
sl@0
   719
sl@0
   720
void CTMultiPtrEventTest::AddExpectedPointerDownUp(TPoint aPos, TInt aZ, TUint8 aPointerNumber)
sl@0
   721
	{
sl@0
   722
	AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPos, aZ, 0, aPointerNumber);
sl@0
   723
	AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, aZ, 0, aPointerNumber);
sl@0
   724
	}
sl@0
   725
sl@0
   726
void CTMultiPtrEventTest::AddExpectedWsEvent(TEventCode aType, TBool aSecondaryClient, TInt aPointerNumber, TUint aHandle)
sl@0
   727
	{
sl@0
   728
	if (aSecondaryClient)
sl@0
   729
		{
sl@0
   730
		iSecMultiPtrEventClient->AddExpectedWsEvent(aType);
sl@0
   731
		}
sl@0
   732
	else
sl@0
   733
		{
sl@0
   734
		iMultiPtrEventClient->AddExpectedWsEvent(aType, aPointerNumber, aHandle);
sl@0
   735
		}
sl@0
   736
	}
sl@0
   737
sl@0
   738
void CTMultiPtrEventTest::TestDragForMultiPointer(TPoint aPtrPos, TInt aPrValue, TUint8 aPointerNumber)
sl@0
   739
	{
sl@0
   740
	SimulatePointerEvent(TRawEvent::EButton1Down, aPtrPos.iX, aPtrPos.iY, aPrValue, aPointerNumber);
sl@0
   741
	SimulatePointerEvent(TRawEvent::EPointerMove, aPtrPos.iX+2, aPtrPos.iY+1, aPrValue, aPointerNumber);
sl@0
   742
	SimulatePointerEvent(TRawEvent::EButton1Up, aPtrPos.iX+2, aPtrPos.iY+1, 0, aPointerNumber);
sl@0
   743
	AddExpectedPointerEvent(TPointerEvent::EButton1Down, aPtrPos, aPrValue, 0, aPointerNumber);
sl@0
   744
	aPtrPos.iX += 2; aPtrPos.iY += 1;
sl@0
   745
	AddExpectedPointerEvent(TPointerEvent::EDrag, aPtrPos, aPrValue, 0, aPointerNumber);
sl@0
   746
	AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPtrPos, 0, 0, aPointerNumber);
sl@0
   747
	}
sl@0
   748
sl@0
   749
void CTMultiPtrEventTest::SimulateAndAddLoneUpEvents(TInt aNumSimulation, TInt aNumAddition, TPoint aPos)
sl@0
   750
	{
sl@0
   751
	for (TInt count = 0; count < aNumSimulation; count++)
sl@0
   752
		{
sl@0
   753
		SimulatePointerEvent(TRawEvent::EButton1Up, aPos.iX, aPos.iY, 0, 0);
sl@0
   754
		}
sl@0
   755
	for (TInt count = 0; count < aNumAddition; count++)
sl@0
   756
		{
sl@0
   757
		AddExpectedPointerEvent(TPointerEvent::EButton1Up, aPos, 0, 0, 0);
sl@0
   758
		}
sl@0
   759
	}
sl@0
   760
sl@0
   761
void CTMultiPtrEventTest::TestFilteringForMultiPointer(TBool aFiltering)
sl@0
   762
	{
sl@0
   763
	TPoint ptrPos;
sl@0
   764
	TInt ptrNum;
sl@0
   765
	TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
sl@0
   766
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
sl@0
   767
	
sl@0
   768
	for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
   769
		{
sl@0
   770
		SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   771
		SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   772
		if(!aFiltering)
sl@0
   773
			{
sl@0
   774
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, ptrNum);
sl@0
   775
			}
sl@0
   776
		AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
sl@0
   777
		ptrPos.iX += xInc/2;
sl@0
   778
		ptrPos.iY += yInc/2;
sl@0
   779
		}
sl@0
   780
	
sl@0
   781
	ptrPos.SetXY(0,0);
sl@0
   782
	TPoint interPt = ptrPos;
sl@0
   783
	for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
   784
		{
sl@0
   785
		SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+2, interPt.iY+1, 0, ptrNum);
sl@0
   786
		SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+4, interPt.iY+2, 0, ptrNum);
sl@0
   787
		SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX+6, interPt.iY+3, 0, ptrNum);
sl@0
   788
		if(!aFiltering)
sl@0
   789
			{
sl@0
   790
			interPt.iX += 6; interPt.iY += 3;
sl@0
   791
			AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, ptrNum);
sl@0
   792
			}
sl@0
   793
		ptrPos.iX += xInc/2;
sl@0
   794
		ptrPos.iY += yInc/2;
sl@0
   795
		interPt = ptrPos; 
sl@0
   796
		}
sl@0
   797
sl@0
   798
	ptrPos.SetXY(0,0);
sl@0
   799
	interPt = ptrPos;
sl@0
   800
	for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
   801
		{
sl@0
   802
		interPt.iX += 6;
sl@0
   803
		interPt.iY += 3;
sl@0
   804
		SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
   805
		AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, ptrNum);
sl@0
   806
		ptrPos.iX += xInc/2;
sl@0
   807
		ptrPos.iY += yInc/2;
sl@0
   808
		interPt = ptrPos; 
sl@0
   809
		}
sl@0
   810
	}
sl@0
   811
sl@0
   812
void CTMultiPtrEventTest::TestGrabbingForMultiPointer(TBool aGrabbing)
sl@0
   813
	{
sl@0
   814
	TPoint ptrPos;
sl@0
   815
	TInt ptrNum;
sl@0
   816
	TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
sl@0
   817
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
sl@0
   818
	
sl@0
   819
	for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
   820
		{
sl@0
   821
		SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   822
		AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
sl@0
   823
		ptrPos.iX += xInc/3;	// Ensure all Button1Down events are on iParentWin
sl@0
   824
		ptrPos.iY += yInc/3;
sl@0
   825
		}
sl@0
   826
	
sl@0
   827
	ptrPos.SetXY(0,0);
sl@0
   828
	ptrPos.iX += iPhysicalScreenSize.iWidth/2;		// Ensure all Drag and Button1Up events are on iChildWin
sl@0
   829
	ptrPos.iY += iPhysicalScreenSize.iHeight/2;
sl@0
   830
	for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
   831
		{
sl@0
   832
		SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   833
		if(aGrabbing)
sl@0
   834
			{
sl@0
   835
			// CalculatePtrPosAndSet3Ddata will subtract iChildWinPos from ptrPos if pointer event occured on child window. Thus we add iChildWinPos here.
sl@0
   836
			AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin());	
sl@0
   837
			}
sl@0
   838
		else
sl@0
   839
			{
sl@0
   840
			AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum);
sl@0
   841
			}
sl@0
   842
		ptrPos.iX += xInc/3;
sl@0
   843
		ptrPos.iY += yInc/3; 
sl@0
   844
		}
sl@0
   845
sl@0
   846
	ptrPos.SetXY(0,0);
sl@0
   847
	ptrPos.iX += iPhysicalScreenSize.iWidth/2;
sl@0
   848
	ptrPos.iY += iPhysicalScreenSize.iHeight/2;
sl@0
   849
	for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
   850
		{
sl@0
   851
		SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   852
		if(aGrabbing)
sl@0
   853
			{
sl@0
   854
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos+iMultiPtrEventClient->ChildWin()->Position(), ptrNum, (TUint)iMultiPtrEventClient->ParentWin());
sl@0
   855
			}
sl@0
   856
		else
sl@0
   857
			{
sl@0
   858
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
sl@0
   859
			}
sl@0
   860
		ptrPos.iX += xInc/3;
sl@0
   861
		ptrPos.iY += yInc/3;
sl@0
   862
		}
sl@0
   863
	}
sl@0
   864
sl@0
   865
void CTMultiPtrEventTest::TestCapturingForMultiPointer(TBool aAllWinGroups)
sl@0
   866
	{
sl@0
   867
	TPoint ptrPos;
sl@0
   868
	TInt ptrNum = 0;
sl@0
   869
	TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
sl@0
   870
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
sl@0
   871
	
sl@0
   872
	// These are some typical values which are used only for testing purposes.
sl@0
   873
	// 20mm to screen
sl@0
   874
	// 50mm to screen
sl@0
   875
	// 4N of pressure
sl@0
   876
	// 2N of pressure
sl@0
   877
	SetThresholdValues(-20,-50,4000,2000);
sl@0
   878
	
sl@0
   879
	iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerMoveEvents, 0);
sl@0
   880
	
sl@0
   881
	if(!aAllWinGroups)
sl@0
   882
		{
sl@0
   883
		for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
   884
			{
sl@0
   885
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -30, ptrNum);
sl@0
   886
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -30, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   887
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum);
sl@0
   888
			AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -10, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   889
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   890
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   891
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum);
sl@0
   892
			AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 5000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   893
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum);
sl@0
   894
			AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   895
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum);
sl@0
   896
			AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 1000, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   897
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   898
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), 0, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   899
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, -60, ptrNum);
sl@0
   900
			AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos-iMultiPtrEventClient->ChildWin()->Position(), -60, 0, ptrNum, (TInt)iMultiPtrEventClient->ChildWin());
sl@0
   901
			ptrPos.iX += xInc/3;	// Ensure all Pointer events are on iParentWin
sl@0
   902
			ptrPos.iY += yInc/3;
sl@0
   903
			}		
sl@0
   904
		}
sl@0
   905
	else
sl@0
   906
		{
sl@0
   907
		ptrPos.iX = iPhysicalScreenSize.iWidth/2 + xInc/3;
sl@0
   908
		ptrPos.iY = 0;
sl@0
   909
		 		
sl@0
   910
		for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
   911
			{
sl@0
   912
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, -10, ptrNum);
sl@0
   913
			AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), -10, 0, ptrNum, (TInt)iWinForCapturing);
sl@0
   914
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   915
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing);		
sl@0
   916
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 5000, ptrNum);
sl@0
   917
			AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 5000, 0, ptrNum, (TInt)iWinForCapturing);			
sl@0
   918
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX-=2, ptrPos.iY-=2, 1000, ptrNum);
sl@0
   919
			AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing);
sl@0
   920
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+=2, ptrPos.iY+=2, 1000, ptrNum);
sl@0
   921
			AddExpectedPointerEvent(TPointerEvent::EDrag, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 1000, 0, ptrNum, (TInt)iWinForCapturing);
sl@0
   922
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
   923
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing);
sl@0
   924
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
   925
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, TPoint(ptrPos.iX+iPhysicalScreenSize.iWidth/2, ptrPos.iY), 0, 0, ptrNum, (TInt)iWinForCapturing);
sl@0
   926
			ptrPos.iX += xInc/3;	
sl@0
   927
			ptrPos.iY += yInc/3;
sl@0
   928
			}
sl@0
   929
		}
sl@0
   930
	}
sl@0
   931
sl@0
   932
void CTMultiPtrEventTest::SetAutoFlush()
sl@0
   933
	{
sl@0
   934
	iTheClientFlush = TheClient->iWs.SetAutoFlush(ETrue);
sl@0
   935
	iClientFlush = iMultiPtrEventClient->iWs.SetAutoFlush(ETrue);
sl@0
   936
	}
sl@0
   937
sl@0
   938
void CTMultiPtrEventTest::ResetFlushStopAS()
sl@0
   939
	{
sl@0
   940
	if (iActiveSchedulerStarted)
sl@0
   941
		{
sl@0
   942
		iActiveSchedulerStarted = EFalse;
sl@0
   943
		CActiveScheduler::Stop();
sl@0
   944
		}
sl@0
   945
	TheClient->iWs.SetAutoFlush(iTheClientFlush);
sl@0
   946
	iMultiPtrEventClient->iWs.SetAutoFlush(iClientFlush);
sl@0
   947
	}
sl@0
   948
sl@0
   949
// Common function for all test cases
sl@0
   950
void CTMultiPtrEventTest::RunTestsL()
sl@0
   951
	{
sl@0
   952
	// Create CTMultiPtrEventClient for each test case and call NextSetOfEventsL()
sl@0
   953
	iMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this);
sl@0
   954
	iMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber);
sl@0
   955
	iMultiPtrEventClient->ConstructL();
sl@0
   956
	
sl@0
   957
	iEventSet=0;
sl@0
   958
sl@0
   959
	// Create secondary client for test case number 3
sl@0
   960
	if (iTest->iState == 3)
sl@0
   961
		{
sl@0
   962
		iSecMultiPtrEventClient = new(ELeave) CTMultiPtrEventClient(this, 1);
sl@0
   963
		iSecMultiPtrEventClient->SetScreenNumber(iTest->iScreenNumber);
sl@0
   964
		iSecMultiPtrEventClient->ConstructL(); 
sl@0
   965
		}
sl@0
   966
	
sl@0
   967
	TRAPD(err, NextSetOfEventsL());
sl@0
   968
	if (err != KErrNone)
sl@0
   969
		{
sl@0
   970
		iFailed = ETrue;
sl@0
   971
		}
sl@0
   972
sl@0
   973
	// Start nested activescheduler if it is not failed for the first attempt
sl@0
   974
	if (!iFailed)
sl@0
   975
		{
sl@0
   976
		iActiveSchedulerStarted = ETrue;
sl@0
   977
		CActiveScheduler::Start();
sl@0
   978
		}
sl@0
   979
sl@0
   980
	//
sl@0
   981
	TInt eventsRem = iMultiPtrEventClient->EventBuffer()->EventsRemaining();
sl@0
   982
	if (eventsRem > 0)
sl@0
   983
		{
sl@0
   984
		iFailed=ETrue;
sl@0
   985
		}
sl@0
   986
sl@0
   987
	// Delete secondary client for test case number 3
sl@0
   988
	if (iTest->iState == 3)
sl@0
   989
		{
sl@0
   990
		delete iSecMultiPtrEventClient;
sl@0
   991
		iSecMultiPtrEventClient = NULL;
sl@0
   992
		}
sl@0
   993
	
sl@0
   994
	delete iMultiPtrEventClient;
sl@0
   995
	iMultiPtrEventClient = NULL;
sl@0
   996
	}
sl@0
   997
sl@0
   998
// Common function for all tests
sl@0
   999
// Important point to remember is that this function should not leave when running tests
sl@0
  1000
void CTMultiPtrEventTest::NextSetOfEventsL()
sl@0
  1001
	{
sl@0
  1002
	// For each test case calls its respective tests
sl@0
  1003
		
sl@0
  1004
	((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
sl@0
  1005
	switch (iTest->iState)
sl@0
  1006
		{
sl@0
  1007
	case 0:
sl@0
  1008
/**
sl@0
  1009
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0036
sl@0
  1010
*/
sl@0
  1011
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0036"));
sl@0
  1012
		MultiPointerEvents();
sl@0
  1013
		break;
sl@0
  1014
	case 1:
sl@0
  1015
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0014"));
sl@0
  1016
		PurgingMultiPointerEvents();
sl@0
  1017
		break;
sl@0
  1018
	case 2:
sl@0
  1019
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0013"));
sl@0
  1020
		MultiPointerEventsForAnimsL();
sl@0
  1021
		break;
sl@0
  1022
	case 3:
sl@0
  1023
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0011"));
sl@0
  1024
		GetRemainingEventsFromSecondaryClient();	// Does nothing for first time
sl@0
  1025
		MultiClientMultiPointerEvents();
sl@0
  1026
		break;
sl@0
  1027
	case 4:
sl@0
  1028
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0027"));
sl@0
  1029
		MultiPointerEventsForPointerClickL();
sl@0
  1030
		break;
sl@0
  1031
	case 5:
sl@0
  1032
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0028"));
sl@0
  1033
		MultiPointerEventsInDiffScreenModes();
sl@0
  1034
		break;
sl@0
  1035
	case 6:
sl@0
  1036
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0025"));
sl@0
  1037
		FilteringMultiPointerEvents();
sl@0
  1038
		break;
sl@0
  1039
	case 7:
sl@0
  1040
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0021"));
sl@0
  1041
		GrabbingMultiPointerEvents();
sl@0
  1042
		break;
sl@0
  1043
	case 8:
sl@0
  1044
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0031"));
sl@0
  1045
		VirtualKeyBoardForMultiplePointers();
sl@0
  1046
		break;
sl@0
  1047
	case 9:
sl@0
  1048
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0032"));
sl@0
  1049
		DoubleClickForMultiplePointers();
sl@0
  1050
		break;
sl@0
  1051
	case 10:
sl@0
  1052
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0015"));
sl@0
  1053
		MultiPointerOutOfRangeEvents();
sl@0
  1054
		break;
sl@0
  1055
	case 11:
sl@0
  1056
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0026"));
sl@0
  1057
		AutoForeGroundForMultiplePointersL();
sl@0
  1058
		break;
sl@0
  1059
	case 12:
sl@0
  1060
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0029"));
sl@0
  1061
		EmulationRulesForMultiplePointers();
sl@0
  1062
		break;
sl@0
  1063
	case 13:
sl@0
  1064
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034"));
sl@0
  1065
		CloseProximityAndHighPressureEventsL();
sl@0
  1066
		break;
sl@0
  1067
	case 14:
sl@0
  1068
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0017"));
sl@0
  1069
		OutOfBoundValueTesting();
sl@0
  1070
		break;	
sl@0
  1071
	case 15:
sl@0
  1072
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0019"));
sl@0
  1073
		CapturingMultiPointerEvents();
sl@0
  1074
		break;
sl@0
  1075
	case 16:
sl@0
  1076
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0035"));
sl@0
  1077
		NegativeTestsForProximityPressureEventsL();
sl@0
  1078
		break;
sl@0
  1079
	case 17:
sl@0
  1080
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-ADVANCEDPOINTER-0034"));
sl@0
  1081
		PointerRepeatEventForMultiplePointers();
sl@0
  1082
		break;
sl@0
  1083
	// Any new test case should be added here.
sl@0
  1084
	// because some of the above tests use testcase number for certain checks
sl@0
  1085
	default:
sl@0
  1086
		((CTMultiPtrEventTestStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
  1087
		AutoPanic(EAutoPanicWrongTest);
sl@0
  1088
		}
sl@0
  1089
	((CTMultiPtrEventTestStep*)iStep)->RecordTestResultL();
sl@0
  1090
	}
sl@0
  1091
sl@0
  1092
/**
sl@0
  1093
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0033
sl@0
  1094
@SYMPREQ				PREQ1226
sl@0
  1095
@SYMREQ					REQ9677
sl@0
  1096
@SYMTestPriority		High
sl@0
  1097
@SYMTestCaseDesc		To check Wserv sends Pointer Repeat Events for all pointers. 
sl@0
  1098
@SYMTestStatus			Implemented
sl@0
  1099
sl@0
  1100
@SYMTestActions			Simulate events being passed to the client by implementing each discrete test 
sl@0
  1101
						over 4 seperate test cases. 
sl@0
  1102
						In the first test case simulate EButton1Down and add event to a TWsEvent buffer. 
sl@0
  1103
						In the second test case call RequestPointerRepeatEvent on the base window passing 
sl@0
  1104
						in a time interval,	a rectangle (the 'hitbox') and pointer number. 
sl@0
  1105
						Add EButtonRepeat to TWsEvent buffer.  
sl@0
  1106
						In the third test case simulate EPointerMove event within the hitbox, then simulate 
sl@0
  1107
						an elapsed period of time longer that specified interval. Add only a EButtonRepeat
sl@0
  1108
						to TWsEvent buffer.
sl@0
  1109
						In the final test case simulate EButton1Up and add event to TWsEvent buffer.
sl@0
  1110
						
sl@0
  1111
						Repeat steps for the second discrete test, however, in the third test case simulate 
sl@0
  1112
						EPointerMove event outside the hitbox. In addition add EDrag to TWsEvent buffer 
sl@0
  1113
						instead of EButtonRepeat. 
sl@0
  1114
						
sl@0
  1115
						A third discrete test will be executed over two test cases and will test
sl@0
  1116
						CancelPointerRepeatEventRequest API.
sl@0
  1117
						
sl@0
  1118
@SYMTestExpectedResults The received events must match the events added to the buffer except where EPointerMove
sl@0
  1119
 						events should be filtered out. In addition, EButtonRepeat will be generated by wserv
sl@0
  1120
 						after calling RequestPointerRepeatEvent and time interval specified has elapsed.
sl@0
  1121
						
sl@0
  1122
*/
sl@0
  1123
void CTMultiPtrEventTest::PointerRepeatEventForMultiplePointers()
sl@0
  1124
	{
sl@0
  1125
	// Test PointerRepeatEvent for Multiple Pointers 
sl@0
  1126
	TLogMessageText logText;
sl@0
  1127
	_LIT(KSet, "PointerRepeatEventForMultiplePointers SetOfEvents: %d of 10");
sl@0
  1128
	logText.AppendFormat(KSet, iEventSet);
sl@0
  1129
	LOG_MESSAGE(logText);
sl@0
  1130
	
sl@0
  1131
	if (!iEventSet)
sl@0
  1132
		{
sl@0
  1133
		SetAutoFlush();
sl@0
  1134
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  1135
		}
sl@0
  1136
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  1137
	
sl@0
  1138
	TPoint ptrPos;
sl@0
  1139
	TInt ptrNum;
sl@0
  1140
	// Ensure all pointers are on iParentWin
sl@0
  1141
	TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers/3;
sl@0
  1142
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers/3;
sl@0
  1143
		
sl@0
  1144
	switch(iEventSet++)
sl@0
  1145
		{
sl@0
  1146
		// Test cases 0 - 3 represent first discrete test for PointerRepeatEvents
sl@0
  1147
		case 0:
sl@0
  1148
			// Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. 
sl@0
  1149
			// If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
sl@0
  1150
			INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers."));
sl@0
  1151
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1152
				{
sl@0
  1153
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);			
sl@0
  1154
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
sl@0
  1155
				ptrPos.iX+=xInc;
sl@0
  1156
				ptrPos.iY+=yInc;
sl@0
  1157
				}	
sl@0
  1158
			break;
sl@0
  1159
		case 1:
sl@0
  1160
			// Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'.
sl@0
  1161
			INFO_PRINTF1(_L("Simulate PointerRepeatEvent request for all pointers."));
sl@0
  1162
			ptrPos.SetXY(0,0);
sl@0
  1163
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1164
				{
sl@0
  1165
				iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum);				
sl@0
  1166
				User::After(200000);	
sl@0
  1167
				AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum);			
sl@0
  1168
				ptrPos.iX+=xInc;
sl@0
  1169
				ptrPos.iY+=yInc;
sl@0
  1170
				}
sl@0
  1171
			break;
sl@0
  1172
		case 2:
sl@0
  1173
			// Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and pointer remaining within the 'hitbox'.
sl@0
  1174
			INFO_PRINTF1(_L("Simulate additional PointerRepeatEvent request for all pointers."));
sl@0
  1175
			// New coordinates will be used for a simulated EPointerMove. This event will be filtered out, however, EButtonRepeat will occur at new coordinates
sl@0
  1176
			ptrPos.iX = xInc;
sl@0
  1177
			ptrPos.iY = yInc;
sl@0
  1178
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1179
				{
sl@0
  1180
				iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/2,iPhysicalScreenSize.iHeight)),ptrNum);				
sl@0
  1181
				// EPointerMove event is filtered out by TWsPointer::PointerRepeatPurgeCheck
sl@0
  1182
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  1183
				User::After(200000);
sl@0
  1184
				AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum);
sl@0
  1185
				ptrPos.iX+=xInc;
sl@0
  1186
				ptrPos.iY+=yInc;
sl@0
  1187
				}
sl@0
  1188
			break;		
sl@0
  1189
		case 3:
sl@0
  1190
			INFO_PRINTF1(_L("Simulate EButton1Up for all pointers."));
sl@0
  1191
			ptrPos.iX = xInc;
sl@0
  1192
			ptrPos.iY = yInc;
sl@0
  1193
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1194
				{
sl@0
  1195
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  1196
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
sl@0
  1197
				ptrPos.iX+=xInc;
sl@0
  1198
				ptrPos.iY+=yInc;
sl@0
  1199
				}
sl@0
  1200
			break; 			
sl@0
  1201
		// Test cases 4 - 7 represent second second discrete test for PointerRepeatEvents	
sl@0
  1202
		case 4:
sl@0
  1203
			// Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. 
sl@0
  1204
			// If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
sl@0
  1205
			INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); 
sl@0
  1206
			ptrPos.SetXY(0,0);
sl@0
  1207
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1208
				{
sl@0
  1209
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);			
sl@0
  1210
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
sl@0
  1211
				ptrPos.iX+=xInc;
sl@0
  1212
				ptrPos.iY+=yInc;
sl@0
  1213
				}	
sl@0
  1214
			break;
sl@0
  1215
		case 5:
sl@0
  1216
			// Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'.
sl@0
  1217
			INFO_PRINTF1(_L("Call RequestPointerRepeatEvent for all pointers."));
sl@0
  1218
			ptrPos.SetXY(0,0);
sl@0
  1219
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1220
				{
sl@0
  1221
				iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); // hitbox size reduced 				
sl@0
  1222
				User::After(200000);	
sl@0
  1223
				AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, ptrNum);			
sl@0
  1224
				ptrPos.iX+=xInc;
sl@0
  1225
				ptrPos.iY+=yInc;
sl@0
  1226
				}
sl@0
  1227
			break;
sl@0
  1228
		case 6:
sl@0
  1229
			// Simulate client calling RequestPointerRepeatEvent in response to EButtonRepeat and event remaining within the 'hitbox' rect.
sl@0
  1230
			// EPointerMove will take pointer out of the hitbox so should not be filtered. PointerRepeatEvent should be cancelled.
sl@0
  1231
			INFO_PRINTF1(_L("Simulate a PointerMove event for all pointers to a coordinate outside the hitbox."));
sl@0
  1232
			// New coordinates will be used for a simulated EPointerMove outisde the hitbox. 
sl@0
  1233
			ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc;
sl@0
  1234
			ptrPos.iY = 0;
sl@0
  1235
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1236
				{
sl@0
  1237
				iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum);				
sl@0
  1238
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  1239
				User::After(200000);
sl@0
  1240
				AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum);
sl@0
  1241
				}
sl@0
  1242
			break;		
sl@0
  1243
		case 7:
sl@0
  1244
			INFO_PRINTF1(_L("Simulate EButton1Up for all pointers."));
sl@0
  1245
			ptrNum = 0;
sl@0
  1246
			ptrPos.iX = iPhysicalScreenSize.iWidth/3 + xInc;
sl@0
  1247
			ptrPos.iY = 0;
sl@0
  1248
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1249
				{
sl@0
  1250
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  1251
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
sl@0
  1252
				}
sl@0
  1253
			break;
sl@0
  1254
		// Test cases 8 and 9 represent third discrete test for PointerRepeatEvents
sl@0
  1255
		case 8:
sl@0
  1256
			// Simulate EButton1Down events only. This is in order to simulate the event being passed to the client. 
sl@0
  1257
			// If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
sl@0
  1258
			INFO_PRINTF1(_L("Simulate EButton1Down event for all pointers.")); 
sl@0
  1259
			ptrPos.SetXY(0,0);
sl@0
  1260
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1261
				{
sl@0
  1262
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);			
sl@0
  1263
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
sl@0
  1264
				ptrPos.iX+=xInc;
sl@0
  1265
				ptrPos.iY+=yInc;
sl@0
  1266
				}	
sl@0
  1267
			break;	
sl@0
  1268
		case 9:
sl@0
  1269
			// No simulated events. This test case is to explicity call RWindowBase::CancelPointerRepeatEventRequest(const TUint8 aPointerNumber)
sl@0
  1270
			INFO_PRINTF1(_L("Call RequestPointerRepeatEvent and CancelPointerRepeatEventRequest for all pointers."));
sl@0
  1271
			ptrPos.SetXY(0,0);
sl@0
  1272
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1273
				{
sl@0
  1274
				iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(iPhysicalScreenSize.iWidth/3,iPhysicalScreenSize.iHeight)),ptrNum); 				
sl@0
  1275
				iMultiPtrEventClient->ParentWin()->BaseWin()->CancelPointerRepeatEventRequest(ptrNum); 
sl@0
  1276
				ptrPos.iX+=xInc;
sl@0
  1277
				ptrPos.iY+=yInc;
sl@0
  1278
				}
sl@0
  1279
			INFO_PRINTF1(_L("Simulate EButton1Up for all pointers."));
sl@0
  1280
			ptrPos.iX = xInc;
sl@0
  1281
			ptrPos.iY = yInc;
sl@0
  1282
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1283
				{
sl@0
  1284
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  1285
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
sl@0
  1286
				ptrPos.iX+=xInc;
sl@0
  1287
				ptrPos.iY+=yInc;
sl@0
  1288
				}
sl@0
  1289
			break;	
sl@0
  1290
		default:
sl@0
  1291
			ResetFlushStopAS();
sl@0
  1292
			break;
sl@0
  1293
		}
sl@0
  1294
	LogEventsAdded();
sl@0
  1295
	}
sl@0
  1296
sl@0
  1297
void CTMultiPtrEventTest::TestErrorCodeL(TInt aExpErrCode, TInt aActualErrCode)
sl@0
  1298
	{
sl@0
  1299
	if (aExpErrCode != aActualErrCode)
sl@0
  1300
		{
sl@0
  1301
		TLogMessageText logText;
sl@0
  1302
		_LIT(KError, "Expected Error code = %d Actual Actual Error code %d");
sl@0
  1303
		logText.AppendFormat(KError, aExpErrCode, aActualErrCode);
sl@0
  1304
		LOG_MESSAGE(logText);
sl@0
  1305
		User::Leave(ETestFailed);
sl@0
  1306
		}
sl@0
  1307
	}
sl@0
  1308
sl@0
  1309
void CTMultiPtrEventTest::NegativeTestingOfProximityPressureAPIsL()
sl@0
  1310
	{
sl@0
  1311
	// First send -10 for EnterCloseProximity and -5 for ExitCLoseProximity, it should return KErrArgument
sl@0
  1312
	// Then send 20 and 10 which should return KErrNone
sl@0
  1313
	// Then sent 10 and 20 which should return KErrArgument
sl@0
  1314
	TInt retVal;
sl@0
  1315
	retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-10, -5);
sl@0
  1316
	TestErrorCodeL(KErrArgument, retVal);
sl@0
  1317
	
sl@0
  1318
	retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(20, 10);
sl@0
  1319
	TestErrorCodeL(KErrNone, retVal);
sl@0
  1320
	
sl@0
  1321
	retVal = iMultiPtrEventClient->iWs.SetCloseProximityThresholds(10, 20);
sl@0
  1322
	TestErrorCodeL(KErrArgument, retVal);
sl@0
  1323
	
sl@0
  1324
	// Repeat the above for EnterHighPressure and ExitHighPressure with these values
sl@0
  1325
	// -10 and -5 it should return KErrArgument
sl@0
  1326
	// -5 and -10 it should return KErrNone
sl@0
  1327
	retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-10, -5);
sl@0
  1328
	TestErrorCodeL(KErrArgument, retVal);
sl@0
  1329
	
sl@0
  1330
	retVal = iMultiPtrEventClient->iWs.SetHighPressureThresholds(-5, -10);
sl@0
  1331
	TestErrorCodeL(KErrNone, retVal);
sl@0
  1332
	}
sl@0
  1333
sl@0
  1334
void CTMultiPtrEventTest::SimulateProximityAndPressureEvents(TInt aCloseProxEnterValue, TInt aCloseProxExitValue, TInt aHighPresEnterValue, TInt aHighPresExitValue)
sl@0
  1335
	{
sl@0
  1336
	TPoint ptrPos(10,10);
sl@0
  1337
	// Simulate EPointerMove with proximity value > EnterCloseProximity threshold 
sl@0
  1338
	for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1339
		{
sl@0
  1340
		SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxEnterValue, ptrNum);
sl@0
  1341
		AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, aCloseProxEnterValue, 0, ptrNum);
sl@0
  1342
		}
sl@0
  1343
	
sl@0
  1344
	// Simulate EPointerMove with proximity value < ExitCloseProximity threshold
sl@0
  1345
	for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1346
		{
sl@0
  1347
		SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum);
sl@0
  1348
		AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum);
sl@0
  1349
		}
sl@0
  1350
	
sl@0
  1351
	// Simulate EBUtton1Down with presure value > EnterHighPressure threshold
sl@0
  1352
	for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1353
		{
sl@0
  1354
		SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, aHighPresEnterValue, ptrNum);
sl@0
  1355
		AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, aHighPresEnterValue, 0, ptrNum);
sl@0
  1356
		AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, aHighPresEnterValue, 0, ptrNum);
sl@0
  1357
		}
sl@0
  1358
	
sl@0
  1359
	// Simulate EPointerMove with presure value < ExitHighPressure threshold
sl@0
  1360
	for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1361
		{
sl@0
  1362
		SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, aHighPresExitValue, ptrNum);
sl@0
  1363
		AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, aHighPresExitValue, 0, ptrNum);
sl@0
  1364
		}
sl@0
  1365
	
sl@0
  1366
	// Finally simulate Ebutton1Up with proximity value < ExitCloseProximity
sl@0
  1367
	for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1368
		{
sl@0
  1369
		SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, aCloseProxExitValue, ptrNum);
sl@0
  1370
		AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, aCloseProxExitValue, 0, ptrNum);
sl@0
  1371
		AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, aCloseProxExitValue, 0, ptrNum);
sl@0
  1372
		}
sl@0
  1373
	}
sl@0
  1374
sl@0
  1375
/**
sl@0
  1376
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0035
sl@0
  1377
@SYMPREQ				PREQ1226
sl@0
  1378
@SYMREQ					REQ10887, REQ10886
sl@0
  1379
@SYMTestPriority		High
sl@0
  1380
@SYMTestCaseDesc		Negative tests for close Proximity and high Pressure events. 
sl@0
  1381
@SYMTestStatus			Implemented
sl@0
  1382
sl@0
  1383
@SYMTestActions			Set CloseProximity and HighPressure thresholds with positive and negative values.
sl@0
  1384
  						Simulate Enter/ExitCloseProximity and Enter/ExitHighPressure events.
sl@0
  1385
@SYMTestExpectedResults The received events must match the simulated pointer events
sl@0
  1386
*/
sl@0
  1387
void CTMultiPtrEventTest::NegativeTestsForProximityPressureEventsL()
sl@0
  1388
	{
sl@0
  1389
	TLogMessageText logText;
sl@0
  1390
	_LIT(KSet, "Negative tests for pressure and proximity events: %d of 3");
sl@0
  1391
	logText.AppendFormat(KSet, iEventSet);
sl@0
  1392
	LOG_MESSAGE(logText);
sl@0
  1393
	
sl@0
  1394
	if (!iEventSet)
sl@0
  1395
		{
sl@0
  1396
		SetAutoFlush();
sl@0
  1397
		NegativeTestingOfProximityPressureAPIsL();
sl@0
  1398
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  1399
		}
sl@0
  1400
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  1401
	switch(iEventSet++)
sl@0
  1402
		{
sl@0
  1403
		case 0:
sl@0
  1404
			// This is to check close proximity threshold API can be given +ve values
sl@0
  1405
			// and high pressure threshold API can begiven -ve values
sl@0
  1406
			iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20);
sl@0
  1407
			iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50);
sl@0
  1408
			SimulateProximityAndPressureEvents(60, 10, -10, -60);
sl@0
  1409
			break;
sl@0
  1410
		case 1:
sl@0
  1411
			// Repeat the above with +ve values
sl@0
  1412
			iMultiPtrEventClient->iWs.SetCloseProximityThresholds(50, 20);
sl@0
  1413
			iMultiPtrEventClient->iWs.SetHighPressureThresholds(50, 20);
sl@0
  1414
			SimulateProximityAndPressureEvents(60, 10, 60, 10);
sl@0
  1415
			break;
sl@0
  1416
		case 2:
sl@0
  1417
			// Repeat the above -ve values
sl@0
  1418
			iMultiPtrEventClient->iWs.SetCloseProximityThresholds(-20, -50);
sl@0
  1419
			iMultiPtrEventClient->iWs.SetHighPressureThresholds(-20, -50);
sl@0
  1420
			SimulateProximityAndPressureEvents(-10, -60, -10, -60);
sl@0
  1421
			break;
sl@0
  1422
		default:
sl@0
  1423
			SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt);
sl@0
  1424
			ResetFlushStopAS();
sl@0
  1425
			break;
sl@0
  1426
		}
sl@0
  1427
sl@0
  1428
	LogEventsAdded();
sl@0
  1429
	}
sl@0
  1430
sl@0
  1431
sl@0
  1432
void CTMultiPtrEventTest::CreateGroupWinForCapturingL()
sl@0
  1433
	{
sl@0
  1434
	iGroupWinForCapturing = new(ELeave) CTWindowGroup(iMultiPtrEventClient);
sl@0
  1435
	iGroupWinForCapturing->ConstructL();
sl@0
  1436
	iGroupWinForCapturing->GroupWin()->AutoForeground(ETrue);
sl@0
  1437
	iGroupWinForCapturing->GroupWin()->EnableFocusChangeEvents();
sl@0
  1438
				
sl@0
  1439
	iWinForCapturing = new(ELeave) CTBlankWindow();
sl@0
  1440
	iWinForCapturing->ConstructL(*iGroupWinForCapturing);
sl@0
  1441
	iWinForCapturing->SetExt(TPoint(), TSize(iPhysicalScreenSize.iWidth/2, iPhysicalScreenSize.iHeight));
sl@0
  1442
	iWinForCapturing->SetColor(KRgbBlue);
sl@0
  1443
	iWinForCapturing->BaseWin()->EnableAdvancedPointers();
sl@0
  1444
	iWinForCapturing->Activate();
sl@0
  1445
	}
sl@0
  1446
sl@0
  1447
void CTMultiPtrEventTest::DeleteGroupWinForCapturing()
sl@0
  1448
	{
sl@0
  1449
	if (iWinForCapturing)
sl@0
  1450
		{
sl@0
  1451
		delete iWinForCapturing;
sl@0
  1452
		iWinForCapturing = NULL;
sl@0
  1453
		}
sl@0
  1454
	if (iGroupWinForCapturing)
sl@0
  1455
		{
sl@0
  1456
		delete iGroupWinForCapturing;
sl@0
  1457
		iGroupWinForCapturing = NULL;
sl@0
  1458
		}
sl@0
  1459
	}
sl@0
  1460
sl@0
  1461
/**
sl@0
  1462
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0019
sl@0
  1463
@SYMPREQ				PREQ1226
sl@0
  1464
@SYMREQ					REQ9677,REQ9683,
sl@0
  1465
@SYMTestPriority		High
sl@0
  1466
@SYMTestCaseDesc		Checks Wserv supports Capturing in case of multi pointer events.
sl@0
  1467
@SYMTestStatus			Implemented
sl@0
  1468
sl@0
  1469
@SYMTestActions			Create a window with group window as its parent. 
sl@0
  1470
						Create another window with same parent and partially overlapping the first one. 
sl@0
  1471
						SetPointerCapture for second window with TCaptureEnabled flag. 
sl@0
  1472
						Simulate TRawEvent::EButton1Down from each pointer the device supports
sl@0
  1473
						
sl@0
  1474
						Repeat the above with TCaptureFlagAllGroups flag for SetPointerCapture 
sl@0
  1475
						and creating windows from different window group
sl@0
  1476
   						
sl@0
  1477
@SYMTestExpectedResults Even if events were simulated on first window events are delivered to 
sl@0
  1478
						second window as it is capturing. 
sl@0
  1479
						With TCaptureFlagAllGroups flag set	events are delivered to window which is
sl@0
  1480
						capturing even if events were simulated on a window from different group
sl@0
  1481
						
sl@0
  1482
*/
sl@0
  1483
void CTMultiPtrEventTest::CapturingMultiPointerEvents()
sl@0
  1484
	{
sl@0
  1485
	// Test Capturing of multi pointer events
sl@0
  1486
	// 1. Test Wserv supports Capturing in case of multi-pointer events
sl@0
  1487
	// 2. Test pointer events are delivered correctly when Capturing is disabled.
sl@0
  1488
	TLogMessageText logText;
sl@0
  1489
	_LIT(KSet, "CapturingMultiPtrEvents SetOfEvents: %d of 3");
sl@0
  1490
	logText.AppendFormat(KSet, iEventSet);
sl@0
  1491
	LOG_MESSAGE(logText);
sl@0
  1492
	
sl@0
  1493
	if (!iEventSet)
sl@0
  1494
		{
sl@0
  1495
		SetAutoFlush();
sl@0
  1496
		}
sl@0
  1497
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  1498
sl@0
  1499
	TPoint ptrPos;
sl@0
  1500
	TInt ptrNum;
sl@0
  1501
		
sl@0
  1502
	switch(iEventSet++)
sl@0
  1503
		{
sl@0
  1504
		case 0:
sl@0
  1505
			INFO_PRINTF1(_L("Ensure pointer state is Out of Range"));
sl@0
  1506
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  1507
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1508
				{
sl@0
  1509
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  1510
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
sl@0
  1511
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1512
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, ptrNum);
sl@0
  1513
				}
sl@0
  1514
			break;			
sl@0
  1515
		case 1:
sl@0
  1516
			INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, within window group"));
sl@0
  1517
			iMultiPtrEventClient->ChildWin()->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled);
sl@0
  1518
			TestCapturingForMultiPointer(EFalse);
sl@0
  1519
			break;	
sl@0
  1520
		case 2:
sl@0
  1521
			INFO_PRINTF1(_L("Check Wserv supports Capturing in case of multi-pointer events, from different window groups"));
sl@0
  1522
			TRAPD(err, CreateGroupWinForCapturingL());	// it cannot leave so trap and fail
sl@0
  1523
			if (err != KErrNone)
sl@0
  1524
				{
sl@0
  1525
				Failed();
sl@0
  1526
				}			
sl@0
  1527
			AddExpectedWsEvent(EEventFocusLost);		// First group window losing focus because of second group creation
sl@0
  1528
			AddExpectedWsEvent(EEventFocusGained);		// Second group window creation
sl@0
  1529
			
sl@0
  1530
			iWinForCapturing->BaseWin()->SetPointerCapture(RWindowBase::TCaptureEnabled|RWindowBase::TCaptureFlagAllGroups);
sl@0
  1531
			TestCapturingForMultiPointer(ETrue);
sl@0
  1532
			break;
sl@0
  1533
		default:
sl@0
  1534
			DeleteGroupWinForCapturing();
sl@0
  1535
			ResetFlushStopAS();
sl@0
  1536
			break;
sl@0
  1537
		}
sl@0
  1538
	LogEventsAdded();
sl@0
  1539
	}
sl@0
  1540
sl@0
  1541
/**
sl@0
  1542
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0017
sl@0
  1543
@SYMPREQ				PREQ1226
sl@0
  1544
@SYMREQ					Negative Testing
sl@0
  1545
@SYMTestPriority		High
sl@0
  1546
@SYMTestCaseDesc		Out of bound value testing
sl@0
  1547
@SYMTestStatus			Implemented
sl@0
  1548
sl@0
  1549
@SYMTestActions			Simulate raw events of TRawEvent with pointer number greater than EPointerMaxPointers
sl@0
  1550
						 						
sl@0
  1551
@SYMTestExpectedResults The received events must match the events added to the buffer and check that out of bound events are ignored.
sl@0
  1552
 
sl@0
  1553
*/
sl@0
  1554
void CTMultiPtrEventTest::OutOfBoundValueTesting()
sl@0
  1555
	{
sl@0
  1556
	// Test Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers. 	 
sl@0
  1557
	TLogMessageText logText;
sl@0
  1558
	_LIT(KSet, "OutOfBoundValueTesting SetOfEvents: %d of 1");
sl@0
  1559
	logText.AppendFormat(KSet, iEventSet);
sl@0
  1560
	LOG_MESSAGE(logText);
sl@0
  1561
	
sl@0
  1562
	if (!iEventSet)
sl@0
  1563
		{
sl@0
  1564
		SetAutoFlush();
sl@0
  1565
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  1566
		}
sl@0
  1567
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  1568
sl@0
  1569
	TPoint ptrPos;
sl@0
  1570
	TInt ptrNum;
sl@0
  1571
	TInt ptrNumOutOfBounds;
sl@0
  1572
			
sl@0
  1573
	switch(iEventSet++)
sl@0
  1574
		{
sl@0
  1575
		case 0:
sl@0
  1576
			INFO_PRINTF1(_L("Checks Wserv ignores pointer events which have a pointer number greater than EPointerMaxPointers."));
sl@0
  1577
			ptrPos.SetXY(0,0);
sl@0
  1578
			ptrNum = iMaxDevPointers-1;				// Max value for ptrNum
sl@0
  1579
			ptrNumOutOfBounds = iMaxDevPointers;	// Invalid ptrNum as pointer numbers are zero indexed
sl@0
  1580
			
sl@0
  1581
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  1582
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNumOutOfBounds);
sl@0
  1583
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum);
sl@0
  1584
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds);
sl@0
  1585
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNum);
sl@0
  1586
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX+10, ptrPos.iY+10, 0, ptrNumOutOfBounds);
sl@0
  1587
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, ptrNum);
sl@0
  1588
			ptrPos.iX += 10; ptrPos.iY += 10;
sl@0
  1589
			AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, ptrNum);
sl@0
  1590
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, ptrNum);
sl@0
  1591
			break;	 
sl@0
  1592
		default:
sl@0
  1593
			ResetFlushStopAS();
sl@0
  1594
			break;
sl@0
  1595
		}
sl@0
  1596
	LogEventsAdded();
sl@0
  1597
	}
sl@0
  1598
sl@0
  1599
void CTMultiPtrEventTest::SetThresholdValues(TInt aEnterCloseProx, TInt aExitCloseProx, TInt aEnterHighPres, TInt aExitHighPres)
sl@0
  1600
	{
sl@0
  1601
	iEnterCloseProximityThreshold = aEnterCloseProx;
sl@0
  1602
	iExitCloseProximityThreshold = aExitCloseProx;
sl@0
  1603
	iEnterHighPressureThreshold = aEnterHighPres;
sl@0
  1604
	iExitHighPressureThreshold  = aExitHighPres;
sl@0
  1605
	
sl@0
  1606
	iMultiPtrEventClient->iWs.SetCloseProximityThresholds(iEnterCloseProximityThreshold,iExitCloseProximityThreshold);
sl@0
  1607
	iMultiPtrEventClient->iWs.SetHighPressureThresholds(iEnterHighPressureThreshold,iExitHighPressureThreshold);
sl@0
  1608
	}
sl@0
  1609
sl@0
  1610
void CTMultiPtrEventTest::TestCloseProximityHighPressureAPIsL()
sl@0
  1611
	{
sl@0
  1612
	// These are some typical values which are used only for testing purposes.
sl@0
  1613
	// 20mm to screen
sl@0
  1614
	// 50mm to screen
sl@0
  1615
	// 4N of pressure
sl@0
  1616
	// 2N of pressure
sl@0
  1617
	SetThresholdValues(-20,-50,4000,2000);
sl@0
  1618
	
sl@0
  1619
	if (iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold() != iEnterCloseProximityThreshold)
sl@0
  1620
		{
sl@0
  1621
		TLogMessageText logText;
sl@0
  1622
		_LIT(KError, "Expected EnterCloseProximityThreshold = %d Actual EnterCloseProximityThreshold %d");
sl@0
  1623
		logText.AppendFormat(KError, iEnterCloseProximityThreshold, iMultiPtrEventClient->iWs.GetEnterCloseProximityThreshold());
sl@0
  1624
		LOG_MESSAGE(logText);
sl@0
  1625
		User::Leave(ETestFailed);
sl@0
  1626
		}
sl@0
  1627
	
sl@0
  1628
	if (iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold() != iExitCloseProximityThreshold)
sl@0
  1629
		{
sl@0
  1630
		TLogMessageText logText;
sl@0
  1631
		_LIT(KError, "Expected ExitCloseProximityThreshold = %d Actual ExitCloseProximityThreshold %d");
sl@0
  1632
		logText.AppendFormat(KError, iExitCloseProximityThreshold, iMultiPtrEventClient->iWs.GetExitCloseProximityThreshold());
sl@0
  1633
		LOG_MESSAGE(logText);		
sl@0
  1634
		User::Leave(ETestFailed);
sl@0
  1635
		}
sl@0
  1636
	
sl@0
  1637
	if (iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold() != iEnterHighPressureThreshold)
sl@0
  1638
		{
sl@0
  1639
		TLogMessageText logText;
sl@0
  1640
		_LIT(KError, "Expected EnterHighPressureThreshold = %d Actual EnterHighPressureThreshold %d");
sl@0
  1641
		logText.AppendFormat(KError, iEnterHighPressureThreshold, iMultiPtrEventClient->iWs.GetEnterHighPressureThreshold());
sl@0
  1642
		LOG_MESSAGE(logText);
sl@0
  1643
		User::Leave(ETestFailed);
sl@0
  1644
		}
sl@0
  1645
	
sl@0
  1646
	if (iMultiPtrEventClient->iWs.GetExitHighPressureThreshold() != iExitHighPressureThreshold)
sl@0
  1647
		{
sl@0
  1648
		TLogMessageText logText;
sl@0
  1649
		_LIT(KError, "Expected ExitHighPressureThreshold = %d Actual ExitHighPressureThreshold %d");
sl@0
  1650
		logText.AppendFormat(KError, iExitHighPressureThreshold, iMultiPtrEventClient->iWs.GetExitHighPressureThreshold());
sl@0
  1651
		LOG_MESSAGE(logText);
sl@0
  1652
		User::Leave(ETestFailed);
sl@0
  1653
		}
sl@0
  1654
	}
sl@0
  1655
sl@0
  1656
/**
sl@0
  1657
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0034
sl@0
  1658
@SYMPREQ				PREQ1226
sl@0
  1659
@SYMREQ					REQ10887,REQ10886
sl@0
  1660
@SYMTestPriority		High
sl@0
  1661
@SYMTestCaseDesc		Tests close Proximity and high Pressure event types. 
sl@0
  1662
@SYMTestStatus			Implemented
sl@0
  1663
sl@0
  1664
@SYMTestActions			Set CloseProximity and HighPressure thresholds and simulate events with different Z values  
sl@0
  1665
@SYMTestExpectedResults The received events must match the simulated pointer events
sl@0
  1666
*/
sl@0
  1667
void CTMultiPtrEventTest::CloseProximityAndHighPressureEventsL()
sl@0
  1668
	{
sl@0
  1669
	TLogMessageText logText;
sl@0
  1670
	_LIT(KSet, "Close Proximity and High Pressure events: %d of 11");
sl@0
  1671
	logText.AppendFormat(KSet, iEventSet);
sl@0
  1672
	LOG_MESSAGE(logText);
sl@0
  1673
	
sl@0
  1674
	if (!iEventSet)
sl@0
  1675
		{
sl@0
  1676
		SetAutoFlush();
sl@0
  1677
		TestCloseProximityHighPressureAPIsL();
sl@0
  1678
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  1679
		}
sl@0
  1680
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  1681
sl@0
  1682
	TPoint ptrPos(10,10);
sl@0
  1683
	TInt proxValue;
sl@0
  1684
	TInt prValue;
sl@0
  1685
	TInt tempCount; 
sl@0
  1686
	switch(iEventSet++)
sl@0
  1687
		{
sl@0
  1688
		case 0:
sl@0
  1689
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  1690
			// One whole cycle of events
sl@0
  1691
			// Simulate out-of-range from all pointers and don't expect out-of-range events
sl@0
  1692
			// since all the pointers are already in same state
sl@0
  1693
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1694
				{
sl@0
  1695
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1696
				}
sl@0
  1697
			
sl@0
  1698
			// Simulate moves with proximity value < EEnterCloseProximity
sl@0
  1699
			proxValue = -30;
sl@0
  1700
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1701
				{
sl@0
  1702
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1703
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  1704
				}
sl@0
  1705
sl@0
  1706
			// Simulate moves with proximity value > EEnterCloseProximity
sl@0
  1707
			proxValue = -10;
sl@0
  1708
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1709
				{
sl@0
  1710
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1711
				AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum);
sl@0
  1712
				}
sl@0
  1713
			
sl@0
  1714
			// Simulate EButton1Down with pressure value < EEnterHighPressure
sl@0
  1715
			prValue = 1000;
sl@0
  1716
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1717
				{
sl@0
  1718
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1719
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
sl@0
  1720
				}
sl@0
  1721
			
sl@0
  1722
			// Simulate moves with pressure value > EEnterHighPressure
sl@0
  1723
			prValue = 5000;
sl@0
  1724
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1725
				{
sl@0
  1726
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1727
				AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
sl@0
  1728
				}
sl@0
  1729
			
sl@0
  1730
			// Simulate moves with pressure value < EExitHighPressure
sl@0
  1731
			prValue = 1000;
sl@0
  1732
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1733
				{
sl@0
  1734
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1735
				AddExpectedPointerEvent(TPointerEvent::EExitHighPressure, ptrPos, prValue, 0, ptrNum);
sl@0
  1736
				}
sl@0
  1737
			
sl@0
  1738
			// Simulate EButton1Up with proximity value > EEnterCloseProximity
sl@0
  1739
			proxValue = -10;
sl@0
  1740
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1741
				{
sl@0
  1742
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1743
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1744
				}
sl@0
  1745
			
sl@0
  1746
			// Simulate moves with proximity value < EExitCloseProximity
sl@0
  1747
			proxValue = -60;
sl@0
  1748
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1749
				{
sl@0
  1750
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1751
				AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
sl@0
  1752
				}
sl@0
  1753
			break;
sl@0
  1754
		case 1:
sl@0
  1755
			// Simulate events to meet all scenarios 
sl@0
  1756
			// Simulate EButton1Down with pressure value < EEnterHighPressure
sl@0
  1757
			prValue = 1000;
sl@0
  1758
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1759
				{
sl@0
  1760
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1761
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
sl@0
  1762
				}
sl@0
  1763
			
sl@0
  1764
			// Simulate EButton1Up with proximity value < EExitCloseProximity
sl@0
  1765
			proxValue = -60;
sl@0
  1766
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1767
				{
sl@0
  1768
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1769
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1770
				AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
sl@0
  1771
				}
sl@0
  1772
			
sl@0
  1773
			// Simulate EButton1Down with pressure value > EEnterHighPressure
sl@0
  1774
			prValue = 5000;
sl@0
  1775
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1776
				{
sl@0
  1777
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1778
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
sl@0
  1779
				AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
sl@0
  1780
				}
sl@0
  1781
			
sl@0
  1782
			// Simulate EButton1Up with proximity value < EExitCloseProximity
sl@0
  1783
			proxValue = -60;
sl@0
  1784
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1785
				{
sl@0
  1786
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1787
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1788
				AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
sl@0
  1789
				}
sl@0
  1790
			break;
sl@0
  1791
		case 2:
sl@0
  1792
			// Simulate moves with proximity value > EEnterCloseProximity
sl@0
  1793
			proxValue = -10;
sl@0
  1794
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1795
				{
sl@0
  1796
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1797
				AddExpectedPointerEvent(TPointerEvent::EEnterCloseProximity, ptrPos, proxValue, 0, ptrNum);
sl@0
  1798
				}
sl@0
  1799
			
sl@0
  1800
			// Simulate EButton1Down with pressure value > EEnterHighPressure
sl@0
  1801
			prValue = 5000;
sl@0
  1802
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1803
				{
sl@0
  1804
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1805
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
sl@0
  1806
				AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
sl@0
  1807
				}
sl@0
  1808
			
sl@0
  1809
			// Simulate EButton1Up with proximity value > EExitCloseProximity
sl@0
  1810
			proxValue = -40;		// When you coming up, EEnterCloseProximity is of no use
sl@0
  1811
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1812
				{
sl@0
  1813
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1814
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1815
				}
sl@0
  1816
			
sl@0
  1817
			// Simulate out-of-range events
sl@0
  1818
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1819
				{
sl@0
  1820
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1821
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  1822
				}
sl@0
  1823
			break;
sl@0
  1824
		case 3:
sl@0
  1825
			// From out-of-range state to EButton1Down
sl@0
  1826
			// Simulate EButton1Down with pressure value < EEnterHighPressure
sl@0
  1827
			prValue = 1000;
sl@0
  1828
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1829
				{
sl@0
  1830
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1831
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
sl@0
  1832
				}
sl@0
  1833
			
sl@0
  1834
			// Simulate EButton1Up with proximity value > EExitCloseProximity
sl@0
  1835
			proxValue = -40;
sl@0
  1836
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1837
				{
sl@0
  1838
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1839
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1840
				}
sl@0
  1841
			
sl@0
  1842
			// Simulate out-of-range events
sl@0
  1843
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1844
				{
sl@0
  1845
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1846
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  1847
				}
sl@0
  1848
			
sl@0
  1849
			// Simulate EButton1Down with pressure value > EEnterHighPressure
sl@0
  1850
			prValue = 5000;
sl@0
  1851
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1852
				{
sl@0
  1853
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1854
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
sl@0
  1855
				AddExpectedPointerEvent(TPointerEvent::EEnterHighPressure, ptrPos, prValue, 0, ptrNum);
sl@0
  1856
				}
sl@0
  1857
			
sl@0
  1858
			// Simulate EButton1Up with proximity value > EExitCloseProximity
sl@0
  1859
			proxValue = -40;
sl@0
  1860
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1861
				{
sl@0
  1862
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1863
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1864
				}
sl@0
  1865
			
sl@0
  1866
			// Simulate out-of-range events
sl@0
  1867
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1868
				{
sl@0
  1869
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1870
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  1871
				}
sl@0
  1872
			break;
sl@0
  1873
		case 4:
sl@0
  1874
			// Simulate EButton1Dowm with pressure value < EEnterHighPressure
sl@0
  1875
			prValue = 1000;
sl@0
  1876
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1877
				{
sl@0
  1878
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1879
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, ptrNum);
sl@0
  1880
				}
sl@0
  1881
			
sl@0
  1882
			// Simulate EButton1Up with proximity value < EExitCloseProximity
sl@0
  1883
			proxValue = -60;
sl@0
  1884
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1885
				{
sl@0
  1886
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1887
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1888
				AddExpectedPointerEvent(TPointerEvent::EExitCloseProximity, ptrPos, proxValue, 0, ptrNum);
sl@0
  1889
				}
sl@0
  1890
			
sl@0
  1891
			// Simulate out-of-range from Up/OutOfCloseProximity
sl@0
  1892
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1893
				{
sl@0
  1894
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1895
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  1896
				}
sl@0
  1897
			break;
sl@0
  1898
		case 5:
sl@0
  1899
			// Purging of proximity and pressure events
sl@0
  1900
			// Simulate EnterCloseProximity and ExitCloseProximity events which will be purged
sl@0
  1901
			// when you send Button1Up events for KMaxQueueSize
sl@0
  1902
			proxValue = -10;
sl@0
  1903
			for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
sl@0
  1904
				{
sl@0
  1905
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1906
				}
sl@0
  1907
			proxValue = -60;
sl@0
  1908
			for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
sl@0
  1909
				{
sl@0
  1910
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1911
				}
sl@0
  1912
			for (TInt count = 0; count < KMaxQueueSize; count++)
sl@0
  1913
				{
sl@0
  1914
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  1915
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0);
sl@0
  1916
				}
sl@0
  1917
			break;
sl@0
  1918
		case 6:
sl@0
  1919
			// Simulate EnterCloseProximity for 4 pointers. 
sl@0
  1920
			// As we cannot create lone ExitCloseProximity events, so create just moves from next 4 pointers
sl@0
  1921
			// Simulate out-of-range for these events on thier respective pointers
sl@0
  1922
			// Then simulate EButton1Up events which will purge EnterCloseProximity and move events
sl@0
  1923
			// which checks that lone EnterCloseProximity and lone move events will be purged
sl@0
  1924
			proxValue = -10;
sl@0
  1925
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  1926
				{
sl@0
  1927
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1928
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1929
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  1930
				}
sl@0
  1931
			proxValue = -60;
sl@0
  1932
			for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1933
				{
sl@0
  1934
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1935
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1936
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  1937
				}
sl@0
  1938
			for (TInt count = 0; count < KMaxQueueSize-iMaxDevPointers; count++)
sl@0
  1939
				{
sl@0
  1940
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  1941
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0);
sl@0
  1942
				}
sl@0
  1943
			break;
sl@0
  1944
		case 7:
sl@0
  1945
			// Bring all other pointers to Up state, becasue of previous test
sl@0
  1946
			// Then simulate out-of-range twice for all the pointers
sl@0
  1947
			// Then simulate Button1Up which will cause purging of successive out-of-range events
sl@0
  1948
			proxValue = -60;
sl@0
  1949
			tempCount = 0;
sl@0
  1950
			for (TInt ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1951
				{
sl@0
  1952
				tempCount++;
sl@0
  1953
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  1954
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, ptrNum);
sl@0
  1955
				}
sl@0
  1956
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  1957
				{
sl@0
  1958
				tempCount++;
sl@0
  1959
				// Wserv does nothing if current state is outofrange and if receives again EOutOfRange event which is practically not possible
sl@0
  1960
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1961
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  1962
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  1963
				}
sl@0
  1964
			for (TInt count = 0; count < KMaxQueueSize-tempCount; count++)
sl@0
  1965
				{
sl@0
  1966
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  1967
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, proxValue, 0, 0);
sl@0
  1968
				}
sl@0
  1969
			break;
sl@0
  1970
		case 8:
sl@0
  1971
			// Simulate EButton1Down with pressure value > EnterHIghPressure threshold
sl@0
  1972
			// which will cause EButton1Down and EnterHighPressure to be filled in queue
sl@0
  1973
			// Simulate ExitHighPressure and EButton1Up events for 2 pointers
sl@0
  1974
			// Then simulate EButton1Up events from pointer0 so that all of the above events are purged
sl@0
  1975
			prValue = 5000;
sl@0
  1976
			for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
sl@0
  1977
				{
sl@0
  1978
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1979
				}
sl@0
  1980
			prValue = 1000;
sl@0
  1981
			for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
sl@0
  1982
				{
sl@0
  1983
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  1984
				// Here these events are purged becasue their correpsonding  down event would have been purged
sl@0
  1985
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);	
sl@0
  1986
				}
sl@0
  1987
			// All the above events get purged by this
sl@0
  1988
			for (TInt count = 0; count < KMaxQueueSize; count++)
sl@0
  1989
				{
sl@0
  1990
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  1991
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
sl@0
  1992
				}
sl@0
  1993
			break;
sl@0
  1994
		case 9:
sl@0
  1995
			// Simulate EButton1Down for 2 pointers, which will generate Button1Down and EnterHighPressure
sl@0
  1996
			// Simulate Ebutton1Up events for MaxQueueSize from last pointer so that all the above events are purged  
sl@0
  1997
			prValue = 5000;
sl@0
  1998
			for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrNum < 2); ptrNum++)
sl@0
  1999
				{
sl@0
  2000
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  2001
				}
sl@0
  2002
			
sl@0
  2003
			// This will cause above down and enterhighpressure events to be purged
sl@0
  2004
			// When pointer is in outofrange state and when EButton1Up event is sent Wserv sends EnterCloseProximity 
sl@0
  2005
			// EnterCloseProximity cannot be purged unless the next event is EExitCloseProximity or EOutOfRange
sl@0
  2006
			for (TInt count = 0; count < KMaxQueueSize; count++)
sl@0
  2007
				{
sl@0
  2008
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, iMaxDevPointers-1);
sl@0
  2009
				AddExpectedPointerEvent((count ? TPointerEvent::EButton1Up : TPointerEvent::EEnterCloseProximity), ptrPos, 0, 0, iMaxDevPointers-1);
sl@0
  2010
				}
sl@0
  2011
sl@0
  2012
			// As the first 2 pointers are in down state, and if we send the move events with prValue = 1000
sl@0
  2013
			// This will generate the exithigh pressure events, which will be ignored
sl@0
  2014
			// This will also generate the Ebutton1Up event which will also be ignored
sl@0
  2015
			prValue = 1000;
sl@0
  2016
			for (TInt ptrNum = 0; (ptrNum < iMaxDevPointers/2  && ptrNum < 2); ptrNum++)
sl@0
  2017
				{
sl@0
  2018
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  2019
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2020
				}
sl@0
  2021
			break;
sl@0
  2022
		case 10:
sl@0
  2023
			// This is to just bring all the pointers to out-of-range state
sl@0
  2024
			// to make all pointers in valid state for other test to run
sl@0
  2025
			// Wserv processes EOutOfRange events only when its current state is not in outofrange. 
sl@0
  2026
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers && ptrNum < 2; ptrNum++)
sl@0
  2027
				{
sl@0
  2028
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2029
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum);
sl@0
  2030
				}
sl@0
  2031
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, iMaxDevPointers-1);
sl@0
  2032
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, iMaxDevPointers-1);
sl@0
  2033
			break;
sl@0
  2034
		default:
sl@0
  2035
			SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt);
sl@0
  2036
			ResetFlushStopAS();
sl@0
  2037
			break;
sl@0
  2038
		}
sl@0
  2039
sl@0
  2040
	LogEventsAdded();
sl@0
  2041
	}
sl@0
  2042
sl@0
  2043
void CTMultiPtrEventTest::CreateAnimDllAndAnimL()
sl@0
  2044
	{
sl@0
  2045
	iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs);
sl@0
  2046
	User::LeaveIfError(iAnimDll->Load(KAnimDLLName));
sl@0
  2047
	iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll);
sl@0
  2048
	}
sl@0
  2049
sl@0
  2050
void CTMultiPtrEventTest::DestroyAnimDllAndAnim()
sl@0
  2051
	{
sl@0
  2052
	if (iAnim)
sl@0
  2053
		{
sl@0
  2054
		iAnim->Destroy();
sl@0
  2055
		iAnim = NULL;
sl@0
  2056
		}
sl@0
  2057
	if (iAnimDll)
sl@0
  2058
		{
sl@0
  2059
		iAnimDll->Destroy();
sl@0
  2060
		iAnimDll = NULL;
sl@0
  2061
		}
sl@0
  2062
	}
sl@0
  2063
sl@0
  2064
void CTMultiPtrEventTest::CreateGroupWinL()
sl@0
  2065
	{
sl@0
  2066
	iGroupWinForEmul = new(ELeave) CTWindowGroup(iMultiPtrEventClient);
sl@0
  2067
	iGroupWinForEmul->ConstructL();
sl@0
  2068
	iGroupWinForEmul->GroupWin()->AutoForeground(ETrue);
sl@0
  2069
	iGroupWinForEmul->GroupWin()->EnableFocusChangeEvents();
sl@0
  2070
sl@0
  2071
	iWinForEmul = new(ELeave) CTBlankWindow();
sl@0
  2072
	iWinForEmul->ConstructL(*iGroupWinForEmul);
sl@0
  2073
	iWinForEmul->SetExt(TPoint(50,50), TSize(80,80));
sl@0
  2074
	iWinForEmul->SetColor(KRgbDarkYellow);
sl@0
  2075
	iWinForEmul->Activate();	
sl@0
  2076
	}
sl@0
  2077
sl@0
  2078
void CTMultiPtrEventTest::DeleteGroupWin()
sl@0
  2079
	{
sl@0
  2080
	if (iWinForEmul)
sl@0
  2081
		{
sl@0
  2082
		delete iWinForEmul;
sl@0
  2083
		iWinForEmul = NULL;
sl@0
  2084
		}
sl@0
  2085
	if (iGroupWinForEmul)
sl@0
  2086
		{
sl@0
  2087
		delete iGroupWinForEmul;
sl@0
  2088
		iGroupWinForEmul = NULL;
sl@0
  2089
		}
sl@0
  2090
	}
sl@0
  2091
sl@0
  2092
/**
sl@0
  2093
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0029
sl@0
  2094
@SYMPREQ				PREQ1226
sl@0
  2095
@SYMREQ					REQ9688
sl@0
  2096
@SYMTestPriority		High
sl@0
  2097
@SYMTestCaseDesc		Tests the emulation rules for Apps, Anims, Autofocus and Buffered delivery
sl@0
  2098
@SYMTestStatus			Implemented
sl@0
  2099
sl@0
  2100
@SYMTestActions			Simulate event to make a pointer primary. EnableAdvancedPointers API is not called. And then simulate events from other pointers  
sl@0
  2101
@SYMTestExpectedResults The events from other pointer are not received
sl@0
  2102
*/
sl@0
  2103
void CTMultiPtrEventTest::EmulationRulesForMultiplePointers()
sl@0
  2104
	{
sl@0
  2105
	TLogMessageText logText;
sl@0
  2106
	_LIT(KSet, "Emulation rules set of events: %d of 15");
sl@0
  2107
	logText.AppendFormat(KSet, iEventSet);
sl@0
  2108
	LOG_MESSAGE(logText);
sl@0
  2109
	
sl@0
  2110
	if (!iEventSet)
sl@0
  2111
		{
sl@0
  2112
		SetExpectNonAdvancedPointerEvents();
sl@0
  2113
		SetAutoFlush();
sl@0
  2114
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  2115
		}
sl@0
  2116
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  2117
	
sl@0
  2118
	TPoint ptrPos(10,10);
sl@0
  2119
	TInt proxValue = -iProximityStep;
sl@0
  2120
	TInt prValue = iPressureStep;
sl@0
  2121
	TInt ptrNum = 0;
sl@0
  2122
	switch(iEventSet++)
sl@0
  2123
		{
sl@0
  2124
		case 0:
sl@0
  2125
			// This event is for simulated/primary pointer
sl@0
  2126
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  2127
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  2128
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2129
			
sl@0
  2130
			// Parent window has not called EnableAdvancedPointers API
sl@0
  2131
			// So even if we simulate moves and out-of-range these are not delivered to client
sl@0
  2132
			for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2133
				{
sl@0
  2134
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2135
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2136
				}
sl@0
  2137
			break;
sl@0
  2138
		case 1:
sl@0
  2139
			// Since the primary pointer is 0, simulate EButton1Down for making pointer 1 as primary 
sl@0
  2140
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2141
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2142
			
sl@0
  2143
			// Simulate move or Ebutton1Down from pointer0 they are NOT sent back to client
sl@0
  2144
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  2145
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2146
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2147
			
sl@0
  2148
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2149
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2150
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2151
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2152
			break;
sl@0
  2153
		case 2:
sl@0
  2154
			// Simulate EButton1Down from pointer0 to make it primary
sl@0
  2155
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2156
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, 0);
sl@0
  2157
			
sl@0
  2158
			// Move from pointer1
sl@0
  2159
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2160
			
sl@0
  2161
			// Take the zero pointer out-of-range, this will not result in Pointer 1 becoming primary
sl@0
  2162
			// and out-of-range event is sent to client
sl@0
  2163
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2164
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
sl@0
  2165
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2166
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, 0);
sl@0
  2167
			
sl@0
  2168
			// Send moves from pointer1, but these are not sent to the Client.
sl@0
  2169
			ptrPos.iX += 10;
sl@0
  2170
			ptrPos.iY += 10;
sl@0
  2171
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2172
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2173
			
sl@0
  2174
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2175
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2176
			
sl@0
  2177
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2178
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2179
			break;
sl@0
  2180
		case 3:
sl@0
  2181
			// Simulate EButton1Down from pointer0 to make it primary
sl@0
  2182
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2183
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2184
			
sl@0
  2185
			// Simulate EButton1Down from pointer1, which is not sent to client 
sl@0
  2186
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2187
			
sl@0
  2188
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2189
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2190
			
sl@0
  2191
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2192
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2193
			
sl@0
  2194
			// Drag events are not sent becasue pointer1 has NOT become primary
sl@0
  2195
			ptrPos.iX += 10;
sl@0
  2196
			ptrPos.iY += 10;
sl@0
  2197
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2198
			
sl@0
  2199
			// Simulate up from pointer1, still not primary, so event is not sent
sl@0
  2200
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2201
			
sl@0
  2202
			// Simulate out-of-range from pointer1, still not primary, so event is not sent
sl@0
  2203
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2204
			
sl@0
  2205
			// Now moves from out-of-range to move state 
sl@0
  2206
			ptrPos.iX += 10;
sl@0
  2207
			ptrPos.iY += 10;
sl@0
  2208
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2209
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2210
			
sl@0
  2211
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2212
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2213
			break;
sl@0
  2214
		case 4:
sl@0
  2215
			// pointer0 sends move (becomes primary)
sl@0
  2216
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2217
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2218
			
sl@0
  2219
			// pointer0 sends down
sl@0
  2220
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2221
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2222
			
sl@0
  2223
			// pointer1 sends down, doesn't become primary
sl@0
  2224
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2225
sl@0
  2226
			// pointer0 sends up, stays primary
sl@0
  2227
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2228
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2229
sl@0
  2230
			// pointer2, pointer3 and pointer4 sends move with proximity -5, -10, -15
sl@0
  2231
			for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++, proxValue -= iProximityStep)
sl@0
  2232
				{
sl@0
  2233
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2234
				}
sl@0
  2235
			
sl@0
  2236
			// pointer0 sends out-of-range, loses primary pointer, But NO events are sent
sl@0
  2237
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2238
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2239
			
sl@0
  2240
			// Send moves for pointer2, pointer3 and pointer4.
sl@0
  2241
			// None of the evnst are sent
sl@0
  2242
			ptrPos.SetXY(0,0);
sl@0
  2243
			for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2244
				{
sl@0
  2245
				ptrPos.iX += 10;
sl@0
  2246
				ptrPos.iY += 5;
sl@0
  2247
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2248
				}
sl@0
  2249
			
sl@0
  2250
			// Drag from pointer1, NOT sent, since it is not primary
sl@0
  2251
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, 1);
sl@0
  2252
sl@0
  2253
			// Send out-of-range from all pointers
sl@0
  2254
			for (ptrNum = 2; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2255
				{
sl@0
  2256
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2257
				}
sl@0
  2258
			
sl@0
  2259
			// As the pointer1 is down, this will not become primary even if EButton1Up is called
sl@0
  2260
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2261
			
sl@0
  2262
			// And now sending out-of-range will also not send the event to client as it is not primary
sl@0
  2263
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2264
			break;
sl@0
  2265
		case 5:
sl@0
  2266
			// Test cases 5 - 7 represent one discrete test for PointerRepeatEvents
sl@0
  2267
			// Case 5 simulates EButton1Down events only. This is to ensure the event is delivered to the client. 
sl@0
  2268
			// If the event remained in the window queue the PointerRepeatEvent request would be cancelled when PointerRepeatPurgeCheck is performed.
sl@0
  2269
			ptrPos.SetXY(0,0);
sl@0
  2270
			
sl@0
  2271
			// pointer0 sends down (become primary)
sl@0
  2272
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2273
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2274
			
sl@0
  2275
			// pointer1 sends down, doesn't become primary
sl@0
  2276
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2277
			
sl@0
  2278
			// pointer4 sends down
sl@0
  2279
			if (4 < iMaxDevPointers)
sl@0
  2280
				{
sl@0
  2281
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 4);
sl@0
  2282
				}
sl@0
  2283
			break;
sl@0
  2284
		case 6:
sl@0
  2285
			ptrPos.SetXY(0,0);
sl@0
  2286
			// Simulate client calling RequestPointerRepeatEvent in response to EButton1Down event being within a 'hitbox'.
sl@0
  2287
			// Legacy API called which does not specify a pointer number. EButtonRepeat should be generated for primary pointer only.
sl@0
  2288
			iMultiPtrEventClient->ParentWin()->BaseWin()->RequestPointerRepeatEvent(TTimeIntervalMicroSeconds32(100000),TRect(TPoint(0,0), TSize(20,20)));				
sl@0
  2289
			User::After(200000);	
sl@0
  2290
			AddExpectedPointerEvent(TPointerEvent::EButtonRepeat, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber);			
sl@0
  2291
			break;
sl@0
  2292
		case 7:
sl@0
  2293
			// pointer0 sends up 
sl@0
  2294
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2295
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2296
			
sl@0
  2297
			// pointer2 sends out-of-range
sl@0
  2298
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2299
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2300
			
sl@0
  2301
			// Send up and out-of-range for pointer1 and 4
sl@0
  2302
			SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 1);
sl@0
  2303
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2304
			
sl@0
  2305
			if (4 < iMaxDevPointers)
sl@0
  2306
				{
sl@0
  2307
				SimulatePointerEvent(TRawEvent::EButton1Up, 0, 0, 0, 4);
sl@0
  2308
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 4);
sl@0
  2309
				}
sl@0
  2310
			break;
sl@0
  2311
		case 8:
sl@0
  2312
			// Autofocus does not work for other than primary pointers
sl@0
  2313
			// Create group window which will send focus lost and gained
sl@0
  2314
			TRAPD(err, CreateGroupWinL());	// it cannot leave so trap and fail
sl@0
  2315
			if (err != KErrNone)
sl@0
  2316
				{
sl@0
  2317
				Failed();
sl@0
  2318
				}
sl@0
  2319
			AddExpectedWsEvent(EEventFocusLost);
sl@0
  2320
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  2321
			
sl@0
  2322
			// Simulate Epointer down which will send focuslost, focusgained and focusgroupchanged events 
sl@0
  2323
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2324
			AddExpectedWsEvent(EEventFocusLost); 
sl@0
  2325
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  2326
			AddExpectedWsEvent(EEventFocusGroupChanged);
sl@0
  2327
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2328
			
sl@0
  2329
			// Now simulate EButton1Down from first or second pointer on second group
sl@0
  2330
			// This should not reflect the autofocus
sl@0
  2331
			ptrPos.iX = 60;
sl@0
  2332
			ptrPos.iY = 60;
sl@0
  2333
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2334
			if (2 < iMaxDevPointers)
sl@0
  2335
				{
sl@0
  2336
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 2);
sl@0
  2337
				}
sl@0
  2338
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2339
			if (2 < iMaxDevPointers)
sl@0
  2340
				{
sl@0
  2341
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 2);
sl@0
  2342
				}
sl@0
  2343
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2344
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2345
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2346
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2347
			break;
sl@0
  2348
		case 9:
sl@0
  2349
			// First thing to do in this case is to delete the group window created
sl@0
  2350
			DeleteGroupWin();
sl@0
  2351
			
sl@0
  2352
			TRAP(err, CreateAnimDllAndAnimL());	// it cannot leave so trap and fail
sl@0
  2353
			if (err != KErrNone)
sl@0
  2354
				{
sl@0
  2355
				Failed();
sl@0
  2356
				}
sl@0
  2357
sl@0
  2358
			// This is the first event which makes first pointer as primary
sl@0
  2359
			// When the last argument is EFalse, it means that the event is not consumed by Anim
sl@0
  2360
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, 0, 0, 0, EFalse);
sl@0
  2361
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2362
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2363
			
sl@0
  2364
			// Now simulate moves from other pointers and these events are not sent to anim
sl@0
  2365
			for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2366
				{
sl@0
  2367
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2368
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2369
				}
sl@0
  2370
sl@0
  2371
			// This is to reset the primary pointer 
sl@0
  2372
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse);
sl@0
  2373
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2374
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2375
	
sl@0
  2376
			// Now simulate EButton1Down, which will make it as primary
sl@0
  2377
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 1, EFalse);
sl@0
  2378
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2379
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2380
			
sl@0
  2381
			// Simulate move or Ebutton1Down from any other prointer they are not sent back to client
sl@0
  2382
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  2383
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2384
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2385
			
sl@0
  2386
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 1, EFalse);
sl@0
  2387
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2388
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2389
			
sl@0
  2390
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 1, EFalse);
sl@0
  2391
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2392
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2393
sl@0
  2394
			// Set the primary pointer to Zero			
sl@0
  2395
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down, ptrPos, 0, 0, 0, EFalse);
sl@0
  2396
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2397
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2398
			
sl@0
  2399
			// Move from second pointer
sl@0
  2400
			// As EnableMultiPointer is not called and this is not a primary pointer so this event
sl@0
  2401
			// will cause the pointer 1 into move state
sl@0
  2402
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2403
			
sl@0
  2404
			// Take the zero pointer out-of-range 
sl@0
  2405
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up, ptrPos, 0, 0, 0, EFalse);
sl@0
  2406
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2407
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2408
			
sl@0
  2409
			iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos, 0, 0, 0, EFalse);
sl@0
  2410
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2411
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2412
			
sl@0
  2413
			// These moves will not be sent
sl@0
  2414
			ptrPos.iX += 10;
sl@0
  2415
			ptrPos.iY += 10;
sl@0
  2416
			
sl@0
  2417
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2418
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2419
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);		
sl@0
  2420
sl@0
  2421
			TestAndDisplayAnimError();
sl@0
  2422
			
sl@0
  2423
			_LIT(KEventsChecked, "Events checked at server side = %d");
sl@0
  2424
			logText.Format(KEventsChecked, 10);
sl@0
  2425
			LOG_MESSAGE(logText);
sl@0
  2426
			break;
sl@0
  2427
		case 10:
sl@0
  2428
			DestroyAnimDllAndAnim();
sl@0
  2429
			
sl@0
  2430
			// Test for PointerMove buffers
sl@0
  2431
			// AllocPointerMoveBuffer, EnablePointerMoveBuffer and then simulate few moves
sl@0
  2432
			// Add these moves to another points buffer for testing
sl@0
  2433
			// Simulate moves from other pointers, these should not be delivered to clients.
sl@0
  2434
			iMultiPtrEventClient->ParentWin()->BaseWin()->AllocPointerMoveBuffer(10, 0);
sl@0
  2435
			iMultiPtrEventClient->ParentWin()->BaseWin()->EnablePointerMoveBuffer();
sl@0
  2436
			
sl@0
  2437
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2438
			AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin());
sl@0
  2439
			iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);   // If this position is above some other window then we need to consider its window postion also
sl@0
  2440
			ptrPos.iX += 10;
sl@0
  2441
			ptrPos.iY += 10;
sl@0
  2442
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2443
			iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
sl@0
  2444
			ptrPos.iX += 10;
sl@0
  2445
			ptrPos.iY += 10;
sl@0
  2446
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2447
			iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
sl@0
  2448
			
sl@0
  2449
			// These events should not be added to buffer
sl@0
  2450
			for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2451
				{
sl@0
  2452
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2453
				ptrPos.iX += 10;
sl@0
  2454
				ptrPos.iY += 10;
sl@0
  2455
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2456
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2457
				}
sl@0
  2458
			break;
sl@0
  2459
		case 11:
sl@0
  2460
			// Repeat the above for drag events
sl@0
  2461
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2462
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2463
			
sl@0
  2464
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2465
			AddExpectedWsEvent(EEventPointerBufferReady, EFalse, TAdvancedPointerEvent::EDefaultPointerNumber, (TUint)iMultiPtrEventClient->ParentWin());
sl@0
  2466
			iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
sl@0
  2467
			ptrPos.iX += 10;
sl@0
  2468
			ptrPos.iY += 10;
sl@0
  2469
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2470
			iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
sl@0
  2471
			ptrPos.iX += 10;
sl@0
  2472
			ptrPos.iY += 10;
sl@0
  2473
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2474
			iMultiPtrEventClient->AddExpectedMovePoint(ptrPos);
sl@0
  2475
			
sl@0
  2476
			// These events should not be added to buffer
sl@0
  2477
			for (ptrNum = 1; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2478
				{
sl@0
  2479
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2480
				ptrPos.iX += 10;
sl@0
  2481
				ptrPos.iY += 10;
sl@0
  2482
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2483
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2484
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2485
				}
sl@0
  2486
			
sl@0
  2487
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2488
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2489
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2490
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2491
			break;
sl@0
  2492
		case 12:
sl@0
  2493
			iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer();
sl@0
  2494
			iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer();
sl@0
  2495
			
sl@0
  2496
			// Pointer Cursor Position test 
sl@0
  2497
			// This event is for simulating primary pointer
sl@0
  2498
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  2499
			// Here I am not adding the event because this event is deleted by another move of same pointer
sl@0
  2500
			if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
sl@0
  2501
				{
sl@0
  2502
				TEST(EFalse);
sl@0
  2503
				Failed();
sl@0
  2504
				}
sl@0
  2505
			
sl@0
  2506
			iMultiPtrEventClient->iWs.SetPointerCursorPosition(TPoint(20,20));
sl@0
  2507
			if (TPoint(20,20) != iMultiPtrEventClient->iWs.PointerCursorPosition())
sl@0
  2508
				{
sl@0
  2509
				TEST(EFalse);
sl@0
  2510
				Failed();
sl@0
  2511
				}
sl@0
  2512
			
sl@0
  2513
			// Now simulate moves from other pointer, this should not have any effect on pointer cursor position
sl@0
  2514
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2515
sl@0
  2516
			// Now move the primary pointer, and check the pointer cursor position which should be same as position used for move
sl@0
  2517
			ptrPos.iX = 30;
sl@0
  2518
			ptrPos.iY = 30;
sl@0
  2519
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  2520
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2521
			if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
sl@0
  2522
				{
sl@0
  2523
				TEST(EFalse);
sl@0
  2524
				Failed();
sl@0
  2525
				}
sl@0
  2526
			
sl@0
  2527
			// Send out-of-range event which will not lead to pointer 1 becoming primary
sl@0
  2528
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2529
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2530
			
sl@0
  2531
			// Now check the pointer cursor position, which should be same
sl@0
  2532
			// as primary even if there is other pointer in up state, but that is not primary
sl@0
  2533
			if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
sl@0
  2534
				{
sl@0
  2535
				TEST(EFalse);
sl@0
  2536
				Failed();
sl@0
  2537
				}
sl@0
  2538
			
sl@0
  2539
			// This is to bring the pointer1 to out-of-range state
sl@0
  2540
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2541
			
sl@0
  2542
			// then send move event and then again check the pointer cursor position
sl@0
  2543
			ptrPos.iX = 20;
sl@0
  2544
			ptrPos.iY = 20;
sl@0
  2545
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2546
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2547
			if (ptrPos != iMultiPtrEventClient->iWs.PointerCursorPosition())
sl@0
  2548
				{
sl@0
  2549
				TEST(EFalse);
sl@0
  2550
				Failed();
sl@0
  2551
				}
sl@0
  2552
			
sl@0
  2553
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2554
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2555
			
sl@0
  2556
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2557
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2558
			break;
sl@0
  2559
		case 13:
sl@0
  2560
			{
sl@0
  2561
			// Pointer Cursor Area test-1
sl@0
  2562
			iOrigPtrCursorArea = iMultiPtrEventClient->iWs.PointerCursorArea();
sl@0
  2563
			TRect ptrCurArea(0,0,40,40);
sl@0
  2564
			iMultiPtrEventClient->iWs.SetPointerCursorArea(ptrCurArea);
sl@0
  2565
			
sl@0
  2566
			// Simulate move from pointer0 in PointerCursorArea
sl@0
  2567
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  2568
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2569
			
sl@0
  2570
			// Simulate move from other pointer, This should have no effect
sl@0
  2571
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2572
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2573
			
sl@0
  2574
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2575
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2576
sl@0
  2577
			// Repeat the above with moves outside pointer cursor area 
sl@0
  2578
			ptrPos.iX = 50;
sl@0
  2579
			ptrPos.iY = 50;
sl@0
  2580
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 0);
sl@0
  2581
			TPoint pointInCurArea(39, 39);
sl@0
  2582
			AddExpectedPointerEvent(TPointerEvent::EMove, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2583
			
sl@0
  2584
			// Simulate move from other pointer, This should have no effect			
sl@0
  2585
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, 1);
sl@0
  2586
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2587
						
sl@0
  2588
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2589
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, proxValue, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2590
			}
sl@0
  2591
			break;
sl@0
  2592
		case 14:
sl@0
  2593
			{
sl@0
  2594
			// Pointer Cursor Area test-2
sl@0
  2595
			// repeat the above test with button1 down
sl@0
  2596
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2597
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2598
			
sl@0
  2599
			// Simulate move from other pointer, This should have no effect
sl@0
  2600
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2601
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2602
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2603
			
sl@0
  2604
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2605
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2606
			
sl@0
  2607
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2608
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2609
			
sl@0
  2610
			// Repeat the above with moves outside pointer cursor area 
sl@0
  2611
			ptrPos.iX = 50;
sl@0
  2612
			ptrPos.iY = 50;
sl@0
  2613
			TPoint pointInCurArea(39, 39);
sl@0
  2614
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2615
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2616
			
sl@0
  2617
			// Simulate move from other pointer, This should have no effect
sl@0
  2618
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2619
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 1);
sl@0
  2620
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 1);
sl@0
  2621
			
sl@0
  2622
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  2623
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2624
			
sl@0
  2625
			SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, 0);
sl@0
  2626
			AddExpectedPointerEvent(TPointerEvent::EOutOfRange, pointInCurArea, 0, 0, TAdvancedPointerEvent::EDefaultPointerNumber);
sl@0
  2627
			}
sl@0
  2628
			break;
sl@0
  2629
		default:
sl@0
  2630
			ClearExpectNonAdvancedPointerEvents();
sl@0
  2631
			iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea);
sl@0
  2632
			ResetFlushStopAS();
sl@0
  2633
			break;
sl@0
  2634
		}
sl@0
  2635
	LogEventsAdded();
sl@0
  2636
	}
sl@0
  2637
sl@0
  2638
/**
sl@0
  2639
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0026
sl@0
  2640
@SYMPREQ				PREQ1226
sl@0
  2641
@SYMREQ					REQ9677, REQ9683
sl@0
  2642
@SYMTestPriority		High
sl@0
  2643
@SYMTestCaseDesc		Checks Wserv supports Autofocus for multiple pointers
sl@0
  2644
@SYMTestStatus			Implemented
sl@0
  2645
sl@0
  2646
@SYMTestActions			Create 2 group window and respective client windows for it. And simulate EButton1Down on each window consecutively 
sl@0
  2647
@SYMTestExpectedResults The received events must match the simulated pointer events
sl@0
  2648
*/
sl@0
  2649
void CTMultiPtrEventTest::AutoForeGroundForMultiplePointersL()
sl@0
  2650
	{
sl@0
  2651
	TLogMessageText logText;
sl@0
  2652
	_LIT(KSet, "Multiple pointer Auto foreground events: %d of 2");
sl@0
  2653
	logText.AppendFormat(KSet, iEventSet);
sl@0
  2654
	LOG_MESSAGE(logText);
sl@0
  2655
	
sl@0
  2656
	if (!iEventSet)
sl@0
  2657
		{
sl@0
  2658
		SetAutoFlush();
sl@0
  2659
		AddExpectedWsEvent(EEventFocusGained);			// This if for the main groupwindow
sl@0
  2660
		iMultiPtrEventClient->ConstructGroupBlankWinL();
sl@0
  2661
		
sl@0
  2662
		// These are for child group window creation
sl@0
  2663
		AddExpectedWsEvent(EEventFocusLost);			// This if for the main groupwindow losing focus
sl@0
  2664
		AddExpectedWsEvent(EEventFocusGained);			// First group window of this test creation
sl@0
  2665
		
sl@0
  2666
		AddExpectedWsEvent(EEventFocusLost);			// First group window losing focus because of second group creation
sl@0
  2667
		AddExpectedWsEvent(EEventFocusGained);			// Second group window creation
sl@0
  2668
		AddExpectedWsEvent(EEventFocusGroupChanged);	// First group window's Enable Focus changed flag is set
sl@0
  2669
		}
sl@0
  2670
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  2671
	
sl@0
  2672
	TPoint win1PtrPos(20,20);
sl@0
  2673
	TPoint win2PtrPos(60,60);
sl@0
  2674
	TPoint ptrPos;
sl@0
  2675
	TInt autoFocusWin;
sl@0
  2676
	switch(iEventSet++)
sl@0
  2677
		{
sl@0
  2678
		case 0:
sl@0
  2679
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  2680
				{
sl@0
  2681
				if ((ptrNum & 1) == 0)
sl@0
  2682
					{
sl@0
  2683
					ptrPos = win1PtrPos;
sl@0
  2684
					autoFocusWin = 1;
sl@0
  2685
					}
sl@0
  2686
				else
sl@0
  2687
					{
sl@0
  2688
					ptrPos = win2PtrPos;
sl@0
  2689
					autoFocusWin = 0;
sl@0
  2690
					}
sl@0
  2691
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2692
				AddExpectedWsEvent(EEventFocusLost);				// Second group window losing focus 
sl@0
  2693
				AddExpectedWsEvent(EEventFocusGained);				// First group window gaining focus
sl@0
  2694
				if (ptrNum == 0)
sl@0
  2695
					{												// First group window has already received EEventFocusGroupChanged
sl@0
  2696
					AddExpectedWsEvent(EEventFocusGroupChanged);	// Second group window's Enable Focus changed flag is set
sl@0
  2697
					}
sl@0
  2698
				// In the queue only once EEventFocusGroupChanged is sent
sl@0
  2699
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  2700
				
sl@0
  2701
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2702
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  2703
				
sl@0
  2704
				// These events are to clear out the pointer state
sl@0
  2705
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2706
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum);
sl@0
  2707
				
sl@0
  2708
				if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin))
sl@0
  2709
					{
sl@0
  2710
					TEST(EFalse);
sl@0
  2711
					Failed();
sl@0
  2712
					}
sl@0
  2713
				}
sl@0
  2714
			break;
sl@0
  2715
		case 1:
sl@0
  2716
			for (TInt ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2717
				{
sl@0
  2718
				if ((ptrNum & 1) == 0)
sl@0
  2719
					{
sl@0
  2720
					ptrPos = win1PtrPos;
sl@0
  2721
					autoFocusWin = 1;
sl@0
  2722
					}
sl@0
  2723
				else
sl@0
  2724
					{
sl@0
  2725
					ptrPos = win2PtrPos;
sl@0
  2726
					autoFocusWin = 0;
sl@0
  2727
					}
sl@0
  2728
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2729
				AddExpectedWsEvent(EEventFocusLost);				// Second group window losing focus 
sl@0
  2730
				AddExpectedWsEvent(EEventFocusGained);				// First group window gaining focus
sl@0
  2731
				if (ptrNum == iMaxDevPointers/2) // first loop
sl@0
  2732
					{												
sl@0
  2733
					// When ever a group window changes focus, For all the group/client windows which have 
sl@0
  2734
					// registered for receiving group window changes recive EEventFocusGroupChanged
sl@0
  2735
					// EEventFocusGroupChanged is sent only once in one queue
sl@0
  2736
					AddExpectedWsEvent(EEventFocusGroupChanged);
sl@0
  2737
					AddExpectedWsEvent(EEventFocusGroupChanged);
sl@0
  2738
					}
sl@0
  2739
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  2740
sl@0
  2741
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2742
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  2743
				
sl@0
  2744
				// These events are to clear out the pointer state
sl@0
  2745
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2746
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, 0, 0, ptrNum);
sl@0
  2747
				if (!iMultiPtrEventClient->CheckOrdinalPosition(autoFocusWin))
sl@0
  2748
					{
sl@0
  2749
					TEST(EFalse);
sl@0
  2750
					Failed();
sl@0
  2751
					}
sl@0
  2752
				}
sl@0
  2753
			break;
sl@0
  2754
		default:
sl@0
  2755
			iMultiPtrEventClient->DeleteGroupBlankWin();
sl@0
  2756
			ResetFlushStopAS();
sl@0
  2757
			break;
sl@0
  2758
		}
sl@0
  2759
	
sl@0
  2760
	LogEventsAdded();
sl@0
  2761
	}
sl@0
  2762
sl@0
  2763
/**
sl@0
  2764
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0015
sl@0
  2765
@SYMPREQ				PREQ1226
sl@0
  2766
@SYMREQ					REQ9684
sl@0
  2767
@SYMTestPriority		High
sl@0
  2768
@SYMTestCaseDesc		Checks Wserv supports out-of-range and pointer Enter/Exit events.
sl@0
  2769
@SYMTestStatus			Implemented
sl@0
  2770
sl@0
  2771
@SYMTestActions			Simulate moves and EPointer3DOutOfRange from different pointers
sl@0
  2772
@SYMTestExpectedResults The received events must match the simulated pointer events
sl@0
  2773
*/
sl@0
  2774
void CTMultiPtrEventTest::MultiPointerOutOfRangeEvents()
sl@0
  2775
	{
sl@0
  2776
	TLogMessageText logText;
sl@0
  2777
	_LIT(KSet, "OutOfRange & Enter/Exit events: %d of 4");
sl@0
  2778
	logText.AppendFormat(KSet, iEventSet);
sl@0
  2779
	LOG_MESSAGE(logText);
sl@0
  2780
	
sl@0
  2781
	if (!iEventSet)
sl@0
  2782
		{
sl@0
  2783
		SetAutoFlush();
sl@0
  2784
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  2785
		}
sl@0
  2786
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  2787
	
sl@0
  2788
	TPoint ptrPos(10,10);
sl@0
  2789
	TInt proxValue = -iProximityStep; 
sl@0
  2790
	switch(iEventSet++)
sl@0
  2791
		{
sl@0
  2792
		case 0:
sl@0
  2793
			// Simulate moves and EPointer3DOutOfRange from all pointers
sl@0
  2794
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  2795
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  2796
				{
sl@0
  2797
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2798
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  2799
				
sl@0
  2800
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2801
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  2802
				// Here I am not enabling the enter/exit events filter so not getting those 
sl@0
  2803
				}
sl@0
  2804
			break;
sl@0
  2805
		case 1:
sl@0
  2806
			// Repeat the above by enabling the enter/exit events
sl@0
  2807
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0);
sl@0
  2808
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
sl@0
  2809
				{
sl@0
  2810
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2811
				AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
sl@0
  2812
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  2813
				
sl@0
  2814
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2815
				AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum);
sl@0
  2816
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  2817
				}
sl@0
  2818
			break;
sl@0
  2819
		case 2:
sl@0
  2820
			// Check the moves from one window to other
sl@0
  2821
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
sl@0
  2822
				{
sl@0
  2823
				ptrPos.iX = 10;
sl@0
  2824
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2825
				AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
sl@0
  2826
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  2827
				
sl@0
  2828
				ptrPos.iX = (iMultiPtrEventClient->ParentWin()->Size().iWidth)/2 + 10;
sl@0
  2829
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2830
				AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum); // move and enter of child window is filtered out
sl@0
  2831
				}
sl@0
  2832
			break;
sl@0
  2833
		case 3:
sl@0
  2834
			// Since all the pointers are now on child and when we change the pointer filter
sl@0
  2835
			// wserv sends enter event to all pointers
sl@0
  2836
			iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterEnterExit, 0);
sl@0
  2837
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
sl@0
  2838
				{
sl@0
  2839
				AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
sl@0
  2840
				}
sl@0
  2841
			for (TInt ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum = ptrNum+2)
sl@0
  2842
				{
sl@0
  2843
				ptrPos.iX = ptrPos.iY =10;
sl@0
  2844
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  2845
				AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum);
sl@0
  2846
				AddExpectedWsEvent(EEventPointerEnter, EFalse, ptrNum);
sl@0
  2847
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  2848
				
sl@0
  2849
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, 0, 0, 0, ptrNum);
sl@0
  2850
				AddExpectedWsEvent(EEventPointerExit, EFalse, ptrNum);
sl@0
  2851
				AddExpectedPointerEvent(TPointerEvent::EOutOfRange, ptrPos, proxValue, 0, ptrNum);
sl@0
  2852
				}
sl@0
  2853
			break;			
sl@0
  2854
		default:
sl@0
  2855
			ResetFlushStopAS();
sl@0
  2856
			break;
sl@0
  2857
		}
sl@0
  2858
	
sl@0
  2859
	LogEventsAdded();
sl@0
  2860
	}
sl@0
  2861
sl@0
  2862
/**
sl@0
  2863
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0032
sl@0
  2864
@SYMPREQ				PREQ1226
sl@0
  2865
@SYMREQ					REQ9677
sl@0
  2866
@SYMTestPriority		High
sl@0
  2867
@SYMTestCaseDesc		Checks Wserv supports Double click events for multi pointer events.
sl@0
  2868
@SYMTestStatus			Implemented
sl@0
  2869
sl@0
  2870
@SYMTestActions			Simulate double click events from different pointers 			
sl@0
  2871
@SYMTestExpectedResults The received events must match the simulated pointer events
sl@0
  2872
*/
sl@0
  2873
void CTMultiPtrEventTest::DoubleClickForMultiplePointers()
sl@0
  2874
	{
sl@0
  2875
	// Logic involved, double click settings are global no need to test them
sl@0
  2876
	// Check that double click events are sent by wserv for all pointers
sl@0
  2877
	TLogMessageText logText;
sl@0
  2878
	_LIT(KSet, "Double click settings and events: %d of 1");
sl@0
  2879
	logText.AppendFormat(KSet, iEventSet);
sl@0
  2880
	LOG_MESSAGE(logText);
sl@0
  2881
	
sl@0
  2882
	if (!iEventSet)
sl@0
  2883
		{
sl@0
  2884
		SetAutoFlush();
sl@0
  2885
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  2886
		}
sl@0
  2887
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  2888
	
sl@0
  2889
	TPoint ptrPos(10,10);
sl@0
  2890
	switch(iEventSet++)
sl@0
  2891
		{
sl@0
  2892
		case 0:
sl@0
  2893
			for (TInt ptrNum = 0; ptrNum < Min(iMaxDevPointers, 7); ptrNum++)
sl@0
  2894
				{
sl@0
  2895
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2896
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  2897
				AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
sl@0
  2898
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, EModifierDoubleClick, ptrNum);
sl@0
  2899
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  2900
				}
sl@0
  2901
			break;
sl@0
  2902
		default:
sl@0
  2903
			ResetFlushStopAS();
sl@0
  2904
			break;
sl@0
  2905
		}
sl@0
  2906
	
sl@0
  2907
	LogEventsAdded();
sl@0
  2908
	}
sl@0
  2909
sl@0
  2910
sl@0
  2911
/**
sl@0
  2912
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0031
sl@0
  2913
@SYMPREQ				PREQ1226
sl@0
  2914
@SYMREQ					REQ9677
sl@0
  2915
@SYMTestPriority		High
sl@0
  2916
@SYMTestCaseDesc		Checks Wserv supports Virtual keyboard for multi pointer events.
sl@0
  2917
@SYMTestStatus			Implemented
sl@0
  2918
sl@0
  2919
@SYMTestActions			Create virtual keyboard by AddKeyRect() to a window and simulate pointer events from all pointers			
sl@0
  2920
@SYMTestExpectedResults The received events must match the simulated Key events
sl@0
  2921
*/
sl@0
  2922
void CTMultiPtrEventTest::VirtualKeyBoardForMultiplePointers()
sl@0
  2923
	{
sl@0
  2924
	TLogMessageText logText;
sl@0
  2925
	_LIT(KSet, "VirtualKeyboard SetOfEvents: %d of 8");
sl@0
  2926
	logText.AppendFormat(KSet, iEventSet);
sl@0
  2927
	LOG_MESSAGE(logText);
sl@0
  2928
sl@0
  2929
	// Create virtual keyboard for 8 keys on parent window
sl@0
  2930
	// give a 5 pixel spacing at start/end and in between keys
sl@0
  2931
	const TInt noVirtualKeys = iMaxDevPointers;
sl@0
  2932
	const TInt keySpacing = 5;
sl@0
  2933
	const TInt keyWidth = ((iPhysicalScreenSize.iWidth/2) - ((noVirtualKeys+1)*keySpacing))/noVirtualKeys;
sl@0
  2934
	const TInt keyHeight = keyWidth/2; 
sl@0
  2935
	TInt startX = keySpacing;
sl@0
  2936
	const TInt baseChar ='A';
sl@0
  2937
	
sl@0
  2938
	if (!iEventSet)
sl@0
  2939
		{
sl@0
  2940
		SetAutoFlush();
sl@0
  2941
		for (TInt count=0; count < noVirtualKeys; count++)
sl@0
  2942
			{
sl@0
  2943
			iMultiPtrEventClient->ParentWin()->BaseWin()->AddKeyRect(TRect(startX, keySpacing, startX+keyWidth, keySpacing+keyHeight), baseChar+count,EFalse);
sl@0
  2944
			startX+=(keyWidth+keySpacing);
sl@0
  2945
			}
sl@0
  2946
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  2947
		}
sl@0
  2948
	
sl@0
  2949
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  2950
	TPoint ptrPos(keySpacing+(keyWidth/2), keySpacing+(keyHeight/2));
sl@0
  2951
sl@0
  2952
	TInt count = 0;
sl@0
  2953
	if (iEventSet < iMaxDevPointers)
sl@0
  2954
		{
sl@0
  2955
		for (; ptrPos.iX < (iPhysicalScreenSize.iWidth/2)-5; ptrPos.iX += (keySpacing+keyWidth), count++)
sl@0
  2956
			{
sl@0
  2957
			SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, iEventSet);
sl@0
  2958
			AddExpectedKeyDownUp(baseChar+count);
sl@0
  2959
			}
sl@0
  2960
		}
sl@0
  2961
	else
sl@0
  2962
		{
sl@0
  2963
		ResetFlushStopAS();
sl@0
  2964
		}
sl@0
  2965
	iEventSet++;
sl@0
  2966
sl@0
  2967
	LogEventsAdded();
sl@0
  2968
	}
sl@0
  2969
sl@0
  2970
/**
sl@0
  2971
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0021
sl@0
  2972
@SYMPREQ				PREQ1226
sl@0
  2973
@SYMREQ					REQ9677,REQ9683,
sl@0
  2974
@SYMTestPriority		High
sl@0
  2975
@SYMTestCaseDesc		Checks Wserv supports Grabbing in case of multi pointer events.
sl@0
  2976
@SYMTestStatus			Implemented
sl@0
  2977
sl@0
  2978
@SYMTestActions			Simulate EButton1Down events on iParentWin. Simulate Drag and Button1Up events on iChildWin.
sl@0
  2979
 						SetPointerGrab is called on iParentWin for first test and disabled for the second. 
sl@0
  2980
@SYMTestExpectedResults The Drag and Button1Up events contain a handle to iParentWin when Grabbing active. 
sl@0
  2981
						The Drag and Button1Up events contain a handle to iChildWin when Grabbing disabled.
sl@0
  2982
*/
sl@0
  2983
void CTMultiPtrEventTest::GrabbingMultiPointerEvents()
sl@0
  2984
	{
sl@0
  2985
	// Test Grabbing of multi pointer events
sl@0
  2986
	// 1. Test Wserv supports Grabbing in case of multi-pointer events
sl@0
  2987
	// 2. Test pointer events are delivered correctly when Grabbing is disabled.
sl@0
  2988
	TLogMessageText logText;
sl@0
  2989
	_LIT(KSet, "GrabbingMultiPtrEvents SetOfEvents: %d of 2");
sl@0
  2990
	logText.AppendFormat(KSet, iEventSet);
sl@0
  2991
	LOG_MESSAGE(logText);
sl@0
  2992
	
sl@0
  2993
	if (!iEventSet)
sl@0
  2994
		{
sl@0
  2995
		SetAutoFlush();
sl@0
  2996
		}
sl@0
  2997
	
sl@0
  2998
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  2999
sl@0
  3000
	TPoint ptrPos;
sl@0
  3001
		
sl@0
  3002
	switch(iEventSet++)
sl@0
  3003
		{
sl@0
  3004
		case 0:
sl@0
  3005
			INFO_PRINTF1(_L("Check Wserv supports Grabbing in case of multi-pointer events"));
sl@0
  3006
			// Check pointer events are delivered to the window where the EButton1Down event occured, 
sl@0
  3007
			// even if subsequent events are simulated outside this window.
sl@0
  3008
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  3009
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
sl@0
  3010
			iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(ETrue);
sl@0
  3011
			TestGrabbingForMultiPointer(ETrue);
sl@0
  3012
			break;	
sl@0
  3013
		case 1:
sl@0
  3014
			INFO_PRINTF1(_L("Check pointer events are delivered correctly when Grabbing is disabled."));
sl@0
  3015
			// Check pointer events are delivered to the window on which they occured.					
sl@0
  3016
			iMultiPtrEventClient->ParentWin()->BaseWin()->SetPointerGrab(EFalse);
sl@0
  3017
			TestGrabbingForMultiPointer(EFalse);
sl@0
  3018
			break;	
sl@0
  3019
		default:
sl@0
  3020
			ResetFlushStopAS();
sl@0
  3021
			break;
sl@0
  3022
		}
sl@0
  3023
	LogEventsAdded();
sl@0
  3024
	}
sl@0
  3025
sl@0
  3026
/**
sl@0
  3027
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0025
sl@0
  3028
@SYMPREQ				PREQ1226
sl@0
  3029
@SYMREQ					REQ9677,REQ9683,
sl@0
  3030
@SYMTestPriority		High
sl@0
  3031
@SYMTestCaseDesc		Checks Wserv supports Filtering in case of multi pointer events.
sl@0
  3032
@SYMTestStatus			Implemented
sl@0
  3033
sl@0
  3034
@SYMTestActions			Simulate Move and Drag events. Add only Button1Up and Button1Down to TWsEvent buffer.
sl@0
  3035
   						Disable Filtering and repeat test with the addition of Move and Drag events to TWsEvent buffer. 
sl@0
  3036
@SYMTestExpectedResults The received events must match the expected simulated raw events
sl@0
  3037
						The received events must match the simulated raw events
sl@0
  3038
*/
sl@0
  3039
void CTMultiPtrEventTest::FilteringMultiPointerEvents()
sl@0
  3040
	{
sl@0
  3041
	// Test Filtering of multi pointer events
sl@0
  3042
	// 1. Test pointer move and drag events are filtered correctly by Wserv
sl@0
  3043
	// 2. Test pointer events are delivered correctly when Filtered is disabled.
sl@0
  3044
	TLogMessageText logText;
sl@0
  3045
	_LIT(KSet, "FilteringMultiPtrEvents SetOfEvents: %d of 2");
sl@0
  3046
	logText.AppendFormat(KSet, iEventSet);
sl@0
  3047
	LOG_MESSAGE(logText);
sl@0
  3048
	
sl@0
  3049
	if (!iEventSet)
sl@0
  3050
		{
sl@0
  3051
		SetAutoFlush();
sl@0
  3052
		}
sl@0
  3053
	
sl@0
  3054
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  3055
sl@0
  3056
	TPoint ptrPos;
sl@0
  3057
		
sl@0
  3058
	switch(iEventSet++)
sl@0
  3059
		{
sl@0
  3060
		case 0:
sl@0
  3061
			INFO_PRINTF1(_L("Check pointer move and drag events are filtered with multi-pointer events"));
sl@0
  3062
			// Check pointer move and drag events are filtered by Wserv
sl@0
  3063
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  3064
			
sl@0
  3065
			// Ensure default values are set i.e. Drag and Move events are filtered out and not delivered to the client.
sl@0
  3066
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove,
sl@0
  3067
																		EPointerFilterDrag|EPointerFilterMove);
sl@0
  3068
			TestFilteringForMultiPointer(ETrue);
sl@0
  3069
			break;	
sl@0
  3070
		case 1:
sl@0
  3071
			INFO_PRINTF1(_L("Check pointer move and drag events are not filtered, with multi-pointer events, when filtering is disabled"));
sl@0
  3072
			// Check move and drag events are not filtered by Wserv when filtering is disabled					
sl@0
  3073
sl@0
  3074
			// Enable Drag and Move events
sl@0
  3075
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag|EPointerFilterMove, 0);
sl@0
  3076
			TestFilteringForMultiPointer(EFalse);
sl@0
  3077
			break;				
sl@0
  3078
		default:
sl@0
  3079
			ResetFlushStopAS();
sl@0
  3080
			break;
sl@0
  3081
		}
sl@0
  3082
	LogEventsAdded();
sl@0
  3083
	}
sl@0
  3084
sl@0
  3085
void CTMultiPtrEventTest::SetDefaultScreenMode()
sl@0
  3086
	{
sl@0
  3087
	iMultiPtrEventClient->iScreen->SetAppScreenMode(0);
sl@0
  3088
	TheClient->iScreen->SetAppScreenMode(0);
sl@0
  3089
	iMultiPtrEventClient->iScreen->SetScreenMode(0);
sl@0
  3090
	iMultiPtrEventClient->iScreen->SetCurrentRotations(0, CFbsBitGc::EGraphicsOrientationNormal);
sl@0
  3091
	}
sl@0
  3092
sl@0
  3093
TPoint PhysicalToLogical(TPoint aPhysicalPt, TPoint aOrigin, TSize aSize)
sl@0
  3094
	{
sl@0
  3095
	return PhysicalToLogical(aPhysicalPt-aOrigin, aSize);
sl@0
  3096
	}
sl@0
  3097
sl@0
  3098
TPoint CTMultiPtrEventTest::GetPointerPostionOnRotatedMode(TPoint aPointerPos, CFbsBitGc::TGraphicsOrientation aRotation)
sl@0
  3099
	{
sl@0
  3100
	if (aRotation == CFbsBitGc::EGraphicsOrientationNormal)
sl@0
  3101
		{
sl@0
  3102
		return aPointerPos;
sl@0
  3103
		}
sl@0
  3104
	else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated90)
sl@0
  3105
		{
sl@0
  3106
		// here width is actually height in rotated mode
sl@0
  3107
		return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iY - 1, aPointerPos.iX);
sl@0
  3108
		}
sl@0
  3109
	else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated180)
sl@0
  3110
		{
sl@0
  3111
		return TPoint(iPhysicalScreenSize.iWidth - aPointerPos.iX - 1, iPhysicalScreenSize.iHeight - aPointerPos.iY - 1);
sl@0
  3112
		}
sl@0
  3113
	else if (aRotation == CFbsBitGc::EGraphicsOrientationRotated270)
sl@0
  3114
		{
sl@0
  3115
		// here width is actually height in rotated mode
sl@0
  3116
		return TPoint(aPointerPos.iY, iPhysicalScreenSize.iHeight - aPointerPos.iX -1);
sl@0
  3117
		}
sl@0
  3118
	return TPoint(0,0);
sl@0
  3119
	}
sl@0
  3120
sl@0
  3121
/**
sl@0
  3122
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0028
sl@0
  3123
@SYMPREQ				PREQ1226
sl@0
  3124
@SYMREQ					REQ9677, REQ9683
sl@0
  3125
@SYMTestPriority		High 
sl@0
  3126
@SYMTestCaseDesc		To check Wserv sends multi pointer events in Different screen modes
sl@0
  3127
@SYMTestStatus			Implemented
sl@0
  3128
sl@0
  3129
@SYMTestActions			Simulate multi pointer events in Different screenmodes
sl@0
  3130
@SYMTestExpectedResults The received events must match the simulated raw events  
sl@0
  3131
*/
sl@0
  3132
void CTMultiPtrEventTest::MultiPointerEventsInDiffScreenModes()
sl@0
  3133
	{
sl@0
  3134
	// Logic inloved, For a particular screen mode check pointer down/up, moves and drags
sl@0
  3135
	// for different pointers and for different co-ordinates.
sl@0
  3136
	// For each screen mode check these events on diffferent rotation that screen mode supports
sl@0
  3137
	// During the last switch case increment the screenmode
sl@0
  3138
	TLogMessageText logText;
sl@0
  3139
	_LIT(KSet, "Multi pointer events in screenmode(%d): %d of 2");
sl@0
  3140
	logText.AppendFormat(KSet, iCurrentScreenMode+1, iEventSet);
sl@0
  3141
	LOG_MESSAGE(logText);
sl@0
  3142
	
sl@0
  3143
	TInt numScrMode = iMultiPtrEventClient->iScreen->NumScreenModes();
sl@0
  3144
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  3145
	
sl@0
  3146
	if (!iEventSet && !iChangeScreenMode)
sl@0
  3147
		{
sl@0
  3148
		SetAutoFlush();
sl@0
  3149
		iChangeScreenMode = ETrue;
sl@0
  3150
		AddExpectedWsEvent(EEventFocusGained);
sl@0
  3151
		}
sl@0
  3152
	else
sl@0
  3153
		{
sl@0
  3154
		if (iChangeScreenMode)
sl@0
  3155
			{
sl@0
  3156
			if (iCurrentScreenMode >= numScrMode)
sl@0
  3157
				{
sl@0
  3158
EndFun:
sl@0
  3159
				SetDefaultScreenMode();
sl@0
  3160
				ResetFlushStopAS();
sl@0
  3161
				return;
sl@0
  3162
				}
sl@0
  3163
			}
sl@0
  3164
		}
sl@0
  3165
sl@0
  3166
	if (iChangeScreenMode)
sl@0
  3167
		{
sl@0
  3168
		iMultiPtrEventClient->iScreen->SetAppScreenMode(iCurrentScreenMode);
sl@0
  3169
		TheClient->iScreen->SetAppScreenMode(iCurrentScreenMode);
sl@0
  3170
		iMultiPtrEventClient->iScreen->SetScreenMode(iCurrentScreenMode);
sl@0
  3171
		iChangeScreenMode = EFalse;
sl@0
  3172
		}
sl@0
  3173
	
sl@0
  3174
	CArrayFixFlat<TInt>* rotations = NULL;
sl@0
  3175
	TRAPD(err, 
sl@0
  3176
			rotations = new(ELeave) CArrayFixFlat<TInt>(1);
sl@0
  3177
			iMultiPtrEventClient->iScreen->GetRotationsList(iCurrentScreenMode, rotations));
sl@0
  3178
	if (err != KErrNone)
sl@0
  3179
		{
sl@0
  3180
		if (iEventSet)
sl@0
  3181
			{
sl@0
  3182
			goto EndFun;
sl@0
  3183
			}
sl@0
  3184
		else
sl@0
  3185
			{
sl@0
  3186
			return;
sl@0
  3187
			}
sl@0
  3188
		}
sl@0
  3189
sl@0
  3190
#if !defined(__WINS__)	
sl@0
  3191
	TPoint ptrRotatedPos;
sl@0
  3192
	TPoint ptrNormalPos;
sl@0
  3193
#else
sl@0
  3194
	TPoint ptrPhyPos;
sl@0
  3195
#endif
sl@0
  3196
	TPoint ptrLogPos;	
sl@0
  3197
	
sl@0
  3198
	TInt ptrNum = 0;
sl@0
  3199
	TInt proxValue = 0;
sl@0
  3200
	// Since screenmode positioning and screenmode scaling is not supported in NGA wserv2
sl@0
  3201
	// but it is supported in Non NGA. But for NGA it will return (0,0) as origin and (1,1) as scale.
sl@0
  3202
	TPoint screenOrigin(iMultiPtrEventClient->iScreen->GetDefaultScreenModeOrigin());
sl@0
  3203
	TPoint scaledScreenOrigin(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScaledOrigin());
sl@0
  3204
	TSize scale(iMultiPtrEventClient->iScreen->GetCurrentScreenModeScale());
sl@0
  3205
	
sl@0
  3206
	switch(iEventSet++)
sl@0
  3207
		{
sl@0
  3208
		case 0:
sl@0
  3209
			// Simulate Pointer down/up for different rotations of a screenmode
sl@0
  3210
			for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++)
sl@0
  3211
				{
sl@0
  3212
				CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]);
sl@0
  3213
				iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation);
sl@0
  3214
				
sl@0
  3215
#if !defined(__WINS__)
sl@0
  3216
				ptrNormalPos = screenOrigin;
sl@0
  3217
				ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
sl@0
  3218
				SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
sl@0
  3219
				ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);				
sl@0
  3220
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3221
				
sl@0
  3222
				ptrNormalPos.iX += 10;
sl@0
  3223
				ptrNormalPos.iY += 5;
sl@0
  3224
				ptrNum = iMaxDevPointers/2;
sl@0
  3225
				ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
sl@0
  3226
				SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
sl@0
  3227
				ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);				
sl@0
  3228
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3229
				
sl@0
  3230
				ptrNormalPos.iX += 5;
sl@0
  3231
				ptrNormalPos.iY += 10;
sl@0
  3232
				ptrNum = iMaxDevPointers-1;
sl@0
  3233
				ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
sl@0
  3234
				SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
sl@0
  3235
				ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);				
sl@0
  3236
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3237
				ptrNum = 0;
sl@0
  3238
#else
sl@0
  3239
				// This is not needed for NGA, becasue NGA wserv does not support positioning and scaling 
sl@0
  3240
				// but for early access we are deliverying for NonNGA so we need it. 
sl@0
  3241
				ptrPhyPos = screenOrigin;
sl@0
  3242
				ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
sl@0
  3243
				SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
sl@0
  3244
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3245
				ptrPhyPos.iX += 10;
sl@0
  3246
				ptrPhyPos.iY += 5;
sl@0
  3247
				ptrNum = iMaxDevPointers/2;
sl@0
  3248
				ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
sl@0
  3249
				SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
sl@0
  3250
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3251
				ptrPhyPos.iX += 5;
sl@0
  3252
				ptrPhyPos.iY += 10;
sl@0
  3253
				ptrNum = iMaxDevPointers-1;
sl@0
  3254
				ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
sl@0
  3255
				SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
sl@0
  3256
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3257
				ptrNum = 0;
sl@0
  3258
#endif
sl@0
  3259
				}
sl@0
  3260
			break;
sl@0
  3261
		case 1:
sl@0
  3262
			// Simulate moves for different rotations of a screenmode with different Proximity
sl@0
  3263
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0);
sl@0
  3264
			for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++)
sl@0
  3265
				{
sl@0
  3266
				CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]);
sl@0
  3267
				iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation);
sl@0
  3268
				
sl@0
  3269
#if !defined(__WINS__)				
sl@0
  3270
				ptrNormalPos = screenOrigin;
sl@0
  3271
				ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
sl@0
  3272
				proxValue = -iProximityStep;
sl@0
  3273
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum);
sl@0
  3274
				ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);			
sl@0
  3275
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
sl@0
  3276
				SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
sl@0
  3277
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3278
				
sl@0
  3279
				ptrNormalPos.iX += 10;
sl@0
  3280
				ptrNormalPos.iY += 5;
sl@0
  3281
				ptrNum = iMaxDevPointers/2;
sl@0
  3282
				if (proxValue-iProximityStep > iMaxProximity)
sl@0
  3283
					{
sl@0
  3284
					proxValue -= iProximityStep;
sl@0
  3285
					}
sl@0
  3286
				ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
sl@0
  3287
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrRotatedPos.iX, ptrRotatedPos.iY, proxValue, ptrNum);
sl@0
  3288
				ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);								
sl@0
  3289
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
sl@0
  3290
				SimulatePointerDownUp(ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
sl@0
  3291
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3292
				ptrNum = 0;
sl@0
  3293
#else
sl@0
  3294
				ptrPhyPos = screenOrigin;
sl@0
  3295
				proxValue = -iProximityStep;
sl@0
  3296
				ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
sl@0
  3297
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum);
sl@0
  3298
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
sl@0
  3299
				SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
sl@0
  3300
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3301
				
sl@0
  3302
				ptrPhyPos.iX += 10;
sl@0
  3303
				ptrPhyPos.iY += 5;
sl@0
  3304
				ptrNum = iMaxDevPointers/2;
sl@0
  3305
				if (proxValue-iProximityStep > iMaxProximity)
sl@0
  3306
					{
sl@0
  3307
					proxValue -= iProximityStep;
sl@0
  3308
					}
sl@0
  3309
				ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
sl@0
  3310
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPhyPos.iX, ptrPhyPos.iY, proxValue, ptrNum);
sl@0
  3311
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrLogPos, proxValue, 0, ptrNum);
sl@0
  3312
				SimulatePointerDownUp(ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
sl@0
  3313
				AddExpectedPointerDownUp(ptrLogPos, 0, ptrNum);
sl@0
  3314
				ptrNum = 0;
sl@0
  3315
#endif
sl@0
  3316
				}
sl@0
  3317
			break;
sl@0
  3318
		case 2:
sl@0
  3319
			{
sl@0
  3320
			// Simulate drags for different rotations of a screenmode
sl@0
  3321
#if !defined(__WINS__)
sl@0
  3322
			TPoint intNormalPt;
sl@0
  3323
			TPoint intRotatedPt;
sl@0
  3324
#else
sl@0
  3325
			TPoint interPhyPt;
sl@0
  3326
			TPoint interLogPt;
sl@0
  3327
#endif			
sl@0
  3328
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0);
sl@0
  3329
			for (TInt rotCou = 0; rotCou < rotations->Count(); rotCou++)
sl@0
  3330
				{
sl@0
  3331
				CFbsBitGc::TGraphicsOrientation newOrientation = static_cast<CFbsBitGc::TGraphicsOrientation>(rotations[0][rotCou]);
sl@0
  3332
				iMultiPtrEventClient->iScreen->SetCurrentRotations(iCurrentScreenMode, newOrientation);
sl@0
  3333
#if !defined(__WINS__)				
sl@0
  3334
				ptrNormalPos = screenOrigin;
sl@0
  3335
				intNormalPt.iX = ptrNormalPos.iX+4;
sl@0
  3336
				intNormalPt.iY = ptrNormalPos.iY+5;
sl@0
  3337
				ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
sl@0
  3338
				intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation);				
sl@0
  3339
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
sl@0
  3340
				SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
sl@0
  3341
				SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
sl@0
  3342
				ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);				
sl@0
  3343
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
sl@0
  3344
				TPoint intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale);				
sl@0
  3345
				AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum);
sl@0
  3346
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum);
sl@0
  3347
				
sl@0
  3348
				ptrNormalPos.iX += 10;
sl@0
  3349
				ptrNormalPos.iY += 5;
sl@0
  3350
				ptrNum = iMaxDevPointers-1;
sl@0
  3351
				intNormalPt.iX = ptrNormalPos.iX+5;
sl@0
  3352
				intNormalPt.iY = ptrNormalPos.iY+4;
sl@0
  3353
				ptrRotatedPos = GetPointerPostionOnRotatedMode(ptrNormalPos, newOrientation);
sl@0
  3354
				intRotatedPt = GetPointerPostionOnRotatedMode(intNormalPt, newOrientation);
sl@0
  3355
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrRotatedPos.iX, ptrRotatedPos.iY, 0, ptrNum);
sl@0
  3356
				SimulatePointerEvent(TRawEvent::EPointerMove, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
sl@0
  3357
				SimulatePointerEvent(TRawEvent::EButton1Up, intRotatedPt.iX, intRotatedPt.iY, 0, ptrNum);
sl@0
  3358
				ptrLogPos = PhysicalToLogical(ptrNormalPos, screenOrigin, scale);
sl@0
  3359
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
sl@0
  3360
				intLogPt = PhysicalToLogical(intNormalPt, screenOrigin, scale);
sl@0
  3361
				AddExpectedPointerEvent(TPointerEvent::EDrag, intLogPt, 0, 0, ptrNum);
sl@0
  3362
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, intLogPt, 0, 0, ptrNum);
sl@0
  3363
sl@0
  3364
				ptrNum = 0;
sl@0
  3365
#else
sl@0
  3366
				ptrPhyPos = screenOrigin;
sl@0
  3367
				interPhyPt.iX = ptrPhyPos.iX+4;
sl@0
  3368
				interPhyPt.iY = ptrPhyPos.iY+5;
sl@0
  3369
				ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
sl@0
  3370
				interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale);
sl@0
  3371
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
sl@0
  3372
				SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
sl@0
  3373
				SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
sl@0
  3374
				interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale);
sl@0
  3375
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
sl@0
  3376
				AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum);
sl@0
  3377
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum);
sl@0
  3378
				
sl@0
  3379
				ptrPhyPos.iX += 10;
sl@0
  3380
				ptrPhyPos.iY += 5;
sl@0
  3381
				ptrNum = iMaxDevPointers-1;
sl@0
  3382
				interPhyPt.iX = ptrPhyPos.iX+5;
sl@0
  3383
				interPhyPt.iY = ptrPhyPos.iY+4;
sl@0
  3384
				
sl@0
  3385
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPhyPos.iX, ptrPhyPos.iY, 0, ptrNum);
sl@0
  3386
				SimulatePointerEvent(TRawEvent::EPointerMove, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
sl@0
  3387
				SimulatePointerEvent(TRawEvent::EButton1Up, interPhyPt.iX, interPhyPt.iY, 0, ptrNum);
sl@0
  3388
				
sl@0
  3389
				ptrLogPos = PhysicalToLogical(ptrPhyPos, screenOrigin, scale);
sl@0
  3390
				interLogPt = PhysicalToLogical(interPhyPt, screenOrigin, scale);
sl@0
  3391
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrLogPos, 0, 0, ptrNum);
sl@0
  3392
				AddExpectedPointerEvent(TPointerEvent::EDrag, interLogPt, 0, 0, ptrNum);
sl@0
  3393
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interLogPt, 0, 0, ptrNum);
sl@0
  3394
				ptrNum = 0;
sl@0
  3395
#endif
sl@0
  3396
				}
sl@0
  3397
			}
sl@0
  3398
			iChangeScreenMode = ETrue;
sl@0
  3399
			iEventSet = 0;
sl@0
  3400
			iCurrentScreenMode++;
sl@0
  3401
			break;
sl@0
  3402
		default:
sl@0
  3403
			break;
sl@0
  3404
		}
sl@0
  3405
	
sl@0
  3406
	delete rotations;
sl@0
  3407
	
sl@0
  3408
	LogEventsAdded();
sl@0
  3409
	}
sl@0
  3410
sl@0
  3411
/* 
sl@0
  3412
 Checks if pointer click plugin has an error when testing its events
sl@0
  3413
 If so then it gets the error deescription and displays the same
sl@0
  3414
 */
sl@0
  3415
void CTMultiPtrEventTest::TestAndDisplayPtrClickError()
sl@0
  3416
	{
sl@0
  3417
	TPckgBuf<TInt> intPkg;
sl@0
  3418
	TInt retErr = iClick.CommandReply(EMultiPtrClickEventError, intPkg);
sl@0
  3419
	if (retErr != KErrNone)
sl@0
  3420
		{
sl@0
  3421
		_LIT(KError, "Failed in Pointer click plugin");
sl@0
  3422
		LOG_MESSAGE(KError);
sl@0
  3423
		// Error is ignored here, becasue this function should not leave
sl@0
  3424
		TRAPD(errMem, iErrDesc = iHeap->AllocL(KErrDescSize));
sl@0
  3425
		if (errMem == KErrNone)
sl@0
  3426
			{
sl@0
  3427
			intPkg() = reinterpret_cast<TUint8*>(iErrDesc) - iChunk.Base() ;
sl@0
  3428
			
sl@0
  3429
			// get the error desccription, print it out and stop the tests
sl@0
  3430
			TInt retVal = iClick.CommandReply(EADllMultiPtrEventErrorDesc, intPkg);
sl@0
  3431
			if (retVal > KErrNone)
sl@0
  3432
				{
sl@0
  3433
				TPtr8 memPtr2(reinterpret_cast<TUint8*>(iErrDesc), retVal, retVal);
sl@0
  3434
				HBufC16* buf16 = NULL;
sl@0
  3435
				TRAPD(err, buf16 = HBufC16::NewL(retVal));		// Error is ignored here
sl@0
  3436
				if (err == KErrNone)
sl@0
  3437
					{
sl@0
  3438
					buf16->Des().Copy(memPtr2);
sl@0
  3439
					LOG_MESSAGE(buf16->Des());
sl@0
  3440
					delete buf16;
sl@0
  3441
					}
sl@0
  3442
				}
sl@0
  3443
			iHeap->Free(iErrDesc);
sl@0
  3444
			}
sl@0
  3445
		Failed();
sl@0
  3446
		}
sl@0
  3447
	iClick.CommandReply(EMultiPtrClickEventReset, intPkg);
sl@0
  3448
	}
sl@0
  3449
sl@0
  3450
void CTMultiPtrEventTest::AddExpectedMultiPtrClickEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle)
sl@0
  3451
	{
sl@0
  3452
	TPckgBuf<TWsEvent> evtPkg;
sl@0
  3453
	TWsEvent& event=evtPkg();
sl@0
  3454
	event.SetType(EEventPointer);
sl@0
  3455
	iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle);
sl@0
  3456
	
sl@0
  3457
	// change the parent position here as they r with respect to screen corodinates.
sl@0
  3458
	event.Pointer()->iParentPosition = aPos;
sl@0
  3459
	
sl@0
  3460
	iClick.CommandReply(EMultiPtrClickEventAdd, evtPkg);
sl@0
  3461
	AddExpectedMultiPtrClickOtherEvent(aType, aPos, aZ, aModifier, aPointerNumber, aHandle);
sl@0
  3462
	}
sl@0
  3463
sl@0
  3464
void CTMultiPtrEventTest::AddExpectedMultiPtrClickOtherEvent(TPointerEvent::TType aType, TPoint aPos, TInt aZ, TUint aModifier, TUint8 aPointerNumber, TUint aHandle)
sl@0
  3465
	{
sl@0
  3466
	TWsEvent event;
sl@0
  3467
	event.SetType(EEventPointer);
sl@0
  3468
	iMultiPtrEventClient->CalculatePtrPosAndSet3Ddata(event, aType, aPos, aModifier, aZ, aPointerNumber, aHandle);
sl@0
  3469
sl@0
  3470
	TPointerEventData otherEvent;
sl@0
  3471
	otherEvent.iClientHandle = event.Handle();
sl@0
  3472
	otherEvent.iCurrentPos = aPos;
sl@0
  3473
	otherEvent.iPointerEvent = *event.Pointer();
sl@0
  3474
	
sl@0
  3475
	TPckgBuf<TPointerEventData> evtPkg(otherEvent);
sl@0
  3476
	iClick.CommandReply(EMultiPtrOtherEventAdd, evtPkg);
sl@0
  3477
	}
sl@0
  3478
sl@0
  3479
/* 
sl@0
  3480
 Function of creating 
sl@0
  3481
 1. Pointer click plugin
sl@0
  3482
 2. RChunk for transfering error description from pointer click plugin to current test
sl@0
  3483
 3. RHeap for allocating memory in RChunk
sl@0
  3484
*/
sl@0
  3485
void CTMultiPtrEventTest::CreatePointerClickPluginL()
sl@0
  3486
	{
sl@0
  3487
	// tranfer this to another function
sl@0
  3488
	iClick=RSoundPlugIn(TheClient->iWs);
sl@0
  3489
	User::LeaveIfError(iClick.Construct(TUid::Uid(MULTIPTR_CLICK_THIRD_UID)));
sl@0
  3490
	TBool ptrPluginLoadable = EFalse;
sl@0
  3491
	iClick.IsLoaded(ptrPluginLoadable);
sl@0
  3492
	if (ptrPluginLoadable)
sl@0
  3493
		{
sl@0
  3494
		User::LeaveIfError(iClick.Load(KMultiPtrPluginDll));
sl@0
  3495
		iPtrPluginLoaded = ETrue;
sl@0
  3496
		}
sl@0
  3497
	iClick.SetPenClick(ETrue);
sl@0
  3498
	iHeap = UserHeap::ChunkHeap(&KMultiPtrClickChunk, 128, 256, 10);
sl@0
  3499
	if (iHeap == NULL)
sl@0
  3500
		{
sl@0
  3501
		User::LeaveNoMemory();
sl@0
  3502
		}
sl@0
  3503
	User::LeaveIfError(iChunk.OpenGlobal(KMultiPtrClickChunk, ETrue));
sl@0
  3504
	}
sl@0
  3505
sl@0
  3506
/**
sl@0
  3507
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0027
sl@0
  3508
@SYMPREQ				PREQ1226
sl@0
  3509
@SYMREQ					REQ9677, REQ9683
sl@0
  3510
@SYMTestPriority		High 
sl@0
  3511
@SYMTestCaseDesc		To check Wserv sends multi pointer events to PointerClickPlugin
sl@0
  3512
@SYMTestStatus			Implemented
sl@0
  3513
sl@0
  3514
@SYMTestActions			Simulate multi pointer events for PointerClickPlugin
sl@0
  3515
@SYMTestExpectedResults The received events must match the simulated raw events  
sl@0
  3516
*/
sl@0
  3517
void CTMultiPtrEventTest::MultiPointerEventsForPointerClickL()
sl@0
  3518
	{
sl@0
  3519
	TLogMessageText logText;
sl@0
  3520
	_LIT(KSet, "Multi pointer events for PointerClickPlugin: %d of 4");
sl@0
  3521
	logText.AppendFormat(KSet, iEventSet);
sl@0
  3522
	LOG_MESSAGE(logText);
sl@0
  3523
	
sl@0
  3524
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  3525
	if (!iEventSet)
sl@0
  3526
		{
sl@0
  3527
		SetAutoFlush();
sl@0
  3528
		}
sl@0
  3529
	
sl@0
  3530
	TPoint ptrPos;
sl@0
  3531
	TInt ptrNum = 0;
sl@0
  3532
	TInt prValue = 0;
sl@0
  3533
	TInt proxValue = 0;
sl@0
  3534
	TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
sl@0
  3535
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
sl@0
  3536
 	
sl@0
  3537
	switch(iEventSet++)
sl@0
  3538
		{
sl@0
  3539
		case 0:
sl@0
  3540
			// Creates RSoundPlugin, loads the plugin DLL, create RChunk and RHeap
sl@0
  3541
			CreatePointerClickPluginL();
sl@0
  3542
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  3543
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  3544
				{
sl@0
  3545
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  3546
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  3547
				AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
sl@0
  3548
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3549
				ptrPos.iX += xInc;
sl@0
  3550
				ptrPos.iY += yInc;
sl@0
  3551
				}
sl@0
  3552
			TestAndDisplayPtrClickError();
sl@0
  3553
			break;
sl@0
  3554
		case 1:
sl@0
  3555
			// Simulate moves from different pointer with different pressure
sl@0
  3556
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove,0);
sl@0
  3557
			iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove,0);
sl@0
  3558
			ptrPos.SetXY(0,0);
sl@0
  3559
			prValue = iPressureStep;
sl@0
  3560
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  3561
				{
sl@0
  3562
				AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
sl@0
  3563
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum);
sl@0
  3564
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum);
sl@0
  3565
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
sl@0
  3566
				AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
sl@0
  3567
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  3568
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3569
				ptrPos.iX += xInc;
sl@0
  3570
				ptrPos.iY += yInc;
sl@0
  3571
				}
sl@0
  3572
			TestAndDisplayPtrClickError();
sl@0
  3573
			break;
sl@0
  3574
		case 2:
sl@0
  3575
			// Simulate moves from different pointer with different proximity
sl@0
  3576
			ptrPos.SetXY(0,0);
sl@0
  3577
			proxValue = -iProximityStep;
sl@0
  3578
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  3579
				{
sl@0
  3580
				AddExpectedMultiPtrClickEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  3581
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down,ptrPos,0,0,ptrNum);
sl@0
  3582
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up,ptrPos,0,0,ptrNum);
sl@0
  3583
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  3584
				AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
sl@0
  3585
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  3586
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3587
				ptrPos.iX += xInc;
sl@0
  3588
				ptrPos.iY += yInc;
sl@0
  3589
				}
sl@0
  3590
			TestAndDisplayPtrClickError();
sl@0
  3591
			break;
sl@0
  3592
		case 3:
sl@0
  3593
			{
sl@0
  3594
			// Simulate drags from all pointers
sl@0
  3595
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0);
sl@0
  3596
			iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag,0);
sl@0
  3597
			ptrPos.SetXY(0,0);
sl@0
  3598
			TPoint interPt;
sl@0
  3599
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  3600
				{
sl@0
  3601
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  3602
				interPt.iX = ptrPos.iX+1;
sl@0
  3603
				interPt.iY = ptrPos.iY+2;
sl@0
  3604
				AddExpectedMultiPtrClickEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
sl@0
  3605
				AddExpectedMultiPtrClickEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
sl@0
  3606
				
sl@0
  3607
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  3608
				AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
sl@0
  3609
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
sl@0
  3610
				
sl@0
  3611
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3612
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  3613
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  3614
				
sl@0
  3615
				ptrPos.iX += xInc;
sl@0
  3616
				ptrPos.iY += yInc;
sl@0
  3617
				}
sl@0
  3618
			TestAndDisplayPtrClickError();
sl@0
  3619
			}
sl@0
  3620
			break;
sl@0
  3621
		default:
sl@0
  3622
			iClick.Unload();
sl@0
  3623
			iClick.Close();
sl@0
  3624
			iPtrPluginLoaded = EFalse;
sl@0
  3625
			iHeap->Close();
sl@0
  3626
			iHeap = NULL;
sl@0
  3627
			iChunk.Close();
sl@0
  3628
			ResetFlushStopAS();
sl@0
  3629
			break;
sl@0
  3630
		}
sl@0
  3631
sl@0
  3632
	LogEventsAdded();
sl@0
  3633
	}
sl@0
  3634
sl@0
  3635
void CTMultiPtrEventTest::GetRemainingEventsFromSecondaryClient()
sl@0
  3636
	{
sl@0
  3637
	if (iSecMultiPtrEventClient->EventBuffer()->EventsRemaining() != 0)
sl@0
  3638
		{
sl@0
  3639
		iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(ETrue);
sl@0
  3640
		CActiveScheduler::Start();
sl@0
  3641
		}	
sl@0
  3642
	}
sl@0
  3643
sl@0
  3644
/**
sl@0
  3645
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0011
sl@0
  3646
@SYMPREQ				PREQ1226
sl@0
  3647
@SYMREQ					REQ9677,REQ9674,
sl@0
  3648
@SYMTestPriority		High 
sl@0
  3649
@SYMTestCaseDesc		To check Wserv sends Multi Pointer events to correct clients
sl@0
  3650
@SYMTestStatus			Implemented
sl@0
  3651
sl@0
  3652
@SYMTestActions			Simulate multi pointer events on windows from different client.
sl@0
  3653
@SYMTestExpectedResults The received events must match the simulated raw events 
sl@0
  3654
*/
sl@0
  3655
void CTMultiPtrEventTest::MultiClientMultiPointerEvents()
sl@0
  3656
	{
sl@0
  3657
	// Logic for this test code
sl@0
  3658
	// Create a secondary client when running this test
sl@0
  3659
	// Simulate events for both main client and secondary simulataneously
sl@0
  3660
	// Get events from DoRunL() of event buffer class
sl@0
  3661
	// Before running next set of events, get all the events from secondary client
sl@0
  3662
	// If test fails on any client make sure both active scheduler are stopped
sl@0
  3663
	TLogMessageText logText;
sl@0
  3664
	_LIT(KSet, "Multi pointer events for Multi client: %d of 5");
sl@0
  3665
	logText.AppendFormat(KSet, iEventSet);
sl@0
  3666
	LOG_MESSAGE(logText);
sl@0
  3667
	
sl@0
  3668
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  3669
	iSecMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  3670
	if (!iEventSet)
sl@0
  3671
		{
sl@0
  3672
		SetAutoFlush();
sl@0
  3673
		iSecClientFlush = iSecMultiPtrEventClient->iWs.SetAutoFlush(ETrue);
sl@0
  3674
		}
sl@0
  3675
	
sl@0
  3676
	TPoint ptrPos;
sl@0
  3677
	TInt ptrNum = 0;
sl@0
  3678
	TInt prValue = 0;
sl@0
  3679
	TInt proxValue = 0;
sl@0
  3680
	TInt xInc = (iPhysicalScreenSize.iWidth/2)/iMaxDevPointers;
sl@0
  3681
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
sl@0
  3682
	TPoint secPt(iPhysicalScreenSize.iWidth/2,0);
sl@0
  3683
	TInt ptrSecNum = iMaxDevPointers-1;
sl@0
  3684
 	
sl@0
  3685
	switch(iEventSet++)
sl@0
  3686
		{
sl@0
  3687
		case 0:
sl@0
  3688
			ptrPos.SetXY(0,0);
sl@0
  3689
			
sl@0
  3690
			// These events are generated when primary client is created and its group 
sl@0
  3691
			// window constructed and then when button down for primary client is called
sl@0
  3692
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  3693
			AddExpectedWsEvent(EEventFocusLost);
sl@0
  3694
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  3695
			
sl@0
  3696
			// Simulate pointer down/up events for primary client from 0,1,3... pointers and 6,5,4... pointers for secondary client
sl@0
  3697
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  3698
				{
sl@0
  3699
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3700
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  3701
							
sl@0
  3702
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3703
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  3704
				
sl@0
  3705
				ptrPos.iX += xInc;
sl@0
  3706
				ptrPos.iY += yInc;
sl@0
  3707
				}
sl@0
  3708
			
sl@0
  3709
			ptrPos.iX = iPhysicalScreenSize.iWidth/2;
sl@0
  3710
			ptrPos.iY = 0;
sl@0
  3711
			
sl@0
  3712
			// These events are generated when secondary cleint is created and then when
sl@0
  3713
			// button down for primary client is called, then when SetOrdinalPosition is 
sl@0
  3714
			// called on secondary cleint's group window
sl@0
  3715
			AddExpectedWsEvent(EEventFocusGained, ETrue);
sl@0
  3716
			AddExpectedWsEvent(EEventFocusLost, ETrue);
sl@0
  3717
			iSecMultiPtrEventClient->iGroup->GroupWin()->SetOrdinalPosition(0, 1);
sl@0
  3718
			AddExpectedWsEvent(EEventFocusGained, ETrue);
sl@0
  3719
sl@0
  3720
			AddExpectedWsEvent(EEventFocusLost);
sl@0
  3721
			
sl@0
  3722
			for (ptrNum = iMaxDevPointers/2; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  3723
				{
sl@0
  3724
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3725
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3726
							
sl@0
  3727
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3728
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3729
				
sl@0
  3730
				ptrPos.iX += xInc;
sl@0
  3731
				ptrPos.iY += yInc;
sl@0
  3732
				}
sl@0
  3733
			break;
sl@0
  3734
		case 1:
sl@0
  3735
			// Simulate move events from primary and secondary client simultaneously with pressure
sl@0
  3736
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  3737
			iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  3738
			
sl@0
  3739
			ptrPos.SetXY(0,0);
sl@0
  3740
			prValue = iPressureStep;
sl@0
  3741
				
sl@0
  3742
			for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
sl@0
  3743
				{
sl@0
  3744
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  3745
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
sl@0
  3746
				ptrPos.iX += xInc;
sl@0
  3747
				ptrPos.iY += yInc;
sl@0
  3748
				
sl@0
  3749
				SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, prValue, ptrSecNum);
sl@0
  3750
				AddExpectedPointerEvent(TPointerEvent::EMove, secPt, prValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3751
				secPt.iX += xInc;
sl@0
  3752
				secPt.iY += yInc;
sl@0
  3753
				}
sl@0
  3754
			break;
sl@0
  3755
		case 2:
sl@0
  3756
			// Simulate move events from primary and secondary client simultaneously with proximity
sl@0
  3757
			ptrPos.SetXY(0,0);
sl@0
  3758
			proxValue = -iProximityStep;
sl@0
  3759
			
sl@0
  3760
			for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
sl@0
  3761
				{
sl@0
  3762
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  3763
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  3764
				ptrPos.iX += xInc;
sl@0
  3765
				ptrPos.iY += yInc;
sl@0
  3766
				
sl@0
  3767
				SimulatePointerEvent(TRawEvent::EPointerMove, secPt.iX, secPt.iY, proxValue, ptrSecNum);
sl@0
  3768
				AddExpectedPointerEvent(TPointerEvent::EMove, secPt, proxValue, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3769
				secPt.iX += xInc;
sl@0
  3770
				secPt.iY += yInc;
sl@0
  3771
				}
sl@0
  3772
			break;
sl@0
  3773
		case 3:
sl@0
  3774
			{
sl@0
  3775
			// Simulate drag events on different clients window one after the other 
sl@0
  3776
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
sl@0
  3777
			iSecMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
sl@0
  3778
			
sl@0
  3779
			ptrPos.SetXY(0,0);
sl@0
  3780
			secPt.iX = iPhysicalScreenSize.iWidth/2;
sl@0
  3781
			secPt.iY = 0; 
sl@0
  3782
			ptrSecNum = iMaxDevPointers-1;
sl@0
  3783
			TPoint interPt;
sl@0
  3784
			for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
sl@0
  3785
				{
sl@0
  3786
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3787
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  3788
				interPt.iX = ptrPos.iX+2;
sl@0
  3789
				interPt.iY = ptrPos.iY+1;
sl@0
  3790
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  3791
				AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
sl@0
  3792
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  3793
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
sl@0
  3794
				ptrPos.iX += xInc;
sl@0
  3795
				ptrPos.iY += yInc;
sl@0
  3796
				
sl@0
  3797
				SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum);
sl@0
  3798
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3799
				interPt.iX = secPt.iX+2;
sl@0
  3800
				interPt.iY = secPt.iY+1;
sl@0
  3801
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum);
sl@0
  3802
				AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3803
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum);
sl@0
  3804
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3805
				secPt.iX += xInc;
sl@0
  3806
				secPt.iY += yInc;
sl@0
  3807
				}
sl@0
  3808
			}
sl@0
  3809
			break;
sl@0
  3810
		case 4:
sl@0
  3811
			{
sl@0
  3812
			// Simulate drag events on different clients, but interleaved each other 
sl@0
  3813
			ptrPos.SetXY(0,0);
sl@0
  3814
			secPt.iX = iPhysicalScreenSize.iWidth/2;
sl@0
  3815
			secPt.iY = 0; 
sl@0
  3816
			ptrSecNum = iMaxDevPointers-1;
sl@0
  3817
			TPoint interPt;
sl@0
  3818
			
sl@0
  3819
			for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
sl@0
  3820
				{
sl@0
  3821
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3822
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  3823
				ptrPos.iX += xInc;
sl@0
  3824
				ptrPos.iY += yInc;
sl@0
  3825
				
sl@0
  3826
				SimulatePointerEvent(TRawEvent::EButton1Down, secPt.iX, secPt.iY, 0, ptrSecNum);
sl@0
  3827
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, secPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3828
				secPt.iX += xInc;
sl@0
  3829
				secPt.iY += yInc;
sl@0
  3830
				}
sl@0
  3831
			
sl@0
  3832
			ptrPos.SetXY(0,0);
sl@0
  3833
			secPt.iX = iPhysicalScreenSize.iWidth/2;
sl@0
  3834
			secPt.iY = 0;
sl@0
  3835
			ptrSecNum = iMaxDevPointers-1;
sl@0
  3836
			for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
sl@0
  3837
				{
sl@0
  3838
				interPt.iX = ptrPos.iX+2;
sl@0
  3839
				interPt.iY = ptrPos.iY+1;
sl@0
  3840
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  3841
				AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
sl@0
  3842
				ptrPos.iX += xInc;
sl@0
  3843
				ptrPos.iY += yInc;
sl@0
  3844
				
sl@0
  3845
sl@0
  3846
				interPt.iX = secPt.iX+2;
sl@0
  3847
				interPt.iY = secPt.iY+1;
sl@0
  3848
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrSecNum);
sl@0
  3849
				AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3850
				secPt.iX += xInc;
sl@0
  3851
				secPt.iY += yInc;
sl@0
  3852
				}
sl@0
  3853
sl@0
  3854
			ptrPos.SetXY(0,0);
sl@0
  3855
			secPt.iX = iPhysicalScreenSize.iWidth/2;
sl@0
  3856
			secPt.iY = 0;
sl@0
  3857
			ptrSecNum = iMaxDevPointers-1;
sl@0
  3858
			for (ptrNum = 0; (ptrNum < iMaxDevPointers/2 && ptrSecNum >= iMaxDevPointers/2); ptrNum++, ptrSecNum--)
sl@0
  3859
				{
sl@0
  3860
				interPt.iX = ptrPos.iX+2;
sl@0
  3861
				interPt.iY = ptrPos.iY+1;
sl@0
  3862
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  3863
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
sl@0
  3864
				ptrPos.iX += xInc;
sl@0
  3865
				ptrPos.iY += yInc;
sl@0
  3866
				
sl@0
  3867
				interPt.iX = secPt.iX+2;
sl@0
  3868
				interPt.iY = secPt.iY+1;
sl@0
  3869
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrSecNum);
sl@0
  3870
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrSecNum, (TUint)iSecMultiPtrEventClient->ParentWin(), ETrue);
sl@0
  3871
				secPt.iX += xInc;
sl@0
  3872
				secPt.iY += yInc;
sl@0
  3873
				}
sl@0
  3874
			}
sl@0
  3875
			break;
sl@0
  3876
		default:
sl@0
  3877
			ResetFlushStopAS();
sl@0
  3878
			iSecMultiPtrEventClient->iWs.SetAutoFlush(iSecClientFlush);
sl@0
  3879
			break;
sl@0
  3880
		}
sl@0
  3881
	
sl@0
  3882
	_LIT(KEventsAdded, "Events added to Primary client's buffer = %d");
sl@0
  3883
	logText.Format(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining());
sl@0
  3884
	LOG_MESSAGE(logText);
sl@0
  3885
	_LIT(KEventsAdded1, "Events added to Secondary client's buffer = %d");
sl@0
  3886
	logText.Format(KEventsAdded1, iSecMultiPtrEventClient->EventBuffer()->EventsRemaining());
sl@0
  3887
	LOG_MESSAGE(logText);
sl@0
  3888
	}
sl@0
  3889
sl@0
  3890
sl@0
  3891
// RMultiPointerAnim
sl@0
  3892
RMultiPointerAnim* RMultiPointerAnim::NewL(RWindowBase* aWin, RAnimDll* aDll)
sl@0
  3893
	{
sl@0
  3894
	RMultiPointerAnim* self=new(ELeave) RMultiPointerAnim(aDll);
sl@0
  3895
	CleanupStack::PushL(TCleanupItem(DestroyAnim,self));
sl@0
  3896
	User::LeaveIfError(self->Construct(*aWin, EAnimTypeMultiPointer, TPtrC8()));
sl@0
  3897
	CleanupStack::Pop(self);
sl@0
  3898
	return self;
sl@0
  3899
	}
sl@0
  3900
sl@0
  3901
TInt RMultiPointerAnim::AddExpectedAnimPointerEvent(TRawEvent::TType aType, TPoint aPos, TInt aZ, TUint /*aModifier*/, TUint8 aPointerNumber, TBool aEat /*= ETrue*/)
sl@0
  3902
	{
sl@0
  3903
	TRawEvent rawEvent;
sl@0
  3904
	rawEvent.Set(aType, aPos.iX, aPos.iY, aZ, aPointerNumber);
sl@0
  3905
	TAnimRawEvent animEvent;
sl@0
  3906
	animEvent.iRawEvent = rawEvent;
sl@0
  3907
	animEvent.iEat = aEat;
sl@0
  3908
	TPckgBuf<TAnimRawEvent> param;
sl@0
  3909
	param()=animEvent;
sl@0
  3910
	return CommandReply(EADllAddExpectedMultiPtrEvent, param);
sl@0
  3911
	}
sl@0
  3912
sl@0
  3913
void CTMultiPtrEventTest::TestAndDisplayAnimError()
sl@0
  3914
	{
sl@0
  3915
	TInt err = iAnim->CommandReply(EADllMultiPtrEventError);
sl@0
  3916
	if (err != KErrNone)
sl@0
  3917
		{
sl@0
  3918
		_LIT(KError, "Failed in Anim dll");
sl@0
  3919
		LOG_MESSAGE(KError);
sl@0
  3920
		TBuf<255> errDesc;
sl@0
  3921
		errDesc.SetMax();
sl@0
  3922
		TIpcArgs ipcArgs;
sl@0
  3923
		ipcArgs.Set(KIpcSlot,&errDesc);
sl@0
  3924
		// get the error desccription, print it out and stop the tests
sl@0
  3925
		TInt retVal = iAnim->CommandReply(EADllMultiPtrEventErrorDesc, KNullDesC8, ipcArgs);
sl@0
  3926
		if (retVal == KErrNone)
sl@0
  3927
			{
sl@0
  3928
			LOG_MESSAGE(errDesc);
sl@0
  3929
			}
sl@0
  3930
		Failed();
sl@0
  3931
		}
sl@0
  3932
	iAnim->CommandReply(EADllMultiPtrEventReset);
sl@0
  3933
	}
sl@0
  3934
sl@0
  3935
/**
sl@0
  3936
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0013
sl@0
  3937
@SYMPREQ				PREQ1226
sl@0
  3938
@SYMREQ					REQ9677,REQ9683,
sl@0
  3939
@SYMTestPriority		High 
sl@0
  3940
@SYMTestCaseDesc		To check Wserv sends Multi Pointer events to Anims
sl@0
  3941
@SYMTestStatus			Implemented
sl@0
  3942
sl@0
  3943
@SYMTestActions			Simulate multi pointer events for anims
sl@0
  3944
@SYMTestExpectedResults The received events must match the simulated raw events 
sl@0
  3945
*/
sl@0
  3946
void CTMultiPtrEventTest::MultiPointerEventsForAnimsL()
sl@0
  3947
	{
sl@0
  3948
	// The logic behind these tests is
sl@0
  3949
	// Create an anim, which creates animation at server side(which swicthes raw event handling on)
sl@0
  3950
	// Add the required events to the animtaion at server side buffer
sl@0
  3951
	// Simulate those events and check simulated events are same as required at server side
sl@0
  3952
	// If any test fail, error description is got from server and displayed in the log file
sl@0
  3953
	TLogMessageText logText;
sl@0
  3954
	_LIT(KSet, "Multi pointer events for Anims: %d of 3");
sl@0
  3955
	logText.AppendFormat(KSet, iEventSet);
sl@0
  3956
	LOG_MESSAGE(logText);
sl@0
  3957
	_LIT(KEventsChecked, "Events checked at server side = %d");
sl@0
  3958
	
sl@0
  3959
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  3960
	if (!iEventSet)
sl@0
  3961
		{
sl@0
  3962
		SetAutoFlush();
sl@0
  3963
		iAnimDll = new(ELeave) RAnimDll(iMultiPtrEventClient->iWs);
sl@0
  3964
		User::LeaveIfError(iAnimDll->Load(KAnimDLLName));
sl@0
  3965
		}
sl@0
  3966
	
sl@0
  3967
	TPoint ptrPos;
sl@0
  3968
	TInt ptrNum = 0;
sl@0
  3969
	TInt prValue = 0;
sl@0
  3970
	TInt proxValue = 0;
sl@0
  3971
	TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
sl@0
  3972
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
sl@0
  3973
 	
sl@0
  3974
	switch(iEventSet++)
sl@0
  3975
		{
sl@0
  3976
		case 0:
sl@0
  3977
			// Simulate downup events for all pointers
sl@0
  3978
			iAnim = RMultiPointerAnim::NewL(iMultiPtrEventClient->ParentWin()->BaseWin(), iAnimDll);
sl@0
  3979
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  3980
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  3981
				{
sl@0
  3982
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum);
sl@0
  3983
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum);
sl@0
  3984
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  3985
				ptrPos.iX += xInc;
sl@0
  3986
				ptrPos.iY += yInc;
sl@0
  3987
				}
sl@0
  3988
			TestAndDisplayAnimError();
sl@0
  3989
			logText.Format(KEventsChecked, iMaxDevPointers*2);
sl@0
  3990
			LOG_MESSAGE(logText);
sl@0
  3991
			break;
sl@0
  3992
		case 1:
sl@0
  3993
			// Simulate moves from different pointer with different pressure
sl@0
  3994
			// Here there is no need for events to be exaclty on the anim window. 
sl@0
  3995
			// becasue when the animtaions ask for events it will be delivered all the events
sl@0
  3996
			// irrespective of where they occured.
sl@0
  3997
			ptrPos.SetXY(0,0);
sl@0
  3998
			prValue = iPressureStep;
sl@0
  3999
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4000
				{
sl@0
  4001
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, prValue, 0, ptrNum);
sl@0
  4002
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum);
sl@0
  4003
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum);
sl@0
  4004
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  4005
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4006
				ptrPos.iX += xInc;
sl@0
  4007
				ptrPos.iY += yInc;
sl@0
  4008
				}
sl@0
  4009
			TestAndDisplayAnimError();
sl@0
  4010
			
sl@0
  4011
			// This is for just to add run the next test
sl@0
  4012
			SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0);
sl@0
  4013
			
sl@0
  4014
			logText.Format(KEventsChecked, iMaxDevPointers*3);
sl@0
  4015
			LOG_MESSAGE(logText);
sl@0
  4016
			break;
sl@0
  4017
		case 2:
sl@0
  4018
			// Simulate moves from different pointer with different proximity
sl@0
  4019
			ptrPos.SetXY(0,0);
sl@0
  4020
			proxValue = -iProximityStep;
sl@0
  4021
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4022
				{
sl@0
  4023
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EPointerMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  4024
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Down,ptrPos,0,0,ptrNum);
sl@0
  4025
				iAnim->AddExpectedAnimPointerEvent(TRawEvent::EButton1Up,ptrPos,0,0,ptrNum);
sl@0
  4026
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  4027
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4028
				ptrPos.iX += xInc;
sl@0
  4029
				ptrPos.iY += yInc;
sl@0
  4030
				}
sl@0
  4031
			TestAndDisplayAnimError();
sl@0
  4032
			
sl@0
  4033
			// This is for just to add run the next test
sl@0
  4034
			SimulatePointerEvent(TRawEvent::EPointerSwitchOn, 0, 0, 0, 0);
sl@0
  4035
			
sl@0
  4036
			logText.Format(KEventsChecked, iMaxDevPointers*3);
sl@0
  4037
			LOG_MESSAGE(logText);
sl@0
  4038
			break;
sl@0
  4039
		default:
sl@0
  4040
			DestroyAnimDllAndAnim();
sl@0
  4041
			ResetFlushStopAS();
sl@0
  4042
			break;
sl@0
  4043
		}
sl@0
  4044
sl@0
  4045
	LogEventsAdded();
sl@0
  4046
	}
sl@0
  4047
sl@0
  4048
sl@0
  4049
/**
sl@0
  4050
@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0014
sl@0
  4051
@SYMPREQ				PREQ1226
sl@0
  4052
@SYMREQ					REQ9677,REQ9683,
sl@0
  4053
@SYMTestPriority		High 
sl@0
  4054
@SYMTestCaseDesc		To check Wserv purges multi pointer events with standard rules
sl@0
  4055
@SYMTestStatus			Implemented
sl@0
  4056
sl@0
  4057
@SYMTestActions			Simulate raw events to be purged  
sl@0
  4058
@SYMTestExpectedResults The purged events should not be delivered to client 
sl@0
  4059
*/
sl@0
  4060
void CTMultiPtrEventTest::PurgingMultiPointerEvents()
sl@0
  4061
	{
sl@0
  4062
	// Test purging of multi pointer events
sl@0
  4063
	// 1. Test down/up pairs are purged
sl@0
  4064
	// 2. Test moves events are purged
sl@0
  4065
	// 3. Test drag events are purged
sl@0
  4066
	// 4. Test lone down events are purged
sl@0
  4067
	// 5. And finally test lone up events are also purged 
sl@0
  4068
	TLogMessageText logText;
sl@0
  4069
	_LIT(KSet, "Purging of multi pointer events: %d of 6");
sl@0
  4070
	logText.AppendFormat(KSet, iEventSet);
sl@0
  4071
	LOG_MESSAGE(logText);
sl@0
  4072
	
sl@0
  4073
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  4074
	TInt xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize;
sl@0
  4075
	TInt yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize;
sl@0
  4076
	TPoint ptrPos(xInc,yInc);
sl@0
  4077
	TInt ptrNum = 0;
sl@0
  4078
	TInt prValue = 0;
sl@0
  4079
	TInt proxValue = 0;
sl@0
  4080
	
sl@0
  4081
	if (!iEventSet)
sl@0
  4082
		{
sl@0
  4083
		SetAutoFlush();
sl@0
  4084
		}
sl@0
  4085
	
sl@0
  4086
	// Point to note is that Kernel has an event queue size of 40
sl@0
  4087
	// So make sure that you don't send more than 40 events
sl@0
  4088
	switch(iEventSet++)
sl@0
  4089
		{
sl@0
  4090
		case 0:
sl@0
  4091
			// Simulate pointer down/up events for all pointers
sl@0
  4092
			// Simulate many up events from any pointer which will purge down/up events
sl@0
  4093
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  4094
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
sl@0
  4095
				{
sl@0
  4096
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4097
				}
sl@0
  4098
			SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize-1, ptrPos);
sl@0
  4099
			break;
sl@0
  4100
		case 1:
sl@0
  4101
			// Repeat the same for Move events
sl@0
  4102
			// Simulate moves for all pointers with different pressure and proximity value
sl@0
  4103
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  4104
			iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  4105
			prValue = iPressureStep;
sl@0
  4106
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && prValue < iMaxPressure && ptrNum < 4); ptrNum++,prValue+=iPressureStep)
sl@0
  4107
				{
sl@0
  4108
				ptrPos.iX += xInc/2;
sl@0
  4109
				ptrPos.iY += yInc/2;
sl@0
  4110
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  4111
				}
sl@0
  4112
			ptrPos.iX = xInc;
sl@0
  4113
			ptrPos.iY = yInc;
sl@0
  4114
			proxValue = -iProximityStep;
sl@0
  4115
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && proxValue > iMaxProximity && ptrNum < 4); ptrNum++,proxValue-=iProximityStep)
sl@0
  4116
				{
sl@0
  4117
				ptrPos.iX += xInc/2;
sl@0
  4118
				ptrPos.iY += yInc/2;
sl@0
  4119
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  4120
				}
sl@0
  4121
			SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos);
sl@0
  4122
			break;
sl@0
  4123
		case 2:
sl@0
  4124
			{
sl@0
  4125
			// Repeat the same for drag events
sl@0
  4126
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
sl@0
  4127
			iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
sl@0
  4128
			ptrPos.iX = xInc;
sl@0
  4129
			ptrPos.iY = yInc;
sl@0
  4130
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
sl@0
  4131
				{
sl@0
  4132
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4133
				ptrPos.iX += xInc/2;
sl@0
  4134
				ptrPos.iY += yInc/2;
sl@0
  4135
				}
sl@0
  4136
			ptrPos.iX = xInc;
sl@0
  4137
			ptrPos.iY = yInc;
sl@0
  4138
			TPoint interPt = ptrPos;
sl@0
  4139
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
sl@0
  4140
				{	
sl@0
  4141
				interPt.iX += 2;
sl@0
  4142
				interPt.iY += 1;
sl@0
  4143
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  4144
				ptrPos.iX += xInc/2;
sl@0
  4145
				ptrPos.iY += yInc/2;
sl@0
  4146
				interPt = ptrPos; 
sl@0
  4147
				}
sl@0
  4148
			ptrPos.iX = xInc;
sl@0
  4149
			ptrPos.iY = yInc;
sl@0
  4150
			interPt = ptrPos;
sl@0
  4151
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 2); ptrNum++)
sl@0
  4152
				{
sl@0
  4153
				interPt.iX += 2;
sl@0
  4154
				interPt.iY += 1;
sl@0
  4155
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  4156
				ptrPos.iX += xInc/2;
sl@0
  4157
				ptrPos.iY += yInc/2;
sl@0
  4158
				interPt = ptrPos; 
sl@0
  4159
				}
sl@0
  4160
			SimulateAndAddLoneUpEvents(KMaxQueueSize, KMaxQueueSize, ptrPos);
sl@0
  4161
			}
sl@0
  4162
			break;
sl@0
  4163
		case 3:
sl@0
  4164
			// Repeat the same for lone down events
sl@0
  4165
			ptrPos.iX = xInc;
sl@0
  4166
			ptrPos.iY = yInc;
sl@0
  4167
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++)
sl@0
  4168
				{
sl@0
  4169
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4170
				ptrPos.iX += xInc/2;
sl@0
  4171
				ptrPos.iY += yInc/2;
sl@0
  4172
				}
sl@0
  4173
			SimulateAndAddLoneUpEvents(KMaxQueueSize+1, KMaxQueueSize, ptrPos);
sl@0
  4174
sl@0
  4175
			// Before this we had to send dummy 7 EButton1Up events from 1 to 7 pointers so that iLastUnmatchedDown1
sl@0
  4176
			// variable to be reset and that consecutive events was not sent to client. But now EPointer3DOutOfRange
sl@0
  4177
			// resets all the variables.
sl@0
  4178
			for (ptrNum = 1; (ptrNum < iMaxDevPointers && ptrNum < 3); ptrNum++)
sl@0
  4179
				{
sl@0
  4180
				SimulatePointerEvent(TRawEvent::EPointer3DOutOfRange, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4181
				}
sl@0
  4182
			break;
sl@0
  4183
		case 4:
sl@0
  4184
			// Finally for even lone up events, check that when you send events more then the queuesize
sl@0
  4185
			// the events are not sent back and they are ignored in wserv
sl@0
  4186
			ptrPos.iX = xInc;
sl@0
  4187
			ptrPos.iY = yInc;
sl@0
  4188
			for (ptrNum = 0; (ptrNum < iMaxDevPointers && ptrNum < 4); ptrNum++)
sl@0
  4189
				{
sl@0
  4190
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4191
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  4192
				ptrPos.iX += xInc/2;
sl@0
  4193
				ptrPos.iY += yInc/2;
sl@0
  4194
				}
sl@0
  4195
			ptrPos.iX = xInc;
sl@0
  4196
			ptrPos.iY = yInc;
sl@0
  4197
			for (TInt count = 0; count < KMaxQueueSize; count++)
sl@0
  4198
				{
sl@0
  4199
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  4200
				// For all up events more then KMaxQueueSize, wserv igoners then as the queue if full
sl@0
  4201
				if (count < (KMaxQueueSize - iMaxDevPointers))
sl@0
  4202
					{
sl@0
  4203
					AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
sl@0
  4204
					}
sl@0
  4205
				}
sl@0
  4206
			break;
sl@0
  4207
		case 5:
sl@0
  4208
			// Check PurgePointerEvents works with multi pointer events
sl@0
  4209
			ptrPos.iX = xInc;
sl@0
  4210
			ptrPos.iY = yInc;
sl@0
  4211
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4212
				{
sl@0
  4213
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4214
				ptrPos.iX += xInc/2;
sl@0
  4215
				ptrPos.iY += yInc/2;
sl@0
  4216
				}
sl@0
  4217
			ptrPos.iX = xInc;
sl@0
  4218
			ptrPos.iY = yInc;
sl@0
  4219
			iMultiPtrEventClient->iWs.PurgePointerEvents();
sl@0
  4220
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  4221
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
sl@0
  4222
			break;
sl@0
  4223
		default:
sl@0
  4224
			ResetFlushStopAS();
sl@0
  4225
			break;
sl@0
  4226
		}
sl@0
  4227
	LogEventsAdded();
sl@0
  4228
	}
sl@0
  4229
sl@0
  4230
void CTMultiPtrEventTest::MultiPointerEvents()
sl@0
  4231
	{
sl@0
  4232
	TLogMessageText logText;
sl@0
  4233
	_LIT(KSet, "MultiPtrEvents SetOfEvents: %d of 9");
sl@0
  4234
	logText.AppendFormat(KSet, iEventSet);
sl@0
  4235
	LOG_MESSAGE(logText);
sl@0
  4236
sl@0
  4237
	if (!iEventSet)
sl@0
  4238
		{
sl@0
  4239
		SetAutoFlush();
sl@0
  4240
		}
sl@0
  4241
	iMultiPtrEventClient->EventBuffer()->SetEventCount(0);
sl@0
  4242
sl@0
  4243
	TPoint ptrPos;
sl@0
  4244
	TInt ptrNum = 0;
sl@0
  4245
	TInt prValue = 0;
sl@0
  4246
	TInt proxValue = 0;
sl@0
  4247
	TInt xInc = iPhysicalScreenSize.iWidth/iMaxDevPointers;
sl@0
  4248
	TInt yInc = iPhysicalScreenSize.iHeight/iMaxDevPointers;
sl@0
  4249
	
sl@0
  4250
	switch(iEventSet++)
sl@0
  4251
		{
sl@0
  4252
		case 0:
sl@0
  4253
			/**
sl@0
  4254
			@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0001
sl@0
  4255
			@SYMPREQ				PREQ1226
sl@0
  4256
			@SYMREQ					REQ9674,REQ9687,
sl@0
  4257
			@SYMTestPriority		High 
sl@0
  4258
			@SYMTestCaseDesc		Checks Wserv sends multi touch pointer events received by it
sl@0
  4259
			@SYMTestStatus			Implemented
sl@0
  4260
sl@0
  4261
			@SYMTestActions			Simulate raw events from different pointers 
sl@0
  4262
			@SYMTestExpectedResults The received events must match the simulated raw events
sl@0
  4263
			*/
sl@0
  4264
			INFO_PRINTF1(_L("Simulate pointer events from all pointers"));
sl@0
  4265
			INFO_PRINTF1(_L("Test pattern is PointerDown0/PointerUp0, PointerDown1/PointerUp1, PointerDown2/PointerUp2..."));
sl@0
  4266
			// Test pattern is down0/up0, down1/up1, down2/up2, down3/up3....
sl@0
  4267
			AddExpectedWsEvent(EEventFocusGained);
sl@0
  4268
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4269
				{
sl@0
  4270
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4271
				AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
sl@0
  4272
				ptrPos.iX += xInc;
sl@0
  4273
				ptrPos.iY += yInc;
sl@0
  4274
				}
sl@0
  4275
			break;
sl@0
  4276
		case 1:
sl@0
  4277
			/**
sl@0
  4278
			@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0003
sl@0
  4279
			@SYMPREQ				PREQ1226
sl@0
  4280
			@SYMREQ					REQ9674,REQ9687,
sl@0
  4281
			@SYMTestPriority		High 
sl@0
  4282
			@SYMTestCaseDesc		To check Wserv sends simultaneous multi touch pointer events 
sl@0
  4283
			@SYMTestStatus			Implemented
sl@0
  4284
sl@0
  4285
			@SYMTestActions			Simulate simultaneous raw events from different pointers 
sl@0
  4286
			@SYMTestExpectedResults The received events must match the simulated raw events
sl@0
  4287
			*/
sl@0
  4288
			INFO_PRINTF1(_L("Test pattern PointerDown0/PointerDown1/PointerDown2/... PointerUp0/PointerUp1/PointerUp2..."));
sl@0
  4289
			// Test pattern is pointer0Down/pointer1Down/pointer2Down/pointer3Down.... pointer0Up/pointer1Up/pointer2Up/pointer3Up.... 
sl@0
  4290
			ptrPos.SetXY(0,0);
sl@0
  4291
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4292
				{
sl@0
  4293
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4294
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  4295
				ptrPos.iX += xInc;
sl@0
  4296
				ptrPos.iY += yInc;
sl@0
  4297
				}
sl@0
  4298
sl@0
  4299
			ptrPos.SetXY(0,0);
sl@0
  4300
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4301
				{
sl@0
  4302
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4303
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  4304
				ptrPos.iX += xInc;
sl@0
  4305
				ptrPos.iY += yInc;				
sl@0
  4306
				}
sl@0
  4307
			break;
sl@0
  4308
		case 2:
sl@0
  4309
			/**
sl@0
  4310
			@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0005
sl@0
  4311
			@SYMPREQ				PREQ1226
sl@0
  4312
			@SYMREQ					REQ9676
sl@0
  4313
			@SYMTestPriority		High 
sl@0
  4314
			@SYMTestCaseDesc		To check Wserv sends the multi touch pointer events received 
sl@0
  4315
									by it along with the Pressure or Proximity 
sl@0
  4316
			@SYMTestStatus			Implemented
sl@0
  4317
sl@0
  4318
			@SYMTestActions			Simulate raw events with pressure and proximity from different pointers  
sl@0
  4319
			@SYMTestExpectedResults The received events must match the simulated raw events
sl@0
  4320
			*/
sl@0
  4321
			// Simulate Button1Down with differet pressure
sl@0
  4322
			// Simulate Button1Up with zero pressure
sl@0
  4323
			INFO_PRINTF1(_L("Simulate pointer events with different pressure values"));
sl@0
  4324
			ptrPos.SetXY(0,0);
sl@0
  4325
			prValue = iPressureStep;
sl@0
  4326
			for (; (prValue <= iMaxPressure && ptrPos.iX < iPhysicalScreenSize.iWidth && ptrPos.iY < iPhysicalScreenSize.iHeight); prValue+=iPressureStep)
sl@0
  4327
				{
sl@0
  4328
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0);
sl@0
  4329
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  4330
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0);
sl@0
  4331
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
sl@0
  4332
				ptrPos.iX += xInc;
sl@0
  4333
				ptrPos.iY += yInc;
sl@0
  4334
				}
sl@0
  4335
			
sl@0
  4336
			// Test with max pressure it might be that the width may cross the physical screen size
sl@0
  4337
			ptrPos.SetXY(0,0);
sl@0
  4338
			prValue = iMaxPressure;
sl@0
  4339
			SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, prValue, 0);
sl@0
  4340
			SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, 0);
sl@0
  4341
			AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, prValue, 0, 0);
sl@0
  4342
			AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, 0);
sl@0
  4343
			break;
sl@0
  4344
		case 3:
sl@0
  4345
			// Simulate EPointerMove with different pressure values and for differernt pointers
sl@0
  4346
			INFO_PRINTF1(_L("Simulate pointer events with different pressure values and from different pointers"));
sl@0
  4347
			ptrPos.SetXY(0,0);
sl@0
  4348
			prValue = iPressureStep;
sl@0
  4349
			
sl@0
  4350
			// Enable move events 
sl@0
  4351
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  4352
			iMultiPtrEventClient->ChildWin()->BaseWin()->PointerFilter(EPointerFilterMove, 0);
sl@0
  4353
			
sl@0
  4354
			// Right now when 2 or more moves occur, wserv deletes all the moves except the last one.
sl@0
  4355
			// So test only one move per Pointer and then one set of button down and button up
sl@0
  4356
			// Then repeat the same for different pressure values
sl@0
  4357
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4358
				{
sl@0
  4359
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  4360
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
sl@0
  4361
				ptrPos.iX += xInc;
sl@0
  4362
				ptrPos.iY += yInc;
sl@0
  4363
				}
sl@0
  4364
			
sl@0
  4365
			ptrPos.SetXY(0,0);
sl@0
  4366
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4367
				{
sl@0
  4368
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4369
				AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
sl@0
  4370
				ptrPos.iX += xInc;
sl@0
  4371
				ptrPos.iY += yInc;
sl@0
  4372
				}
sl@0
  4373
			
sl@0
  4374
			// Test moves with different pressure 
sl@0
  4375
			ptrPos.SetXY(0,0);
sl@0
  4376
			if ((prValue+iPressureStep) <= iMaxPressure)
sl@0
  4377
				{
sl@0
  4378
				prValue += iPressureStep;
sl@0
  4379
				}
sl@0
  4380
			ptrNum = 0;
sl@0
  4381
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  4382
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
sl@0
  4383
			break;
sl@0
  4384
		case 4:
sl@0
  4385
			INFO_PRINTF1(_L("Simulate pointer events with different proximity values"));
sl@0
  4386
			// Repeat the same test of case 3 for different proximity values
sl@0
  4387
			ptrPos.SetXY(0,0);
sl@0
  4388
			
sl@0
  4389
			proxValue = -iProximityStep;
sl@0
  4390
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4391
				{
sl@0
  4392
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  4393
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  4394
				ptrPos.iX += xInc;
sl@0
  4395
				ptrPos.iY += yInc;
sl@0
  4396
				}
sl@0
  4397
			
sl@0
  4398
			ptrPos.SetXY(0,0);
sl@0
  4399
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4400
				{
sl@0
  4401
				SimulatePointerDownUp(ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4402
				AddExpectedPointerDownUp(ptrPos, 0, ptrNum);
sl@0
  4403
				ptrPos.iX += xInc;
sl@0
  4404
				ptrPos.iY += yInc;
sl@0
  4405
				}
sl@0
  4406
sl@0
  4407
			ptrPos.SetXY(0,0);
sl@0
  4408
			if ((proxValue-iProximityStep) > iMaxProximity)
sl@0
  4409
				{
sl@0
  4410
				proxValue -= iProximityStep;
sl@0
  4411
				}
sl@0
  4412
			ptrNum = 0;
sl@0
  4413
			SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  4414
			AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  4415
			break;
sl@0
  4416
		case 5:
sl@0
  4417
			/**
sl@0
  4418
			@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0007
sl@0
  4419
			@SYMPREQ				PREQ1226
sl@0
  4420
			@SYMREQ					REQ9677
sl@0
  4421
			@SYMTestPriority		High 
sl@0
  4422
			@SYMTestCaseDesc		To check Wserv sends move/drags of different pointers  
sl@0
  4423
			@SYMTestStatus			Implemented
sl@0
  4424
sl@0
  4425
			@SYMTestActions			Simulate raw move and drag events from different pointers  
sl@0
  4426
			@SYMTestExpectedResults The received events must match the simulated raw events
sl@0
  4427
			*/
sl@0
  4428
			INFO_PRINTF1(_L("Simulate pointer drag events"));
sl@0
  4429
			ptrPos.SetXY(0,0);
sl@0
  4430
			iMultiPtrEventClient->ParentWin()->BaseWin()->PointerFilter(EPointerFilterDrag, 0);
sl@0
  4431
			
sl@0
  4432
			// Simulate EButton1Down and then one move and then EButton1Up event  
sl@0
  4433
			// which will lead to corresponding drag, do it for all the pointers
sl@0
  4434
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4435
				{
sl@0
  4436
				TestDragForMultiPointer(ptrPos, 0, ptrNum);
sl@0
  4437
				ptrPos.iX += xInc/2;
sl@0
  4438
				ptrPos.iY += yInc/2;
sl@0
  4439
				}
sl@0
  4440
sl@0
  4441
			// Check the drag with different pressure value with different pointer
sl@0
  4442
			prValue = iPressureStep;
sl@0
  4443
			ptrPos.iX = xInc;
sl@0
  4444
			ptrPos.iY = yInc;
sl@0
  4445
			if ((prValue+iPressureStep) <= iMaxPressure)
sl@0
  4446
				{
sl@0
  4447
				prValue += iPressureStep;
sl@0
  4448
				}
sl@0
  4449
			ptrNum = 0;
sl@0
  4450
			TestDragForMultiPointer(ptrPos, prValue, ptrNum);
sl@0
  4451
			break;
sl@0
  4452
		case 6:
sl@0
  4453
			{
sl@0
  4454
			/**
sl@0
  4455
			@SYMTestCaseID			GRAPHICS-WSERV-ADVANCEDPOINTER-0009
sl@0
  4456
			@SYMPREQ				PREQ1226
sl@0
  4457
			@SYMREQ					REQ9677, REQ9674
sl@0
  4458
			@SYMTestPriority		High 
sl@0
  4459
			@SYMTestCaseDesc		To check Wserv sends simultaneous move/drags of different pointers  
sl@0
  4460
			@SYMTestStatus			Implemented
sl@0
  4461
sl@0
  4462
			@SYMTestActions			Simulate simulatneous raw move and drag events from different pointers  
sl@0
  4463
			@SYMTestExpectedResults The received events must match the simulated raw events
sl@0
  4464
			*/
sl@0
  4465
			INFO_PRINTF1(_L("Simulate pointer drag events in different pattern"));
sl@0
  4466
			// Dragging done in this pattern
sl@0
  4467
			// pointer0Down/pointer1Down/pointer2Down/pointer3Down... pointer0Up/pointer1Up/pointer2Up/pointer3Up....
sl@0
  4468
			
sl@0
  4469
			ptrPos.SetXY(0,0);
sl@0
  4470
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4471
				{
sl@0
  4472
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4473
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  4474
				ptrPos.iX += xInc/2;
sl@0
  4475
				ptrPos.iY += yInc/2;
sl@0
  4476
				}
sl@0
  4477
			
sl@0
  4478
			ptrPos.SetXY(0,0);
sl@0
  4479
			TPoint interPt = ptrPos;
sl@0
  4480
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4481
				{
sl@0
  4482
				interPt.iX += 2;
sl@0
  4483
				interPt.iY += 1;
sl@0
  4484
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  4485
				AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
sl@0
  4486
				ptrPos.iX += xInc/2;
sl@0
  4487
				ptrPos.iY += yInc/2;
sl@0
  4488
				interPt = ptrPos; 
sl@0
  4489
				}
sl@0
  4490
		
sl@0
  4491
			ptrPos.SetXY(0,0);
sl@0
  4492
			interPt = ptrPos;
sl@0
  4493
			for (ptrNum = 0; ptrNum < iMaxDevPointers; ptrNum++)
sl@0
  4494
				{
sl@0
  4495
				interPt.iX += 2;
sl@0
  4496
				interPt.iY += 1;
sl@0
  4497
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  4498
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
sl@0
  4499
				ptrPos.iX += xInc/2;
sl@0
  4500
				ptrPos.iY += yInc/2;
sl@0
  4501
				interPt = ptrPos; 
sl@0
  4502
				}
sl@0
  4503
			break;
sl@0
  4504
			}
sl@0
  4505
		case 7:
sl@0
  4506
			{
sl@0
  4507
			// Mixing of drag and moves of different pointers
sl@0
  4508
			ptrPos.SetXY(0,0);
sl@0
  4509
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  4510
				{
sl@0
  4511
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4512
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  4513
				ptrPos.iX += xInc/2;
sl@0
  4514
				ptrPos.iY += yInc/2;
sl@0
  4515
				}
sl@0
  4516
			ptrPos.SetXY(0,0);
sl@0
  4517
			TPoint interPt = ptrPos;
sl@0
  4518
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  4519
				{
sl@0
  4520
				interPt.iX += 2;
sl@0
  4521
				interPt.iY += 1;
sl@0
  4522
				SimulatePointerEvent(TRawEvent::EPointerMove, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  4523
				AddExpectedPointerEvent(TPointerEvent::EDrag, interPt, 0, 0, ptrNum);
sl@0
  4524
				ptrPos.iX += xInc/2;
sl@0
  4525
				ptrPos.iY += yInc/2;
sl@0
  4526
				interPt = ptrPos; 
sl@0
  4527
				}
sl@0
  4528
		
sl@0
  4529
			ptrPos.SetXY(0,0);
sl@0
  4530
			interPt = ptrPos;
sl@0
  4531
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  4532
				{
sl@0
  4533
				interPt.iX += 2;
sl@0
  4534
				interPt.iY += 1;
sl@0
  4535
				SimulatePointerEvent(TRawEvent::EButton1Up, interPt.iX, interPt.iY, 0, ptrNum);
sl@0
  4536
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, interPt, 0, 0, ptrNum);
sl@0
  4537
				ptrPos.iX += xInc/2;
sl@0
  4538
				ptrPos.iY += yInc/2;
sl@0
  4539
				interPt = ptrPos; 
sl@0
  4540
				}
sl@0
  4541
			
sl@0
  4542
			ptrPos.SetXY(0,0);
sl@0
  4543
			prValue = iPressureStep;
sl@0
  4544
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2 && prValue < iMaxPressure; ptrNum++, prValue+=iPressureStep)
sl@0
  4545
				{
sl@0
  4546
				SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  4547
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, prValue, 0, ptrNum);
sl@0
  4548
				ptrPos.iX += xInc;
sl@0
  4549
				ptrPos.iY += yInc;
sl@0
  4550
				}
sl@0
  4551
			}
sl@0
  4552
			break;
sl@0
  4553
		case 8:
sl@0
  4554
			{
sl@0
  4555
			INFO_PRINTF1(_L("Check intermediate Moves and Drags are deleted except last event"));
sl@0
  4556
			// Check if intermediate move and drag events are deleted
sl@0
  4557
			// The deletion is done with respect to same pointer and same window
sl@0
  4558
			xInc = iPhysicalScreenSize.iWidth/KMaxQueueSize;
sl@0
  4559
			yInc = iPhysicalScreenSize.iHeight/KMaxQueueSize;
sl@0
  4560
			ptrPos.iX = xInc;
sl@0
  4561
			ptrPos.iY = yInc;
sl@0
  4562
			TInt count = 0;
sl@0
  4563
			
sl@0
  4564
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  4565
				{
sl@0
  4566
				// Make sure that ptrPos does not go out of screen area, i,e the loop count should not exceed 4
sl@0
  4567
				for (count = proxValue = 0; proxValue > iMaxProximity && count < 4; proxValue=proxValue-(4*iProximityStep), count++)
sl@0
  4568
					{
sl@0
  4569
					ptrPos.iX += xInc/2;
sl@0
  4570
					ptrPos.iY += yInc/2;
sl@0
  4571
					SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, proxValue, ptrNum);
sl@0
  4572
					}
sl@0
  4573
				// Since the for loop increments the variables at the end
sl@0
  4574
				proxValue = proxValue + (4*iProximityStep);
sl@0
  4575
				AddExpectedPointerEvent(TPointerEvent::EMove, ptrPos, proxValue, 0, ptrNum);
sl@0
  4576
				}
sl@0
  4577
			
sl@0
  4578
			ptrPos.iX = xInc;
sl@0
  4579
			ptrPos.iY = yInc;
sl@0
  4580
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  4581
				{
sl@0
  4582
				ptrPos.iX += xInc/2;
sl@0
  4583
				ptrPos.iY += yInc/2;
sl@0
  4584
				SimulatePointerEvent(TRawEvent::EButton1Down, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4585
				AddExpectedPointerEvent(TPointerEvent::EButton1Down, ptrPos, 0, 0, ptrNum);
sl@0
  4586
				}
sl@0
  4587
sl@0
  4588
			ptrPos.iX = xInc;
sl@0
  4589
			ptrPos.iY = yInc;
sl@0
  4590
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  4591
				{
sl@0
  4592
				// Make sure that ptrPos does not go out of screen area, i,e the loop count shuld not exceed 4
sl@0
  4593
				for (count = prValue = 0; prValue < iMaxPressure && count < 4; prValue=prValue+(4*iPressureStep), count++)
sl@0
  4594
					{
sl@0
  4595
					ptrPos.iX += xInc/2;
sl@0
  4596
					ptrPos.iY += yInc/2;
sl@0
  4597
					SimulatePointerEvent(TRawEvent::EPointerMove, ptrPos.iX, ptrPos.iY, prValue, ptrNum);
sl@0
  4598
					}
sl@0
  4599
				prValue = prValue-(4*iPressureStep);
sl@0
  4600
				AddExpectedPointerEvent(TPointerEvent::EDrag, ptrPos, prValue, 0, ptrNum);
sl@0
  4601
				}
sl@0
  4602
			
sl@0
  4603
			ptrPos.iX = xInc;
sl@0
  4604
			ptrPos.iY = yInc;
sl@0
  4605
			for (ptrNum = 0; ptrNum < iMaxDevPointers/2; ptrNum++)
sl@0
  4606
				{
sl@0
  4607
				ptrPos.iX += xInc/2;
sl@0
  4608
				ptrPos.iY += yInc/2;
sl@0
  4609
				SimulatePointerEvent(TRawEvent::EButton1Up, ptrPos.iX, ptrPos.iY, 0, ptrNum);
sl@0
  4610
				AddExpectedPointerEvent(TPointerEvent::EButton1Up, ptrPos, 0, 0, ptrNum);
sl@0
  4611
				}
sl@0
  4612
			}
sl@0
  4613
			break;
sl@0
  4614
		default:
sl@0
  4615
			ResetFlushStopAS();
sl@0
  4616
			break;
sl@0
  4617
		}
sl@0
  4618
	
sl@0
  4619
	LogEventsAdded();
sl@0
  4620
	}
sl@0
  4621
sl@0
  4622
// Logs number of events added to test buffer for comaparison
sl@0
  4623
void CTMultiPtrEventTest::LogEventsAdded()
sl@0
  4624
	{
sl@0
  4625
	TLogMessageText logText1;
sl@0
  4626
	_LIT(KEventsAdded, "Events added to buffer = %d");
sl@0
  4627
	logText1.AppendFormat(KEventsAdded, iMultiPtrEventClient->EventBuffer()->EventsRemaining());
sl@0
  4628
	LOG_MESSAGE(logText1);	
sl@0
  4629
	}
sl@0
  4630
sl@0
  4631
// If any of the Tests fails, bring the wserv in a consistent state for other test to run, 
sl@0
  4632
// stop ActiveScheduler and display some logs where the fail occured.
sl@0
  4633
void CTMultiPtrEventTest::Failed()
sl@0
  4634
	{
sl@0
  4635
	switch (iTest->iState)
sl@0
  4636
		{
sl@0
  4637
		case 2:		// Anim tests
sl@0
  4638
			DestroyAnimDllAndAnim();
sl@0
  4639
			break;
sl@0
  4640
		case 3:		// MultiClient tests
sl@0
  4641
			if (iMultiPtrEventClient->EventBuffer()->NestedLoopState())
sl@0
  4642
				{
sl@0
  4643
				iSecMultiPtrEventClient->EventBuffer()->SetNestedLoopState(EFalse);
sl@0
  4644
				CActiveScheduler::Stop();
sl@0
  4645
				}
sl@0
  4646
			break;
sl@0
  4647
		case 4:		//PtrClick tests
sl@0
  4648
			if (iPtrPluginLoaded)
sl@0
  4649
				{
sl@0
  4650
				iPtrPluginLoaded = EFalse;
sl@0
  4651
				iClick.Unload();
sl@0
  4652
				iClick.Close();
sl@0
  4653
				}
sl@0
  4654
			if (iHeap)
sl@0
  4655
				{
sl@0
  4656
				iHeap->Close();
sl@0
  4657
				iHeap = NULL;
sl@0
  4658
				iChunk.Close();
sl@0
  4659
				}
sl@0
  4660
			break;
sl@0
  4661
		case 5:		//Screen mode tests
sl@0
  4662
			SetDefaultScreenMode();
sl@0
  4663
			break;
sl@0
  4664
		case 11:
sl@0
  4665
			iMultiPtrEventClient->DeleteGroupBlankWin();
sl@0
  4666
			break;
sl@0
  4667
		case 12:	//Emulation tests, iEventSet is incremented in main switch case.
sl@0
  4668
			switch (iEventSet)
sl@0
  4669
				{
sl@0
  4670
				case 9:
sl@0
  4671
					DeleteGroupWin();
sl@0
  4672
					break;
sl@0
  4673
				case 10:
sl@0
  4674
					DestroyAnimDllAndAnim();
sl@0
  4675
					break;
sl@0
  4676
				case 11:
sl@0
  4677
				case 12:
sl@0
  4678
					iMultiPtrEventClient->ParentWin()->BaseWin()->FreePointerMoveBuffer();
sl@0
  4679
					iMultiPtrEventClient->ParentWin()->BaseWin()->DisablePointerMoveBuffer();
sl@0
  4680
					break;
sl@0
  4681
				case 14:
sl@0
  4682
				case 15:
sl@0
  4683
					iMultiPtrEventClient->iWs.SetPointerCursorArea(iOrigPtrCursorArea);
sl@0
  4684
					break;
sl@0
  4685
				default:
sl@0
  4686
					break;
sl@0
  4687
				}
sl@0
  4688
			break;
sl@0
  4689
		case 15:
sl@0
  4690
			if (iEventSet > 1)
sl@0
  4691
				{
sl@0
  4692
				DeleteGroupWinForCapturing();
sl@0
  4693
				}
sl@0
  4694
			break;
sl@0
  4695
		case 13:
sl@0
  4696
		case 16:
sl@0
  4697
			SetThresholdValues(KMaxTInt, KMinTInt, KMaxTInt, KMinTInt);
sl@0
  4698
			break;
sl@0
  4699
		default:
sl@0
  4700
			break;
sl@0
  4701
		}
sl@0
  4702
	
sl@0
  4703
	if (iActiveSchedulerStarted)
sl@0
  4704
		{
sl@0
  4705
		iActiveSchedulerStarted = EFalse;
sl@0
  4706
		CActiveScheduler::Stop();
sl@0
  4707
		}
sl@0
  4708
	
sl@0
  4709
	// Display the test case number, subtest case number and number of events left in the buffer which can be used to
sl@0
  4710
	// find out which event actually caused the failure when any test fails
sl@0
  4711
	TLogMessageText logText1;
sl@0
  4712
	_LIT(KEventsAdded, "Test case number %d Sub test case number %d Events remaining in the buffer %d \n");
sl@0
  4713
	logText1.AppendFormat(KEventsAdded, iTest->iState, iEventSet, iMultiPtrEventClient->EventBuffer()->EventsRemaining());
sl@0
  4714
	LOG_MESSAGE(logText1);
sl@0
  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());
sl@0
  4716
	
sl@0
  4717
	iFailed=ETrue;
sl@0
  4718
	}
sl@0
  4719
sl@0
  4720
// This function is called by TestExecute Framework, through which all the testcases are run
sl@0
  4721
void CTMultiPtrEventTest::RunTestCaseL(TInt /*aCurTestCase*/)
sl@0
  4722
	{
sl@0
  4723
	_LIT(KTest0, "MultiPointerEvents with Pressure and Proximity");
sl@0
  4724
	_LIT(KTest1, "Purging Of MultiPointerEvents");
sl@0
  4725
	_LIT(KTest2, "MultiPointerEvents for Anims");
sl@0
  4726
	_LIT(KTest3, "MultiPointerEvents from multi client");
sl@0
  4727
	_LIT(KTest4, "MultiPointerEvents for pointer click plugin");
sl@0
  4728
	_LIT(KTest5, "MultiPointerEvents In Different ScreenModes");
sl@0
  4729
	_LIT(KTest6, "Filtering Of MultiPointerEvents");
sl@0
  4730
	_LIT(KTest7, "Grabbing Of MultiPointerEvents");
sl@0
  4731
	_LIT(KTest8, "VirtualKeyboard for Multiple Pointers");
sl@0
  4732
	_LIT(KTest9, "DoubleClick events for Multiple Pointer");
sl@0
  4733
	_LIT(KTest10, "OutOfRange & EnterExit for Multiple Pointer");
sl@0
  4734
	_LIT(KTest11, "Auto foreground for Multiple Pointer");
sl@0
  4735
	_LIT(KTest12, "Emulation rules for Mulitple Pointers");
sl@0
  4736
	_LIT(KTest13, "Close proximity and High Pressure events");
sl@0
  4737
	_LIT(KTest14, "Out of bound value testing");
sl@0
  4738
	_LIT(KTest15, "Capturing Of MultiPointerEvents");
sl@0
  4739
	_LIT(KTest16, "Negative testing for Proximity and Pressure events");
sl@0
  4740
	_LIT(KTest17, "PointerRepeatEvent for Multiple Pointers");
sl@0
  4741
	
sl@0
  4742
	if (!TestBase()->ConfigurationSupportsPointerEventTesting())
sl@0
  4743
	    {
sl@0
  4744
	    INFO_PRINTF1(_L("Test skipped because config does not support pointer event testing"));
sl@0
  4745
	    TestComplete();
sl@0
  4746
	    return;
sl@0
  4747
	    }
sl@0
  4748
	
sl@0
  4749
	switch(iTest->iState)
sl@0
  4750
		{
sl@0
  4751
	case 0:
sl@0
  4752
		iTest->LogSubTest(KTest0);
sl@0
  4753
		RunTestsL();
sl@0
  4754
		break;
sl@0
  4755
	case 1:
sl@0
  4756
		iTest->LogSubTest(KTest1);
sl@0
  4757
		RunTestsL();
sl@0
  4758
		break;
sl@0
  4759
	case 2:
sl@0
  4760
		iTest->LogSubTest(KTest2);
sl@0
  4761
		RunTestsL();
sl@0
  4762
		break;
sl@0
  4763
	case 3:
sl@0
  4764
		iTest->LogSubTest(KTest3);
sl@0
  4765
		RunTestsL();
sl@0
  4766
		break;
sl@0
  4767
	case 4:
sl@0
  4768
		iTest->LogSubTest(KTest4);
sl@0
  4769
		RunTestsL();
sl@0
  4770
		break;
sl@0
  4771
	case 5:
sl@0
  4772
		iTest->LogSubTest(KTest5);
sl@0
  4773
		RunTestsL();
sl@0
  4774
		break;
sl@0
  4775
	case 6:
sl@0
  4776
		iTest->LogSubTest(KTest6);
sl@0
  4777
		RunTestsL();
sl@0
  4778
		break;	
sl@0
  4779
	case 7:
sl@0
  4780
		iTest->LogSubTest(KTest7);
sl@0
  4781
		RunTestsL();
sl@0
  4782
		break;	
sl@0
  4783
	case 8:
sl@0
  4784
		iTest->LogSubTest(KTest8);
sl@0
  4785
		RunTestsL();
sl@0
  4786
		break;
sl@0
  4787
	case 9:
sl@0
  4788
		iTest->LogSubTest(KTest9);
sl@0
  4789
		RunTestsL();
sl@0
  4790
		break;
sl@0
  4791
	case 10:
sl@0
  4792
		iTest->LogSubTest(KTest10);
sl@0
  4793
		RunTestsL();
sl@0
  4794
		break;
sl@0
  4795
	case 11:
sl@0
  4796
		iTest->LogSubTest(KTest11);
sl@0
  4797
		RunTestsL();
sl@0
  4798
		break;
sl@0
  4799
	case 12:
sl@0
  4800
		iTest->LogSubTest(KTest12);
sl@0
  4801
		RunTestsL();
sl@0
  4802
		break;
sl@0
  4803
	case 13:
sl@0
  4804
		iTest->LogSubTest(KTest13);
sl@0
  4805
		RunTestsL();
sl@0
  4806
		break;
sl@0
  4807
	case 14:
sl@0
  4808
		iTest->LogSubTest(KTest14);
sl@0
  4809
		RunTestsL();
sl@0
  4810
		break;
sl@0
  4811
	case 15:
sl@0
  4812
		iTest->LogSubTest(KTest15);
sl@0
  4813
		RunTestsL();
sl@0
  4814
		break;
sl@0
  4815
	case 16:
sl@0
  4816
		iTest->LogSubTest(KTest16);
sl@0
  4817
		RunTestsL();
sl@0
  4818
		break;	
sl@0
  4819
	case 17:
sl@0
  4820
		iTest->LogSubTest(KTest17);
sl@0
  4821
		RunTestsL();
sl@0
  4822
		break;	
sl@0
  4823
	case 18:
sl@0
  4824
		// Keep this code in last case statement for main test completion 
sl@0
  4825
		TestComplete();
sl@0
  4826
		break;
sl@0
  4827
	default:
sl@0
  4828
		AutoPanic(EAutoPanicWrongTest);
sl@0
  4829
		}
sl@0
  4830
sl@0
  4831
	// 
sl@0
  4832
	if (iFailed)
sl@0
  4833
		{
sl@0
  4834
		TEST(EFalse);
sl@0
  4835
		iFailed=EFalse;
sl@0
  4836
		}
sl@0
  4837
	++iTest->iState;
sl@0
  4838
	}
sl@0
  4839
sl@0
  4840
// Macro which is used for construction of CTMultiPtrEventTestStep object
sl@0
  4841
// and also used to call CreateTestL() which creates CTMultiPtrEventTest and CTestBase objects
sl@0
  4842
__WS_CONSTRUCT_STEP__(MultiPtrEventTest)