First public contribution.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // Auto test Animated DLL functions
23 #include "TAnimDraw.h"
36 const TSpriteMemberInfo* SpriteMemberInfo;
37 const TShadowDrawTest* ShadowDrawTest;
38 const TDrawTestScreen* DrawTestScreen;
39 const TSyncTests* SyncTests;
40 const TTimeChangeTest* TimeChangeTest;
41 const TAnimRawEvent* AnimRawEvent;
42 const TWindowGroupInfoParms* WindowGroupInfoParms;
43 const TSetOrdinalParms* SetOrdinalParms;
44 const TFrameData* FrameData;
45 const TRawEvent* RawEvent;
48 class CPanicAnim : public CWindowAnim
56 ESyncStateTimeChange1,
57 ESyncStateTimeChange2,
63 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
64 virtual void Animate(TDateTime *aDateTime);
65 virtual void Redraw();
66 virtual void Command(TInt aOpcode, TAny *aArgs);
67 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
68 virtual void FocusChanged(TBool aState);
69 //Pure virtual function from MEventHandler
70 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
72 void StartSyncTest(MAnimGeneralFunctions::TAnimSync aSync);
73 void StartTimeChangeTest();
74 void DoLeaveInActiveCallback();
75 static TInt LeaveInActiveCallback(TAny *aThis);
77 TRequestStatus *iStatusPtr;
78 TRequestStatus *iStatusPtr2;
81 TSyncState iSyncState;
82 MAnimGeneralFunctions::TAnimSync iSyncMode;
84 CIdle* iActivePanicIdle;
87 class CPanicAnim2 : public CWindowAnim
89 // Simply panics in the ConstructL()
93 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
94 virtual void Animate(TDateTime *aDateTime);
95 virtual void Redraw();
96 virtual void Command(TInt aOpcode, TAny *aArgs);
97 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
98 virtual void FocusChanged(TBool aState);
99 //Pure virtual function from MEventHandler
100 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
103 class CAutoAnim3 : public CWindowAnim
105 // test drawing/redrawing
109 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
110 virtual void Animate(TDateTime *aDateTime);
111 virtual void Redraw();
112 virtual void Command(TInt aOpcode, TAny *aArgs);
113 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
114 virtual void FocusChanged(TBool aState);
115 void Draw(const TRect &aRect);
116 void DrawTestScreenL(const TDrawTestScreen* aParams);
117 //Pure virtual function from MEventHandler
118 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
120 TRequestStatus *iStatusPtr;
127 class CAutoAnimScrBack : public CWindowAnim
129 // test anim drawing behind a backed up window
133 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
134 virtual void Animate(TDateTime *aDateTime);
135 virtual void Redraw();
136 virtual void Command(TInt aOpcode, TAny *aArgs);
137 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
138 virtual void FocusChanged(TBool aState);
140 //Pure virtual function from MEventHandler
141 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
147 class CTestSpriteAnim : public CSpriteAnim
150 virtual void ConstructL(TAny *aArgs);
151 virtual void Animate(TDateTime *aDateTime);
152 virtual void Command(TInt aOpcode, TAny *aArgs);
153 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
154 //Pure virtual function from MEventHandler
155 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
157 TBool CheckMember(const TSpriteMemberInfo& aMemInfo);
158 void DrawMemberL(TInt aMember);
163 Used by CAnimTimer below
165 class MAnimTimerObserver
168 virtual void DisplayNextFrameL()=0;
172 This class is used by CTestFreeTimerAnim to determine when to swap the current frame with the next one.
174 class CAnimTimer : public CTimer
178 static CAnimTimer* NewL(MAnimTimerObserver& aObserver);
181 CAnimTimer(MAnimTimerObserver& aObserver);
184 MAnimTimerObserver& iAnim;
187 class CTestFreeTimerAnim : public CFreeTimerWindowAnim, public MAnimTimerObserver
191 ~CTestFreeTimerAnim();
193 void Animate(TDateTime *aDateTime);
194 void Command(TInt aOpcode, TAny *aArgs);
195 TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
197 void ConstructL(TAny *aArgs, TBool aHasFocus);
199 void FocusChanged(TBool aState);
201 TBool OfferRawEvent(const TRawEvent &aRawEvent);
203 void DisplayNextFrameL();
211 class CEventTestAnimBase : public CWindowAnim
213 enum {EEventBufferSize=40};
215 virtual ~CEventTestAnimBase();
216 //Pure virtual functions from CAnim
217 virtual void Animate(TDateTime *aDateTime);
218 virtual void Command(TInt aOpcode, TAny *aArgs);
219 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
220 //Pure virtual functions from CWindowAnim
221 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
222 virtual void Redraw();
223 virtual void FocusChanged(TBool aState);
224 //Pure virtual function from MEventHandler
225 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
228 TBool IsIgnorableEvent(const TRawEvent& aRawEvent) const;
229 TBool GetNextExpectedEvent(TAnimRawEvent& aRawEvent);
230 TBool CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent) const;
231 TBool HandleRecursiveEvent(const TRawEvent& aRawEvent);
234 TInt EventCount() const;
235 void ResetEventCount();
236 TInt TotalExpectedEvents() const;
237 TInt AddEvent(const TAnimRawEvent* event);
239 virtual TInt AddExpectedEvent(const TAnimRawEvent* event)=0;
241 CCirBuf<TAnimRawEvent> iExpectedEvents;
246 class CEventTestAnim : public CEventTestAnimBase
250 //Pure virtual functions from CWindowAnim overridden in CEventTestAnimBase
251 void ConstructL(TAny* aArgs,TBool aHasFocus);
252 //Pure virtual functions from CAnim overridden in CEventTestAnimBase
253 TInt CommandReplyL(TInt aOpcode,TAny* aArgs);
254 void Command(TInt aOpcode,TAny* aArgs);
256 TInt UnloadDeviceDriver();
257 //Pure virtual function from CEventTestAnimBase
258 TInt AddExpectedEvent(const TAnimRawEvent* event);
260 TBool iDevDriverLoaded;
264 class CEventPostingAnim : public CEventTestAnimBase
267 ~CEventPostingAnim();
268 //Virtual functions from CEventTestAnimBase
269 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
270 //Virtual function from MEventHandler
271 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
273 //Pure virtual function from CEventTestAnimBase
274 virtual TInt AddExpectedEvent(const TAnimRawEvent* event);
277 class CRemovableAnim : public CEventTestAnimBase
281 //Virtual functions from CEventTestAnimBase
282 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
283 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
285 //Pure virtual function from CEventTestAnimBase
286 virtual TInt AddExpectedEvent(const TAnimRawEvent* event);
291 class CTimerTestAnim : public CWindowAnim
295 //Pure virtual functions from CAnim
296 virtual void Animate(TDateTime *aDateTime);
297 virtual void Command(TInt aOpcode, TAny *aArgs);
298 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
299 //Pure virtual functions from CWindowAnim
300 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
301 virtual void Redraw();
302 virtual void FocusChanged(TBool aState);
303 //Pure virtual function from MEventHandler
304 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
307 TBool iExpectingTicks;
311 class CWinFunctionTestAnim : public CWindowAnim
313 //enum {EEventBufferSize=40};
315 ~CWinFunctionTestAnim();
316 //Pure virtual functions from CAnim
317 virtual void Animate(TDateTime *aDateTime);
318 virtual void Command(TInt aOpcode, TAny *aArgs);
319 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
320 //Pure virtual functions from CWindowAnim
321 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
322 virtual void Redraw();
323 virtual void FocusChanged(TBool aState);
324 //Pure virtual function from MEventHandler
325 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
327 MAnimGeneralFunctionsWindowExtension* iWinFunctions;
330 class CNotificationTestAnim : public CWindowAnim
333 CNotificationTestAnim();
334 ~CNotificationTestAnim();
335 //Pure virtual functions from CAnim
336 virtual void HandleNotification(const TWsEvent& aEvent);
337 virtual void Animate(TDateTime *aDateTime);
338 virtual void Command(TInt aOpcode, TAny *aArgs);
339 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
340 //Pure virtual functions from CWindowAnim
341 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
342 virtual void Redraw();
343 virtual void FocusChanged(TBool aState);
344 //Pure virtual function from MEventHandler
345 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
347 TFixedArray<TBool,2> iDSA;
348 TBool iHeartbeatState;
349 TBool iScreenDeviceChanged;
353 class CTransAnim : public CWindowAnim
355 // Test drawing/redrawing in Transparent window.
359 //Implementaion for pure virtual functions from CAnim
360 void ConstructL(TAny* aArgs, TBool aHasFocus);
361 void Animate(TDateTime* aDateTime);
363 void Command(TInt aOpcode, TAny* aArgs);
364 TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
365 void FocusChanged(TBool aState);
366 TBool OfferRawEvent(const TRawEvent &aRawEvent);
376 class CTestHandlerAnim : public CWindowAnim
380 void ConstructL(TAny* aArgs, TBool aHasFocus);
382 void FocusChanged(TBool aState);
383 TInt CommandReplyL(TInt aOpcode, TAny* aArgs);
384 void Command(TInt aOpcode, TAny* aArgs);
385 void Animate(TDateTime* aDateTime);
386 TBool OfferRawEvent(const TRawEvent &aRawEvent);
390 class CCoverageAnim : public CWindowAnim
392 This class adds functional coverage to CWsAnimGc.
393 The actual work is handled by the 'Draw' method which calls
395 Mostly copied from CAutoAnimScrBack and CAutoAnim3.
397 @SYMPREQ 1841 Add Coverage tests.
398 @SYMTestCaseDesc Functional coverage.
399 @SYMTestActions Run functional coverage test on CWsAnimGc.
404 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
405 virtual void Animate(TDateTime *aDateTime);
406 virtual void Redraw();
407 virtual void Command(TInt aOpcode, TAny *aArgs);
408 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
409 virtual void FocusChanged(TBool aState);
411 //Pure virtual function from MEventHandler
412 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
414 TRect iRect; /** rectangle used for all draw ops that require one */
418 class CMultiPointerAnim : public CWindowAnim
420 enum {EEventBufferSize=40};
422 virtual ~CMultiPointerAnim();
423 //Pure virtual functions from CAnim
424 virtual void Animate(TDateTime *aDateTime);
425 virtual void Command(TInt aOpcode, TAny *aArgs);
426 virtual TInt CommandReplyL(TInt aOpcode, TAny *aArgs);
427 //Pure virtual functions from CWindowAnim
428 virtual void ConstructL(TAny *aArgs, TBool aHasFocus);
429 virtual void Redraw();
430 virtual void FocusChanged(TBool aState);
431 //Pure virtual function from MEventHandler
432 virtual TBool OfferRawEvent(const TRawEvent &aRawEvent);
434 TInt AddEvent(const TAnimRawEvent* aEvent);
435 TBool CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent);
437 CCirBuf<TAnimRawEvent> iExpectedEvents;
443 class CTestAnimDll : public CAnimDll
446 CAnim *CreateInstanceL(TInt aType);
450 /*#if defined(__WINS__)
451 #pragma data_seg(".E32_UID")
452 __WINS_UID(0, KWservAnimDllUidValue, 0)
456 EXPORT_C CAnimDll *CreateCAnimDllL()
458 return(new(ELeave) CTestAnimDll());
463 void CPanicAnim::ConstructL(TAny *, TBool )
465 iWindowFunctions->SetRect(TRect(0,0,1,1));
466 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
467 if (iFunctions->Sync()!=MAnimGeneralFunctions::ESyncSecond)
468 User::Leave(KErrGeneral);
469 // Check the anim time is not ahead of and not more than 2 secs behind the system time
472 TDateTime dt=now.DateTime();
473 TDateTime adt=iFunctions->SystemTime();
474 if (adt.Day()!=dt.Day())
475 User::Leave(KErrGeneral);
477 iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
478 if (iFunctions->Sync()!=MAnimGeneralFunctions::ESyncNone)
479 User::Leave(KErrGeneral);
482 CPanicAnim::~CPanicAnim()
484 delete iActivePanicIdle;
487 void CPanicAnim::Animate(TDateTime *aDateTime)
493 case ESyncStateStarting:
494 iTime=iFunctions->SystemTime();
495 iSyncState=ESyncStateCounting;
498 case ESyncStateCounting:
501 TTimeIntervalSeconds interval;
502 TTime(*aDateTime).SecondsFrom(iTime, interval);
503 iSyncCount=interval.Int();
507 if (iSyncCount==ESyncCount)
509 TTimeIntervalMicroSeconds minInterval(0);
510 TTimeIntervalMicroSeconds maxInterval(0);
511 iSyncState=ESyncStateNull;
514 case MAnimGeneralFunctions::ESyncSecond:
515 minInterval=iSyncCount*1000000-100000;
516 maxInterval=iSyncCount*1000000+100000;
520 TTime time(iFunctions->SystemTime());
521 TTimeIntervalMicroSeconds interval=time.MicroSecondsFrom(iTime);
523 if (interval<minInterval || interval>maxInterval)
525 iFunctions->Client().RequestComplete(iStatusPtr,ret);
529 User::Leave(KErrGeneral); // Test: Not allowed to leave, will cause a panic
531 case ESyncStateTimeChange1:
534 iFunctions->Client().RequestComplete(iStatusPtr,KErrNone);
535 iSyncState=ESyncStateTimeChange2;
538 case ESyncStateTimeChange2:
541 iSyncState=ESyncStateTimeChange3;
544 case ESyncStateTimeChange3:
545 iFunctions->Client().RequestComplete(iStatusPtr2,aDateTime ? KErrNone : KErrGeneral);
546 iSyncState=ESyncStateNull;
551 void CPanicAnim::Redraw()
554 User::Leave(KErrGeneral); //Test: Not allowed to leave, will cause a panic
557 void CPanicAnim::Command(TInt aOpcode, TAny *)
561 case EADllPanicCallPanic:
564 case EADllPanicSetInterval:
565 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
566 iFunctions->SetInterval(1);
568 case EADllPanicSetNextInterval:
569 iFunctions->SetSync(MAnimGeneralFunctions::ESyncMinute);
570 iFunctions->SetNextInterval(1);
572 case EADllPanicDoubleActivateGC:
573 iWindowFunctions->ActivateGc();
574 iWindowFunctions->ActivateGc();
576 case EADllPanicDrawRectWithNoGc:
577 iGc->DrawRect(TRect(0,0,10,10));
579 case EADllPanicDrawTextWithNoFont:
580 iWindowFunctions->ActivateGc();
581 iGc->DrawText(_L("Panic"),TPoint(20,20));
583 case EADllPanicLeaveInAnimate:
584 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
585 iSyncState=ESyncLeave;
587 case EADllPanicLeaveInRedraw:
588 iLeaveInRedraw=ETrue;
589 iWindowFunctions->Invalidate(TRect(0,0,10,10));
591 case EADllPanicLeave:
592 //tests a leaving function in a non-leaving function and should not be moved to CommandReplyL as it leaves
593 User::Leave(KErrGeneral); //LeaveScan: intentional test
595 case EADllPanicSetVisWithGcActive:
596 iWindowFunctions->ActivateGc();
597 iWindowFunctions->SetVisible(EFalse);
598 iWindowFunctions->SetVisible(ETrue);
600 case EADllPanicLeaveInActiveCallback:
601 iActivePanicIdle=CIdle::NewL(EPriorityHigh);
602 iActivePanicIdle->Start(TCallBack(CPanicAnim::LeaveInActiveCallback,this));
604 case EADllPanicSetClippingRectWithNoGc:
606 // currently this test fails because when deactivated iWin is also NULL and is deferenced in function
607 TRect rect(20,20,20,20);
608 iGc->SetClippingRect(rect);
611 case EADllPanicCancelClippingRegionWithNoGc:
612 // currently this test fails because when deactivated iWin is NULL and function leaves
613 iGc->CancelClippingRegion();
615 case EADllPanicCancelClippingRectWithNoGc:
616 // currently this test fails because when deactivated iWin is also NULL and is deferenced in function
617 iGc->CancelClippingRect();
619 case EADllPanicSetDrawModeWithNoGc:
620 iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);
622 case EADllPanicUseFontWithNoGc:
624 // currently this test fails because does not check for NULL font
625 CFbsFont* font = NULL;
629 case EADllPanicDiscardFontWithNoGc:
632 case EADllPanicSetUnderlineStyleWithNoGc:
633 iGc->SetUnderlineStyle(EUnderlineOff);
635 case EADllPanicSetStrikeThoughStyleWithNoGc:
636 iGc->SetStrikethroughStyle(EStrikethroughOff);
638 case EADllPanicSetWordJustificationWithNoGc:
639 iGc->SetWordJustification(0,0);
641 case EADllPanicSetCharJustificationWithNoGc:
642 iGc->SetCharJustification(0,0);
644 case EADllPanicSetPenColorWithNoGc:
647 iGc->SetPenColor(rgbs);
650 case EADllPanicSetPenStyleWithNoGc:
651 iGc->SetPenStyle(CGraphicsContext::ESolidPen);
653 case EADllPanicSetPenSizeWithNoGc:
656 iGc->SetPenSize(size);
659 case EADllPanicSetBrushColorWithNoGc:
662 iGc->SetBrushColor(rgbs);
665 case EADllPanicSetBrushStyleWithNoGc:
666 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
668 case EADllPanicSetBrushOriginWithNoGc:
671 iGc->SetBrushOrigin(point);
674 case EADllPanicUseBrushPatterWithNoGc:
676 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
677 CleanupStack::PushL(bitmap);
678 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
679 iGc->UseBrushPattern(bitmap);
680 CleanupStack::PopAndDestroy(bitmap);
683 case EADllPanicDiscardBrushPatternWithNoGc:
684 iGc->DiscardBrushPattern();
686 case EADllPanicSetFadedWithNoGc:
687 iGc->SetFaded(EFalse);
689 case EADllPanicSetFadingParametersWithNoGc:
690 iGc->SetFadingParameters(1,1);
692 case EADllPanicDrawArcWithNoGc:
696 TPoint(rect.Center().iX, rect.iTl.iY),
697 TPoint(rect.iBr.iX, rect.Center().iY));
700 case EADllPanicDrawPieWithNoGc:
703 iGc->DrawPie(rect, TPoint(rect.Center().iX, rect.iTl.iY), TPoint(rect.iBr.iX, rect.Center().iY));
706 case EADllPanicDrawLineWithNoGc:
710 iGc->DrawLine(point1, point2);
713 case EADllPanicDrawLineToWithNoGc:
716 iGc->DrawLineTo(point);
719 case EADllPanicDrawLineByWithNoGc:
722 iGc->DrawLineBy(point);
725 case EADllPanicDrawEllipseWithNoGc:
727 TRect rect(20,20,20,20);
728 iGc->DrawEllipse(rect);
731 case EADllPanicDrawRoundedRecWithNoGc:
734 iGc->DrawRoundRect(rect, TSize(rect.Width()/8, rect.Height()/8));
737 case EADllPanicClearWithRectWithNoGc:
739 TRect rect(20,20,20,20);
743 case EADllPanicClearWithNoGc:
746 case EADllPanicBitBltWithNoGc:
748 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
749 CleanupStack::PushL(bitmap);
750 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
751 iGc->BitBlt(TPoint(0, 0), bitmap);
752 CleanupStack::PopAndDestroy(bitmap);
755 case EADllPanicBitBltWithRectWithNoGc:
757 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
759 CleanupStack::PushL(bitmap);
760 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
761 iGc->BitBlt(TPoint(0, 0), bitmap, rect);
762 CleanupStack::PopAndDestroy(bitmap);
765 case EADllPanicBitBltMaskedWithNoGc:
767 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
769 CleanupStack::PushL(bitmap);
770 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
771 iGc->BitBltMasked(TPoint(0, 0), bitmap, rect, bitmap, EFalse);
772 CleanupStack::PopAndDestroy(bitmap);
775 case EADllPanicDrawBitmapMaskedFbsBitmapWithNoGc:
777 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
779 CleanupStack::PushL(bitmap);
780 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
781 iGc->DrawBitmapMasked(rect, bitmap, rect, bitmap, ETrue);
782 CleanupStack::PopAndDestroy(bitmap);
785 case EADllPanicDrawBitmapMaskedWsBitmapWithNoGc:
787 CWsBitmap* bitmap = NULL;
789 iGc->DrawBitmapMasked(rect, bitmap, rect, bitmap, ETrue);
792 case EADllPanicDrawBitmapPointWithNoGc:
794 CWsBitmap* bitmap = NULL;
796 iGc->DrawBitmap(rect.iTl, bitmap);
799 case EADllPanicDrawBitmapWithNoGc:
801 CWsBitmap* bitmap = NULL;
803 iGc->DrawBitmap(rect, bitmap);
806 case EADllPanicDrawBitmapRectWithNoGc:
808 CWsBitmap* bitmap = NULL;
810 iGc->DrawBitmap(rect, bitmap, TRect(0, 0, 16, 16));
813 case EADllPanicDrawPolyLinePointsWithNoGc:
816 CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
817 CleanupStack::PushL(polyPoints);
818 polyPoints->AppendL(rect.iTl);
819 polyPoints->AppendL(rect.Center());
820 polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
821 iGc->DrawPolyLine(&polyPoints->At(0), 3);
822 CleanupStack::PopAndDestroy(polyPoints);
825 case EADllPanicDrawPolyLineArrayWithNoGc:
828 CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
829 CleanupStack::PushL(polyPoints);
830 polyPoints->AppendL(rect.iTl);
831 polyPoints->AppendL(rect.Center());
832 polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
833 iGc->DrawPolyLine(polyPoints);
834 CleanupStack::PopAndDestroy(polyPoints);
837 case EADllPanicMoveToWithNoGc:
843 case EADllPanicMoveByWithNoGc:
849 case EADllPanicPlotWithNoGc:
855 case EADllPanicSetOriginWithNoGc:
858 iGc->SetOrigin(point);
861 case EADllPanicCopyRectWithNoGc:
865 iGc->CopyRect(point, rect);
868 case EADllPanicResetWithNoGc:
871 case EADllPanicMapColorsWithNoGc:
875 iGc->MapColors(rect, rgbs, 1, ETrue);
878 case EADllPanicDrawTextWithRectWithNoFont:
879 iWindowFunctions->ActivateGc();
880 iGc->DrawText(_L("Panic"),TRect(20,20,20,20),0);
882 case EADllPanicDrawTextVerticalWithNoFont:
883 iWindowFunctions->ActivateGc();
884 iGc->DrawTextVertical(_L("Panic"),TPoint(20,20), EFalse);
886 case EADllPanicDrawTextVerticalWithRectWithNoFont:
887 iWindowFunctions->ActivateGc();
888 iGc->DrawTextVertical(_L("Panic"),TRect(20,20,20,20), 0, EFalse);
890 case EADllPanicInvalidFocusScreenTooBig:
891 (static_cast<MAnimGeneralFunctionsWindowExtension*>(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface)))->SetFocusScreen(3000);
893 case EADllPanicInvalidFocusScreenNegative:
894 (static_cast<MAnimGeneralFunctionsWindowExtension*>(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface)))->SetFocusScreen(-1);
901 void CPanicAnim::DoLeaveInActiveCallback()
903 iWindowFunctions->ActivateGc();
904 User::Leave(KErrUnknown);
907 TInt CPanicAnim::LeaveInActiveCallback(TAny *aThis)
909 CPanicAnim* panicAnim=(CPanicAnim*)aThis;
910 panicAnim->DoLeaveInActiveCallback();
914 void CPanicAnim::StartSyncTest(MAnimGeneralFunctions::TAnimSync aSync)
916 iFunctions->SetSync(aSync);
918 iSyncState=ESyncStateStarting;
921 void CPanicAnim::StartTimeChangeTest()
923 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
924 iSyncMode=MAnimGeneralFunctions::ESyncSecond;
925 iSyncState=ESyncStateTimeChange1;
928 TInt CPanicAnim::CommandReplyL(TInt aOpcode,TAny* aParams)
934 case EADllPanicBadFont:
935 iFunctions->DuplicateFontL(123);
937 case EADllPanicBadBitmap:
938 iFunctions->DuplicateBitmapL(123);
940 case EADllPanicCallPanic:
943 case EADllReadRemoteDescriptor:
946 const RMessagePtr2& message=*iFunctions->Message();
947 TInt bufLength = message.GetDesLength(KIpcSlot);
948 TUint16* heapCell=static_cast<TUint16*>(User::AllocL(bufLength*2));
949 TPtr buf(heapCell,bufLength*2,bufLength*2);
950 const TInt theError=message.Read(KIpcSlot,buf);
951 if(theError == KErrNone)
953 for (TInt index=0;index<bufLength;index++)
958 User::Free(heapCell);
961 case EADllTestWindowSize:
962 return(*pData.Size==iWindowFunctions->WindowSize());
964 iStatusPtr=pData.SyncTests->status;
965 StartSyncTest(pData.SyncTests->syncMode);
967 case EADllTimeChangedTest:
968 iStatusPtr=pData.TimeChangeTest->status;
969 iStatusPtr2=pData.TimeChangeTest->status2;
970 StartTimeChangeTest();
972 case EADllTestSetVisible:
973 if (iWindowFunctions->IsHidden())
975 iWindowFunctions->SetVisible(EFalse);
976 if (!iWindowFunctions->IsHidden())
978 iWindowFunctions->SetVisible(ETrue);
979 if (iWindowFunctions->IsHidden())
980 setVisFailed: return(EFalse);
982 case EADllPanicSetVisWithGcActiveReply:
983 iWindowFunctions->ActivateGc();
984 iWindowFunctions->SetVisible(EFalse);
985 iWindowFunctions->SetVisible(ETrue);
987 case EADllPanicSetClippingRegionWithNoGc:
989 // currently this test fails because when deactivated iWin is also NULL and is deferenced in function
991 TBool err = iGc->SetClippingRegion(region);
994 case EADllPanicDrawPolygonPointsWithNoGc:
996 TRect rect(20,20,20,20);
997 CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
998 CleanupStack::PushL(polyPoints);
999 polyPoints->AppendL(rect.iTl);
1000 polyPoints->AppendL(rect.Center());
1001 polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
1002 iGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
1003 CleanupStack::PopAndDestroy(polyPoints);
1006 case EADllPanicDrawPolygonArrayWithNoGc:
1008 TRect rect(20,20,20,20);
1009 CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
1010 CleanupStack::PushL(polyPoints);
1011 polyPoints->AppendL(rect.iTl);
1012 polyPoints->AppendL(rect.Center());
1013 polyPoints->AppendL(TPoint(rect.iBr.iX, rect.iTl.iY));
1014 iGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
1015 CleanupStack::PopAndDestroy(polyPoints);
1018 case EADllPanicAlphaBlendingBitmapsFbsBitmapWithNoGc:
1020 TRect rect(20,20,20,20);
1021 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
1022 CleanupStack::PushL(bitmap);
1023 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
1024 iGc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, rect, bitmap, TPoint(0,0));
1025 CleanupStack::PopAndDestroy(bitmap);
1028 case EADllPanicDevice:
1030 CGraphicsDevice *device = iGc->Device();
1034 iFunctions->Panic();
1039 void CPanicAnim::FocusChanged(TBool )
1043 TBool CPanicAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1049 // CPanicAnim2 simply panics in the construct //
1050 void CPanicAnim2::ConstructL(TAny *, TBool )
1052 iFunctions->Panic();
1055 void CPanicAnim2::Animate(TDateTime *)
1058 void CPanicAnim2::Redraw()
1061 void CPanicAnim2::Command(TInt , TAny *)
1064 TInt CPanicAnim2::CommandReplyL(TInt , TAny *)
1067 void CPanicAnim2::FocusChanged(TBool )
1070 TBool CPanicAnim2::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1076 // CAutoAnim3 test drawing/redrawing //
1077 void CAutoAnim3::ConstructL(TAny *aParam, TBool )
1079 iRect=*((TRect *)aParam);
1080 iWindowFunctions->SetRect(iRect);
1082 iWindowFunctions->Invalidate(iRect);
1083 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1086 void CAutoAnim3::Animate(TDateTime *)
1088 iWindowFunctions->ActivateGc();
1092 if (iRect.Width()>20 && iRect.Height()>20)
1093 iRect.Shrink(TSize(20,20));
1101 iFunctions->Client().RequestComplete(iStatusPtr,KErrNone);
1102 iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1106 // flip between two sizes
1107 if (iRect.iTl.iX == 10)
1108 iRect.SetRect(40,40,80,80);
1110 iRect.SetRect(10,10,110,110);
1115 void CAutoAnim3::Draw(const TRect &aRect)
1120 iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
1121 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1122 iGc->SetBrushColor(TRgb::Gray256(85));
1123 iGc->SetPenColor(TRgb::Gray256(170));
1124 iGc->DrawEllipse(aRect);
1125 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1127 case 1: // Shrinking box
1128 iGc->SetDrawMode(CGraphicsContext::EDrawModeXOR);
1129 iGc->SetPenColor(TRgb::Gray256(255));
1130 iGc->DrawRect(aRect);
1134 iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
1135 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1136 iGc->SetBrushColor(TRgb::Gray256(85));
1137 iGc->SetPenColor(TRgb::Gray256(170));
1138 iGc->DrawEllipse(aRect);
1139 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
1146 void CAutoAnim3::Redraw()
1151 void CAutoAnim3::Command(TInt aOpcode,TAny* aParam)
1153 TAnimArgUnion pData;
1158 iWindowFunctions->ActivateGc();
1161 iWindowFunctions->SetRect(iRect);
1163 { //Do more extensive testing
1165 iWindowFunctions->Parameters(data);
1168 case EADllStartAnimate:
1169 iWindowFunctions->ActivateGc();
1172 iBaseRect=*pData.Rect;
1174 iWindowFunctions->SetRect(iRect);
1175 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1178 case EADllCancelAnimate:
1179 iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1180 iWindowFunctions->ActivateGc();
1184 case EADllSetVisible:
1185 iWindowFunctions->SetVisible(*pData.Bool);
1187 case EADllSetShadowDrawMode:
1190 case EADllDrawTestScreen:
1191 DrawTestScreenL(pData.DrawTestScreen); //Should move to CommandReplyL as it leaves
1199 TInt CAutoAnim3::CommandReplyL(TInt aOpcode, TAny *aParam)
1201 TAnimArgUnion pData;
1206 case EADllShadowAnimTest:
1207 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1208 iStatusPtr=((TShadowDrawTest *)aParam)->status;
1210 case EADllParameterRectValueTest:
1213 iWindowFunctions->Parameters(wininf);
1214 TRect comp = *(pData.Rect);
1215 ret=(comp==wininf.iScreenPos);
1218 case EADllDoSetSync:
1219 iFunctions->SetSync(static_cast<MAnimGeneralFunctions::TAnimSync>(*pData.Int));
1221 case EADllSetInterval:
1222 iFunctions->SetInterval(*pData.Int);
1228 void CAutoAnim3::FocusChanged(TBool )
1231 //void CAutoAnim3::DrawTestScreen(TDrawTestScreen *aParams)
1232 //Function now at bottom of file
1234 TBool CAutoAnim3::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1240 // CAutoAnimScrBack test drawing/redrawing //
1241 void CAutoAnimScrBack::ConstructL(TAny *aParam, TBool )
1243 iRect=*((TRect *)aParam);
1244 iWindowFunctions->SetRect(iRect);
1246 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
1249 void CAutoAnimScrBack::Animate(TDateTime *)
1251 iWindowFunctions->ActivateGc();
1253 iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
1256 void CAutoAnimScrBack::Draw()
1258 iGc->SetDrawMode(CGraphicsContext::EDrawModePEN);
1260 iGc->SetPenSize(TSize(3,3));
1261 iGc->SetPenColor(TRgb::Gray4(iMode==1 ? 2 : 3));
1262 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1263 iGc->SetBrushColor(TRgb::Gray4(iMode==1 ? 1 : 0));
1264 iGc->DrawRect(iRect);
1267 void CAutoAnimScrBack::Redraw()
1272 void CAutoAnimScrBack::Command(TInt aOpcode,TAny* aParam)
1274 TAnimArgUnion pData;
1278 case EADllDrawOtherRect:
1280 TRect oldRect(iRect);
1282 oldRect.Grow(1,1); // To allow for 3x3 pen size
1285 TRect fullRect(iRect);
1286 fullRect.Grow(1,1); // To allow for 3x3 pen size
1287 iWindowFunctions->Invalidate(oldRect);
1288 iWindowFunctions->SetRect(fullRect);
1289 iWindowFunctions->Invalidate(fullRect);
1291 // iFunctions->ActivateGc();
1297 TInt CAutoAnimScrBack::CommandReplyL(TInt aOpcode, TAny *)
1302 return iWindowFunctions->IsHidden();
1307 void CAutoAnimScrBack::FocusChanged(TBool )
1310 TBool CAutoAnimScrBack::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
1316 // CTestSpriteAnim test sprite access //
1317 void CTestSpriteAnim::ConstructL(TAny* /*aParam*/)
1319 iSpriteFunctions->SizeChangedL();
1320 iSpriteFunctions->Activate(ETrue);
1323 void CTestSpriteAnim::Animate(TDateTime*)
1327 void CTestSpriteAnim::Command(TInt aOpcode,TAny* aParam)
1329 TAnimArgUnion pData;
1333 case EADllSizeChanged:
1334 iSpriteFunctions->Activate(EFalse);
1335 iSpriteFunctions->SizeChangedL(); //Should move to CommandReplyL as it leaves
1337 iSpriteFunctions->Activate(ETrue);
1339 case EADllDeactivate:
1340 iSpriteFunctions->Activate(EFalse);
1343 iSpriteFunctions->SetPosition(*pData.Point);
1348 DrawMemberL(aOpcode-EADllDraw1); //Should move to CommandReplyL as it leaves
1351 DrawMemberL(); //Should move to CommandReplyL as it leaves
1357 TInt CTestSpriteAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
1359 TAnimArgUnion pData;
1363 case EADllCheckMember:
1364 return CheckMember(*pData.SpriteMemberInfo);
1370 TBool CTestSpriteAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1375 TBool CTestSpriteAnim::CheckMember(const TSpriteMemberInfo& aMemInfo)
1377 TSpriteMember spriteMember=*iSpriteFunctions->GetSpriteMember(aMemInfo.iMember);
1378 if (spriteMember.iBitmap->Handle()!=aMemInfo.iBitmapHandle)
1380 if (aMemInfo.iMaskBitmapHandle==0)
1382 if (spriteMember.iMaskBitmap!=NULL)
1387 if (spriteMember.iMaskBitmap->Handle()!=aMemInfo.iMaskBitmapHandle)
1390 if (spriteMember.iInvertMask!=aMemInfo.iInvertMask)
1392 if (spriteMember.iDrawMode!=aMemInfo.iDrawMode)
1394 if (spriteMember.iOffset!=aMemInfo.iOffset)
1396 if (spriteMember.iInterval!=aMemInfo.iInterval)
1401 void CTestSpriteAnim::DrawMemberL(TInt aMember)
1403 CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(aMember)->iBitmap;
1404 CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
1405 CleanupStack::PushL(device);
1407 User::LeaveIfError(device->CreateContext(gc));
1408 CleanupStack::PushL(gc);
1409 //gc->SetBrushColor(TRgb::Gray4((aMember+1)%3));
1410 gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1411 gc->SetPenSize(TSize());
1412 TSize size=bitmap->SizeInPixels();
1413 size.SetSize(size.iWidth/2,size.iHeight/2);
1414 TPoint point=size.AsPoint();
1415 gc->SetBrushColor(TRgb::Gray4(0));
1416 //TRect rect=bitmap->SizeInPixels();
1417 gc->DrawRect(TRect(TPoint(),size));
1418 gc->SetBrushColor(TRgb::Gray4(1));
1419 gc->DrawRect(TRect(TPoint(point.iX,0),size));
1420 gc->SetBrushColor(TRgb::Gray4(2));
1421 gc->DrawRect(TRect(TPoint(0,point.iY),size));
1422 gc->SetBrushColor(TRgb::Gray4(3));
1423 gc->DrawRect(TRect(point,size));
1424 iSpriteFunctions->UpdateMember(aMember,TRect(bitmap->SizeInPixels()),ETrue);
1425 CleanupStack::PopAndDestroy(2);
1428 void CTestSpriteAnim::DrawMemberL()
1430 CFbsBitmap *bitmap=iSpriteFunctions->GetSpriteMember(0)->iBitmap;
1431 CFbsBitmapDevice *device=CFbsBitmapDevice::NewL(bitmap);
1432 CleanupStack::PushL(device);
1434 User::LeaveIfError(device->CreateContext(gc));
1435 CleanupStack::PushL(gc);
1436 gc->SetPenSize(TSize(3,3));
1437 gc->SetPenColor(TRgb::Gray4(1));
1438 TPoint corner=bitmap->SizeInPixels().AsPoint();
1439 gc->DrawLine(TPoint(),corner);
1440 gc->DrawLine(TPoint(0,corner.iY),TPoint(corner.iX,0));
1441 iSpriteFunctions->UpdateMember(0,TRect(bitmap->SizeInPixels()),EFalse);
1442 CleanupStack::PopAndDestroy(2);
1446 // CTestFreeTimerAnim test drawing off own timer //
1447 CTestFreeTimerAnim::~CTestFreeTimerAnim()
1453 void CTestFreeTimerAnim::ConstructL(TAny* /*aParam*/, TBool )
1455 User::LeaveIfNull(iFunctions);
1456 User::LeaveIfNull(iWindowFunctions);
1458 //Configure free-timer anim (these values should be the default ones)
1459 iFunctions->SetSync( MAnimGeneralFunctions::ESyncNone );
1460 iFunctions->SetInterval(0);
1462 iFrameTime = 100000; //default frametime 0.1s
1463 iTimer = CAnimTimer::NewL(*this);
1464 iRect = iWindowFunctions->WindowSize();
1467 #define MAX(a,b) (((a)>(b))?(a):(b))
1469 void CTestFreeTimerAnim::Animate(TDateTime*)
1471 TInt max = MAX(iRect.Width(), iRect.Height());
1474 iRect = iWindowFunctions->WindowSize();
1482 switch(iColour.Value())
1484 case 0x000000: //black
1485 case 0xffffff: //white
1488 case 0x0000ff: //red
1489 iColour = KRgbGreen;
1491 case 0x00ff00: //green
1494 case 0xff0000: //blue
1495 iColour = KRgbBlack;
1500 void CTestFreeTimerAnim::Redraw()
1502 //draw something in the animated colour
1503 iGc->SetBrushColor(iColour);
1504 iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
1505 iGc->SetPenColor(KRgbBlack);
1506 iGc->DrawRect(iRect);
1509 void CTestFreeTimerAnim::Command(TInt aOpcode, TAny* aArgs)
1513 case EStartAnimation:
1514 DisplayNextFrameL();
1516 case EStopAnimation:
1521 iFrameTime = *reinterpret_cast<TInt*>(aArgs);
1528 TInt CTestFreeTimerAnim::CommandReplyL(TInt aOpcode, TAny* aArgs)
1532 case EStartAnimation:
1533 DisplayNextFrameL();
1535 case EStopAnimation:
1540 iFrameTime = *reinterpret_cast<TInt*>(aArgs);
1548 void CTestFreeTimerAnim::FocusChanged(TBool /*aState*/)
1552 TBool CTestFreeTimerAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
1558 void CTestFreeTimerAnim::DisplayNextFrameL()
1560 //Reschedule timer callback
1562 iTimer->After(iFrameTime);
1564 Animate(NULL); //wserv don't animate free-timer animations
1566 //Schedule wserv redraw
1567 MAnimFreeTimerWindowFunctions* windowFunctions = WindowFunctions();
1568 ASSERT(windowFunctions);
1569 windowFunctions->ActivateGc();
1570 windowFunctions->DeactivateGc();
1571 windowFunctions->Update();
1579 Constructs a new bitmap animation timer object,and adds the specified active object to the current active scheduler.
1581 @param aObserver a pointer to MAnimTimerObserver
1583 CAnimTimer::CAnimTimer(MAnimTimerObserver& aObserver)
1584 :CTimer(EPriorityStandard),
1587 CActiveScheduler::Add(this);
1591 Frees resources owned by the object prior to deletion.
1593 CAnimTimer::~CAnimTimer()
1598 Creates a new bitmap animation timer object.
1600 @param aObserver A pointer to the MAnimTimerObserver
1601 @return A pointer to the new bitmap animation timer object.
1603 CAnimTimer* CAnimTimer::NewL(MAnimTimerObserver& aObserver)
1605 CAnimTimer* timer=new(ELeave) CAnimTimer(aObserver);
1606 CleanupStack::PushL(timer);
1607 timer->ConstructL();
1608 CleanupStack::Pop();
1613 Completes construction of the bitmap animation timer object and
1614 constructs a new asynchronous timer.
1616 void CAnimTimer::ConstructL()
1618 CTimer::ConstructL();
1622 Handles an active object's request completion event.
1623 Invokes the function to draw the next frame
1625 void CAnimTimer::RunL()
1627 iAnim.DisplayNextFrameL();
1630 // CEventTestAnimBase base class for event test anims //
1631 CEventTestAnimBase::~CEventTestAnimBase()
1633 iFunctions->GetRawEvents(EFalse);
1636 void CEventTestAnimBase::ConstructL(TAny* /*aParam*/, TBool )
1638 iExpectedEvents.SetLengthL(EEventBufferSize);
1641 void CEventTestAnimBase::Animate(TDateTime*)
1645 void CEventTestAnimBase::Redraw()
1649 void CEventTestAnimBase::Command(TInt /*aOpcode*/, TAny* /*aParam*/)
1657 void CEventTestAnimBase::FocusChanged(TBool /*aState*/)
1661 // Base class common client server interface
1662 TInt CEventTestAnimBase::CommandReplyL(TInt aOpcode,TAny* aParam)
1664 TAnimArgUnion pData;
1668 case EADllAddExpectedEvent:
1669 return AddExpectedEvent(pData.AnimRawEvent);
1670 case EADllNumberOfEventsReceived:
1672 case EADllErrorCode:
1675 iExpectedEvents.Reset();
1684 TBool CEventTestAnimBase::HandleRecursiveEvent(const TRawEvent& aRawEvent)
1686 if (aRawEvent.ScanCode() == 60)
1689 rawEvent.Set(TRawEvent::EKeyUp, 34);
1690 iFunctions->PostRawEvent(rawEvent);
1691 rawEvent.Set(TRawEvent::EKeyUp, 35);
1692 iFunctions->PostRawEvent(rawEvent);
1698 TBool CEventTestAnimBase::OfferRawEvent(const TRawEvent& aRawEvent)
1700 // Do not consume the following types of events
1701 if (IsIgnorableEvent(aRawEvent))
1706 // Increment event count if not in an error state
1712 // For anim which generates recursive events
1713 if (aRawEvent.Type() == TRawEvent::EKeyDown && aRawEvent.ScanCode() == 60)
1715 return HandleRecursiveEvent(aRawEvent);
1718 TAnimRawEvent event;
1720 if (!GetNextExpectedEvent(event))
1726 // Fail if wrong event type
1727 if (!CompareEvents(event.iRawEvent, aRawEvent))
1735 TBool CEventTestAnimBase::GetNextExpectedEvent(TAnimRawEvent& aRawEvent)
1737 // Get next expected event
1738 if (iExpectedEvents.Remove(&aRawEvent)<1)
1749 TBool CEventTestAnimBase::IsIgnorableEvent(const TRawEvent& aRawEvent) const
1751 TRawEvent::TType aType=aRawEvent.Type();
1752 TBool result = (aType==TRawEvent::EActive || aType==TRawEvent::EInactive || aType==TRawEvent::ERedraw
1753 || (iExpectedEvents.Count()==0 && aType==TRawEvent::EPointerMove));
1758 TBool CEventTestAnimBase::CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent) const
1760 TRawEvent::TType eType=aExpectedEvent.Type();
1761 TRawEvent::TType aType=aActualEvent.Type();
1770 case TRawEvent::EUpdateModifiers:
1772 TInt eMod=aExpectedEvent.Modifiers(),aMod=aActualEvent.Modifiers();
1779 case TRawEvent::EKeyDown:
1780 case TRawEvent::EKeyUp:
1782 TInt eScan=aExpectedEvent.ScanCode(),aScan=aActualEvent.ScanCode();
1789 case TRawEvent::EPointerMove:
1790 case TRawEvent::EPointerSwitchOn:
1791 case TRawEvent::EButton1Down:
1792 case TRawEvent::EButton1Up:
1793 case TRawEvent::EButton2Down:
1794 case TRawEvent::EButton2Up:
1795 case TRawEvent::EButton3Down:
1796 case TRawEvent::EButton3Up:
1798 TPoint ePoint=aExpectedEvent.Pos(),aPoint=aActualEvent.Pos();
1811 void CEventTestAnimBase::Fail()
1819 inline TInt CEventTestAnimBase::Error() const
1824 inline TInt CEventTestAnimBase::EventCount() const
1829 inline void CEventTestAnimBase::ResetEventCount()
1834 inline TInt CEventTestAnimBase::TotalExpectedEvents() const
1836 return iExpectedEvents.Count();
1839 inline TInt CEventTestAnimBase::AddEvent(const TAnimRawEvent* aEvent)
1841 return iExpectedEvents.Add(aEvent);
1844 // CEventTestAnim test drawing off own timer //
1845 CEventTestAnim::~CEventTestAnim()
1847 UnloadDeviceDriver();
1850 void CEventTestAnim::ConstructL(TAny* aParam, TBool aBool)
1852 CEventTestAnimBase::ConstructL(aParam, aBool);
1853 iFunctions->GetRawEvents(ETrue);
1854 iDevDriverLoaded=EFalse;
1857 TInt CEventTestAnim::UnloadDeviceDriver()
1861 if (iDevDriverLoaded)
1863 err=User::FreeLogicalDevice(REventDD::BinaryName());
1865 iDevDriverLoaded=EFalse;
1870 TInt CEventTestAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
1872 return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
1875 TInt CEventTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
1879 case EADllNoEventsAndReset:
1881 TInt events=EventCount();
1885 case EADllLoadDeviceDriver:
1887 TInt err=User::LoadLogicalDevice(REventDD::BinaryName());
1888 if (err==KErrNone || err==KErrAlreadyExists)
1890 TInt err2=iLdd.Open();
1894 iDevDriverLoaded=ETrue;
1895 else //Only unload if we loaded it
1896 User::FreeLogicalDevice(REventDD::BinaryName());
1902 case EADllUnloadDeviceDriver:
1903 return UnloadDeviceDriver();
1904 case EADllSendEvent:
1906 TAnimRawEvent event;
1907 TInt events=*static_cast<TInt*>(aParam);
1910 for (ii=events;ii>0;--ii)
1912 event.iRawEvent.Set(ii/2==0 ? TRawEvent::ECaseOpen : TRawEvent::ECaseClose);
1913 //TInt err=UserSvr::AddEvent(event.iRawEvent);
1914 //Need to do the above line here, but don't have enough capability
1915 //so call a device driver to do it instead
1916 err=iLdd.SendEvent(event.iRawEvent);
1920 AddExpectedEvent(&event);
1925 return CEventTestAnimBase::CommandReplyL(aOpcode, aParam);
1929 void CEventTestAnim::Command(TInt aOpcode,TAny* /*aParam*/)
1933 case EADllAfterEvent:
1934 if (TotalExpectedEvents()>0)
1941 // CEventPostingAnim test posting of anim events //
1942 CEventPostingAnim::~CEventPostingAnim()
1946 void CEventPostingAnim::ConstructL(TAny* aParam, TBool aBool)
1948 CEventTestAnimBase::ConstructL(aParam, aBool);
1949 iFunctions->GetRawEvents(ETrue);
1952 TInt CEventPostingAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
1954 return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
1957 TBool CEventPostingAnim::OfferRawEvent(const TRawEvent &aRawEvent)
1959 // Call PostRawEvent or PostKeyEvent according to type of the event
1960 TBool ret = CEventTestAnimBase::OfferRawEvent(aRawEvent);
1963 if (aRawEvent.Type() == TRawEvent::EKeyDown && aRawEvent.ScanCode() == 45)
1970 // This is to check the normal PostKeyEvent API
1971 iFunctions->PostKeyEvent(event);
1973 // This is to check the newly added API
1974 iFunctions->EventExtension()->PostKeyEvent(event, 2);
1978 iFunctions->PostRawEvent(aRawEvent);
1984 // CTimerTestAnim check that timer events stop //
1985 CTimerTestAnim::~CTimerTestAnim()
1989 void CTimerTestAnim::ConstructL(TAny* /*aParam*/, TBool )
1991 iWindowFunctions->SetRect(TRect(0,0,1,1));
1992 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
1993 iExpectingTicks=ETrue;
1997 void CTimerTestAnim::Animate(TDateTime*)
2000 if (!iExpectingTicks)
2004 void CTimerTestAnim::Redraw()
2008 void CTimerTestAnim::Command(TInt aOpcode, TAny* /*aParam*/)
2012 case EADllResetCount:
2016 iExpectingTicks=EFalse;
2017 iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
2019 case EADllTimerStarted:
2020 iExpectingTicks=ETrue;
2021 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
2027 TInt CTimerTestAnim::CommandReplyL(TInt aOpcode, TAny* /*aParam*/)
2031 case EADllCurrentCount:
2040 void CTimerTestAnim::FocusChanged(TBool /*aState*/)
2044 TBool CTimerTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
2050 // CWinFunctionTestAnim test drawing off own timer //
2051 CWinFunctionTestAnim::~CWinFunctionTestAnim()
2054 void CWinFunctionTestAnim::ConstructL(TAny* /*aParam*/,TBool)
2056 iWinFunctions=static_cast<MAnimGeneralFunctionsWindowExtension*>
2057 (iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface));
2060 void CWinFunctionTestAnim::Animate(TDateTime*)
2063 void CWinFunctionTestAnim::Redraw()
2066 void CWinFunctionTestAnim::Command(TInt /*aOpcode*/,TAny* /*aParam*/)
2074 TInt CWinFunctionTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
2076 TAnimArgUnion pData;
2081 return iWinFunctions->Screens();
2082 case EADllFocusScreen:
2083 return iWinFunctions->FocusScreens();
2084 case EADllWindowGroups:
2085 return iWinFunctions->WindowGroups(*pData.Int);
2086 case EADllWindowGroupInfo:
2088 const TWindowGroupInfoParms& params=*pData.WindowGroupInfoParms;
2089 TPckgBuf<MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo> info;
2090 TBool ret=iWinFunctions->WindowGroupInfo(info(),params.iScreen,params.iOrdinalPosition);
2091 /*const TInt theError=*/(*iFunctions->Message()).Write(KIpcSlot,info);
2094 case EADllWindowGroupName:
2096 const TWindowGroupInfoParms& params=*pData.WindowGroupInfoParms;
2098 TBool ret=iWinFunctions->WindowGroupName(name,params.iScreen,params.iOrdinalPosition);
2099 /*const TInt theError=*/(*iFunctions->Message()).Write(KIpcSlot,name);
2102 case EADllSetOrdinalPosition:
2104 const TSetOrdinalParms& params=*pData.SetOrdinalParms;
2105 return iWinFunctions->SetOrdinalPosition(params.iIdentifier,params.iOrdinalPosition,params.iOrdinalPriority);
2107 case EADllSetFocusScreen:
2109 const TInt& params=*pData.Int;
2110 iWinFunctions->SetFocusScreen(params);
2118 void CWinFunctionTestAnim::FocusChanged(TBool /*aState*/)
2121 TBool CWinFunctionTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
2127 // CNotificationTestAnim
2128 CNotificationTestAnim::CNotificationTestAnim() : iHeartbeatState(EFalse) , iScreenDeviceChanged(ETrue)
2132 CNotificationTestAnim::~CNotificationTestAnim()
2134 // Removed for test case GRAPHICS-WSERV-0139 for DEF12220
2135 // iFunctions->RegisterForNotifications(EFalse);
2138 void CNotificationTestAnim::ConstructL(TAny* /*aParam*/, TBool )
2140 iWindowFunctions->SetRect(TRect(0,0,1,1));
2141 iFunctions->RegisterForNotifications(EDirectScreenAccess|EHeartbeatTimer|EScreenDeviceChange);
2142 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
2143 iLastAnimTime.UniversalTime();
2146 void CNotificationTestAnim::HandleNotification(const TWsEvent& aEvent)
2148 switch (aEvent.Type())
2150 case EEventDirectScreenAccessBegin:
2152 TInt screenNum = *(aEvent.Int());
2153 iDSA[screenNum] = ETrue;
2156 case EEventDirectScreenAccessEnd:
2158 TInt screenNum = *(aEvent.Int());
2159 iDSA[screenNum] = EFalse;
2162 case EEventHeartbeatTimerStateChange:
2164 iHeartbeatState=*aEvent.Int();
2167 case EEventScreenDeviceChanged:
2169 iScreenDeviceChanged=!iScreenDeviceChanged;
2177 void CNotificationTestAnim::Animate(TDateTime*)
2179 iLastAnimTime.UniversalTime();
2182 void CNotificationTestAnim::Redraw()
2186 void CNotificationTestAnim::Command(TInt /*aOpcode*/, TAny* /*aParam*/)
2190 TInt CNotificationTestAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
2192 TAnimArgUnion pData;
2198 TInt screenNum = *pData.Int;
2199 return iDSA[screenNum];
2201 case EADllQueryHeartbeatState:
2203 return iHeartbeatState;
2205 case EADllIsAnimating:
2207 // Check if the anim DLL is currently animating by comparing
2208 // the current time with the last anim time - if this is greater than a second
2209 // then we are not animating
2211 timeNow.UniversalTime();
2212 TTimeIntervalMicroSeconds microSecs = timeNow.MicroSecondsFrom(iLastAnimTime);
2213 if(microSecs > TTimeIntervalMicroSeconds(1200000)) // 1 sec plus 0.2 secs to cope with any latency
2227 void CNotificationTestAnim::FocusChanged(TBool /*aState*/)
2231 TBool CNotificationTestAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
2236 // CTransAnim test drawing//
2237 void CTransAnim::ConstructL(TAny* aParam, TBool)
2239 iRect=*static_cast<TRect*>(aParam);//Assigns the animation area
2240 iWindowFunctions->SetRect(iRect);
2241 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
2246 void CTransAnim::Animate(TDateTime*)
2248 iWindowFunctions->ActivateGc();
2249 if(iMode==1) //Draw line mode
2251 DoDraw(iDraw,*iGc,iColor,iRect);
2253 else if(iMode==2) //Draw text mode
2255 DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
2259 void CTransAnim::Redraw()
2261 DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
2264 void CTransAnim::Command(TInt aOpcode,TAny* aParam)
2266 TAnimArgUnion pData;
2270 case EADllDrawNow: //Used to draw a single frame
2271 iWindowFunctions->ActivateGc();
2275 DoDraw(iDraw,*iGc,iColor,iRect);
2277 case EADllNextFrame: //Used to draw a continous frame
2279 iColor=pData.FrameData->color;
2280 iDraw=pData.FrameData->draw;
2281 iCount=pData.FrameData->text;
2283 case EADllStartAnimText: //Used to start text animate
2284 iWindowFunctions->ActivateGc();
2287 iFont=iFunctions->DuplicateFontL(pData.FrameData->font);
2288 iColor=pData.FrameData->color;
2289 iCount=pData.FrameData->text;
2290 if(pData.FrameData->sync==EStateFlash)
2291 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
2292 else if(pData.FrameData->sync==EStateSecond)
2293 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
2294 DoDraw(iDraw,*iGc,iColor,iRect,iFont,iCount);
2296 case EADllEndAnimText: //Used to end text animate
2297 iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
2298 iWindowFunctions->ActivateGc();
2301 iFunctions->CloseFont(iFont);
2307 TInt CTransAnim::CommandReplyL(TInt /*aOpcode*/, TAny* /*aParam*/)
2312 void CTransAnim::FocusChanged(TBool /*aState*/)
2315 TBool CTransAnim::OfferRawEvent(const TRawEvent& /*aRawEvent*/)
2320 // an anim dll that doesn't remove itself from the event handler list
2321 CTestHandlerAnim::~CTestHandlerAnim()
2325 void CTestHandlerAnim::ConstructL(TAny* /*aArgs*/, TBool /*aHasFocus*/)
2327 iFunctions->GetRawEvents(ETrue);
2330 void CTestHandlerAnim::Redraw()
2334 void CTestHandlerAnim::FocusChanged(TBool /*aState*/)
2338 TInt CTestHandlerAnim::CommandReplyL(TInt /*aOpcode*/, TAny* /*aArgs*/)
2343 void CTestHandlerAnim::Command(TInt /*aOpcode*/, TAny* /*aArgs*/)
2347 void CTestHandlerAnim::Animate(TDateTime* /*aDateTime*/)
2351 TBool CTestHandlerAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
2356 // CRemovableAnim Test removal of anim during event handling //
2357 CRemovableAnim::~CRemovableAnim()
2361 TInt CRemovableAnim::AddExpectedEvent(const TAnimRawEvent* aEvent)
2363 if (TotalExpectedEvents() + EventCount() < iLifetime)
2365 return (AddEvent(aEvent) ? KErrNone : KErrOverflow);
2373 TInt CRemovableAnim::CommandReplyL(TInt aOpcode,TAny* aParam)
2375 TAnimArgUnion pData;
2379 case EADllSetEventHandlerLifetime:
2380 iLifetime = *pData.Int;
2382 case EADllEventHandlerLifetime:
2384 case EADllAddToEventHandlers:
2385 iFunctions->GetRawEvents(ETrue);
2387 case EADllRemoveFromEventHandlers:
2388 iFunctions->GetRawEvents(EFalse);
2390 case EADllTestPassed:
2392 // If any unexpected events are received, then Error() > 0
2393 // If fewer than the number of expected events are received, then TotalExpectedEvents() > 0
2394 TBool passed = (Error() == 0) && (TotalExpectedEvents() == 0);
2398 return CEventTestAnimBase::CommandReplyL(aOpcode, aParam);
2403 TBool CRemovableAnim::OfferRawEvent(const TRawEvent& aRawEvent)
2405 TBool eat = CEventTestAnimBase::OfferRawEvent(aRawEvent);
2407 // Remove anim from event handlers if lifetime has been exceeded
2408 if (EventCount() >= iLifetime)
2410 iFunctions->GetRawEvents(EFalse);
2415 // CMultiPointerAnim for Testing multipointerevents for anims //
2416 CMultiPointerAnim::~CMultiPointerAnim()
2418 iFunctions->GetRawEvents(EFalse);
2421 // Important thing here is to call GetRawEvents() which Switches animation raw event handling on
2422 void CMultiPointerAnim::ConstructL(TAny */*aArgs*/, TBool /*aHasFocus*/)
2424 iExpectedEvents.SetLengthL(EEventBufferSize);
2425 iFunctions->GetRawEvents(ETrue);
2428 void CMultiPointerAnim::Animate(TDateTime */*aDateTime*/)
2432 void CMultiPointerAnim::Command(TInt /*aOpcode*/, TAny */*aArgs*/)
2436 TInt CMultiPointerAnim::CommandReplyL(TInt aOpcode, TAny *aArgs)
2438 TAnimArgUnion pData;
2442 case EADllAddExpectedMultiPtrEvent:
2443 return AddEvent(pData.AnimRawEvent);
2444 case EADllMultiPtrEventError:
2446 case EADllMultiPtrEventErrorDesc:
2447 if (iError != KErrNone)
2449 // returns the error description which gets displayed in logs if test failed
2450 const RMessagePtr2& message=*iFunctions->Message();
2451 const TInt error=message.Write(KIpcSlot, iErrorDes);
2452 if (error != KErrNone)
2458 case EADllMultiPtrEventReset:
2459 iExpectedEvents.Reset();
2468 void CMultiPointerAnim::Redraw()
2472 void CMultiPointerAnim::FocusChanged(TBool /*aState*/)
2476 TBool CMultiPointerAnim::OfferRawEvent(const TRawEvent &aRawEvent)
2478 // Ignore following raw events
2479 TRawEvent::TType aType=aRawEvent.Type();
2480 if (aType==TRawEvent::EActive || aType==TRawEvent::EInactive || aType==TRawEvent::ERedraw
2481 || aType==TRawEvent::EPointerSwitchOn || aType==TRawEvent::EUpdateModifiers)
2486 // If it has already failed then do not test other events becasue the error value
2487 // and its descriptor will be over written
2493 TAnimRawEvent expectedEvent;
2494 if (iExpectedEvents.Remove(&expectedEvent)<1)
2499 // Increment event count
2502 // Call compare events function passing in both the events
2503 if (!CompareEvents(expectedEvent.iRawEvent, aRawEvent))
2505 iError = iEventCount;
2508 return expectedEvent.iEat;
2511 TInt CMultiPointerAnim::AddEvent(const TAnimRawEvent* aEvent)
2513 return iExpectedEvents.Add(aEvent);
2516 TBool CMultiPointerAnim::CompareEvents(const TRawEvent& aExpectedEvent, const TRawEvent& aActualEvent)
2518 // Check pointer type
2519 if (aExpectedEvent.Type() != aActualEvent.Type())
2521 _LIT(KEventType, "Actual Event type = %d Expected Event Type = %d ");
2522 iErrorDes.Format(KEventType, aActualEvent.Type(), aExpectedEvent.Type());
2526 // Here for EOutOfRange we cannot query Pos or Pos3D...
2527 if (aExpectedEvent.Type() != TRawEvent::EPointer3DOutOfRange)
2529 // Check 3d position
2530 TPoint3D expected3DPos = aExpectedEvent.Pos3D();
2531 TPoint3D actual3DPos = aActualEvent.Pos3D();
2532 if (expected3DPos.iX != actual3DPos.iX)
2534 _LIT(KXPosition, "Actual X coordinate = %d Expected X coordinate = %d ");
2535 iErrorDes.Format(KXPosition, actual3DPos.iX, expected3DPos.iX);
2538 if (expected3DPos.iY != actual3DPos.iY)
2540 _LIT(KYPosition, "Actual Y coordinate = %d Expected Y coordinate = %d ");
2541 iErrorDes.Format(KYPosition, actual3DPos.iY, expected3DPos.iY);
2544 if (expected3DPos.iZ != actual3DPos.iZ)
2546 _LIT(KZPosition, "Actual Z coordinate = %d Expected Z coordinate = %d ");
2547 iErrorDes.Format(KZPosition, actual3DPos.iZ, expected3DPos.iZ);
2552 // Check pointer number
2553 if (aExpectedEvent.PointerNumber() != aActualEvent.PointerNumber())
2555 _LIT(KPointerNumber, "Actual Pointer number = %d Expected Pointer number = %d ");
2556 iErrorDes.Copy(KPointerNumber);
2557 iErrorDes.Format(KPointerNumber, aActualEvent.PointerNumber(), aExpectedEvent.PointerNumber());
2563 // CCoverageAnim test drawing/redrawing //
2564 CCoverageAnim::~CCoverageAnim()
2566 if(iFont && iFunctions)
2567 iFunctions->CloseFont(iFont);
2571 Initializes members.
2573 void CCoverageAnim::ConstructL(TAny *aParam, TBool )
2575 iRect=*static_cast<TRect*>(aParam);
2576 iWindowFunctions->SetRect(iRect);
2577 iWindowFunctions->Invalidate(iRect);
2579 iFunctions->SetSync(MAnimGeneralFunctions::ESyncDay);
2580 if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncDay)
2581 User::Leave(KErrGeneral);
2583 iFunctions->SetSync(MAnimGeneralFunctions::ESyncMinute);
2584 if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncMinute)
2585 User::Leave(KErrGeneral);
2587 iFunctions->SetSync(MAnimGeneralFunctions::ESyncSecond);
2588 if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncSecond)
2589 User::Leave(KErrGeneral);
2591 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
2592 if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncFlash)
2593 User::Leave(KErrGeneral);
2595 iFunctions->SetSync(MAnimGeneralFunctions::ESyncNone);
2596 if (iFunctions->Sync() != MAnimGeneralFunctions::ESyncNone)
2597 User::Leave(KErrGeneral);
2599 iFunctions->SetInterval(1);
2600 iFunctions->SetInterval(0);
2601 iFunctions->SetNextInterval(0);
2603 User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::ENumberOfExtendedInterfaces));
2604 User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EWindowExtensionInterface));
2605 User::LeaveIfNull(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EEventExtentionInterface));
2606 User::LeaveIfError(iFunctions->ExtendedInterface(MAnimGeneralFunctions::EInterfaceCount) != NULL);
2608 #if !defined(SYMBIAN_GRAPHICS_GCE)
2609 // Deprecated in NGA but needs to be tested in NONNGA
2610 User::LeaveIfNull((TAny*)iFunctions->ScreenDevice());
2613 iFunctions->Client();
2617 Copied from CAutoAnimScrBack.
2619 void CCoverageAnim::Animate(TDateTime *)
2621 iWindowFunctions->ActivateGc();
2626 All methods of the graphic-context are executed one by one.
2628 void CCoverageAnim::Draw()
2630 iGc->SetClippingRect(iRect);
2634 iGc->SetDrawMode(CGraphicsContext::EDrawModeAND);
2635 iGc->SetBrushStyle(CGraphicsContext::ENullBrush);
2636 iGc->SetBrushColor(TRgb::Gray256(85));
2637 iGc->SetBrushOrigin(TPoint(0,0));
2638 iGc->SetPenColor(TRgb::Gray256(170));
2640 //primitive method calls
2641 iGc->SetFaded(ETrue);
2642 iGc->SetFadingParameters(1, 1);
2644 iGc->SetPenStyle(CGraphicsContext::ESolidPen);
2645 iGc->SetStrikethroughStyle(EStrikethroughOff);
2646 iGc->SetUnderlineStyle(EUnderlineOff);
2647 iGc->SetWordJustification(2, 1);
2650 iGc->UseFont(iFont);
2653 TPoint(iRect.Center().iX, iRect.iTl.iY),
2654 TPoint(iRect.iBr.iX, iRect.Center().iY));
2655 iGc->DrawLine(iRect.iTl,iRect.Center());
2656 iGc->DrawLineTo(TPoint(iRect.iBr.iX, iRect.iTl.iY));
2658 iGc->DrawLineBy(TPoint(iRect.iTl.iX, iRect.iBr.iY));
2659 iGc->MoveBy(iRect.iTl + TPoint(1,1));
2660 iGc->MoveTo(iRect.iTl + TPoint(0,0));
2661 iGc->SetPenSize(TSize(10,10));
2662 iGc->Plot(iRect.iTl + TPoint(2,2));
2663 iGc->SetPenSize(TSize(1,1));
2665 CArrayFixFlat<TPoint>* polyPoints = new(ELeave) CArrayFixFlat<TPoint>(3); //CArrayFixFlat
2666 CleanupStack::PushL(polyPoints);
2667 polyPoints->AppendL(iRect.iTl);
2668 polyPoints->AppendL(iRect.Center());
2669 polyPoints->AppendL(TPoint(iRect.iBr.iX, iRect.iTl.iY));
2671 iGc->DrawPolyLine(polyPoints);
2672 iGc->DrawPolyLine(&polyPoints->At(0), 3);
2673 iGc->DrawPolygon(polyPoints, CGraphicsContext::EWinding);
2674 iGc->DrawPolygon(&polyPoints->At(0), 3, CGraphicsContext::EAlternate);
2676 iGc->DrawPie(iRect, TPoint(iRect.Center().iX, iRect.iTl.iY), TPoint(iRect.iBr.iX, iRect.Center().iY));
2677 iGc->DrawEllipse(iRect);
2678 iGc->DrawRect(iRect);
2679 iGc->DrawRoundRect(iRect, TSize(iRect.Width()/8, iRect.Height()/8));
2681 CleanupStack::PopAndDestroy(polyPoints);
2683 iGc->CopyRect(TPoint(10, 10), iRect);
2685 CFbsBitmap* bitmap = new(ELeave) CFbsBitmap();
2686 CleanupStack::PushL(bitmap);
2687 User::LeaveIfError(bitmap->Create(TSize(16,16),EGray4));
2689 iGc->UseBrushPattern(bitmap);
2690 iGc->DrawBitmap(iRect.iTl, bitmap);
2691 iGc->DrawBitmap(iRect, bitmap);
2692 iGc->DrawBitmap(iRect, bitmap, TRect(0, 0, 16, 16));
2693 iGc->DrawBitmapMasked(iRect, bitmap, TRect(0, 0, 16, 16), bitmap, ETrue);
2695 iGc->BitBlt(TPoint(0, 0), bitmap);
2696 iGc->BitBlt(TPoint(0, 0), bitmap, iRect);
2697 iGc->BitBltMasked(TPoint(0, 0), bitmap, iRect, bitmap, ETrue);
2698 iGc->AlphaBlendBitmaps(TPoint(0, 0), bitmap, iRect, bitmap, TPoint(0,0));
2700 CleanupStack::PopAndDestroy(bitmap);
2702 iGc->SetCharJustification(1,1);
2703 iGc->SetClippingRect(iRect);
2706 _LIT(KHelloWorld,"Hello World");
2707 iGc->DrawText(*&KHelloWorld, iRect.iTl);
2708 iGc->DrawText(*&KHelloWorld, iRect, 0, CGraphicsContext::ELeft, 0);
2709 iGc->DrawTextVertical(*&KHelloWorld, iRect.iBr, ETrue);
2710 iGc->DrawTextVertical(*&KHelloWorld, iRect, 0, ETrue, CGraphicsContext::ELeft, 0);
2714 iGc->MapColors(iRect, rgbs, 1, ETrue);
2715 iGc->DiscardBrushPattern();
2720 iFunctions->CloseFont(0);
2722 TDateTime dt = iFunctions->SystemTime();
2726 Copied from CAutoAnim3.
2728 void CCoverageAnim::Redraw()
2734 Copied from CAutoAnim3.
2736 void CCoverageAnim::Command(TInt ,TAny*)
2741 Copied from CAutoAnim3.
2743 TInt CCoverageAnim::CommandReplyL(TInt aOpcode , TAny* aParam)
2745 TAnimArgUnion pData;
2750 iFunctions->SetSync(MAnimGeneralFunctions::ESyncFlash);
2755 iFunctions->CloseFont(iFont);
2758 iFont = iFunctions->DuplicateFontL(*pData.Int);
2765 Copied from CAutoAnim3.
2767 void CCoverageAnim::FocusChanged(TBool )
2771 Copied from CAutoAnim3.
2773 TBool CCoverageAnim::OfferRawEvent(const TRawEvent &/*aRawEvent*/)
2781 CAnim *CTestAnimDll::CreateInstanceL(TInt aType)
2786 case EAnimTypeTest1:
2787 anim=new(ELeave) CPanicAnim();
2789 case EAnimTypeTest2:
2790 anim=new(ELeave) CPanicAnim2();
2792 case EAnimTypeTest3:
2793 anim=new(ELeave) CAutoAnim3();
2795 case EAnimTypeScrBackTest:
2796 anim=new(ELeave) CAutoAnimScrBack();
2798 case EAnimTypeSprite:
2799 anim=new(ELeave) CTestSpriteAnim();
2801 case EAnimTypeFreeTimer:
2802 anim=new(ELeave) CTestFreeTimerAnim();
2804 case EAnimTypeEventTest:
2805 anim=new(ELeave) CEventTestAnim();
2807 case EAnimTypeNotificationTest:
2808 anim=new(ELeave) CNotificationTestAnim();
2810 case EAnimTypeTimer:
2811 anim=new(ELeave) CTimerTestAnim();
2813 case EAnimTypeWindowFunctions:
2814 anim=new(ELeave) CWinFunctionTestAnim();
2816 case EAnimTypeTrans:
2817 anim=new(ELeave) CTransAnim();
2819 case EAnimTypeEventHandler:
2820 anim = new (ELeave) CTestHandlerAnim();
2822 case EAnimTypeRemovableAnim:
2823 anim=new(ELeave) CRemovableAnim();
2825 case EAnimTypeEventPostingTest:
2826 anim=new(ELeave) CEventPostingAnim();
2828 case EAnimTypeCoverage:
2829 anim=new(ELeave) CCoverageAnim();
2831 case EAnimTypeMultiPointer:
2832 anim=new(ELeave) CMultiPointerAnim();
2838 // Dummy E32Dll needed by E32 to build //
2840 void CAutoAnim3::DrawTestScreenL(const TDrawTestScreen* aParams)
2841 //Moved here as the include messes up the debugging of the rest of the file.
2843 CFbsBitmap *aBitmap=iFunctions->DuplicateBitmapL(aParams->bitmap);
2844 CleanupStack::PushL(aBitmap);
2845 CFbsBitmap *aMaskBitmap=iFunctions->DuplicateBitmapL(aParams->maskBitmap);
2846 CleanupStack::PushL(aMaskBitmap);
2847 CFbsFont *aFont=iFont=iFunctions->DuplicateFontL(aParams->font);
2848 TSize size(iWindowFunctions->WindowSize());
2849 iWindowFunctions->ActivateGc();
2850 CBitmapContext *gc=iGc;
2851 TBool aExtraDrawBitMap=ETrue;
2853 #include "DLLDRAW.H"
2855 iFunctions->CloseFont(iFont);
2857 CleanupStack::PopAndDestroy(2);