os/graphics/windowing/windowserver/test/tauto/TAUTODLL.CPP
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/TAUTODLL.CPP	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,2945 @@
     1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +// Client side of AUTODLL test code
    1.18 +// 
    1.19 +//
    1.20 +
    1.21 +/**
    1.22 + @file
    1.23 + @test
    1.24 + @internalComponent - Internal Symbian test code
    1.25 +*/
    1.26 +
    1.27 +#include "TAUTODLL.H"
    1.28 +#include "TEVENT.H"
    1.29 +
    1.30 +//#define LOGGING
    1.31 +
    1.32 +//
    1.33 +
    1.34 +
    1.35 +CGraphicsContext::TDrawMode CAnimWindow::iEllipseDrawMode;
    1.36 +
    1.37 +CTAnimDll::CTAnimDll(CTestStep* aStep) : CTWsGraphicsBase(aStep)
    1.38 +	{
    1.39 +	}
    1.40 +
    1.41 +RTestAnim::RTestAnim() : RAnim()
    1.42 +	{
    1.43 +	}
    1.44 +
    1.45 +RTestAnim::RTestAnim(RAnimDll &aDll) : RAnim(aDll)
    1.46 +	{
    1.47 +	}
    1.48 +
    1.49 +LOCAL_C TInt DoPanicTest(TInt aInt, TAny *aScreenNumber)
    1.50 +	{
    1.51 +	RWsSession ws;
    1.52 +	User::LeaveIfError(ws.Connect());
    1.53 +
    1.54 +	// assign to the correct screen
    1.55 +	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
    1.56 +	User::LeaveIfError(screen->Construct((TInt)aScreenNumber));
    1.57 +
    1.58 +	RWindowGroup group(ws);
    1.59 +	User::LeaveIfError(group.Construct(333));
    1.60 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
    1.61 +	RAnimDll animDll=RAnimDll(ws);
    1.62 +	User::LeaveIfError(animDll.Load(KAnimDLLName));
    1.63 +	RTestAnim panic(animDll);
    1.64 +	RWindow window(ws);
    1.65 +	RBlankWindow blankwin(ws);
    1.66 +	if (aInt==16 || aInt==17)	// Use a blank window for this one
    1.67 +		{
    1.68 +		User::LeaveIfError(blankwin.Construct(group,123));
    1.69 +		blankwin.SetSize(TSize(10,10));
    1.70 +		blankwin.Activate();
    1.71 +		User::LeaveIfError(panic.Construct(blankwin,EAnimTypeTest1,TPtrC8()));
    1.72 +		}
    1.73 +	else
    1.74 +		{
    1.75 +		User::LeaveIfError(window.Construct(group,123));
    1.76 +		window.SetSize(TSize(10,10));
    1.77 +		window.Activate();
    1.78 +		window.BeginRedraw();
    1.79 +		window.EndRedraw();
    1.80 +		if (aInt==0)
    1.81 +			User::LeaveIfError(panic.Construct(window,EAnimTypeTest2,TPtrC8()));
    1.82 +		User::LeaveIfError(panic.Construct(window,EAnimTypeTest1,TPtrC8()));
    1.83 +		}
    1.84 +	TPckgBuf<TPoint> dummyParam;
    1.85 +	switch(aInt)
    1.86 +		{
    1.87 +		case 1:
    1.88 +			panic.Command(EADllPanicCallPanic);
    1.89 +			break;
    1.90 +		case 2:
    1.91 +			panic.Command(EADllPanicCallPanic,dummyParam);
    1.92 +			break;
    1.93 +		case 3:
    1.94 +			panic.CommandReply(EADllPanicCallPanic);
    1.95 +			break;
    1.96 +		case 4:
    1.97 +			panic.CommandReply(EADllPanicCallPanic,dummyParam);
    1.98 +			break;
    1.99 +		case 5:
   1.100 +			panic.Command(EADllPanicSetInterval);
   1.101 +			break;
   1.102 +		case 6:
   1.103 +			panic.Command(EADllPanicSetNextInterval);
   1.104 +			break;
   1.105 +		case 7:
   1.106 +			panic.CommandReply(EADllPanicBadFont);
   1.107 +			break;
   1.108 +		case 8:
   1.109 +			panic.CommandReply(EADllPanicBadBitmap);
   1.110 +			break;
   1.111 +		case 9:
   1.112 +			panic.Command(EADllPanicLeave);
   1.113 +			break;
   1.114 +		case 10:
   1.115 +			panic.Command(EADllPanicDoubleActivateGC);
   1.116 +			break;
   1.117 +		case 11:
   1.118 +			panic.Command(EADllPanicDrawRectWithNoGc);
   1.119 +			break;
   1.120 +		case 12:
   1.121 +			panic.Command(EADllPanicDrawTextWithNoFont);
   1.122 +			break;
   1.123 +		case 13:
   1.124 +			panic.Command(EADllPanicLeaveInAnimate);
   1.125 +			ws.Finish();
   1.126 +			panic.CommandReply(EADllBlankOpCode);
   1.127 +			break;
   1.128 +		case 14:
   1.129 +			panic.Command(EADllPanicLeaveInRedraw);
   1.130 +			window.BeginRedraw();
   1.131 +			window.EndRedraw();
   1.132 +			ws.Finish();
   1.133 +			panic.CommandReply(EADllBlankOpCode);
   1.134 +			break;
   1.135 +		case 15:
   1.136 +			ws.TestWrite(animDll.WsHandle(),999,NULL,0);
   1.137 +			break;
   1.138 +		case 16:
   1.139 +			panic.Command(EADllPanicSetVisWithGcActive);
   1.140 +			break;
   1.141 +		case 17:
   1.142 +			panic.CommandReply(EADllPanicSetVisWithGcActiveReply);
   1.143 +			break;
   1.144 +		case 18:
   1.145 +			panic.Command(EADllPanicLeaveInActiveCallback);
   1.146 +			ws.Flush();
   1.147 +			User::After(2000000);
   1.148 +			panic.CommandReply(EADllBlankOpCode);
   1.149 +			break;
   1.150 +		case 19:
   1.151 +			panic.Command(EADllPanicSetClippingRectWithNoGc);
   1.152 +			break;
   1.153 +		case 20:
   1.154 +			panic.CommandReply(EADllPanicSetClippingRegionWithNoGc);
   1.155 +			break;
   1.156 +		case 21:
   1.157 +			panic.Command(EADllPanicCancelClippingRegionWithNoGc);
   1.158 +			break;
   1.159 +		case 22:
   1.160 +			panic.Command(EADllPanicCancelClippingRectWithNoGc);
   1.161 +			break;
   1.162 +		case 23:
   1.163 +			panic.Command(EADllPanicSetDrawModeWithNoGc);
   1.164 +			break;
   1.165 +		case 24:
   1.166 +			panic.Command(EADllPanicUseFontWithNoGc);
   1.167 +			break;
   1.168 +		case 25:
   1.169 +			panic.Command(EADllPanicDiscardFontWithNoGc);
   1.170 +			break;
   1.171 +		case 26:
   1.172 +			panic.Command(EADllPanicSetUnderlineStyleWithNoGc);
   1.173 +			break;
   1.174 +		case 27:
   1.175 +			panic.Command(EADllPanicSetStrikeThoughStyleWithNoGc);
   1.176 +			break;
   1.177 +		case 28:
   1.178 +			panic.Command(EADllPanicSetWordJustificationWithNoGc);
   1.179 +			break;
   1.180 +		case 29:
   1.181 +			panic.Command(EADllPanicSetCharJustificationWithNoGc);
   1.182 +			break;
   1.183 +		case 30:
   1.184 +			panic.Command(EADllPanicSetPenColorWithNoGc);
   1.185 +			break;
   1.186 +		case 31:
   1.187 +			panic.Command(EADllPanicSetPenStyleWithNoGc);
   1.188 +			break;
   1.189 +		case 32:
   1.190 +			panic.Command(EADllPanicSetPenSizeWithNoGc);
   1.191 +			break;
   1.192 +		case 33:
   1.193 +			panic.Command(EADllPanicSetBrushColorWithNoGc);
   1.194 +			break;
   1.195 +		case 34:
   1.196 +			panic.Command(EADllPanicSetBrushStyleWithNoGc);
   1.197 +			break;
   1.198 +		case 35:
   1.199 +			panic.Command(EADllPanicSetBrushOriginWithNoGc);
   1.200 +			break;
   1.201 +		case 36:
   1.202 +			panic.Command(EADllPanicUseBrushPatterWithNoGc);
   1.203 +			break;
   1.204 +		case 37:
   1.205 +			panic.Command(EADllPanicDiscardBrushPatternWithNoGc);
   1.206 +			break;
   1.207 +		case 38:
   1.208 +			panic.Command(EADllPanicSetFadedWithNoGc);
   1.209 +			break;
   1.210 +		case 39:
   1.211 +			panic.Command(EADllPanicSetFadingParametersWithNoGc);
   1.212 +			break;
   1.213 +		case 40:
   1.214 +			panic.Command(EADllPanicDrawArcWithNoGc);
   1.215 +			break;
   1.216 +		case 41:
   1.217 +			panic.Command(EADllPanicDrawPieWithNoGc);
   1.218 +			break;
   1.219 +		case 42:
   1.220 +			panic.Command(EADllPanicDrawLineWithNoGc);
   1.221 +			break;
   1.222 +		case 43:
   1.223 +			panic.Command(EADllPanicDrawLineToWithNoGc);
   1.224 +			break;
   1.225 +		case 44:
   1.226 +			panic.Command(EADllPanicDrawLineByWithNoGc);
   1.227 +			break;
   1.228 +		case 45:
   1.229 +			panic.Command(EADllPanicDrawEllipseWithNoGc);
   1.230 +			break;
   1.231 +		case 46:
   1.232 +			panic.Command(EADllPanicDrawRoundedRecWithNoGc);
   1.233 +			break;
   1.234 +		case 47:
   1.235 +			panic.Command(EADllPanicClearWithRectWithNoGc);
   1.236 +			break;
   1.237 +		case 48:
   1.238 +			panic.Command(EADllPanicClearWithNoGc);
   1.239 +			break;
   1.240 +		case 49:
   1.241 +			panic.Command(EADllPanicBitBltWithNoGc);
   1.242 +			break;
   1.243 +		case 50:
   1.244 +			panic.Command(EADllPanicBitBltWithRectWithNoGc);
   1.245 +			break;
   1.246 +		case 51:
   1.247 +			panic.Command(EADllPanicBitBltMaskedWithNoGc);
   1.248 +			break;
   1.249 +		case 52:
   1.250 +			panic.Command(EADllPanicDrawBitmapPointWithNoGc);
   1.251 +			break;
   1.252 +		case 53:
   1.253 +			panic.Command(EADllPanicDrawBitmapWithNoGc);
   1.254 +			break;
   1.255 +		case 54:
   1.256 +			panic.Command(EADllPanicDrawBitmapRectWithNoGc);
   1.257 +			break;
   1.258 +		case 55:
   1.259 +			panic.Command(EADllPanicDrawBitmapMaskedFbsBitmapWithNoGc);
   1.260 +			break;
   1.261 +		case 56:
   1.262 +			panic.Command(EADllPanicDrawBitmapMaskedWsBitmapWithNoGc);
   1.263 +			break;
   1.264 +		case 57:
   1.265 +			panic.Command(EADllPanicDrawPolyLinePointsWithNoGc);
   1.266 +			break;
   1.267 +		case 58:
   1.268 +			panic.Command(EADllPanicDrawPolyLineArrayWithNoGc);
   1.269 +			break;
   1.270 +		case 59:
   1.271 +			panic.CommandReply(EADllPanicDrawPolygonPointsWithNoGc);
   1.272 +			break;
   1.273 +		case 60:
   1.274 +			panic.CommandReply(EADllPanicDrawPolygonArrayWithNoGc);
   1.275 +			break;
   1.276 +		case 61:
   1.277 +			panic.Command(EADllPanicMoveToWithNoGc);
   1.278 +			break;
   1.279 +		case 62:
   1.280 +			panic.Command(EADllPanicMoveByWithNoGc);
   1.281 +			break;
   1.282 +		case 63:
   1.283 +			panic.Command(EADllPanicPlotWithNoGc);
   1.284 +			break;
   1.285 +		case 64:
   1.286 +			panic.Command(EADllPanicSetOriginWithNoGc);
   1.287 +			break;
   1.288 +		case 65:
   1.289 +			panic.Command(EADllPanicCopyRectWithNoGc);
   1.290 +			break;
   1.291 +		case 66:
   1.292 +			panic.Command(EADllPanicResetWithNoGc);
   1.293 +			break;
   1.294 +		case 67:
   1.295 +			panic.CommandReply(EADllPanicAlphaBlendingBitmapsFbsBitmapWithNoGc);
   1.296 +			break;
   1.297 +		case 68:
   1.298 +			panic.Command(EADllPanicMapColorsWithNoGc);
   1.299 +			break;
   1.300 +		case 69:
   1.301 +			panic.Command(EADllPanicDrawTextWithRectWithNoFont);
   1.302 +			break;
   1.303 +		case 70:
   1.304 +			panic.Command(EADllPanicDrawTextVerticalWithNoFont);
   1.305 +			break;
   1.306 +		case 71:
   1.307 +			panic.Command(EADllPanicDrawTextVerticalWithRectWithNoFont);
   1.308 +			break;
   1.309 +		case 72:
   1.310 +			panic.CommandReply(EADllPanicDevice);
   1.311 +			break;
   1.312 +		case 73:
   1.313 +			panic.Command(EADllPanicInvalidFocusScreenTooBig);
   1.314 +			break;
   1.315 +		case 74:
   1.316 +			panic.Command(EADllPanicInvalidFocusScreenNegative);
   1.317 +			break;
   1.318 +		default:
   1.319 +			return(EWsExitReasonFinished);
   1.320 +		}
   1.321 +
   1.322 +	ws.Flush();
   1.323 +	return(EWsExitReasonBad);
   1.324 +	}
   1.325 +
   1.326 +/**
   1.327 +@SYMTestCaseID		GRAPHICS-WSERV-0125
   1.328 +
   1.329 +@SYMDEF             DEF081259
   1.330 +
   1.331 +@SYMTestCaseDesc    Panic tests
   1.332 +
   1.333 +@SYMTestPriority    High
   1.334 +
   1.335 +@SYMTestStatus      Implemented
   1.336 +
   1.337 +@SYMTestActions     The test creates an animation and animation's client threads.
   1.338 +					Each thread calls some
   1.339 +					command of the animation which is expected to panic on certain reason.
   1.340 +					The test checks that those client threads will panic returning
   1.341 +					a proper panic code. Client threads are created and tested for
   1.342 +					the following actions:
   1.343 +					1. A Command() call to an animation which executes
   1.344 +					iFunctions->Panic() method. Client thread must panic with
   1.345 +					code EWservPanicAnimDll.
   1.346 +					2. A Command() call with dummy parameter to an animation which
   1.347 +					executes iFunctions->Panic() method. Client thread must panic
   1.348 +					with code EWservPanicAnimDll.
   1.349 +					3. A CommandReply() call to an animation which executes
   1.350 +					iFunctions->Panic() method. Client thread must panic with code
   1.351 +					EWservPanicAnimDll.
   1.352 +					4. A CommandReply() call with dummy parameter to an animation
   1.353 +					which executes iFunctions->Panic() method. Client thread must
   1.354 +					panic with code EWservPanicAnimDll.
   1.355 +					5. A command that calls MAnimGeneralFunctions::SetInterval() when
   1.356 +					the synchronisation mode is not TAnimSync::ESyncNone. Client
   1.357 +					thread must panic with code EWservPanicAnimDll.
   1.358 +					6. A command that calls MAnimGeneralFunctions::SetNextInterval()
   1.359 +					when the synchronisation mode is not TAnimSync::ESyncNone. Client
   1.360 +					thread must panic with code EWservPanicAnimDll.
   1.361 +					7. A command that calls MAnimGeneralFunctions::DuplicateFontL() to
   1.362 +					duplicate undefined font. Client thread must panic with code
   1.363 +					EWservPanicFont.
   1.364 +					8. A command that calls MAnimGeneralFunctions::DuplicateBitmapL()
   1.365 +					to duplicate undefined bitmap. Client thread must panic with code
   1.366 +					EWservPanicBitmap.
   1.367 +					9. A command that calls User::Leave(KErrGeneral). Client thread
   1.368 +					must panic with code EWservPanicAnimLeave.
   1.369 +					10. A command that activates window animation's graphical context
   1.370 +					twice. Client thread must panic with code EWservPanicAnimDll.
   1.371 +					11. A command that tries to draw a rectangle while graphical
   1.372 +					context is not defined yet. Client thread must panic with code
   1.373 +					EWservPanicAnimLeave.
   1.374 +					12. A command that tries to draw a text whihout a font defined yet.
   1.375 +					Client thread must panic with code EWservPanicNoFont.
   1.376 +					13. A command that causes an animation to leave during execution
   1.377 +					of CAnim::Animate() method; and a new command call 4 seconds after
   1.378 +					that. Client thread must panic with code EWservPanicAnimLeave.
   1.379 +					14. A command that causes an animation to leave during execution
   1.380 +					of CAnim::Redraw() method. The client thread initiates it's window
   1.381 +					redraw after that. Client thread must panic with code
   1.382 +					EWservPanicAnimLeave.
   1.383 +					15. The client thread calls RWsSession::TestWrite() on animation
   1.384 +					DLL server-side handle with opcode 999. Client thread must panic with code
   1.385 +					EWservPanicOpcode.
   1.386 +					16. A command that activates graphical context and sets the
   1.387 +					window to invisible and then to visible. Client thread must panic
   1.388 +					with code EWservPanicAnimDll.
   1.389 +
   1.390 +
   1.391 +@SYMTestExpectedResults See test actions.
   1.392 +*/
   1.393 +void CTAnimDll::TestPanicsL()
   1.394 +	{
   1.395 +	TInt index=0;
   1.396 +	TBool finishTests=EFalse;
   1.397 +	do
   1.398 +		{
   1.399 +
   1.400 +
   1.401 +		TClientPanic panicCode=EWservPanicAnimDll;
   1.402 +		switch(index)
   1.403 +			{
   1.404 +			// panic the server with a KERN-4. When server fixed these this can be removed.
   1.405 +			case 19:
   1.406 +			case 20:
   1.407 +			case 22:
   1.408 +			case 24:
   1.409 +				goto bypasstest;
   1.410 +
   1.411 +			case 0:
   1.412 +			case 1:
   1.413 +			case 2:
   1.414 +			case 3:
   1.415 +			case 4:
   1.416 +			case 5:
   1.417 +			case 6:
   1.418 +			case 10:
   1.419 +			case 16:
   1.420 +			case 17:
   1.421 +			case 18:
   1.422 +			case 73:
   1.423 +			case 74:
   1.424 +				panicCode=EWservPanicAnimDll;
   1.425 +				break;
   1.426 +			case 7:
   1.427 +				panicCode=EWservPanicFont;
   1.428 +				break;
   1.429 +			case 8:
   1.430 +				panicCode=EWservPanicBitmap;
   1.431 +				break;
   1.432 +			case 12:
   1.433 +			case 69:
   1.434 +			case 70:
   1.435 +			case 71:
   1.436 +				panicCode=EWservPanicNoFont;
   1.437 +				break;
   1.438 +			case 15:
   1.439 +				panicCode=EWservPanicOpcode;
   1.440 +				break;
   1.441 +			case 9:
   1.442 +			case 11:
   1.443 +			case 13:
   1.444 +			case 14:
   1.445 +			case 72:
   1.446 +			default: // cases 19 - 68
   1.447 +				panicCode=EWservPanicAnimLeave;
   1.448 +				break;
   1.449 +			}
   1.450 +			
   1.451 +		TEST(iTest->TestWsPanicL(&DoPanicTest,panicCode,index,(TAny*)iTest->iScreenNumber,&finishTests));
   1.452 +bypasstest:
   1.453 +		if (iTest->iScreenNumber == 0)
   1.454 +			iTest->CloseAllPanicWindows();
   1.455 +		index++;
   1.456 +		} while(!finishTests);
   1.457 +	}
   1.458 +
   1.459 +void CTAnimDll::TestSyncModes(MAnimGeneralFunctions::TAnimSync aSyncMode)
   1.460 +	{
   1.461 +	RTestAnim anim=RTestAnim(iAnimDll);
   1.462 +	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
   1.463 +	CleanupClosePushL(anim);
   1.464 +
   1.465 +	TPckgBuf<TSyncTests> params;
   1.466 +	TRequestStatus status(KRequestPending);
   1.467 +	params().status=&status;
   1.468 +	params().syncMode=aSyncMode;
   1.469 +	anim.CommandReply(EADllSyncTests,params);
   1.470 +	User::WaitForRequest(status);
   1.471 +	TEST(status==KErrNone);
   1.472 +
   1.473 +	CleanupStack::PopAndDestroy(&anim);
   1.474 +	}
   1.475 +
   1.476 +void CTAnimDll::TestTimeChange()
   1.477 +	{
   1.478 +	RTestAnim anim=RTestAnim(iAnimDll);
   1.479 +	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
   1.480 +	CleanupClosePushL(anim);
   1.481 +
   1.482 +	TPckgBuf<TTimeChangeTest> params;
   1.483 +	TRequestStatus status(KRequestPending);
   1.484 +	TRequestStatus status2(KRequestPending);
   1.485 +	params().status=&status;
   1.486 +	params().status2=&status2;
   1.487 +	anim.CommandReply(EADllTimeChangedTest,params);
   1.488 +	User::WaitForRequest(status);
   1.489 +	TTime time;
   1.490 +	time.HomeTime();
   1.491 +	time+=TTimeIntervalHours(1);
   1.492 +	User::SetHomeTime(time);
   1.493 +	User::WaitForRequest(status2);
   1.494 +	time.HomeTime();
   1.495 +	time-=TTimeIntervalHours(1);
   1.496 +	User::SetHomeTime(time);
   1.497 +	TEST(status2==KErrNone);
   1.498 +
   1.499 +	CleanupStack::PopAndDestroy(&anim);
   1.500 +	}
   1.501 +
   1.502 +void CTAnimDll::ConstructL()
   1.503 +	{
   1.504 +	TheClient->iGroup->WinTreeNode()->SetOrdinalPosition(0);
   1.505 +	iRedrawWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw);
   1.506 +	iBackedUpTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBackedUp);
   1.507 +	iBlankTestWin=new(ELeave) CAnimWindow(EFalse, CAnimWindow::EBlank);
   1.508 +	iBaseWin=new(ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw);
   1.509 +
   1.510 +//
   1.511 +	TSize screenSize=TheClient->iGroup->Size();
   1.512 +	TInt winWidth=(screenSize.iWidth/3)-10;
   1.513 +	TInt winHeight=screenSize.iHeight-10;
   1.514 +	iBaseWin->ConstructL(TPoint(screenSize.iWidth/3+5,5),TSize(winWidth,winHeight));
   1.515 +	iBlankTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
   1.516 +	((RBlankWindow *)iBlankTestWin->BaseWin())->SetColor(TRgb::Gray4(2));
   1.517 +	iBackedUpTestWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
   1.518 +	iRedrawWin->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
   1.519 +//
   1.520 +	iTestWin=iRedrawWin;
   1.521 +//
   1.522 +	iAnimDll=RAnimDll(TheClient->iWs);
   1.523 +	TInt retVal = iAnimDll.Load(KAnimDLLName);
   1.524 +	TEST(retVal==KErrNone);
   1.525 +	if (retVal!=KErrNone)
   1.526 +		INFO_PRINTF3(_L("iAnimDll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
   1.527 +	}
   1.528 +
   1.529 +CTAnimDll::~CTAnimDll()
   1.530 +	{
   1.531 +	iAnimDll.Close();
   1.532 +	delete iBackedUpTestWin;
   1.533 +	delete iBlankTestWin;
   1.534 +	delete iRedrawWin;
   1.535 +	delete iBaseWin;
   1.536 +	}
   1.537 +
   1.538 +/**
   1.539 +@SYMTestCaseID		GRAPHICS-WSERV-0126
   1.540 +
   1.541 +@SYMDEF             DEF081259
   1.542 +
   1.543 +@SYMTestCaseDesc    Miscellaneous animation tests.
   1.544 +
   1.545 +@SYMTestPriority    High
   1.546 +
   1.547 +@SYMTestStatus      Implemented
   1.548 +
   1.549 +@SYMTestActions     Tests window animation's window funtions like WindowSize(),
   1.550 +					IsHidden(), SetVisible().
   1.551 +					Tests RAnimDll's constructor, Close(), Load() and copy-constructor.
   1.552 +
   1.553 +@SYMTestExpectedResults Expects window funtions and RAnimDll's methods work properly.
   1.554 +*/
   1.555 +void CTAnimDll::Misc()
   1.556 +	{
   1.557 +	RTestAnim anim=RTestAnim(iAnimDll);
   1.558 +	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
   1.559 +	CleanupClosePushL(anim);
   1.560 +
   1.561 +	TPckgBuf<TSize> params;
   1.562 +	params()=iTestWin->Size();
   1.563 +	TBool retBool = anim.CommandReply(EADllTestWindowSize,params);
   1.564 +	TEST(retBool);
   1.565 +	if (!retBool)
   1.566 +		INFO_PRINTF3(_L("anim.CommandReply(EADllTestWindowSize,params) return value - Expected: %d , Actual: %d"), ETrue, retBool);
   1.567 +	TheClient->iWs.Finish();
   1.568 +	retBool = anim.CommandReply(EADllTestSetVisible);
   1.569 +	TEST(retBool);
   1.570 +	if (!retBool)
   1.571 +		INFO_PRINTF3(_L("anim.CommandReply(EADllTestSetVisible) return value - Expected: %d , Actual: %d"), ETrue, retBool);
   1.572 +	CleanupStack::PopAndDestroy(&anim);
   1.573 +
   1.574 +	RAnimDll closeme(TheClient->iWs);
   1.575 +	closeme.Close();
   1.576 +	RAnimDll animdll(TheClient->iWs);
   1.577 +	TInt retVal = animdll.Load(KAnimDLLName);
   1.578 +	TEST(retVal==KErrNone);
   1.579 +	if (retVal!=KErrNone)
   1.580 +		INFO_PRINTF3(_L("animdll.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
   1.581 +
   1.582 +	RTestAnim anim2(animdll);
   1.583 +	anim2.Close();
   1.584 +	animdll.Close();
   1.585 +	}
   1.586 +
   1.587 +/**
   1.588 +@SYMTestCaseID		GRAPHICS-WSERV-0127
   1.589 +
   1.590 +@SYMDEF             DEF081259
   1.591 +
   1.592 +@SYMTestCaseDesc    Test animation's command call with reply
   1.593 +
   1.594 +@SYMTestPriority    High
   1.595 +
   1.596 +@SYMTestStatus      Implemented
   1.597 +
   1.598 +@SYMTestActions     Puts an array containing a sequnce of numbers into a command argument.
   1.599 +					Performs command call to server, assuming that the server-side
   1.600 +					should return a sum of the numbers in sequence.
   1.601 +
   1.602 +@SYMTestExpectedResults Checks that server returns the correct sum.
   1.603 +*/
   1.604 +void CTAnimDll::RemoteBuffer()
   1.605 +	{
   1.606 +	RTestAnim anim=RTestAnim(iAnimDll);
   1.607 +	User::LeaveIfError(anim.Construct(*iTestWin->BaseWin(),EAnimTypeTest1,TPtrC8()));
   1.608 +	CleanupClosePushL(anim);
   1.609 +
   1.610 +	TBuf<ERemoteBufSize> buf(ERemoteBufSize);
   1.611 +	TInt total=0;
   1.612 +	for (TInt8 index=0;index<ERemoteBufSize;index++)
   1.613 +		{
   1.614 +		total+=index;
   1.615 +		buf[index]=index;
   1.616 +		}
   1.617 +	TIpcArgs ipcArgs;
   1.618 +	ipcArgs.Set(KIpcSlot,&buf);
   1.619 + 	TInt retVal = anim.CommandReply(EADllReadRemoteDescriptor,KNullDesC8,ipcArgs);
   1.620 +	TEST(retVal==total);
   1.621 +	if (retVal!=total)
   1.622 +		INFO_PRINTF3(_L("anim.CommandReply(EADllReadRemoteDescriptor,KNullDesC8,ipcArgs) return value - Expected: %d , Actual: %d"), total, retVal);
   1.623 +
   1.624 +	CleanupStack::PopAndDestroy(&anim);
   1.625 +	}
   1.626 +//
   1.627 +/**
   1.628 +@SYMTestCaseID		GRAPHICS-WSERV-0128
   1.629 +
   1.630 +@SYMDEF             DEF081259
   1.631 +
   1.632 +@SYMTestCaseDesc    RAnimDll extracopy test
   1.633 +
   1.634 +@SYMTestPriority    High
   1.635 +
   1.636 +@SYMTestStatus      Implemented
   1.637 +
   1.638 +@SYMTestActions     Creates another RAnimDll instance for a dll that already has a client-side interface.
   1.639 +
   1.640 +@SYMTestExpectedResults Expects that operation completes without errors.
   1.641 +*/
   1.642 +void CTAnimDll::ExtraCopyTest()
   1.643 +	{
   1.644 +	RAnimDll extraCopy(TheClient->iWs);
   1.645 +	TInt retVal = extraCopy.Load(KAnimDLLName);
   1.646 +	TEST(retVal==KErrNone);
   1.647 +	if (retVal!=KErrNone)
   1.648 +		INFO_PRINTF3(_L("extraCopy.Load(KAnimDLLName) return value - Expected: %d , Actual: %d"), KErrNone, retVal);
   1.649 +
   1.650 +	extraCopy.Close();
   1.651 +	}
   1.652 +//
   1.653 +void CTAnimDll::SyncMode1()
   1.654 +	{
   1.655 +	TestSyncModes(MAnimGeneralFunctions::ESyncSecond);
   1.656 +	}
   1.657 +
   1.658 +void CTAnimDll::CheckWindows()
   1.659 +	{
   1.660 +	CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size()),_L("CTAnimDll::CheckWindows() failed"));
   1.661 +	}
   1.662 +
   1.663 +void CTAnimDll::InvalidatePauseAndRedraw(const TRect &aRect,TTimeIntervalMicroSeconds32 aInterval)
   1.664 +	{
   1.665 +	iTestWin->Invalidate(aRect);
   1.666 +	TheClient->iWs.Flush();
   1.667 +	User::After(aInterval);
   1.668 +	__ASSERT_DEBUG(iTestWin->iWinType==CAnimWindow::ERedraw,AutoPanic(EAutoPanicWindowType));
   1.669 +	RWindow *win=(RWindow *)iTestWin->BaseWin();
   1.670 +	win->BeginRedraw();
   1.671 +	iTestWin->DoDraw();
   1.672 +	win->EndRedraw();
   1.673 +	TheClient->iWs.Flush();
   1.674 +	}
   1.675 +
   1.676 +void CTAnimDll::RedrawAndCheckWindows(TBool aBlankIt)
   1.677 +	{
   1.678 +	if (iTestWin->iWinType==CAnimWindow::ERedraw)
   1.679 +		{
   1.680 +		RWindow *win=(RWindow *)iTestWin->BaseWin();
   1.681 +		win->BeginRedraw();
   1.682 +		iTestWin->DoDraw(aBlankIt);
   1.683 +		win->EndRedraw();
   1.684 +		}
   1.685 +	RWindow *win=(RWindow *)iBaseWin->BaseWin();
   1.686 +	win->BeginRedraw();
   1.687 +	iBaseWin->DoDraw(aBlankIt);
   1.688 +	win->EndRedraw();
   1.689 +	TheClient->WaitForRedrawsToFinish();
   1.690 +	CheckWindows();
   1.691 +	}
   1.692 +
   1.693 +/**
   1.694 +@SYMTestCaseID		GRAPHICS-WSERV-0129
   1.695 +
   1.696 +@SYMDEF             DEF081259
   1.697 +
   1.698 +@SYMTestCaseDesc    Animation drawing test
   1.699 +
   1.700 +@SYMTestPriority    High
   1.701 +
   1.702 +@SYMTestStatus      Implemented
   1.703 +
   1.704 +@SYMTestActions     Performs animation drawing ontop of redrawable window, backed-up window and blank window.
   1.705 +					Draws the same shapes using directly window graphics on an other window (base window).
   1.706 +					The following shapes are drawn:
   1.707 +					1. An animation with a small ellipse drawn in XOR mode on top of redrawable
   1.708 +					black-lined gray window.
   1.709 +					2. The same with a bigger ellipse but previously invalidating an
   1.710 +					area which intersects the old ellipse and the new ellipse.
   1.711 +					3. Runs an animation that continuously moves a rectangle and shrinks another on top of
   1.712 +					redrawable black-lined gray window and then cancels an animation.
   1.713 +					The test checks that the window will be identical with the gray base window
   1.714 +					that contains only black lines.
   1.715 +					4. An animation with a small ellipse drawn in XOR mode on top of backed-up
   1.716 +					black-lined gray window. The test also calls Invalidate() method and performs
   1.717 +					a check again to make sure that the test-window and base window are identical.
   1.718 +					5. An animation with a small ellipse drawn in XOR mode on top of the blank
   1.719 +					gray window. The test also sends commands to the animation that call windows
   1.720 +					SetVisible(EFalse) and SetVisible(ETrue) and checks that the
   1.721 +					test-window and base window are identical.
   1.722 +
   1.723 +
   1.724 +@SYMTestExpectedResults Each time performs pixelwise comparisons of animated windows
   1.725 +					and the base window expecting the windows to be identical.
   1.726 +*/
   1.727 +void CTAnimDll::DrawingTestL()
   1.728 +	{
   1.729 +	// draws a little circle on the base window using window graphics and using window animation on the test window.
   1.730 +	RTestAnim drawAnim=RTestAnim(iAnimDll);
   1.731 +//
   1.732 +	TRect rect;
   1.733 +	TPckgBuf<TRect> rectPckg;
   1.734 +	TPckgBuf<TBool> boolPckg;
   1.735 +
   1.736 +//
   1.737 +	_LIT(KLog1,"Draw Ellipse Test1");
   1.738 +	LOG_MESSAGE(KLog1);
   1.739 +	rect = TRect(10,10,50,50);
   1.740 +	CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModeXOR);
   1.741 +	iTestWin->Invalidate();
   1.742 +	iTestWin->SetRect(rect);
   1.743 +	iBaseWin->Invalidate();
   1.744 +	iBaseWin->SetRect(rect);
   1.745 +	rectPckg()=rect;
   1.746 +	User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
   1.747 +	RedrawAndCheckWindows();
   1.748 +//
   1.749 +	_LIT(KLog2,"Draw Ellipse Test2");
   1.750 +	LOG_MESSAGE(KLog2);
   1.751 +	iTestWin->Invalidate(TRect(20,20,100,40));
   1.752 +	iBaseWin->Invalidate(TRect(20,20,100,40));
   1.753 +	iBaseWin->DoDrawEllipse();	// Should clear old Ellipse (except invalid bits)
   1.754 +	rect=TRect(30,30,200,100);
   1.755 +	rectPckg()=rect;
   1.756 +	iBaseWin->SetRect(rect);
   1.757 +	iBaseWin->DoDrawEllipse();	// Should draw new Ellipse (except invalid bits)
   1.758 +	drawAnim.Command(EADllSetRect,rectPckg);
   1.759 +	RedrawAndCheckWindows();
   1.760 +	iBaseWin->DoDrawEllipse();	// Clear old ellipse
   1.761 +//
   1.762 +	_LIT(KLog3,"Window Overlap Anim Test");
   1.763 +	LOG_MESSAGE(KLog3);
   1.764 +
   1.765 +	iBaseWin->SetRect(TRect());
   1.766 +	iBaseWin->DoDraw();
   1.767 +	TheClient->iWs.Finish();
   1.768 +
   1.769 +	// create another window on top and check that animation beneath is not visible	
   1.770 +	TSize screenSize=TheClient->iGroup->Size();
   1.771 +	TInt winWidth=(screenSize.iWidth/3)-10;
   1.772 +	TInt winHeight=screenSize.iHeight-10;
   1.773 +	TSize size=iTestWin->Size();
   1.774 +	rectPckg()=TRect(size);
   1.775 +	drawAnim.Command(EADllStartAnimate,rectPckg);
   1.776 +
   1.777 +	CAnimWindow *topWindow = new (ELeave) CAnimWindow(ETrue, CAnimWindow::ERedraw);
   1.778 +	CleanupStack::PushL(topWindow);
   1.779 +	topWindow->ConstructL(TPoint(screenSize.iWidth/3*2+5,5),TSize(winWidth,winHeight));
   1.780 +	
   1.781 +	RWindow *win=(RWindow *)iTestWin->BaseWin();
   1.782 +	win->BeginRedraw();
   1.783 +	topWindow->DoDraw(EFalse);
   1.784 +	win->EndRedraw();
   1.785 +	
   1.786 +	TheClient->iWs.Flush();
   1.787 +	for(TInt i=0;i<size.iWidth/2;i+=5)
   1.788 +		InvalidatePauseAndRedraw(TRect(i,size.iHeight-i-i,i+i,size.iHeight-i),TTimeIntervalMicroSeconds32(400000));
   1.789 +
   1.790 +	TheClient->WaitForRedrawsToFinish();
   1.791 +	CheckRect(iBaseWin->CtBaseWin(),iTestWin->CtBaseWin(),TRect(iBaseWin->Size()));
   1.792 +	
   1.793 +	win->BeginRedraw(rect);
   1.794 +	drawAnim.Command(EADllCancelAnimate,rectPckg);
   1.795 +	win->EndRedraw();
   1.796 +
   1.797 +	CleanupStack::PopAndDestroy(topWindow);
   1.798 +//
   1.799 +	iTestWin->BaseWin()->SetVisible(EFalse);
   1.800 +	drawAnim.Close();
   1.801 +//
   1.802 +	_LIT(KLog4,"Draw Ellipse Test4&5");
   1.803 +	LOG_MESSAGE(KLog4);
   1.804 +	rect=TRect(20,20,50,50);
   1.805 +	iBackedUpTestWin->SetRect(rect);
   1.806 +	iBackedUpTestWin->DoDraw();
   1.807 +	iBaseWin->SetRect(rect);
   1.808 +	win->BeginRedraw();
   1.809 +	iBaseWin->DoDraw();
   1.810 +	win->EndRedraw();
   1.811 +	TheClient->iWs.Finish();
   1.812 +
   1.813 +	rectPckg()=rect;
   1.814 +	User::LeaveIfError(drawAnim.Construct(*iBackedUpTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
   1.815 +	TheClient->iWs.Finish();
   1.816 +	TheClient->WaitForRedrawsToFinish();
   1.817 +	CheckWindows();
   1.818 +	iBackedUpTestWin->Invalidate();
   1.819 +	TheClient->iWs.Flush();
   1.820 +	TheClient->WaitForRedrawsToFinish();
   1.821 +	CheckWindows();
   1.822 +	iBackedUpTestWin->BaseWin()->SetVisible(EFalse);
   1.823 +//
   1.824 +	_LIT(KLog5,"Draw Ellipse Test6&7");
   1.825 +	LOG_MESSAGE(KLog5);
   1.826 +	rect=TRect(20,20,50,50);
   1.827 +	TheClient->iWs.Flush();
   1.828 +	RWindow *winBase=(RWindow *)iBaseWin->BaseWin();
   1.829 +	winBase->BeginRedraw();
   1.830 +	iBaseWin->SetRect(rect);
   1.831 +	iBaseWin->DoDraw(ETrue);
   1.832 +	winBase->EndRedraw();
   1.833 +	rectPckg()=rect;
   1.834 +	User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
   1.835 +	TheClient->iWs.Flush();
   1.836 +	iBlankTestWin->Invalidate();
   1.837 +	TheClient->iWs.Flush();
   1.838 +	TheClient->WaitForRedrawsToFinish();
   1.839 +	CheckWindows();
   1.840 +	boolPckg()=EFalse;
   1.841 +	drawAnim.Command(EADllSetVisible,boolPckg);
   1.842 +	TheClient->iWs.Flush();
   1.843 +	boolPckg()=ETrue;
   1.844 +	drawAnim.Command(EADllSetVisible,boolPckg);
   1.845 +	TheClient->WaitForRedrawsToFinish();
   1.846 +	CheckWindows();
   1.847 +
   1.848 +//This test does functional coverage by calling code that executes each of the 
   1.849 +//server's class (CWsAnimGc) members in turn.
   1.850 +
   1.851 +
   1.852 +	_LIT(KLog6,"Draw Primitives (Coverage) Test");
   1.853 +	LOG_MESSAGE(KLog6);
   1.854 +	rect = TRect(10,10,150,150);
   1.855 +	iBaseWin->BaseWin()->SetVisible(ETrue);
   1.856 +	iBaseWin->SetRect(TRect(0,0,0,0));
   1.857 +	winBase->BeginRedraw();
   1.858 +	iBaseWin->DoDraw();
   1.859 +	iBaseWin->SetRect(rect);
   1.860 +	iBaseWin->DoDrawCoverage();
   1.861 +	winBase->EndRedraw();
   1.862 +
   1.863 +	iTestWin->BaseWin()->SetVisible(ETrue);
   1.864 +	iTestWin->SetRect(rect);
   1.865 +	win->BeginRedraw();
   1.866 +	iTestWin->DoDraw();
   1.867 +	win->EndRedraw();
   1.868 +
   1.869 +	rectPckg()=rect;
   1.870 +	User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeCoverage,rectPckg));
   1.871 +	
   1.872 +	//set font
   1.873 +	CFbsFont* font;
   1.874 +	User::LeaveIfError(TheClient->iGc->Device()->GetNearestFontToDesignHeightInTwips((CFont*&)font, TFontSpec()));
   1.875 +	TPckgBuf<TInt> fontHandle;
   1.876 +	fontHandle() = font->Handle();
   1.877 +	const TInt err = drawAnim.CommandReply(EADllSetFont, fontHandle);
   1.878 +	TheClient->iGc->Device()->ReleaseFont(font);
   1.879 +	User::LeaveIfError(err);
   1.880 +	
   1.881 +	//draw 
   1.882 +	User::LeaveIfError(drawAnim.CommandReply(EADllDrawNow));
   1.883 +
   1.884 +	TheClient->iWs.Finish();
   1.885 +	TheClient->WaitForRedrawsToFinish();
   1.886 +	CheckWindows();
   1.887 +	drawAnim.Close();
   1.888 +	}
   1.889 +
   1.890 +void CTAnimDll::ShadowDrawingTestL()
   1.891 +	{
   1.892 +// Create a blank window to cast a shadow over the animation
   1.893 +	TSize scrSize(TheClient->iScreen->SizeInPixels());
   1.894 +	CTBlankWindow *blank=new(ELeave) CTBlankWindow();
   1.895 +	CleanupStack::PushL(blank);
   1.896 +	blank->SetUpL(TPoint(0,10), TSize(scrSize.iWidth,scrSize.iHeight/3), TheClient->iGroup, *TheClient->iGc);
   1.897 +	blank->BaseWin()->SetShadowHeight(2);
   1.898 +	iBlankTestWin->BaseWin()->SetShadowHeight(0);
   1.899 +//
   1.900 +	RTestAnim drawAnim=RTestAnim(iAnimDll);
   1.901 +	TRect rect(10,scrSize.iHeight/3-20,50,scrSize.iHeight/3+40);
   1.902 +	TPckgBuf<TRect> rectPckg;
   1.903 +	rectPckg()=rect;
   1.904 +	User::LeaveIfError(drawAnim.Construct(*iBlankTestWin->BaseWin(),EAnimTypeTest3,rectPckg));
   1.905 +	drawAnim.Command(EADllSetShadowDrawMode);
   1.906 +	CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN);
   1.907 +//
   1.908 +	iBlankTestWin->Invalidate();
   1.909 +	iBlankTestWin->SetRect(rect);
   1.910 +	iBaseWin->Invalidate();
   1.911 +	iBaseWin->SetRect(rect);
   1.912 +	RedrawAndCheckWindows(ETrue);
   1.913 +//
   1.914 +	for(TInt ypos=10;ypos>0;ypos-=4)
   1.915 +		{
   1.916 +		blank->SetPos(TPoint(0,ypos));
   1.917 +		TPckgBuf<TShadowDrawTest> params;
   1.918 +		TRequestStatus status(KRequestPending);
   1.919 +		params().status=&status;
   1.920 +		drawAnim.CommandReply(EADllShadowAnimTest,params);
   1.921 +		User::WaitForRequest(status);
   1.922 +		RedrawAndCheckWindows(ETrue);
   1.923 +		}
   1.924 +//
   1.925 +	CleanupStack::PopAndDestroy(blank);	// Destroy the shadow window
   1.926 +	}
   1.927 +
   1.928 +/**
   1.929 +@SYMTestCaseID		GRAPHICS-WSERV-0130
   1.930 +
   1.931 +@SYMDEF             DEF081259
   1.932 +
   1.933 +@SYMTestCaseDesc    Complicated drawing test
   1.934 +
   1.935 +@SYMTestPriority    High
   1.936 +
   1.937 +@SYMTestStatus      Implemented
   1.938 +
   1.939 +@SYMTestActions     Performs complicated drawing both through the animation on
   1.940 +					a blank window and through direct fbs drawing on the second
   1.941 +					window.
   1.942 +
   1.943 +@SYMTestExpectedResults Expects the both windows to be are identical
   1.944 +*/
   1.945 +void CTAnimDll::GeneralDrawingTestL()
   1.946 +	{
   1.947 +	// This test has been removed as it is no longer relevant
   1.948 +	// Anims are not allowed to draw immediately to the screen
   1.949 +	}
   1.950 +
   1.951 +/**
   1.952 +@SYMTestCaseID		GRAPHICS-WSERV-0131
   1.953 +
   1.954 +@SYMDEF             DEF081259
   1.955 +
   1.956 +@SYMTestCaseDesc    Animated window destruction test
   1.957 +
   1.958 +@SYMTestPriority    High
   1.959 +
   1.960 +@SYMTestStatus      Implemented
   1.961 +
   1.962 +@SYMTestActions     Creates a window and a child window inside it, runs an animation
   1.963 +					in the child window in ESyncFlash mode, destroys windows.
   1.964 +
   1.965 +@SYMTestExpectedResults Expects the operations not to fail.
   1.966 +*/
   1.967 +void CTAnimDll::DestroyWindowTestL()
   1.968 +	{
   1.969 +	RWindow window(TheClient->iWs);
   1.970 +	User::LeaveIfError(window.Construct(*TheClient->iGroup->GroupWin(),123));
   1.971 +	CleanupClosePushL(window);
   1.972 +	window.SetSize(TSize(100,100));
   1.973 +	window.Activate();
   1.974 +	RWindow window2(TheClient->iWs);
   1.975 +	CleanupClosePushL(window2);
   1.976 +	User::LeaveIfError(window2.Construct(window,124));
   1.977 +	window2.Activate();
   1.978 +	window2.BeginRedraw();	// Validate it
   1.979 +	window2.EndRedraw();
   1.980 +//
   1.981 +	RTestAnim drawAnim;
   1.982 +	drawAnim=RTestAnim(iAnimDll);
   1.983 +	TRect rect(10,10,50,50);
   1.984 +	TPckgBuf<TRect> rectPckg;
   1.985 +	rectPckg()=rect;
   1.986 +	User::LeaveIfError(drawAnim.Construct(window2,EAnimTypeTest3,rectPckg));
   1.987 +	drawAnim.Command(EADllStartAnimate,rectPckg);
   1.988 +	CleanupStack::Pop(&window2);
   1.989 +	CleanupStack::PopAndDestroy(&window);
   1.990 +	TheClient->iWs.Flush();
   1.991 +	User::After(TTimeIntervalMicroSeconds32(2000000));
   1.992 +	window2.Close();
   1.993 +	drawAnim.Close();
   1.994 +	}
   1.995 +
   1.996 +void CTAnimDll::SetUpMember(TSpriteMember &aMember,TInt aType)
   1.997 +	{
   1.998 +	switch (aType)
   1.999 +		{
  1.1000 +	case 1:
  1.1001 +		iTest->SetUpMember(aMember);
  1.1002 +		aMember.iOffset=TPoint();
  1.1003 +		aMember.iInterval=TTimeIntervalMicroSeconds32(1);
  1.1004 +		break;
  1.1005 +	case 2:
  1.1006 +		aMember.iInvertMask=EFalse;
  1.1007 +		aMember.iDrawMode=CGraphicsContext::EDrawModeXOR;
  1.1008 +		aMember.iOffset=TPoint(1,2);
  1.1009 +		aMember.iInterval=TTimeIntervalMicroSeconds32(2);
  1.1010 +		break;
  1.1011 +	case 3:
  1.1012 +		aMember.iInvertMask=ETrue;
  1.1013 +		aMember.iDrawMode=CGraphicsContext::EDrawModeOR;
  1.1014 +		aMember.iOffset=TPoint(3,4);
  1.1015 +		aMember.iInterval=TTimeIntervalMicroSeconds32(3);
  1.1016 +		break;
  1.1017 +	default:
  1.1018 +		iTest->SetUpMember(aMember);
  1.1019 +		}
  1.1020 +	}
  1.1021 +
  1.1022 +/**
  1.1023 +@SYMTestCaseID		GRAPHICS-WSERV-0132
  1.1024 +
  1.1025 +@SYMDEF             DEF081259
  1.1026 +
  1.1027 +@SYMTestCaseDesc    Sprite animation test
  1.1028 +
  1.1029 +@SYMTestPriority    High
  1.1030 +
  1.1031 +@SYMTestStatus      Implemented
  1.1032 +
  1.1033 +@SYMTestActions     Creates a sprite with three sprite members and a sprite animation
  1.1034 +					passing the sprite to it. The test updates sprite members'
  1.1035 +					properties in various ways verifying that the properties are changing
  1.1036 +					on the server-side as well.
  1.1037 +
  1.1038 +@SYMTestExpectedResults Expects that operations above do not fail and that client-side
  1.1039 +					changes to the sprite affect server-side properly.
  1.1040 +*/
  1.1041 +#define HALF_SEC 500000
  1.1042 +void CTAnimDll::SpriteAnimL()
  1.1043 +	{
  1.1044 +	// create a sprite, add 3 members to it
  1.1045 +	RWsSprite sprite(TheClient->iWs);
  1.1046 +	iRedrawWin->BaseWin()->SetVisible(ETrue);
  1.1047 +	sprite.Construct(*iRedrawWin->CtBaseWin()->BaseWin(),TPoint(),0);
  1.1048 +	CleanupClosePushL(sprite);
  1.1049 +	CFbsBitmap* bitmap1=new(ELeave) CFbsBitmap();
  1.1050 +	CleanupStack::PushL(bitmap1);
  1.1051 +	CFbsBitmap* bitmap2=new(ELeave) CFbsBitmap();
  1.1052 +	CleanupStack::PushL(bitmap2);
  1.1053 +	CFbsBitmap* bitmap3=new(ELeave) CFbsBitmap();
  1.1054 +	CleanupStack::PushL(bitmap3);
  1.1055 +	User::LeaveIfError(bitmap1->Create(TSize(10,12),EGray4));
  1.1056 +	User::LeaveIfError(bitmap2->Create(TSize(15,17),EGray4));
  1.1057 +	User::LeaveIfError(bitmap3->Create(TSize(20,22),EGray4));
  1.1058 +	TSpriteMember member1;
  1.1059 +	TSpriteMember member2;
  1.1060 +	TSpriteMember member3;
  1.1061 +	SetUpMember(member1,1);
  1.1062 +	member1.iBitmap=bitmap1;
  1.1063 +	member1.iMaskBitmap=bitmap1;
  1.1064 +	SetUpMember(member2,2);
  1.1065 +	member2.iBitmap=bitmap2;
  1.1066 +	member2.iMaskBitmap=bitmap2;
  1.1067 +	SetUpMember(member3,3);
  1.1068 +	member3.iBitmap=bitmap3;
  1.1069 +	member3.iMaskBitmap=bitmap3;
  1.1070 +	sprite.AppendMember(member1);
  1.1071 +	sprite.AppendMember(member2);
  1.1072 +	sprite.AppendMember(member3);
  1.1073 +
  1.1074 +	// create a sprite animation for the sprite
  1.1075 +	RTestAnim spriteAnim(iAnimDll);
  1.1076 +	TPtrC8 des(NULL,0);
  1.1077 +	TPoint pos(1,2);
  1.1078 +	User::LeaveIfError(spriteAnim.Construct(sprite,EAnimTypeSprite,des));
  1.1079 +	CleanupClosePushL(spriteAnim);
  1.1080 +
  1.1081 +	// call EADllCheckMember-command to verify that sprite animation's members
  1.1082 +	// have the same properties as the sprite instance
  1.1083 +	TPckgBuf<TSpriteMemberInfo> spriteInfo;
  1.1084 +	spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
  1.1085 +	TBool retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
  1.1086 +	TEST(retBool);
  1.1087 +	if (!retBool)
  1.1088 +		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
  1.1089 +
  1.1090 +	sprite.SetPosition(pos);
  1.1091 +	spriteInfo()=TSpriteMemberInfo(pos,1,member2);
  1.1092 +	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
  1.1093 +	TEST(retBool);
  1.1094 +	if (!retBool)
  1.1095 +		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
  1.1096 +
  1.1097 +	pos.SetXY(3,4);
  1.1098 +	sprite.SetPosition(pos);
  1.1099 +	spriteInfo()=TSpriteMemberInfo(pos,2,member3);
  1.1100 +	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
  1.1101 +	TEST(retBool);
  1.1102 +	if (!retBool)
  1.1103 +		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
  1.1104 +
  1.1105 +	// call commands to change sprite members' bitmaps and update members
  1.1106 +	spriteAnim.Command(EADllDraw1);
  1.1107 +	spriteAnim.Command(EADllDraw2);
  1.1108 +	spriteAnim.Command(EADllDraw3);
  1.1109 +	TheClient->iWs.Flush();
  1.1110 +	User::After(HALF_SEC);
  1.1111 +
  1.1112 +	// call commands to change sprite's position
  1.1113 +	TPckgBuf<TPoint> position;
  1.1114 +	position().SetXY(60,50);
  1.1115 +	spriteAnim.Command(EADllSetPos,position);
  1.1116 +	TheClient->iWs.Flush();
  1.1117 +	User::After(HALF_SEC);
  1.1118 +
  1.1119 +	// change 1st member's bitmap size and interval, update it and call command to check
  1.1120 +	// that the new properties are applied
  1.1121 +	User::LeaveIfError(bitmap1->Resize(TSize(30,32)));
  1.1122 +	member1.iMaskBitmap=NULL;
  1.1123 +	member1.iInterval=TTimeIntervalMicroSeconds32(25);
  1.1124 +	User::LeaveIfError(sprite.UpdateMember(0,member1));
  1.1125 +	spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
  1.1126 +	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
  1.1127 +	TEST(retBool);
  1.1128 +	if (!retBool)
  1.1129 +		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
  1.1130 +
  1.1131 +	User::After(HALF_SEC);
  1.1132 +
  1.1133 +	// change 1st member's bitmap size and calls command that invokes
  1.1134 +	// MAnimSpriteFunctions::SizeChangedL(). Check that new property is applied
  1.1135 +	spriteAnim.CommandReply(EADllDeactivate);
  1.1136 +	User::LeaveIfError(bitmap1->Resize(TSize(35,37)));
  1.1137 +	spriteAnim.Command(EADllSizeChanged);
  1.1138 +	spriteAnim.CommandReply(EADllActivate);
  1.1139 +	spriteInfo()=TSpriteMemberInfo(TPoint(),0,member1);
  1.1140 +	retBool = spriteAnim.CommandReply(EADllCheckMember,spriteInfo);
  1.1141 +	TEST(retBool);
  1.1142 +	if (!retBool)
  1.1143 +		INFO_PRINTF3(_L("spriteAnim.CommandReply(EADllCheckMember,spriteInfo) return value - Expected: %d , Actual: %d"), ETrue, retBool);
  1.1144 +
  1.1145 +	User::After(HALF_SEC);
  1.1146 +
  1.1147 +	// call command that changes 1st member's bitmap image
  1.1148 +	spriteAnim.Command(EADllIncDraw);
  1.1149 +	TheClient->iWs.Flush();
  1.1150 +	User::After(HALF_SEC);
  1.1151 +
  1.1152 +
  1.1153 +	CleanupStack::PopAndDestroy(5,&sprite);
  1.1154 +	}
  1.1155 +
  1.1156 +/**
  1.1157 +@SYMTestCaseID		GRAPHICS-WSERV-0133
  1.1158 +
  1.1159 +@SYMDEF             DEF081259
  1.1160 +
  1.1161 +@SYMTestCaseDesc    Free timer animation test
  1.1162 +
  1.1163 +@SYMTestPriority    High
  1.1164 +
  1.1165 +@SYMTestStatus      Implemented
  1.1166 +
  1.1167 +@SYMTestActions     The test creates a free timer window animation that animates
  1.1168 +                    a shrinking filled rect which changes colour in a predefined way.
  1.1169 +
  1.1170 +@SYMTestExpectedResults The test verifies that the colour changes gets through to the the display.
  1.1171 +*/
  1.1172 +
  1.1173 +#define NOT_TIMED_OUT timeWaitingForFrame < frametime<<4
  1.1174 +void CTAnimDll::FreeTimerL()
  1.1175 +    {
  1.1176 +    RTestAnim freeTimerAnim(iAnimDll);
  1.1177 +    User::LeaveIfError(freeTimerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeFreeTimer,KNullDesC8));
  1.1178 +    CleanupClosePushL(freeTimerAnim);
  1.1179 +    
  1.1180 +    const TInt frametime = 100000;  // 100 ms
  1.1181 +    const TInt samplingtime = frametime>>1; // 50 ms
  1.1182 +    
  1.1183 +    TPckgC<TInt> frametimeBuf(frametime);
  1.1184 +    freeTimerAnim.Command(ESetFrameTime, frametimeBuf);
  1.1185 +    freeTimerAnim.Command(EStartAnimation);
  1.1186 +    TheClient->iWs.Flush();
  1.1187 +    TheClient->iWs.Finish();
  1.1188 +
  1.1189 +    TInt x = iRedrawWin->BaseWin()->AbsPosition().iX + (iRedrawWin->BaseWin()->Size().iWidth >> 1);
  1.1190 +    TInt y = iRedrawWin->BaseWin()->AbsPosition().iY + (iRedrawWin->BaseWin()->Size().iHeight >> 1);
  1.1191 +    TPoint middle(x,y);
  1.1192 +    
  1.1193 +    TRgb color = KRgbMagenta;
  1.1194 +    TBool foundRedFrame = EFalse;
  1.1195 +    TBool foundGreenFrame = EFalse;
  1.1196 +    TBool foundBlueFrame = EFalse;
  1.1197 +    TBool foundBlackFrame = EFalse;
  1.1198 +    
  1.1199 +    //The free-timer animates the colour in this predefined way.
  1.1200 +    //Test that the screen gets updated.
  1.1201 +    TInt timeWaitingForFrame = 0;
  1.1202 +    while(NOT_TIMED_OUT && !(foundRedFrame && foundGreenFrame && foundBlueFrame && foundBlackFrame)) //wait max 16*frametime=1280ms
  1.1203 +        {
  1.1204 +        //wait for the colour frame
  1.1205 +        color = PixelColour(middle);
  1.1206 +
  1.1207 +        if(color == KRgbRed)
  1.1208 +            {
  1.1209 +            foundRedFrame = ETrue;
  1.1210 +            }
  1.1211 +        else if(color == KRgbGreen)
  1.1212 +            {
  1.1213 +            foundGreenFrame = ETrue;
  1.1214 +            }
  1.1215 +        else if(color == KRgbBlue)
  1.1216 +            {
  1.1217 +            foundBlueFrame = ETrue;
  1.1218 +            }
  1.1219 +        else if(color == KRgbBlack)
  1.1220 +            {
  1.1221 +            foundBlackFrame = ETrue;
  1.1222 +            }
  1.1223 +
  1.1224 +        timeWaitingForFrame += samplingtime;
  1.1225 +        User::After(samplingtime); 
  1.1226 +        }
  1.1227 +    
  1.1228 +    TEST(foundRedFrame);
  1.1229 +    TEST(foundGreenFrame);
  1.1230 +    TEST(foundBlueFrame);
  1.1231 +    TEST(foundBlackFrame);
  1.1232 +    
  1.1233 +    freeTimerAnim.Command(EStopAnimation);  
  1.1234 +    CleanupStack::PopAndDestroy(&freeTimerAnim);
  1.1235 +    }
  1.1236 +
  1.1237 +TRgb CTAnimDll::PixelColour(const TPoint& aPoint) const
  1.1238 +    {
  1.1239 +    TRgb pixel;
  1.1240 +    TheClient->iScreen->GetPixel(pixel, aPoint);
  1.1241 +    return pixel;
  1.1242 +    }
  1.1243 +
  1.1244 +/**
  1.1245 +@SYMTestCaseID		GRAPHICS-WSERV-0134
  1.1246 +
  1.1247 +@SYMDEF             DEF081259
  1.1248 +
  1.1249 +@SYMTestCaseDesc    Animation's ESyncSecond sync-mode test
  1.1250 +
  1.1251 +@SYMTestPriority    High
  1.1252 +
  1.1253 +@SYMTestStatus      Implemented
  1.1254 +
  1.1255 +@SYMTestActions     Creates an animation in ESyncSecond sync-mode.
  1.1256 +					Checks that animation's Animate() method was called either 9, 10 or 11
  1.1257 +					times during a 10-seconds-wait.
  1.1258 +					The test also checks that if RWsSession::PrepareForSwitchOff()
  1.1259 +					is called then the Animate() method will not be called until
  1.1260 +					TRawEvent::EActive event is simulated.
  1.1261 +
  1.1262 +@SYMTestExpectedResults See actions.
  1.1263 +*/
  1.1264 +static const TInt K1Second =  1000000;
  1.1265 +static const TInt K3Seconds = 3000000;
  1.1266 +static const TInt K9Seconds = 9500000;
  1.1267 +void CTAnimDll::DisableTimerL()
  1.1268 +	{
  1.1269 +	//Defer start of timerAnim until the systen time are close to a full second
  1.1270 +	TTime now;
  1.1271 +	now.HomeTime();
  1.1272 +	TInt deferTime = K1Second - now.DateTime().MicroSecond();
  1.1273 +	User::After(deferTime);
  1.1274 +	
  1.1275 +	//Kick off timerAnim
  1.1276 +	RTestAnim timerAnim(iAnimDll);
  1.1277 +	User::LeaveIfError(timerAnim.Construct(*iRedrawWin->BaseWin(),EAnimTypeTimer,KNullDesC8));
  1.1278 +	
  1.1279 +	User::After(K9Seconds);
  1.1280 +	TInt count=timerAnim.CommandReply(EADllCurrentCount);
  1.1281 +	
  1.1282 +#if defined(LOGGING)
  1.1283 +	TLogMessageText buf;
  1.1284 +	_LIT(KLog,"Anim DisableTimer  Count=%d");
  1.1285 +	buf.Format(KLog,count);
  1.1286 +	TheClient->LogMessage(buf);
  1.1287 +#endif
  1.1288 +	
  1.1289 +	TEST(count>=9 && count<=11);
  1.1290 +	if (count != 10)
  1.1291 +		INFO_PRINTF2(_L("count>=9 && count<=11 - Expected: 9,10 or 11 , Actual: %d"), count);
  1.1292 +	
  1.1293 +#if defined(__WINS__)
  1.1294 +	TheClient->iWs.SimulateXyInputType(EXYInputNone);	//Turn off pen in case it turns on the timer
  1.1295 +#endif
  1.1296 +
  1.1297 +	// reset timer's counter and call RWsSession::PrepareForSwitchOff(),
  1.1298 +	// check that 3 seconds after the counter = 0
  1.1299 +	timerAnim.Command(EADllResetCount);
  1.1300 +	timerAnim.Command(EADllNoTimer);
  1.1301 +	TheClient->iWs.PrepareForSwitchOff();
  1.1302 +	TheClient->iWs.Flush();
  1.1303 +	User::After(K3Seconds);
  1.1304 +	count=timerAnim.CommandReply(EADllCurrentCount);
  1.1305 +#if defined(LOGGING)
  1.1306 +	buf.Format(KLog,count);
  1.1307 +	TheClient->LogMessage(buf);
  1.1308 +#endif
  1.1309 +	TEST(count==0);
  1.1310 +	if (count!=0)
  1.1311 +		INFO_PRINTF3(_L("count==0 - Expected: %d , Actual: %d"), 0,  count);
  1.1312 +
  1.1313 +
  1.1314 +	// simulates TRawEvent::EActive event,
  1.1315 +	// check that the timer didn't ticked until the event were simulated
  1.1316 +	timerAnim.Command(EADllTimerStarted);
  1.1317 +	TRawEvent event;
  1.1318 +	event.Set(TRawEvent::EActive);
  1.1319 +	TheClient->iWs.SimulateRawEvent(event);
  1.1320 +#if defined(__WINS__)
  1.1321 +	TheClient->iWs.SimulateXyInputType(EXYInputPointer);	//Turn pen on again
  1.1322 +#endif
  1.1323 +	TInt retVal = timerAnim.CommandReply(EADllFailed);
  1.1324 +	TEST(retVal==0);
  1.1325 +	if (retVal!=0)
  1.1326 +		INFO_PRINTF3(_L("timerAnim.CommandReply(EADllFailed) return value - Expected: %d , Actual: %d"), 0,  retVal);
  1.1327 +
  1.1328 +	timerAnim.Close();
  1.1329 +	}
  1.1330 +
  1.1331 +
  1.1332 +/**
  1.1333 +@SYMTestCaseID		GRAPHICS-WSERV-0135
  1.1334 +
  1.1335 +@SYMDEF             DEF081259
  1.1336 +
  1.1337 +@SYMTestCaseDesc    Multiple animations test
  1.1338 +
  1.1339 +@SYMTestPriority    High
  1.1340 +
  1.1341 +@SYMTestStatus      Implemented
  1.1342 +
  1.1343 +@SYMTestActions     Creates multiple animations for a window.
  1.1344 +
  1.1345 +@SYMTestExpectedResults The test doesn't perform any specific validations.
  1.1346 +*/
  1.1347 +void CTAnimDll::MultipleAnimsL()
  1.1348 +	{
  1.1349 +	RTestAnim anim1(iAnimDll);
  1.1350 +	RTestAnim anim2(iAnimDll);
  1.1351 +	RTestAnim anim3(iAnimDll);
  1.1352 +	RTestAnim anim4(iAnimDll);
  1.1353 +	RTestAnim anim5(iAnimDll);
  1.1354 +	RTestAnim anim6(iAnimDll);
  1.1355 +	TPtrC8 des(NULL,0);
  1.1356 +	User::LeaveIfError(anim1.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1357 +	CleanupClosePushL(anim1);
  1.1358 +	User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1359 +	CleanupClosePushL(anim2);
  1.1360 +	User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1361 +	CleanupClosePushL(anim3);
  1.1362 +	User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1363 +	CleanupClosePushL(anim4);
  1.1364 +	User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1365 +	CleanupClosePushL(anim5);
  1.1366 +	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1367 +	anim6.Close();
  1.1368 +	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1369 +	anim6.Close();
  1.1370 +	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1371 +	CleanupStack::PopAndDestroy(&anim5);
  1.1372 +	anim6.Close();
  1.1373 +	User::LeaveIfError(anim5.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1374 +	CleanupClosePushL(anim5);
  1.1375 +	User::LeaveIfError(anim6.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1376 +	CleanupStack::Pop(&anim5);
  1.1377 +	CleanupStack::PopAndDestroy(&anim4);
  1.1378 +	anim5.Close();
  1.1379 +	anim6.Close();
  1.1380 +	User::LeaveIfError(anim4.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1381 +	CleanupStack::PopAndDestroy(&anim3);
  1.1382 +	anim4.Close();
  1.1383 +	User::LeaveIfError(anim3.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1384 +	CleanupStack::PopAndDestroy(&anim2);
  1.1385 +	anim3.Close();
  1.1386 +	User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeTest3,des));
  1.1387 +	CleanupStack::PopAndDestroy(&anim1);
  1.1388 +	anim2.Close();
  1.1389 +	}
  1.1390 +
  1.1391 +/**
  1.1392 +@SYMTestCaseID		GRAPHICS-WSERV-0136
  1.1393 +
  1.1394 +@SYMDEF             DEF081259
  1.1395 +
  1.1396 +@SYMTestCaseDesc    Click plugin DLL test
  1.1397 +
  1.1398 +@SYMTestPriority    High
  1.1399 +
  1.1400 +@SYMTestStatus      Implemented
  1.1401 +
  1.1402 +@SYMTestActions     Created two handles for a click plugin dll (RSoundPlugIn instances).
  1.1403 +					Plays with Load(), Unload() methods to verify that they affect
  1.1404 +					IsLoaded() call result.
  1.1405 +					Checks that CommandReply() for different opcodes
  1.1406 +					returns RSoundPlugIn::ESoundWrongPlugIn value.
  1.1407 +					Plays with SetPenClick(), SetKeyClick() to verify that they affect
  1.1408 +					PenClickEnabled() and KeyClickEnabled() call result.
  1.1409 +
  1.1410 +
  1.1411 +@SYMTestExpectedResults The test checks that RSoundPlugIn's methods work properly
  1.1412 +					and that both handles behave identically.
  1.1413 +*/
  1.1414 +void CTAnimDll::ClickPlugInL()
  1.1415 +	{
  1.1416 +	_LIT(KDllName,"CLICK");
  1.1417 +	RWsSession ws;
  1.1418 +	User::LeaveIfError(ws.Connect());
  1.1419 +	CleanupClosePushL(ws);
  1.1420 +	TBool retBool;
  1.1421 +	TInt retVal;
  1.1422 +
  1.1423 +	// assign to the correct screen
  1.1424 +	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
  1.1425 +	CleanupStack::PushL(screen);
  1.1426 +	User::LeaveIfError(screen->Construct(iTest->iScreenNumber));
  1.1427 +
  1.1428 +	RSoundPlugIn click1(ws);
  1.1429 +	RSoundPlugIn click2(TheClient->iWs);
  1.1430 +	User::LeaveIfError(click1.Construct());
  1.1431 +	CleanupClosePushL(click1);
  1.1432 +	User::LeaveIfError(click2.Construct());
  1.1433 +	CleanupClosePushL(click2);
  1.1434 +	TBool changeable1;
  1.1435 +	TBool changeable2;
  1.1436 +	TBool loaded=click1.IsLoaded(changeable1);
  1.1437 +	//test that either both are loaded or both are not loaded
  1.1438 +	TEST(!loaded==!click2.IsLoaded(changeable2));
  1.1439 +	if (!loaded!=!click2.IsLoaded(changeable2))
  1.1440 +		INFO_PRINTF3(_L("!loaded==!click2.IsLoaded(changeable2) - Expected: %d , Actual: %d"), !loaded,  !click2.IsLoaded(changeable2));
  1.1441 +
  1.1442 +	//test that either both are changeable or both are not changeable
  1.1443 +	TEST(!changeable1==!changeable2);
  1.1444 +	if (!changeable1!=!changeable2)
  1.1445 +		INFO_PRINTF3(_L("!changeable1==!changeable2) - Expected: %d , Actual: %d"), !changeable1,  !changeable2);
  1.1446 +
  1.1447 +	if (loaded && changeable1)
  1.1448 +		{
  1.1449 +		// unload the first one
  1.1450 +		User::LeaveIfError(click1.Unload());
  1.1451 +		// check that the second is not loaded and still changeable
  1.1452 +		retBool = !click2.IsLoaded(changeable2);
  1.1453 +		TEST(retBool);
  1.1454 +		if (!retBool)
  1.1455 +			INFO_PRINTF3(_L("!click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1456 +
  1.1457 +		TEST(changeable2);
  1.1458 +		if (!changeable2)
  1.1459 +			INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue,  changeable2);
  1.1460 +
  1.1461 +
  1.1462 +		// load the first one and check that the second became loaded and is changeable
  1.1463 +		User::LeaveIfError(click1.Load(KDllName));
  1.1464 +		retBool = click2.IsLoaded(changeable2);
  1.1465 +		TEST(retBool);
  1.1466 +		if (!retBool)
  1.1467 +			INFO_PRINTF3(_L("click2.IsLoaded(changeable2) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1468 +
  1.1469 +		TEST(changeable2);
  1.1470 +		if (!changeable2)
  1.1471 +			INFO_PRINTF3(_L("changeable2 - Expected: %d , Actual: %d"), ETrue,  changeable2);
  1.1472 +
  1.1473 +		// unload the second one
  1.1474 +		User::LeaveIfError(click2.Unload());
  1.1475 +		// check that the first is not loaded and still changeable
  1.1476 +		retBool = !click1.IsLoaded(changeable1);
  1.1477 +		TEST(retBool);
  1.1478 +		if (!retBool)
  1.1479 +			INFO_PRINTF3(_L("!click1.IsLoaded(changeable1) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1480 +
  1.1481 +		TEST(changeable1);
  1.1482 +		if (!changeable1)
  1.1483 +			INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue,  changeable1);
  1.1484 +
  1.1485 +		// load the second one and check that the first one became loaded and is changeable
  1.1486 +		User::LeaveIfError(click2.Load(KDllName));
  1.1487 +		loaded=click1.IsLoaded(changeable1);
  1.1488 +		TEST(loaded);
  1.1489 +		if (!loaded)
  1.1490 +			INFO_PRINTF3(_L("loaded - Expected: %d , Actual: %d"), ETrue,  loaded);
  1.1491 +
  1.1492 +		TEST(changeable1);
  1.1493 +		if (!changeable1)
  1.1494 +			INFO_PRINTF3(_L("changeable1 - Expected: %d , Actual: %d"), ETrue,  changeable1);
  1.1495 +		}
  1.1496 +	if (loaded)
  1.1497 +		{
  1.1498 +		TPtrC8 des(NULL,0);
  1.1499 +		retVal = click1.CommandReply(0,des);
  1.1500 +		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
  1.1501 +		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
  1.1502 +			INFO_PRINTF3(_L("click1.CommandReply(0,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
  1.1503 +
  1.1504 +		retVal = click1.CommandReply(1,des);
  1.1505 +		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
  1.1506 +		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
  1.1507 +			INFO_PRINTF3(_L("click1.CommandReply(1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
  1.1508 +
  1.1509 +		retVal = click1.CommandReply(2,des);
  1.1510 +		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
  1.1511 +		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
  1.1512 +			INFO_PRINTF3(_L("click1.CommandReply(2,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
  1.1513 +
  1.1514 +		retVal = click1.CommandReply(-1,des);
  1.1515 +		TEST(RSoundPlugIn::ESoundWrongPlugIn==retVal);
  1.1516 +		if (RSoundPlugIn::ESoundWrongPlugIn!=retVal)
  1.1517 +			INFO_PRINTF3(_L("click1.CommandReply(-1,des) return value - Expected: %d , Actual: %d"), RSoundPlugIn::ESoundWrongPlugIn,  retVal);
  1.1518 +
  1.1519 +		retBool = click1.KeyClickEnabled();
  1.1520 +		TEST(retBool);
  1.1521 +		if (!retBool)
  1.1522 +			INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1523 +
  1.1524 +		retBool = click1.PenClickEnabled();
  1.1525 +		TEST(retBool);
  1.1526 +		if (!retBool)
  1.1527 +			INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1528 +
  1.1529 +		click1.SetPenClick(EFalse);
  1.1530 +		retBool = click1.KeyClickEnabled();
  1.1531 +		TEST(retBool);
  1.1532 +		if (!retBool)
  1.1533 +			INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1534 +
  1.1535 +		retBool = !click1.PenClickEnabled();
  1.1536 +		TEST(retBool);
  1.1537 +		if (!retBool)
  1.1538 +			INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1539 +
  1.1540 +		click1.SetKeyClick(EFalse);
  1.1541 +
  1.1542 +		retBool = !click1.KeyClickEnabled();
  1.1543 +		TEST(retBool);
  1.1544 +		if (!retBool)
  1.1545 +			INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1546 +
  1.1547 +		retBool = !click1.PenClickEnabled();
  1.1548 +		TEST(retBool);
  1.1549 +		if (!retBool)
  1.1550 +			INFO_PRINTF3(_L("!click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1551 +
  1.1552 +		click1.SetPenClick(ETrue);
  1.1553 +		retBool = !click1.KeyClickEnabled();
  1.1554 +		TEST(retBool);
  1.1555 +		if (!retBool)
  1.1556 +			INFO_PRINTF3(_L("!click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1557 +
  1.1558 +		retBool = click1.PenClickEnabled();
  1.1559 +		TEST(retBool);
  1.1560 +		if (!retBool)
  1.1561 +			INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1562 +
  1.1563 +		click1.SetKeyClick(ETrue);
  1.1564 +		retBool = click1.KeyClickEnabled();
  1.1565 +		TEST(retBool);
  1.1566 +		if (!retBool)
  1.1567 +			INFO_PRINTF3(_L("click1.KeyClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1568 +
  1.1569 +		retBool = click1.PenClickEnabled();
  1.1570 +		TEST(retBool);
  1.1571 +		if (!retBool)
  1.1572 +			INFO_PRINTF3(_L("click1.PenClickEnabled() return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1573 +
  1.1574 +		/*RLibrary lib;
  1.1575 +		TInt err=lib.Load(KDllName);
  1.1576 +		if (err==KErrNone)
  1.1577 +			{
  1.1578 +			TPtrC8 des(NULL,0);
  1.1579 +			TEST(lib.Type()[2].iUid==click1.CommandReply(0,des));
  1.1580 +			lib.Close();
  1.1581 +			}*/
  1.1582 +		}
  1.1583 +	CleanupStack::PopAndDestroy(4,&ws);
  1.1584 +	}
  1.1585 +
  1.1586 +void CTAnimDll::TestWindowInfo(RTestAnim& aAnim,TInt aScreen,TInt aPos,TInt aId)
  1.1587 +	{
  1.1588 +	TPckgBuf<TWindowGroupInfoParms> params;
  1.1589 +	params().iScreen=aScreen;
  1.1590 +	params().iOrdinalPosition=aPos;
  1.1591 +	TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> winGpInfo;
  1.1592 +	TIpcArgs ipcArgs;
  1.1593 +	ipcArgs.Set(KIpcSlot,&winGpInfo);
  1.1594 +	TBool retBool = aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs);
  1.1595 +	TEST(retBool);
  1.1596 +	if (!retBool)
  1.1597 +		INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1598 +
  1.1599 +	MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo& info=winGpInfo();
  1.1600 +	TEST(info.iId==aId);
  1.1601 +	if (info.iId!=aId)
  1.1602 +		INFO_PRINTF3(_L("winGpInfo() return value - Expected: %d , Actual: %d"), aId,  info.iId);
  1.1603 +
  1.1604 +	TInt retVal = TheClient->iWs.GetWindowGroupOrdinalPriority(aId);
  1.1605 +	TEST(info.iOrdinalPriority==retVal);
  1.1606 +	if (info.iOrdinalPriority!=retVal)
  1.1607 +		INFO_PRINTF3(_L("TheClient->iWs.GetWindowGroupOrdinalPriority(aId) return value - Expected: %d , Actual: %d"), info.iOrdinalPriority, retVal);
  1.1608 +
  1.1609 +	TBuf<64> windowGroupNameS;
  1.1610 +	TBuf<64> windowGroupNameA;
  1.1611 +	TheClient->iWs.GetWindowGroupNameFromIdentifier(aId,windowGroupNameS);
  1.1612 +	retVal = windowGroupNameS.Length();
  1.1613 +	TEST(info.iNameLength==retVal);
  1.1614 +	if (info.iNameLength!=retVal)
  1.1615 +		INFO_PRINTF3(_L("windowGroupNameS.Length() return value - Expected: %d , Actual: %d"), info.iNameLength, retVal);
  1.1616 +
  1.1617 +	if (info.iNameLength<64)
  1.1618 +		{
  1.1619 +		ipcArgs.Set(KIpcSlot,&windowGroupNameA);
  1.1620 +		retBool = aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs);
  1.1621 +		TEST(retBool);
  1.1622 +		if (!retBool)
  1.1623 +			INFO_PRINTF3(_L("aAnim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d , Actual: %d"), ETrue,  retBool);
  1.1624 +
  1.1625 +		if (info.iNameLength>0)
  1.1626 +			{
  1.1627 +			TEST(windowGroupNameA==windowGroupNameS);
  1.1628 +			}
  1.1629 +		else
  1.1630 +			{
  1.1631 +			TEST(windowGroupNameA.Length()==0);
  1.1632 +			if (windowGroupNameA.Length()!=0)
  1.1633 +				INFO_PRINTF3(_L("iwindowGroupNameA.Length()==0 - Expected: %d, Actual: %d"), 0, windowGroupNameA.Length());
  1.1634 +			}
  1.1635 +
  1.1636 +		}
  1.1637 +	TEST(info.iParentId>=-1);
  1.1638 +	if (info.iParentId<-1)
  1.1639 +		INFO_PRINTF3(_L("info.iParentId>=-1 - Expected: %d or greater, Actual: %d"), -1, info.iParentId);
  1.1640 +
  1.1641 +	}
  1.1642 +
  1.1643 +void CTAnimDll::TestEventHandlerRemovalL()
  1.1644 +	{
  1.1645 +	RTestAnim anim(iAnimDll);
  1.1646 +	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeEventHandler,KNullDesC8));
  1.1647 +	anim.Close();
  1.1648 +	}
  1.1649 +
  1.1650 +/**
  1.1651 +@SYMTestCaseID		GRAPHICS-WSERV-0137
  1.1652 +
  1.1653 +@SYMDEF             DEF081259
  1.1654 +
  1.1655 +@SYMTestCaseDesc    Animation's extended window functions test
  1.1656 +
  1.1657 +@SYMTestPriority    High
  1.1658 +
  1.1659 +@SYMTestStatus      Implemented
  1.1660 +
  1.1661 +@SYMTestActions     The test creates a window animation that has a couple of
  1.1662 +					commands that work with extended window functions encapsulated
  1.1663 +					into MAnimGeneralFunctionsWindowExtension class instance.
  1.1664 +					The test calls those commands to compare MAnimGeneralFunctionsWindowExtension's
  1.1665 +					methods' results with the results retuned by WSERV client classes.
  1.1666 +					MAnimGeneralFunctionsWindowExtension methods tested here:
  1.1667 +					Screens(), FocusScreens(), WindowGroups(), WindowGroupInfo(),
  1.1668 +					WindowGroupName()
  1.1669 +
  1.1670 +@SYMTestExpectedResults MAnimGeneralFunctionsWindowExtension methods must give the same results as
  1.1671 +					the corresponding WSERV client methods would.
  1.1672 +*/
  1.1673 +void CTAnimDll::WinFunctionsL()
  1.1674 +	{
  1.1675 +	RTestAnim anim(iAnimDll);
  1.1676 +	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8));
  1.1677 +	CleanupClosePushL(anim);
  1.1678 +	TInt screens=anim.CommandReply(EADllScreen);
  1.1679 +	TEST(screens>0);
  1.1680 +	if (screens<=0)
  1.1681 +		INFO_PRINTF3(_L("anim.CommandReply(EADllScreen) return value - Expected: %d or greater, Actual: %d"), 1, screens);
  1.1682 +
  1.1683 +	TInt focusScreen=anim.CommandReply(EADllFocusScreen);
  1.1684 +	TInt retVal = TheClient->iWs.GetFocusScreen();
  1.1685 +	TEST(focusScreen==retVal && focusScreen<=screens);
  1.1686 +	if (focusScreen!=retVal || focusScreen>screens)
  1.1687 +		INFO_PRINTF4(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d and less than or equal to  %d, Actual: %d"), retVal, screens, focusScreen);
  1.1688 +
  1.1689 +	TInt ii;
  1.1690 +	TPckgBuf<TInt> screen;
  1.1691 +	CArrayPtrFlat<CMinWin>* wins=new(ELeave) CArrayPtrFlat<CMinWin>(screens);
  1.1692 +	CleanupStack::PushL(wins);
  1.1693 +	// create one window on each screen
  1.1694 +	for(ii=0;ii<screens;++ii)
  1.1695 +		{
  1.1696 +		CMinWin* win=new(ELeave) CMinWin(ii);
  1.1697 +		CleanupStack::PushL(win);
  1.1698 +		win->ConstructL();
  1.1699 +		wins->AppendL(win);
  1.1700 +		}
  1.1701 +	if (screens>1)
  1.1702 +		{
  1.1703 +		for (ii=screens-1;ii>=0;--ii)
  1.1704 +			{
  1.1705 +			TheClient->iWs.SetFocusScreen(ii);
  1.1706 +			retVal = anim.CommandReply(EADllFocusScreen);
  1.1707 +			TEST(retVal==ii);
  1.1708 +			if (retVal!=ii)
  1.1709 +				INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal);
  1.1710 +			}
  1.1711 +		for (ii=screens-1;ii>=0;--ii)
  1.1712 +			{
  1.1713 +			screen()=ii;
  1.1714 +			anim.CommandReply(EADllSetFocusScreen,screen);
  1.1715 +			retVal = anim.CommandReply(EADllFocusScreen);
  1.1716 +			TEST(retVal==ii);
  1.1717 +			if (retVal!=ii)
  1.1718 +				INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), ii, retVal);
  1.1719 +			}
  1.1720 +		}
  1.1721 +	TheClient->iWs.SetFocusScreen(focusScreen);
  1.1722 +	retVal = anim.CommandReply(EADllFocusScreen);
  1.1723 +	TEST(retVal==focusScreen);
  1.1724 +	if (retVal!=focusScreen)
  1.1725 +		INFO_PRINTF3(_L("anim.CommandReply(EADllFocusScreen) return value - Expected: %d, Actual: %d"), focusScreen, retVal);
  1.1726 +
  1.1727 +	TInt winGroupsAll=0;
  1.1728 +	for(ii=0;ii<screens;++ii)
  1.1729 +		{
  1.1730 +		screen()=ii;
  1.1731 +		winGroupsAll+=anim.CommandReply(EADllWindowGroups,screen);
  1.1732 +		}
  1.1733 +	TInt winGroupsS=TheClient->iWs.NumWindowGroups();
  1.1734 +	TEST(winGroupsAll==winGroupsS);
  1.1735 +	if (winGroupsAll!=winGroupsS)
  1.1736 +		INFO_PRINTF3(_L("TheClient->iWs.NumWindowGroups() return value - Expected: %d, Actual: %d"), winGroupsS, winGroupsAll);
  1.1737 +
  1.1738 +	// the remaining test will use winGroupsA and performed on current focus screen only
  1.1739 +	screen()=iTest->iScreenNumber;
  1.1740 +	TInt winGroupsA=anim.CommandReply(EADllWindowGroups,screen);
  1.1741 +	CArrayFixFlat<TInt>* windowList=new(ELeave) CArrayFixFlat<TInt>(3);
  1.1742 +	CleanupStack::PushL(windowList);
  1.1743 +	// wserv implementation returns window groups from current focus screen, followed by the rest
  1.1744 +	TheClient->iWs.WindowGroupList(windowList);
  1.1745 +	// only interested in window group from current focus screen
  1.1746 +	for (ii=0;ii<winGroupsA;++ii)
  1.1747 +		TestWindowInfo(anim,iTest->iScreenNumber,ii,(*windowList)[ii]);
  1.1748 +	TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> winGpInfo;
  1.1749 +	TIpcArgs ipcArgs;
  1.1750 +	TPckgBuf<TWindowGroupInfoParms> params;
  1.1751 +	params().iScreen=iTest->iScreenNumber;
  1.1752 +	params().iOrdinalPosition=winGroupsA;
  1.1753 +	ipcArgs.Set(KIpcSlot,&winGpInfo);
  1.1754 +	TBuf<64> windowGroupName;
  1.1755 +	TBool retBool = !anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs);
  1.1756 +	TEST(retBool);
  1.1757 +	if (!retBool)
  1.1758 +		INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool);
  1.1759 +
  1.1760 +	ipcArgs.Set(KIpcSlot,&windowGroupName);
  1.1761 +	retBool = !anim.CommandReply(EADllWindowGroupName,params,ipcArgs);
  1.1762 +	TEST(retBool);
  1.1763 +	if (!retBool)
  1.1764 +		INFO_PRINTF3(_L("!anim.CommandReply(EADllWindowGroupName,params,ipcArgs) return value - Expected: %d, Actual: %d"), ETrue, retBool);
  1.1765 +
  1.1766 +	/*params().iOrdinalPosition=-1;		//Behaviour for negative positions not defined - but as writtin this code will pass
  1.1767 +	ipcArgs.Set(KIpcSlot,&winGpInfo);
  1.1768 +	TEST(anim.CommandReply(EADllWindowGroupInfo,params,ipcArgs));
  1.1769 +	ipcArgs.Set(KIpcSlot,&windowGroupNameA);
  1.1770 +	TEST(anim.CommandReply(EADllWindowGroupName,params,ipcArgs));*/
  1.1771 +	RWindowGroup group(TheClient->iWs);
  1.1772 +	User::LeaveIfError(group.Construct(ENullWsHandle));
  1.1773 +	CleanupClosePushL(group);
  1.1774 +	_LIT(KGroupName,"Testxyz1234");
  1.1775 +	group.SetName(KGroupName);
  1.1776 +	group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+1);
  1.1777 +	TInt groupId=group.Identifier();
  1.1778 +	TestWindowInfo(anim,iTest->iScreenNumber,0,groupId);
  1.1779 +	group.SetOrdinalPosition(0,TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[winGroupsA-1])-1);
  1.1780 +	TestWindowInfo(anim,iTest->iScreenNumber,winGroupsA,groupId);
  1.1781 +	CleanupStack::PopAndDestroy(screens+4,&anim);
  1.1782 +// Restore us back to the front
  1.1783 +	TheClient->iGroup->GroupWin()->SetOrdinalPosition(0);
  1.1784 +	}
  1.1785 +
  1.1786 +/**
  1.1787 +@SYMTestCaseID		GRAPHICS-WSERV-0138
  1.1788 +
  1.1789 +@SYMDEF             DEF081259
  1.1790 +
  1.1791 +@SYMTestCaseDesc    Animation's extended window functions test 2
  1.1792 +
  1.1793 +@SYMTestPriority    High
  1.1794 +
  1.1795 +@SYMTestStatus      Implemented
  1.1796 +
  1.1797 +@SYMTestActions     The test creates a window animation that has a command
  1.1798 +					for setting window's ordinal position and priority.
  1.1799 +					The test creates 4 window groups with the same priority and
  1.1800 +					checks that they have correct ordinal positions after the creation.
  1.1801 +					After that the test plays with updating ordinal positions and
  1.1802 +					priorities of the window groups using the animation's command.
  1.1803 +
  1.1804 +@SYMTestExpectedResults The test checks that the command was executed with no errors
  1.1805 +					and affected ordinal positions of the window groups properly.
  1.1806 +*/
  1.1807 +void CTAnimDll::WinFunctions2L()
  1.1808 +	{
  1.1809 +	RTestAnim anim(iAnimDll);
  1.1810 +	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeWindowFunctions,KNullDesC8));
  1.1811 +	CleanupClosePushL(anim);
  1.1812 +	CArrayFixFlat<TInt>* windowList=new(ELeave) CArrayFixFlat<TInt>(3);
  1.1813 +	TheClient->iWs.WindowGroupList(windowList);
  1.1814 +	TInt priority=TheClient->iWs.GetWindowGroupOrdinalPriority((*windowList)[0])+2;
  1.1815 +	delete windowList;
  1.1816 +	RWindowGroup group1(TheClient->iWs);
  1.1817 +	User::LeaveIfError(group1.Construct(ENullWsHandle));
  1.1818 +	CleanupClosePushL(group1);
  1.1819 +	group1.SetOrdinalPosition(0,priority);
  1.1820 +	RWindowGroup group2(TheClient->iWs);
  1.1821 +	User::LeaveIfError(group2.Construct(ENullWsHandle));
  1.1822 +	CleanupClosePushL(group2);
  1.1823 +	group2.SetOrdinalPosition(0,priority);
  1.1824 +	RWindowGroup group3(TheClient->iWs);
  1.1825 +	User::LeaveIfError(group3.Construct(ENullWsHandle));
  1.1826 +	CleanupClosePushL(group3);
  1.1827 +	group3.SetOrdinalPosition(0,priority);
  1.1828 +	RWindowGroup group4(TheClient->iWs);
  1.1829 +	User::LeaveIfError(group4.Construct(ENullWsHandle));
  1.1830 +	CleanupClosePushL(group4);
  1.1831 +	group4.SetOrdinalPosition(0,priority);
  1.1832 +
  1.1833 +	TInt retVal = group1.OrdinalPosition();
  1.1834 +	TEST(retVal==3);
  1.1835 +	if (retVal!=3)
  1.1836 +		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
  1.1837 +
  1.1838 +	retVal = group2.OrdinalPosition();
  1.1839 +	TEST(retVal==2);
  1.1840 +	if (retVal!=2)
  1.1841 +		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
  1.1842 +
  1.1843 +	retVal = group3.OrdinalPosition();
  1.1844 +	TEST(retVal==1);
  1.1845 +	if (retVal!=1)
  1.1846 +		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
  1.1847 +
  1.1848 +	retVal = group4.OrdinalPosition();
  1.1849 +	TEST(retVal==0);
  1.1850 +	if (retVal!=0)
  1.1851 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.1852 +
  1.1853 +	TPckgBuf<TSetOrdinalParms> params;
  1.1854 +	params().iIdentifier=group4.Identifier();
  1.1855 +	params().iOrdinalPriority=priority;
  1.1856 +	params().iOrdinalPosition=1;
  1.1857 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1858 +	TEST(retVal==KErrNone);
  1.1859 +	if (retVal!=KErrNone)
  1.1860 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1861 +
  1.1862 +	retVal = group3.OrdinalPosition();
  1.1863 +	TEST(retVal==0);
  1.1864 +	if (retVal!=0)
  1.1865 +		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.1866 +
  1.1867 +	retVal = group4.OrdinalPosition();
  1.1868 +	TEST(retVal==1);
  1.1869 +	if (retVal!=1)
  1.1870 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
  1.1871 +
  1.1872 +	params().iOrdinalPosition=2;
  1.1873 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1874 +	TEST(retVal==KErrNone);
  1.1875 +	if (retVal!=KErrNone)
  1.1876 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1877 +
  1.1878 +	retVal = group2.OrdinalPosition();
  1.1879 +	TEST(retVal==1);
  1.1880 +	if (retVal!=1)
  1.1881 +		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
  1.1882 +
  1.1883 +	retVal = group4.OrdinalPosition();
  1.1884 +	TEST(retVal==2);
  1.1885 +	if (retVal!=2)
  1.1886 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
  1.1887 +
  1.1888 +	params().iOrdinalPosition=3;
  1.1889 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1890 +	TEST(retVal==KErrNone);
  1.1891 +	if (retVal!=KErrNone)
  1.1892 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1893 +
  1.1894 +	retVal = group1.OrdinalPosition();
  1.1895 +	TEST(retVal==2);
  1.1896 +	if (retVal!=2)
  1.1897 +		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
  1.1898 +
  1.1899 +	retVal = group2.OrdinalPosition();
  1.1900 +	TEST(retVal==1);
  1.1901 +	if (retVal!=1)
  1.1902 +		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
  1.1903 +
  1.1904 +	retVal = group3.OrdinalPosition();
  1.1905 +	TEST(retVal==0);
  1.1906 +	if (retVal!=0)
  1.1907 +		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.1908 +
  1.1909 +	retVal = group4.OrdinalPosition();
  1.1910 +	TEST(retVal==3);
  1.1911 +	if (retVal!=3)
  1.1912 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
  1.1913 +
  1.1914 +	params().iOrdinalPriority=priority+1;
  1.1915 +	params().iOrdinalPosition=3;
  1.1916 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1917 +	TEST(retVal==KErrNone);
  1.1918 +	if (retVal!=KErrNone)
  1.1919 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1920 +
  1.1921 +	retVal = group4.OrdinalPosition();
  1.1922 +	TEST(retVal==0);
  1.1923 +	if (retVal!=0)
  1.1924 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.1925 +
  1.1926 +	params().iOrdinalPriority=priority;
  1.1927 +	params().iOrdinalPosition=-2;
  1.1928 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1929 +	TEST(retVal==KErrNone);
  1.1930 +	if (retVal!=KErrNone)
  1.1931 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1932 +
  1.1933 +	retVal = group4.OrdinalPosition();
  1.1934 +	TEST(retVal==3);
  1.1935 +	if (retVal!=3)
  1.1936 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
  1.1937 +
  1.1938 +	params().iOrdinalPosition=0;
  1.1939 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1940 +	TEST(retVal==KErrNone);
  1.1941 +	if (retVal!=KErrNone)
  1.1942 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1943 +
  1.1944 +	retVal = group1.OrdinalPosition();
  1.1945 +	TEST(retVal==3);
  1.1946 +	if (retVal!=3)
  1.1947 +		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
  1.1948 +
  1.1949 +	retVal = group2.OrdinalPosition();
  1.1950 +	TEST(retVal==2);
  1.1951 +	if (retVal!=2)
  1.1952 +		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
  1.1953 +
  1.1954 +	retVal = group3.OrdinalPosition();
  1.1955 +	TEST(retVal==1);
  1.1956 +	if (retVal!=1)
  1.1957 +		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
  1.1958 +
  1.1959 +	retVal = group4.OrdinalPosition();
  1.1960 +	TEST(retVal==0);
  1.1961 +	if (retVal!=0)
  1.1962 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.1963 +
  1.1964 +	params().iOrdinalPriority=priority-1;
  1.1965 +	params().iOrdinalPosition=2;
  1.1966 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1967 +	TEST(retVal==KErrNone);
  1.1968 +	if (retVal!=KErrNone)
  1.1969 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1970 +
  1.1971 +	retVal = group1.OrdinalPosition();
  1.1972 +	TEST(retVal==2);
  1.1973 +	if (retVal!=2)
  1.1974 +		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
  1.1975 +
  1.1976 +	retVal = group2.OrdinalPosition();
  1.1977 +	TEST(retVal==1);
  1.1978 +	if (retVal!=1)
  1.1979 +		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
  1.1980 +
  1.1981 +	retVal = group3.OrdinalPosition();
  1.1982 +	TEST(retVal==0);
  1.1983 +	if (retVal!=0)
  1.1984 +		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.1985 +
  1.1986 +	retVal = group4.OrdinalPosition();
  1.1987 +	TEST(retVal==0);
  1.1988 +	if (retVal!=0)
  1.1989 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.1990 +
  1.1991 +
  1.1992 +	params().iOrdinalPriority=priority;
  1.1993 +	params().iOrdinalPosition=0;
  1.1994 +	retVal = anim.CommandReply(EADllSetOrdinalPosition,params);
  1.1995 +	TEST(retVal==KErrNone);
  1.1996 +	if (retVal!=KErrNone)
  1.1997 +		INFO_PRINTF3(_L("anim.CommandReply(EADllSetOrdinalPosition,params) return value - Expected: %d, Actual: %d"), KErrNone, retVal);
  1.1998 +
  1.1999 +	retVal = group1.OrdinalPosition();
  1.2000 +	TEST(retVal==3);
  1.2001 +	if (retVal!=3)
  1.2002 +		INFO_PRINTF3(_L("group1.OrdinalPosition() return value - Expected: %d, Actual: %d"), 3, retVal);
  1.2003 +
  1.2004 +	retVal = group2.OrdinalPosition();
  1.2005 +	TEST(retVal==2);
  1.2006 +	if (retVal!=2)
  1.2007 +		INFO_PRINTF3(_L("group2.OrdinalPosition() return value - Expected: %d, Actual: %d"), 2, retVal);
  1.2008 +
  1.2009 +	retVal = group3.OrdinalPosition();
  1.2010 +	TEST(retVal==1);
  1.2011 +	if (retVal!=1)
  1.2012 +		INFO_PRINTF3(_L("group3.OrdinalPosition() return value - Expected: %d, Actual: %d"), 1, retVal);
  1.2013 +
  1.2014 +	retVal = group4.OrdinalPosition();
  1.2015 +	TEST(retVal==0);
  1.2016 +	if (retVal!=0)
  1.2017 +		INFO_PRINTF3(_L("group4.OrdinalPosition() return value - Expected: %d, Actual: %d"), 0, retVal);
  1.2018 +
  1.2019 +	CleanupStack::PopAndDestroy(5,&anim);
  1.2020 +	/*TInt pos1=group1.OrdinalPosition();
  1.2021 +	TInt pos2=group2.OrdinalPosition();
  1.2022 +	TInt pos3=group3.OrdinalPosition();
  1.2023 +	TInt pos4=group4.OrdinalPosition();*/
  1.2024 +	}
  1.2025 +
  1.2026 +
  1.2027 +/**
  1.2028 +@SYMTestCaseID		GRAPHICS-WSERV-0139
  1.2029 +
  1.2030 +@SYMDEF             DEF081259, DEF122220
  1.2031 +
  1.2032 +@SYMTestCaseDesc    Animation's notifications test
  1.2033 +
  1.2034 +@SYMTestPriority    High
  1.2035 +
  1.2036 +@SYMTestStatus      Implemented
  1.2037 +
  1.2038 +@SYMTestActions     The test works with two screens. An animation is created that keeps
  1.2039 +					track on all notifications about EDirectScreenAccess, EHeartbeatTimer,
  1.2040 +					EScreenDeviceChange events.
  1.2041 +					The test generates those events by performing operations on direct
  1.2042 +					screen access and simulating TRawEvent::EInactive and TRawEvent::EAactive
  1.2043 +					events.
  1.2044 +
  1.2045 +@SYMTestExpectedResults  The test checks that the animation didn't miss any of EDirectScreenAccess
  1.2046 +					or EHeartbeatTimer notifications. (The test doesn't check EScreenDeviceChange
  1.2047 +					notifications however).
  1.2048 +					The test also makes sure that the animation didn't animate
  1.2049 +					during inactive state.
  1.2050 +					For DEF12220, the test will crash when a untidied notifier from a previous RTestAnim object
  1.2051 +					is accessed if the fix is not present. If the fix is present, the test should not crash.
  1.2052 +*/
  1.2053 +void CTAnimDll::TestNotificationsL()
  1.2054 +	{
  1.2055 +	RTestAnim anim(iAnimDll);
  1.2056 +	User::LeaveIfError(anim.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8));
  1.2057 +	CleanupClosePushL(anim);
  1.2058 +
  1.2059 +	TPckgBuf<TInt> screenNum;
  1.2060 +
  1.2061 +	// initial state - test that we have no DSA on either screen
  1.2062 +	screenNum() = 0;
  1.2063 +	TInt dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2064 +	TEST(!dsa);
  1.2065 +	if (dsa)
  1.2066 +		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
  1.2067 +
  1.2068 +	screenNum() = 1;
  1.2069 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2070 +	TEST(!dsa);
  1.2071 +	if (dsa)
  1.2072 +		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
  1.2073 +
  1.2074 +	// create first DSA, but don't start it - test that we have no DSA on either screen
  1.2075 +	CScrollText* dsa1 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
  1.2076 +	CleanupStack::PushL(dsa1);
  1.2077 +	screenNum() = 0;
  1.2078 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2079 +	TEST(!dsa);
  1.2080 +	if (dsa)
  1.2081 +		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
  1.2082 +
  1.2083 +	screenNum() = 1;
  1.2084 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2085 +	TEST(!dsa);
  1.2086 +	if (dsa)
  1.2087 +		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
  1.2088 +
  1.2089 +	// start first DSA - test that we have DSA on this screen but not other screen
  1.2090 +	dsa1->StartL();
  1.2091 +	screenNum() = 0;
  1.2092 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2093 +	TInt retVal = (screenNum() == iTest->iScreenNumber);
  1.2094 +	TEST(dsa == retVal);
  1.2095 +	if (dsa != retVal)
  1.2096 +		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
  1.2097 +
  1.2098 +	screenNum() = 1;
  1.2099 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2100 +	retVal = (screenNum() == iTest->iScreenNumber);
  1.2101 +	TEST(dsa == retVal);
  1.2102 +	if (dsa != retVal)
  1.2103 +		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
  1.2104 +
  1.2105 +	// start second DSA
  1.2106 +	CScrollText* dsa2 = CScrollText::NewL(iTest->iScreenNumber,2,*TheClient->iGroup,5,EFalse);
  1.2107 +	CleanupStack::PushL(dsa2);
  1.2108 +	dsa2->StartL();
  1.2109 +	screenNum() = 0;
  1.2110 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2111 +	retVal = (screenNum() == iTest->iScreenNumber);
  1.2112 +	TEST(dsa == retVal);
  1.2113 +	if (dsa != retVal)
  1.2114 +		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
  1.2115 +
  1.2116 +	screenNum() = 1;
  1.2117 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2118 +	retVal = (screenNum() == iTest->iScreenNumber);
  1.2119 +	TEST(dsa == retVal);
  1.2120 +	if (dsa != retVal)
  1.2121 +		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
  1.2122 +
  1.2123 +	// stop second DSA
  1.2124 +	dsa2->Stop();
  1.2125 +	CleanupStack::PopAndDestroy(dsa2);
  1.2126 +	screenNum() = 0;
  1.2127 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2128 +	retVal = (screenNum() == iTest->iScreenNumber);
  1.2129 +	TEST(dsa == retVal);
  1.2130 +	if (dsa != retVal)
  1.2131 +		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
  1.2132 +
  1.2133 +	screenNum() = 1;
  1.2134 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2135 +	retVal = (screenNum() == iTest->iScreenNumber);
  1.2136 +	TEST(dsa == retVal);
  1.2137 +	if (dsa != retVal)
  1.2138 +		INFO_PRINTF3(_L("dsa == (screenNum() == iTest->iScreenNumber) - Expected: %d, Actual: %d"), retVal, dsa);
  1.2139 +
  1.2140 +	// stop first DSA
  1.2141 +	dsa1->Stop();
  1.2142 +	CleanupStack::PopAndDestroy(dsa1);
  1.2143 +	screenNum() = 0;
  1.2144 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2145 +	TEST(!dsa);
  1.2146 +	if (dsa)
  1.2147 +		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
  1.2148 +
  1.2149 +	screenNum() = 1;
  1.2150 +	dsa=anim.CommandReply(EADllQueryDSA, screenNum);
  1.2151 +	TEST(!dsa);
  1.2152 +	if (dsa)
  1.2153 +		INFO_PRINTF3(_L("anim.CommandReply(EADllQueryDSA, screenNum) return value - Expected: %d, Actual: %d"), 0, dsa);
  1.2154 +
  1.2155 +	// TEST heartbeat timer start\stop notifications - no longer relevant - has been removed 
  1.2156 +
  1.2157 +	CleanupStack::PopAndDestroy(&anim);
  1.2158 +	
  1.2159 +	// Create second RTestAnim for DEF12220 test
  1.2160 +	RTestAnim anim2(iAnimDll);
  1.2161 +	User::LeaveIfError(anim2.Construct(*iRedrawWin->BaseWin(),EAnimTypeNotificationTest,KNullDesC8));
  1.2162 +	CleanupClosePushL(anim2);
  1.2163 +	
  1.2164 +	// Create third dsa
  1.2165 +	CScrollText* dsa3 = CScrollText::NewL(iTest->iScreenNumber,1,*TheClient->iGroup,5,EFalse);
  1.2166 +	CleanupStack::PushL(dsa3);
  1.2167 +	// If the fix for DEF12220 is not present, starting dsa3 will cause a crash.
  1.2168 +	dsa3->StartL();
  1.2169 +	dsa3->Stop();
  1.2170 +	CleanupStack::PopAndDestroy(dsa3);
  1.2171 +	CleanupStack::PopAndDestroy(&anim2);
  1.2172 +	}
  1.2173 +
  1.2174 +/**
  1.2175 + A minimal dsa call to a window with a child window, for running coverage on
  1.2176 + ClipWindows member funcion.
  1.2177 + 
  1.2178 +@SYMTestCaseID GRAPHICS-WSERV-0410
  1.2179 +
  1.2180 +@SYMPREQ PREQ1841
  1.2181 +
  1.2182 +@SYMTestExpectedResults Nothing visible, the CWsClientWindow::ClipWindows 
  1.2183 +should be partially covered.
  1.2184 + */
  1.2185 +void CTAnimDll::TestCoverageL()
  1.2186 +	{
  1.2187 +	// create first DSA, but don't start it - test that we have no DSA on either screen
  1.2188 +	CWindowWithChild* dsa1 = CWindowWithChild::NewL(iTest->iScreenNumber, *TheClient->iGroup, EFalse);
  1.2189 +	CleanupStack::PushL(dsa1);
  1.2190 +
  1.2191 +	// start first DSA - test that we have DSA on this screen but not other screen
  1.2192 +	dsa1->StartL();
  1.2193 +	dsa1->PerformCoverageCalls();
  1.2194 +	dsa1->Stop();
  1.2195 +
  1.2196 +	// cover another trivial case for a non-visible window
  1.2197 +	RWindow* cwin = dsa1->ChildWindow();
  1.2198 +	
  1.2199 +	cwin->SetTransparencyAlphaChannel();
  1.2200 +	dsa1->ContinueL();
  1.2201 +
  1.2202 +	//ClipWindows with visible and invisible branches
  1.2203 +	cwin->SetVisible(EFalse);
  1.2204 +
  1.2205 +	//cover CWsWindow::StatusDump (visible and invisible branch)
  1.2206 +	TheClient->iWs.LogCommand(RWsSession::ELoggingStatusDump);
  1.2207 +	
  1.2208 +	dsa1->Stop();
  1.2209 +	dsa1->StartL();
  1.2210 +	cwin->SetVisible(ETrue);
  1.2211 +	dsa1->Stop();
  1.2212 +
  1.2213 +	CleanupStack::PopAndDestroy(dsa1);
  1.2214 +	}
  1.2215 +
  1.2216 +/**
  1.2217 + Executes a Panic coverage test for a given test-number.
  1.2218 + Most of the first lines copied from DoPanicTest.
  1.2219 + CWsWindow is tested through CommandL (case 0-3) and other API funcs
  1.2220 + */
  1.2221 +LOCAL_C TInt DoPanicTestCoverage(TInt aTestNum, TAny *aScreenNumber)
  1.2222 +	{
  1.2223 +	RWsSession ws;
  1.2224 +	User::LeaveIfError(ws.Connect());
  1.2225 +
  1.2226 +	// assign to the correct screen
  1.2227 +	CWsScreenDevice* screen = new (ELeave) CWsScreenDevice(ws);
  1.2228 +	User::LeaveIfError(screen->Construct(reinterpret_cast<TInt>(aScreenNumber)));
  1.2229 +
  1.2230 +	RWindowGroup group(ws);
  1.2231 +	User::LeaveIfError(group.Construct(333));
  1.2232 +	group.EnableReceiptOfFocus(EFalse);	// Stop auto group switching on close
  1.2233 +	RAnimDll animDll=RAnimDll(ws);
  1.2234 +	User::LeaveIfError(animDll.Load(KAnimDLLName));
  1.2235 +	
  1.2236 +	RWindow window(ws);
  1.2237 +	User::LeaveIfError(window.Construct(group,123));
  1.2238 +	window.SetSize(TSize(10,10));
  1.2239 +	window.Activate();
  1.2240 +	window.BeginRedraw();
  1.2241 +	window.EndRedraw();
  1.2242 +
  1.2243 +	switch (aTestNum)
  1.2244 +	{
  1.2245 +	case 0: //non translucent window
  1.2246 +		//EWsWinOpSetTransparentRegion -> EWservPanicTransparencyObjNotCreated
  1.2247 +		{
  1.2248 +		RRegion r;
  1.2249 +		window.SetTransparentRegion(r);
  1.2250 +		break;
  1.2251 +		}
  1.2252 +	case 1:
  1.2253 +		//EWsWinOpSetTransparencyPolicy -> EWservPanicTransparencyObjNotCreated
  1.2254 +		window.SetTransparencyPolicy(ETransparencyDefault);
  1.2255 +		break;
  1.2256 +	case 2:
  1.2257 +		// -> EWservPanicWindowActive
  1.2258 +		window.Activate();
  1.2259 +		break;
  1.2260 +	case 3:
  1.2261 +		// -> EWservPanicCornerParams
  1.2262 +		window.SetCornerType(EWindowCornerSquare, ECornerTypeMask);
  1.2263 +		break;
  1.2264 +	case 4:
  1.2265 +		// -> EWservPanicCornerParams
  1.2266 +		window.SetCornerType(ECornerTypeMask, 0);
  1.2267 +		break;
  1.2268 +	default:
  1.2269 +		return EWsExitReasonFinished;
  1.2270 +	}
  1.2271 +	ws.Flush();
  1.2272 +	
  1.2273 +	return(EWsExitReasonBad);	// Should never get here, but it's baaddd if it does
  1.2274 +	}
  1.2275 +
  1.2276 +/**
  1.2277 +@SYMTestCaseID GRAPHICS-WSERV-0411
  1.2278 +
  1.2279 +@SYMPREQ PREQ1841
  1.2280 +
  1.2281 +@SYMTestCaseDesc Does functional coverage for code that Panics
  1.2282 +
  1.2283 +*/
  1.2284 +void CTAnimDll::TestPanicCoverageL()
  1.2285 +	{
  1.2286 +	TClientPanic expectedPanicCode[] = 
  1.2287 +		{
  1.2288 +		EWservPanicTransparencyObjNotCreated,	//0
  1.2289 +		EWservPanicTransparencyObjNotCreated,	//1
  1.2290 +		EWservPanicWindowActive,				//2
  1.2291 +		EWservPanicCornerParams,				//3
  1.2292 +		EWservPanicCornerParams,				//4
  1.2293 +		};
  1.2294 +	for (TInt i=0; i<sizeof(expectedPanicCode)/sizeof(TClientPanic); i++)
  1.2295 +		{
  1.2296 +		TEST(iTest->TestWsPanicL(
  1.2297 +				DoPanicTestCoverage,			//aFunction
  1.2298 +				expectedPanicCode[i],			//aExitReason
  1.2299 +				i,								//aInt
  1.2300 +				(TAny*)iTest->iScreenNumber,	//aPtr
  1.2301 +				NULL)); //&finishTests			//aTestFinished
  1.2302 +		iTest->CloseAllPanicWindows();
  1.2303 +		}
  1.2304 +	}
  1.2305 +
  1.2306 +
  1.2307 +/**
  1.2308 +@SYMTestCaseID GRAPHICS-CODEBASE-WSERV-0056-0001
  1.2309 +
  1.2310 +@SYMPREQ PGM027
  1.2311 +
  1.2312 +@SYMTestCaseDesc Tests RAnimDll::Load (by passing invalid file name)
  1.2313 +
  1.2314 +@SYMTestPriority 1 
  1.2315 +
  1.2316 +@SYMTestStatus Implemented
  1.2317 +
  1.2318 +@SYMTestActions Call RAnimDll::Load() by passing invalid file name\n
  1.2319 +
  1.2320 +@SYMTestExpectedResults Should return with appropiate error message. KErrNotFound
  1.2321 + */
  1.2322 +void CTAnimDll::TestLoadApiL()	
  1.2323 +	{
  1.2324 +	RAnimDll* animDll=new(ELeave) RAnimDll(TheClient->iWs);
  1.2325 +	CleanupStack::PushL(animDll);
  1.2326 +	TInt ret=0;
  1.2327 +	_LIT(KAnimFile,"Nothing.dll");
  1.2328 +	_LIT(KEmpty,"");
  1.2329 +	ret=animDll->Load(KAnimFile);
  1.2330 +	TEST(ret==KErrNotFound);
  1.2331 +	ret=animDll->Load(KEmpty);
  1.2332 +	TEST(ret==KErrNotFound);
  1.2333 +	CleanupStack::PopAndDestroy(animDll);
  1.2334 +	}
  1.2335 +
  1.2336 +TInt CTAnimDll::CheckError(TInt aError,TInt aExpected)
  1.2337 +	{
  1.2338 +	if (aError!=0)
  1.2339 +		{
  1.2340 +		if (aError>0)
  1.2341 +			{
  1.2342 +			_LIT(KLog,"The event at position %d did not match, total number of events=%d");
  1.2343 +			LOG_MESSAGE3(KLog,aError,aExpected);
  1.2344 +			}
  1.2345 +		else
  1.2346 +			{
  1.2347 +			_LIT(KLog,"Only recieved %d events, expecting %d events");
  1.2348 +			LOG_MESSAGE3(KLog,-aError,aExpected);
  1.2349 +			}
  1.2350 +		return EFalse;
  1.2351 +		}
  1.2352 +	return ETrue;
  1.2353 +	}
  1.2354 +
  1.2355 +/**
  1.2356 +@SYMTestCaseID		GRAPHICS-WSERV-0448
  1.2357 +
  1.2358 +@SYMCR				CR1164
  1.2359 +
  1.2360 +@SYMTestCaseDesc	Test events get to Anims at a higher priorty than commands
  1.2361 +
  1.2362 +@SYMTestPriority	High
  1.2363 +
  1.2364 +@SYMTestStatus		Implemented
  1.2365 +
  1.2366 +@SYMTestActions		Create a 2nd thread that sends events via kernal, send also commands from client to an Anim
  1.2367 +
  1.2368 +@SYMTestExpectedResults	Check that events intersperse commands from client
  1.2369 +*/
  1.2370 +void CTAnimDll::KeyClickPriorityL()
  1.2371 +	{
  1.2372 +	_LIT(KFailedAdd,"Device Driver Failed to Add an Event, error=%d");
  1.2373 +	REventAnim* anim=REventAnim::NewL(iTestWin->BaseWin(),&iAnimDll);
  1.2374 +	TPckgBuf<TInt> events;
  1.2375 +	TInt err=anim->CommandReply(EADllLoadDeviceDriver);
  1.2376 +	if (err!=KErrNone)
  1.2377 +		{
  1.2378 +		_LIT(KLog,"Failed to load Device Driver for sending Events");
  1.2379 +		TEST(EFalse);
  1.2380 +		LOG_MESSAGE(KLog);
  1.2381 +		}
  1.2382 +	TInt error;
  1.2383 +	TInt ii;
  1.2384 +	for (ii=1;ii<5;++ii)
  1.2385 +		{
  1.2386 +		events()=ii;
  1.2387 +		error=anim->CommandReply(EADllSendEvent,events);
  1.2388 +		if (error!=KErrNone)
  1.2389 +			LOG_MESSAGE2(KFailedAdd,error);
  1.2390 +		anim->Command(EADllAfterEvent);
  1.2391 +		TheClient->Flush();
  1.2392 +		error=anim->TestFail(ii);
  1.2393 +		TEST(CheckError(error,ii));
  1.2394 +		}
  1.2395 +	const TInt iterations=15;
  1.2396 +	const TInt eventsPerIteration=2;
  1.2397 +	const TInt totalEvents=iterations*eventsPerIteration;
  1.2398 +	events()=eventsPerIteration;
  1.2399 +	for (ii=iterations;ii>0;--ii)
  1.2400 +		{
  1.2401 +		error=anim->CommandReply(EADllSendEvent,events);
  1.2402 +		if (error!=KErrNone)
  1.2403 +			LOG_MESSAGE2(KFailedAdd,error);
  1.2404 +		anim->Command(EADllAfterEvent);
  1.2405 +		}
  1.2406 +	TheClient->Flush();
  1.2407 +	error=anim->TestFail(totalEvents);
  1.2408 +	TEST(CheckError(error,totalEvents));
  1.2409 +	anim->CommandReply(EADllUnloadDeviceDriver);
  1.2410 +	delete anim;
  1.2411 +	}
  1.2412 +
  1.2413 +/**
  1.2414 +@SYMDEF             INC117828
  1.2415 +
  1.2416 +@SYMTestCaseDesc    Tests Window Rect returned by CWsAnim::Parameters
  1.2417 +
  1.2418 +@SYMTestPriority    High
  1.2419 +
  1.2420 +@SYMTestStatus      Implemented
  1.2421 +
  1.2422 +@SYMTestActions     This test creates a new window which overlaps the screen edge
  1.2423 +					and creates an animation on this window. An additional
  1.2424 +					CommandReplyL() option has been added to the AnimDLL to compare
  1.2425 +					the expected value of this rect with the actual value.
  1.2426 +					
  1.2427 +
  1.2428 +@SYMTestExpectedResults The result of the EADllTestParameterRect CommandReplyL call will equal ETrue
  1.2429 +						if the passed Rect matches, EFalse otherwise.
  1.2430 +*/
  1.2431 +void CTAnimDll::ParameterValueTestL()
  1.2432 +	{
  1.2433 +	//Window Location & Dimension
  1.2434 +	TPoint winOrigin(-1,15);
  1.2435 +	TSize winSize(250,65);
  1.2436 +	
  1.2437 +	//Create a new window to perform the test; window needs to overlap the left edge of the screen.
  1.2438 +	CAnimWindow* paramTestWin = new(ELeave) CAnimWindow(EFalse, CAnimWindow::ERedraw);
  1.2439 +	CleanupStack::PushL(paramTestWin);
  1.2440 +	paramTestWin->ConstructL(winOrigin, winSize);
  1.2441 +
  1.2442 +	RTestAnim anim = RTestAnim(iAnimDll);
  1.2443 +
  1.2444 +	TPckgBuf<TRect> rectPckg;
  1.2445 +	TRect winRect(winOrigin, winSize);
  1.2446 +	rectPckg() = winRect;
  1.2447 +
  1.2448 +	anim.Construct(*(paramTestWin->BaseWin()), EAnimTypeTest3, rectPckg);
  1.2449 +	anim.Command(EADllStartAnimate, rectPckg);
  1.2450 +
  1.2451 +	TPckgBuf<TBool> boolPckg;
  1.2452 +	boolPckg() = ETrue;
  1.2453 +	anim.Command(EADllSetVisible, boolPckg);
  1.2454 +
  1.2455 +	TEST(anim.CommandReply(EADllParameterRectValueTest, rectPckg));
  1.2456 +
  1.2457 +	boolPckg() = EFalse;
  1.2458 +	anim.Command(EADllSetVisible, boolPckg);
  1.2459 +	anim.Command(EADllCancelAnimate);	
  1.2460 +	anim.Close();
  1.2461 +	CleanupStack::PopAndDestroy(paramTestWin);
  1.2462 +	}
  1.2463 +
  1.2464 +/**
  1.2465 +@SYMDEF             DEF122176
  1.2466 +
  1.2467 +@SYMTestCaseDesc    Test the operation of SetInterval with both negative and positive intervals
  1.2468 +
  1.2469 +@SYMTestPriority    High
  1.2470 +
  1.2471 +@SYMTestStatus      Implemented
  1.2472 +
  1.2473 +@SYMTestActions     This test uses the test anim CAutoAnim3 in mode 3 which alternates
  1.2474 +					between drawing a large and a small ellipse at each interval.
  1.2475 +					The large ellipse is drawn first.
  1.2476 +					Note that the anims are redrawn at the rate of 2 intervals per second, so
  1.2477 +					setting an interval of 2 will mean that the anim is redrawn every second.
  1.2478 +						Step 1: The interval is set to be -2 and the test then waits for 0.9
  1.2479 +								seconds (to make sure one interval has passed) then checks that 
  1.2480 +								only the large ellipse has been drawn.							
  1.2481 +						Step 2: The interval is set to be 2 (redraw every second) and the test then 
  1.2482 +								waits for 1.2 seconds (to make sure two intervals have passed) and 
  1.2483 +								checks that the small ellipse has been drawn.
  1.2484 +					
  1.2485 +@SYMTestExpectedResults 
  1.2486 +					After Step 1 a large ellipse will be drawn on both windows.
  1.2487 +					After Step 1 a small ellipse will be drawn on both windows. 
  1.2488 +
  1.2489 +*/
  1.2490 +void CTAnimDll::TestSetIntervalL()
  1.2491 +	{
  1.2492 +	RWsSession ws;
  1.2493 +	User::LeaveIfError(ws.Connect());
  1.2494 +	
  1.2495 +	// draws a little circle on the base window using window graphics and using window animation on the test window.
  1.2496 +	RTestAnim drawAnim=RTestAnim(iAnimDll);
  1.2497 +
  1.2498 +	_LIT(KLog1,"SetInterval Test");
  1.2499 +	LOG_MESSAGE(KLog1);
  1.2500 +	TRect rect(10,10,110,110);
  1.2501 +	CAnimWindow::SetEllipseDrawMode(CGraphicsContext::EDrawModePEN);
  1.2502 +	iTestWin->Invalidate();
  1.2503 +	iTestWin->SetRect(rect);
  1.2504 +	iBaseWin->Invalidate();
  1.2505 +	iBaseWin->SetRect(rect);
  1.2506 +	TPckgBuf<TRect> rectPckg;
  1.2507 +	rectPckg()=rect;
  1.2508 +	User::LeaveIfError(drawAnim.Construct(*iTestWin->BaseWin(),EAnimTypeTest3,rectPckg));	
  1.2509 +	
  1.2510 +	TPckgBuf<TInt> intPckg;
  1.2511 +	intPckg() = 3; // mode 3 for this anim flips between drawing a large and a small ellipse
  1.2512 +	drawAnim.Command(EADllSetMode, intPckg);
  1.2513 +	
  1.2514 +	intPckg() = MAnimGeneralFunctions::ESyncNone;
  1.2515 +	drawAnim.CommandReply(EADllDoSetSync, intPckg);	
  1.2516 +	
  1.2517 +	// Set an interval of -2 then wait 0.9 seconds, after which only the large ellipse should be visible 
  1.2518 +	intPckg() = -2;
  1.2519 +	drawAnim.CommandReply(EADllSetInterval, intPckg);
  1.2520 +	// Draw the large ellipse on the base window to match what the anim should be drawing
  1.2521 +	iBaseWin->SetRect(rect);	
  1.2522 +	iBaseWin->DoDraw();
  1.2523 +	ws.Finish();	
  1.2524 +	// Check Step 1 completed successfully
  1.2525 +	RedrawAndCheckWindows();	
  1.2526 +	
  1.2527 +	// Set an interval of 2 and wait 0.9 seconds, after which the small ellipse should be visible	
  1.2528 +	intPckg() = 2;
  1.2529 +	drawAnim.CommandReply(EADllSetInterval, intPckg);
  1.2530 +	// Draw the small ellipse on the base window to match what the anim should be drawing
  1.2531 +	iBaseWin->SetRect(TRect(40,40,80,80));	
  1.2532 +	iBaseWin->DoDraw();	
  1.2533 +	ws.Finish();
  1.2534 +	// Check Step 2 completed successfully
  1.2535 +	RedrawAndCheckWindows();		
  1.2536 +
  1.2537 +	// clean up
  1.2538 +	drawAnim.Close();
  1.2539 +	ws.Close();
  1.2540 +	}
  1.2541 +
  1.2542 +void CTAnimDll::RunTestCaseL(TInt /*aCurTestCase*/)
  1.2543 +	{
  1.2544 +	_LIT(KTest0,"RemoteBuffer");
  1.2545 +	_LIT(KTest1,"ExtraCopyTest");
  1.2546 +	_LIT(KTest2,"Misc");
  1.2547 +	_LIT(KTest3,"SyncMode1");
  1.2548 +	_LIT(KTest4,"Anim Dll Panics");
  1.2549 +	_LIT(KTest5,"Drawing test");
  1.2550 +	_LIT(KTest6,"Shadow drawing test");
  1.2551 +	_LIT(KTest7,"General drawing test");
  1.2552 +	_LIT(KTest8,"Destroy window test");
  1.2553 +	_LIT(KTest9,"Sprite Anim test");
  1.2554 +	_LIT(KTest10,"Free Timer test");
  1.2555 +	_LIT(KTest11,"Disable Timer test");
  1.2556 +	_LIT(KTest12,"Multiple Anims");
  1.2557 +	_LIT(KTest13,"ReLoad Click PlugIn");
  1.2558 +	_LIT(KTest14,"Window Functions");
  1.2559 +	_LIT(KTest15,"Window Functions 2");
  1.2560 +	_LIT(KTest16,"Notifications");
  1.2561 +	_LIT(KTest17,"Event Handler removal");
  1.2562 +	_LIT(KTest18,"Anim dll - Load Api Negative Test");
  1.2563 +	_LIT(KTest19,"Key Click Priority Test");
  1.2564 +	_LIT(KTest20,"CWsAnim::Parameters() WindowRect Value Test");
  1.2565 +	_LIT(KTest21,"SetInterval test");
  1.2566 +	_LIT(KTest22,"Client Window Coverage");
  1.2567 +	_LIT(KTest23,"Client Window Panic Coverage");
  1.2568 +	((CTAnimDllStep*)iStep)->SetTestStepID(KUnknownSYMTestCaseIDName);
  1.2569 +
  1.2570 +//	if (iTest->iState==0) iTest->iState=22;	//Use this line to start running tests from a particular test
  1.2571 +	switch(++iTest->iState)
  1.2572 +		{
  1.2573 +		case 1:
  1.2574 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0127"));
  1.2575 +			iTest->LogSubTest(KTest0);
  1.2576 +			RemoteBuffer();
  1.2577 +			break;
  1.2578 +		case 2:
  1.2579 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0128"));
  1.2580 +			iTest->LogSubTest(KTest1);
  1.2581 +			ExtraCopyTest();
  1.2582 +			break;
  1.2583 +		case 3:
  1.2584 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0126"));
  1.2585 +			iTest->LogSubTest(KTest2);
  1.2586 +			Misc();
  1.2587 +			break;
  1.2588 +		case 4:
  1.2589 +/**
  1.2590 +@SYMTestCaseID		GRAPHICS-WSERV-0503
  1.2591 +*/
  1.2592 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0503"));
  1.2593 +			iTest->LogSubTest(KTest3);
  1.2594 +// Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue
  1.2595 +			break;
  1.2596 +		case 5:
  1.2597 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0125"));
  1.2598 +			iTest->LogSubTest(KTest4);
  1.2599 +			TestPanicsL();
  1.2600 +			if (iTest->iScreenNumber == 1)
  1.2601 +				iTest->CloseAllPanicWindows();
  1.2602 +			break;
  1.2603 +		case 6:
  1.2604 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0129"));
  1.2605 +			iTest->LogSubTest(KTest5);
  1.2606 +			DrawingTestL();
  1.2607 +			break;
  1.2608 +		case 7:
  1.2609 +/**
  1.2610 +@SYMTestCaseID		GRAPHICS-WSERV-0504
  1.2611 +*/
  1.2612 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0504"));
  1.2613 +			iTest->LogSubTest(KTest6);
  1.2614 +// Disabled temporarily (process isolation/ RThread::RequestComplete issue) to allow WSERV test to continue
  1.2615 +			break;
  1.2616 +		case 8:
  1.2617 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0130"));
  1.2618 +			iTest->LogSubTest(KTest7);
  1.2619 +			GeneralDrawingTestL();
  1.2620 +			break;
  1.2621 +		case 9:
  1.2622 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0131"));
  1.2623 +			iTest->LogSubTest(KTest8);
  1.2624 +			DestroyWindowTestL();
  1.2625 +			break;
  1.2626 +		case 10:
  1.2627 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0132"));
  1.2628 +			iTest->LogSubTest(KTest9);
  1.2629 +			SpriteAnimL();
  1.2630 +			break;
  1.2631 +		case 11:
  1.2632 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0133"));
  1.2633 +			iTest->LogSubTest(KTest10);
  1.2634 +			FreeTimerL();
  1.2635 +			break;
  1.2636 +		case 12:
  1.2637 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0134"));
  1.2638 +			iTest->LogSubTest(KTest11);
  1.2639 +			DisableTimerL();
  1.2640 +			break;
  1.2641 +		case 13:
  1.2642 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0135"));
  1.2643 +			iTest->LogSubTest(KTest12);
  1.2644 +			MultipleAnimsL();
  1.2645 +			break;
  1.2646 +		case 14:
  1.2647 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0136"));
  1.2648 +			iTest->LogSubTest(KTest13);
  1.2649 +			ClickPlugInL();
  1.2650 +			break;
  1.2651 +		case 15:
  1.2652 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137"));
  1.2653 +			iTest->LogSubTest(KTest14);
  1.2654 +			WinFunctionsL();
  1.2655 +			break;
  1.2656 +		case 16:
  1.2657 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0138"));
  1.2658 +			iTest->LogSubTest(KTest15);
  1.2659 +			WinFunctions2L();
  1.2660 +			break;
  1.2661 +		case 17:
  1.2662 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0139"));
  1.2663 +			iTest->LogSubTest(KTest16);
  1.2664 +			TestNotificationsL();
  1.2665 +			break;
  1.2666 +		case 18:
  1.2667 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0137"));
  1.2668 +			iTest->LogSubTest(KTest17);
  1.2669 +			TestEventHandlerRemovalL();
  1.2670 +			break;
  1.2671 +		case 19:
  1.2672 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-CODEBASE-WSERV-0056-0001"));
  1.2673 +			iTest->LogSubTest(KTest18);			
  1.2674 +			TestLoadApiL();
  1.2675 +			break;
  1.2676 +		case 20:
  1.2677 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0448"));
  1.2678 +			iTest->LogSubTest(KTest19);
  1.2679 +			KeyClickPriorityL();
  1.2680 +			break;
  1.2681 +		case 21:
  1.2682 + /**
  1.2683 +@SYMTestCaseID		GRAPHICS-WSERV-0505
  1.2684 +*/
  1.2685 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0505"));
  1.2686 +			iTest->LogSubTest(KTest20);
  1.2687 +			ParameterValueTestL();
  1.2688 +			break;
  1.2689 +		case 22:
  1.2690 +/**
  1.2691 +@SYMTestCaseID		GRAPHICS-WSERV-0506
  1.2692 +*/
  1.2693 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0506"));
  1.2694 +			iTest->LogSubTest(KTest21);
  1.2695 +			TestSetIntervalL();
  1.2696 +		case 23:
  1.2697 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0410"));
  1.2698 +			iTest->LogSubTest(KTest22);			
  1.2699 +			TestCoverageL();
  1.2700 +			break;
  1.2701 +		case 24:
  1.2702 +			((CTAnimDllStep*)iStep)->SetTestStepID(_L("GRAPHICS-WSERV-0411"));
  1.2703 +			iTest->LogSubTest(KTest23);
  1.2704 +			TestPanicCoverageL();
  1.2705 +		default:
  1.2706 +			((CTAnimDllStep*)iStep)->SetTestStepID(KNotATestSYMTestCaseIDName);
  1.2707 +			((CTAnimDllStep*)iStep)->CloseTMSGraphicsStep();
  1.2708 +			TestComplete();
  1.2709 +		}
  1.2710 +	User::Check();
  1.2711 +	((CTAnimDllStep*)iStep)->RecordTestResultL();
  1.2712 +	}
  1.2713 +
  1.2714 +//
  1.2715 +
  1.2716 +CAnimRedrawWindow::CAnimRedrawWindow(CAnimWindow *aAnimWindow, TBool aIsBase) : CTWin(),
  1.2717 +	iAnimWindow(aAnimWindow),
  1.2718 +	iIsBase(aIsBase)
  1.2719 +	{
  1.2720 +	}
  1.2721 +
  1.2722 +CAnimRedrawWindow::~CAnimRedrawWindow()
  1.2723 +	{
  1.2724 +	}
  1.2725 +
  1.2726 +void CAnimRedrawWindow::Draw()
  1.2727 +	{
  1.2728 +	CAnimWindow::Draw(Gc(),Size(),iIsBase,iAnimWindow->iRect,EFalse);
  1.2729 +	}
  1.2730 +
  1.2731 +//
  1.2732 +
  1.2733 +CAnimWindow::CAnimWindow(TBool aIsBase, TWinType aWinType) : iWinType(aWinType), iIsBase(aIsBase)
  1.2734 +	{
  1.2735 +	}
  1.2736 +
  1.2737 +
  1.2738 +CAnimWindow::~CAnimWindow()
  1.2739 +	{
  1.2740 +	delete iCtWin;
  1.2741 +	}
  1.2742 +
  1.2743 +void CAnimWindow::ConstructL(const TPoint &aPos, const TSize &aSize)
  1.2744 +	{
  1.2745 +	switch(iWinType)
  1.2746 +		{
  1.2747 +		case ERedraw:
  1.2748 +			iCtWin=new(ELeave) CAnimRedrawWindow(this, iIsBase);
  1.2749 +			break;
  1.2750 +		case EBlank:
  1.2751 +			iCtWin=new(ELeave) CTBlankWindow();
  1.2752 +			break;
  1.2753 +		case EBackedUp:
  1.2754 +			iCtWin=new(ELeave) CTBackedUpWin(EGray4);
  1.2755 +			break;
  1.2756 +		}
  1.2757 +	iCtWin->SetUpL(aPos, aSize, TheClient->iGroup, *TheClient->iGc);
  1.2758 +	if (iWinType==ERedraw)
  1.2759 +		{
  1.2760 +		static_cast<CTWin*>(iCtWin)->Win()->EnableRedrawStore(EFalse);
  1.2761 +		}
  1.2762 +	}
  1.2763 +
  1.2764 +void CAnimWindow::SetEllipseDrawMode(CGraphicsContext::TDrawMode aEllipseDrawMode)
  1.2765 +	{
  1.2766 +	iEllipseDrawMode=aEllipseDrawMode;
  1.2767 +	}
  1.2768 +
  1.2769 +void CAnimWindow::SetRect(const TRect &aRect)
  1.2770 +	{
  1.2771 +	iRect=aRect;
  1.2772 +	}
  1.2773 +
  1.2774 +void CAnimWindow::DrawEllipse(CBitmapContext *aGc, const TRect &aRect)
  1.2775 +	{
  1.2776 +	aGc->SetDrawMode(iEllipseDrawMode);
  1.2777 +	aGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
  1.2778 +	aGc->SetBrushColor(TRgb(85,85,85));
  1.2779 +	aGc->SetPenColor(TRgb(170,170,170));
  1.2780 +	aGc->DrawEllipse(aRect);
  1.2781 +	}
  1.2782 +
  1.2783 +void CAnimWindow::Draw(CBitmapContext *aGc, const TSize &aSize, TBool aIsBase, const TRect &aRect, TBool aBlankIt)
  1.2784 +	{
  1.2785 +	aGc->SetBrushColor(TRgb::Gray4(2));
  1.2786 +	aGc->Clear();
  1.2787 +	if (!aBlankIt)
  1.2788 +		for(TInt i=0;i<aSize.iWidth;i+=10)
  1.2789 +			aGc->DrawLine(TPoint(i,0),TPoint(i+10,aSize.iHeight));
  1.2790 +	if (aIsBase)
  1.2791 +		DrawEllipse(aGc, aRect);
  1.2792 +	}
  1.2793 +
  1.2794 +void CAnimWindow::DoDraw(TBool aBlankIt)
  1.2795 +	{
  1.2796 +	__ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
  1.2797 +	iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
  1.2798 +	Draw(iCtWin->Gc(),Size(),iIsBase,iRect,aBlankIt);
  1.2799 +	iCtWin->Gc()->Deactivate();
  1.2800 +	}
  1.2801 +
  1.2802 +void CAnimWindow::DoDrawEllipse()
  1.2803 +	{
  1.2804 +	__ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
  1.2805 +	iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
  1.2806 +	DrawEllipse(iCtWin->Gc(),iRect);
  1.2807 +	iCtWin->Gc()->Deactivate();
  1.2808 +	}
  1.2809 +
  1.2810 +void CAnimWindow::DoDrawCoverage()
  1.2811 +	{
  1.2812 +	__ASSERT_ALWAYS(iWinType!=EBlank,AutoPanic(EAutoPanicWindowType));
  1.2813 +	CWindowGc *gc = iCtWin->Gc();
  1.2814 +	gc->Activate(*(RDrawableWindow *)BaseWin());
  1.2815 +
  1.2816 +	gc->SetClippingRect(iRect);
  1.2817 +	gc->Clear();
  1.2818 +	gc->Clear(iRect);
  1.2819 +
  1.2820 +	gc->SetDrawMode(CGraphicsContext::EDrawModeAND);
  1.2821 +	gc->SetBrushStyle(CGraphicsContext::ENullBrush);
  1.2822 +	gc->SetBrushColor(TRgb::Gray256(85));
  1.2823 +	gc->SetBrushOrigin(TPoint(0,0));
  1.2824 +	gc->SetPenColor(TRgb::Gray256(170));
  1.2825 +
  1.2826 +	//primitive method calls
  1.2827 +	gc->SetFaded(ETrue);
  1.2828 +	gc->SetFadingParameters(1, 1);
  1.2829 +
  1.2830 +	gc->SetPenStyle(CGraphicsContext::ESolidPen);
  1.2831 +	gc->SetStrikethroughStyle(EStrikethroughOff);
  1.2832 +	gc->SetUnderlineStyle(EUnderlineOff);
  1.2833 +	gc->SetWordJustification(2, 1);
  1.2834 +
  1.2835 +	CFbsFont* font;
  1.2836 +	gc->Device()->GetNearestFontInTwips((CFont*&)font, TFontSpec());
  1.2837 +
  1.2838 +	gc->UseFont(font);
  1.2839 +	
  1.2840 +	gc->DrawArc(iRect,
  1.2841 +			TPoint(iRect.Center().iX, iRect.iTl.iY),
  1.2842 +			TPoint(iRect.iBr.iX, iRect.Center().iY));
  1.2843 +	gc->DrawLine(iRect.iTl,iRect.Center());
  1.2844 +	gc->DrawLineTo(TPoint(iRect.iBr.iX, iRect.iTl.iY));
  1.2845 +
  1.2846 +	gc->DrawLineBy(TPoint(iRect.iTl.iX, iRect.iBr.iY));
  1.2847 +	gc->MoveBy(iRect.iTl + TPoint(1,1));
  1.2848 +	gc->MoveTo(iRect.iTl + TPoint(0,0)); 
  1.2849 +	gc->SetPenSize(TSize(10,10));
  1.2850 +	gc->Plot(iRect.iTl + TPoint(2,2));
  1.2851 +	gc->SetPenSize(TSize(1,1));
  1.2852 +
  1.2853 +	CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
  1.2854 +	CleanupStack::PushL(polyPoints);
  1.2855 +	polyPoints->AppendL(iRect.iTl);
  1.2856 +	polyPoints->AppendL(iRect.Center());
  1.2857 +	polyPoints->AppendL(TPoint(iRect.iBr.iX, iRect.iTl.iY));
  1.2858 +	
  1.2859 +	gc->DrawPolyLine(polyPoints);
  1.2860 +	gc->DrawPolyLine(&polyPoints->At(0), 3);
  1.2861 +	gc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
  1.2862 +	gc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
  1.2863 +
  1.2864 +	gc->DrawPie(iRect, TPoint(iRect.Center().iX, iRect.iTl.iY), TPoint(iRect.iBr.iX, iRect.Center().iY));
  1.2865 +	gc->DrawEllipse(iRect);
  1.2866 +	gc->DrawRect(iRect);
  1.2867 +	gc->DrawRoundRect(iRect, TSize(iRect.Width()/8, iRect.Height()/8));
  1.2868 +
  1.2869 +	CleanupStack::PopAndDestroy(polyPoints);
  1.2870 +
  1.2871 +	gc->CopyRect(TPoint(10, 10), iRect);
  1.2872 +
  1.2873 +	CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
  1.2874 +	CleanupStack::PushL(bitmap);
  1.2875 +	User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
  1.2876 +
  1.2877 +	gc->UseBrushPattern(bitmap);
  1.2878 +	gc->DrawBitmap(iRect.iTl, bitmap);
  1.2879 +	gc->DrawBitmap(iRect, bitmap);
  1.2880 +	gc->DrawBitmap(iRect, bitmap, TRect(0, 0, 16, 16));
  1.2881 +	gc->DrawBitmapMasked(iRect, bitmap, TRect(0, 0, 16, 16), bitmap, ETrue);
  1.2882 +
  1.2883 +	gc->BitBlt(TPoint(0, 0), bitmap);
  1.2884 +	gc->BitBlt(TPoint(0, 0), bitmap, iRect);
  1.2885 +	gc->BitBltMasked(TPoint(0, 0), bitmap, iRect, bitmap, ETrue);
  1.2886 +	gc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, iRect, bitmap, TPoint(0,0));
  1.2887 +	
  1.2888 +	CleanupStack::PopAndDestroy(bitmap);
  1.2889 +
  1.2890 +	_LIT(KHelloWorld,"Hello World");
  1.2891 +	gc->SetCharJustification(1,1);
  1.2892 +	gc->SetClippingRect(iRect);
  1.2893 +	gc->DrawText(*&KHelloWorld, iRect.iTl);
  1.2894 +	gc->DrawText(*&KHelloWorld, iRect, 0, CGraphicsContext::ELeft, 0);
  1.2895 +	gc->DrawTextVertical(*&KHelloWorld, iRect.iBr, ETrue);
  1.2896 +	gc->DrawTextVertical(*&KHelloWorld, iRect, 0, ETrue, CGraphicsContext::ELeft, 0);
  1.2897 +
  1.2898 +	TRgb rgbs[2];
  1.2899 +	gc->MapColors(iRect, rgbs, 1, ETrue);
  1.2900 +	gc->DiscardBrushPattern();
  1.2901 +
  1.2902 +	gc->DiscardFont();
  1.2903 +	gc->Device()->ReleaseFont(font);
  1.2904 +
  1.2905 +	gc->Deactivate();
  1.2906 +	}
  1.2907 +
  1.2908 +TSize CAnimWindow::Size()
  1.2909 +	{
  1.2910 +	return(iCtWin->Size());
  1.2911 +	}
  1.2912 +
  1.2913 +RWindowBase *CAnimWindow::BaseWin() const
  1.2914 +	{
  1.2915 +	return(iCtWin->BaseWin());
  1.2916 +	}
  1.2917 +
  1.2918 +CTBaseWin *CAnimWindow::CtBaseWin()
  1.2919 +	{
  1.2920 +	return(iCtWin);
  1.2921 +	}
  1.2922 +
  1.2923 +void CAnimWindow::Invalidate()
  1.2924 +	{
  1.2925 +	CTUser::Splat(TheClient,TRect(iCtWin->Position(),iCtWin->Size()),TRgb::Gray256(0));
  1.2926 +	}
  1.2927 +
  1.2928 +void CAnimWindow::Invalidate(const TRect &aRect)
  1.2929 +	{
  1.2930 +	TRect rect(aRect);
  1.2931 +	rect.Move(iCtWin->Position());
  1.2932 +	CTUser::Splat(TheClient,rect,TRgb::Gray256(0));
  1.2933 +	}
  1.2934 +
  1.2935 +void CAnimWindow::DrawTestScreen(CFbsBitmap *aBitmap, CFbsBitmap *aMaskBitmap, CFbsFont *aFont)
  1.2936 +	{
  1.2937 +	iCtWin->Gc()->Activate(*(RDrawableWindow *)BaseWin());
  1.2938 +	CBitmapContext *gc=iCtWin->Gc();
  1.2939 +	TSize size(Size());
  1.2940 +	TBool aExtraDrawBitMap=ETrue;
  1.2941 +//
  1.2942 +#include "DLLDRAW.H"
  1.2943 +//
  1.2944 +	iCtWin->Gc()->Deactivate();
  1.2945 +	}
  1.2946 +
  1.2947 +
  1.2948 +__WS_CONSTRUCT_STEP__(AnimDll)