1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/AUTODLL.CPP Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,2858 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// Auto test Animated DLL functions
1.18 +//
1.19 +//
1.20 +
1.21 +#include <e32std.h>
1.22 +#include <w32std.h>
1.23 +#include <w32adll.h>
1.24 +#include <bitstd.h>
1.25 +#include "AUTODLL.H"
1.26 +#include "TAnimDraw.h"
1.27 +#include "eventdd.h"
1.28 +#include <gdi.h>
1.29 +#include <fbs.h>
1.30 +
1.31 +union TAnimArgUnion
1.32 + {
1.33 + const TAny* any;
1.34 + const TBool* Bool;
1.35 + const TInt* Int;
1.36 + const TPoint* Point;
1.37 + const TSize* Size;
1.38 + const TRect* Rect;
1.39 + const TSpriteMemberInfo* SpriteMemberInfo;
1.40 + const TShadowDrawTest* ShadowDrawTest;
1.41 + const TDrawTestScreen* DrawTestScreen;
1.42 + const TSyncTests* SyncTests;
1.43 + const TTimeChangeTest* TimeChangeTest;
1.44 + const TAnimRawEvent* AnimRawEvent;
1.45 + const TWindowGroupInfoParms* WindowGroupInfoParms;
1.46 + const TSetOrdinalParms* SetOrdinalParms;
1.47 + const TFrameData* FrameData;
1.48 + const TRawEvent* RawEvent;
1.49 + };
1.50 +
1.51 +class CPanicAnim : public CWindowAnim
1.52 + {
1.53 + enum TSyncState
1.54 + {
1.55 + ESyncStateNull,
1.56 + ESyncStateStarting,
1.57 + ESyncStateCounting,
1.58 + ESyncLeave,
1.59 + ESyncStateTimeChange1,
1.60 + ESyncStateTimeChange2,
1.61 + ESyncStateTimeChange3
1.62 + };
1.63 + enum {ESyncCount=8};
1.64 +public:
1.65 + ~CPanicAnim();
1.66 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.67 + virtual void Animate(TDateTime *aDateTime);
1.68 + virtual void Redraw();
1.69 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.70 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.71 + virtual void FocusChanged(TBool aState);
1.72 + //Pure virtual function from MEventHandler
1.73 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.74 +private:
1.75 + void StartSyncTest(MAnimGeneralFunctions::TAnimSync aSync);
1.76 + void StartTimeChangeTest();
1.77 + void DoLeaveInActiveCallback();
1.78 + static TInt LeaveInActiveCallback(TAny *aThis);
1.79 +private:
1.80 + TRequestStatus *iStatusPtr;
1.81 + TRequestStatus *iStatusPtr2;
1.82 + TTime iTime;
1.83 + TInt iSyncCount;
1.84 + TSyncState iSyncState;
1.85 + MAnimGeneralFunctions::TAnimSync iSyncMode;
1.86 + TBool iLeaveInRedraw;
1.87 + CIdle* iActivePanicIdle;
1.88 + };
1.89 +
1.90 +class CPanicAnim2 : public CWindowAnim
1.91 +//
1.92 +// Simply panics in the ConstructL()
1.93 +//
1.94 + {
1.95 +public:
1.96 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.97 + virtual void Animate(TDateTime *aDateTime);
1.98 + virtual void Redraw();
1.99 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.100 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.101 + virtual void FocusChanged(TBool aState);
1.102 + //Pure virtual function from MEventHandler
1.103 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.104 + };
1.105 +
1.106 +class CAutoAnim3 : public CWindowAnim
1.107 +//
1.108 +// test drawing/redrawing
1.109 +//
1.110 + {
1.111 +public:
1.112 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.113 + virtual void Animate(TDateTime *aDateTime);
1.114 + virtual void Redraw();
1.115 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.116 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.117 + virtual void FocusChanged(TBool aState);
1.118 + void Draw(const TRect &aRect);
1.119 + void DrawTestScreenL(const TDrawTestScreen* aParams);
1.120 + //Pure virtual function from MEventHandler
1.121 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.122 +private:
1.123 + TRequestStatus *iStatusPtr;
1.124 + CFbsFont *iFont;
1.125 + TRect iRect;
1.126 + TRect iBaseRect;
1.127 + TInt iMode;
1.128 + };
1.129 +
1.130 +class CAutoAnimScrBack : public CWindowAnim
1.131 +//
1.132 +// test anim drawing behind a backed up window
1.133 +//
1.134 + {
1.135 +public:
1.136 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.137 + virtual void Animate(TDateTime *aDateTime);
1.138 + virtual void Redraw();
1.139 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.140 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.141 + virtual void FocusChanged(TBool aState);
1.142 + void Draw();
1.143 + //Pure virtual function from MEventHandler
1.144 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.145 +private:
1.146 + TRect iRect;
1.147 + TInt iMode;
1.148 + };
1.149 +
1.150 +class CTestSpriteAnim : public CSpriteAnim
1.151 + {
1.152 +public:
1.153 + virtual void ConstructL(TAny *aArgs);
1.154 + virtual void Animate(TDateTime *aDateTime);
1.155 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.156 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.157 + //Pure virtual function from MEventHandler
1.158 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.159 +private:
1.160 + TBool CheckMember(const TSpriteMemberInfo& aMemInfo);
1.161 + void DrawMemberL(TInt aMember);
1.162 + void DrawMemberL();
1.163 + };
1.164 +
1.165 +/**
1.166 +Used by CAnimTimer below
1.167 +*/
1.168 +class MAnimTimerObserver
1.169 + {
1.170 +public:
1.171 + virtual void DisplayNextFrameL()=0;
1.172 + };
1.173 +
1.174 +/**
1.175 +This class is used by CTestFreeTimerAnim to determine when to swap the current frame with the next one.
1.176 +*/
1.177 +class CAnimTimer : public CTimer
1.178 + {
1.179 +public:
1.180 + ~CAnimTimer();
1.181 + static CAnimTimer* NewL(MAnimTimerObserver& aObserver);
1.182 + void RunL();
1.183 +private:
1.184 + CAnimTimer(MAnimTimerObserver& aObserver);
1.185 + void ConstructL();
1.186 +private:
1.187 + MAnimTimerObserver& iAnim;
1.188 + };
1.189 +
1.190 +class CTestFreeTimerAnim : public CFreeTimerWindowAnim, public MAnimTimerObserver
1.191 + {
1.192 +public:
1.193 + //from CBase
1.194 + ~CTestFreeTimerAnim();
1.195 + //from CAnim
1.196 + void Animate(TDateTime *aDateTime);
1.197 + void Command(TInt aOpcode, TAny *aArgs);
1.198 + TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.199 + //from CWindowAnim
1.200 + void ConstructL(TAny *aArgs, TBool aHasFocus);
1.201 + void Redraw();
1.202 + void FocusChanged(TBool aState);
1.203 + //from MEventHandler
1.204 + TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.205 +private:
1.206 + void DisplayNextFrameL();
1.207 +private:
1.208 + CAnimTimer* iTimer;
1.209 + TInt iFrameTime;
1.210 + TRgb iColour;
1.211 + TRect iRect;
1.212 + };
1.213 +
1.214 +class CEventTestAnimBase : public CWindowAnim
1.215 + {
1.216 + enum {EEventBufferSize=40};
1.217 +public:
1.218 + virtual ~CEventTestAnimBase();
1.219 + //Pure virtual functions from CAnim
1.220 + virtual void Animate(TDateTime *aDateTime);
1.221 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.222 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.223 + //Pure virtual functions from CWindowAnim
1.224 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.225 + virtual void Redraw();
1.226 + virtual void FocusChanged(TBool aState);
1.227 + //Pure virtual function from MEventHandler
1.228 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.229 +protected:
1.230 + void Fail();
1.231 + TBool IsIgnorableEvent(const TRawEvent& aRawEvent) const;
1.232 + TBool GetNextExpectedEvent(TAnimRawEvent& aRawEvent);
1.233 + TBool CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent) const;
1.234 + TBool HandleRecursiveEvent(const TRawEvent& aRawEvent);
1.235 +
1.236 + TInt Error() const;
1.237 + TInt EventCount() const;
1.238 + void ResetEventCount();
1.239 + TInt TotalExpectedEvents() const;
1.240 + TInt AddEvent(const TAnimRawEvent* event);
1.241 +private:
1.242 + virtual TInt AddExpectedEvent(const TAnimRawEvent* event)=0;
1.243 +private:
1.244 + CCirBuf<TAnimRawEvent> iExpectedEvents;
1.245 + TInt iError;
1.246 + TInt iEventCount;
1.247 + };
1.248 +
1.249 +class CEventTestAnim : public CEventTestAnimBase
1.250 + {
1.251 +public:
1.252 + ~CEventTestAnim();
1.253 + //Pure virtual functions from CWindowAnim overridden in CEventTestAnimBase
1.254 + void ConstructL(TAny* aArgs,TBool aHasFocus);
1.255 + //Pure virtual functions from CAnim overridden in CEventTestAnimBase
1.256 + TInt CommandReplyL(TInt aOpcode,TAny* aArgs);
1.257 + void Command(TInt aOpcode,TAny* aArgs);
1.258 +private:
1.259 + TInt UnloadDeviceDriver();
1.260 + //Pure virtual function from CEventTestAnimBase
1.261 + TInt AddExpectedEvent(const TAnimRawEvent* event);
1.262 +private:
1.263 + TBool iDevDriverLoaded;
1.264 + REventDD iLdd;
1.265 + };
1.266 +
1.267 +class CEventPostingAnim : public CEventTestAnimBase
1.268 + {
1.269 +public:
1.270 + ~CEventPostingAnim();
1.271 + //Virtual functions from CEventTestAnimBase
1.272 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.273 + //Virtual function from MEventHandler
1.274 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.275 +private:
1.276 + //Pure virtual function from CEventTestAnimBase
1.277 + virtual TInt AddExpectedEvent(const TAnimRawEvent* event);
1.278 + };
1.279 +
1.280 +class CRemovableAnim : public CEventTestAnimBase
1.281 + {
1.282 +public:
1.283 + ~CRemovableAnim();
1.284 + //Virtual functions from CEventTestAnimBase
1.285 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.286 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.287 +private:
1.288 + //Pure virtual function from CEventTestAnimBase
1.289 + virtual TInt AddExpectedEvent(const TAnimRawEvent* event);
1.290 +private:
1.291 + TInt iLifetime;
1.292 + };
1.293 +
1.294 +class CTimerTestAnim : public CWindowAnim
1.295 + {
1.296 +public:
1.297 + ~CTimerTestAnim();
1.298 + //Pure virtual functions from CAnim
1.299 + virtual void Animate(TDateTime *aDateTime);
1.300 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.301 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.302 + //Pure virtual functions from CWindowAnim
1.303 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.304 + virtual void Redraw();
1.305 + virtual void FocusChanged(TBool aState);
1.306 + //Pure virtual function from MEventHandler
1.307 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.308 +private:
1.309 + TInt iTimerCount;
1.310 + TBool iExpectingTicks;
1.311 + TBool iFail;
1.312 + };
1.313 +
1.314 +class CWinFunctionTestAnim : public CWindowAnim
1.315 + {
1.316 + //enum {EEventBufferSize=40};
1.317 +public:
1.318 + ~CWinFunctionTestAnim();
1.319 + //Pure virtual functions from CAnim
1.320 + virtual void Animate(TDateTime *aDateTime);
1.321 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.322 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.323 + //Pure virtual functions from CWindowAnim
1.324 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.325 + virtual void Redraw();
1.326 + virtual void FocusChanged(TBool aState);
1.327 + //Pure virtual function from MEventHandler
1.328 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.329 +private:
1.330 + MAnimGeneralFunctionsWindowExtension* iWinFunctions;
1.331 + };
1.332 +
1.333 +class CNotificationTestAnim : public CWindowAnim
1.334 + {
1.335 +public:
1.336 + CNotificationTestAnim();
1.337 + ~CNotificationTestAnim();
1.338 + //Pure virtual functions from CAnim
1.339 + virtual void HandleNotification(const TWsEvent& aEvent);
1.340 + virtual void Animate(TDateTime *aDateTime);
1.341 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.342 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.343 + //Pure virtual functions from CWindowAnim
1.344 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.345 + virtual void Redraw();
1.346 + virtual void FocusChanged(TBool aState);
1.347 + //Pure virtual function from MEventHandler
1.348 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.349 +private:
1.350 + TFixedArray<TBool,2> iDSA;
1.351 + TBool iHeartbeatState;
1.352 + TBool iScreenDeviceChanged;
1.353 + TTime iLastAnimTime;
1.354 + };
1.355 +
1.356 +class CTransAnim : public CWindowAnim
1.357 +//
1.358 +// Test drawing/redrawing in Transparent window.
1.359 +//
1.360 + {
1.361 +public:
1.362 + //Implementaion for pure virtual functions from CAnim
1.363 + void ConstructL(TAny* aArgs, TBool aHasFocus);
1.364 + void Animate(TDateTime* aDateTime);
1.365 + void Redraw();
1.366 + void Command(TInt aOpcode, TAny* aArgs);
1.367 + TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
1.368 + void FocusChanged(TBool aState);
1.369 + TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.370 +private:
1.371 + CFbsFont* iFont;
1.372 + TRect iRect;
1.373 + TInt iMode;
1.374 + TInt iDraw;
1.375 + TRgb iColor;
1.376 + TInt iCount;
1.377 + };
1.378 +
1.379 +class CTestHandlerAnim : public CWindowAnim
1.380 + {
1.381 + public:
1.382 + ~CTestHandlerAnim();
1.383 + void ConstructL(TAny* aArgs, TBool aHasFocus);
1.384 + void Redraw();
1.385 + void FocusChanged(TBool aState);
1.386 + TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
1.387 + void Command(TInt aOpcode, TAny* aArgs);
1.388 + void Animate(TDateTime* aDateTime);
1.389 + TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.390 + private:
1.391 + };
1.392 +
1.393 +class CCoverageAnim : public CWindowAnim
1.394 +/**
1.395 + This class adds functional coverage to CWsAnimGc.
1.396 + The actual work is handled by the 'Draw' method which calls
1.397 + each method in turn.
1.398 + Mostly copied from CAutoAnimScrBack and CAutoAnim3.
1.399 + @SYMTestCaseID
1.400 + @SYMPREQ 1841 Add Coverage tests.
1.401 + @SYMTestCaseDesc Functional coverage.
1.402 + @SYMTestActions Run functional coverage test on CWsAnimGc.
1.403 + */
1.404 + {
1.405 +public:
1.406 + ~CCoverageAnim();
1.407 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.408 + virtual void Animate(TDateTime *aDateTime);
1.409 + virtual void Redraw();
1.410 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.411 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.412 + virtual void FocusChanged(TBool aState);
1.413 + void Draw();
1.414 + //Pure virtual function from MEventHandler
1.415 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.416 +private:
1.417 + TRect iRect; /** rectangle used for all draw ops that require one */
1.418 + CFbsFont* iFont;
1.419 + };
1.420 +
1.421 +class CMultiPointerAnim : public CWindowAnim
1.422 + {
1.423 + enum {EEventBufferSize=40};
1.424 +public:
1.425 + virtual ~CMultiPointerAnim();
1.426 + //Pure virtual functions from CAnim
1.427 + virtual void Animate(TDateTime *aDateTime);
1.428 + virtual void Command(TInt aOpcode, TAny *aArgs);
1.429 + virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
1.430 + //Pure virtual functions from CWindowAnim
1.431 + virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
1.432 + virtual void Redraw();
1.433 + virtual void FocusChanged(TBool aState);
1.434 + //Pure virtual function from MEventHandler
1.435 + virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
1.436 +protected:
1.437 + TInt AddEvent(const TAnimRawEvent* aEvent);
1.438 + TBool CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent);
1.439 +private:
1.440 + CCirBuf<TAnimRawEvent> iExpectedEvents;
1.441 + TBuf<255> iErrorDes;
1.442 + TInt iEventCount;
1.443 + TInt iError;
1.444 + };
1.445 +
1.446 +class CTestAnimDll : public CAnimDll
1.447 + {
1.448 +public:
1.449 + CAnim *CreateInstanceL(TInt aType);
1.450 +private:
1.451 + };
1.452 +
1.453 +/*#if defined(__WINS__)
1.454 +#pragma data_seg(".E32_UID")
1.455 +__WINS_UID(0, KWservAnimDllUidValue, 0)
1.456 +#pragma data_seg()
1.457 +#endif*/
1.458 +
1.459 +EXPORT_C CAnimDll *CreateCAnimDllL()
1.460 + {
1.461 + return(new(ELeave) CTestAnimDll());
1.462 + }
1.463 +
1.464 +
1.465 +// Panic Tests //
1.466 +void CPanicAnim::ConstructL(TAny *, TBool )
1.467 + {
1.468 + iWindowFunctions->SetRect(TRect(0,0,1,1));
1.469 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.470 + if (iFunctions->Sync()!=MAnimGeneralFunctions::ESyncSecond)
1.471 + User::Leave(KErrGeneral);
1.472 +// Check the anim time is not ahead of and not more than 2 secs behind the system time
1.473 + TTime now;
1.474 + now.UniversalTime();
1.475 + TDateTime dt=now.DateTime();
1.476 + TDateTime adt=iFunctions->SystemTime();
1.477 + if (adt.Day()!=dt.Day())
1.478 + User::Leave(KErrGeneral);
1.479 +
1.480 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1.481 + if (iFunctions->Sync()!=MAnimGeneralFunctions::ESyncNone)
1.482 + User::Leave(KErrGeneral);
1.483 + }
1.484 +
1.485 +CPanicAnim::~CPanicAnim()
1.486 + {
1.487 + delete iActivePanicIdle;
1.488 + }
1.489 +
1.490 +void CPanicAnim::Animate(TDateTime *aDateTime)
1.491 + {
1.492 + switch(iSyncState)
1.493 + {
1.494 + case ESyncStateNull:
1.495 + break;
1.496 + case ESyncStateStarting:
1.497 + iTime=iFunctions->SystemTime();
1.498 + iSyncState=ESyncStateCounting;
1.499 + iSyncCount=0;
1.500 + break;
1.501 + case ESyncStateCounting:
1.502 + if (aDateTime)
1.503 + {
1.504 + TTimeIntervalSeconds interval;
1.505 + TTime(*aDateTime).SecondsFrom(iTime, interval);
1.506 + iSyncCount=interval.Int();
1.507 + }
1.508 + else
1.509 + iSyncCount++;
1.510 + if (iSyncCount==ESyncCount)
1.511 + {
1.512 + TTimeIntervalMicroSeconds minInterval(0);
1.513 + TTimeIntervalMicroSeconds maxInterval(0);
1.514 + iSyncState=ESyncStateNull;
1.515 + switch(iSyncMode)
1.516 + {
1.517 + case MAnimGeneralFunctions::ESyncSecond:
1.518 + minInterval=iSyncCount*1000000-100000;
1.519 + maxInterval=iSyncCount*1000000+100000;
1.520 + break;
1.521 + default:;
1.522 + }
1.523 + TTime time(iFunctions->SystemTime());
1.524 + TTimeIntervalMicroSeconds interval=time.MicroSecondsFrom(iTime);
1.525 + TInt ret=KErrNone;
1.526 + if (interval<minInterval || interval>maxInterval)
1.527 + ret=KErrGeneral;
1.528 + iFunctions->Client().RequestComplete(iStatusPtr,ret);
1.529 + }
1.530 + break;
1.531 + case ESyncLeave:
1.532 + User::Leave(KErrGeneral); // Test: Not allowed to leave, will cause a panic
1.533 + break;
1.534 + case ESyncStateTimeChange1:
1.535 + if (!aDateTime)
1.536 + {
1.537 + iFunctions->Client().RequestComplete(iStatusPtr,KErrNone);
1.538 + iSyncState=ESyncStateTimeChange2;
1.539 + }
1.540 + break;
1.541 + case ESyncStateTimeChange2:
1.542 + if (!aDateTime)
1.543 + {
1.544 + iSyncState=ESyncStateTimeChange3;
1.545 + break;
1.546 + }
1.547 + case ESyncStateTimeChange3:
1.548 + iFunctions->Client().RequestComplete(iStatusPtr2,aDateTime ? KErrNone : KErrGeneral);
1.549 + iSyncState=ESyncStateNull;
1.550 + break;
1.551 + }
1.552 + }
1.553 +
1.554 +void CPanicAnim::Redraw()
1.555 + {
1.556 + if (iLeaveInRedraw)
1.557 + User::Leave(KErrGeneral); //Test: Not allowed to leave, will cause a panic
1.558 + }
1.559 +
1.560 +void CPanicAnim::Command(TInt aOpcode, TAny *)
1.561 + {
1.562 + switch(aOpcode)
1.563 + {
1.564 + case EADllPanicCallPanic:
1.565 + iFunctions->Panic();
1.566 + break;
1.567 + case EADllPanicSetInterval:
1.568 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.569 + iFunctions->SetInterval(1);
1.570 + break;
1.571 + case EADllPanicSetNextInterval:
1.572 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncMinute);
1.573 + iFunctions->SetNextInterval(1);
1.574 + break;
1.575 + case EADllPanicDoubleActivateGC:
1.576 + iWindowFunctions->ActivateGc();
1.577 + iWindowFunctions->ActivateGc();
1.578 + break;
1.579 + case EADllPanicDrawRectWithNoGc:
1.580 + iGc->DrawRect(TRect(0,0,10,10));
1.581 + break;
1.582 + case EADllPanicDrawTextWithNoFont:
1.583 + iWindowFunctions->ActivateGc();
1.584 + iGc->DrawText(_L("Panic"),TPoint(20,20));
1.585 + break;
1.586 + case EADllPanicLeaveInAnimate:
1.587 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.588 + iSyncState=ESyncLeave;
1.589 + break;
1.590 + case EADllPanicLeaveInRedraw:
1.591 + iLeaveInRedraw=ETrue;
1.592 + iWindowFunctions->Invalidate(TRect(0,0,10,10));
1.593 + break;
1.594 + case EADllPanicLeave:
1.595 + //tests a leaving function in a non-leaving function and should not be moved to CommandReplyL as it leaves
1.596 + User::Leave(KErrGeneral); //LeaveScan: intentional test
1.597 + break;
1.598 + case EADllPanicSetVisWithGcActive:
1.599 + iWindowFunctions->ActivateGc();
1.600 + iWindowFunctions->SetVisible(EFalse);
1.601 + iWindowFunctions->SetVisible(ETrue);
1.602 + break;
1.603 + case EADllPanicLeaveInActiveCallback:
1.604 + iActivePanicIdle=CIdle::NewL(EPriorityHigh);
1.605 + iActivePanicIdle->Start(TCallBack(CPanicAnim::LeaveInActiveCallback,this));
1.606 + break;
1.607 + case EADllPanicSetClippingRectWithNoGc:
1.608 + {
1.609 + // currently this test fails because when deactivated iWin is also NULL and is deferenced in function
1.610 + TRect rect(20,20,20,20);
1.611 + iGc->SetClippingRect(rect);
1.612 + }
1.613 + break;
1.614 + case EADllPanicCancelClippingRegionWithNoGc:
1.615 + // currently this test fails because when deactivated iWin is NULL and function leaves
1.616 + iGc->CancelClippingRegion();
1.617 + break;
1.618 + case EADllPanicCancelClippingRectWithNoGc:
1.619 + // currently this test fails because when deactivated iWin is also NULL and is deferenced in function
1.620 + iGc->CancelClippingRect();
1.621 + break;
1.622 + case EADllPanicSetDrawModeWithNoGc:
1.623 + iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);
1.624 + break;
1.625 + case EADllPanicUseFontWithNoGc:
1.626 + {
1.627 + // currently this test fails because does not check for NULL font
1.628 + CFbsFont* font = NULL;
1.629 + iGc->UseFont(font);
1.630 + }
1.631 + break;
1.632 + case EADllPanicDiscardFontWithNoGc:
1.633 + iGc->DiscardFont();
1.634 + break;
1.635 + case EADllPanicSetUnderlineStyleWithNoGc:
1.636 + iGc->SetUnderlineStyle(EUnderlineOff);
1.637 + break;
1.638 + case EADllPanicSetStrikeThoughStyleWithNoGc:
1.639 + iGc->SetStrikethroughStyle(EStrikethroughOff);
1.640 + break;
1.641 + case EADllPanicSetWordJustificationWithNoGc:
1.642 + iGc->SetWordJustification(0,0);
1.643 + break;
1.644 + case EADllPanicSetCharJustificationWithNoGc:
1.645 + iGc->SetCharJustification(0,0);
1.646 + break;
1.647 + case EADllPanicSetPenColorWithNoGc:
1.648 + {
1.649 + TRgb rgbs;
1.650 + iGc->SetPenColor(rgbs);
1.651 + }
1.652 + break;
1.653 + case EADllPanicSetPenStyleWithNoGc:
1.654 + iGc->SetPenStyle(CGraphicsContext::ESolidPen);
1.655 + break;
1.656 + case EADllPanicSetPenSizeWithNoGc:
1.657 + {
1.658 + const TSize size;
1.659 + iGc->SetPenSize(size);
1.660 + }
1.661 + break;
1.662 + case EADllPanicSetBrushColorWithNoGc:
1.663 + {
1.664 + TRgb rgbs;
1.665 + iGc->SetBrushColor(rgbs);
1.666 + }
1.667 + break;
1.668 + case EADllPanicSetBrushStyleWithNoGc:
1.669 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.670 + break;
1.671 + case EADllPanicSetBrushOriginWithNoGc:
1.672 + {
1.673 + TPoint point;
1.674 + iGc->SetBrushOrigin(point);
1.675 + }
1.676 + break;
1.677 + case EADllPanicUseBrushPatterWithNoGc:
1.678 + {
1.679 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.680 + CleanupStack::PushL(bitmap);
1.681 + User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1.682 + iGc->UseBrushPattern(bitmap);
1.683 + CleanupStack::PopAndDestroy(bitmap);
1.684 + }
1.685 + break;
1.686 + case EADllPanicDiscardBrushPatternWithNoGc:
1.687 + iGc->DiscardBrushPattern();
1.688 + break;
1.689 + case EADllPanicSetFadedWithNoGc:
1.690 + iGc->SetFaded(EFalse);
1.691 + break;
1.692 + case EADllPanicSetFadingParametersWithNoGc:
1.693 + iGc->SetFadingParameters(1,1);
1.694 + break;
1.695 + case EADllPanicDrawArcWithNoGc:
1.696 + {
1.697 + TRect rect;
1.698 + iGc->DrawArc(rect,
1.699 + TPoint(rect.Center().iX, rect.iTl.iY),
1.700 + TPoint(rect.iBr.iX, rect.Center().iY));
1.701 + }
1.702 + break;
1.703 + case EADllPanicDrawPieWithNoGc:
1.704 + {
1.705 + TRect rect;
1.706 + iGc->DrawPie(rect, TPoint(rect.Center().iX, rect.iTl.iY), TPoint(rect.iBr.iX, rect.Center().iY));
1.707 + }
1.708 + break;
1.709 + case EADllPanicDrawLineWithNoGc:
1.710 + {
1.711 + const TPoint point1;
1.712 + const TPoint point2;
1.713 + iGc->DrawLine(point1, point2);
1.714 + }
1.715 + break;
1.716 + case EADllPanicDrawLineToWithNoGc:
1.717 + {
1.718 + const TPoint point;
1.719 + iGc->DrawLineTo(point);
1.720 + }
1.721 + break;
1.722 + case EADllPanicDrawLineByWithNoGc:
1.723 + {
1.724 + const TPoint point;
1.725 + iGc->DrawLineBy(point);
1.726 + }
1.727 + break;
1.728 + case EADllPanicDrawEllipseWithNoGc:
1.729 + {
1.730 + TRect rect(20,20,20,20);
1.731 + iGc->DrawEllipse(rect);
1.732 + }
1.733 + break;
1.734 + case EADllPanicDrawRoundedRecWithNoGc:
1.735 + {
1.736 + TRect rect;
1.737 + iGc->DrawRoundRect(rect, TSize(rect.Width()/8, rect.Height()/8));
1.738 + }
1.739 + break;
1.740 + case EADllPanicClearWithRectWithNoGc:
1.741 + {
1.742 + TRect rect(20,20,20,20);
1.743 + iGc->Clear(rect);
1.744 + }
1.745 + break;
1.746 + case EADllPanicClearWithNoGc:
1.747 + iGc->Clear();
1.748 + break;
1.749 + case EADllPanicBitBltWithNoGc:
1.750 + {
1.751 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.752 + CleanupStack::PushL(bitmap);
1.753 + User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1.754 + iGc->BitBlt(TPoint(0, 0), bitmap);
1.755 + CleanupStack::PopAndDestroy(bitmap);
1.756 + }
1.757 + break;
1.758 + case EADllPanicBitBltWithRectWithNoGc:
1.759 + {
1.760 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.761 + TRect rect;
1.762 + CleanupStack::PushL(bitmap);
1.763 + User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1.764 + iGc->BitBlt(TPoint(0, 0), bitmap, rect);
1.765 + CleanupStack::PopAndDestroy(bitmap);
1.766 + }
1.767 + break;
1.768 + case EADllPanicBitBltMaskedWithNoGc:
1.769 + {
1.770 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.771 + TRect rect;
1.772 + CleanupStack::PushL(bitmap);
1.773 + User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1.774 + iGc->BitBltMasked(TPoint(0, 0), bitmap, rect, bitmap, EFalse);
1.775 + CleanupStack::PopAndDestroy(bitmap);
1.776 + }
1.777 + break;
1.778 + case EADllPanicDrawBitmapMaskedFbsBitmapWithNoGc:
1.779 + {
1.780 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.781 + TRect rect;
1.782 + CleanupStack::PushL(bitmap);
1.783 + User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1.784 + iGc->DrawBitmapMasked(rect, bitmap, rect, bitmap, ETrue);
1.785 + CleanupStack::PopAndDestroy(bitmap);
1.786 + }
1.787 + break;
1.788 + case EADllPanicDrawBitmapMaskedWsBitmapWithNoGc:
1.789 + {
1.790 + CWsBitmap* bitmap = NULL;
1.791 + TRect rect;
1.792 + iGc->DrawBitmapMasked(rect, bitmap, rect, bitmap, ETrue);
1.793 + }
1.794 + break;
1.795 + case EADllPanicDrawBitmapPointWithNoGc:
1.796 + {
1.797 + CWsBitmap* bitmap = NULL;
1.798 + TRect rect;
1.799 + iGc->DrawBitmap(rect.iTl, bitmap);
1.800 + }
1.801 + break;
1.802 + case EADllPanicDrawBitmapWithNoGc:
1.803 + {
1.804 + CWsBitmap* bitmap = NULL;
1.805 + TRect rect;
1.806 + iGc->DrawBitmap(rect, bitmap);
1.807 + }
1.808 + break;
1.809 + case EADllPanicDrawBitmapRectWithNoGc:
1.810 + {
1.811 + CWsBitmap* bitmap = NULL;
1.812 + TRect rect;
1.813 + iGc->DrawBitmap(rect, bitmap, TRect(0, 0, 16, 16));
1.814 + }
1.815 + break;
1.816 + case EADllPanicDrawPolyLinePointsWithNoGc:
1.817 + {
1.818 + TRect rect;
1.819 + CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
1.820 + CleanupStack::PushL(polyPoints);
1.821 + polyPoints->AppendL(rect.iTl);
1.822 + polyPoints->AppendL(rect.Center());
1.823 + polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
1.824 + iGc->DrawPolyLine(&polyPoints->At(0), 3);
1.825 + CleanupStack::PopAndDestroy(polyPoints);
1.826 + }
1.827 + break;
1.828 + case EADllPanicDrawPolyLineArrayWithNoGc:
1.829 + {
1.830 + TRect rect;
1.831 + CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
1.832 + CleanupStack::PushL(polyPoints);
1.833 + polyPoints->AppendL(rect.iTl);
1.834 + polyPoints->AppendL(rect.Center());
1.835 + polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
1.836 + iGc->DrawPolyLine(polyPoints);
1.837 + CleanupStack::PopAndDestroy(polyPoints);
1.838 + }
1.839 + break;
1.840 + case EADllPanicMoveToWithNoGc:
1.841 + {
1.842 + TPoint point;
1.843 + iGc->MoveTo(point);
1.844 + }
1.845 + break;
1.846 + case EADllPanicMoveByWithNoGc:
1.847 + {
1.848 + TPoint point;
1.849 + iGc->MoveBy(point);
1.850 + }
1.851 + break;
1.852 + case EADllPanicPlotWithNoGc:
1.853 + {
1.854 + TPoint point;
1.855 + iGc->Plot(point);
1.856 + }
1.857 + break;
1.858 + case EADllPanicSetOriginWithNoGc:
1.859 + {
1.860 + TPoint point;
1.861 + iGc->SetOrigin(point);
1.862 + }
1.863 + break;
1.864 + case EADllPanicCopyRectWithNoGc:
1.865 + {
1.866 + TPoint point;
1.867 + TRect rect;
1.868 + iGc->CopyRect(point, rect);
1.869 + }
1.870 + break;
1.871 + case EADllPanicResetWithNoGc:
1.872 + iGc->Reset();
1.873 + break;
1.874 + case EADllPanicMapColorsWithNoGc:
1.875 + {
1.876 + TRgb rgbs[2];
1.877 + TRect rect;
1.878 + iGc->MapColors(rect, rgbs, 1, ETrue);
1.879 + }
1.880 + break;
1.881 + case EADllPanicDrawTextWithRectWithNoFont:
1.882 + iWindowFunctions->ActivateGc();
1.883 + iGc->DrawText(_L("Panic"),TRect(20,20,20,20),0);
1.884 + break;
1.885 + case EADllPanicDrawTextVerticalWithNoFont:
1.886 + iWindowFunctions->ActivateGc();
1.887 + iGc->DrawTextVertical(_L("Panic"),TPoint(20,20), EFalse);
1.888 + break;
1.889 + case EADllPanicDrawTextVerticalWithRectWithNoFont:
1.890 + iWindowFunctions->ActivateGc();
1.891 + iGc->DrawTextVertical(_L("Panic"),TRect(20,20,20,20), 0, EFalse);
1.892 + break;
1.893 + case EADllPanicInvalidFocusScreenTooBig:
1.894 + (static_cast<MAnimGeneralFunctionsWindowExtension*>(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface)))->SetFocusScreen(3000);
1.895 + break;
1.896 + case EADllPanicInvalidFocusScreenNegative:
1.897 + (static_cast<MAnimGeneralFunctionsWindowExtension*>(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface)))->SetFocusScreen(-1);
1.898 + break;
1.899 + default:
1.900 + iFunctions->Panic();
1.901 + }
1.902 + }
1.903 +
1.904 +void CPanicAnim::DoLeaveInActiveCallback()
1.905 + {
1.906 + iWindowFunctions->ActivateGc();
1.907 + User::Leave(KErrUnknown);
1.908 + }
1.909 +
1.910 +TInt CPanicAnim::LeaveInActiveCallback(TAny *aThis)
1.911 + {
1.912 + CPanicAnim* panicAnim=(CPanicAnim*)aThis;
1.913 + panicAnim->DoLeaveInActiveCallback();
1.914 + return(KErrNone);
1.915 + }
1.916 +
1.917 +void CPanicAnim::StartSyncTest(MAnimGeneralFunctions::TAnimSync aSync)
1.918 + {
1.919 + iFunctions->SetSync(aSync);
1.920 + iSyncMode=aSync;
1.921 + iSyncState=ESyncStateStarting;
1.922 + }
1.923 +
1.924 +void CPanicAnim::StartTimeChangeTest()
1.925 + {
1.926 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.927 + iSyncMode=MAnimGeneralFunctions::ESyncSecond;
1.928 + iSyncState=ESyncStateTimeChange1;
1.929 + }
1.930 +
1.931 +TInt CPanicAnim::CommandReplyL(TInt aOpcode,TAny* aParams)
1.932 + {
1.933 + TAnimArgUnion pData;
1.934 + pData.any=aParams;
1.935 + switch(aOpcode)
1.936 + {
1.937 + case EADllPanicBadFont:
1.938 + iFunctions->DuplicateFontL(123);
1.939 + break;
1.940 + case EADllPanicBadBitmap:
1.941 + iFunctions->DuplicateBitmapL(123);
1.942 + break;
1.943 + case EADllPanicCallPanic:
1.944 + iFunctions->Panic();
1.945 + break;
1.946 + case EADllReadRemoteDescriptor:
1.947 + {
1.948 + TInt ret=0;
1.949 + const RMessagePtr2& message=*iFunctions->Message();
1.950 + TInt bufLength = message.GetDesLength(KIpcSlot);
1.951 + TUint16* heapCell=static_cast<TUint16*>(User::AllocL(bufLength*2));
1.952 + TPtr buf(heapCell,bufLength*2,bufLength*2);
1.953 + const TInt theError=message.Read(KIpcSlot,buf);
1.954 + if(theError == KErrNone)
1.955 + {
1.956 + for (TInt index=0;index<bufLength;index++)
1.957 + {
1.958 + ret+=buf[index];
1.959 + }
1.960 + }
1.961 + User::Free(heapCell);
1.962 + return(ret);
1.963 + }
1.964 + case EADllTestWindowSize:
1.965 + return(*pData.Size==iWindowFunctions->WindowSize());
1.966 + case EADllSyncTests:
1.967 + iStatusPtr=pData.SyncTests->status;
1.968 + StartSyncTest(pData.SyncTests->syncMode);
1.969 + break;
1.970 + case EADllTimeChangedTest:
1.971 + iStatusPtr=pData.TimeChangeTest->status;
1.972 + iStatusPtr2=pData.TimeChangeTest->status2;
1.973 + StartTimeChangeTest();
1.974 + break;
1.975 + case EADllTestSetVisible:
1.976 + if (iWindowFunctions->IsHidden())
1.977 + goto setVisFailed;
1.978 + iWindowFunctions->SetVisible(EFalse);
1.979 + if (!iWindowFunctions->IsHidden())
1.980 + goto setVisFailed;
1.981 + iWindowFunctions->SetVisible(ETrue);
1.982 + if (iWindowFunctions->IsHidden())
1.983 +setVisFailed: return(EFalse);
1.984 + return(ETrue);
1.985 + case EADllPanicSetVisWithGcActiveReply:
1.986 + iWindowFunctions->ActivateGc();
1.987 + iWindowFunctions->SetVisible(EFalse);
1.988 + iWindowFunctions->SetVisible(ETrue);
1.989 + break;
1.990 + case EADllPanicSetClippingRegionWithNoGc:
1.991 + {
1.992 + // currently this test fails because when deactivated iWin is also NULL and is deferenced in function
1.993 + RRegion region;
1.994 + TBool err = iGc->SetClippingRegion(region);
1.995 + }
1.996 + break;
1.997 + case EADllPanicDrawPolygonPointsWithNoGc:
1.998 + {
1.999 + TRect rect(20,20,20,20);
1.1000 + CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
1.1001 + CleanupStack::PushL(polyPoints);
1.1002 + polyPoints->AppendL(rect.iTl);
1.1003 + polyPoints->AppendL(rect.Center());
1.1004 + polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
1.1005 + iGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
1.1006 + CleanupStack::PopAndDestroy(polyPoints);
1.1007 + }
1.1008 + break;
1.1009 + case EADllPanicDrawPolygonArrayWithNoGc:
1.1010 + {
1.1011 + TRect rect(20,20,20,20);
1.1012 + CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
1.1013 + CleanupStack::PushL(polyPoints);
1.1014 + polyPoints->AppendL(rect.iTl);
1.1015 + polyPoints->AppendL(rect.Center());
1.1016 + polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
1.1017 + iGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
1.1018 + CleanupStack::PopAndDestroy(polyPoints);
1.1019 + }
1.1020 + break;
1.1021 + case EADllPanicAlphaBlendingBitmapsFbsBitmapWithNoGc:
1.1022 + {
1.1023 + TRect rect(20,20,20,20);
1.1024 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.1025 + CleanupStack::PushL(bitmap);
1.1026 + User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1.1027 + iGc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, rect, bitmap, TPoint(0,0));
1.1028 + CleanupStack::PopAndDestroy(bitmap);
1.1029 + }
1.1030 + break;
1.1031 + case EADllPanicDevice:
1.1032 + {
1.1033 + CGraphicsDevice *device = iGc->Device();
1.1034 + }
1.1035 + break;
1.1036 + default:
1.1037 + iFunctions->Panic();
1.1038 + }
1.1039 + return(KErrNone);
1.1040 + }
1.1041 +
1.1042 +void CPanicAnim::FocusChanged(TBool )
1.1043 + {
1.1044 + }
1.1045 +
1.1046 +TBool CPanicAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1.1047 + {
1.1048 + return EFalse;
1.1049 + }
1.1050 +
1.1051 +
1.1052 +// CPanicAnim2 simply panics in the construct //
1.1053 +void CPanicAnim2::ConstructL(TAny *, TBool )
1.1054 + {
1.1055 + iFunctions->Panic();
1.1056 + }
1.1057 +
1.1058 +void CPanicAnim2::Animate(TDateTime *)
1.1059 + {}
1.1060 +
1.1061 +void CPanicAnim2::Redraw()
1.1062 + {}
1.1063 +
1.1064 +void CPanicAnim2::Command(TInt , TAny *)
1.1065 + {}
1.1066 +
1.1067 +TInt CPanicAnim2::CommandReplyL(TInt , TAny *)
1.1068 + {return(0);}
1.1069 +
1.1070 +void CPanicAnim2::FocusChanged(TBool )
1.1071 + {}
1.1072 +
1.1073 +TBool CPanicAnim2::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1.1074 + {
1.1075 + return EFalse;
1.1076 + }
1.1077 +
1.1078 +
1.1079 +// CAutoAnim3 test drawing/redrawing //
1.1080 +void CAutoAnim3::ConstructL(TAny *aParam, TBool )
1.1081 + {
1.1082 + iRect=*((TRect *)aParam);
1.1083 + iWindowFunctions->SetRect(iRect);
1.1084 + iMode=0;
1.1085 + iWindowFunctions->Invalidate(iRect);
1.1086 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.1087 + }
1.1088 +
1.1089 +void CAutoAnim3::Animate(TDateTime *)
1.1090 + {
1.1091 + iWindowFunctions->ActivateGc();
1.1092 + if (iMode==1)
1.1093 + {
1.1094 + Draw(iRect);
1.1095 + if (iRect.Width()>20 && iRect.Height()>20)
1.1096 + iRect.Shrink(TSize(20,20));
1.1097 + else
1.1098 + iRect=iBaseRect;
1.1099 + Draw(iRect);
1.1100 + }
1.1101 + else if (iMode==2)
1.1102 + {
1.1103 + Draw(iRect);
1.1104 + iFunctions->Client().RequestComplete(iStatusPtr,KErrNone);
1.1105 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1.1106 + }
1.1107 + else if (iMode==3)
1.1108 + {
1.1109 + // flip between two sizes
1.1110 + if (iRect.iTl.iX == 10)
1.1111 + iRect.SetRect(40,40,80,80);
1.1112 + else
1.1113 + iRect.SetRect(10,10,110,110);
1.1114 + Draw(iRect);
1.1115 + }
1.1116 + }
1.1117 +
1.1118 +void CAutoAnim3::Draw(const TRect &aRect)
1.1119 + {
1.1120 + switch(iMode)
1.1121 + {
1.1122 + case 0:
1.1123 + iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
1.1124 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.1125 + iGc->SetBrushColor(TRgb::Gray256(85));
1.1126 + iGc->SetPenColor(TRgb::Gray256(170));
1.1127 + iGc->DrawEllipse(aRect);
1.1128 + iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1.1129 + break;
1.1130 + case 1: // Shrinking box
1.1131 + iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
1.1132 + iGc->SetPenColor(TRgb::Gray256(255));
1.1133 + iGc->DrawRect(aRect);
1.1134 + break;
1.1135 + case 2:
1.1136 + case 3:
1.1137 + iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
1.1138 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.1139 + iGc->SetBrushColor(TRgb::Gray256(85));
1.1140 + iGc->SetPenColor(TRgb::Gray256(170));
1.1141 + iGc->DrawEllipse(aRect);
1.1142 + iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1.1143 + break;
1.1144 + default:
1.1145 + break;
1.1146 + }
1.1147 + }
1.1148 +
1.1149 +void CAutoAnim3::Redraw()
1.1150 + {
1.1151 + Draw(iRect);
1.1152 + }
1.1153 +
1.1154 +void CAutoAnim3::Command(TInt aOpcode,TAny* aParam)
1.1155 + {
1.1156 + TAnimArgUnion pData;
1.1157 + pData.any=aParam;
1.1158 + switch(aOpcode)
1.1159 + {
1.1160 + case EADllSetRect:
1.1161 + iWindowFunctions->ActivateGc();
1.1162 + Draw(iRect);
1.1163 + iRect=*pData.Rect;
1.1164 + iWindowFunctions->SetRect(iRect);
1.1165 + Draw(iRect);
1.1166 + { //Do more extensive testing
1.1167 + TWindowInfo data;
1.1168 + iWindowFunctions->Parameters(data);
1.1169 + }
1.1170 + break;
1.1171 + case EADllStartAnimate:
1.1172 + iWindowFunctions->ActivateGc();
1.1173 + Draw(iRect);
1.1174 + iMode=1;
1.1175 + iBaseRect=*pData.Rect;
1.1176 + iRect=iBaseRect;
1.1177 + iWindowFunctions->SetRect(iRect);
1.1178 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.1179 + Draw(iRect);
1.1180 + break;
1.1181 + case EADllCancelAnimate:
1.1182 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1.1183 + iWindowFunctions->ActivateGc();
1.1184 + Draw(iRect);
1.1185 + iMode=-1;
1.1186 + break;
1.1187 + case EADllSetVisible:
1.1188 + iWindowFunctions->SetVisible(*pData.Bool);
1.1189 + break;
1.1190 + case EADllSetShadowDrawMode:
1.1191 + iMode=2;
1.1192 + break;
1.1193 + case EADllDrawTestScreen:
1.1194 + DrawTestScreenL(pData.DrawTestScreen); //Should move to CommandReplyL as it leaves
1.1195 + break;
1.1196 + case EADllSetMode:
1.1197 + iMode = *pData.Int;
1.1198 + break;
1.1199 + }
1.1200 + }
1.1201 +
1.1202 +TInt CAutoAnim3::CommandReplyL(TInt aOpcode, TAny *aParam)
1.1203 + {
1.1204 + TAnimArgUnion pData;
1.1205 + pData.any = aParam;
1.1206 + TInt ret=0;
1.1207 + switch(aOpcode)
1.1208 + {
1.1209 + case EADllShadowAnimTest:
1.1210 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.1211 + iStatusPtr=((TShadowDrawTest *)aParam)->status;
1.1212 + break;
1.1213 + case EADllParameterRectValueTest:
1.1214 + {
1.1215 + TWindowInfo wininf;
1.1216 + iWindowFunctions->Parameters(wininf);
1.1217 + TRect comp = *(pData.Rect);
1.1218 + ret=(comp==wininf.iScreenPos);
1.1219 + }
1.1220 + break;
1.1221 + case EADllDoSetSync:
1.1222 + iFunctions->SetSync(static_cast<MAnimGeneralFunctions::TAnimSync>(*pData.Int));
1.1223 + break;
1.1224 + case EADllSetInterval:
1.1225 + iFunctions->SetInterval(*pData.Int);
1.1226 + break;
1.1227 + }
1.1228 + return(ret);
1.1229 + }
1.1230 +
1.1231 +void CAutoAnim3::FocusChanged(TBool )
1.1232 + {}
1.1233 +
1.1234 +//void CAutoAnim3::DrawTestScreen(TDrawTestScreen *aParams)
1.1235 +//Function now at bottom of file
1.1236 +
1.1237 +TBool CAutoAnim3::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1.1238 + {
1.1239 + return EFalse;
1.1240 + }
1.1241 +
1.1242 +
1.1243 +// CAutoAnimScrBack test drawing/redrawing //
1.1244 +void CAutoAnimScrBack::ConstructL(TAny *aParam, TBool )
1.1245 + {
1.1246 + iRect=*((TRect *)aParam);
1.1247 + iWindowFunctions->SetRect(iRect);
1.1248 + iMode=1;
1.1249 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.1250 + }
1.1251 +
1.1252 +void CAutoAnimScrBack::Animate(TDateTime *)
1.1253 + {
1.1254 + iWindowFunctions->ActivateGc();
1.1255 + Draw();
1.1256 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1.1257 + }
1.1258 +
1.1259 +void CAutoAnimScrBack::Draw()
1.1260 + {
1.1261 + iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
1.1262 + if (iMode==2)
1.1263 + iGc->SetPenSize(TSize(3,3));
1.1264 + iGc->SetPenColor(TRgb::Gray4(iMode==1 ? 2 : 3));
1.1265 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.1266 + iGc->SetBrushColor(TRgb::Gray4(iMode==1 ? 1 : 0));
1.1267 + iGc->DrawRect(iRect);
1.1268 + }
1.1269 +
1.1270 +void CAutoAnimScrBack::Redraw()
1.1271 + {
1.1272 + Draw();
1.1273 + }
1.1274 +
1.1275 +void CAutoAnimScrBack::Command(TInt aOpcode,TAny* aParam)
1.1276 + {
1.1277 + TAnimArgUnion pData;
1.1278 + pData.any=aParam;
1.1279 + switch(aOpcode)
1.1280 + {
1.1281 + case EADllDrawOtherRect:
1.1282 + {
1.1283 + TRect oldRect(iRect);
1.1284 + if (iMode==2)
1.1285 + oldRect.Grow(1,1); // To allow for 3x3 pen size
1.1286 + iMode=2;
1.1287 + iRect=*pData.Rect;
1.1288 + TRect fullRect(iRect);
1.1289 + fullRect.Grow(1,1); // To allow for 3x3 pen size
1.1290 + iWindowFunctions->Invalidate(oldRect);
1.1291 + iWindowFunctions->SetRect(fullRect);
1.1292 + iWindowFunctions->Invalidate(fullRect);
1.1293 + }
1.1294 +// iFunctions->ActivateGc();
1.1295 +// Draw();
1.1296 + break;
1.1297 + }
1.1298 + }
1.1299 +
1.1300 +TInt CAutoAnimScrBack::CommandReplyL(TInt aOpcode, TAny *)
1.1301 + {
1.1302 + switch(aOpcode)
1.1303 + {
1.1304 + case EADllIsHidden:
1.1305 + return iWindowFunctions->IsHidden();
1.1306 + }
1.1307 + return(0);
1.1308 + }
1.1309 +
1.1310 +void CAutoAnimScrBack::FocusChanged(TBool )
1.1311 + {}
1.1312 +
1.1313 +TBool CAutoAnimScrBack::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1.1314 + {
1.1315 + return EFalse;
1.1316 + }
1.1317 +
1.1318 +
1.1319 +// CTestSpriteAnim test sprite access //
1.1320 +void CTestSpriteAnim::ConstructL(TAny* /*aParam*/)
1.1321 + {
1.1322 + iSpriteFunctions->SizeChangedL();
1.1323 + iSpriteFunctions->Activate(ETrue);
1.1324 + }
1.1325 +
1.1326 +void CTestSpriteAnim::Animate(TDateTime*)
1.1327 + {
1.1328 + }
1.1329 +
1.1330 +void CTestSpriteAnim::Command(TInt aOpcode,TAny* aParam)
1.1331 + {
1.1332 + TAnimArgUnion pData;
1.1333 + pData.any=aParam;
1.1334 + switch (aOpcode)
1.1335 + {
1.1336 + case EADllSizeChanged:
1.1337 + iSpriteFunctions->Activate(EFalse);
1.1338 + iSpriteFunctions->SizeChangedL(); //Should move to CommandReplyL as it leaves
1.1339 + case EADllActivate:
1.1340 + iSpriteFunctions->Activate(ETrue);
1.1341 + break;
1.1342 + case EADllDeactivate:
1.1343 + iSpriteFunctions->Activate(EFalse);
1.1344 + break;
1.1345 + case EADllSetPos:
1.1346 + iSpriteFunctions->SetPosition(*pData.Point);
1.1347 + break;
1.1348 + case EADllDraw1:
1.1349 + case EADllDraw2:
1.1350 + case EADllDraw3:
1.1351 + DrawMemberL(aOpcode-EADllDraw1); //Should move to CommandReplyL as it leaves
1.1352 + break;
1.1353 + case EADllIncDraw:
1.1354 + DrawMemberL(); //Should move to CommandReplyL as it leaves
1.1355 + break;
1.1356 + default:;
1.1357 + }
1.1358 + }
1.1359 +
1.1360 +TInt CTestSpriteAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
1.1361 + {
1.1362 + TAnimArgUnion pData;
1.1363 + pData.any=aParam;
1.1364 + switch (aOpcode)
1.1365 + {
1.1366 + case EADllCheckMember:
1.1367 + return CheckMember(*pData.SpriteMemberInfo);
1.1368 + default:;
1.1369 + }
1.1370 + return(KErrNone);
1.1371 + }
1.1372 +
1.1373 +TBool CTestSpriteAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1.1374 + {
1.1375 + return EFalse;
1.1376 + }
1.1377 +
1.1378 +TBool CTestSpriteAnim::CheckMember(const TSpriteMemberInfo& aMemInfo)
1.1379 + {
1.1380 + TSpriteMember spriteMember=*iSpriteFunctions->GetSpriteMember(aMemInfo.iMember);
1.1381 + if (spriteMember.iBitmap->Handle()!=aMemInfo.iBitmapHandle)
1.1382 + return EFalse;
1.1383 + if (aMemInfo.iMaskBitmapHandle==0)
1.1384 + {
1.1385 + if (spriteMember.iMaskBitmap!=NULL)
1.1386 + return EFalse;
1.1387 + }
1.1388 + else
1.1389 + {
1.1390 + if (spriteMember.iMaskBitmap->Handle()!=aMemInfo.iMaskBitmapHandle)
1.1391 + return EFalse;
1.1392 + }
1.1393 + if (spriteMember.iInvertMask!=aMemInfo.iInvertMask)
1.1394 + return EFalse;
1.1395 + if (spriteMember.iDrawMode!=aMemInfo.iDrawMode)
1.1396 + return EFalse;
1.1397 + if (spriteMember.iOffset!=aMemInfo.iOffset)
1.1398 + return EFalse;
1.1399 + if (spriteMember.iInterval!=aMemInfo.iInterval)
1.1400 + return EFalse;
1.1401 + return ETrue;
1.1402 + }
1.1403 +
1.1404 +void CTestSpriteAnim::DrawMemberL(TInt aMember)
1.1405 + {
1.1406 + CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(aMember)->iBitmap;
1.1407 + CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
1.1408 + CleanupStack::PushL(device);
1.1409 + CFbsBitGc *gc;
1.1410 + User::LeaveIfError(device->CreateContext(gc));
1.1411 + CleanupStack::PushL(gc);
1.1412 + //gc->SetBrushColor(TRgb::Gray4((aMember+1)%3));
1.1413 + gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.1414 + gc->SetPenSize(TSize());
1.1415 + TSize size=bitmap->SizeInPixels();
1.1416 + size.SetSize(size.iWidth/2,size.iHeight/2);
1.1417 + TPoint point=size.AsPoint();
1.1418 + gc->SetBrushColor(TRgb::Gray4(0));
1.1419 + //TRect rect=bitmap->SizeInPixels();
1.1420 + gc->DrawRect(TRect(TPoint(),size));
1.1421 + gc->SetBrushColor(TRgb::Gray4(1));
1.1422 + gc->DrawRect(TRect(TPoint(point.iX,0),size));
1.1423 + gc->SetBrushColor(TRgb::Gray4(2));
1.1424 + gc->DrawRect(TRect(TPoint(0,point.iY),size));
1.1425 + gc->SetBrushColor(TRgb::Gray4(3));
1.1426 + gc->DrawRect(TRect(point,size));
1.1427 + iSpriteFunctions->UpdateMember(aMember,TRect(bitmap->SizeInPixels()),ETrue);
1.1428 + CleanupStack::PopAndDestroy(2);
1.1429 + }
1.1430 +
1.1431 +void CTestSpriteAnim::DrawMemberL()
1.1432 + {
1.1433 + CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(0)->iBitmap;
1.1434 + CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
1.1435 + CleanupStack::PushL(device);
1.1436 + CFbsBitGc *gc;
1.1437 + User::LeaveIfError(device->CreateContext(gc));
1.1438 + CleanupStack::PushL(gc);
1.1439 + gc->SetPenSize(TSize(3,3));
1.1440 + gc->SetPenColor(TRgb::Gray4(1));
1.1441 + TPoint corner=bitmap->SizeInPixels().AsPoint();
1.1442 + gc->DrawLine(TPoint(),corner);
1.1443 + gc->DrawLine(TPoint(0,corner.iY),TPoint(corner.iX,0));
1.1444 + iSpriteFunctions->UpdateMember(0,TRect(bitmap->SizeInPixels()),EFalse);
1.1445 + CleanupStack::PopAndDestroy(2);
1.1446 + }
1.1447 +
1.1448 +
1.1449 +// CTestFreeTimerAnim test drawing off own timer //
1.1450 +CTestFreeTimerAnim::~CTestFreeTimerAnim()
1.1451 + {
1.1452 + iTimer->Cancel();
1.1453 + delete iTimer;
1.1454 + }
1.1455 +
1.1456 +void CTestFreeTimerAnim::ConstructL(TAny* /*aParam*/, TBool )
1.1457 + {
1.1458 + User::LeaveIfNull(iFunctions);
1.1459 + User::LeaveIfNull(iWindowFunctions);
1.1460 +
1.1461 + //Configure free-timer anim (these values should be the default ones)
1.1462 + iFunctions->SetSync( MAnimGeneralFunctions::ESyncNone );
1.1463 + iFunctions->SetInterval(0);
1.1464 +
1.1465 + iFrameTime = 100000; //default frametime 0.1s
1.1466 + iTimer = CAnimTimer::NewL(*this);
1.1467 + iRect = iWindowFunctions->WindowSize();
1.1468 + }
1.1469 +
1.1470 +#define MAX(a,b) (((a)>(b))?(a):(b))
1.1471 +
1.1472 +void CTestFreeTimerAnim::Animate(TDateTime*)
1.1473 + {
1.1474 + TInt max = MAX(iRect.Width(), iRect.Height());
1.1475 + if(max <= 0)
1.1476 + {
1.1477 + iRect = iWindowFunctions->WindowSize();
1.1478 + }
1.1479 + else
1.1480 + {
1.1481 + iRect.Shrink(1,1);
1.1482 + }
1.1483 +
1.1484 + //change colour
1.1485 + switch(iColour.Value())
1.1486 + {
1.1487 + case 0x000000: //black
1.1488 + case 0xffffff: //white
1.1489 + iColour = KRgbRed;
1.1490 + break;
1.1491 + case 0x0000ff: //red
1.1492 + iColour = KRgbGreen;
1.1493 + break;
1.1494 + case 0x00ff00: //green
1.1495 + iColour = KRgbBlue;
1.1496 + break;
1.1497 + case 0xff0000: //blue
1.1498 + iColour = KRgbBlack;
1.1499 + break;
1.1500 + }
1.1501 + }
1.1502 +
1.1503 +void CTestFreeTimerAnim::Redraw()
1.1504 + {
1.1505 + //draw something in the animated colour
1.1506 + iGc->SetBrushColor(iColour);
1.1507 + iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1.1508 + iGc->SetPenColor(KRgbBlack);
1.1509 + iGc->DrawRect(iRect);
1.1510 + }
1.1511 +
1.1512 +void CTestFreeTimerAnim::Command(TInt aOpcode, TAny* aArgs)
1.1513 + {
1.1514 + switch(aOpcode)
1.1515 + {
1.1516 + case EStartAnimation:
1.1517 + DisplayNextFrameL();
1.1518 + break;
1.1519 + case EStopAnimation:
1.1520 + iTimer->Cancel();
1.1521 + break;
1.1522 + case ESetFrameTime:
1.1523 + ASSERT(aArgs);
1.1524 + iFrameTime = *reinterpret_cast<TInt*>(aArgs);
1.1525 + break;
1.1526 + default:
1.1527 + ASSERT(0);
1.1528 + }
1.1529 + }
1.1530 +
1.1531 +TInt CTestFreeTimerAnim::CommandReplyL(TInt aOpcode, TAny* aArgs)
1.1532 + {
1.1533 + switch(aOpcode)
1.1534 + {
1.1535 + case EStartAnimation:
1.1536 + DisplayNextFrameL();
1.1537 + break;
1.1538 + case EStopAnimation:
1.1539 + iTimer->Cancel();
1.1540 + break;
1.1541 + case ESetFrameTime:
1.1542 + ASSERT(aArgs);
1.1543 + iFrameTime = *reinterpret_cast<TInt*>(aArgs);
1.1544 + break;
1.1545 + default:
1.1546 + ASSERT(0);
1.1547 + }
1.1548 + return(KErrNone);
1.1549 + }
1.1550 +
1.1551 +void CTestFreeTimerAnim::FocusChanged(TBool /*aState*/)
1.1552 + {
1.1553 + }
1.1554 +
1.1555 +TBool CTestFreeTimerAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1.1556 + {
1.1557 + return EFalse;
1.1558 + }
1.1559 +
1.1560 +
1.1561 +void CTestFreeTimerAnim::DisplayNextFrameL()
1.1562 + {
1.1563 + //Reschedule timer callback
1.1564 + iTimer->Cancel();
1.1565 + iTimer->After(iFrameTime);
1.1566 +
1.1567 + Animate(NULL); //wserv don't animate free-timer animations
1.1568 +
1.1569 + //Schedule wserv redraw
1.1570 + MAnimFreeTimerWindowFunctions* windowFunctions = WindowFunctions();
1.1571 + ASSERT(windowFunctions);
1.1572 + windowFunctions->ActivateGc();
1.1573 + windowFunctions->DeactivateGc();
1.1574 + windowFunctions->Update();
1.1575 + }
1.1576 +
1.1577 +//
1.1578 +// CAnimTimer class
1.1579 +//
1.1580 +
1.1581 +/**
1.1582 + Constructs a new bitmap animation timer object,and adds the specified active object to the current active scheduler.
1.1583 +
1.1584 +@param aObserver a pointer to MAnimTimerObserver
1.1585 +*/
1.1586 +CAnimTimer::CAnimTimer(MAnimTimerObserver& aObserver)
1.1587 + :CTimer(EPriorityStandard),
1.1588 + iAnim(aObserver)
1.1589 + {
1.1590 + CActiveScheduler::Add(this);
1.1591 + }
1.1592 +
1.1593 +/**
1.1594 + Frees resources owned by the object prior to deletion.
1.1595 +*/
1.1596 +CAnimTimer::~CAnimTimer()
1.1597 + {
1.1598 + }
1.1599 +
1.1600 +/**
1.1601 + Creates a new bitmap animation timer object.
1.1602 +
1.1603 +@param aObserver A pointer to the MAnimTimerObserver
1.1604 +@return A pointer to the new bitmap animation timer object.
1.1605 +*/
1.1606 +CAnimTimer* CAnimTimer::NewL(MAnimTimerObserver& aObserver)
1.1607 + {
1.1608 + CAnimTimer* timer=new(ELeave) CAnimTimer(aObserver);
1.1609 + CleanupStack::PushL(timer);
1.1610 + timer->ConstructL();
1.1611 + CleanupStack::Pop();
1.1612 + return timer;
1.1613 + }
1.1614 +
1.1615 +/**
1.1616 + Completes construction of the bitmap animation timer object and
1.1617 + constructs a new asynchronous timer.
1.1618 +*/
1.1619 +void CAnimTimer::ConstructL()
1.1620 + {
1.1621 + CTimer::ConstructL();
1.1622 + }
1.1623 +
1.1624 +/**
1.1625 + Handles an active object's request completion event.
1.1626 + Invokes the function to draw the next frame
1.1627 +*/
1.1628 +void CAnimTimer::RunL()
1.1629 + {
1.1630 + iAnim.DisplayNextFrameL();
1.1631 + }
1.1632 +
1.1633 +// CEventTestAnimBase base class for event test anims //
1.1634 +CEventTestAnimBase::~CEventTestAnimBase()
1.1635 + {
1.1636 + iFunctions->GetRawEvents(EFalse);
1.1637 + }
1.1638 +
1.1639 +void CEventTestAnimBase::ConstructL(TAny* /*aParam*/, TBool )
1.1640 + {
1.1641 + iExpectedEvents.SetLengthL(EEventBufferSize);
1.1642 + }
1.1643 +
1.1644 +void CEventTestAnimBase::Animate(TDateTime*)
1.1645 + {
1.1646 + }
1.1647 +
1.1648 +void CEventTestAnimBase::Redraw()
1.1649 + {
1.1650 + }
1.1651 +
1.1652 +void CEventTestAnimBase::Command(TInt /*aOpcode*/, TAny* /*aParam*/)
1.1653 + {
1.1654 + /*switch (aOpcode)
1.1655 + {
1.1656 + default:;
1.1657 + }*/
1.1658 + }
1.1659 +
1.1660 +void CEventTestAnimBase::FocusChanged(TBool /*aState*/)
1.1661 + {
1.1662 + }
1.1663 +
1.1664 +// Base class common client server interface
1.1665 +TInt CEventTestAnimBase::CommandReplyL(TInt aOpcode,TAny* aParam)
1.1666 + {
1.1667 + TAnimArgUnion pData;
1.1668 + pData.any=aParam;
1.1669 + switch (aOpcode)
1.1670 + {
1.1671 + case EADllAddExpectedEvent:
1.1672 + return AddExpectedEvent(pData.AnimRawEvent);
1.1673 + case EADllNumberOfEventsReceived:
1.1674 + return iEventCount;
1.1675 + case EADllErrorCode:
1.1676 + return iError;
1.1677 + case EADllReset:
1.1678 + iExpectedEvents.Reset();
1.1679 + iError = 0;
1.1680 + iEventCount = 0;
1.1681 + return KErrNone;
1.1682 + default:;
1.1683 + }
1.1684 + return(KErrNone);
1.1685 + }
1.1686 +
1.1687 +TBool CEventTestAnimBase::HandleRecursiveEvent(const TRawEvent& aRawEvent)
1.1688 + {
1.1689 + if (aRawEvent.ScanCode() == 60)
1.1690 + {
1.1691 + TRawEvent rawEvent;
1.1692 + rawEvent.Set(TRawEvent::EKeyUp, 34);
1.1693 + iFunctions->PostRawEvent(rawEvent);
1.1694 + rawEvent.Set(TRawEvent::EKeyUp, 35);
1.1695 + iFunctions->PostRawEvent(rawEvent);
1.1696 + return ETrue;
1.1697 + }
1.1698 + return EFalse;
1.1699 + }
1.1700 +
1.1701 +TBool CEventTestAnimBase::OfferRawEvent(const TRawEvent& aRawEvent)
1.1702 + {
1.1703 + // Do not consume the following types of events
1.1704 + if (IsIgnorableEvent(aRawEvent))
1.1705 + {
1.1706 + return EFalse;
1.1707 + }
1.1708 +
1.1709 + // Increment event count if not in an error state
1.1710 + if (!Error())
1.1711 + {
1.1712 + iEventCount++;
1.1713 + }
1.1714 +
1.1715 + // For anim which generates recursive events
1.1716 + if (aRawEvent.Type() == TRawEvent::EKeyDown && aRawEvent.ScanCode() == 60)
1.1717 + {
1.1718 + return HandleRecursiveEvent(aRawEvent);
1.1719 + }
1.1720 +
1.1721 + TAnimRawEvent event;
1.1722 +
1.1723 + if (!GetNextExpectedEvent(event))
1.1724 + {
1.1725 + Fail();
1.1726 + return EFalse;
1.1727 + }
1.1728 +
1.1729 + // Fail if wrong event type
1.1730 + if (!CompareEvents(event.iRawEvent, aRawEvent))
1.1731 + {
1.1732 + Fail();
1.1733 + }
1.1734 +
1.1735 + return event.iEat;
1.1736 + }
1.1737 +
1.1738 +TBool CEventTestAnimBase::GetNextExpectedEvent(TAnimRawEvent& aRawEvent)
1.1739 + {
1.1740 + // Get next expected event
1.1741 + if (iExpectedEvents.Remove(&aRawEvent)<1)
1.1742 + {
1.1743 + Fail();
1.1744 + return EFalse;
1.1745 + }
1.1746 + else
1.1747 + {
1.1748 + return ETrue;
1.1749 + }
1.1750 + }
1.1751 +
1.1752 +TBool CEventTestAnimBase::IsIgnorableEvent(const TRawEvent& aRawEvent) const
1.1753 + {
1.1754 + TRawEvent::TType aType=aRawEvent.Type();
1.1755 + TBool result = (aType==TRawEvent::EActive || aType==TRawEvent::EInactive || aType==TRawEvent::ERedraw
1.1756 + || (iExpectedEvents.Count()==0 && aType==TRawEvent::EPointerMove));
1.1757 +
1.1758 + return result;
1.1759 + }
1.1760 +
1.1761 +TBool CEventTestAnimBase::CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent) const
1.1762 + {
1.1763 + TRawEvent::TType eType=aExpectedEvent.Type();
1.1764 + TRawEvent::TType aType=aActualEvent.Type();
1.1765 + if (eType!=aType)
1.1766 + {
1.1767 + return EFalse;
1.1768 + }
1.1769 + else
1.1770 + {
1.1771 + switch (aType)
1.1772 + {
1.1773 + case TRawEvent::EUpdateModifiers:
1.1774 + {
1.1775 + TInt eMod=aExpectedEvent.Modifiers(),aMod=aActualEvent.Modifiers();
1.1776 + if (eMod!=aMod)
1.1777 + {
1.1778 + return EFalse;
1.1779 + }
1.1780 + break;
1.1781 + }
1.1782 + case TRawEvent::EKeyDown:
1.1783 + case TRawEvent::EKeyUp:
1.1784 + {
1.1785 + TInt eScan=aExpectedEvent.ScanCode(),aScan=aActualEvent.ScanCode();
1.1786 + if (eScan!=aScan)
1.1787 + {
1.1788 + return EFalse;
1.1789 + }
1.1790 + break;
1.1791 + }
1.1792 + case TRawEvent::EPointerMove:
1.1793 + case TRawEvent::EPointerSwitchOn:
1.1794 + case TRawEvent::EButton1Down:
1.1795 + case TRawEvent::EButton1Up:
1.1796 + case TRawEvent::EButton2Down:
1.1797 + case TRawEvent::EButton2Up:
1.1798 + case TRawEvent::EButton3Down:
1.1799 + case TRawEvent::EButton3Up:
1.1800 + {
1.1801 + TPoint ePoint=aExpectedEvent.Pos(),aPoint=aActualEvent.Pos();
1.1802 + if (ePoint!=aPoint)
1.1803 + {
1.1804 + return EFalse;
1.1805 + }
1.1806 + break;
1.1807 + }
1.1808 + default:;
1.1809 + }
1.1810 + }
1.1811 + return ETrue;
1.1812 + }
1.1813 +
1.1814 +void CEventTestAnimBase::Fail()
1.1815 + {
1.1816 + if (iError==0)
1.1817 + {
1.1818 + iError=iEventCount;
1.1819 + }
1.1820 + }
1.1821 +
1.1822 +inline TInt CEventTestAnimBase::Error() const
1.1823 + {
1.1824 + return iError;
1.1825 + }
1.1826 +
1.1827 +inline TInt CEventTestAnimBase::EventCount() const
1.1828 + {
1.1829 + return iEventCount;
1.1830 + }
1.1831 +
1.1832 +inline void CEventTestAnimBase::ResetEventCount()
1.1833 + {
1.1834 + iEventCount = 0;
1.1835 + }
1.1836 +
1.1837 +inline TInt CEventTestAnimBase::TotalExpectedEvents() const
1.1838 + {
1.1839 + return iExpectedEvents.Count();
1.1840 + }
1.1841 +
1.1842 +inline TInt CEventTestAnimBase::AddEvent(const TAnimRawEvent* aEvent)
1.1843 + {
1.1844 + return iExpectedEvents.Add(aEvent);
1.1845 + }
1.1846 +
1.1847 +// CEventTestAnim test drawing off own timer //
1.1848 +CEventTestAnim::~CEventTestAnim()
1.1849 + {
1.1850 + UnloadDeviceDriver();
1.1851 + }
1.1852 +
1.1853 +void CEventTestAnim::ConstructL(TAny* aParam, TBool aBool)
1.1854 + {
1.1855 + CEventTestAnimBase::ConstructL(aParam, aBool);
1.1856 + iFunctions->GetRawEvents(ETrue);
1.1857 + iDevDriverLoaded=EFalse;
1.1858 + }
1.1859 +
1.1860 +TInt CEventTestAnim::UnloadDeviceDriver()
1.1861 + {
1.1862 + TInt err=KErrNone;
1.1863 + iLdd.Close();
1.1864 + if (iDevDriverLoaded)
1.1865 + {
1.1866 + err=User::FreeLogicalDevice(REventDD::BinaryName());
1.1867 + if (err==KErrNone)
1.1868 + iDevDriverLoaded=EFalse;
1.1869 + }
1.1870 + return err;
1.1871 + }
1.1872 +
1.1873 +TInt CEventTestAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
1.1874 + {
1.1875 + return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
1.1876 + }
1.1877 +
1.1878 +TInt CEventTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
1.1879 + {
1.1880 + switch (aOpcode)
1.1881 + {
1.1882 + case EADllNoEventsAndReset:
1.1883 + {
1.1884 + TInt events=EventCount();
1.1885 + ResetEventCount();
1.1886 + return events;
1.1887 + }
1.1888 + case EADllLoadDeviceDriver:
1.1889 + {
1.1890 + TInt err=User::LoadLogicalDevice(REventDD::BinaryName());
1.1891 + if (err==KErrNone || err==KErrAlreadyExists)
1.1892 + {
1.1893 + TInt err2=iLdd.Open();
1.1894 + if (err==KErrNone)
1.1895 + {
1.1896 + if (err2==KErrNone)
1.1897 + iDevDriverLoaded=ETrue;
1.1898 + else //Only unload if we loaded it
1.1899 + User::FreeLogicalDevice(REventDD::BinaryName());
1.1900 + }
1.1901 + err=err2;
1.1902 + }
1.1903 + return err;
1.1904 + }
1.1905 + case EADllUnloadDeviceDriver:
1.1906 + return UnloadDeviceDriver();
1.1907 + case EADllSendEvent:
1.1908 + {
1.1909 + TAnimRawEvent event;
1.1910 + TInt events=*static_cast<TInt*>(aParam);
1.1911 + TInt err=KErrNone;
1.1912 + TInt ii;
1.1913 + for (ii=events;ii>0;--ii)
1.1914 + {
1.1915 + event.iRawEvent.Set(ii/2==0 ? TRawEvent::ECaseOpen : TRawEvent::ECaseClose);
1.1916 + //TInt err=UserSvr::AddEvent(event.iRawEvent);
1.1917 + //Need to do the above line here, but don't have enough capability
1.1918 + //so call a device driver to do it instead
1.1919 + err=iLdd.SendEvent(event.iRawEvent);
1.1920 + if (err!=KErrNone)
1.1921 + return err;
1.1922 + event.iEat=ETrue;
1.1923 + AddExpectedEvent(&event);
1.1924 + }
1.1925 + return KErrNone;
1.1926 + }
1.1927 + default:;
1.1928 + return CEventTestAnimBase::CommandReplyL(aOpcode, aParam);
1.1929 + }
1.1930 + }
1.1931 +
1.1932 +void CEventTestAnim::Command(TInt aOpcode,TAny* /*aParam*/)
1.1933 + {
1.1934 + switch (aOpcode)
1.1935 + {
1.1936 + case EADllAfterEvent:
1.1937 + if (TotalExpectedEvents()>0)
1.1938 + Fail();
1.1939 + break;
1.1940 + default:;
1.1941 + }
1.1942 + }
1.1943 +
1.1944 +// CEventPostingAnim test posting of anim events //
1.1945 +CEventPostingAnim::~CEventPostingAnim()
1.1946 + {
1.1947 + }
1.1948 +
1.1949 +void CEventPostingAnim::ConstructL(TAny* aParam, TBool aBool)
1.1950 + {
1.1951 + CEventTestAnimBase::ConstructL(aParam, aBool);
1.1952 + iFunctions->GetRawEvents(ETrue);
1.1953 + }
1.1954 +
1.1955 +TInt CEventPostingAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
1.1956 + {
1.1957 + return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
1.1958 + }
1.1959 +
1.1960 +TBool CEventPostingAnim::OfferRawEvent(const TRawEvent &aRawEvent)
1.1961 + {
1.1962 + // Call PostRawEvent or PostKeyEvent according to type of the event
1.1963 + TBool ret = CEventTestAnimBase::OfferRawEvent(aRawEvent);
1.1964 + if (ret)
1.1965 + {
1.1966 + if (aRawEvent.Type() == TRawEvent::EKeyDown && aRawEvent.ScanCode() == 45)
1.1967 + {
1.1968 + TKeyEvent event;
1.1969 + event.iCode='J';
1.1970 + event.iScanCode=0;
1.1971 + event.iModifiers=0;
1.1972 +
1.1973 + // This is to check the normal PostKeyEvent API
1.1974 + iFunctions->PostKeyEvent(event);
1.1975 +
1.1976 + // This is to check the newly added API
1.1977 + iFunctions->EventExtension()->PostKeyEvent(event, 2);
1.1978 + }
1.1979 + else
1.1980 + {
1.1981 + iFunctions->PostRawEvent(aRawEvent);
1.1982 + }
1.1983 + }
1.1984 + return ret;
1.1985 + }
1.1986 +
1.1987 +// CTimerTestAnim check that timer events stop //
1.1988 +CTimerTestAnim::~CTimerTestAnim()
1.1989 + {
1.1990 + }
1.1991 +
1.1992 +void CTimerTestAnim::ConstructL(TAny* /*aParam*/, TBool )
1.1993 + {
1.1994 + iWindowFunctions->SetRect(TRect(0,0,1,1));
1.1995 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.1996 + iExpectingTicks=ETrue;
1.1997 + iFail=EFalse;
1.1998 + }
1.1999 +
1.2000 +void CTimerTestAnim::Animate(TDateTime*)
1.2001 + {
1.2002 + ++iTimerCount;
1.2003 + if (!iExpectingTicks)
1.2004 + iFail=iTimerCount;
1.2005 + }
1.2006 +
1.2007 +void CTimerTestAnim::Redraw()
1.2008 + {
1.2009 + }
1.2010 +
1.2011 +void CTimerTestAnim::Command(TInt aOpcode, TAny* /*aParam*/)
1.2012 + {
1.2013 + switch (aOpcode)
1.2014 + {
1.2015 + case EADllResetCount:
1.2016 + iTimerCount=0;
1.2017 + break;
1.2018 + case EADllNoTimer:
1.2019 + iExpectingTicks=EFalse;
1.2020 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1.2021 + break;
1.2022 + case EADllTimerStarted:
1.2023 + iExpectingTicks=ETrue;
1.2024 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.2025 + break;
1.2026 + default:;
1.2027 + }
1.2028 + }
1.2029 +
1.2030 +TInt CTimerTestAnim::CommandReplyL(TInt aOpcode, TAny* /*aParam*/)
1.2031 + {
1.2032 + switch (aOpcode)
1.2033 + {
1.2034 + case EADllCurrentCount:
1.2035 + return iTimerCount;
1.2036 + case EADllFailed:
1.2037 + return iFail;
1.2038 + default:;
1.2039 + }
1.2040 + return(KErrNone);
1.2041 + }
1.2042 +
1.2043 +void CTimerTestAnim::FocusChanged(TBool /*aState*/)
1.2044 + {
1.2045 + }
1.2046 +
1.2047 +TBool CTimerTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1.2048 + {
1.2049 + return EFalse;
1.2050 + }
1.2051 +
1.2052 +
1.2053 +// CWinFunctionTestAnim test drawing off own timer //
1.2054 +CWinFunctionTestAnim::~CWinFunctionTestAnim()
1.2055 + {}
1.2056 +
1.2057 +void CWinFunctionTestAnim::ConstructL(TAny* /*aParam*/,TBool)
1.2058 + {
1.2059 + iWinFunctions=static_cast<MAnimGeneralFunctionsWindowExtension*>
1.2060 + (iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface));
1.2061 + }
1.2062 +
1.2063 +void CWinFunctionTestAnim::Animate(TDateTime*)
1.2064 + {}
1.2065 +
1.2066 +void CWinFunctionTestAnim::Redraw()
1.2067 + {}
1.2068 +
1.2069 +void CWinFunctionTestAnim::Command(TInt /*aOpcode*/,TAny* /*aParam*/)
1.2070 + {
1.2071 + /*switch (aOpcode)
1.2072 + {
1.2073 + default:;
1.2074 + }*/
1.2075 + }
1.2076 +
1.2077 +TInt CWinFunctionTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
1.2078 + {
1.2079 + TAnimArgUnion pData;
1.2080 + pData.any=aParam;
1.2081 + switch (aOpcode)
1.2082 + {
1.2083 + case EADllScreen:
1.2084 + return iWinFunctions->Screens();
1.2085 + case EADllFocusScreen:
1.2086 + return iWinFunctions->FocusScreens();
1.2087 + case EADllWindowGroups:
1.2088 + return iWinFunctions->WindowGroups(*pData.Int);
1.2089 + case EADllWindowGroupInfo:
1.2090 + {
1.2091 + const TWindowGroupInfoParms& params=*pData.WindowGroupInfoParms;
1.2092 + TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> info;
1.2093 + TBool ret=iWinFunctions->WindowGroupInfo(info(),params.iScreen,params.iOrdinalPosition);
1.2094 + /*const TInt theError=*/(*iFunctions->Message()).Write(KIpcSlot,info);
1.2095 + return ret;
1.2096 + }
1.2097 + case EADllWindowGroupName:
1.2098 + {
1.2099 + const TWindowGroupInfoParms& params=*pData.WindowGroupInfoParms;
1.2100 + TPtrC name;
1.2101 + TBool ret=iWinFunctions->WindowGroupName(name,params.iScreen,params.iOrdinalPosition);
1.2102 + /*const TInt theError=*/(*iFunctions->Message()).Write(KIpcSlot,name);
1.2103 + return ret;
1.2104 + }
1.2105 + case EADllSetOrdinalPosition:
1.2106 + {
1.2107 + const TSetOrdinalParms& params=*pData.SetOrdinalParms;
1.2108 + return iWinFunctions->SetOrdinalPosition(params.iIdentifier,params.iOrdinalPosition,params.iOrdinalPriority);
1.2109 + }
1.2110 + case EADllSetFocusScreen:
1.2111 + {
1.2112 + const TInt& params=*pData.Int;
1.2113 + iWinFunctions->SetFocusScreen(params);
1.2114 + break;
1.2115 + }
1.2116 + default:;
1.2117 + }
1.2118 + return(KErrNone);
1.2119 + }
1.2120 +
1.2121 +void CWinFunctionTestAnim::FocusChanged(TBool /*aState*/)
1.2122 + {}
1.2123 +
1.2124 +TBool CWinFunctionTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1.2125 + {
1.2126 + return EFalse;
1.2127 + }
1.2128 +
1.2129 +
1.2130 +// CNotificationTestAnim
1.2131 +CNotificationTestAnim::CNotificationTestAnim() : iHeartbeatState(EFalse) , iScreenDeviceChanged(ETrue)
1.2132 + {
1.2133 + }
1.2134 +
1.2135 +CNotificationTestAnim::~CNotificationTestAnim()
1.2136 + {
1.2137 +// Removed for test case GRAPHICS-WSERV-0139 for DEF12220
1.2138 +// iFunctions->RegisterForNotifications(EFalse);
1.2139 + }
1.2140 +
1.2141 +void CNotificationTestAnim::ConstructL(TAny* /*aParam*/, TBool )
1.2142 + {
1.2143 + iWindowFunctions->SetRect(TRect(0,0,1,1));
1.2144 + iFunctions->RegisterForNotifications(EDirectScreenAccess|EHeartbeatTimer|EScreenDeviceChange);
1.2145 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.2146 + iLastAnimTime.UniversalTime();
1.2147 + }
1.2148 +
1.2149 +void CNotificationTestAnim::HandleNotification(const TWsEvent& aEvent)
1.2150 + {
1.2151 + switch (aEvent.Type())
1.2152 + {
1.2153 + case EEventDirectScreenAccessBegin:
1.2154 + {
1.2155 + TInt screenNum = *(aEvent.Int());
1.2156 + iDSA[screenNum] = ETrue;
1.2157 + }
1.2158 + break;
1.2159 + case EEventDirectScreenAccessEnd:
1.2160 + {
1.2161 + TInt screenNum = *(aEvent.Int());
1.2162 + iDSA[screenNum] = EFalse;
1.2163 + }
1.2164 + break;
1.2165 + case EEventHeartbeatTimerStateChange:
1.2166 + {
1.2167 + iHeartbeatState=*aEvent.Int();
1.2168 + }
1.2169 + break;
1.2170 + case EEventScreenDeviceChanged:
1.2171 + {
1.2172 + iScreenDeviceChanged=!iScreenDeviceChanged;
1.2173 + }
1.2174 + break;
1.2175 + default:
1.2176 + break;
1.2177 + }
1.2178 + }
1.2179 +
1.2180 +void CNotificationTestAnim::Animate(TDateTime*)
1.2181 + {
1.2182 + iLastAnimTime.UniversalTime();
1.2183 + }
1.2184 +
1.2185 +void CNotificationTestAnim::Redraw()
1.2186 + {
1.2187 + }
1.2188 +
1.2189 +void CNotificationTestAnim::Command(TInt /*aOpcode*/, TAny* /*aParam*/)
1.2190 + {
1.2191 + }
1.2192 +
1.2193 +TInt CNotificationTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
1.2194 + {
1.2195 + TAnimArgUnion pData;
1.2196 + pData.any=aParam;
1.2197 + switch (aOpcode)
1.2198 + {
1.2199 + case EADllQueryDSA:
1.2200 + {
1.2201 + TInt screenNum = *pData.Int;
1.2202 + return iDSA[screenNum];
1.2203 + }
1.2204 + case EADllQueryHeartbeatState:
1.2205 + {
1.2206 + return iHeartbeatState;
1.2207 + }
1.2208 + case EADllIsAnimating:
1.2209 + {
1.2210 + // Check if the anim DLL is currently animating by comparing
1.2211 + // the current time with the last anim time - if this is greater than a second
1.2212 + // then we are not animating
1.2213 + TTime timeNow;
1.2214 + timeNow.UniversalTime();
1.2215 + TTimeIntervalMicroSeconds microSecs = timeNow.MicroSecondsFrom(iLastAnimTime);
1.2216 + if(microSecs > TTimeIntervalMicroSeconds(1200000)) // 1 sec plus 0.2 secs to cope with any latency
1.2217 + {
1.2218 + return EFalse;
1.2219 + }
1.2220 + else
1.2221 + {
1.2222 + return ETrue;
1.2223 + }
1.2224 + }
1.2225 + default:;
1.2226 + }
1.2227 + return(KErrNone);
1.2228 + }
1.2229 +
1.2230 +void CNotificationTestAnim::FocusChanged(TBool /*aState*/)
1.2231 + {
1.2232 + }
1.2233 +
1.2234 +TBool CNotificationTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1.2235 + {
1.2236 + return EFalse;
1.2237 + }
1.2238 +
1.2239 +// CTransAnim test drawing//
1.2240 +void CTransAnim::ConstructL(TAny* aParam, TBool)
1.2241 + {
1.2242 + iRect=*static_cast<TRect*>(aParam);//Assigns the animation area
1.2243 + iWindowFunctions->SetRect(iRect);
1.2244 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.2245 + iFont=NULL;
1.2246 + iColor=TRgb(0,0,0);
1.2247 + }
1.2248 +
1.2249 +void CTransAnim::Animate(TDateTime*)
1.2250 + {
1.2251 + iWindowFunctions->ActivateGc();
1.2252 + if(iMode==1) //Draw line mode
1.2253 + {
1.2254 + DoDraw(iDraw,*iGc,iColor,iRect);
1.2255 + }
1.2256 + else if(iMode==2) //Draw text mode
1.2257 + {
1.2258 + DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
1.2259 + }
1.2260 + }
1.2261 +
1.2262 +void CTransAnim::Redraw()
1.2263 + {
1.2264 + DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
1.2265 + }
1.2266 +
1.2267 +void CTransAnim::Command(TInt aOpcode,TAny* aParam)
1.2268 + {
1.2269 + TAnimArgUnion pData;
1.2270 + pData.any=aParam;
1.2271 + switch(aOpcode)
1.2272 + {
1.2273 + case EADllDrawNow: //Used to draw a single frame
1.2274 + iWindowFunctions->ActivateGc();
1.2275 + iMode=1;
1.2276 + iDraw=36;
1.2277 + iColor=TRgb(0,0,0);
1.2278 + DoDraw(iDraw,*iGc,iColor,iRect);
1.2279 + break;
1.2280 + case EADllNextFrame: //Used to draw a continous frame
1.2281 + iMode=2;
1.2282 + iColor=pData.FrameData->color;
1.2283 + iDraw=pData.FrameData->draw;
1.2284 + iCount=pData.FrameData->text;
1.2285 + break;
1.2286 + case EADllStartAnimText: //Used to start text animate
1.2287 + iWindowFunctions->ActivateGc();
1.2288 + iMode=2;
1.2289 + iDraw=37;
1.2290 + iFont=iFunctions->DuplicateFontL(pData.FrameData->font);
1.2291 + iColor=pData.FrameData->color;
1.2292 + iCount=pData.FrameData->text;
1.2293 + if(pData.FrameData->sync==EStateFlash)
1.2294 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.2295 + else if(pData.FrameData->sync==EStateSecond)
1.2296 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.2297 + DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
1.2298 + break;
1.2299 + case EADllEndAnimText: //Used to end text animate
1.2300 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1.2301 + iWindowFunctions->ActivateGc();
1.2302 + iCount=0;
1.2303 + iMode=0;
1.2304 + iFunctions->CloseFont(iFont);
1.2305 + iFont=NULL;
1.2306 + break;
1.2307 + }
1.2308 + }
1.2309 +
1.2310 +TInt CTransAnim::CommandReplyL(TInt /*aOpcode*/, TAny* /*aParam*/)
1.2311 + {
1.2312 + return(0);
1.2313 + }
1.2314 +
1.2315 +void CTransAnim::FocusChanged(TBool /*aState*/)
1.2316 + {}
1.2317 +
1.2318 +TBool CTransAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1.2319 + {
1.2320 + return EFalse;
1.2321 + }
1.2322 +
1.2323 +// an anim dll that doesn't remove itself from the event handler list
1.2324 +CTestHandlerAnim::~CTestHandlerAnim()
1.2325 + {
1.2326 + }
1.2327 +
1.2328 +void CTestHandlerAnim::ConstructL(TAny* /*aArgs*/, TBool /*aHasFocus*/)
1.2329 + {
1.2330 + iFunctions->GetRawEvents(ETrue);
1.2331 + }
1.2332 +
1.2333 +void CTestHandlerAnim::Redraw()
1.2334 + {
1.2335 + }
1.2336 +
1.2337 +void CTestHandlerAnim::FocusChanged(TBool /*aState*/)
1.2338 + {
1.2339 + }
1.2340 +
1.2341 +TInt CTestHandlerAnim::CommandReplyL(TInt /*aOpcode*/, TAny* /*aArgs*/)
1.2342 + {
1.2343 + return KErrNone;
1.2344 + }
1.2345 +
1.2346 +void CTestHandlerAnim::Command(TInt /*aOpcode*/, TAny* /*aArgs*/)
1.2347 + {
1.2348 + }
1.2349 +
1.2350 +void CTestHandlerAnim::Animate(TDateTime* /*aDateTime*/)
1.2351 + {
1.2352 + }
1.2353 +
1.2354 +TBool CTestHandlerAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1.2355 + {
1.2356 + return EFalse;
1.2357 + }
1.2358 +
1.2359 +// CRemovableAnim Test removal of anim during event handling //
1.2360 +CRemovableAnim::~CRemovableAnim()
1.2361 + {
1.2362 + }
1.2363 +
1.2364 +TInt CRemovableAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
1.2365 + {
1.2366 + if (TotalExpectedEvents() + EventCount() < iLifetime)
1.2367 + {
1.2368 + return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
1.2369 + }
1.2370 + else
1.2371 + {
1.2372 + return KErrNone;
1.2373 + }
1.2374 + }
1.2375 +
1.2376 +TInt CRemovableAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
1.2377 + {
1.2378 + TAnimArgUnion pData;
1.2379 + pData.any=aParam;
1.2380 + switch (aOpcode)
1.2381 + {
1.2382 + case EADllSetEventHandlerLifetime:
1.2383 + iLifetime = *pData.Int;
1.2384 + return iLifetime;
1.2385 + case EADllEventHandlerLifetime:
1.2386 + return iLifetime;
1.2387 + case EADllAddToEventHandlers:
1.2388 + iFunctions->GetRawEvents(ETrue);
1.2389 + return KErrNone;
1.2390 + case EADllRemoveFromEventHandlers:
1.2391 + iFunctions->GetRawEvents(EFalse);
1.2392 + return KErrNone;
1.2393 + case EADllTestPassed:
1.2394 + {
1.2395 + // If any unexpected events are received, then Error() > 0
1.2396 + // If fewer than the number of expected events are received, then TotalExpectedEvents() > 0
1.2397 + TBool passed = (Error() == 0) && (TotalExpectedEvents() == 0);
1.2398 + return passed;
1.2399 + }
1.2400 + default:
1.2401 + return CEventTestAnimBase::CommandReplyL(aOpcode, aParam);
1.2402 + }
1.2403 + }
1.2404 +
1.2405 +
1.2406 +TBool CRemovableAnim::OfferRawEvent(const TRawEvent& aRawEvent)
1.2407 + {
1.2408 + TBool eat = CEventTestAnimBase::OfferRawEvent(aRawEvent);
1.2409 +
1.2410 + // Remove anim from event handlers if lifetime has been exceeded
1.2411 + if (EventCount() >= iLifetime)
1.2412 + {
1.2413 + iFunctions->GetRawEvents(EFalse);
1.2414 + }
1.2415 + return eat;
1.2416 + }
1.2417 +
1.2418 +// CMultiPointerAnim for Testing multipointerevents for anims //
1.2419 +CMultiPointerAnim::~CMultiPointerAnim()
1.2420 + {
1.2421 + iFunctions->GetRawEvents(EFalse);
1.2422 + }
1.2423 +
1.2424 +// Important thing here is to call GetRawEvents() which Switches animation raw event handling on
1.2425 +void CMultiPointerAnim::ConstructL(TAny */*aArgs*/, TBool /*aHasFocus*/)
1.2426 + {
1.2427 + iExpectedEvents.SetLengthL(EEventBufferSize);
1.2428 + iFunctions->GetRawEvents(ETrue);
1.2429 + }
1.2430 +
1.2431 +void CMultiPointerAnim::Animate(TDateTime */*aDateTime*/)
1.2432 + {
1.2433 + }
1.2434 +
1.2435 +void CMultiPointerAnim::Command(TInt /*aOpcode*/, TAny */*aArgs*/)
1.2436 + {
1.2437 + }
1.2438 +
1.2439 +TInt CMultiPointerAnim::CommandReplyL(TInt aOpcode, TAny *aArgs)
1.2440 + {
1.2441 + TAnimArgUnion pData;
1.2442 + pData.any=aArgs;
1.2443 + switch (aOpcode)
1.2444 + {
1.2445 + case EADllAddExpectedMultiPtrEvent:
1.2446 + return AddEvent(pData.AnimRawEvent);
1.2447 + case EADllMultiPtrEventError:
1.2448 + return iError;
1.2449 + case EADllMultiPtrEventErrorDesc:
1.2450 + if (iError != KErrNone)
1.2451 + {
1.2452 + // returns the error description which gets displayed in logs if test failed
1.2453 + const RMessagePtr2& message=*iFunctions->Message();
1.2454 + const TInt error=message.Write(KIpcSlot, iErrorDes);
1.2455 + if (error != KErrNone)
1.2456 + {
1.2457 + return error;
1.2458 + }
1.2459 + }
1.2460 + break;
1.2461 + case EADllMultiPtrEventReset:
1.2462 + iExpectedEvents.Reset();
1.2463 + iError = 0;
1.2464 + iEventCount = 0;
1.2465 + break;
1.2466 + default:;
1.2467 + }
1.2468 + return(KErrNone);
1.2469 + }
1.2470 +
1.2471 +void CMultiPointerAnim::Redraw()
1.2472 + {
1.2473 + }
1.2474 +
1.2475 +void CMultiPointerAnim::FocusChanged(TBool /*aState*/)
1.2476 + {
1.2477 + }
1.2478 +
1.2479 +TBool CMultiPointerAnim::OfferRawEvent(const TRawEvent &aRawEvent)
1.2480 + {
1.2481 + // Ignore following raw events
1.2482 + TRawEvent::TType aType=aRawEvent.Type();
1.2483 + if (aType==TRawEvent::EActive || aType==TRawEvent::EInactive || aType==TRawEvent::ERedraw
1.2484 + || aType==TRawEvent::EPointerSwitchOn || aType==TRawEvent::EUpdateModifiers)
1.2485 + {
1.2486 + return EFalse;
1.2487 + }
1.2488 +
1.2489 + // If it has already failed then do not test other events becasue the error value
1.2490 + // and its descriptor will be over written
1.2491 + if (iError)
1.2492 + {
1.2493 + return EFalse;;
1.2494 + }
1.2495 +
1.2496 + TAnimRawEvent expectedEvent;
1.2497 + if (iExpectedEvents.Remove(&expectedEvent)<1)
1.2498 + {
1.2499 + return EFalse;
1.2500 + }
1.2501 +
1.2502 + // Increment event count
1.2503 + iEventCount++;
1.2504 +
1.2505 + // Call compare events function passing in both the events
1.2506 + if (!CompareEvents(expectedEvent.iRawEvent, aRawEvent))
1.2507 + {
1.2508 + iError = iEventCount;
1.2509 + }
1.2510 +
1.2511 + return expectedEvent.iEat;
1.2512 + }
1.2513 +
1.2514 +TInt CMultiPointerAnim::AddEvent(const TAnimRawEvent* aEvent)
1.2515 + {
1.2516 + return iExpectedEvents.Add(aEvent);
1.2517 + }
1.2518 +
1.2519 +TBool CMultiPointerAnim::CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent)
1.2520 + {
1.2521 + // Check pointer type
1.2522 + if (aExpectedEvent.Type() != aActualEvent.Type())
1.2523 + {
1.2524 + _LIT(KEventType, "Actual Event type = %d Expected Event Type = %d ");
1.2525 + iErrorDes.Format(KEventType, aActualEvent.Type(), aExpectedEvent.Type());
1.2526 + return EFalse;
1.2527 + }
1.2528 +
1.2529 + // Here for EOutOfRange we cannot query Pos or Pos3D...
1.2530 + if (aExpectedEvent.Type() != TRawEvent::EPointer3DOutOfRange)
1.2531 + {
1.2532 + // Check 3d position
1.2533 + TPoint3D expected3DPos = aExpectedEvent.Pos3D();
1.2534 + TPoint3D actual3DPos = aActualEvent.Pos3D();
1.2535 + if (expected3DPos.iX != actual3DPos.iX)
1.2536 + {
1.2537 + _LIT(KXPosition, "Actual X coordinate = %d Expected X coordinate = %d ");
1.2538 + iErrorDes.Format(KXPosition, actual3DPos.iX, expected3DPos.iX);
1.2539 + return EFalse;
1.2540 + }
1.2541 + if (expected3DPos.iY != actual3DPos.iY)
1.2542 + {
1.2543 + _LIT(KYPosition, "Actual Y coordinate = %d Expected Y coordinate = %d ");
1.2544 + iErrorDes.Format(KYPosition, actual3DPos.iY, expected3DPos.iY);
1.2545 + return EFalse;
1.2546 + }
1.2547 + if (expected3DPos.iZ != actual3DPos.iZ)
1.2548 + {
1.2549 + _LIT(KZPosition, "Actual Z coordinate = %d Expected Z coordinate = %d ");
1.2550 + iErrorDes.Format(KZPosition, actual3DPos.iZ, expected3DPos.iZ);
1.2551 + return EFalse;
1.2552 + }
1.2553 + }
1.2554 +
1.2555 + // Check pointer number
1.2556 + if (aExpectedEvent.PointerNumber() != aActualEvent.PointerNumber())
1.2557 + {
1.2558 + _LIT(KPointerNumber, "Actual Pointer number = %d Expected Pointer number = %d ");
1.2559 + iErrorDes.Copy(KPointerNumber);
1.2560 + iErrorDes.Format(KPointerNumber, aActualEvent.PointerNumber(), aExpectedEvent.PointerNumber());
1.2561 + return EFalse;
1.2562 + }
1.2563 + return ETrue;
1.2564 + }
1.2565 +
1.2566 +// CCoverageAnim test drawing/redrawing //
1.2567 +CCoverageAnim::~CCoverageAnim()
1.2568 + {
1.2569 + if(iFont && iFunctions)
1.2570 + iFunctions->CloseFont(iFont);
1.2571 + }
1.2572 +
1.2573 +/**
1.2574 + Initializes members.
1.2575 + */
1.2576 +void CCoverageAnim::ConstructL(TAny *aParam, TBool )
1.2577 + {
1.2578 + iRect=*static_cast<TRect*>(aParam);
1.2579 + iWindowFunctions->SetRect(iRect);
1.2580 + iWindowFunctions->Invalidate(iRect);
1.2581 +
1.2582 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncDay);
1.2583 + if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncDay)
1.2584 + User::Leave(KErrGeneral);
1.2585 +
1.2586 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncMinute);
1.2587 + if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncMinute)
1.2588 + User::Leave(KErrGeneral);
1.2589 +
1.2590 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1.2591 + if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncSecond)
1.2592 + User::Leave(KErrGeneral);
1.2593 +
1.2594 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.2595 + if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncFlash)
1.2596 + User::Leave(KErrGeneral);
1.2597 +
1.2598 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1.2599 + if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncNone)
1.2600 + User::Leave(KErrGeneral);
1.2601 +
1.2602 + iFunctions->SetInterval(1);
1.2603 + iFunctions->SetInterval(0);
1.2604 + iFunctions->SetNextInterval(0);
1.2605 +
1.2606 + User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::ENumberOfExtendedInterfaces));
1.2607 + User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface));
1.2608 + User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EEventExtentionInterface));
1.2609 + User::LeaveIfError(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EInterfaceCount) != NULL);
1.2610 +
1.2611 + #if !defined(SYMBIAN_GRAPHICS_GCE)
1.2612 + // Deprecated in NGA but needs to be tested in NONNGA
1.2613 + User::LeaveIfNull((TAny*)iFunctions->ScreenDevice());
1.2614 + #endif
1.2615 +
1.2616 + iFunctions->Client();
1.2617 + }
1.2618 +
1.2619 +/**
1.2620 + Copied from CAutoAnimScrBack.
1.2621 + */
1.2622 +void CCoverageAnim::Animate(TDateTime *)
1.2623 + {
1.2624 + iWindowFunctions->ActivateGc();
1.2625 + Draw();
1.2626 + }
1.2627 +
1.2628 +/**
1.2629 + All methods of the graphic-context are executed one by one.
1.2630 + */
1.2631 +void CCoverageAnim::Draw()
1.2632 + {
1.2633 + iGc->SetClippingRect(iRect);
1.2634 + iGc->Clear();
1.2635 + iGc->Clear(iRect);
1.2636 +
1.2637 + iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);
1.2638 + iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1.2639 + iGc->SetBrushColor(TRgb::Gray256(85));
1.2640 + iGc->SetBrushOrigin(TPoint(0,0));
1.2641 + iGc->SetPenColor(TRgb::Gray256(170));
1.2642 +
1.2643 + //primitive method calls
1.2644 + iGc->SetFaded(ETrue);
1.2645 + iGc->SetFadingParameters(1, 1);
1.2646 +
1.2647 + iGc->SetPenStyle(CGraphicsContext::ESolidPen);
1.2648 + iGc->SetStrikethroughStyle(EStrikethroughOff);
1.2649 + iGc->SetUnderlineStyle(EUnderlineOff);
1.2650 + iGc->SetWordJustification(2, 1);
1.2651 +
1.2652 + if(iFont)
1.2653 + iGc->UseFont(iFont);
1.2654 +
1.2655 + iGc->DrawArc(iRect,
1.2656 + TPoint(iRect.Center().iX, iRect.iTl.iY),
1.2657 + TPoint(iRect.iBr.iX, iRect.Center().iY));
1.2658 + iGc->DrawLine(iRect.iTl,iRect.Center());
1.2659 + iGc->DrawLineTo(TPoint(iRect.iBr.iX, iRect.iTl.iY));
1.2660 +
1.2661 + iGc->DrawLineBy(TPoint(iRect.iTl.iX, iRect.iBr.iY));
1.2662 + iGc->MoveBy(iRect.iTl + TPoint(1,1));
1.2663 + iGc->MoveTo(iRect.iTl + TPoint(0,0));
1.2664 + iGc->SetPenSize(TSize(10,10));
1.2665 + iGc->Plot(iRect.iTl + TPoint(2,2));
1.2666 + iGc->SetPenSize(TSize(1,1));
1.2667 +
1.2668 + CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
1.2669 + CleanupStack::PushL(polyPoints);
1.2670 + polyPoints->AppendL(iRect.iTl);
1.2671 + polyPoints->AppendL(iRect.Center());
1.2672 + polyPoints->AppendL(TPoint(iRect.iBr.iX, iRect.iTl.iY));
1.2673 +
1.2674 + iGc->DrawPolyLine(polyPoints);
1.2675 + iGc->DrawPolyLine(&polyPoints->At(0), 3);
1.2676 + iGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
1.2677 + iGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
1.2678 +
1.2679 + iGc->DrawPie(iRect, TPoint(iRect.Center().iX, iRect.iTl.iY), TPoint(iRect.iBr.iX, iRect.Center().iY));
1.2680 + iGc->DrawEllipse(iRect);
1.2681 + iGc->DrawRect(iRect);
1.2682 + iGc->DrawRoundRect(iRect, TSize(iRect.Width()/8, iRect.Height()/8));
1.2683 +
1.2684 + CleanupStack::PopAndDestroy(polyPoints);
1.2685 +
1.2686 + iGc->CopyRect(TPoint(10, 10), iRect);
1.2687 +
1.2688 + CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1.2689 + CleanupStack::PushL(bitmap);
1.2690 + User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1.2691 +
1.2692 + iGc->UseBrushPattern(bitmap);
1.2693 + iGc->DrawBitmap(iRect.iTl, bitmap);
1.2694 + iGc->DrawBitmap(iRect, bitmap);
1.2695 + iGc->DrawBitmap(iRect, bitmap, TRect(0, 0, 16, 16));
1.2696 + iGc->DrawBitmapMasked(iRect, bitmap, TRect(0, 0, 16, 16), bitmap, ETrue);
1.2697 +
1.2698 + iGc->BitBlt(TPoint(0, 0), bitmap);
1.2699 + iGc->BitBlt(TPoint(0, 0), bitmap, iRect);
1.2700 + iGc->BitBltMasked(TPoint(0, 0), bitmap, iRect, bitmap, ETrue);
1.2701 + iGc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, iRect, bitmap, TPoint(0,0));
1.2702 +
1.2703 + CleanupStack::PopAndDestroy(bitmap);
1.2704 +
1.2705 + iGc->SetCharJustification(1,1);
1.2706 + iGc->SetClippingRect(iRect);
1.2707 + if(iFont)
1.2708 + {
1.2709 + _LIT(KHelloWorld,"Hello World");
1.2710 + iGc->DrawText(*&KHelloWorld, iRect.iTl);
1.2711 + iGc->DrawText(*&KHelloWorld, iRect, 0, CGraphicsContext::ELeft, 0);
1.2712 + iGc->DrawTextVertical(*&KHelloWorld, iRect.iBr, ETrue);
1.2713 + iGc->DrawTextVertical(*&KHelloWorld, iRect, 0, ETrue, CGraphicsContext::ELeft, 0);
1.2714 + }
1.2715 +
1.2716 + TRgb rgbs[2];
1.2717 + iGc->MapColors(iRect, rgbs, 1, ETrue);
1.2718 + iGc->DiscardBrushPattern();
1.2719 +
1.2720 + if(iFont)
1.2721 + iGc->DiscardFont();
1.2722 +
1.2723 + iFunctions->CloseFont(0);
1.2724 +
1.2725 + TDateTime dt = iFunctions->SystemTime();
1.2726 + }
1.2727 +
1.2728 +/**
1.2729 + Copied from CAutoAnim3.
1.2730 + */
1.2731 +void CCoverageAnim::Redraw()
1.2732 + {
1.2733 + Draw();
1.2734 + }
1.2735 +
1.2736 +/**
1.2737 + Copied from CAutoAnim3.
1.2738 + */
1.2739 +void CCoverageAnim::Command(TInt ,TAny*)
1.2740 + {
1.2741 + }
1.2742 +
1.2743 +/**
1.2744 + Copied from CAutoAnim3.
1.2745 + */
1.2746 +TInt CCoverageAnim::CommandReplyL(TInt aOpcode , TAny* aParam)
1.2747 + {
1.2748 + TAnimArgUnion pData;
1.2749 + pData.any=aParam;
1.2750 + switch(aOpcode)
1.2751 + {
1.2752 + case EADllDrawNow:
1.2753 + iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1.2754 + break;
1.2755 + case EADllSetFont:
1.2756 + if(iFont)
1.2757 + {
1.2758 + iFunctions->CloseFont(iFont);
1.2759 + iFont = NULL;
1.2760 + }
1.2761 + iFont = iFunctions->DuplicateFontL(*pData.Int);
1.2762 + break;
1.2763 + }
1.2764 + return(KErrNone);
1.2765 + }
1.2766 +
1.2767 +/**
1.2768 + Copied from CAutoAnim3.
1.2769 + */
1.2770 +void CCoverageAnim::FocusChanged(TBool )
1.2771 + {}
1.2772 +
1.2773 +/**
1.2774 + Copied from CAutoAnim3.
1.2775 + */
1.2776 +TBool CCoverageAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1.2777 + {
1.2778 + return EFalse;
1.2779 + }
1.2780 +
1.2781 +
1.2782 +// DLL code //
1.2783 +
1.2784 +CAnim *CTestAnimDll::CreateInstanceL(TInt aType)
1.2785 + {
1.2786 + CAnim *anim=NULL;
1.2787 + switch(aType)
1.2788 + {
1.2789 + case EAnimTypeTest1:
1.2790 + anim=new(ELeave) CPanicAnim();
1.2791 + break;
1.2792 + case EAnimTypeTest2:
1.2793 + anim=new(ELeave) CPanicAnim2();
1.2794 + break;
1.2795 + case EAnimTypeTest3:
1.2796 + anim=new(ELeave) CAutoAnim3();
1.2797 + break;
1.2798 + case EAnimTypeScrBackTest:
1.2799 + anim=new(ELeave) CAutoAnimScrBack();
1.2800 + break;
1.2801 + case EAnimTypeSprite:
1.2802 + anim=new(ELeave) CTestSpriteAnim();
1.2803 + break;
1.2804 + case EAnimTypeFreeTimer:
1.2805 + anim=new(ELeave) CTestFreeTimerAnim();
1.2806 + break;
1.2807 + case EAnimTypeEventTest:
1.2808 + anim=new(ELeave) CEventTestAnim();
1.2809 + break;
1.2810 + case EAnimTypeNotificationTest:
1.2811 + anim=new(ELeave) CNotificationTestAnim();
1.2812 + break;
1.2813 + case EAnimTypeTimer:
1.2814 + anim=new(ELeave) CTimerTestAnim();
1.2815 + break;
1.2816 + case EAnimTypeWindowFunctions:
1.2817 + anim=new(ELeave) CWinFunctionTestAnim();
1.2818 + break;
1.2819 + case EAnimTypeTrans:
1.2820 + anim=new(ELeave) CTransAnim();
1.2821 + break;
1.2822 + case EAnimTypeEventHandler:
1.2823 + anim = new (ELeave) CTestHandlerAnim();
1.2824 + break;
1.2825 + case EAnimTypeRemovableAnim:
1.2826 + anim=new(ELeave) CRemovableAnim();
1.2827 + break;
1.2828 + case EAnimTypeEventPostingTest:
1.2829 + anim=new(ELeave) CEventPostingAnim();
1.2830 + break;
1.2831 + case EAnimTypeCoverage:
1.2832 + anim=new(ELeave) CCoverageAnim();
1.2833 + break;
1.2834 + case EAnimTypeMultiPointer:
1.2835 + anim=new(ELeave) CMultiPointerAnim();
1.2836 + break;
1.2837 + }
1.2838 + return(anim);
1.2839 + }
1.2840 +
1.2841 +// Dummy E32Dll needed by E32 to build //
1.2842 +
1.2843 +void CAutoAnim3::DrawTestScreenL(const TDrawTestScreen* aParams)
1.2844 +//Moved here as the include messes up the debugging of the rest of the file.
1.2845 + {
1.2846 + CFbsBitmap *aBitmap=iFunctions->DuplicateBitmapL(aParams->bitmap);
1.2847 + CleanupStack::PushL(aBitmap);
1.2848 + CFbsBitmap *aMaskBitmap=iFunctions->DuplicateBitmapL(aParams->maskBitmap);
1.2849 + CleanupStack::PushL(aMaskBitmap);
1.2850 + CFbsFont *aFont=iFont=iFunctions->DuplicateFontL(aParams->font);
1.2851 + TSize size(iWindowFunctions->WindowSize());
1.2852 + iWindowFunctions->ActivateGc();
1.2853 + CBitmapContext *gc=iGc;
1.2854 + TBool aExtraDrawBitMap=ETrue;
1.2855 +//
1.2856 +#include "DLLDRAW.H"
1.2857 +//
1.2858 + iFunctions->CloseFont(iFont);
1.2859 + iFont=NULL;
1.2860 + CleanupStack::PopAndDestroy(2);
1.2861 + }