os/graphics/windowing/windowserver/test/tauto/TAUTODLL.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-2009 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
// Client side of AUTODLL test code
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @test
sl@0
    21
 @internalComponent - Internal Symbian test code
sl@0
    22
*/
sl@0
    23
sl@0
    24
#include "TAUTODLL.H"
sl@0
    25
#include "TEVENT.H"
sl@0
    26
sl@0
    27
//#define LOGGING
sl@0
    28
sl@0
    29
//
sl@0
    30
sl@0
    31
sl@0
    32
CGraphicsContext::TDrawMode CAnimWindow::iEllipseDrawMode;
sl@0
    33
sl@0
    34
CTAnimDll::CTAnimDll(CTestStep* aStep) : CTWsGraphicsBase(aStep)
sl@0
    35
	{
sl@0
    36
	}
sl@0
    37
sl@0
    38
RTestAnim::RTestAnim() : RAnim()
sl@0
    39
	{
sl@0
    40
	}
sl@0
    41
sl@0
    42
RTestAnim::RTestAnim(RAnimDll &aDll) : RAnim(aDll)
sl@0
    43
	{
sl@0
    44
	}
sl@0
    45
sl@0
    46
LOCAL_C TInt DoPanicTest(TInt aInt, TAny *aScreenNumber)
sl@0
    47
	{
sl@0
    48
	RWsSession ws;
sl@0
    49
	User::LeaveIfError(ws.Connect());
sl@0
    50
sl@0
    51
	// assign to the correct screen
sl@0
    52
	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
sl@0
    53
	User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
sl@0
    54
sl@0
    55
	RWindowGroup group(ws);
sl@0
    56
	User::LeaveIfError(group.Construct(333));
sl@0
    57
	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
sl@0
    58
	RAnimDll animDll=RAnimDll(ws);
sl@0
    59
	User::LeaveIfError(animDll.Load(KAnimDLLName));
sl@0
    60
	RTestAnim panic(animDll);
sl@0
    61
	RWindow window(ws);
sl@0
    62
	RBlankWindow blankwin(ws);
sl@0
    63
	if (aInt==16 || aInt==17)	// Use a blank window for this one
sl@0
    64
		{
sl@0
    65
		User::LeaveIfError(blankwin.Construct(group,123));
sl@0
    66
		blankwin.SetSize(TSize(10,10));
sl@0
    67
		blankwin.Activate();
sl@0
    68
		User::LeaveIfError(panic.Construct(blankwin,EAnimTypeTest1,TPtrC8()));
sl@0
    69
		}
sl@0
    70
	else
sl@0
    71
		{
sl@0
    72
		User::LeaveIfError(window.Construct(group,123));
sl@0
    73
		window.SetSize(TSize(10,10));
sl@0
    74
		window.Activate();
sl@0
    75
		window.BeginRedraw();
sl@0
    76
		window.EndRedraw();
sl@0
    77
		if (aInt==0)
sl@0
    78
			User::LeaveIfError(panic.Construct(window,EAnimTypeTest2,TPtrC8()));
sl@0
    79
		User::LeaveIfError(panic.Construct(window,EAnimTypeTest1,TPtrC8()));
sl@0
    80
		}
sl@0
    81
	TPckgBuf<TPoint> dummyParam;
sl@0
    82
	switch(aInt)
sl@0
    83
		{
sl@0
    84
		case 1:
sl@0
    85
			panic.Command(EADllPanicCallPanic);
sl@0
    86
			break;
sl@0
    87
		case 2:
sl@0
    88
			panic.Command(EADllPanicCallPanic,dummyParam);
sl@0
    89
			break;
sl@0
    90
		case 3:
sl@0
    91
			panic.CommandReply(EADllPanicCallPanic);
sl@0
    92
			break;
sl@0
    93
		case 4:
sl@0
    94
			panic.CommandReply(EADllPanicCallPanic,dummyParam);
sl@0
    95
			break;
sl@0
    96
		case 5:
sl@0
    97
			panic.Command(EADllPanicSetInterval);
sl@0
    98
			break;
sl@0
    99
		case 6:
sl@0
   100
			panic.Command(EADllPanicSetNextInterval);
sl@0
   101
			break;
sl@0
   102
		case 7:
sl@0
   103
			panic.CommandReply(EADllPanicBadFont);
sl@0
   104
			break;
sl@0
   105
		case 8:
sl@0
   106
			panic.CommandReply(EADllPanicBadBitmap);
sl@0
   107
			break;
sl@0
   108
		case 9:
sl@0
   109
			panic.Command(EADllPanicLeave);
sl@0
   110
			break;
sl@0
   111
		case 10:
sl@0
   112
			panic.Command(EADllPanicDoubleActivateGC);
sl@0
   113
			break;
sl@0
   114
		case 11:
sl@0
   115
			panic.Command(EADllPanicDrawRectWithNoGc);
sl@0
   116
			break;
sl@0
   117
		case 12:
sl@0
   118
			panic.Command(EADllPanicDrawTextWithNoFont);
sl@0
   119
			break;
sl@0
   120
		case 13:
sl@0
   121
			panic.Command(EADllPanicLeaveInAnimate);
sl@0
   122
			ws.Finish();
sl@0
   123
			panic.CommandReply(EADllBlankOpCode);
sl@0
   124
			break;
sl@0
   125
		case 14:
sl@0
   126
			panic.Command(EADllPanicLeaveInRedraw);
sl@0
   127
			window.BeginRedraw();
sl@0
   128
			window.EndRedraw();
sl@0
   129
			ws.Finish();
sl@0
   130
			panic.CommandReply(EADllBlankOpCode);
sl@0
   131
			break;
sl@0
   132
		case 15:
sl@0
   133
			ws.TestWrite(animDll.WsHandle(),999,NULL,0);
sl@0
   134
			break;
sl@0
   135
		case 16:
sl@0
   136
			panic.Command(EADllPanicSetVisWithGcActive);
sl@0
   137
			break;
sl@0
   138
		case 17:
sl@0
   139
			panic.CommandReply(EADllPanicSetVisWithGcActiveReply);
sl@0
   140
			break;
sl@0
   141
		case 18:
sl@0
   142
			panic.Command(EADllPanicLeaveInActiveCallback);
sl@0
   143
			ws.Flush();
sl@0
   144
			User::After(2000000);
sl@0
   145
			panic.CommandReply(EADllBlankOpCode);
sl@0
   146
			break;
sl@0
   147
		case 19:
sl@0
   148
			panic.Command(EADllPanicSetClippingRectWithNoGc);
sl@0
   149
			break;
sl@0
   150
		case 20:
sl@0
   151
			panic.CommandReply(EADllPanicSetClippingRegionWithNoGc);
sl@0
   152
			break;
sl@0
   153
		case 21:
sl@0
   154
			panic.Command(EADllPanicCancelClippingRegionWithNoGc);
sl@0
   155
			break;
sl@0
   156
		case 22:
sl@0
   157
			panic.Command(EADllPanicCancelClippingRectWithNoGc);
sl@0
   158
			break;
sl@0
   159
		case 23:
sl@0
   160
			panic.Command(EADllPanicSetDrawModeWithNoGc);
sl@0
   161
			break;
sl@0
   162
		case 24:
sl@0
   163
			panic.Command(EADllPanicUseFontWithNoGc);
sl@0
   164
			break;
sl@0
   165
		case 25:
sl@0
   166
			panic.Command(EADllPanicDiscardFontWithNoGc);
sl@0
   167
			break;
sl@0
   168
		case 26:
sl@0
   169
			panic.Command(EADllPanicSetUnderlineStyleWithNoGc);
sl@0
   170
			break;
sl@0
   171
		case 27:
sl@0
   172
			panic.Command(EADllPanicSetStrikeThoughStyleWithNoGc);
sl@0
   173
			break;
sl@0
   174
		case 28:
sl@0
   175
			panic.Command(EADllPanicSetWordJustificationWithNoGc);
sl@0
   176
			break;
sl@0
   177
		case 29:
sl@0
   178
			panic.Command(EADllPanicSetCharJustificationWithNoGc);
sl@0
   179
			break;
sl@0
   180
		case 30:
sl@0
   181
			panic.Command(EADllPanicSetPenColorWithNoGc);
sl@0
   182
			break;
sl@0
   183
		case 31:
sl@0
   184
			panic.Command(EADllPanicSetPenStyleWithNoGc);
sl@0
   185
			break;
sl@0
   186
		case 32:
sl@0
   187
			panic.Command(EADllPanicSetPenSizeWithNoGc);
sl@0
   188
			break;
sl@0
   189
		case 33:
sl@0
   190
			panic.Command(EADllPanicSetBrushColorWithNoGc);
sl@0
   191
			break;
sl@0
   192
		case 34:
sl@0
   193
			panic.Command(EADllPanicSetBrushStyleWithNoGc);
sl@0
   194
			break;
sl@0
   195
		case 35:
sl@0
   196
			panic.Command(EADllPanicSetBrushOriginWithNoGc);
sl@0
   197
			break;
sl@0
   198
		case 36:
sl@0
   199
			panic.Command(EADllPanicUseBrushPatterWithNoGc);
sl@0
   200
			break;
sl@0
   201
		case 37:
sl@0
   202
			panic.Command(EADllPanicDiscardBrushPatternWithNoGc);
sl@0
   203
			break;
sl@0
   204
		case 38:
sl@0
   205
			panic.Command(EADllPanicSetFadedWithNoGc);
sl@0
   206
			break;
sl@0
   207
		case 39:
sl@0
   208
			panic.Command(EADllPanicSetFadingParametersWithNoGc);
sl@0
   209
			break;
sl@0
   210
		case 40:
sl@0
   211
			panic.Command(EADllPanicDrawArcWithNoGc);
sl@0
   212
			break;
sl@0
   213
		case 41:
sl@0
   214
			panic.Command(EADllPanicDrawPieWithNoGc);
sl@0
   215
			break;
sl@0
   216
		case 42:
sl@0
   217
			panic.Command(EADllPanicDrawLineWithNoGc);
sl@0
   218
			break;
sl@0
   219
		case 43:
sl@0
   220
			panic.Command(EADllPanicDrawLineToWithNoGc);
sl@0
   221
			break;
sl@0
   222
		case 44:
sl@0
   223
			panic.Command(EADllPanicDrawLineByWithNoGc);
sl@0
   224
			break;
sl@0
   225
		case 45:
sl@0
   226
			panic.Command(EADllPanicDrawEllipseWithNoGc);
sl@0
   227
			break;
sl@0
   228
		case 46:
sl@0
   229
			panic.Command(EADllPanicDrawRoundedRecWithNoGc);
sl@0
   230
			break;
sl@0
   231
		case 47:
sl@0
   232
			panic.Command(EADllPanicClearWithRectWithNoGc);
sl@0
   233
			break;
sl@0
   234
		case 48:
sl@0
   235
			panic.Command(EADllPanicClearWithNoGc);
sl@0
   236
			break;
sl@0
   237
		case 49:
sl@0
   238
			panic.Command(EADllPanicBitBltWithNoGc);
sl@0
   239
			break;
sl@0
   240
		case 50:
sl@0
   241
			panic.Command(EADllPanicBitBltWithRectWithNoGc);
sl@0
   242
			break;
sl@0
   243
		case 51:
sl@0
   244
			panic.Command(EADllPanicBitBltMaskedWithNoGc);
sl@0
   245
			break;
sl@0
   246
		case 52:
sl@0
   247
			panic.Command(EADllPanicDrawBitmapPointWithNoGc);
sl@0
   248
			break;
sl@0
   249
		case 53:
sl@0
   250
			panic.Command(EADllPanicDrawBitmapWithNoGc);
sl@0
   251
			break;
sl@0
   252
		case 54:
sl@0
   253
			panic.Command(EADllPanicDrawBitmapRectWithNoGc);
sl@0
   254
			break;
sl@0
   255
		case 55:
sl@0
   256
			panic.Command(EADllPanicDrawBitmapMaskedFbsBitmapWithNoGc);
sl@0
   257
			break;
sl@0
   258
		case 56:
sl@0
   259
			panic.Command(EADllPanicDrawBitmapMaskedWsBitmapWithNoGc);
sl@0
   260
			break;
sl@0
   261
		case 57:
sl@0
   262
			panic.Command(EADllPanicDrawPolyLinePointsWithNoGc);
sl@0
   263
			break;
sl@0
   264
		case 58:
sl@0
   265
			panic.Command(EADllPanicDrawPolyLineArrayWithNoGc);
sl@0
   266
			break;
sl@0
   267
		case 59:
sl@0
   268
			panic.CommandReply(EADllPanicDrawPolygonPointsWithNoGc);
sl@0
   269
			break;
sl@0
   270
		case 60:
sl@0
   271
			panic.CommandReply(EADllPanicDrawPolygonArrayWithNoGc);
sl@0
   272
			break;
sl@0
   273
		case 61:
sl@0
   274
			panic.Command(EADllPanicMoveToWithNoGc);
sl@0
   275
			break;
sl@0
   276
		case 62:
sl@0
   277
			panic.Command(EADllPanicMoveByWithNoGc);
sl@0
   278
			break;
sl@0
   279
		case 63:
sl@0
   280
			panic.Command(EADllPanicPlotWithNoGc);
sl@0
   281
			break;
sl@0
   282
		case 64:
sl@0
   283
			panic.Command(EADllPanicSetOriginWithNoGc);
sl@0
   284
			break;
sl@0
   285
		case 65:
sl@0
   286
			panic.Command(EADllPanicCopyRectWithNoGc);
sl@0
   287
			break;
sl@0
   288
		case 66:
sl@0
   289
			panic.Command(EADllPanicResetWithNoGc);
sl@0
   290
			break;
sl@0
   291
		case 67:
sl@0
   292
			panic.CommandReply(EADllPanicAlphaBlendingBitmapsFbsBitmapWithNoGc);
sl@0
   293
			break;
sl@0
   294
		case 68:
sl@0
   295
			panic.Command(EADllPanicMapColorsWithNoGc);
sl@0
   296
			break;
sl@0
   297
		case 69:
sl@0
   298
			panic.Command(EADllPanicDrawTextWithRectWithNoFont);
sl@0
   299
			break;
sl@0
   300
		case 70:
sl@0
   301
			panic.Command(EADllPanicDrawTextVerticalWithNoFont);
sl@0
   302
			break;
sl@0
   303
		case 71:
sl@0
   304
			panic.Command(EADllPanicDrawTextVerticalWithRectWithNoFont);
sl@0
   305
			break;
sl@0
   306
		case 72:
sl@0
   307
			panic.CommandReply(EADllPanicDevice);
sl@0
   308
			break;
sl@0
   309
		case 73:
sl@0
   310
			panic.Command(EADllPanicInvalidFocusScreenTooBig);
sl@0
   311
			break;
sl@0
   312
		case 74:
sl@0
   313
			panic.Command(EADllPanicInvalidFocusScreenNegative);
sl@0
   314
			break;
sl@0
   315
		default:
sl@0
   316
			return(EWsExitReasonFinished);
sl@0
   317
		}
sl@0
   318
sl@0
   319
	ws.Flush();
sl@0
   320
	return(EWsExitReasonBad);
sl@0
   321
	}
sl@0
   322
sl@0
   323
/**
sl@0
   324
@SYMTestCaseID		GRAPHICS-WSERV-0125
sl@0
   325
sl@0
   326
@SYMDEF             DEF081259
sl@0
   327
sl@0
   328
@SYMTestCaseDesc    Panic tests
sl@0
   329
sl@0
   330
@SYMTestPriority    High
sl@0
   331
sl@0
   332
@SYMTestStatus      Implemented
sl@0
   333
sl@0
   334
@SYMTestActions     The test creates an animation and animation's client threads.
sl@0
   335
					Each thread calls some
sl@0
   336
					command of the animation which is expected to panic on certain reason.
sl@0
   337
					The test checks that those client threads will panic returning
sl@0
   338
					a proper panic code. Client threads are created and tested for
sl@0
   339
					the following actions:
sl@0
   340
					1. A Command() call to an animation which executes
sl@0
   341
					iFunctions->Panic() method. Client thread must panic with
sl@0
   342
					code EWservPanicAnimDll.
sl@0
   343
					2. A Command() call with dummy parameter to an animation which
sl@0
   344
					executes iFunctions->Panic() method. Client thread must panic
sl@0
   345
					with code EWservPanicAnimDll.
sl@0
   346
					3. A CommandReply() call to an animation which executes
sl@0
   347
					iFunctions->Panic() method. Client thread must panic with code
sl@0
   348
					EWservPanicAnimDll.
sl@0
   349
					4. A CommandReply() call with dummy parameter to an animation
sl@0
   350
					which executes iFunctions->Panic() method. Client thread must
sl@0
   351
					panic with code EWservPanicAnimDll.
sl@0
   352
					5. A command that calls MAnimGeneralFunctions::SetInterval() when
sl@0
   353
					the synchronisation mode is not TAnimSync::ESyncNone. Client
sl@0
   354
					thread must panic with code EWservPanicAnimDll.
sl@0
   355
					6. A command that calls MAnimGeneralFunctions::SetNextInterval()
sl@0
   356
					when the synchronisation mode is not TAnimSync::ESyncNone. Client
sl@0
   357
					thread must panic with code EWservPanicAnimDll.
sl@0
   358
					7. A command that calls MAnimGeneralFunctions::DuplicateFontL() to
sl@0
   359
					duplicate undefined font. Client thread must panic with code
sl@0
   360
					EWservPanicFont.
sl@0
   361
					8. A command that calls MAnimGeneralFunctions::DuplicateBitmapL()
sl@0
   362
					to duplicate undefined bitmap. Client thread must panic with code
sl@0
   363
					EWservPanicBitmap.
sl@0
   364
					9. A command that calls User::Leave(KErrGeneral). Client thread
sl@0
   365
					must panic with code EWservPanicAnimLeave.
sl@0
   366
					10. A command that activates window animation's graphical context
sl@0
   367
					twice. Client thread must panic with code EWservPanicAnimDll.
sl@0
   368
					11. A command that tries to draw a rectangle while graphical
sl@0
   369
					context is not defined yet. Client thread must panic with code
sl@0
   370
					EWservPanicAnimLeave.
sl@0
   371
					12. A command that tries to draw a text whihout a font defined yet.
sl@0
   372
					Client thread must panic with code EWservPanicNoFont.
sl@0
   373
					13. A command that causes an animation to leave during execution
sl@0
   374
					of CAnim::Animate() method; and a new command call 4 seconds after
sl@0
   375
					that. Client thread must panic with code EWservPanicAnimLeave.
sl@0
   376
					14. A command that causes an animation to leave during execution
sl@0
   377
					of CAnim::Redraw() method. The client thread initiates it's window
sl@0
   378
					redraw after that. Client thread must panic with code
sl@0
   379
					EWservPanicAnimLeave.
sl@0
   380
					15. The client thread calls RWsSession::TestWrite() on animation
sl@0
   381
					DLL server-side handle with opcode 999. Client thread must panic with code
sl@0
   382
					EWservPanicOpcode.
sl@0
   383
					16. A command that activates graphical context and sets the
sl@0
   384
					window to invisible and then to visible. Client thread must panic
sl@0
   385
					with code EWservPanicAnimDll.
sl@0
   386
sl@0
   387
sl@0
   388
@SYMTestExpectedResults See test actions.
sl@0
   389
*/
sl@0
   390
void CTAnimDll::TestPanicsL()
sl@0
   391
	{
sl@0
   392
	TInt index=0;
sl@0
   393
	TBool finishTests=EFalse;
sl@0
   394
	do
sl@0
   395
		{
sl@0
   396
sl@0
   397
sl@0
   398
		TClientPanic panicCode=EWservPanicAnimDll;
sl@0
   399
		switch(index)
sl@0
   400
			{
sl@0
   401
			// panic the server with a KERN-4. When server fixed these this can be removed.
sl@0
   402
			case 19:
sl@0
   403
			case 20:
sl@0
   404
			case 22:
sl@0
   405
			case 24:
sl@0
   406
				goto bypasstest;
sl@0
   407
sl@0
   408
			case 0:
sl@0
   409
			case 1:
sl@0
   410
			case 2:
sl@0
   411
			case 3:
sl@0
   412
			case 4:
sl@0
   413
			case 5:
sl@0
   414
			case 6:
sl@0
   415
			case 10:
sl@0
   416
			case 16:
sl@0
   417
			case 17:
sl@0
   418
			case 18:
sl@0
   419
			case 73:
sl@0
   420
			case 74:
sl@0
   421
				panicCode=EWservPanicAnimDll;
sl@0
   422
				break;
sl@0
   423
			case 7:
sl@0
   424
				panicCode=EWservPanicFont;
sl@0
   425
				break;
sl@0
   426
			case 8:
sl@0
   427
				panicCode=EWservPanicBitmap;
sl@0
   428
				break;
sl@0
   429
			case 12:
sl@0
   430
			case 69:
sl@0
   431
			case 70:
sl@0
   432
			case 71:
sl@0
   433
				panicCode=EWservPanicNoFont;
sl@0
   434
				break;
sl@0
   435
			case 15:
sl@0
   436
				panicCode=EWservPanicOpcode;
sl@0
   437
				break;
sl@0
   438
			case 9:
sl@0
   439
			case 11:
sl@0
   440
			case 13:
sl@0
   441
			case 14:
sl@0
   442
			case 72:
sl@0
   443
			default: // cases 19 - 68
sl@0
   444
				panicCode=EWservPanicAnimLeave;
sl@0
   445
				break;
sl@0
   446
			}
sl@0
   447
			
sl@0
   448
		TEST(iTest->TestWsPanicL(&DoPanicTest,panicCode,index,(TAny*)iTest->iScreenNumber,&finishTests));
sl@0
   449
bypasstest:
sl@0
   450
		if (iTest->iScreenNumber == 0)
sl@0
   451
			iTest->CloseAllPanicWindows();
sl@0
   452
		index++;
sl@0
   453
		} while(!finishTests);
sl@0
   454
	}
sl@0
   455
sl@0
   456
void CTAnimDll::TestSyncModes(MAnimGeneralFunctions::TAnimSync aSyncMode)
sl@0
   457
	{
sl@0
   458
	RTestAnim anim=RTestAnim(iAnimDll);
sl@0
   459
	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
sl@0
   460
	CleanupClosePushL(anim);
sl@0
   461
sl@0
   462
	TPckgBuf<TSyncTests> params;
sl@0
   463
	TRequestStatus status(KRequestPending);
sl@0
   464
	params().status=&status;
sl@0
   465
	params().syncMode=aSyncMode;
sl@0
   466
	anim.CommandReply(EADllSyncTests,params);
sl@0
   467
	User::WaitForRequest(status);
sl@0
   468
	TEST(status==KErrNone);
sl@0
   469
sl@0
   470
	CleanupStack::PopAndDestroy(&anim);
sl@0
   471
	}
sl@0
   472
sl@0
   473
void CTAnimDll::TestTimeChange()
sl@0
   474
	{
sl@0
   475
	RTestAnim anim=RTestAnim(iAnimDll);
sl@0
   476
	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
sl@0
   477
	CleanupClosePushL(anim);
sl@0
   478
sl@0
   479
	TPckgBuf<TTimeChangeTest> params;
sl@0
   480
	TRequestStatus status(KRequestPending);
sl@0
   481
	TRequestStatus status2(KRequestPending);
sl@0
   482
	params().status=&status;
sl@0
   483
	params().status2=&status2;
sl@0
   484
	anim.CommandReply(EADllTimeChangedTest,params);
sl@0
   485
	User::WaitForRequest(status);
sl@0
   486
	TTime time;
sl@0
   487
	time.HomeTime();
sl@0
   488
	time+=TTimeIntervalHours(1);
sl@0
   489
	User::SetHomeTime(time);
sl@0
   490
	User::WaitForRequest(status2);
sl@0
   491
	time.HomeTime();
sl@0
   492
	time-=TTimeIntervalHours(1);
sl@0
   493
	User::SetHomeTime(time);
sl@0
   494
	TEST(status2==KErrNone);
sl@0
   495
sl@0
   496
	CleanupStack::PopAndDestroy(&anim);
sl@0
   497
	}
sl@0
   498
sl@0
   499
void CTAnimDll::ConstructL()
sl@0
   500
	{
sl@0
   501
	TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0);
sl@0
   502
	iRedrawWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw);
sl@0
   503
	iBackedUpTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBackedUp);
sl@0
   504
	iBlankTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBlank);
sl@0
   505
	iBaseWin=new(ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw);
sl@0
   506
sl@0
   507
//
sl@0
   508
	TSize screenSize=TheClient->iGroup->Size();
sl@0
   509
	TInt winWidth=(screenSize.iWidth/3)-10;
sl@0
   510
	TInt winHeight=screenSize.iHeight-10;
sl@0
   511
	iBaseWin->ConstructL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight));
sl@0
   512
	iBlankTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
sl@0
   513
	((RBlankWindow *)iBlankTestWin->BaseWin())->SetColor(TRgb::Gray4(2));
sl@0
   514
	iBackedUpTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
sl@0
   515
	iRedrawWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
sl@0
   516
//
sl@0
   517
	iTestWin=iRedrawWin;
sl@0
   518
//
sl@0
   519
	iAnimDll=RAnimDll(TheClient->iWs);
sl@0
   520
	TInt retVal = iAnimDll.Load(KAnimDLLName);
sl@0
   521
	TEST(retVal==KErrNone);
sl@0
   522
	if (retVal!=KErrNone)
sl@0
   523
		INFO_PRINTF3(_L("iAnimDll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
sl@0
   524
	}
sl@0
   525
sl@0
   526
CTAnimDll::~CTAnimDll()
sl@0
   527
	{
sl@0
   528
	iAnimDll.Close();
sl@0
   529
	delete iBackedUpTestWin;
sl@0
   530
	delete iBlankTestWin;
sl@0
   531
	delete iRedrawWin;
sl@0
   532
	delete iBaseWin;
sl@0
   533
	}
sl@0
   534
sl@0
   535
/**
sl@0
   536
@SYMTestCaseID		GRAPHICS-WSERV-0126
sl@0
   537
sl@0
   538
@SYMDEF             DEF081259
sl@0
   539
sl@0
   540
@SYMTestCaseDesc    Miscellaneous animation tests.
sl@0
   541
sl@0
   542
@SYMTestPriority    High
sl@0
   543
sl@0
   544
@SYMTestStatus      Implemented
sl@0
   545
sl@0
   546
@SYMTestActions     Tests window animation's window funtions like WindowSize(),
sl@0
   547
					IsHidden(), SetVisible().
sl@0
   548
					Tests RAnimDll's constructor, Close(), Load() and copy-constructor.
sl@0
   549
sl@0
   550
@SYMTestExpectedResults Expects window funtions and RAnimDll's methods work properly.
sl@0
   551
*/
sl@0
   552
void CTAnimDll::Misc()
sl@0
   553
	{
sl@0
   554
	RTestAnim anim=RTestAnim(iAnimDll);
sl@0
   555
	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
sl@0
   556
	CleanupClosePushL(anim);
sl@0
   557
sl@0
   558
	TPckgBuf<TSize> params;
sl@0
   559
	params()=iTestWin->Size();
sl@0
   560
	TBool retBool = anim.CommandReply(EADllTestWindowSize,params);
sl@0
   561
	TEST(retBool);
sl@0
   562
	if (!retBool)
sl@0
   563
		INFO_PRINTF3(_L("anim.CommandReply(EADllTestWindowSize,params) return value - Expected: %d , Actual: %d"), ETrue, retBool);
sl@0
   564
	TheClient->iWs.Finish();
sl@0
   565
	retBool = anim.CommandReply(EADllTestSetVisible);
sl@0
   566
	TEST(retBool);
sl@0
   567
	if (!retBool)
sl@0
   568
		INFO_PRINTF3(_L("anim.CommandReply(EADllTestSetVisible) return value - Expected: %d , Actual: %d"), ETrue, retBool);
sl@0
   569
	CleanupStack::PopAndDestroy(&anim);
sl@0
   570
sl@0
   571
	RAnimDll closeme(TheClient->iWs);
sl@0
   572
	closeme.Close();
sl@0
   573
	RAnimDll animdll(TheClient->iWs);
sl@0
   574
	TInt retVal = animdll.Load(KAnimDLLName);
sl@0
   575
	TEST(retVal==KErrNone);
sl@0
   576
	if (retVal!=KErrNone)
sl@0
   577
		INFO_PRINTF3(_L("animdll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
sl@0
   578
sl@0
   579
	RTestAnim anim2(animdll);
sl@0
   580
	anim2.Close();
sl@0
   581
	animdll.Close();
sl@0
   582
	}
sl@0
   583
sl@0
   584
/**
sl@0
   585
@SYMTestCaseID		GRAPHICS-WSERV-0127
sl@0
   586
sl@0
   587
@SYMDEF             DEF081259
sl@0
   588
sl@0
   589
@SYMTestCaseDesc    Test animation's command call with reply
sl@0
   590
sl@0
   591
@SYMTestPriority    High
sl@0
   592
sl@0
   593
@SYMTestStatus      Implemented
sl@0
   594
sl@0
   595
@SYMTestActions     Puts an array containing a sequnce of numbers into a command argument.
sl@0
   596
					Performs command call to server, assuming that the server-side
sl@0
   597
					should return a sum of the numbers in sequence.
sl@0
   598
sl@0
   599
@SYMTestExpectedResults Checks that server returns the correct sum.
sl@0
   600
*/
sl@0
   601
void CTAnimDll::RemoteBuffer()
sl@0
   602
	{
sl@0
   603
	RTestAnim anim=RTestAnim(iAnimDll);
sl@0
   604
	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
sl@0
   605
	CleanupClosePushL(anim);
sl@0
   606
sl@0
   607
	TBuf<ERemoteBufSize> buf(ERemoteBufSize);
sl@0
   608
	TInt total=0;
sl@0
   609
	for (TInt8 index=0;index<ERemoteBufSize;index++)
sl@0
   610
		{
sl@0
   611
		total+=index;
sl@0
   612
		buf[index]=index;
sl@0
   613
		}
sl@0
   614
	TIpcArgs ipcArgs;
sl@0
   615
	ipcArgs.Set(KIpcSlot,&buf);
sl@0
   616
 	TInt retVal = anim.CommandReply(EADllReadRemoteDescriptor,KNullDesC8,ipcArgs);
sl@0
   617
	TEST(retVal==total);
sl@0
   618
	if (retVal!=total)
sl@0
   619
		INFO_PRINTF3(_L("anim.CommandReply(EADllReadRemoteDescriptor,KNullDesC8,ipcArgs) return value - Expected: %d , Actual: %d"), total, retVal);
sl@0
   620
sl@0
   621
	CleanupStack::PopAndDestroy(&anim);
sl@0
   622
	}
sl@0
   623
//
sl@0
   624
/**
sl@0
   625
@SYMTestCaseID		GRAPHICS-WSERV-0128
sl@0
   626
sl@0
   627
@SYMDEF             DEF081259
sl@0
   628
sl@0
   629
@SYMTestCaseDesc    RAnimDll extracopy test
sl@0
   630
sl@0
   631
@SYMTestPriority    High
sl@0
   632
sl@0
   633
@SYMTestStatus      Implemented
sl@0
   634
sl@0
   635
@SYMTestActions     Creates another RAnimDll instance for a dll that already has a client-side interface.
sl@0
   636
sl@0
   637
@SYMTestExpectedResults Expects that operation completes without errors.
sl@0
   638
*/
sl@0
   639
void CTAnimDll::ExtraCopyTest()
sl@0
   640
	{
sl@0
   641
	RAnimDll extraCopy(TheClient->iWs);
sl@0
   642
	TInt retVal = extraCopy.Load(KAnimDLLName);
sl@0
   643
	TEST(retVal==KErrNone);
sl@0
   644
	if (retVal!=KErrNone)
sl@0
   645
		INFO_PRINTF3(_L("extraCopy.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
sl@0
   646
sl@0
   647
	extraCopy.Close();
sl@0
   648
	}
sl@0
   649
//
sl@0
   650
void CTAnimDll::SyncMode1()
sl@0
   651
	{
sl@0
   652
	TestSyncModes(MAnimGeneralFunctions::ESyncSecond);
sl@0
   653
	}
sl@0
   654
sl@0
   655
void CTAnimDll::CheckWindows()
sl@0
   656
	{
sl@0
   657
	CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size()),_L("CTAnimDll::CheckWindows() failed"));
sl@0
   658
	}
sl@0
   659
sl@0
   660
void CTAnimDll::InvalidatePauseAndRedraw(const TRect &aRect,TTimeIntervalMicroSeconds32 aInterval)
sl@0
   661
	{
sl@0
   662
	iTestWin->Invalidate(aRect);
sl@0
   663
	TheClient->iWs.Flush();
sl@0
   664
	User::After(aInterval);
sl@0
   665
	__ASSERT_DEBUG(iTestWin->iWinType==CAnimWindow::ERedraw,AutoPanic(EAutoPanicWindowType));
sl@0
   666
	RWindow *win=(RWindow *)iTestWin->BaseWin();
sl@0
   667
	win->BeginRedraw();
sl@0
   668
	iTestWin->DoDraw();
sl@0
   669
	win->EndRedraw();
sl@0
   670
	TheClient->iWs.Flush();
sl@0
   671
	}
sl@0
   672
sl@0
   673
void CTAnimDll::RedrawAndCheckWindows(TBool aBlankIt)
sl@0
   674
	{
sl@0
   675
	if (iTestWin->iWinType==CAnimWindow::ERedraw)
sl@0
   676
		{
sl@0
   677
		RWindow *win=(RWindow *)iTestWin->BaseWin();
sl@0
   678
		win->BeginRedraw();
sl@0
   679
		iTestWin->DoDraw(aBlankIt);
sl@0
   680
		win->EndRedraw();
sl@0
   681
		}
sl@0
   682
	RWindow *win=(RWindow *)iBaseWin->BaseWin();
sl@0
   683
	win->BeginRedraw();
sl@0
   684
	iBaseWin->DoDraw(aBlankIt);
sl@0
   685
	win->EndRedraw();
sl@0
   686
	TheClient->WaitForRedrawsToFinish();
sl@0
   687
	CheckWindows();
sl@0
   688
	}
sl@0
   689
sl@0
   690
/**
sl@0
   691
@SYMTestCaseID		GRAPHICS-WSERV-0129
sl@0
   692
sl@0
   693
@SYMDEF             DEF081259
sl@0
   694
sl@0
   695
@SYMTestCaseDesc    Animation drawing test
sl@0
   696
sl@0
   697
@SYMTestPriority    High
sl@0
   698
sl@0
   699
@SYMTestStatus      Implemented
sl@0
   700
sl@0
   701
@SYMTestActions     Performs animation drawing ontop of redrawable window, backed-up window and blank window.
sl@0
   702
					Draws the same shapes using directly window graphics on an other window (base window).
sl@0
   703
					The following shapes are drawn:
sl@0
   704
					1. An animation with a small ellipse drawn in XOR mode on top of redrawable
sl@0
   705
					black-lined gray window.
sl@0
   706
					2. The same with a bigger ellipse but previously invalidating an
sl@0
   707
					area which intersects the old ellipse and the new ellipse.
sl@0
   708
					3. Runs an animation that continuously moves a rectangle and shrinks another on top of
sl@0
   709
					redrawable black-lined gray window and then cancels an animation.
sl@0
   710
					The test checks that the window will be identical with the gray base window
sl@0
   711
					that contains only black lines.
sl@0
   712
					4. An animation with a small ellipse drawn in XOR mode on top of backed-up
sl@0
   713
					black-lined gray window. The test also calls Invalidate() method and performs
sl@0
   714
					a check again to make sure that the test-window and base window are identical.
sl@0
   715
					5. An animation with a small ellipse drawn in XOR mode on top of the blank
sl@0
   716
					gray window. The test also sends commands to the animation that call windows
sl@0
   717
					SetVisible(EFalse) and SetVisible(ETrue) and checks that the
sl@0
   718
					test-window and base window are identical.
sl@0
   719
sl@0
   720
sl@0
   721
@SYMTestExpectedResults Each time performs pixelwise comparisons of animated windows
sl@0
   722
					and the base window expecting the windows to be identical.
sl@0
   723
*/
sl@0
   724
void CTAnimDll::DrawingTestL()
sl@0
   725
	{
sl@0
   726
	// draws a little circle on the base window using window graphics and using window animation on the test window.
sl@0
   727
	RTestAnim drawAnim=RTestAnim(iAnimDll);
sl@0
   728
//
sl@0
   729
	TRect rect;
sl@0
   730
	TPckgBuf<TRect> rectPckg;
sl@0
   731
	TPckgBuf<TBool> boolPckg;
sl@0
   732
sl@0
   733
//
sl@0
   734
	_LIT(KLog1,"Draw Ellipse Test1");
sl@0
   735
	LOG_MESSAGE(KLog1);
sl@0
   736
	rect = TRect(10,10,50,50);
sl@0
   737
	CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModeXOR);
sl@0
   738
	iTestWin->Invalidate();
sl@0
   739
	iTestWin->SetRect(rect);
sl@0
   740
	iBaseWin->Invalidate();
sl@0
   741
	iBaseWin->SetRect(rect);
sl@0
   742
	rectPckg()=rect;
sl@0
   743
	User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
sl@0
   744
	RedrawAndCheckWindows();
sl@0
   745
//
sl@0
   746
	_LIT(KLog2,"Draw Ellipse Test2");
sl@0
   747
	LOG_MESSAGE(KLog2);
sl@0
   748
	iTestWin->Invalidate(TRect(20,20,100,40));
sl@0
   749
	iBaseWin->Invalidate(TRect(20,20,100,40));
sl@0
   750
	iBaseWin->DoDrawEllipse();	// Should clear old Ellipse (except invalid bits)
sl@0
   751
	rect=TRect(30,30,200,100);
sl@0
   752
	rectPckg()=rect;
sl@0
   753
	iBaseWin->SetRect(rect);
sl@0
   754
	iBaseWin->DoDrawEllipse();	// Should draw new Ellipse (except invalid bits)
sl@0
   755
	drawAnim.Command(EADllSetRect,rectPckg);
sl@0
   756
	RedrawAndCheckWindows();
sl@0
   757
	iBaseWin->DoDrawEllipse();	// Clear old ellipse
sl@0
   758
//
sl@0
   759
	_LIT(KLog3,"Window Overlap Anim Test");
sl@0
   760
	LOG_MESSAGE(KLog3);
sl@0
   761
sl@0
   762
	iBaseWin->SetRect(TRect());
sl@0
   763
	iBaseWin->DoDraw();
sl@0
   764
	TheClient->iWs.Finish();
sl@0
   765
sl@0
   766
	// create another window on top and check that animation beneath is not visible	
sl@0
   767
	TSize screenSize=TheClient->iGroup->Size();
sl@0
   768
	TInt winWidth=(screenSize.iWidth/3)-10;
sl@0
   769
	TInt winHeight=screenSize.iHeight-10;
sl@0
   770
	TSize size=iTestWin->Size();
sl@0
   771
	rectPckg()=TRect(size);
sl@0
   772
	drawAnim.Command(EADllStartAnimate,rectPckg);
sl@0
   773
sl@0
   774
	CAnimWindow *topWindow = new (ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw);
sl@0
   775
	CleanupStack::PushL(topWindow);
sl@0
   776
	topWindow->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
sl@0
   777
	
sl@0
   778
	RWindow *win=(RWindow *)iTestWin->BaseWin();
sl@0
   779
	win->BeginRedraw();
sl@0
   780
	topWindow->DoDraw(EFalse);
sl@0
   781
	win->EndRedraw();
sl@0
   782
	
sl@0
   783
	TheClient->iWs.Flush();
sl@0
   784
	for(TInt i=0;i<size.iWidth/2;i+=5)
sl@0
   785
		InvalidatePauseAndRedraw(TRect(i,size.iHeight-i-i,i+i,size.iHeight-i),TTimeIntervalMicroSeconds32(400000));
sl@0
   786
sl@0
   787
	TheClient->WaitForRedrawsToFinish();
sl@0
   788
	CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size()));
sl@0
   789
	
sl@0
   790
	win->BeginRedraw(rect);
sl@0
   791
	drawAnim.Command(EADllCancelAnimate,rectPckg);
sl@0
   792
	win->EndRedraw();
sl@0
   793
sl@0
   794
	CleanupStack::PopAndDestroy(topWindow);
sl@0
   795
//
sl@0
   796
	iTestWin->BaseWin()->SetVisible(EFalse);
sl@0
   797
	drawAnim.Close();
sl@0
   798
//
sl@0
   799
	_LIT(KLog4,"Draw Ellipse Test4&5");
sl@0
   800
	LOG_MESSAGE(KLog4);
sl@0
   801
	rect=TRect(20,20,50,50);
sl@0
   802
	iBackedUpTestWin->SetRect(rect);
sl@0
   803
	iBackedUpTestWin->DoDraw();
sl@0
   804
	iBaseWin->SetRect(rect);
sl@0
   805
	win->BeginRedraw();
sl@0
   806
	iBaseWin->DoDraw();
sl@0
   807
	win->EndRedraw();
sl@0
   808
	TheClient->iWs.Finish();
sl@0
   809
sl@0
   810
	rectPckg()=rect;
sl@0
   811
	User::LeaveIfError(drawAnim.Construct(*iBackedUpTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
sl@0
   812
	TheClient->iWs.Finish();
sl@0
   813
	TheClient->WaitForRedrawsToFinish();
sl@0
   814
	CheckWindows();
sl@0
   815
	iBackedUpTestWin->Invalidate();
sl@0
   816
	TheClient->iWs.Flush();
sl@0
   817
	TheClient->WaitForRedrawsToFinish();
sl@0
   818
	CheckWindows();
sl@0
   819
	iBackedUpTestWin->BaseWin()->SetVisible(EFalse);
sl@0
   820
//
sl@0
   821
	_LIT(KLog5,"Draw Ellipse Test6&7");
sl@0
   822
	LOG_MESSAGE(KLog5);
sl@0
   823
	rect=TRect(20,20,50,50);
sl@0
   824
	TheClient->iWs.Flush();
sl@0
   825
	RWindow *winBase=(RWindow *)iBaseWin->BaseWin();
sl@0
   826
	winBase->BeginRedraw();
sl@0
   827
	iBaseWin->SetRect(rect);
sl@0
   828
	iBaseWin->DoDraw(ETrue);
sl@0
   829
	winBase->EndRedraw();
sl@0
   830
	rectPckg()=rect;
sl@0
   831
	User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
sl@0
   832
	TheClient->iWs.Flush();
sl@0
   833
	iBlankTestWin->Invalidate();
sl@0
   834
	TheClient->iWs.Flush();
sl@0
   835
	TheClient->WaitForRedrawsToFinish();
sl@0
   836
	CheckWindows();
sl@0
   837
	boolPckg()=EFalse;
sl@0
   838
	drawAnim.Command(EADllSetVisible,boolPckg);
sl@0
   839
	TheClient->iWs.Flush();
sl@0
   840
	boolPckg()=ETrue;
sl@0
   841
	drawAnim.Command(EADllSetVisible,boolPckg);
sl@0
   842
	TheClient->WaitForRedrawsToFinish();
sl@0
   843
	CheckWindows();
sl@0
   844
sl@0
   845
//This test does functional coverage by calling code that executes each of the 
sl@0
   846
//server's class (CWsAnimGc) members in turn.
sl@0
   847
sl@0
   848
sl@0
   849
	_LIT(KLog6,"Draw Primitives (Coverage) Test");
sl@0
   850
	LOG_MESSAGE(KLog6);
sl@0
   851
	rect = TRect(10,10,150,150);
sl@0
   852
	iBaseWin->BaseWin()->SetVisible(ETrue);
sl@0
   853
	iBaseWin->SetRect(TRect(0,0,0,0));
sl@0
   854
	winBase->BeginRedraw();
sl@0
   855
	iBaseWin->DoDraw();
sl@0
   856
	iBaseWin->SetRect(rect);
sl@0
   857
	iBaseWin->DoDrawCoverage();
sl@0
   858
	winBase->EndRedraw();
sl@0
   859
sl@0
   860
	iTestWin->BaseWin()->SetVisible(ETrue);
sl@0
   861
	iTestWin->SetRect(rect);
sl@0
   862
	win->BeginRedraw();
sl@0
   863
	iTestWin->DoDraw();
sl@0
   864
	win->EndRedraw();
sl@0
   865
sl@0
   866
	rectPckg()=rect;
sl@0
   867
	User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeCoverage,rectPckg));
sl@0
   868
	
sl@0
   869
	//set font
sl@0
   870
	CFbsFont* font;
sl@0
   871
	User::LeaveIfError(TheClient->iGc->Device()->GetNearestFontToDesignHeightInTwips((CFont*&)font, TFontSpec()));
sl@0
   872
	TPckgBuf<TInt> fontHandle;
sl@0
   873
	fontHandle() = font->Handle();
sl@0
   874
	const TInt err = drawAnim.CommandReply(EADllSetFont, fontHandle);
sl@0
   875
	TheClient->iGc->Device()->ReleaseFont(font);
sl@0
   876
	User::LeaveIfError(err);
sl@0
   877
	
sl@0
   878
	//draw 
sl@0
   879
	User::LeaveIfError(drawAnim.CommandReply(EADllDrawNow));
sl@0
   880
sl@0
   881
	TheClient->iWs.Finish();
sl@0
   882
	TheClient->WaitForRedrawsToFinish();
sl@0
   883
	CheckWindows();
sl@0
   884
	drawAnim.Close();
sl@0
   885
	}
sl@0
   886
sl@0
   887
void CTAnimDll::ShadowDrawingTestL()
sl@0
   888
	{
sl@0
   889
// Create a blank window to cast a shadow over the animation
sl@0
   890
	TSize scrSize(TheClient->iScreen->SizeInPixels());
sl@0
   891
	CTBlankWindow *blank=new(ELeave) CTBlankWindow();
sl@0
   892
	CleanupStack::PushL(blank);
sl@0
   893
	blank->SetUpL(TPoint(0,10), TSize(scrSize.iWidth,scrSize.iHeight/3), TheClient->iGroup, *TheClient->iGc);
sl@0
   894
	blank->BaseWin()->SetShadowHeight(2);
sl@0
   895
	iBlankTestWin->BaseWin()->SetShadowHeight(0);
sl@0
   896
//
sl@0
   897
	RTestAnim drawAnim=RTestAnim(iAnimDll);
sl@0
   898
	TRect rect(10,scrSize.iHeight/3-20,50,scrSize.iHeight/3+40);
sl@0
   899
	TPckgBuf<TRect> rectPckg;
sl@0
   900
	rectPckg()=rect;
sl@0
   901
	User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
sl@0
   902
	drawAnim.Command(EADllSetShadowDrawMode);
sl@0
   903
	CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
   904
//
sl@0
   905
	iBlankTestWin->Invalidate();
sl@0
   906
	iBlankTestWin->SetRect(rect);
sl@0
   907
	iBaseWin->Invalidate();
sl@0
   908
	iBaseWin->SetRect(rect);
sl@0
   909
	RedrawAndCheckWindows(ETrue);
sl@0
   910
//
sl@0
   911
	for(TInt ypos=10;ypos>0;ypos-=4)
sl@0
   912
		{
sl@0
   913
		blank->SetPos(TPoint(0,ypos));
sl@0
   914
		TPckgBuf<TShadowDrawTest> params;
sl@0
   915
		TRequestStatus status(KRequestPending);
sl@0
   916
		params().status=&status;
sl@0
   917
		drawAnim.CommandReply(EADllShadowAnimTest,params);
sl@0
   918
		User::WaitForRequest(status);
sl@0
   919
		RedrawAndCheckWindows(ETrue);
sl@0
   920
		}
sl@0
   921
//
sl@0
   922
	CleanupStack::PopAndDestroy(blank);	// Destroy the shadow window
sl@0
   923
	}
sl@0
   924
sl@0
   925
/**
sl@0
   926
@SYMTestCaseID		GRAPHICS-WSERV-0130
sl@0
   927
sl@0
   928
@SYMDEF             DEF081259
sl@0
   929
sl@0
   930
@SYMTestCaseDesc    Complicated drawing test
sl@0
   931
sl@0
   932
@SYMTestPriority    High
sl@0
   933
sl@0
   934
@SYMTestStatus      Implemented
sl@0
   935
sl@0
   936
@SYMTestActions     Performs complicated drawing both through the animation on
sl@0
   937
					a blank window and through direct fbs drawing on the second
sl@0
   938
					window.
sl@0
   939
sl@0
   940
@SYMTestExpectedResults Expects the both windows to be are identical
sl@0
   941
*/
sl@0
   942
void CTAnimDll::GeneralDrawingTestL()
sl@0
   943
	{
sl@0
   944
	// This test has been removed as it is no longer relevant
sl@0
   945
	// Anims are not allowed to draw immediately to the screen
sl@0
   946
	}
sl@0
   947
sl@0
   948
/**
sl@0
   949
@SYMTestCaseID		GRAPHICS-WSERV-0131
sl@0
   950
sl@0
   951
@SYMDEF             DEF081259
sl@0
   952
sl@0
   953
@SYMTestCaseDesc    Animated window destruction test
sl@0
   954
sl@0
   955
@SYMTestPriority    High
sl@0
   956
sl@0
   957
@SYMTestStatus      Implemented
sl@0
   958
sl@0
   959
@SYMTestActions     Creates a window and a child window inside it, runs an animation
sl@0
   960
					in the child window in ESyncFlash mode, destroys windows.
sl@0
   961
sl@0
   962
@SYMTestExpectedResults Expects the operations not to fail.
sl@0
   963
*/
sl@0
   964
void CTAnimDll::DestroyWindowTestL()
sl@0
   965
	{
sl@0
   966
	RWindow window(TheClient->iWs);
sl@0
   967
	User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),123));
sl@0
   968
	CleanupClosePushL(window);
sl@0
   969
	window.SetSize(TSize(100,100));
sl@0
   970
	window.Activate();
sl@0
   971
	RWindow window2(TheClient->iWs);
sl@0
   972
	CleanupClosePushL(window2);
sl@0
   973
	User::LeaveIfError(window2.Construct(window,124));
sl@0
   974
	window2.Activate();
sl@0
   975
	window2.BeginRedraw();	// Validate it
sl@0
   976
	window2.EndRedraw();
sl@0
   977
//
sl@0
   978
	RTestAnim drawAnim;
sl@0
   979
	drawAnim=RTestAnim(iAnimDll);
sl@0
   980
	TRect rect(10,10,50,50);
sl@0
   981
	TPckgBuf<TRect> rectPckg;
sl@0
   982
	rectPckg()=rect;
sl@0
   983
	User::LeaveIfError(drawAnim.Construct(window2,EAnimTypeTest3,rectPckg));
sl@0
   984
	drawAnim.Command(EADllStartAnimate,rectPckg);
sl@0
   985
	CleanupStack::Pop(&window2);
sl@0
   986
	CleanupStack::PopAndDestroy(&window);
sl@0
   987
	TheClient->iWs.Flush();
sl@0
   988
	User::After(TTimeIntervalMicroSeconds32(2000000));
sl@0
   989
	window2.Close();
sl@0
   990
	drawAnim.Close();
sl@0
   991
	}
sl@0
   992
sl@0
   993
void CTAnimDll::SetUpMember(TSpriteMember &aMember,TInt aType)
sl@0
   994
	{
sl@0
   995
	switch (aType)
sl@0
   996
		{
sl@0
   997
	case 1:
sl@0
   998
		iTest->SetUpMember(aMember);
sl@0
   999
		aMember.iOffset=TPoint();
sl@0
  1000
		aMember.iInterval=TTimeIntervalMicroSeconds32(1);
sl@0
  1001
		break;
sl@0
  1002
	case 2:
sl@0
  1003
		aMember.iInvertMask=EFalse;
sl@0
  1004
		aMember.iDrawMode=CGraphicsContext::EDrawModeXOR;
sl@0
  1005
		aMember.iOffset=TPoint(1,2);
sl@0
  1006
		aMember.iInterval=TTimeIntervalMicroSeconds32(2);
sl@0
  1007
		break;
sl@0
  1008
	case 3:
sl@0
  1009
		aMember.iInvertMask=ETrue;
sl@0
  1010
		aMember.iDrawMode=CGraphicsContext::EDrawModeOR;
sl@0
  1011
		aMember.iOffset=TPoint(3,4);
sl@0
  1012
		aMember.iInterval=TTimeIntervalMicroSeconds32(3);
sl@0
  1013
		break;
sl@0
  1014
	default:
sl@0
  1015
		iTest->SetUpMember(aMember);
sl@0
  1016
		}
sl@0
  1017
	}
sl@0
  1018
sl@0
  1019
/**
sl@0
  1020
@SYMTestCaseID		GRAPHICS-WSERV-0132
sl@0
  1021
sl@0
  1022
@SYMDEF             DEF081259
sl@0
  1023
sl@0
  1024
@SYMTestCaseDesc    Sprite animation test
sl@0
  1025
sl@0
  1026
@SYMTestPriority    High
sl@0
  1027
sl@0
  1028
@SYMTestStatus      Implemented
sl@0
  1029
sl@0
  1030
@SYMTestActions     Creates a sprite with three sprite members and a sprite animation
sl@0
  1031
					passing the sprite to it. The test updates sprite members'
sl@0
  1032
					properties in various ways verifying that the properties are changing
sl@0
  1033
					on the server-side as well.
sl@0
  1034
sl@0
  1035
@SYMTestExpectedResults Expects that operations above do not fail and that client-side
sl@0
  1036
					changes to the sprite affect server-side properly.
sl@0
  1037
*/
sl@0
  1038
#define HALF_SEC 500000
sl@0
  1039
void CTAnimDll::SpriteAnimL()
sl@0
  1040
	{
sl@0
  1041
	// create a sprite, add 3 members to it
sl@0
  1042
	RWsSprite sprite(TheClient->iWs);
sl@0
  1043
	iRedrawWin->BaseWin()->SetVisible(ETrue);
sl@0
  1044
	sprite.Construct(*iRedrawWin->CtBaseWin()->BaseWin(),TPoint(),0);
sl@0
  1045
	CleanupClosePushL(sprite);
sl@0
  1046
	CFbsBitmap* bitmap1=new(ELeave) CFbsBitmap();
sl@0
  1047
	CleanupStack::PushL(bitmap1);
sl@0
  1048
	CFbsBitmap* bitmap2=new(ELeave) CFbsBitmap();
sl@0
  1049
	CleanupStack::PushL(bitmap2);
sl@0
  1050
	CFbsBitmap* bitmap3=new(ELeave) CFbsBitmap();
sl@0
  1051
	CleanupStack::PushL(bitmap3);
sl@0
  1052
	User::LeaveIfError(bitmap1->Create(TSize(10,12),EGray4));
sl@0
  1053
	User::LeaveIfError(bitmap2->Create(TSize(15,17),EGray4));
sl@0
  1054
	User::LeaveIfError(bitmap3->Create(TSize(20,22),EGray4));
sl@0
  1055
	TSpriteMember member1;
sl@0
  1056
	TSpriteMember member2;
sl@0
  1057
	TSpriteMember member3;
sl@0
  1058
	SetUpMember(member1,1);
sl@0
  1059
	member1.iBitmap=bitmap1;
sl@0
  1060
	member1.iMaskBitmap=bitmap1;
sl@0
  1061
	SetUpMember(member2,2);
sl@0
  1062
	member2.iBitmap=bitmap2;
sl@0
  1063
	member2.iMaskBitmap=bitmap2;
sl@0
  1064
	SetUpMember(member3,3);
sl@0
  1065
	member3.iBitmap=bitmap3;
sl@0
  1066
	member3.iMaskBitmap=bitmap3;
sl@0
  1067
	sprite.AppendMember(member1);
sl@0
  1068
	sprite.AppendMember(member2);
sl@0
  1069
	sprite.AppendMember(member3);
sl@0
  1070
sl@0
  1071
	// create a sprite animation for the sprite
sl@0
  1072
	RTestAnim spriteAnim(iAnimDll);
sl@0
  1073
	TPtrC8 des(NULL,0);
sl@0
  1074
	TPoint pos(1,2);
sl@0
  1075
	User::LeaveIfError(spriteAnim.Construct(sprite,EAnimTypeSprite,des));
sl@0
  1076
	CleanupClosePushL(spriteAnim);
sl@0
  1077
sl@0
  1078
	// call EADllCheckMember-command to verify that sprite animation's members
sl@0
  1079
	// have the same properties as the sprite instance
sl@0
  1080
	TPckgBuf<TSpriteMemberInfo> spriteInfo;
sl@0
  1081
	spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
sl@0
  1082
	TBool retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
sl@0
  1083
	TEST(retBool);
sl@0
  1084
	if (!retBool)
sl@0
  1085
		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
sl@0
  1086
sl@0
  1087
	sprite.SetPosition(pos);
sl@0
  1088
	spriteInfo()=TSpriteMemberInfo(pos,1,member2);
sl@0
  1089
	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
sl@0
  1090
	TEST(retBool);
sl@0
  1091
	if (!retBool)
sl@0
  1092
		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
sl@0
  1093
sl@0
  1094
	pos.SetXY(3,4);
sl@0
  1095
	sprite.SetPosition(pos);
sl@0
  1096
	spriteInfo()=TSpriteMemberInfo(pos,2,member3);
sl@0
  1097
	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
sl@0
  1098
	TEST(retBool);
sl@0
  1099
	if (!retBool)
sl@0
  1100
		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
sl@0
  1101
sl@0
  1102
	// call commands to change sprite members' bitmaps and update members
sl@0
  1103
	spriteAnim.Command(EADllDraw1);
sl@0
  1104
	spriteAnim.Command(EADllDraw2);
sl@0
  1105
	spriteAnim.Command(EADllDraw3);
sl@0
  1106
	TheClient->iWs.Flush();
sl@0
  1107
	User::After(HALF_SEC);
sl@0
  1108
sl@0
  1109
	// call commands to change sprite's position
sl@0
  1110
	TPckgBuf<TPoint> position;
sl@0
  1111
	position().SetXY(60,50);
sl@0
  1112
	spriteAnim.Command(EADllSetPos,position);
sl@0
  1113
	TheClient->iWs.Flush();
sl@0
  1114
	User::After(HALF_SEC);
sl@0
  1115
sl@0
  1116
	// change 1st member's bitmap size and interval, update it and call command to check
sl@0
  1117
	// that the new properties are applied
sl@0
  1118
	User::LeaveIfError(bitmap1->Resize(TSize(30,32)));
sl@0
  1119
	member1.iMaskBitmap=NULL;
sl@0
  1120
	member1.iInterval=TTimeIntervalMicroSeconds32(25);
sl@0
  1121
	User::LeaveIfError(sprite.UpdateMember(0,member1));
sl@0
  1122
	spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
sl@0
  1123
	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
sl@0
  1124
	TEST(retBool);
sl@0
  1125
	if (!retBool)
sl@0
  1126
		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
sl@0
  1127
sl@0
  1128
	User::After(HALF_SEC);
sl@0
  1129
sl@0
  1130
	// change 1st member's bitmap size and calls command that invokes
sl@0
  1131
	// MAnimSpriteFunctions::SizeChangedL(). Check that new property is applied
sl@0
  1132
	spriteAnim.CommandReply(EADllDeactivate);
sl@0
  1133
	User::LeaveIfError(bitmap1->Resize(TSize(35,37)));
sl@0
  1134
	spriteAnim.Command(EADllSizeChanged);
sl@0
  1135
	spriteAnim.CommandReply(EADllActivate);
sl@0
  1136
	spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
sl@0
  1137
	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
sl@0
  1138
	TEST(retBool);
sl@0
  1139
	if (!retBool)
sl@0
  1140
		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
sl@0
  1141
sl@0
  1142
	User::After(HALF_SEC);
sl@0
  1143
sl@0
  1144
	// call command that changes 1st member's bitmap image
sl@0
  1145
	spriteAnim.Command(EADllIncDraw);
sl@0
  1146
	TheClient->iWs.Flush();
sl@0
  1147
	User::After(HALF_SEC);
sl@0
  1148
sl@0
  1149
sl@0
  1150
	CleanupStack::PopAndDestroy(5,&sprite);
sl@0
  1151
	}
sl@0
  1152
sl@0
  1153
/**
sl@0
  1154
@SYMTestCaseID		GRAPHICS-WSERV-0133
sl@0
  1155
sl@0
  1156
@SYMDEF             DEF081259
sl@0
  1157
sl@0
  1158
@SYMTestCaseDesc    Free timer animation test
sl@0
  1159
sl@0
  1160
@SYMTestPriority    High
sl@0
  1161
sl@0
  1162
@SYMTestStatus      Implemented
sl@0
  1163
sl@0
  1164
@SYMTestActions     The test creates a free timer window animation that animates
sl@0
  1165
                    a shrinking filled rect which changes colour in a predefined way.
sl@0
  1166
sl@0
  1167
@SYMTestExpectedResults The test verifies that the colour changes gets through to the the display.
sl@0
  1168
*/
sl@0
  1169
sl@0
  1170
#define NOT_TIMED_OUT timeWaitingForFrame < frametime<<4
sl@0
  1171
void CTAnimDll::FreeTimerL()
sl@0
  1172
    {
sl@0
  1173
    RTestAnim freeTimerAnim(iAnimDll);
sl@0
  1174
    User::LeaveIfError(freeTimerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeFreeTimer,KNullDesC8));
sl@0
  1175
    CleanupClosePushL(freeTimerAnim);
sl@0
  1176
    
sl@0
  1177
    const TInt frametime = 100000;  // 100 ms
sl@0
  1178
    const TInt samplingtime = frametime>>1; // 50 ms
sl@0
  1179
    
sl@0
  1180
    TPckgC<TInt> frametimeBuf(frametime);
sl@0
  1181
    freeTimerAnim.Command(ESetFrameTime, frametimeBuf);
sl@0
  1182
    freeTimerAnim.Command(EStartAnimation);
sl@0
  1183
    TheClient->iWs.Flush();
sl@0
  1184
    TheClient->iWs.Finish();
sl@0
  1185
sl@0
  1186
    TInt x = iRedrawWin->BaseWin()->AbsPosition().iX + (iRedrawWin->BaseWin()->Size().iWidth >> 1);
sl@0
  1187
    TInt y = iRedrawWin->BaseWin()->AbsPosition().iY + (iRedrawWin->BaseWin()->Size().iHeight >> 1);
sl@0
  1188
    TPoint middle(x,y);
sl@0
  1189
    
sl@0
  1190
    TRgb color = KRgbMagenta;
sl@0
  1191
    TBool foundRedFrame = EFalse;
sl@0
  1192
    TBool foundGreenFrame = EFalse;
sl@0
  1193
    TBool foundBlueFrame = EFalse;
sl@0
  1194
    TBool foundBlackFrame = EFalse;
sl@0
  1195
    
sl@0
  1196
    //The free-timer animates the colour in this predefined way.
sl@0
  1197
    //Test that the screen gets updated.
sl@0
  1198
    TInt timeWaitingForFrame = 0;
sl@0
  1199
    while(NOT_TIMED_OUT && !(foundRedFrame && foundGreenFrame && foundBlueFrame && foundBlackFrame)) //wait max 16*frametime=1280ms
sl@0
  1200
        {
sl@0
  1201
        //wait for the colour frame
sl@0
  1202
        color = PixelColour(middle);
sl@0
  1203
sl@0
  1204
        if(color == KRgbRed)
sl@0
  1205
            {
sl@0
  1206
            foundRedFrame = ETrue;
sl@0
  1207
            }
sl@0
  1208
        else if(color == KRgbGreen)
sl@0
  1209
            {
sl@0
  1210
            foundGreenFrame = ETrue;
sl@0
  1211
            }
sl@0
  1212
        else if(color == KRgbBlue)
sl@0
  1213
            {
sl@0
  1214
            foundBlueFrame = ETrue;
sl@0
  1215
            }
sl@0
  1216
        else if(color == KRgbBlack)
sl@0
  1217
            {
sl@0
  1218
            foundBlackFrame = ETrue;
sl@0
  1219
            }
sl@0
  1220
sl@0
  1221
        timeWaitingForFrame += samplingtime;
sl@0
  1222
        User::After(samplingtime); 
sl@0
  1223
        }
sl@0
  1224
    
sl@0
  1225
    TEST(foundRedFrame);
sl@0
  1226
    TEST(foundGreenFrame);
sl@0
  1227
    TEST(foundBlueFrame);
sl@0
  1228
    TEST(foundBlackFrame);
sl@0
  1229
    
sl@0
  1230
    freeTimerAnim.Command(EStopAnimation);  
sl@0
  1231
    CleanupStack::PopAndDestroy(&freeTimerAnim);
sl@0
  1232
    }
sl@0
  1233
sl@0
  1234
TRgb CTAnimDll::PixelColour(const TPoint& aPoint) const
sl@0
  1235
    {
sl@0
  1236
    TRgb pixel;
sl@0
  1237
    TheClient->iScreen->GetPixel(pixel, aPoint);
sl@0
  1238
    return pixel;
sl@0
  1239
    }
sl@0
  1240
sl@0
  1241
/**
sl@0
  1242
@SYMTestCaseID		GRAPHICS-WSERV-0134
sl@0
  1243
sl@0
  1244
@SYMDEF             DEF081259
sl@0
  1245
sl@0
  1246
@SYMTestCaseDesc    Animation's ESyncSecond sync-mode test
sl@0
  1247
sl@0
  1248
@SYMTestPriority    High
sl@0
  1249
sl@0
  1250
@SYMTestStatus      Implemented
sl@0
  1251
sl@0
  1252
@SYMTestActions     Creates an animation in ESyncSecond sync-mode.
sl@0
  1253
					Checks that animation's Animate() method was called either 9, 10 or 11
sl@0
  1254
					times during a 10-seconds-wait.
sl@0
  1255
					The test also checks that if RWsSession::PrepareForSwitchOff()
sl@0
  1256
					is called then the Animate() method will not be called until
sl@0
  1257
					TRawEvent::EActive event is simulated.
sl@0
  1258
sl@0
  1259
@SYMTestExpectedResults See actions.
sl@0
  1260
*/
sl@0
  1261
static const TInt K1Second =  1000000;
sl@0
  1262
static const TInt K3Seconds = 3000000;
sl@0
  1263
static const TInt K9Seconds = 9500000;
sl@0
  1264
void CTAnimDll::DisableTimerL()
sl@0
  1265
	{
sl@0
  1266
	//Defer start of timerAnim until the systen time are close to a full second
sl@0
  1267
	TTime now;
sl@0
  1268
	now.HomeTime();
sl@0
  1269
	TInt deferTime = K1Second - now.DateTime().MicroSecond();
sl@0
  1270
	User::After(deferTime);
sl@0
  1271
	
sl@0
  1272
	//Kick off timerAnim
sl@0
  1273
	RTestAnim timerAnim(iAnimDll);
sl@0
  1274
	User::LeaveIfError(timerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeTimer,KNullDesC8));
sl@0
  1275
	
sl@0
  1276
	User::After(K9Seconds);
sl@0
  1277
	TInt count=timerAnim.CommandReply(EADllCurrentCount);
sl@0
  1278
	
sl@0
  1279
#if defined(LOGGING)
sl@0
  1280
	TLogMessageText buf;
sl@0
  1281
	_LIT(KLog,"Anim DisableTimer  Count=%d");
sl@0
  1282
	buf.Format(KLog,count);
sl@0
  1283
	TheClient->LogMessage(buf);
sl@0
  1284
#endif
sl@0
  1285
	
sl@0
  1286
	TEST(count>=9 && count<=11);
sl@0
  1287
	if (count != 10)
sl@0
  1288
		INFO_PRINTF2(_L("count>=9 && count<=11 - Expected: 9,10 or 11 , Actual: %d"), count);
sl@0
  1289
	
sl@0
  1290
#if defined(__WINS__)
sl@0
  1291
	TheClient->iWs.SimulateXyInputType(EXYInputNone);	//Turn off pen in case it turns on the timer
sl@0
  1292
#endif
sl@0
  1293
sl@0
  1294
	// reset timer's counter and call RWsSession::PrepareForSwitchOff(),
sl@0
  1295
	// check that 3 seconds after the counter = 0
sl@0
  1296
	timerAnim.Command(EADllResetCount);
sl@0
  1297
	timerAnim.Command(EADllNoTimer);
sl@0
  1298
	TheClient->iWs.PrepareForSwitchOff();
sl@0
  1299
	TheClient->iWs.Flush();
sl@0
  1300
	User::After(K3Seconds);
sl@0
  1301
	count=timerAnim.CommandReply(EADllCurrentCount);
sl@0
  1302
#if defined(LOGGING)
sl@0
  1303
	buf.Format(KLog,count);
sl@0
  1304
	TheClient->LogMessage(buf);
sl@0
  1305
#endif
sl@0
  1306
	TEST(count==0);
sl@0
  1307
	if (count!=0)
sl@0
  1308
		INFO_PRINTF3(_L("count==0 - Expected: %d , Actual: %d"), 0,  count);
sl@0
  1309
sl@0
  1310
sl@0
  1311
	// simulates TRawEvent::EActive event,
sl@0
  1312
	// check that the timer didn't ticked until the event were simulated
sl@0
  1313
	timerAnim.Command(EADllTimerStarted);
sl@0
  1314
	TRawEvent event;
sl@0
  1315
	event.Set(TRawEvent::EActive);
sl@0
  1316
	TheClient->iWs.SimulateRawEvent(event);
sl@0
  1317
#if defined(__WINS__)
sl@0
  1318
	TheClient->iWs.SimulateXyInputType(EXYInputPointer);	//Turn pen on again
sl@0
  1319
#endif
sl@0
  1320
	TInt retVal = timerAnim.CommandReply(EADllFailed);
sl@0
  1321
	TEST(retVal==0);
sl@0
  1322
	if (retVal!=0)
sl@0
  1323
		INFO_PRINTF3(_L("timerAnim.CommandReply(EADllFailed) return value - Expected: %d , Actual: %d"), 0,  retVal);
sl@0
  1324
sl@0
  1325
	timerAnim.Close();
sl@0
  1326
	}
sl@0
  1327
sl@0
  1328
sl@0
  1329
/**
sl@0
  1330
@SYMTestCaseID		GRAPHICS-WSERV-0135
sl@0
  1331
sl@0
  1332
@SYMDEF             DEF081259
sl@0
  1333
sl@0
  1334
@SYMTestCaseDesc    Multiple animations test
sl@0
  1335
sl@0
  1336
@SYMTestPriority    High
sl@0
  1337
sl@0
  1338
@SYMTestStatus      Implemented
sl@0
  1339
sl@0
  1340
@SYMTestActions     Creates multiple animations for a window.
sl@0
  1341
sl@0
  1342
@SYMTestExpectedResults The test doesn't perform any specific validations.
sl@0
  1343
*/
sl@0
  1344
void CTAnimDll::MultipleAnimsL()
sl@0
  1345
	{
sl@0
  1346
	RTestAnim anim1(iAnimDll);
sl@0
  1347
	RTestAnim anim2(iAnimDll);
sl@0
  1348
	RTestAnim anim3(iAnimDll);
sl@0
  1349
	RTestAnim anim4(iAnimDll);
sl@0
  1350
	RTestAnim anim5(iAnimDll);
sl@0
  1351
	RTestAnim anim6(iAnimDll);
sl@0
  1352
	TPtrC8 des(NULL,0);
sl@0
  1353
	User::LeaveIfError(anim1.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1354
	CleanupClosePushL(anim1);
sl@0
  1355
	User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1356
	CleanupClosePushL(anim2);
sl@0
  1357
	User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1358
	CleanupClosePushL(anim3);
sl@0
  1359
	User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1360
	CleanupClosePushL(anim4);
sl@0
  1361
	User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1362
	CleanupClosePushL(anim5);
sl@0
  1363
	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1364
	anim6.Close();
sl@0
  1365
	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1366
	anim6.Close();
sl@0
  1367
	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1368
	CleanupStack::PopAndDestroy(&anim5);
sl@0
  1369
	anim6.Close();
sl@0
  1370
	User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1371
	CleanupClosePushL(anim5);
sl@0
  1372
	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1373
	CleanupStack::Pop(&anim5);
sl@0
  1374
	CleanupStack::PopAndDestroy(&anim4);
sl@0
  1375
	anim5.Close();
sl@0
  1376
	anim6.Close();
sl@0
  1377
	User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1378
	CleanupStack::PopAndDestroy(&anim3);
sl@0
  1379
	anim4.Close();
sl@0
  1380
	User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1381
	CleanupStack::PopAndDestroy(&anim2);
sl@0
  1382
	anim3.Close();
sl@0
  1383
	User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
sl@0
  1384
	CleanupStack::PopAndDestroy(&anim1);
sl@0
  1385
	anim2.Close();
sl@0
  1386
	}
sl@0
  1387
sl@0
  1388
/**
sl@0
  1389
@SYMTestCaseID		GRAPHICS-WSERV-0136
sl@0
  1390
sl@0
  1391
@SYMDEF             DEF081259
sl@0
  1392
sl@0
  1393
@SYMTestCaseDesc    Click plugin DLL test
sl@0
  1394
sl@0
  1395
@SYMTestPriority    High
sl@0
  1396
sl@0
  1397
@SYMTestStatus      Implemented
sl@0
  1398
sl@0
  1399
@SYMTestActions     Created two handles for a click plugin dll (RSoundPlugIn instances).
sl@0
  1400
					Plays with Load(), Unload() methods to verify that they affect
sl@0
  1401
					IsLoaded() call result.
sl@0
  1402
					Checks that CommandReply() for different opcodes
sl@0
  1403
					returns RSoundPlugIn::ESoundWrongPlugIn value.
sl@0
  1404
					Plays with SetPenClick(), SetKeyClick() to verify that they affect
sl@0
  1405
					PenClickEnabled() and KeyClickEnabled() call result.
sl@0
  1406
sl@0
  1407
sl@0
  1408
@SYMTestExpectedResults The test checks that RSoundPlugIn's methods work properly
sl@0
  1409
					and that both handles behave identically.
sl@0
  1410
*/
sl@0
  1411
void CTAnimDll::ClickPlugInL()
sl@0
  1412
	{
sl@0
  1413
	_LIT(KDllName,"CLICK");
sl@0
  1414
	RWsSession ws;
sl@0
  1415
	User::LeaveIfError(ws.Connect());
sl@0
  1416
	CleanupClosePushL(ws);
sl@0
  1417
	TBool retBool;
sl@0
  1418
	TInt retVal;
sl@0
  1419
sl@0
  1420
	// assign to the correct screen
sl@0
  1421
	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
sl@0
  1422
	CleanupStack::PushL(screen);
sl@0
  1423
	User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
sl@0
  1424
sl@0
  1425
	RSoundPlugIn click1(ws);
sl@0
  1426
	RSoundPlugIn click2(TheClient->iWs);
sl@0
  1427
	User::LeaveIfError(click1.Construct());
sl@0
  1428
	CleanupClosePushL(click1);
sl@0
  1429
	User::LeaveIfError(click2.Construct());
sl@0
  1430
	CleanupClosePushL(click2);
sl@0
  1431
	TBool changeable1;
sl@0
  1432
	TBool changeable2;
sl@0
  1433
	TBool loaded=click1.IsLoaded(changeable1);
sl@0
  1434
	//test that either both are loaded or both are not loaded
sl@0
  1435
	TEST(!loaded==!click2.IsLoaded(changeable2));
sl@0
  1436
	if (!loaded!=!click2.IsLoaded(changeable2))
sl@0
  1437
		INFO_PRINTF3(_L("!loaded==!click2.IsLoaded(changeable2) - Expected: %d , Actual: %d"), !loaded,  !click2.IsLoaded(changeable2));
sl@0
  1438
sl@0
  1439
	//test that either both are changeable or both are not changeable
sl@0
  1440
	TEST(!changeable1==!changeable2);
sl@0
  1441
	if (!changeable1!=!changeable2)
sl@0
  1442
		INFO_PRINTF3(_L("!changeable1==!changeable2) - Expected: %d , Actual: %d"), !changeable1,  !changeable2);
sl@0
  1443
sl@0
  1444
	if (loaded && changeable1)
sl@0
  1445
		{
sl@0
  1446
		// unload the first one
sl@0
  1447
		User::LeaveIfError(click1.Unload());
sl@0
  1448
		// check that the second is not loaded and still changeable
sl@0
  1449
		retBool = !click2.IsLoaded(changeable2);
sl@0
  1450
		TEST(retBool);
sl@0
  1451
		if (!retBool)
sl@0
  1452
			INFO_PRINTF3(_L("!click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1453
sl@0
  1454
		TEST(changeable2);
sl@0
  1455
		if (!changeable2)
sl@0
  1456
			INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue,  changeable2);
sl@0
  1457
sl@0
  1458
sl@0
  1459
		// load the first one and check that the second became loaded and is changeable
sl@0
  1460
		User::LeaveIfError(click1.Load(KDllName));
sl@0
  1461
		retBool = click2.IsLoaded(changeable2);
sl@0
  1462
		TEST(retBool);
sl@0
  1463
		if (!retBool)
sl@0
  1464
			INFO_PRINTF3(_L("click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1465
sl@0
  1466
		TEST(changeable2);
sl@0
  1467
		if (!changeable2)
sl@0
  1468
			INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue,  changeable2);
sl@0
  1469
sl@0
  1470
		// unload the second one
sl@0
  1471
		User::LeaveIfError(click2.Unload());
sl@0
  1472
		// check that the first is not loaded and still changeable
sl@0
  1473
		retBool = !click1.IsLoaded(changeable1);
sl@0
  1474
		TEST(retBool);
sl@0
  1475
		if (!retBool)
sl@0
  1476
			INFO_PRINTF3(_L("!click1.IsLoaded(changeable1) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1477
sl@0
  1478
		TEST(changeable1);
sl@0
  1479
		if (!changeable1)
sl@0
  1480
			INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue,  changeable1);
sl@0
  1481
sl@0
  1482
		// load the second one and check that the first one became loaded and is changeable
sl@0
  1483
		User::LeaveIfError(click2.Load(KDllName));
sl@0
  1484
		loaded=click1.IsLoaded(changeable1);
sl@0
  1485
		TEST(loaded);
sl@0
  1486
		if (!loaded)
sl@0
  1487
			INFO_PRINTF3(_L("loaded - Expected: %d , Actual: %d"), ETrue,  loaded);
sl@0
  1488
sl@0
  1489
		TEST(changeable1);
sl@0
  1490
		if (!changeable1)
sl@0
  1491
			INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue,  changeable1);
sl@0
  1492
		}
sl@0
  1493
	if (loaded)
sl@0
  1494
		{
sl@0
  1495
		TPtrC8 des(NULL,0);
sl@0
  1496
		retVal = click1.CommandReply(0,des);
sl@0
  1497
		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
sl@0
  1498
		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
sl@0
  1499
			INFO_PRINTF3(_L("click1.CommandReply(0,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
sl@0
  1500
sl@0
  1501
		retVal = click1.CommandReply(1,des);
sl@0
  1502
		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
sl@0
  1503
		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
sl@0
  1504
			INFO_PRINTF3(_L("click1.CommandReply(1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
sl@0
  1505
sl@0
  1506
		retVal = click1.CommandReply(2,des);
sl@0
  1507
		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
sl@0
  1508
		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
sl@0
  1509
			INFO_PRINTF3(_L("click1.CommandReply(2,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
sl@0
  1510
sl@0
  1511
		retVal = click1.CommandReply(-1,des);
sl@0
  1512
		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
sl@0
  1513
		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
sl@0
  1514
			INFO_PRINTF3(_L("click1.CommandReply(-1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
sl@0
  1515
sl@0
  1516
		retBool = click1.KeyClickEnabled();
sl@0
  1517
		TEST(retBool);
sl@0
  1518
		if (!retBool)
sl@0
  1519
			INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1520
sl@0
  1521
		retBool = click1.PenClickEnabled();
sl@0
  1522
		TEST(retBool);
sl@0
  1523
		if (!retBool)
sl@0
  1524
			INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1525
sl@0
  1526
		click1.SetPenClick(EFalse);
sl@0
  1527
		retBool = click1.KeyClickEnabled();
sl@0
  1528
		TEST(retBool);
sl@0
  1529
		if (!retBool)
sl@0
  1530
			INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1531
sl@0
  1532
		retBool = !click1.PenClickEnabled();
sl@0
  1533
		TEST(retBool);
sl@0
  1534
		if (!retBool)
sl@0
  1535
			INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1536
sl@0
  1537
		click1.SetKeyClick(EFalse);
sl@0
  1538
sl@0
  1539
		retBool = !click1.KeyClickEnabled();
sl@0
  1540
		TEST(retBool);
sl@0
  1541
		if (!retBool)
sl@0
  1542
			INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1543
sl@0
  1544
		retBool = !click1.PenClickEnabled();
sl@0
  1545
		TEST(retBool);
sl@0
  1546
		if (!retBool)
sl@0
  1547
			INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1548
sl@0
  1549
		click1.SetPenClick(ETrue);
sl@0
  1550
		retBool = !click1.KeyClickEnabled();
sl@0
  1551
		TEST(retBool);
sl@0
  1552
		if (!retBool)
sl@0
  1553
			INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1554
sl@0
  1555
		retBool = click1.PenClickEnabled();
sl@0
  1556
		TEST(retBool);
sl@0
  1557
		if (!retBool)
sl@0
  1558
			INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1559
sl@0
  1560
		click1.SetKeyClick(ETrue);
sl@0
  1561
		retBool = click1.KeyClickEnabled();
sl@0
  1562
		TEST(retBool);
sl@0
  1563
		if (!retBool)
sl@0
  1564
			INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1565
sl@0
  1566
		retBool = click1.PenClickEnabled();
sl@0
  1567
		TEST(retBool);
sl@0
  1568
		if (!retBool)
sl@0
  1569
			INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1570
sl@0
  1571
		/*RLibrary lib;
sl@0
  1572
		TInt err=lib.Load(KDllName);
sl@0
  1573
		if (err==KErrNone)
sl@0
  1574
			{
sl@0
  1575
			TPtrC8 des(NULL,0);
sl@0
  1576
			TEST(lib.Type()[2].iUid==click1.CommandReply(0,des));
sl@0
  1577
			lib.Close();
sl@0
  1578
			}*/
sl@0
  1579
		}
sl@0
  1580
	CleanupStack::PopAndDestroy(4,&ws);
sl@0
  1581
	}
sl@0
  1582
sl@0
  1583
void CTAnimDll::TestWindowInfo(RTestAnim& aAnim,TInt aScreen,TInt aPos,TInt aId)
sl@0
  1584
	{
sl@0
  1585
	TPckgBuf<TWindowGroupInfoParms> params;
sl@0
  1586
	params().iScreen=aScreen;
sl@0
  1587
	params().iOrdinalPosition=aPos;
sl@0
  1588
	TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> winGpInfo;
sl@0
  1589
	TIpcArgs ipcArgs;
sl@0
  1590
	ipcArgs.Set(KIpcSlot,&winGpInfo);
sl@0
  1591
	TBool retBool = aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs);
sl@0
  1592
	TEST(retBool);
sl@0
  1593
	if (!retBool)
sl@0
  1594
		INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1595
sl@0
  1596
	MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo& info=winGpInfo();
sl@0
  1597
	TEST(info.iId==aId);
sl@0
  1598
	if (info.iId!=aId)
sl@0
  1599
		INFO_PRINTF3(_L("winGpInfo() return value - Expected: %d , Actual: %d"), aId,  info.iId);
sl@0
  1600
sl@0
  1601
	TInt retVal = TheClient->iWs.GetWindowGroupOrdinalPriority(aId);
sl@0
  1602
	TEST(info.iOrdinalPriority==retVal);
sl@0
  1603
	if (info.iOrdinalPriority!=retVal)
sl@0
  1604
		INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority(aId) return value - Expected: %d , Actual: %d"), info.iOrdinalPriority, retVal);
sl@0
  1605
sl@0
  1606
	TBuf<64> windowGroupNameS;
sl@0
  1607
	TBuf<64> windowGroupNameA;
sl@0
  1608
	TheClient->iWs.GetWindowGroupNameFromIdentifier(aId,windowGroupNameS);
sl@0
  1609
	retVal = windowGroupNameS.Length();
sl@0
  1610
	TEST(info.iNameLength==retVal);
sl@0
  1611
	if (info.iNameLength!=retVal)
sl@0
  1612
		INFO_PRINTF3(_L("windowGroupNameS.Length() return value - Expected: %d , Actual: %d"), info.iNameLength, retVal);
sl@0
  1613
sl@0
  1614
	if (info.iNameLength<64)
sl@0
  1615
		{
sl@0
  1616
		ipcArgs.Set(KIpcSlot,&windowGroupNameA);
sl@0
  1617
		retBool = aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs);
sl@0
  1618
		TEST(retBool);
sl@0
  1619
		if (!retBool)
sl@0
  1620
			INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
sl@0
  1621
sl@0
  1622
		if (info.iNameLength>0)
sl@0
  1623
			{
sl@0
  1624
			TEST(windowGroupNameA==windowGroupNameS);
sl@0
  1625
			}
sl@0
  1626
		else
sl@0
  1627
			{
sl@0
  1628
			TEST(windowGroupNameA.Length()==0);
sl@0
  1629
			if (windowGroupNameA.Length()!=0)
sl@0
  1630
				INFO_PRINTF3(_L("iwindowGroupNameA.Length()==0 - Expected: %d, Actual: %d"), 0, windowGroupNameA.Length());
sl@0
  1631
			}
sl@0
  1632
sl@0
  1633
		}
sl@0
  1634
	TEST(info.iParentId>=-1);
sl@0
  1635
	if (info.iParentId<-1)
sl@0
  1636
		INFO_PRINTF3(_L("info.iParentId>=-1 - Expected: %d or greater, Actual: %d"), -1, info.iParentId);
sl@0
  1637
sl@0
  1638
	}
sl@0
  1639
sl@0
  1640
void CTAnimDll::TestEventHandlerRemovalL()
sl@0
  1641
	{
sl@0
  1642
	RTestAnim anim(iAnimDll);
sl@0
  1643
	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeEventHandler,KNullDesC8));
sl@0
  1644
	anim.Close();
sl@0
  1645
	}
sl@0
  1646
sl@0
  1647
/**
sl@0
  1648
@SYMTestCaseID		GRAPHICS-WSERV-0137
sl@0
  1649
sl@0
  1650
@SYMDEF             DEF081259
sl@0
  1651
sl@0
  1652
@SYMTestCaseDesc    Animation's extended window functions test
sl@0
  1653
sl@0
  1654
@SYMTestPriority    High
sl@0
  1655
sl@0
  1656
@SYMTestStatus      Implemented
sl@0
  1657
sl@0
  1658
@SYMTestActions     The test creates a window animation that has a couple of
sl@0
  1659
					commands that work with extended window functions encapsulated
sl@0
  1660
					into MAnimGeneralFunctionsWindowExtension class instance.
sl@0
  1661
					The test calls those commands to compare MAnimGeneralFunctionsWindowExtension's
sl@0
  1662
					methods' results with the results retuned by WSERV client classes.
sl@0
  1663
					MAnimGeneralFunctionsWindowExtension methods tested here:
sl@0
  1664
					Screens(), FocusScreens(), WindowGroups(), WindowGroupInfo(),
sl@0
  1665
					WindowGroupName()
sl@0
  1666
sl@0
  1667
@SYMTestExpectedResults MAnimGeneralFunctionsWindowExtension methods must give the same results as
sl@0
  1668
					the corresponding WSERV client methods would.
sl@0
  1669
*/
sl@0
  1670
void CTAnimDll::WinFunctionsL()
sl@0
  1671
	{
sl@0
  1672
	RTestAnim anim(iAnimDll);
sl@0
  1673
	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8));
sl@0
  1674
	CleanupClosePushL(anim);
sl@0
  1675
	TInt screens=anim.CommandReply(EADllScreen);
sl@0
  1676
	TEST(screens>0);
sl@0
  1677
	if (screens<=0)
sl@0
  1678
		INFO_PRINTF3(_L("anim.CommandReply(EADllScreen) return value - Expected: %d or greater, Actual: %d"), 1, screens);
sl@0
  1679
sl@0
  1680
	TInt focusScreen=anim.CommandReply(EADllFocusScreen);
sl@0
  1681
	TInt retVal = TheClient->iWs.GetFocusScreen();
sl@0
  1682
	TEST(focusScreen==retVal && focusScreen<=screens);
sl@0
  1683
	if (focusScreen!=retVal || focusScreen>screens)
sl@0
  1684
		INFO_PRINTF4(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d and less than or equal to  %d, Actual: %d"), retVal, screens, focusScreen);
sl@0
  1685
sl@0
  1686
	TInt ii;
sl@0
  1687
	TPckgBuf<TInt> screen;
sl@0
  1688
	CArrayPtrFlat<CMinWin>* wins=new(ELeave) CArrayPtrFlat<CMinWin>(screens);
sl@0
  1689
	CleanupStack::PushL(wins);
sl@0
  1690
	// create one window on each screen
sl@0
  1691
	for(ii=0;ii<screens;++ii)
sl@0
  1692
		{
sl@0
  1693
		CMinWin* win=new(ELeave) CMinWin(ii);
sl@0
  1694
		CleanupStack::PushL(win);
sl@0
  1695
		win->ConstructL();
sl@0
  1696
		wins->AppendL(win);
sl@0
  1697
		}
sl@0
  1698
	if (screens>1)
sl@0
  1699
		{
sl@0
  1700
		for (ii=screens-1;ii>=0;--ii)
sl@0
  1701
			{
sl@0
  1702
			TheClient->iWs.SetFocusScreen(ii);
sl@0
  1703
			retVal = anim.CommandReply(EADllFocusScreen);
sl@0
  1704
			TEST(retVal==ii);
sl@0
  1705
			if (retVal!=ii)
sl@0
  1706
				INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal);
sl@0
  1707
			}
sl@0
  1708
		for (ii=screens-1;ii>=0;--ii)
sl@0
  1709
			{
sl@0
  1710
			screen()=ii;
sl@0
  1711
			anim.CommandReply(EADllSetFocusScreen,screen);
sl@0
  1712
			retVal = anim.CommandReply(EADllFocusScreen);
sl@0
  1713
			TEST(retVal==ii);
sl@0
  1714
			if (retVal!=ii)
sl@0
  1715
				INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal);
sl@0
  1716
			}
sl@0
  1717
		}
sl@0
  1718
	TheClient->iWs.SetFocusScreen(focusScreen);
sl@0
  1719
	retVal = anim.CommandReply(EADllFocusScreen);
sl@0
  1720
	TEST(retVal==focusScreen);
sl@0
  1721
	if (retVal!=focusScreen)
sl@0
  1722
		INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), focusScreen, retVal);
sl@0
  1723
sl@0
  1724
	TInt winGroupsAll=0;
sl@0
  1725
	for(ii=0;ii<screens;++ii)
sl@0
  1726
		{
sl@0
  1727
		screen()=ii;
sl@0
  1728
		winGroupsAll+=anim.CommandReply(EADllWindowGroups,screen);
sl@0
  1729
		}
sl@0
  1730
	TInt winGroupsS=TheClient->iWs.NumWindowGroups();
sl@0
  1731
	TEST(winGroupsAll==winGroupsS);
sl@0
  1732
	if (winGroupsAll!=winGroupsS)
sl@0
  1733
		INFO_PRINTF3(_L("TheClient->iWs.NumWindowGroups() return value - Expected: %d, Actual: %d"), winGroupsS, winGroupsAll);
sl@0
  1734
sl@0
  1735
	// the remaining test will use winGroupsA and performed on current focus screen only
sl@0
  1736
	screen()=iTest->iScreenNumber;
sl@0
  1737
	TInt winGroupsA=anim.CommandReply(EADllWindowGroups,screen);
sl@0
  1738
	CArrayFixFlat<TInt>* windowList=new(ELeave) CArrayFixFlat<TInt>(3);
sl@0
  1739
	CleanupStack::PushL(windowList);
sl@0
  1740
	// wserv implementation returns window groups from current focus screen, followed by the rest
sl@0
  1741
	TheClient->iWs.WindowGroupList(windowList);
sl@0
  1742
	// only interested in window group from current focus screen
sl@0
  1743
	for (ii=0;ii<winGroupsA;++ii)
sl@0
  1744
		TestWindowInfo(anim,iTest->iScreenNumber,ii,(*windowList)[ii]);
sl@0
  1745
	TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> winGpInfo;
sl@0
  1746
	TIpcArgs ipcArgs;
sl@0
  1747
	TPckgBuf<TWindowGroupInfoParms> params;
sl@0
  1748
	params().iScreen=iTest->iScreenNumber;
sl@0
  1749
	params().iOrdinalPosition=winGroupsA;
sl@0
  1750
	ipcArgs.Set(KIpcSlot,&winGpInfo);
sl@0
  1751
	TBuf<64> windowGroupName;
sl@0
  1752
	TBool retBool = !anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs);
sl@0
  1753
	TEST(retBool);
sl@0
  1754
	if (!retBool)
sl@0
  1755
		INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool);
sl@0
  1756
sl@0
  1757
	ipcArgs.Set(KIpcSlot,&windowGroupName);
sl@0
  1758
	retBool = !anim.CommandReply(EADllWindowGroupName,params,ipcArgs);
sl@0
  1759
	TEST(retBool);
sl@0
  1760
	if (!retBool)
sl@0
  1761
		INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool);
sl@0
  1762
sl@0
  1763
	/*params().iOrdinalPosition=-1;		//Behaviour for negative positions not defined - but as writtin this code will pass
sl@0
  1764
	ipcArgs.Set(KIpcSlot,&winGpInfo);
sl@0
  1765
	TEST(anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs));
sl@0
  1766
	ipcArgs.Set(KIpcSlot,&windowGroupNameA);
sl@0
  1767
	TEST(anim.CommandReply(EADllWindowGroupName,params,ipcArgs));*/
sl@0
  1768
	RWindowGroup group(TheClient->iWs);
sl@0
  1769
	User::LeaveIfError(group.Construct(ENullWsHandle));
sl@0
  1770
	CleanupClosePushL(group);
sl@0
  1771
	_LIT(KGroupName,"Testxyz1234");
sl@0
  1772
	group.SetName(KGroupName);
sl@0
  1773
	group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+1);
sl@0
  1774
	TInt groupId=group.Identifier();
sl@0
  1775
	TestWindowInfo(anim,iTest->iScreenNumber,0,groupId);
sl@0
  1776
	group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[winGroupsA-1])-1);
sl@0
  1777
	TestWindowInfo(anim,iTest->iScreenNumber,winGroupsA,groupId);
sl@0
  1778
	CleanupStack::PopAndDestroy(screens+4,&anim);
sl@0
  1779
// Restore us back to the front
sl@0
  1780
	TheClient->iGroup->GroupWin()->SetOrdinalPosition(0);
sl@0
  1781
	}
sl@0
  1782
sl@0
  1783
/**
sl@0
  1784
@SYMTestCaseID		GRAPHICS-WSERV-0138
sl@0
  1785
sl@0
  1786
@SYMDEF             DEF081259
sl@0
  1787
sl@0
  1788
@SYMTestCaseDesc    Animation's extended window functions test 2
sl@0
  1789
sl@0
  1790
@SYMTestPriority    High
sl@0
  1791
sl@0
  1792
@SYMTestStatus      Implemented
sl@0
  1793
sl@0
  1794
@SYMTestActions     The test creates a window animation that has a command
sl@0
  1795
					for setting window's ordinal position and priority.
sl@0
  1796
					The test creates 4 window groups with the same priority and
sl@0
  1797
					checks that they have correct ordinal positions after the creation.
sl@0
  1798
					After that the test plays with updating ordinal positions and
sl@0
  1799
					priorities of the window groups using the animation's command.
sl@0
  1800
sl@0
  1801
@SYMTestExpectedResults The test checks that the command was executed with no errors
sl@0
  1802
					and affected ordinal positions of the window groups properly.
sl@0
  1803
*/
sl@0
  1804
void CTAnimDll::WinFunctions2L()
sl@0
  1805
	{
sl@0
  1806
	RTestAnim anim(iAnimDll);
sl@0
  1807
	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8));
sl@0
  1808
	CleanupClosePushL(anim);
sl@0
  1809
	CArrayFixFlat<TInt>* windowList=new(ELeave) CArrayFixFlat<TInt>(3);
sl@0
  1810
	TheClient->iWs.WindowGroupList(windowList);
sl@0
  1811
	TInt priority=TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+2;
sl@0
  1812
	delete windowList;
sl@0
  1813
	RWindowGroup group1(TheClient->iWs);
sl@0
  1814
	User::LeaveIfError(group1.Construct(ENullWsHandle));
sl@0
  1815
	CleanupClosePushL(group1);
sl@0
  1816
	group1.SetOrdinalPosition(0,priority);
sl@0
  1817
	RWindowGroup group2(TheClient->iWs);
sl@0
  1818
	User::LeaveIfError(group2.Construct(ENullWsHandle));
sl@0
  1819
	CleanupClosePushL(group2);
sl@0
  1820
	group2.SetOrdinalPosition(0,priority);
sl@0
  1821
	RWindowGroup group3(TheClient->iWs);
sl@0
  1822
	User::LeaveIfError(group3.Construct(ENullWsHandle));
sl@0
  1823
	CleanupClosePushL(group3);
sl@0
  1824
	group3.SetOrdinalPosition(0,priority);
sl@0
  1825
	RWindowGroup group4(TheClient->iWs);
sl@0
  1826
	User::LeaveIfError(group4.Construct(ENullWsHandle));
sl@0
  1827
	CleanupClosePushL(group4);
sl@0
  1828
	group4.SetOrdinalPosition(0,priority);
sl@0
  1829
sl@0
  1830
	TInt retVal = group1.OrdinalPosition();
sl@0
  1831
	TEST(retVal==3);
sl@0
  1832
	if (retVal!=3)
sl@0
  1833
		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
sl@0
  1834
sl@0
  1835
	retVal = group2.OrdinalPosition();
sl@0
  1836
	TEST(retVal==2);
sl@0
  1837
	if (retVal!=2)
sl@0
  1838
		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
sl@0
  1839
sl@0
  1840
	retVal = group3.OrdinalPosition();
sl@0
  1841
	TEST(retVal==1);
sl@0
  1842
	if (retVal!=1)
sl@0
  1843
		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
sl@0
  1844
sl@0
  1845
	retVal = group4.OrdinalPosition();
sl@0
  1846
	TEST(retVal==0);
sl@0
  1847
	if (retVal!=0)
sl@0
  1848
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  1849
sl@0
  1850
	TPckgBuf<TSetOrdinalParms> params;
sl@0
  1851
	params().iIdentifier=group4.Identifier();
sl@0
  1852
	params().iOrdinalPriority=priority;
sl@0
  1853
	params().iOrdinalPosition=1;
sl@0
  1854
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1855
	TEST(retVal==KErrNone);
sl@0
  1856
	if (retVal!=KErrNone)
sl@0
  1857
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1858
sl@0
  1859
	retVal = group3.OrdinalPosition();
sl@0
  1860
	TEST(retVal==0);
sl@0
  1861
	if (retVal!=0)
sl@0
  1862
		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  1863
sl@0
  1864
	retVal = group4.OrdinalPosition();
sl@0
  1865
	TEST(retVal==1);
sl@0
  1866
	if (retVal!=1)
sl@0
  1867
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
sl@0
  1868
sl@0
  1869
	params().iOrdinalPosition=2;
sl@0
  1870
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1871
	TEST(retVal==KErrNone);
sl@0
  1872
	if (retVal!=KErrNone)
sl@0
  1873
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1874
sl@0
  1875
	retVal = group2.OrdinalPosition();
sl@0
  1876
	TEST(retVal==1);
sl@0
  1877
	if (retVal!=1)
sl@0
  1878
		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
sl@0
  1879
sl@0
  1880
	retVal = group4.OrdinalPosition();
sl@0
  1881
	TEST(retVal==2);
sl@0
  1882
	if (retVal!=2)
sl@0
  1883
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
sl@0
  1884
sl@0
  1885
	params().iOrdinalPosition=3;
sl@0
  1886
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1887
	TEST(retVal==KErrNone);
sl@0
  1888
	if (retVal!=KErrNone)
sl@0
  1889
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1890
sl@0
  1891
	retVal = group1.OrdinalPosition();
sl@0
  1892
	TEST(retVal==2);
sl@0
  1893
	if (retVal!=2)
sl@0
  1894
		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
sl@0
  1895
sl@0
  1896
	retVal = group2.OrdinalPosition();
sl@0
  1897
	TEST(retVal==1);
sl@0
  1898
	if (retVal!=1)
sl@0
  1899
		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
sl@0
  1900
sl@0
  1901
	retVal = group3.OrdinalPosition();
sl@0
  1902
	TEST(retVal==0);
sl@0
  1903
	if (retVal!=0)
sl@0
  1904
		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  1905
sl@0
  1906
	retVal = group4.OrdinalPosition();
sl@0
  1907
	TEST(retVal==3);
sl@0
  1908
	if (retVal!=3)
sl@0
  1909
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
sl@0
  1910
sl@0
  1911
	params().iOrdinalPriority=priority+1;
sl@0
  1912
	params().iOrdinalPosition=3;
sl@0
  1913
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1914
	TEST(retVal==KErrNone);
sl@0
  1915
	if (retVal!=KErrNone)
sl@0
  1916
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1917
sl@0
  1918
	retVal = group4.OrdinalPosition();
sl@0
  1919
	TEST(retVal==0);
sl@0
  1920
	if (retVal!=0)
sl@0
  1921
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  1922
sl@0
  1923
	params().iOrdinalPriority=priority;
sl@0
  1924
	params().iOrdinalPosition=-2;
sl@0
  1925
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1926
	TEST(retVal==KErrNone);
sl@0
  1927
	if (retVal!=KErrNone)
sl@0
  1928
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1929
sl@0
  1930
	retVal = group4.OrdinalPosition();
sl@0
  1931
	TEST(retVal==3);
sl@0
  1932
	if (retVal!=3)
sl@0
  1933
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
sl@0
  1934
sl@0
  1935
	params().iOrdinalPosition=0;
sl@0
  1936
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1937
	TEST(retVal==KErrNone);
sl@0
  1938
	if (retVal!=KErrNone)
sl@0
  1939
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1940
sl@0
  1941
	retVal = group1.OrdinalPosition();
sl@0
  1942
	TEST(retVal==3);
sl@0
  1943
	if (retVal!=3)
sl@0
  1944
		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
sl@0
  1945
sl@0
  1946
	retVal = group2.OrdinalPosition();
sl@0
  1947
	TEST(retVal==2);
sl@0
  1948
	if (retVal!=2)
sl@0
  1949
		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
sl@0
  1950
sl@0
  1951
	retVal = group3.OrdinalPosition();
sl@0
  1952
	TEST(retVal==1);
sl@0
  1953
	if (retVal!=1)
sl@0
  1954
		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
sl@0
  1955
sl@0
  1956
	retVal = group4.OrdinalPosition();
sl@0
  1957
	TEST(retVal==0);
sl@0
  1958
	if (retVal!=0)
sl@0
  1959
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  1960
sl@0
  1961
	params().iOrdinalPriority=priority-1;
sl@0
  1962
	params().iOrdinalPosition=2;
sl@0
  1963
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1964
	TEST(retVal==KErrNone);
sl@0
  1965
	if (retVal!=KErrNone)
sl@0
  1966
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1967
sl@0
  1968
	retVal = group1.OrdinalPosition();
sl@0
  1969
	TEST(retVal==2);
sl@0
  1970
	if (retVal!=2)
sl@0
  1971
		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
sl@0
  1972
sl@0
  1973
	retVal = group2.OrdinalPosition();
sl@0
  1974
	TEST(retVal==1);
sl@0
  1975
	if (retVal!=1)
sl@0
  1976
		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
sl@0
  1977
sl@0
  1978
	retVal = group3.OrdinalPosition();
sl@0
  1979
	TEST(retVal==0);
sl@0
  1980
	if (retVal!=0)
sl@0
  1981
		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  1982
sl@0
  1983
	retVal = group4.OrdinalPosition();
sl@0
  1984
	TEST(retVal==0);
sl@0
  1985
	if (retVal!=0)
sl@0
  1986
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  1987
sl@0
  1988
sl@0
  1989
	params().iOrdinalPriority=priority;
sl@0
  1990
	params().iOrdinalPosition=0;
sl@0
  1991
	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
sl@0
  1992
	TEST(retVal==KErrNone);
sl@0
  1993
	if (retVal!=KErrNone)
sl@0
  1994
		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
sl@0
  1995
sl@0
  1996
	retVal = group1.OrdinalPosition();
sl@0
  1997
	TEST(retVal==3);
sl@0
  1998
	if (retVal!=3)
sl@0
  1999
		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
sl@0
  2000
sl@0
  2001
	retVal = group2.OrdinalPosition();
sl@0
  2002
	TEST(retVal==2);
sl@0
  2003
	if (retVal!=2)
sl@0
  2004
		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
sl@0
  2005
sl@0
  2006
	retVal = group3.OrdinalPosition();
sl@0
  2007
	TEST(retVal==1);
sl@0
  2008
	if (retVal!=1)
sl@0
  2009
		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
sl@0
  2010
sl@0
  2011
	retVal = group4.OrdinalPosition();
sl@0
  2012
	TEST(retVal==0);
sl@0
  2013
	if (retVal!=0)
sl@0
  2014
		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
sl@0
  2015
sl@0
  2016
	CleanupStack::PopAndDestroy(5,&anim);
sl@0
  2017
	/*TInt pos1=group1.OrdinalPosition();
sl@0
  2018
	TInt pos2=group2.OrdinalPosition();
sl@0
  2019
	TInt pos3=group3.OrdinalPosition();
sl@0
  2020
	TInt pos4=group4.OrdinalPosition();*/
sl@0
  2021
	}
sl@0
  2022
sl@0
  2023
sl@0
  2024
/**
sl@0
  2025
@SYMTestCaseID		GRAPHICS-WSERV-0139
sl@0
  2026
sl@0
  2027
@SYMDEF             DEF081259, DEF122220
sl@0
  2028
sl@0
  2029
@SYMTestCaseDesc    Animation's notifications test
sl@0
  2030
sl@0
  2031
@SYMTestPriority    High
sl@0
  2032
sl@0
  2033
@SYMTestStatus      Implemented
sl@0
  2034
sl@0
  2035
@SYMTestActions     The test works with two screens. An animation is created that keeps
sl@0
  2036
					track on all notifications about EDirectScreenAccess, EHeartbeatTimer,
sl@0
  2037
					EScreenDeviceChange events.
sl@0
  2038
					The test generates those events by performing operations on direct
sl@0
  2039
					screen access and simulating TRawEvent::EInactive and TRawEvent::EAactive
sl@0
  2040
					events.
sl@0
  2041
sl@0
  2042
@SYMTestExpectedResults  The test checks that the animation didn't miss any of EDirectScreenAccess
sl@0
  2043
					or EHeartbeatTimer notifications. (The test doesn't check EScreenDeviceChange
sl@0
  2044
					notifications however).
sl@0
  2045
					The test also makes sure that the animation didn't animate
sl@0
  2046
					during inactive state.
sl@0
  2047
					For DEF12220, the test will crash when a untidied notifier from a previous RTestAnim object
sl@0
  2048
					is accessed if the fix is not present. If the fix is present, the test should not crash.
sl@0
  2049
*/
sl@0
  2050
void CTAnimDll::TestNotificationsL()
sl@0
  2051
	{
sl@0
  2052
	RTestAnim anim(iAnimDll);
sl@0
  2053
	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8));
sl@0
  2054
	CleanupClosePushL(anim);
sl@0
  2055
sl@0
  2056
	TPckgBuf<TInt> screenNum;
sl@0
  2057
sl@0
  2058
	// initial state - test that we have no DSA on either screen
sl@0
  2059
	screenNum() = 0;
sl@0
  2060
	TInt dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2061
	TEST(!dsa);
sl@0
  2062
	if (dsa)
sl@0
  2063
		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
sl@0
  2064
sl@0
  2065
	screenNum() = 1;
sl@0
  2066
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2067
	TEST(!dsa);
sl@0
  2068
	if (dsa)
sl@0
  2069
		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
sl@0
  2070
sl@0
  2071
	// create first DSA, but don't start it - test that we have no DSA on either screen
sl@0
  2072
	CScrollText* dsa1 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
sl@0
  2073
	CleanupStack::PushL(dsa1);
sl@0
  2074
	screenNum() = 0;
sl@0
  2075
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2076
	TEST(!dsa);
sl@0
  2077
	if (dsa)
sl@0
  2078
		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
sl@0
  2079
sl@0
  2080
	screenNum() = 1;
sl@0
  2081
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2082
	TEST(!dsa);
sl@0
  2083
	if (dsa)
sl@0
  2084
		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
sl@0
  2085
sl@0
  2086
	// start first DSA - test that we have DSA on this screen but not other screen
sl@0
  2087
	dsa1->StartL();
sl@0
  2088
	screenNum() = 0;
sl@0
  2089
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2090
	TInt retVal = (screenNum() == iTest->iScreenNumber);
sl@0
  2091
	TEST(dsa == retVal);
sl@0
  2092
	if (dsa != retVal)
sl@0
  2093
		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
sl@0
  2094
sl@0
  2095
	screenNum() = 1;
sl@0
  2096
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2097
	retVal = (screenNum() == iTest->iScreenNumber);
sl@0
  2098
	TEST(dsa == retVal);
sl@0
  2099
	if (dsa != retVal)
sl@0
  2100
		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
sl@0
  2101
sl@0
  2102
	// start second DSA
sl@0
  2103
	CScrollText* dsa2 = CScrollText::NewL(iTest->iScreenNumber,2,*TheClient->iGroup,5,EFalse);
sl@0
  2104
	CleanupStack::PushL(dsa2);
sl@0
  2105
	dsa2->StartL();
sl@0
  2106
	screenNum() = 0;
sl@0
  2107
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2108
	retVal = (screenNum() == iTest->iScreenNumber);
sl@0
  2109
	TEST(dsa == retVal);
sl@0
  2110
	if (dsa != retVal)
sl@0
  2111
		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
sl@0
  2112
sl@0
  2113
	screenNum() = 1;
sl@0
  2114
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2115
	retVal = (screenNum() == iTest->iScreenNumber);
sl@0
  2116
	TEST(dsa == retVal);
sl@0
  2117
	if (dsa != retVal)
sl@0
  2118
		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
sl@0
  2119
sl@0
  2120
	// stop second DSA
sl@0
  2121
	dsa2->Stop();
sl@0
  2122
	CleanupStack::PopAndDestroy(dsa2);
sl@0
  2123
	screenNum() = 0;
sl@0
  2124
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2125
	retVal = (screenNum() == iTest->iScreenNumber);
sl@0
  2126
	TEST(dsa == retVal);
sl@0
  2127
	if (dsa != retVal)
sl@0
  2128
		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
sl@0
  2129
sl@0
  2130
	screenNum() = 1;
sl@0
  2131
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2132
	retVal = (screenNum() == iTest->iScreenNumber);
sl@0
  2133
	TEST(dsa == retVal);
sl@0
  2134
	if (dsa != retVal)
sl@0
  2135
		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
sl@0
  2136
sl@0
  2137
	// stop first DSA
sl@0
  2138
	dsa1->Stop();
sl@0
  2139
	CleanupStack::PopAndDestroy(dsa1);
sl@0
  2140
	screenNum() = 0;
sl@0
  2141
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2142
	TEST(!dsa);
sl@0
  2143
	if (dsa)
sl@0
  2144
		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
sl@0
  2145
sl@0
  2146
	screenNum() = 1;
sl@0
  2147
	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
sl@0
  2148
	TEST(!dsa);
sl@0
  2149
	if (dsa)
sl@0
  2150
		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
sl@0
  2151
sl@0
  2152
	// TEST heartbeat timer start\stop notifications - no longer relevant - has been removed 
sl@0
  2153
sl@0
  2154
	CleanupStack::PopAndDestroy(&anim);
sl@0
  2155
	
sl@0
  2156
	// Create second RTestAnim for DEF12220 test
sl@0
  2157
	RTestAnim anim2(iAnimDll);
sl@0
  2158
	User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8));
sl@0
  2159
	CleanupClosePushL(anim2);
sl@0
  2160
	
sl@0
  2161
	// Create third dsa
sl@0
  2162
	CScrollText* dsa3 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
sl@0
  2163
	CleanupStack::PushL(dsa3);
sl@0
  2164
	// If the fix for DEF12220 is not present, starting dsa3 will cause a crash.
sl@0
  2165
	dsa3->StartL();
sl@0
  2166
	dsa3->Stop();
sl@0
  2167
	CleanupStack::PopAndDestroy(dsa3);
sl@0
  2168
	CleanupStack::PopAndDestroy(&anim2);
sl@0
  2169
	}
sl@0
  2170
sl@0
  2171
/**
sl@0
  2172
 A minimal dsa call to a window with a child window, for running coverage on
sl@0
  2173
 ClipWindows member funcion.
sl@0
  2174
 
sl@0
  2175
@SYMTestCaseID GRAPHICS-WSERV-0410
sl@0
  2176
sl@0
  2177
@SYMPREQ PREQ1841
sl@0
  2178
sl@0
  2179
@SYMTestExpectedResults Nothing visible, the CWsClientWindow::ClipWindows 
sl@0
  2180
should be partially covered.
sl@0
  2181
 */
sl@0
  2182
void CTAnimDll::TestCoverageL()
sl@0
  2183
	{
sl@0
  2184
	// create first DSA, but don't start it - test that we have no DSA on either screen
sl@0
  2185
	CWindowWithChild* dsa1 = CWindowWithChild::NewL(iTest->iScreenNumber, *TheClient->iGroup, EFalse);
sl@0
  2186
	CleanupStack::PushL(dsa1);
sl@0
  2187
sl@0
  2188
	// start first DSA - test that we have DSA on this screen but not other screen
sl@0
  2189
	dsa1->StartL();
sl@0
  2190
	dsa1->PerformCoverageCalls();
sl@0
  2191
	dsa1->Stop();
sl@0
  2192
sl@0
  2193
	// cover another trivial case for a non-visible window
sl@0
  2194
	RWindow* cwin = dsa1->ChildWindow();
sl@0
  2195
	
sl@0
  2196
	cwin->SetTransparencyAlphaChannel();
sl@0
  2197
	dsa1->ContinueL();
sl@0
  2198
sl@0
  2199
	//ClipWindows with visible and invisible branches
sl@0
  2200
	cwin->SetVisible(EFalse);
sl@0
  2201
sl@0
  2202
	//cover CWsWindow::StatusDump (visible and invisible branch)
sl@0
  2203
	TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump);
sl@0
  2204
	
sl@0
  2205
	dsa1->Stop();
sl@0
  2206
	dsa1->StartL();
sl@0
  2207
	cwin->SetVisible(ETrue);
sl@0
  2208
	dsa1->Stop();
sl@0
  2209
sl@0
  2210
	CleanupStack::PopAndDestroy(dsa1);
sl@0
  2211
	}
sl@0
  2212
sl@0
  2213
/**
sl@0
  2214
 Executes a Panic coverage test for a given test-number.
sl@0
  2215
 Most of the first lines copied from DoPanicTest.
sl@0
  2216
 CWsWindow is tested through CommandL (case 0-3) and other API funcs
sl@0
  2217
 */
sl@0
  2218
LOCAL_C TInt DoPanicTestCoverage(TInt aTestNum, TAny *aScreenNumber)
sl@0
  2219
	{
sl@0
  2220
	RWsSession ws;
sl@0
  2221
	User::LeaveIfError(ws.Connect());
sl@0
  2222
sl@0
  2223
	// assign to the correct screen
sl@0
  2224
	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
sl@0
  2225
	User::LeaveIfError(screen->Construct(reinterpret_cast<TInt>(aScreenNumber)));
sl@0
  2226
sl@0
  2227
	RWindowGroup group(ws);
sl@0
  2228
	User::LeaveIfError(group.Construct(333));
sl@0
  2229
	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
sl@0
  2230
	RAnimDll animDll=RAnimDll(ws);
sl@0
  2231
	User::LeaveIfError(animDll.Load(KAnimDLLName));
sl@0
  2232
	
sl@0
  2233
	RWindow window(ws);
sl@0
  2234
	User::LeaveIfError(window.Construct(group,123));
sl@0
  2235
	window.SetSize(TSize(10,10));
sl@0
  2236
	window.Activate();
sl@0
  2237
	window.BeginRedraw();
sl@0
  2238
	window.EndRedraw();
sl@0
  2239
sl@0
  2240
	switch (aTestNum)
sl@0
  2241
	{
sl@0
  2242
	case 0: //non translucent window
sl@0
  2243
		//EWsWinOpSetTransparentRegion -> EWservPanicTransparencyObjNotCreated
sl@0
  2244
		{
sl@0
  2245
		RRegion r;
sl@0
  2246
		window.SetTransparentRegion(r);
sl@0
  2247
		break;
sl@0
  2248
		}
sl@0
  2249
	case 1:
sl@0
  2250
		//EWsWinOpSetTransparencyPolicy -> EWservPanicTransparencyObjNotCreated
sl@0
  2251
		window.SetTransparencyPolicy(ETransparencyDefault);
sl@0
  2252
		break;
sl@0
  2253
	case 2:
sl@0
  2254
		// -> EWservPanicWindowActive
sl@0
  2255
		window.Activate();
sl@0
  2256
		break;
sl@0
  2257
	case 3:
sl@0
  2258
		// -> EWservPanicCornerParams
sl@0
  2259
		window.SetCornerType(EWindowCornerSquare, ECornerTypeMask);
sl@0
  2260
		break;
sl@0
  2261
	case 4:
sl@0
  2262
		// -> EWservPanicCornerParams
sl@0
  2263
		window.SetCornerType(ECornerTypeMask, 0);
sl@0
  2264
		break;
sl@0
  2265
	default:
sl@0
  2266
		return EWsExitReasonFinished;
sl@0
  2267
	}
sl@0
  2268
	ws.Flush();
sl@0
  2269
	
sl@0
  2270
	return(EWsExitReasonBad);	// Should never get here, but it's baaddd if it does
sl@0
  2271
	}
sl@0
  2272
sl@0
  2273
/**
sl@0
  2274
@SYMTestCaseID GRAPHICS-WSERV-0411
sl@0
  2275
sl@0
  2276
@SYMPREQ PREQ1841
sl@0
  2277
sl@0
  2278
@SYMTestCaseDesc Does functional coverage for code that Panics
sl@0
  2279
sl@0
  2280
*/
sl@0
  2281
void CTAnimDll::TestPanicCoverageL()
sl@0
  2282
	{
sl@0
  2283
	TClientPanic expectedPanicCode[] = 
sl@0
  2284
		{
sl@0
  2285
		EWservPanicTransparencyObjNotCreated,	//0
sl@0
  2286
		EWservPanicTransparencyObjNotCreated,	//1
sl@0
  2287
		EWservPanicWindowActive,				//2
sl@0
  2288
		EWservPanicCornerParams,				//3
sl@0
  2289
		EWservPanicCornerParams,				//4
sl@0
  2290
		};
sl@0
  2291
	for (TInt i=0; i<sizeof(expectedPanicCode)/sizeof(TClientPanic); i++)
sl@0
  2292
		{
sl@0
  2293
		TEST(iTest->TestWsPanicL(
sl@0
  2294
				DoPanicTestCoverage,			//aFunction
sl@0
  2295
				expectedPanicCode[i],			//aExitReason
sl@0
  2296
				i,								//aInt
sl@0
  2297
				(TAny*)iTest->iScreenNumber,	//aPtr
sl@0
  2298
				NULL)); //&finishTests			//aTestFinished
sl@0
  2299
		iTest->CloseAllPanicWindows();
sl@0
  2300
		}
sl@0
  2301
	}
sl@0
  2302
sl@0
  2303
sl@0
  2304
/**
sl@0
  2305
@SYMTestCaseID GRAPHICS-CODEBASE-WSERV-0056-0001
sl@0
  2306
sl@0
  2307
@SYMPREQ PGM027
sl@0
  2308
sl@0
  2309
@SYMTestCaseDesc Tests RAnimDll::Load (by passing invalid file name)
sl@0
  2310
sl@0
  2311
@SYMTestPriority 1 
sl@0
  2312
sl@0
  2313
@SYMTestStatus Implemented
sl@0
  2314
sl@0
  2315
@SYMTestActions Call RAnimDll::Load() by passing invalid file name\n
sl@0
  2316
sl@0
  2317
@SYMTestExpectedResults Should return with appropiate error message. KErrNotFound
sl@0
  2318
 */
sl@0
  2319
void CTAnimDll::TestLoadApiL()	
sl@0
  2320
	{
sl@0
  2321
	RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs);
sl@0
  2322
	CleanupStack::PushL(animDll);
sl@0
  2323
	TInt ret=0;
sl@0
  2324
	_LIT(KAnimFile,"Nothing.dll");
sl@0
  2325
	_LIT(KEmpty,"");
sl@0
  2326
	ret=animDll->Load(KAnimFile);
sl@0
  2327
	TEST(ret==KErrNotFound);
sl@0
  2328
	ret=animDll->Load(KEmpty);
sl@0
  2329
	TEST(ret==KErrNotFound);
sl@0
  2330
	CleanupStack::PopAndDestroy(animDll);
sl@0
  2331
	}
sl@0
  2332
sl@0
  2333
TInt CTAnimDll::CheckError(TInt aError,TInt aExpected)
sl@0
  2334
	{
sl@0
  2335
	if (aError!=0)
sl@0
  2336
		{
sl@0
  2337
		if (aError>0)
sl@0
  2338
			{
sl@0
  2339
			_LIT(KLog,"The event at position %d did not match, total number of events=%d");
sl@0
  2340
			LOG_MESSAGE3(KLog,aError,aExpected);
sl@0
  2341
			}
sl@0
  2342
		else
sl@0
  2343
			{
sl@0
  2344
			_LIT(KLog,"Only recieved %d events, expecting %d events");
sl@0
  2345
			LOG_MESSAGE3(KLog,-aError,aExpected);
sl@0
  2346
			}
sl@0
  2347
		return EFalse;
sl@0
  2348
		}
sl@0
  2349
	return ETrue;
sl@0
  2350
	}
sl@0
  2351
sl@0
  2352
/**
sl@0
  2353
@SYMTestCaseID		GRAPHICS-WSERV-0448
sl@0
  2354
sl@0
  2355
@SYMCR				CR1164
sl@0
  2356
sl@0
  2357
@SYMTestCaseDesc	Test events get to Anims at a higher priorty than commands
sl@0
  2358
sl@0
  2359
@SYMTestPriority	High
sl@0
  2360
sl@0
  2361
@SYMTestStatus		Implemented
sl@0
  2362
sl@0
  2363
@SYMTestActions		Create a 2nd thread that sends events via kernal, send also commands from client to an Anim
sl@0
  2364
sl@0
  2365
@SYMTestExpectedResults	Check that events intersperse commands from client
sl@0
  2366
*/
sl@0
  2367
void CTAnimDll::KeyClickPriorityL()
sl@0
  2368
	{
sl@0
  2369
	_LIT(KFailedAdd,"Device Driver Failed to Add an Event, error=%d");
sl@0
  2370
	REventAnim* anim=REventAnim::NewL(iTestWin->BaseWin(),&iAnimDll);
sl@0
  2371
	TPckgBuf<TInt> events;
sl@0
  2372
	TInt err=anim->CommandReply(EADllLoadDeviceDriver);
sl@0
  2373
	if (err!=KErrNone)
sl@0
  2374
		{
sl@0
  2375
		_LIT(KLog,"Failed to load Device Driver for sending Events");
sl@0
  2376
		TEST(EFalse);
sl@0
  2377
		LOG_MESSAGE(KLog);
sl@0
  2378
		}
sl@0
  2379
	TInt error;
sl@0
  2380
	TInt ii;
sl@0
  2381
	for (ii=1;ii<5;++ii)
sl@0
  2382
		{
sl@0
  2383
		events()=ii;
sl@0
  2384
		error=anim->CommandReply(EADllSendEvent,events);
sl@0
  2385
		if (error!=KErrNone)
sl@0
  2386
			LOG_MESSAGE2(KFailedAdd,error);
sl@0
  2387
		anim->Command(EADllAfterEvent);
sl@0
  2388
		TheClient->Flush();
sl@0
  2389
		error=anim->TestFail(ii);
sl@0
  2390
		TEST(CheckError(error,ii));
sl@0
  2391
		}
sl@0
  2392
	const TInt iterations=15;
sl@0
  2393
	const TInt eventsPerIteration=2;
sl@0
  2394
	const TInt totalEvents=iterations*eventsPerIteration;
sl@0
  2395
	events()=eventsPerIteration;
sl@0
  2396
	for (ii=iterations;ii>0;--ii)
sl@0
  2397
		{
sl@0
  2398
		error=anim->CommandReply(EADllSendEvent,events);
sl@0
  2399
		if (error!=KErrNone)
sl@0
  2400
			LOG_MESSAGE2(KFailedAdd,error);
sl@0
  2401
		anim->Command(EADllAfterEvent);
sl@0
  2402
		}
sl@0
  2403
	TheClient->Flush();
sl@0
  2404
	error=anim->TestFail(totalEvents);
sl@0
  2405
	TEST(CheckError(error,totalEvents));
sl@0
  2406
	anim->CommandReply(EADllUnloadDeviceDriver);
sl@0
  2407
	delete anim;
sl@0
  2408
	}
sl@0
  2409
sl@0
  2410
/**
sl@0
  2411
@SYMDEF             INC117828
sl@0
  2412
sl@0
  2413
@SYMTestCaseDesc    Tests Window Rect returned by CWsAnim::Parameters
sl@0
  2414
sl@0
  2415
@SYMTestPriority    High
sl@0
  2416
sl@0
  2417
@SYMTestStatus      Implemented
sl@0
  2418
sl@0
  2419
@SYMTestActions     This test creates a new window which overlaps the screen edge
sl@0
  2420
					and creates an animation on this window. An additional
sl@0
  2421
					CommandReplyL() option has been added to the AnimDLL to compare
sl@0
  2422
					the expected value of this rect with the actual value.
sl@0
  2423
					
sl@0
  2424
sl@0
  2425
@SYMTestExpectedResults The result of the EADllTestParameterRect CommandReplyL call will equal ETrue
sl@0
  2426
						if the passed Rect matches, EFalse otherwise.
sl@0
  2427
*/
sl@0
  2428
void CTAnimDll::ParameterValueTestL()
sl@0
  2429
	{
sl@0
  2430
	//Window Location & Dimension
sl@0
  2431
	TPoint winOrigin(-1,15);
sl@0
  2432
	TSize winSize(250,65);
sl@0
  2433
	
sl@0
  2434
	//Create a new window to perform the test; window needs to overlap the left edge of the screen.
sl@0
  2435
	CAnimWindow* paramTestWin = new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw);
sl@0
  2436
	CleanupStack::PushL(paramTestWin);
sl@0
  2437
	paramTestWin->ConstructL(winOrigin, winSize);
sl@0
  2438
sl@0
  2439
	RTestAnim anim = RTestAnim(iAnimDll);
sl@0
  2440
sl@0
  2441
	TPckgBuf<TRect> rectPckg;
sl@0
  2442
	TRect winRect(winOrigin, winSize);
sl@0
  2443
	rectPckg() = winRect;
sl@0
  2444
sl@0
  2445
	anim.Construct(*(paramTestWin->BaseWin()), EAnimTypeTest3, rectPckg);
sl@0
  2446
	anim.Command(EADllStartAnimate, rectPckg);
sl@0
  2447
sl@0
  2448
	TPckgBuf<TBool> boolPckg;
sl@0
  2449
	boolPckg() = ETrue;
sl@0
  2450
	anim.Command(EADllSetVisible, boolPckg);
sl@0
  2451
sl@0
  2452
	TEST(anim.CommandReply(EADllParameterRectValueTest, rectPckg));
sl@0
  2453
sl@0
  2454
	boolPckg() = EFalse;
sl@0
  2455
	anim.Command(EADllSetVisible, boolPckg);
sl@0
  2456
	anim.Command(EADllCancelAnimate);	
sl@0
  2457
	anim.Close();
sl@0
  2458
	CleanupStack::PopAndDestroy(paramTestWin);
sl@0
  2459
	}
sl@0
  2460
sl@0
  2461
/**
sl@0
  2462
@SYMDEF             DEF122176
sl@0
  2463
sl@0
  2464
@SYMTestCaseDesc    Test the operation of SetInterval with both negative and positive intervals
sl@0
  2465
sl@0
  2466
@SYMTestPriority    High
sl@0
  2467
sl@0
  2468
@SYMTestStatus      Implemented
sl@0
  2469
sl@0
  2470
@SYMTestActions     This test uses the test anim CAutoAnim3 in mode 3 which alternates
sl@0
  2471
					between drawing a large and a small ellipse at each interval.
sl@0
  2472
					The large ellipse is drawn first.
sl@0
  2473
					Note that the anims are redrawn at the rate of 2 intervals per second, so
sl@0
  2474
					setting an interval of 2 will mean that the anim is redrawn every second.
sl@0
  2475
						Step 1: The interval is set to be -2 and the test then waits for 0.9
sl@0
  2476
								seconds (to make sure one interval has passed) then checks that 
sl@0
  2477
								only the large ellipse has been drawn.							
sl@0
  2478
						Step 2: The interval is set to be 2 (redraw every second) and the test then 
sl@0
  2479
								waits for 1.2 seconds (to make sure two intervals have passed) and 
sl@0
  2480
								checks that the small ellipse has been drawn.
sl@0
  2481
					
sl@0
  2482
@SYMTestExpectedResults 
sl@0
  2483
					After Step 1 a large ellipse will be drawn on both windows.
sl@0
  2484
					After Step 1 a small ellipse will be drawn on both windows. 
sl@0
  2485
sl@0
  2486
*/
sl@0
  2487
void CTAnimDll::TestSetIntervalL()
sl@0
  2488
	{
sl@0
  2489
	RWsSession ws;
sl@0
  2490
	User::LeaveIfError(ws.Connect());
sl@0
  2491
	
sl@0
  2492
	// draws a little circle on the base window using window graphics and using window animation on the test window.
sl@0
  2493
	RTestAnim drawAnim=RTestAnim(iAnimDll);
sl@0
  2494
sl@0
  2495
	_LIT(KLog1,"SetInterval Test");
sl@0
  2496
	LOG_MESSAGE(KLog1);
sl@0
  2497
	TRect rect(10,10,110,110);
sl@0
  2498
	CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN);
sl@0
  2499
	iTestWin->Invalidate();
sl@0
  2500
	iTestWin->SetRect(rect);
sl@0
  2501
	iBaseWin->Invalidate();
sl@0
  2502
	iBaseWin->SetRect(rect);
sl@0
  2503
	TPckgBuf<TRect> rectPckg;
sl@0
  2504
	rectPckg()=rect;
sl@0
  2505
	User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg));	
sl@0
  2506
	
sl@0
  2507
	TPckgBuf<TInt> intPckg;
sl@0
  2508
	intPckg() = 3; // mode 3 for this anim flips between drawing a large and a small ellipse
sl@0
  2509
	drawAnim.Command(EADllSetMode, intPckg);
sl@0
  2510
	
sl@0
  2511
	intPckg() = MAnimGeneralFunctions::ESyncNone;
sl@0
  2512
	drawAnim.CommandReply(EADllDoSetSync, intPckg);	
sl@0
  2513
	
sl@0
  2514
	// Set an interval of -2 then wait 0.9 seconds, after which only the large ellipse should be visible 
sl@0
  2515
	intPckg() = -2;
sl@0
  2516
	drawAnim.CommandReply(EADllSetInterval, intPckg);
sl@0
  2517
	// Draw the large ellipse on the base window to match what the anim should be drawing
sl@0
  2518
	iBaseWin->SetRect(rect);	
sl@0
  2519
	iBaseWin->DoDraw();
sl@0
  2520
	ws.Finish();	
sl@0
  2521
	// Check Step 1 completed successfully
sl@0
  2522
	RedrawAndCheckWindows();	
sl@0
  2523
	
sl@0
  2524
	// Set an interval of 2 and wait 0.9 seconds, after which the small ellipse should be visible	
sl@0
  2525
	intPckg() = 2;
sl@0
  2526
	drawAnim.CommandReply(EADllSetInterval, intPckg);
sl@0
  2527
	// Draw the small ellipse on the base window to match what the anim should be drawing
sl@0
  2528
	iBaseWin->SetRect(TRect(40,40,80,80));	
sl@0
  2529
	iBaseWin->DoDraw();	
sl@0
  2530
	ws.Finish();
sl@0
  2531
	// Check Step 2 completed successfully
sl@0
  2532
	RedrawAndCheckWindows();		
sl@0
  2533
sl@0
  2534
	// clean up
sl@0
  2535
	drawAnim.Close();
sl@0
  2536
	ws.Close();
sl@0
  2537
	}
sl@0
  2538
sl@0
  2539
void CTAnimDll::RunTestCaseL(TInt /*aCurTestCase*/)
sl@0
  2540
	{
sl@0
  2541
	_LIT(KTest0,"RemoteBuffer");
sl@0
  2542
	_LIT(KTest1,"ExtraCopyTest");
sl@0
  2543
	_LIT(KTest2,"Misc");
sl@0
  2544
	_LIT(KTest3,"SyncMode1");
sl@0
  2545
	_LIT(KTest4,"Anim Dll Panics");
sl@0
  2546
	_LIT(KTest5,"Drawing test");
sl@0
  2547
	_LIT(KTest6,"Shadow drawing test");
sl@0
  2548
	_LIT(KTest7,"General drawing test");
sl@0
  2549
	_LIT(KTest8,"Destroy window test");
sl@0
  2550
	_LIT(KTest9,"Sprite Anim test");
sl@0
  2551
	_LIT(KTest10,"Free Timer test");
sl@0
  2552
	_LIT(KTest11,"Disable Timer test");
sl@0
  2553
	_LIT(KTest12,"Multiple Anims");
sl@0
  2554
	_LIT(KTest13,"ReLoad Click PlugIn");
sl@0
  2555
	_LIT(KTest14,"Window Functions");
sl@0
  2556
	_LIT(KTest15,"Window Functions 2");
sl@0
  2557
	_LIT(KTest16,"Notifications");
sl@0
  2558
	_LIT(KTest17,"Event Handler removal");
sl@0
  2559
	_LIT(KTest18,"Anim dll - Load Api Negative Test");
sl@0
  2560
	_LIT(KTest19,"Key Click Priority Test");
sl@0
  2561
	_LIT(KTest20,"CWsAnim::Parameters() WindowRect Value Test");
sl@0
  2562
	_LIT(KTest21,"SetInterval test");
sl@0
  2563
	_LIT(KTest22,"Client Window Coverage");
sl@0
  2564
	_LIT(KTest23,"Client Window Panic Coverage");
sl@0
  2565
	((CTAnimDllStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
sl@0
  2566
sl@0
  2567
//	if (iTest->iState==0) iTest->iState=22;	//Use this line to start running tests from a particular test
sl@0
  2568
	switch(++iTest->iState)
sl@0
  2569
		{
sl@0
  2570
		case 1:
sl@0
  2571
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0127"));
sl@0
  2572
			iTest->LogSubTest(KTest0);
sl@0
  2573
			RemoteBuffer();
sl@0
  2574
			break;
sl@0
  2575
		case 2:
sl@0
  2576
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0128"));
sl@0
  2577
			iTest->LogSubTest(KTest1);
sl@0
  2578
			ExtraCopyTest();
sl@0
  2579
			break;
sl@0
  2580
		case 3:
sl@0
  2581
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0126"));
sl@0
  2582
			iTest->LogSubTest(KTest2);
sl@0
  2583
			Misc();
sl@0
  2584
			break;
sl@0
  2585
		case 4:
sl@0
  2586
/**
sl@0
  2587
@SYMTestCaseID		GRAPHICS-WSERV-0503
sl@0
  2588
*/
sl@0
  2589
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0503"));
sl@0
  2590
			iTest->LogSubTest(KTest3);
sl@0
  2591
// Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue
sl@0
  2592
			break;
sl@0
  2593
		case 5:
sl@0
  2594
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0125"));
sl@0
  2595
			iTest->LogSubTest(KTest4);
sl@0
  2596
			TestPanicsL();
sl@0
  2597
			if (iTest->iScreenNumber == 1)
sl@0
  2598
				iTest->CloseAllPanicWindows();
sl@0
  2599
			break;
sl@0
  2600
		case 6:
sl@0
  2601
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0129"));
sl@0
  2602
			iTest->LogSubTest(KTest5);
sl@0
  2603
			DrawingTestL();
sl@0
  2604
			break;
sl@0
  2605
		case 7:
sl@0
  2606
/**
sl@0
  2607
@SYMTestCaseID		GRAPHICS-WSERV-0504
sl@0
  2608
*/
sl@0
  2609
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0504"));
sl@0
  2610
			iTest->LogSubTest(KTest6);
sl@0
  2611
// Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue
sl@0
  2612
			break;
sl@0
  2613
		case 8:
sl@0
  2614
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0130"));
sl@0
  2615
			iTest->LogSubTest(KTest7);
sl@0
  2616
			GeneralDrawingTestL();
sl@0
  2617
			break;
sl@0
  2618
		case 9:
sl@0
  2619
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0131"));
sl@0
  2620
			iTest->LogSubTest(KTest8);
sl@0
  2621
			DestroyWindowTestL();
sl@0
  2622
			break;
sl@0
  2623
		case 10:
sl@0
  2624
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0132"));
sl@0
  2625
			iTest->LogSubTest(KTest9);
sl@0
  2626
			SpriteAnimL();
sl@0
  2627
			break;
sl@0
  2628
		case 11:
sl@0
  2629
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0133"));
sl@0
  2630
			iTest->LogSubTest(KTest10);
sl@0
  2631
			FreeTimerL();
sl@0
  2632
			break;
sl@0
  2633
		case 12:
sl@0
  2634
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0134"));
sl@0
  2635
			iTest->LogSubTest(KTest11);
sl@0
  2636
			DisableTimerL();
sl@0
  2637
			break;
sl@0
  2638
		case 13:
sl@0
  2639
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0135"));
sl@0
  2640
			iTest->LogSubTest(KTest12);
sl@0
  2641
			MultipleAnimsL();
sl@0
  2642
			break;
sl@0
  2643
		case 14:
sl@0
  2644
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0136"));
sl@0
  2645
			iTest->LogSubTest(KTest13);
sl@0
  2646
			ClickPlugInL();
sl@0
  2647
			break;
sl@0
  2648
		case 15:
sl@0
  2649
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137"));
sl@0
  2650
			iTest->LogSubTest(KTest14);
sl@0
  2651
			WinFunctionsL();
sl@0
  2652
			break;
sl@0
  2653
		case 16:
sl@0
  2654
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0138"));
sl@0
  2655
			iTest->LogSubTest(KTest15);
sl@0
  2656
			WinFunctions2L();
sl@0
  2657
			break;
sl@0
  2658
		case 17:
sl@0
  2659
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0139"));
sl@0
  2660
			iTest->LogSubTest(KTest16);
sl@0
  2661
			TestNotificationsL();
sl@0
  2662
			break;
sl@0
  2663
		case 18:
sl@0
  2664
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137"));
sl@0
  2665
			iTest->LogSubTest(KTest17);
sl@0
  2666
			TestEventHandlerRemovalL();
sl@0
  2667
			break;
sl@0
  2668
		case 19:
sl@0
  2669
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-WSERV-0056-0001"));
sl@0
  2670
			iTest->LogSubTest(KTest18);			
sl@0
  2671
			TestLoadApiL();
sl@0
  2672
			break;
sl@0
  2673
		case 20:
sl@0
  2674
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0448"));
sl@0
  2675
			iTest->LogSubTest(KTest19);
sl@0
  2676
			KeyClickPriorityL();
sl@0
  2677
			break;
sl@0
  2678
		case 21:
sl@0
  2679
 /**
sl@0
  2680
@SYMTestCaseID		GRAPHICS-WSERV-0505
sl@0
  2681
*/
sl@0
  2682
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0505"));
sl@0
  2683
			iTest->LogSubTest(KTest20);
sl@0
  2684
			ParameterValueTestL();
sl@0
  2685
			break;
sl@0
  2686
		case 22:
sl@0
  2687
/**
sl@0
  2688
@SYMTestCaseID		GRAPHICS-WSERV-0506
sl@0
  2689
*/
sl@0
  2690
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0506"));
sl@0
  2691
			iTest->LogSubTest(KTest21);
sl@0
  2692
			TestSetIntervalL();
sl@0
  2693
		case 23:
sl@0
  2694
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0410"));
sl@0
  2695
			iTest->LogSubTest(KTest22);			
sl@0
  2696
			TestCoverageL();
sl@0
  2697
			break;
sl@0
  2698
		case 24:
sl@0
  2699
			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0411"));
sl@0
  2700
			iTest->LogSubTest(KTest23);
sl@0
  2701
			TestPanicCoverageL();
sl@0
  2702
		default:
sl@0
  2703
			((CTAnimDllStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
sl@0
  2704
			((CTAnimDllStep*)iStep)->CloseTMSGraphicsStep();
sl@0
  2705
			TestComplete();
sl@0
  2706
		}
sl@0
  2707
	User::Check();
sl@0
  2708
	((CTAnimDllStep*)iStep)->RecordTestResultL();
sl@0
  2709
	}
sl@0
  2710
sl@0
  2711
//
sl@0
  2712
sl@0
  2713
CAnimRedrawWindow::CAnimRedrawWindow(CAnimWindow *aAnimWindow, TBool aIsBase) : CTWin(),
sl@0
  2714
	iAnimWindow(aAnimWindow),
sl@0
  2715
	iIsBase(aIsBase)
sl@0
  2716
	{
sl@0
  2717
	}
sl@0
  2718
sl@0
  2719
CAnimRedrawWindow::~CAnimRedrawWindow()
sl@0
  2720
	{
sl@0
  2721
	}
sl@0
  2722
sl@0
  2723
void CAnimRedrawWindow::Draw()
sl@0
  2724
	{
sl@0
  2725
	CAnimWindow::Draw(Gc(),Size(),iIsBase,iAnimWindow->iRect,EFalse);
sl@0
  2726
	}
sl@0
  2727
sl@0
  2728
//
sl@0
  2729
sl@0
  2730
CAnimWindow::CAnimWindow(TBool aIsBase, TWinType aWinType) : iWinType(aWinType), iIsBase(aIsBase)
sl@0
  2731
	{
sl@0
  2732
	}
sl@0
  2733
sl@0
  2734
sl@0
  2735
CAnimWindow::~CAnimWindow()
sl@0
  2736
	{
sl@0
  2737
	delete iCtWin;
sl@0
  2738
	}
sl@0
  2739
sl@0
  2740
void CAnimWindow::ConstructL(const TPoint &aPos, const TSize &aSize)
sl@0
  2741
	{
sl@0
  2742
	switch(iWinType)
sl@0
  2743
		{
sl@0
  2744
		case ERedraw:
sl@0
  2745
			iCtWin=new(ELeave) CAnimRedrawWindow(this, iIsBase);
sl@0
  2746
			break;
sl@0
  2747
		case EBlank:
sl@0
  2748
			iCtWin=new(ELeave) CTBlankWindow();
sl@0
  2749
			break;
sl@0
  2750
		case EBackedUp:
sl@0
  2751
			iCtWin=new(ELeave) CTBackedUpWin(EGray4);
sl@0
  2752
			break;
sl@0
  2753
		}
sl@0
  2754
	iCtWin->SetUpL(aPos, aSize, TheClient->iGroup, *TheClient->iGc);
sl@0
  2755
	if (iWinType==ERedraw)
sl@0
  2756
		{
sl@0
  2757
		static_cast<CTWin*>(iCtWin)->Win()->EnableRedrawStore(EFalse);
sl@0
  2758
		}
sl@0
  2759
	}
sl@0
  2760
sl@0
  2761
void CAnimWindow::SetEllipseDrawMode(CGraphicsContext::TDrawMode aEllipseDrawMode)
sl@0
  2762
	{
sl@0
  2763
	iEllipseDrawMode=aEllipseDrawMode;
sl@0
  2764
	}
sl@0
  2765
sl@0
  2766
void CAnimWindow::SetRect(const TRect &aRect)
sl@0
  2767
	{
sl@0
  2768
	iRect=aRect;
sl@0
  2769
	}
sl@0
  2770
sl@0
  2771
void CAnimWindow::DrawEllipse(CBitmapContext *aGc, const TRect &aRect)
sl@0
  2772
	{
sl@0
  2773
	aGc->SetDrawMode(iEllipseDrawMode);
sl@0
  2774
	aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
sl@0
  2775
	aGc->SetBrushColor(TRgb(85,85,85));
sl@0
  2776
	aGc->SetPenColor(TRgb(170,170,170));
sl@0
  2777
	aGc->DrawEllipse(aRect);
sl@0
  2778
	}
sl@0
  2779
sl@0
  2780
void CAnimWindow::Draw(CBitmapContext *aGc, const TSize &aSize, TBool aIsBase, const TRect &aRect, TBool aBlankIt)
sl@0
  2781
	{
sl@0
  2782
	aGc->SetBrushColor(TRgb::Gray4(2));
sl@0
  2783
	aGc->Clear();
sl@0
  2784
	if (!aBlankIt)
sl@0
  2785
		for(TInt i=0;i<aSize.iWidth;i+=10)
sl@0
  2786
			aGc->DrawLine(TPoint(i,0),TPoint(i+10,aSize.iHeight));
sl@0
  2787
	if (aIsBase)
sl@0
  2788
		DrawEllipse(aGc, aRect);
sl@0
  2789
	}
sl@0
  2790
sl@0
  2791
void CAnimWindow::DoDraw(TBool aBlankIt)
sl@0
  2792
	{
sl@0
  2793
	__ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
sl@0
  2794
	iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
sl@0
  2795
	Draw(iCtWin->Gc(),Size(),iIsBase,iRect,aBlankIt);
sl@0
  2796
	iCtWin->Gc()->Deactivate();
sl@0
  2797
	}
sl@0
  2798
sl@0
  2799
void CAnimWindow::DoDrawEllipse()
sl@0
  2800
	{
sl@0
  2801
	__ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
sl@0
  2802
	iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
sl@0
  2803
	DrawEllipse(iCtWin->Gc(),iRect);
sl@0
  2804
	iCtWin->Gc()->Deactivate();
sl@0
  2805
	}
sl@0
  2806
sl@0
  2807
void CAnimWindow::DoDrawCoverage()
sl@0
  2808
	{
sl@0
  2809
	__ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
sl@0
  2810
	CWindowGc *gc = iCtWin->Gc();
sl@0
  2811
	gc->Activate(*(RDrawableWindow *)BaseWin());
sl@0
  2812
sl@0
  2813
	gc->SetClippingRect(iRect);
sl@0
  2814
	gc->Clear();
sl@0
  2815
	gc->Clear(iRect);
sl@0
  2816
sl@0
  2817
	gc->SetDrawMode(CGraphicsContext::EDrawModeAND);
sl@0
  2818
	gc->SetBrushStyle(CGraphicsContext::ENullBrush);
sl@0
  2819
	gc->SetBrushColor(TRgb::Gray256(85));
sl@0
  2820
	gc->SetBrushOrigin(TPoint(0,0));
sl@0
  2821
	gc->SetPenColor(TRgb::Gray256(170));
sl@0
  2822
sl@0
  2823
	//primitive method calls
sl@0
  2824
	gc->SetFaded(ETrue);
sl@0
  2825
	gc->SetFadingParameters(1, 1);
sl@0
  2826
sl@0
  2827
	gc->SetPenStyle(CGraphicsContext::ESolidPen);
sl@0
  2828
	gc->SetStrikethroughStyle(EStrikethroughOff);
sl@0
  2829
	gc->SetUnderlineStyle(EUnderlineOff);
sl@0
  2830
	gc->SetWordJustification(2, 1);
sl@0
  2831
sl@0
  2832
	CFbsFont* font;
sl@0
  2833
	gc->Device()->GetNearestFontInTwips((CFont*&)font, TFontSpec());
sl@0
  2834
sl@0
  2835
	gc->UseFont(font);
sl@0
  2836
	
sl@0
  2837
	gc->DrawArc(iRect,
sl@0
  2838
			TPoint(iRect.Center().iX, iRect.iTl.iY),
sl@0
  2839
			TPoint(iRect.iBr.iX, iRect.Center().iY));
sl@0
  2840
	gc->DrawLine(iRect.iTl,iRect.Center());
sl@0
  2841
	gc->DrawLineTo(TPoint(iRect.iBr.iX, iRect.iTl.iY));
sl@0
  2842
sl@0
  2843
	gc->DrawLineBy(TPoint(iRect.iTl.iX, iRect.iBr.iY));
sl@0
  2844
	gc->MoveBy(iRect.iTl + TPoint(1,1));
sl@0
  2845
	gc->MoveTo(iRect.iTl + TPoint(0,0)); 
sl@0
  2846
	gc->SetPenSize(TSize(10,10));
sl@0
  2847
	gc->Plot(iRect.iTl + TPoint(2,2));
sl@0
  2848
	gc->SetPenSize(TSize(1,1));
sl@0
  2849
sl@0
  2850
	CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
sl@0
  2851
	CleanupStack::PushL(polyPoints);
sl@0
  2852
	polyPoints->AppendL(iRect.iTl);
sl@0
  2853
	polyPoints->AppendL(iRect.Center());
sl@0
  2854
	polyPoints->AppendL(TPoint(iRect.iBr.iX, iRect.iTl.iY));
sl@0
  2855
	
sl@0
  2856
	gc->DrawPolyLine(polyPoints);
sl@0
  2857
	gc->DrawPolyLine(&polyPoints->At(0), 3);
sl@0
  2858
	gc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
sl@0
  2859
	gc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
sl@0
  2860
sl@0
  2861
	gc->DrawPie(iRect, TPoint(iRect.Center().iX, iRect.iTl.iY), TPoint(iRect.iBr.iX, iRect.Center().iY));
sl@0
  2862
	gc->DrawEllipse(iRect);
sl@0
  2863
	gc->DrawRect(iRect);
sl@0
  2864
	gc->DrawRoundRect(iRect, TSize(iRect.Width()/8, iRect.Height()/8));
sl@0
  2865
sl@0
  2866
	CleanupStack::PopAndDestroy(polyPoints);
sl@0
  2867
sl@0
  2868
	gc->CopyRect(TPoint(10, 10), iRect);
sl@0
  2869
sl@0
  2870
	CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
sl@0
  2871
	CleanupStack::PushL(bitmap);
sl@0
  2872
	User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
sl@0
  2873
sl@0
  2874
	gc->UseBrushPattern(bitmap);
sl@0
  2875
	gc->DrawBitmap(iRect.iTl, bitmap);
sl@0
  2876
	gc->DrawBitmap(iRect, bitmap);
sl@0
  2877
	gc->DrawBitmap(iRect, bitmap, TRect(0, 0, 16, 16));
sl@0
  2878
	gc->DrawBitmapMasked(iRect, bitmap, TRect(0, 0, 16, 16), bitmap, ETrue);
sl@0
  2879
sl@0
  2880
	gc->BitBlt(TPoint(0, 0), bitmap);
sl@0
  2881
	gc->BitBlt(TPoint(0, 0), bitmap, iRect);
sl@0
  2882
	gc->BitBltMasked(TPoint(0, 0), bitmap, iRect, bitmap, ETrue);
sl@0
  2883
	gc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, iRect, bitmap, TPoint(0,0));
sl@0
  2884
	
sl@0
  2885
	CleanupStack::PopAndDestroy(bitmap);
sl@0
  2886
sl@0
  2887
	_LIT(KHelloWorld,"Hello World");
sl@0
  2888
	gc->SetCharJustification(1,1);
sl@0
  2889
	gc->SetClippingRect(iRect);
sl@0
  2890
	gc->DrawText(*&KHelloWorld, iRect.iTl);
sl@0
  2891
	gc->DrawText(*&KHelloWorld, iRect, 0, CGraphicsContext::ELeft, 0);
sl@0
  2892
	gc->DrawTextVertical(*&KHelloWorld, iRect.iBr, ETrue);
sl@0
  2893
	gc->DrawTextVertical(*&KHelloWorld, iRect, 0, ETrue, CGraphicsContext::ELeft, 0);
sl@0
  2894
sl@0
  2895
	TRgb rgbs[2];
sl@0
  2896
	gc->MapColors(iRect, rgbs, 1, ETrue);
sl@0
  2897
	gc->DiscardBrushPattern();
sl@0
  2898
sl@0
  2899
	gc->DiscardFont();
sl@0
  2900
	gc->Device()->ReleaseFont(font);
sl@0
  2901
sl@0
  2902
	gc->Deactivate();
sl@0
  2903
	}
sl@0
  2904
sl@0
  2905
TSize CAnimWindow::Size()
sl@0
  2906
	{
sl@0
  2907
	return(iCtWin->Size());
sl@0
  2908
	}
sl@0
  2909
sl@0
  2910
RWindowBase *CAnimWindow::BaseWin() const
sl@0
  2911
	{
sl@0
  2912
	return(iCtWin->BaseWin());
sl@0
  2913
	}
sl@0
  2914
sl@0
  2915
CTBaseWin *CAnimWindow::CtBaseWin()
sl@0
  2916
	{
sl@0
  2917
	return(iCtWin);
sl@0
  2918
	}
sl@0
  2919
sl@0
  2920
void CAnimWindow::Invalidate()
sl@0
  2921
	{
sl@0
  2922
	CTUser::Splat(TheClient,TRect(iCtWin->Position(),iCtWin->Size()),TRgb::Gray256(0));
sl@0
  2923
	}
sl@0
  2924
sl@0
  2925
void CAnimWindow::Invalidate(const TRect &aRect)
sl@0
  2926
	{
sl@0
  2927
	TRect rect(aRect);
sl@0
  2928
	rect.Move(iCtWin->Position());
sl@0
  2929
	CTUser::Splat(TheClient,rect,TRgb::Gray256(0));
sl@0
  2930
	}
sl@0
  2931
sl@0
  2932
void CAnimWindow::DrawTestScreen(CFbsBitmap *aBitmap, CFbsBitmap *aMaskBitmap, CFbsFont *aFont)
sl@0
  2933
	{
sl@0
  2934
	iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
sl@0
  2935
	CBitmapContext *gc=iCtWin->Gc();
sl@0
  2936
	TSize size(Size());
sl@0
  2937
	TBool aExtraDrawBitMap=ETrue;
sl@0
  2938
//
sl@0
  2939
#include "DLLDRAW.H"
sl@0
  2940
//
sl@0
  2941
	iCtWin->Gc()->Deactivate();
sl@0
  2942
	}
sl@0
  2943
sl@0
  2944
sl@0
  2945
__WS_CONSTRUCT_STEP__(AnimDll)