os/graphics/windowing/windowserver/test/tauto/TCapKey.CPP
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// Test capture key
sl@0
    15
// Coverted from TMan test code (TMCAPKEY.CPP) October 2000
sl@0
    16
// 
sl@0
    17
//
sl@0
    18
sl@0
    19
/**
sl@0
    20
 @file
sl@0
    21
 @test
sl@0
    22
 @internalComponent - Internal Symbian test code
sl@0
    23
*/
sl@0
    24
sl@0
    25
sl@0
    26
#include "TCapKey.H"
sl@0
    27
sl@0
    28
#define LOGGING on
sl@0
    29
sl@0
    30
//
sl@0
    31
// CAbortHandler
sl@0
    32
sl@0
    33
CAbortHandler::CAbortHandler(RWsSession *aWs, CCKAbortConnection *aConnection) : CTEventBase(aWs, 10), iConnection(aConnection)
sl@0
    34
	{
sl@0
    35
	}
sl@0
    36
sl@0
    37
CAbortHandler::~CAbortHandler()
sl@0
    38
	{
sl@0
    39
	Cancel();
sl@0
    40
	}
sl@0
    41
sl@0
    42
void CAbortHandler::Request()
sl@0
    43
	{
sl@0
    44
	iWs->PriorityKeyReady(&iStatus);
sl@0
    45
	SetActive();
sl@0
    46
	}
sl@0
    47
sl@0
    48
void CAbortHandler::DoCancel()
sl@0
    49
	{
sl@0
    50
	iWs->PriorityKeyReadyCancel();
sl@0
    51
	}
sl@0
    52
sl@0
    53
void CAbortHandler::doRunL()
sl@0
    54
	{
sl@0
    55
	TWsPriorityKeyEvent abortEvent;
sl@0
    56
	iWs->GetPriorityKey(abortEvent);
sl@0
    57
	iConnection->ReceivedAbortEvent(abortEvent.Handle(),abortEvent.Key());
sl@0
    58
	}
sl@0
    59
sl@0
    60
//
sl@0
    61
// CCKConnection
sl@0
    62
sl@0
    63
CCKConnectionBase::CCKConnectionBase(CTCaptureKey *aTest) : iTest(aTest)
sl@0
    64
	{
sl@0
    65
	}
sl@0
    66
sl@0
    67
void CCKConnectionBase::ConstructL()
sl@0
    68
	{
sl@0
    69
	CTClient::SetScreenNumber(iTest->ScreenNumber());
sl@0
    70
	CTClient::ConstructL();
sl@0
    71
	iGroup=new(ELeave) CCKWindowGroup(this, iTest);
sl@0
    72
	iGroup->ConstructL();
sl@0
    73
	}
sl@0
    74
sl@0
    75
CCKConnection::CCKConnection(CTCaptureKey *aTest, TInt aConnIndex) : CCKConnectionBase(aTest), iConnIndex(aConnIndex)
sl@0
    76
	{
sl@0
    77
	}
sl@0
    78
sl@0
    79
CCKConnection::~CCKConnection()
sl@0
    80
	{
sl@0
    81
	for(TInt index=0;index<numCapKeys;index++)
sl@0
    82
		if (capKeys[index].connIndex==iConnIndex)
sl@0
    83
			iGroup->GroupWin()->CancelCaptureKey(capKeyHandle[index]);
sl@0
    84
	for(TInt index1=0;index1<numCapKeysWithPriority;index1++)
sl@0
    85
		if (capKeysWithPriority[index1].connIndex==iConnIndex)
sl@0
    86
			iGroup->GroupWin()->CancelCaptureKey(capKeyWithPriorityHandle[index1]);
sl@0
    87
	for(TInt index2=0;index2<numUpDownKeys;index2++)
sl@0
    88
		if (capUpAndDownKeys[index2].connIndex==iConnIndex)
sl@0
    89
			iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(capUpDownKeyHandle[index2]);
sl@0
    90
	for(TInt index3=0;index3<numUpDownKeysWithPriority;index3++)
sl@0
    91
		if (capUpAndDownKeysWithPriority[index3].connIndex==iConnIndex)
sl@0
    92
			iGroup->GroupWin()->CancelCaptureKeyUpAndDowns(capUpDownKeyWithPriorityHandle[index3]);
sl@0
    93
	CTWin::Delete(iWin);
sl@0
    94
	}
sl@0
    95
sl@0
    96
void CCKConnection::SubStateChanged()
sl@0
    97
	{
sl@0
    98
	iWin->Invalidate();
sl@0
    99
	iWs.Flush();
sl@0
   100
	}
sl@0
   101
sl@0
   102
void CCKConnection::ConstructL()
sl@0
   103
	{
sl@0
   104
	CCKConnectionBase::ConstructL();
sl@0
   105
	for(TInt index=0;index<numCapKeys;index++)
sl@0
   106
		if (capKeys[index].connIndex==iConnIndex)
sl@0
   107
			capKeyHandle[index]=User::LeaveIfError(iGroup->GroupWin()->CaptureKey(capKeys[index].keyCode,capKeys[index].modifier_mask,capKeys[index].modifiers));
sl@0
   108
	for(TInt index1=0;index1<numCapKeysWithPriority;index1++)
sl@0
   109
		if (capKeysWithPriority[index1].connIndex==iConnIndex)
sl@0
   110
			capKeyWithPriorityHandle[index1]=User::LeaveIfError(iGroup->GroupWin()->CaptureKey(capKeysWithPriority[index1].keyCode,capKeysWithPriority[index1].modifier_mask,capKeysWithPriority[index1].modifiers,capKeysWithPriority[index1].priority));
sl@0
   111
	for(TInt index2=0;index2<numUpDownKeys;index2++)
sl@0
   112
		if (capUpAndDownKeys[index2].connIndex==iConnIndex)
sl@0
   113
			capUpDownKeyHandle[index2]=User::LeaveIfError(iGroup->GroupWin()->CaptureKeyUpAndDowns(capUpAndDownKeys[index2].keyCode,
sl@0
   114
								capUpAndDownKeys[index2].modifier_mask,capUpAndDownKeys[index2].modifiers));
sl@0
   115
	for(TInt index3=0;index3<numUpDownKeysWithPriority;index3++)
sl@0
   116
		if (capUpAndDownKeysWithPriority[index3].connIndex==iConnIndex)
sl@0
   117
			capUpDownKeyWithPriorityHandle[index3]=User::LeaveIfError(iGroup->GroupWin()->CaptureKeyUpAndDowns(capUpAndDownKeysWithPriority[index3].keyCode,
sl@0
   118
								capUpAndDownKeysWithPriority[index3].modifier_mask,capUpAndDownKeysWithPriority[index3].modifiers,capUpAndDownKeysWithPriority[index3].priority));
sl@0
   119
	TSize screenSize=iGroup->Size();
sl@0
   120
	TInt winWidth=screenSize.iWidth/2;
sl@0
   121
	TInt winHeight=screenSize.iHeight-10;
sl@0
   122
	iGroup->GroupWin()->AutoForeground(EFalse);		// Don't allow clicking to cause foreground, might mess up test
sl@0
   123
	CCKWindow *win=new(ELeave) CCKWindow(iTest, iConnIndex);
sl@0
   124
	win->SetUpL(TPoint(5,5),TSize(winWidth,winHeight),iGroup,*iGc);
sl@0
   125
	iWin=win;
sl@0
   126
	}
sl@0
   127
sl@0
   128
void CCKConnection::KeyTestL(TInt aBool)
sl@0
   129
	{
sl@0
   130
	if (!aBool)
sl@0
   131
		{
sl@0
   132
		CTDialog *dialog= new(ELeave) CTDialog();
sl@0
   133
		TInt ret=0;
sl@0
   134
		if (dialog)
sl@0
   135
			{
sl@0
   136
			dialog->ConstructLD(*iGroup,*iGc);
sl@0
   137
			dialog->SetTitle(_L("Invalid key press"));
sl@0
   138
			dialog->SetLine1(_L("Try again?"));
sl@0
   139
			dialog->SetNumButtons(2);
sl@0
   140
			dialog->SetButtonText(0,_L("Fail"));
sl@0
   141
			dialog->SetButtonText(1,_L("Retry"));
sl@0
   142
			ret=dialog->Display();
sl@0
   143
			}
sl@0
   144
		User::Leave(ret==1 ? ECapKeyRetry : ECapKeyFail);
sl@0
   145
		}
sl@0
   146
	}
sl@0
   147
sl@0
   148
void CCKConnection::CheckKeyL(const SCapKeyTestParams &aKeyTest, const TKeyEvent &aKey)
sl@0
   149
	{
sl@0
   150
	KeyTestL(aKeyTest.keyCode==aKey.iCode);
sl@0
   151
	KeyTestL(aKeyTest.modifiers==(aKey.iModifiers&aKeyTest.modifier_mask));
sl@0
   152
	}
sl@0
   153
sl@0
   154
void CCKConnection::CheckUpDownL(const SCapKeyTestParams &aKeyTest, const TKeyEvent &aKey)
sl@0
   155
	{
sl@0
   156
	if(iTest->Mode()==EModeKeyUpsAndDownsWithPriority)
sl@0
   157
		KeyTestL(aKeyTest.connIndex==iTest->SubState()-15);
sl@0
   158
	KeyTestL(aKeyTest.connIndex==iConnIndex);
sl@0
   159
	KeyTestL(aKeyTest.keyCode==(TUint)aKey.iScanCode);
sl@0
   160
	KeyTestL(aKeyTest.modifiers==(aKey.iModifiers&aKeyTest.modifier_mask));
sl@0
   161
	}
sl@0
   162
sl@0
   163
void CCKConnection::KeyL(const TKeyEvent &aKey,const TTime &)
sl@0
   164
	{
sl@0
   165
#if defined(LOGGING)
sl@0
   166
	_LIT(KLog,"CCKConnection::KeyL  State=%d  SubState=%d  Mode=%d  KeyCode=%d  ScanCode=%d  Mod=0x%x");
sl@0
   167
	iTest->LOG_MESSAGE7(KLog,iTest->State(),iTest->SubState(),iTest->Mode(),aKey.iCode,aKey.iScanCode,aKey.iModifiers);
sl@0
   168
#endif
sl@0
   169
	if (iTest->Mode()==EModeNormalCapture || iTest->Mode()==EModeNormalCaptureWithPriority)
sl@0
   170
		{
sl@0
   171
		//if (aKey.iCode==EKeyEscape)
sl@0
   172
		//	iTest->Abort();
sl@0
   173
		if(iTest->Mode()==EModeNormalCaptureWithPriority)
sl@0
   174
			{
sl@0
   175
			SCapKeyTestParams tmpCapKeyTest=capKeyTests[iTest->SubState()];
sl@0
   176
			KeyTestL(tmpCapKeyTest.connIndex==iTest->SubState()-8);
sl@0
   177
			}
sl@0
   178
		TRAPD(ret,CheckKeyL(capKeyTests[iTest->SubState()],aKey));
sl@0
   179
		if (ret==ECapKeyOkay)
sl@0
   180
			iTest->IncSubState();
sl@0
   181
		else
sl@0
   182
			{
sl@0
   183
			iTest->TEST(ret==ECapKeyRetry);
sl@0
   184
			if (ret!=ECapKeyRetry)
sl@0
   185
				iTest->INFO_PRINTF3(_L("CheckKeyL(capKeyTests[iTest->SubState()],aKey) return value - Expected: %d, Actual: %d"), ECapKeyRetry, ret);		
sl@0
   186
			}
sl@0
   187
			
sl@0
   188
		}
sl@0
   189
	}
sl@0
   190
sl@0
   191
void CCKConnection::CheckUpDownL(const TKeyEvent &aKey)
sl@0
   192
	{
sl@0
   193
	CheckUpDownL(capKeyTests[iTest->SubState()],aKey);
sl@0
   194
	}
sl@0
   195
sl@0
   196
CCKAbortConnection::CCKAbortConnection(CTCaptureKey *aTest) : CCKConnectionBase(aTest)
sl@0
   197
	{
sl@0
   198
	}
sl@0
   199
sl@0
   200
CCKAbortConnection::~CCKAbortConnection()
sl@0
   201
	{
sl@0
   202
	iGroup->GroupWin()->RemovePriorityKey(3,EModifierCtrl,EModifierCtrl);
sl@0
   203
	delete iAbortHandler;
sl@0
   204
	}
sl@0
   205
sl@0
   206
void CCKAbortConnection::ConstructL()
sl@0
   207
	{
sl@0
   208
	CCKConnectionBase::ConstructL();
sl@0
   209
	User::LeaveIfError(iGroup->GroupWin()->AddPriorityKey(abortKeyTests[0].keyCode,abortKeyTests[0].modifier_mask,abortKeyTests[0].modifiers));
sl@0
   210
	User::LeaveIfError(iGroup->GroupWin()->AddPriorityKey(abortKeyTests[1].keyCode,abortKeyTests[1].modifier_mask,abortKeyTests[1].modifiers));
sl@0
   211
	User::LeaveIfError(iGroup->GroupWin()->AddPriorityKey(abortKeyTests[2].keyCode,abortKeyTests[2].modifier_mask,abortKeyTests[2].modifiers));
sl@0
   212
	iAbortHandler=new(ELeave) CAbortHandler(&iWs, this);
sl@0
   213
	iAbortHandler->Construct();
sl@0
   214
	iWs.Flush();
sl@0
   215
	}
sl@0
   216
sl@0
   217
void CCKAbortConnection::ReceivedAbortEvent(TInt aHandle,TKeyEvent* aKey)
sl@0
   218
	{
sl@0
   219
#if defined(LOGGING)
sl@0
   220
	_LIT(KLog,"CCKAbortConnection::ReceivedAbortEvent  State=%d  SubState=%d  Mode=%d  KeyCode=%d  ScanCode=%d  Mod=0x%x");
sl@0
   221
	iTest->LOG_MESSAGE7(KLog,iTest->State(),iTest->SubState(),iTest->Mode(),aKey->iCode,aKey->iScanCode,aKey->iModifiers);
sl@0
   222
#endif
sl@0
   223
	TInt group=reinterpret_cast<TInt>(iGroup);
sl@0
   224
	iTest->TEST(aHandle==group);
sl@0
   225
	if (aHandle!=group)
sl@0
   226
		{
sl@0
   227
		_LIT(KLog,"Event Handle is not for the right group, expected=%d actual=%d");
sl@0
   228
		iTest->LOG_MESSAGE3(KLog,group,aHandle);
sl@0
   229
		}
sl@0
   230
sl@0
   231
	iTest->TEST(aKey->iCode==abortKeyTests[iAbortKeyIndex].keyCode);
sl@0
   232
	if (aKey->iCode!=abortKeyTests[iAbortKeyIndex].keyCode)
sl@0
   233
		{
sl@0
   234
		_LIT(KLog,"The event KeyCode is not right, expected=%d actual=%d");
sl@0
   235
		iTest->LOG_MESSAGE3(KLog,abortKeyTests[iAbortKeyIndex].keyCode,aKey->iCode);
sl@0
   236
		}
sl@0
   237
sl@0
   238
	iTest->TEST((aKey->iModifiers&abortKeyTests[iAbortKeyIndex].modifier_mask)==abortKeyTests[iAbortKeyIndex].modifiers);
sl@0
   239
	if ((aKey->iModifiers&abortKeyTests[iAbortKeyIndex].modifier_mask)!=abortKeyTests[iAbortKeyIndex].modifiers)
sl@0
   240
		{
sl@0
   241
		_LIT(KLog,"The event modifiers are not right, expected=0x%x actual=0x%x (0x%x) mask=0x%x");
sl@0
   242
		iTest->LOG_MESSAGE5(KLog,abortKeyTests[iAbortKeyIndex].modifiers,aKey->iModifiers&abortKeyTests[iAbortKeyIndex].modifier_mask
sl@0
   243
									,aKey->iModifiers,abortKeyTests[iAbortKeyIndex].modifier_mask);
sl@0
   244
		}
sl@0
   245
	iAbortKeyIndex++;
sl@0
   246
	iTest->IncSubState();
sl@0
   247
	}
sl@0
   248
sl@0
   249
void CCKAbortConnection::Foreground()
sl@0
   250
	{
sl@0
   251
	iGroup->GroupWin()->SetOrdinalPosition(0);
sl@0
   252
	iWs.Flush();
sl@0
   253
	}
sl@0
   254
sl@0
   255
//
sl@0
   256
// CCKWindowGroup class //
sl@0
   257
//
sl@0
   258
sl@0
   259
CCKWindowGroup::CCKWindowGroup(CTClient *aClient, CTCaptureKey *aTest) : CTWindowGroup(aClient), iTest(aTest)
sl@0
   260
	{}
sl@0
   261
sl@0
   262
void CCKWindowGroup::KeyL(const TKeyEvent &aKey,const TTime &time)
sl@0
   263
	{
sl@0
   264
#if defined(LOGGING)
sl@0
   265
	_LIT(KLog,"CCKWindowGroup::KeyL  State=%d  SubState=%d  Mode=%d  KeyCode=%d  ScanCode=%d  Mod=0x%x");
sl@0
   266
	iTest->LOG_MESSAGE7(KLog,iTest->State(),iTest->SubState(),iTest->Mode(),aKey.iCode,aKey.iScanCode,aKey.iModifiers);
sl@0
   267
#endif
sl@0
   268
	if (iTest->Mode()==EModeWaitingForFirstNormalCapWithPriority)
sl@0
   269
		iTest->SetMode(EModeNormalCaptureWithPriority);
sl@0
   270
	if (iCurWin)
sl@0
   271
		iCurWin->WinKeyL(aKey,time);
sl@0
   272
	else
sl@0
   273
		((CCKConnection *)iClient)->KeyL(aKey,time);
sl@0
   274
	}
sl@0
   275
sl@0
   276
void CCKWindowGroup::KeyDownL(const TKeyEvent &aKey,const TTime &)
sl@0
   277
	{
sl@0
   278
#if defined(LOGGING)
sl@0
   279
	_LIT(KLog,"CCKWindowGroup::KeyDownL  State=%d  SubState=%d  Mode=%d  KeyCode=%d  ScanCode=%d  Mod=0x%x");
sl@0
   280
	iTest->LOG_MESSAGE7(KLog,iTest->State(),iTest->SubState(),iTest->Mode(),aKey.iCode,aKey.iScanCode,aKey.iModifiers);
sl@0
   281
#endif
sl@0
   282
	if (aKey.iScanCode!=EStdKeyLeftShift && aKey.iScanCode!=EStdKeyRightShift)
sl@0
   283
		{
sl@0
   284
		if (iTest->Mode()==EModeWaitingForFirstDown)
sl@0
   285
			iTest->SetMode(EModeKeyUpsAndDowns);
sl@0
   286
		if (iTest->Mode()==EModeWaitingForFirstDownWithPriority)
sl@0
   287
			iTest->SetMode(EModeKeyUpsAndDownsWithPriority);
sl@0
   288
		if (iTest->Mode()==EModeKeyUpsAndDowns || iTest->Mode()==EModeKeyUpsAndDownsWithPriority)
sl@0
   289
			((CCKConnection *)iClient)->CheckUpDownL(aKey);
sl@0
   290
		}
sl@0
   291
	}
sl@0
   292
sl@0
   293
void CCKWindowGroup::KeyUpL(const TKeyEvent &aKey,const TTime &)
sl@0
   294
	{
sl@0
   295
#if defined(LOGGING)
sl@0
   296
	_LIT(KLog,"CCKWindowGroup::KeyUpL  State=%d  SubState=%d  Mode=%d  KeyCode=%d  ScanCode=%d  Mod=0x%x");
sl@0
   297
	iTest->LOG_MESSAGE7(KLog,iTest->State(),iTest->SubState(),iTest->Mode(),aKey.iCode,aKey.iScanCode,aKey.iModifiers);
sl@0
   298
#endif
sl@0
   299
	if (aKey.iScanCode!=EStdKeyLeftShift && aKey.iScanCode!=EStdKeyRightShift)
sl@0
   300
		{
sl@0
   301
		if (iTest->Mode()==EModeKeyUpsAndDowns || iTest->Mode()==EModeKeyUpsAndDownsWithPriority)
sl@0
   302
			{
sl@0
   303
			((CCKConnection *)iClient)->CheckUpDownL(aKey);
sl@0
   304
			iTest->IncSubState();
sl@0
   305
			}
sl@0
   306
		}
sl@0
   307
	}
sl@0
   308
sl@0
   309
//
sl@0
   310
// CCKWindow, class //
sl@0
   311
//
sl@0
   312
sl@0
   313
CCKWindow::CCKWindow(CTCaptureKey *aTest, TInt aConnIndex) : CTWin(), iConnIndex(aConnIndex), iTest(aTest)
sl@0
   314
	{
sl@0
   315
	iBack=TRgb::Gray256(230);
sl@0
   316
	}
sl@0
   317
sl@0
   318
void CCKWindow::SetUpL(TPoint pos,TSize size,CTWinBase *parent, CWindowGc &aGc)
sl@0
   319
	{
sl@0
   320
	ConstructExtLD(*parent,pos,size);
sl@0
   321
	iWin.SetBackgroundColor(iBack);
sl@0
   322
	Activate();
sl@0
   323
	AssignGC(aGc);
sl@0
   324
	}
sl@0
   325
sl@0
   326
void CCKWindow::Draw()
sl@0
   327
	{
sl@0
   328
	iGc->Clear();
sl@0
   329
	if (iConnIndex==0)
sl@0
   330
		{
sl@0
   331
		TInt test=iTest->SubState();
sl@0
   332
		if (test<numTests)
sl@0
   333
			iGc->DrawText(TPtrC(capKeyTests[test].txt), TPoint(10,20));
sl@0
   334
		}
sl@0
   335
	}
sl@0
   336
sl@0
   337
//
sl@0
   338
sl@0
   339
CTCaptureKey::CTCaptureKey(CTestStep* aStep) : CTWsGraphicsBase(aStep)
sl@0
   340
	{
sl@0
   341
	}
sl@0
   342
	
sl@0
   343
CTCaptureKey::~CTCaptureKey()
sl@0
   344
	{
sl@0
   345
	((CTCaptureKeyStep*)iStep)->CloseTMSGraphicsStep();
sl@0
   346
	delete iConn1;
sl@0
   347
	delete iConn2;
sl@0
   348
	delete iConn3;
sl@0
   349
	delete iAbortConn;
sl@0
   350
	}
sl@0
   351
sl@0
   352
void CTCaptureKey::ConstructL()
sl@0
   353
	{
sl@0
   354
	iAbortConn=new(ELeave) CCKAbortConnection(this);
sl@0
   355
	iAbortConn->ConstructL();
sl@0
   356
	iConn3=new(ELeave) CCKConnection(this,2);
sl@0
   357
	iConn3->ConstructL();
sl@0
   358
	iConn2=new(ELeave) CCKConnection(this,1);
sl@0
   359
	iConn2->ConstructL();
sl@0
   360
	iConn1=new(ELeave) CCKConnection(this,0);
sl@0
   361
	iConn1->ConstructL();
sl@0
   362
	iMode=EModeNormalCapture;
sl@0
   363
	SetSelfDrive(ETrue);
sl@0
   364
	TUint mods=TheClient->iWs.GetModifierState();
sl@0
   365
	_LIT(KLog,"Initial Modifiers state 0x%x (ideally should be zero)");
sl@0
   366
	LOG_MESSAGE2(KLog,mods);
sl@0
   367
	}
sl@0
   368
sl@0
   369
TInt CTCaptureKey::SubState() const
sl@0
   370
	{
sl@0
   371
	return(iSubState);
sl@0
   372
	}
sl@0
   373
sl@0
   374
void CTCaptureKey::IncSubState()
sl@0
   375
	{
sl@0
   376
	iSubState++;
sl@0
   377
#if defined(LOGGING)
sl@0
   378
	_LIT(KLog,"IncSubState  State=%d  SubState=%d  Mode=%d");
sl@0
   379
	LOG_MESSAGE4(KLog,iState,iSubState,iMode);
sl@0
   380
#endif
sl@0
   381
	iConn1->SubStateChanged();
sl@0
   382
	iConn2->SubStateChanged();
sl@0
   383
	iConn3->SubStateChanged();
sl@0
   384
	switch(iMode)
sl@0
   385
		{
sl@0
   386
		case EModeNormalCapture:
sl@0
   387
			if (iSubState==numCapKeyTests)
sl@0
   388
				{
sl@0
   389
				CaseComplete();
sl@0
   390
				return;
sl@0
   391
				}
sl@0
   392
			break;
sl@0
   393
		case EModeNormalCaptureWithPriority:
sl@0
   394
			if (iSubState==numCapKeyTests+numCapKeyWithPriorityTests)
sl@0
   395
				{
sl@0
   396
				CaseComplete();
sl@0
   397
				return;
sl@0
   398
				}
sl@0
   399
			break;
sl@0
   400
		case EModeKeyUpsAndDowns:
sl@0
   401
			if (iSubState==(numCapKeyTests+numCapKeyWithPriorityTests+numUpDownKeyTests))
sl@0
   402
				{
sl@0
   403
				CaseComplete();
sl@0
   404
				return;
sl@0
   405
				}
sl@0
   406
			break;
sl@0
   407
		case EModeKeyUpsAndDownsWithPriority:
sl@0
   408
			if (iSubState==(numCapKeyTests+numCapKeyWithPriorityTests+numUpDownKeyTests+numUpDownKeyWithPriorityTests))
sl@0
   409
				{
sl@0
   410
				SetSelfDrive(EFalse);
sl@0
   411
				return;
sl@0
   412
				}
sl@0
   413
			break;
sl@0
   414
		case EModeAbortKeys:
sl@0
   415
			if (iSubState==(numCapKeyTests+numCapKeyWithPriorityTests+numUpDownKeyTests+numUpDownKeyWithPriorityTests+numAbortKeyTests))
sl@0
   416
				++iState;
sl@0
   417
			TheClient->WaitForRedrawsToFinish();
sl@0
   418
			return;
sl@0
   419
		default:
sl@0
   420
			break;
sl@0
   421
		}
sl@0
   422
	TheClient->WaitForRedrawsToFinish();
sl@0
   423
	SendEvents();
sl@0
   424
	}
sl@0
   425
sl@0
   426
void CTCaptureKey::CapKeyPurgingL()
sl@0
   427
	{
sl@0
   428
	TInt base=Client()->iWs.ResourceCount();
sl@0
   429
	RWindowGroup groupWin(Client()->iWs);
sl@0
   430
	User::LeaveIfError(groupWin.Construct(ENullWsHandle));
sl@0
   431
	TInt capHandle=User::LeaveIfError(groupWin.CaptureKey('a',EModifierFunc,EModifierFunc));
sl@0
   432
	User::LeaveIfError(groupWin.CaptureKey('b',EModifierFunc,EModifierFunc));
sl@0
   433
	TInt retVal = Client()->iWs.ResourceCount();
sl@0
   434
	TEST(retVal==(base+3));
sl@0
   435
	if (retVal!=(base+3))
sl@0
   436
		INFO_PRINTF3(_L("Client()->iWs.ResourceCount() return value - Expected: %d, Actual: %d"), retVal, (base+3));		
sl@0
   437
sl@0
   438
	groupWin.CancelCaptureKey(capHandle);
sl@0
   439
	retVal = Client()->iWs.ResourceCount();
sl@0
   440
	TEST(retVal==(base+2));
sl@0
   441
	if (retVal!=(base+2))
sl@0
   442
		INFO_PRINTF3(_L("Client()->iWs.ResourceCount() return value - Expected: %d, Actual: %d"), retVal, (base+2));		
sl@0
   443
sl@0
   444
	groupWin.Close();
sl@0
   445
	// Check it also freed the extra capture key
sl@0
   446
	retVal = Client()->iWs.ResourceCount();
sl@0
   447
	TEST(retVal==base);
sl@0
   448
	if (retVal!=base)
sl@0
   449
		INFO_PRINTF3(_L("Client()->iWs.ResourceCount() return value - Expected: %d, Actual: %d"), retVal, base);		
sl@0
   450
sl@0
   451
	}
sl@0
   452
sl@0
   453
void CTCaptureKey::BadParams()
sl@0
   454
	{
sl@0
   455
	TInt retVal;
sl@0
   456
	TInt resCount=Client()->iWs.ResourceCount();
sl@0
   457
	for(TInt index=0;index<numErrorKeys;index++)
sl@0
   458
		{
sl@0
   459
		retVal = Client()->iGroup->GroupWin()->CaptureKey(errorKeys[index].keyCode,errorKeys[index].modifier_mask,errorKeys[index].modifiers, errorKeys[index].priority);
sl@0
   460
		TEST(retVal==KErrArgument);
sl@0
   461
		if (retVal!=KErrArgument)
sl@0
   462
			{
sl@0
   463
			_LIT(KMsg, "CaptureKey() with bad parameter set %d returned %d - expected KErrArgument (%d)");
sl@0
   464
			LOG_MESSAGE4(KMsg, index, retVal, KErrArgument);	
sl@0
   465
			}
sl@0
   466
sl@0
   467
		retVal = Client()->iGroup->GroupWin()->CaptureKeyUpAndDowns(errorKeys[index].keyCode, errorKeys[index].modifier_mask, errorKeys[index].modifiers, errorKeys[index].priority);
sl@0
   468
		TEST(retVal == KErrArgument);
sl@0
   469
		if (retVal != KErrArgument)
sl@0
   470
			{
sl@0
   471
			_LIT(KMsg, "CaptureKeyUpAndDowns() with bad parameter set %d returned %d - expected KErrArgument (%d)");
sl@0
   472
			LOG_MESSAGE4(KMsg, index, retVal, KErrArgument);	
sl@0
   473
			}
sl@0
   474
sl@0
   475
		retVal = Client()->iGroup->GroupWin()->CaptureLongKey(errorKeys[index].keyCode, errorKeys[index].keyCode, errorKeys[index].modifier_mask, errorKeys[index].modifiers, errorKeys[index].priority, ELongCaptureNormal);
sl@0
   476
		TEST(retVal == KErrArgument);
sl@0
   477
		if (retVal != KErrArgument)
sl@0
   478
			{
sl@0
   479
			_LIT(KMsg, "CaptureLongKey() with bad parameter set %d returned %d - expected KErrArgument (%d)");
sl@0
   480
			LOG_MESSAGE4(KMsg, index, retVal, KErrArgument);	
sl@0
   481
			}
sl@0
   482
		}
sl@0
   483
sl@0
   484
	retVal = Client()->iWs.ResourceCount();
sl@0
   485
	TEST(retVal==resCount);
sl@0
   486
	if (retVal!=resCount)
sl@0
   487
		{
sl@0
   488
		_LIT(KMsg, "Resource count %d - expected %d");
sl@0
   489
		LOG_MESSAGE3(KMsg, retVal, resCount);	
sl@0
   490
		}
sl@0
   491
	}
sl@0
   492
sl@0
   493
void CTCaptureKey::SetMode(TTestMode aMode)
sl@0
   494
	{
sl@0
   495
#if defined(LOGGING)
sl@0
   496
	_LIT(KLog,"SetMode  State=%d  SubState=%d  OldMode=%d  NewMode=%d");
sl@0
   497
	LOG_MESSAGE5(KLog,State(),SubState(),iMode,aMode);
sl@0
   498
#endif
sl@0
   499
	iMode=aMode;
sl@0
   500
	}
sl@0
   501
sl@0
   502
TTestMode CTCaptureKey::Mode()
sl@0
   503
	{
sl@0
   504
	return(iMode);
sl@0
   505
	}
sl@0
   506
sl@0
   507
void CTCaptureKey::SetUpPriorityKeyTest()
sl@0
   508
	{
sl@0
   509
	iMode=EModeAbortKeys;
sl@0
   510
	iAbortConn->Foreground();
sl@0
   511
	}
sl@0
   512
sl@0
   513
void CTCaptureKey::CaptureWithPriorityTest() //normal key capture but with priority
sl@0
   514
	{
sl@0
   515
	iMode=EModeWaitingForFirstNormalCapWithPriority;
sl@0
   516
	}
sl@0
   517
sl@0
   518
void CTCaptureKey::CaptureUpsAndDownsTest()
sl@0
   519
	{
sl@0
   520
	iMode=EModeWaitingForFirstDown;
sl@0
   521
	}
sl@0
   522
sl@0
   523
void CTCaptureKey::CaptureUpsAndDownsWithPriorityTest()
sl@0
   524
	{
sl@0
   525
	iMode=EModeWaitingForFirstDownWithPriority;
sl@0
   526
	}
sl@0
   527
sl@0
   528
void CTCaptureKey::SendEvents()
sl@0
   529
	{
sl@0
   530
#if defined(LOGGING)
sl@0
   531
	_LIT(KLog,"SendEvents  State=%d  SubState=%d");
sl@0
   532
	LOG_MESSAGE3(KLog,iState,iSubState);
sl@0
   533
#endif
sl@0
   534
	switch (iSubState)
sl@0
   535
		{
sl@0
   536
	case 0:
sl@0
   537
		iTest->SimulateKeyDownUp('Q');
sl@0
   538
		break;
sl@0
   539
	case 1:
sl@0
   540
		iTest->SimulateKeyDownUpWithModifiers('W',EModifierAlt);
sl@0
   541
		break;
sl@0
   542
	case 2:
sl@0
   543
		iTest->SimulateKeyDownUp('A');
sl@0
   544
		break;
sl@0
   545
	case 3:
sl@0
   546
		iTest->SimulateKeyDownUpWithModifiers('S',EModifierAlt|EModifierCtrl);
sl@0
   547
		break;
sl@0
   548
	case 4:
sl@0
   549
		iTest->SimulateKeyDownUpWithModifiers('N',EModifierAlt);
sl@0
   550
		break;
sl@0
   551
	case 5:
sl@0
   552
		iTest->SimulateKeyDownUpWithModifiers('B',EModifierAlt|EModifierCtrl);
sl@0
   553
		break;
sl@0
   554
	case 6:
sl@0
   555
		iTest->SimulateKeyDownUpWithModifiers('D',EModifierAlt);
sl@0
   556
		break;
sl@0
   557
	case 7:
sl@0
   558
		iTest->SimulateKeyDownUpWithModifiers('C',EModifierAlt|EModifierCtrl);
sl@0
   559
		break;
sl@0
   560
	case 8:
sl@0
   561
		iTest->SimulateKeyDownUp('H');//state EModeNormalCaptureWithPriority
sl@0
   562
		break;
sl@0
   563
	case 9:
sl@0
   564
		iTest->SimulateKeyDownUp('J');
sl@0
   565
		break;
sl@0
   566
	case 10:
sl@0
   567
		iTest->SimulateKeyDownUp('K');
sl@0
   568
		break;
sl@0
   569
	case 11:
sl@0
   570
		iTest->SimulateKeyDownUp(EStdKeySpace);
sl@0
   571
		break;
sl@0
   572
	case 12:
sl@0
   573
		iTest->SimulateKeyDownUp(EStdKeyEnter);
sl@0
   574
		break;
sl@0
   575
	case 13:
sl@0
   576
		iTest->SimulateKeyDownUpWithModifiers(EStdKeySpace,EModifierShift);
sl@0
   577
		break;
sl@0
   578
	case 14:
sl@0
   579
		iTest->SimulateKeyDownUpWithModifiers(EStdKeyEnter,EModifierShift);
sl@0
   580
		break;
sl@0
   581
	case 15:
sl@0
   582
		iTest->SimulateKeyDownUp('H');//state EModeKeyUpsAndDownsWithPriority
sl@0
   583
		break;
sl@0
   584
	case 16:
sl@0
   585
		iTest->SimulateKeyDownUp('J');
sl@0
   586
		break;
sl@0
   587
	case 17:
sl@0
   588
		iTest->SimulateKeyDownUp('K');
sl@0
   589
		break;
sl@0
   590
	case 18:
sl@0
   591
		iTest->SimulateKeyDownUpWithModifiers('C',EModifierCtrl);
sl@0
   592
		break;
sl@0
   593
	case 19:
sl@0
   594
		iTest->SimulateKeyDownUpWithModifiers('D',EModifierCtrl);
sl@0
   595
		break;
sl@0
   596
	case 20:
sl@0
   597
		iTest->SimulateKeyDownUp('Z');
sl@0
   598
		break;
sl@0
   599
	default:
sl@0
   600
		TEST(EFalse);
sl@0
   601
		}
sl@0
   602
	TheClient->iWs.Flush();
sl@0
   603
	}
sl@0
   604
sl@0
   605
void CTCaptureKey::CapKeyPowerOffL()
sl@0
   606
	{
sl@0
   607
	const TUint protKey=0xF844;		//This value needs to be defined in the WSINI.INI file as a key only capturable by a certain application
sl@0
   608
	RWsSession ws;
sl@0
   609
	User::LeaveIfError(ws.Connect());
sl@0
   610
	CleanupClosePushL(ws);
sl@0
   611
	
sl@0
   612
	// assign to the correct screen
sl@0
   613
	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
sl@0
   614
	CleanupStack::PushL(screen);
sl@0
   615
	User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
sl@0
   616
	
sl@0
   617
	RWindowGroup group(ws);
sl@0
   618
	group.Construct(ENullWsHandle);
sl@0
   619
	CleanupClosePushL(group);
sl@0
   620
	group.EnableReceiptOfFocus(EFalse);
sl@0
   621
	group.SetOrdinalPosition(0,5);
sl@0
   622
	RBlankWindow blank(ws);
sl@0
   623
	blank.Construct(group,ENullWsHandle);
sl@0
   624
	CleanupClosePushL(blank);
sl@0
   625
	blank.EnableBackup();
sl@0
   626
	blank.Activate();
sl@0
   627
	_LIT(kGroupName1,"Hello");
sl@0
   628
	group.SetName(kGroupName1);
sl@0
   629
	TInt capHandle = group.CaptureKey(EKeyDevice2,EModifierFunc,EModifierFunc);
sl@0
   630
	TEST(capHandle==KErrPermissionDenied);
sl@0
   631
	if (capHandle!=KErrPermissionDenied)
sl@0
   632
		{
sl@0
   633
		_LIT(KLog1,"Capture Key suceeded when it should of failed, Error/Handle=%d (expected: %d)");
sl@0
   634
		LOG_MESSAGE3(KLog1,capHandle,KErrPermissionDenied);
sl@0
   635
		_LIT(KLog2,"This is indicative of a bad WSINI file");
sl@0
   636
		LOG_MESSAGE(KLog2);
sl@0
   637
		}
sl@0
   638
sl@0
   639
	capHandle=group.CaptureKeyUpAndDowns(protKey,0,0);
sl@0
   640
	TEST(capHandle==KErrPermissionDenied);
sl@0
   641
	if (capHandle!=KErrPermissionDenied)
sl@0
   642
		{
sl@0
   643
		_LIT(KLog,"Capture Key Up & Down suceeded when it should of failed, Error/Handle=%d (expected: %d)");
sl@0
   644
		LOG_MESSAGE3(KLog,capHandle,KErrPermissionDenied);
sl@0
   645
		}
sl@0
   646
	
sl@0
   647
	_LIT(kGroupName2,"SysApp");
sl@0
   648
	group.SetName(kGroupName2);
sl@0
   649
	capHandle = group.CaptureKey(EKeyDevice2,EModifierFunc,EModifierFunc);
sl@0
   650
	TEST(capHandle > 0);
sl@0
   651
	if (capHandle<=0)
sl@0
   652
		{
sl@0
   653
		_LIT(KLog,"Capture Key failed when it should of succeeded, Error=%d");
sl@0
   654
		LOG_MESSAGE2(KLog,capHandle);
sl@0
   655
		}
sl@0
   656
sl@0
   657
	group.CancelCaptureKey(capHandle);
sl@0
   658
	capHandle=group.CaptureKeyUpAndDowns(protKey,0,0);
sl@0
   659
	TEST(capHandle > 0);
sl@0
   660
	if (capHandle<=0)
sl@0
   661
		{
sl@0
   662
		_LIT(KLog,"Capture Key Up & Down failed when it should of succeeded, Error=%d");
sl@0
   663
		LOG_MESSAGE2(KLog,capHandle);
sl@0
   664
		}
sl@0
   665
sl@0
   666
	group.CancelCaptureKeyUpAndDowns(capHandle);
sl@0
   667
	CleanupStack::PopAndDestroy(4,&ws);
sl@0
   668
	}
sl@0
   669
sl@0
   670
sl@0
   671
void CTCaptureKey::RunTestCaseL(TInt /*aCurTestCase*/)
sl@0
   672
	{
sl@0
   673
	_LIT(Test0,"Normal capture with priority");
sl@0
   674
	_LIT(TestNormalCaptureWithPriority,"Normal capture with priority");
sl@0
   675
	_LIT(TestUpDown,"Capture ups and downs");
sl@0
   676
	_LIT(TestUpDownWithPriority,"Capture ups and downs with priority");
sl@0
   677
	_LIT(TestAbort,"Abort key");
sl@0
   678
	_LIT(TestAbort2,"Abort key extended");
sl@0
   679
	_LIT(TestErrors,"Errors");
sl@0
   680
	_LIT(TestCaptureKey,"Capture Key");
sl@0
   681
	_LIT(TestCapturePowerOffKey,"Capture PowerOff Key");
sl@0
   682
sl@0
   683
	iTest->iState=iState;
sl@0
   684
	((CTCaptureKeyStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
sl@0
   685
	switch(iState)
sl@0
   686
		{
sl@0
   687
/**
sl@0
   688
@SYMTestCaseID		GRAPHICS-WSERV-0140
sl@0
   689
sl@0
   690
sl@0
   691
@SYMDEF             DEF081259
sl@0
   692
sl@0
   693
@SYMTestCaseDesc    Normal key capture test
sl@0
   694
sl@0
   695
@SYMTestPriority    High
sl@0
   696
sl@0
   697
@SYMTestStatus      Implemented
sl@0
   698
sl@0
   699
@SYMTestActions     The test uses 3 wserv clients with their own window groups. The 
sl@0
   700
					clients are registered for different keys to capture. The test 
sl@0
   701
					simulates key presses.
sl@0
   702
sl@0
   703
@SYMTestExpectedResults Checks that the key presses are captured correctly .
sl@0
   704
*/
sl@0
   705
		case 0:	// Dummy one to let capture key tests run
sl@0
   706
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0140"));
sl@0
   707
			iTest->LogSubTest(Test0);
sl@0
   708
			iState++;
sl@0
   709
			SendEvents();
sl@0
   710
			break;
sl@0
   711
/**
sl@0
   712
@SYMTestCaseID		GRAPHICS-WSERV-0141
sl@0
   713
sl@0
   714
@SYMDEF             DEF081259
sl@0
   715
sl@0
   716
@SYMTestCaseDesc    Normal key capture test with priorities
sl@0
   717
sl@0
   718
@SYMTestPriority    High
sl@0
   719
sl@0
   720
@SYMTestStatus      Implemented
sl@0
   721
sl@0
   722
@SYMTestActions     The test uses 3 wserv clients with their own window groups. The 
sl@0
   723
					clients are registered for different keys to capture and with
sl@0
   724
					different priorities. The test simulates key presses.
sl@0
   725
sl@0
   726
@SYMTestExpectedResults Checks that the key presses are captured correctly .
sl@0
   727
*/
sl@0
   728
		case 1:
sl@0
   729
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0141"));
sl@0
   730
			iTest->LogSubTest(TestNormalCaptureWithPriority);
sl@0
   731
			CaptureWithPriorityTest();
sl@0
   732
			iState++;
sl@0
   733
			SendEvents();
sl@0
   734
			break;
sl@0
   735
/**
sl@0
   736
@SYMTestCaseID		GRAPHICS-WSERV-0142
sl@0
   737
sl@0
   738
@SYMDEF             DEF081259
sl@0
   739
sl@0
   740
@SYMTestCaseDesc    Up-down key capture test
sl@0
   741
sl@0
   742
@SYMTestPriority    High
sl@0
   743
sl@0
   744
@SYMTestStatus      Implemented
sl@0
   745
sl@0
   746
@SYMTestActions     The test uses 3 wserv clients with their own window groups. The 
sl@0
   747
					clients are registered for different keys to capture their
sl@0
   748
					up and down events. The test simulates key presses and releases.
sl@0
   749
sl@0
   750
@SYMTestExpectedResults Checks that the key presses and releases are captured correctly .
sl@0
   751
*/
sl@0
   752
		case 2:
sl@0
   753
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0142"));
sl@0
   754
			iTest->LogSubTest(TestUpDown);
sl@0
   755
			CaptureUpsAndDownsTest();
sl@0
   756
			iState++;
sl@0
   757
			SendEvents();
sl@0
   758
			break;
sl@0
   759
/**
sl@0
   760
@SYMTestCaseID		GRAPHICS-WSERV-0143
sl@0
   761
sl@0
   762
@SYMDEF             DEF081259
sl@0
   763
sl@0
   764
@SYMTestCaseDesc    Up-down key capture test with priorities
sl@0
   765
sl@0
   766
@SYMTestPriority    High
sl@0
   767
sl@0
   768
@SYMTestStatus      Implemented
sl@0
   769
sl@0
   770
@SYMTestActions     The test uses 3 wserv clients with their own window groups. The 
sl@0
   771
					clients are registered with different priorities for different keys to capture their
sl@0
   772
					up and down events. The test simulates key presses and releases.
sl@0
   773
sl@0
   774
@SYMTestExpectedResults Checks that the key presses and releases are captured correctly .
sl@0
   775
*/
sl@0
   776
		case 3:
sl@0
   777
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0143"));
sl@0
   778
			iTest->LogSubTest(TestUpDownWithPriority);
sl@0
   779
			CaptureUpsAndDownsWithPriorityTest();
sl@0
   780
			iState++;
sl@0
   781
			SendEvents();
sl@0
   782
			break;
sl@0
   783
/**
sl@0
   784
@SYMTestCaseID		GRAPHICS-WSERV-0144
sl@0
   785
sl@0
   786
@SYMDEF             DEF081259
sl@0
   787
sl@0
   788
@SYMTestCaseDesc    Priority key events test
sl@0
   789
sl@0
   790
@SYMTestPriority    High
sl@0
   791
sl@0
   792
@SYMTestStatus      Implemented
sl@0
   793
sl@0
   794
@SYMTestActions     The test simulates key events and make sure that the events are 
sl@0
   795
					recieved by the registered wserv client.
sl@0
   796
sl@0
   797
@SYMTestExpectedResults Makes sure that key code is the same as a key simulated, event modifiers comply
sl@0
   798
					with registered priority key's modifirs and mask, and that event handle 
sl@0
   799
					is a window group of the session.
sl@0
   800
					
sl@0
   801
*/
sl@0
   802
		case 4:
sl@0
   803
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0144"));
sl@0
   804
			if (iSubState==numCapKeyTests+numUpDownKeyWithPriorityTests+numUpDownKeyTests+numUpDownKeyWithPriorityTests)
sl@0
   805
				{
sl@0
   806
				iTest->LogSubTest(TestAbort);
sl@0
   807
				SetUpPriorityKeyTest();
sl@0
   808
				}
sl@0
   809
			else
sl@0
   810
				iTest->LogSubTest(TestAbort2);
sl@0
   811
			//iState++;
sl@0
   812
			SendEvents();
sl@0
   813
			TheClient->WaitUntilEventPending();
sl@0
   814
			break;
sl@0
   815
/**
sl@0
   816
@SYMTestCaseID		GRAPHICS-WSERV-0145
sl@0
   817
sl@0
   818
@SYMDEF             DEF081259
sl@0
   819
sl@0
   820
@SYMTestCaseDesc    Invalid capture keys test
sl@0
   821
sl@0
   822
@SYMTestPriority    High
sl@0
   823
sl@0
   824
@SYMTestStatus      Implemented
sl@0
   825
sl@0
   826
@SYMTestActions     Memorizes amount of objects that the server has allocated for that client.
sl@0
   827
					Tries to register capture keys with invalid modifiers and
sl@0
   828
					modifier mask pairs, using each of the RWindowGroup capture
sl@0
   829
					functions CaptureKey(), CaptureKeyUpAndDowns() and
sl@0
   830
					CaptureLongKey().
sl@0
   831
sl@0
   832
@SYMTestExpectedResults Makes sure that the number of server-side objects for the 
sl@0
   833
					session didn't change.
sl@0
   834
*/
sl@0
   835
		case 5:
sl@0
   836
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0145"));
sl@0
   837
			iTest->LogSubTest(TestErrors);
sl@0
   838
			BadParams();
sl@0
   839
			((CTCaptureKeyStep*)iStep)->RecordTestResultL();
sl@0
   840
/**
sl@0
   841
@SYMTestCaseID		GRAPHICS-WSERV-0146
sl@0
   842
sl@0
   843
@SYMDEF             DEF081259
sl@0
   844
sl@0
   845
@SYMTestCaseDesc    Capture keys clean up test
sl@0
   846
sl@0
   847
@SYMTestPriority    High
sl@0
   848
sl@0
   849
@SYMTestStatus      Implemented
sl@0
   850
sl@0
   851
@SYMTestActions     Memorizes amount of objects that the server has allocated for that client.
sl@0
   852
					Creates a window group and requests two keys to be captured.
sl@0
   853
					Cancels one key capture request and closes the window group.
sl@0
   854
sl@0
   855
@SYMTestExpectedResults Checks that creation of the group or registering a capture key
sl@0
   856
					increased this amount by 1 each time.
sl@0
   857
					Makes sure that the number of server-side objects for the 
sl@0
   858
					session in the end of the test is the same as in the beginning.
sl@0
   859
*/
sl@0
   860
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0146"));
sl@0
   861
			iTest->LogSubTest(TestCaptureKey);
sl@0
   862
			CapKeyPurgingL();
sl@0
   863
			iState++;
sl@0
   864
			break;
sl@0
   865
/**
sl@0
   866
@SYMTestCaseID		GRAPHICS-WSERV-0147
sl@0
   867
sl@0
   868
@SYMDEF             DEF081259
sl@0
   869
sl@0
   870
@SYMTestCaseDesc    Capture power off key test
sl@0
   871
sl@0
   872
@SYMTestPriority    High
sl@0
   873
sl@0
   874
@SYMTestStatus      Implemented
sl@0
   875
sl@0
   876
@SYMTestActions     The test creates a new session, new window group and a new window
sl@0
   877
					in the group. After that the test gives "Hello" name to the group
sl@0
   878
					and tries to register for key capture of FN+EKeyDevice2 and 0xF844
sl@0
   879
					buttons. Makes sure that registration fails due to KErrPermissionDenied
sl@0
   880
					error.
sl@0
   881
					Then the test changes the name of the window group to "SysApp"
sl@0
   882
					and tries the registration again. Makes sure that operation 
sl@0
   883
					completed successfully.
sl@0
   884
sl@0
   885
@SYMTestExpectedResults See actions
sl@0
   886
*/
sl@0
   887
		case 6:
sl@0
   888
			((CTCaptureKeyStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0147"));
sl@0
   889
			iTest->LogSubTest(TestCapturePowerOffKey);
sl@0
   890
			CapKeyPowerOffL();
sl@0
   891
			iState++;
sl@0
   892
			break;
sl@0
   893
		default:
sl@0
   894
			((CTCaptureKeyStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
   895
			TestComplete();
sl@0
   896
		}
sl@0
   897
	((CTCaptureKeyStep*)iStep)->RecordTestResultL();
sl@0
   898
sl@0
   899
	}
sl@0
   900
sl@0
   901
sl@0
   902
__WS_CONSTRUCT_STEP__(CaptureKey)