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