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