|
1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 /** |
|
17 @file |
|
18 @test |
|
19 @internalComponent - Internal Symbian test code |
|
20 */ |
|
21 |
|
22 #if !defined(__TBMPANIMSTEP_H__) |
|
23 #define __TBMPANIMSTEP_H__ |
|
24 |
|
25 |
|
26 #include <test/testexecutestepbase.h> |
|
27 #include "TBmpAnimTestServer.h" |
|
28 #include <coeaui.h> |
|
29 #include <eikappui.h> |
|
30 #include <eikapp.h> |
|
31 #include <eikdoc.h> |
|
32 #include <techview/eikdialg.h> |
|
33 #include <techview/eikchlst.h> |
|
34 #include <techview/eikchkbx.h> |
|
35 #include <techview/eikmfne.h> |
|
36 #include <techview/eikmenup.h> |
|
37 #include <eikenv.h> |
|
38 #include "Tanctl.h" |
|
39 #include "appfwk_test_AppUi.h" |
|
40 |
|
41 enum TContainerPanic |
|
42 { |
|
43 TContainerPanicNoArray, |
|
44 TContainerNoWindow, |
|
45 TContainerInalidPointer, |
|
46 TInvalidIndex |
|
47 }; |
|
48 |
|
49 |
|
50 class CTBmpAnimStep : public CTmsTestStep |
|
51 { |
|
52 public: |
|
53 CTBmpAnimStep(); |
|
54 ~CTBmpAnimStep(); |
|
55 // virtual TVerdict doTestStepPreambleL(); |
|
56 // virtual TVerdict doTestStepPostambleL(); |
|
57 virtual TVerdict doTestStepL(); |
|
58 void ConstructAppL(CEikonEnv* aCoe); |
|
59 private: |
|
60 }; |
|
61 |
|
62 // |
|
63 // CAnimationDlg |
|
64 // |
|
65 class CAnimationDlg : public CEikDialog |
|
66 { |
|
67 public: |
|
68 CAnimationDlg(TFileName iFileName); |
|
69 ~CAnimationDlg(); |
|
70 private: |
|
71 TBool OkToExitL(TInt aKeyCode); |
|
72 void PostLayoutDynInitL(); |
|
73 SEikControlInfo CreateCustomControlL(TInt aControlType); |
|
74 static TInt Execute(TAny* aDialog); |
|
75 private: |
|
76 TFileName iFileName; |
|
77 TBool iAuto; |
|
78 CPeriodic *iTimer; |
|
79 }; |
|
80 |
|
81 // |
|
82 // |
|
83 // class CColorSchemeDlg |
|
84 // |
|
85 |
|
86 class CColorSchemeDlg : public CEikDialog |
|
87 { |
|
88 public: |
|
89 CColorSchemeDlg(TInt& aChoice); |
|
90 ~CColorSchemeDlg() {}; |
|
91 private: // from CEikDialog |
|
92 TBool OkToExitL(TInt aKeycode); |
|
93 void PreLayoutDynInitL(); |
|
94 TInt& iChoice; |
|
95 }; |
|
96 |
|
97 // |
|
98 // |
|
99 // class TAnimationAttributesDlg |
|
100 // |
|
101 |
|
102 enum TAnimationFlag |
|
103 { |
|
104 ENoAnimation = 0x00, |
|
105 EDefaultAnimation = 0x01, |
|
106 EDefaultAnimationSh = 0x02, |
|
107 EBallAnimation = 0x04, |
|
108 EAllAnimations = 0x08, |
|
109 ERedPurpBallAnimationMaskedBackground = 0x10, |
|
110 ETBmpAnimBallAnimWindowCovering = 0x12 |
|
111 }; |
|
112 |
|
113 class TAnimationAttributes |
|
114 { |
|
115 public: |
|
116 TAnimationAttributes(); |
|
117 public: |
|
118 enum { ENone=0x0, EFloating=0x1, EAlreadyInit=0x2 }; |
|
119 public: |
|
120 CBitmapAnimClientData::TPlayMode iPlayMode; |
|
121 TInt iFrameIntervalInMilliSeconds; |
|
122 TBool iOnOff; |
|
123 TInt iNumberOfCycles; |
|
124 }; |
|
125 |
|
126 // |
|
127 // |
|
128 // class CAnimationAttributesDlg |
|
129 // |
|
130 |
|
131 class CAnimationAttributesDlg : public CEikDialog |
|
132 { |
|
133 public: |
|
134 CAnimationAttributesDlg(TAnimationAttributes& aAttributes); |
|
135 ~CAnimationAttributesDlg() {}; |
|
136 private: // from CEikDialog |
|
137 TBool OkToExitL(TInt aKeycode); |
|
138 void PreLayoutDynInitL(); |
|
139 private: |
|
140 TAnimationAttributes& iAttributes; |
|
141 }; |
|
142 |
|
143 // |
|
144 // |
|
145 // class CAnimation |
|
146 // |
|
147 |
|
148 class CAnimation : public CBase |
|
149 { |
|
150 public: |
|
151 CAnimation(); |
|
152 ~CAnimation(); |
|
153 void CopyAttributesFromClientData(); |
|
154 void SetAnimationExtent(); |
|
155 public: |
|
156 TInt iIndex; |
|
157 TAnimationFlag iType; |
|
158 CAnimateFramesCtl* iAnimationCtl; |
|
159 TAnimationAttributes iAttributes; |
|
160 }; |
|
161 |
|
162 /* |
|
163 |
|
164 Test window owning control. |
|
165 Used in a test case. |
|
166 |
|
167 */ |
|
168 class CTestWindowControl : public CCoeControl |
|
169 { |
|
170 public: |
|
171 void ConstructL(); |
|
172 CTestWindowControl(); |
|
173 ~CTestWindowControl(); |
|
174 |
|
175 public: |
|
176 void Draw(const TRect& aRect) const; |
|
177 }; |
|
178 |
|
179 // |
|
180 // |
|
181 // class CTestContainer |
|
182 // |
|
183 |
|
184 class CTestContainer : public CCoeControl |
|
185 //Container window owning control to display animations. |
|
186 { |
|
187 public: |
|
188 void ConstructL(); |
|
189 CTestContainer(); |
|
190 ~CTestContainer(); |
|
191 void CancelAnimationL(TInt aIndex); |
|
192 void SetAnimationAttributesL(TAnimationFlag aAnimationType); |
|
193 CAnimation* CreateAnimationByTypeL(TAnimationFlag aAnimationType); |
|
194 void CreateAndRunAnimationL(); |
|
195 TInt FindAnimation(TAnimationFlag aAnimationType); |
|
196 void ShowAnimationL(TAnimationFlag aAnimationType); |
|
197 void StartAnimationL(TInt aIndex); |
|
198 void SetAppFileName(TDesC& aAppFileName); |
|
199 void Panic(TContainerPanic aPanic); |
|
200 void DisplayAnimCoveringWindowL(); |
|
201 TBool TestRenderBackgroundFrameL(); |
|
202 |
|
203 public: // from CCoeControl |
|
204 TInt CountComponentControls() const; |
|
205 void Draw(const TRect& aRect) const; |
|
206 CCoeControl* ComponentControl(TInt aIndex) const; |
|
207 void SizeChanged(); |
|
208 |
|
209 private: |
|
210 TBool CompareScreenContentWithTestBitmapL(const CBitmapFrameData& aBkgdFrameBmp, const CBitmapFrameData& aFrame1Bmp, const TPoint& aPos); |
|
211 TBool CompareBitmapsL(CFbsBitmap* aBmp1, CFbsBitmap* aBmp2); |
|
212 |
|
213 public: |
|
214 enum TBackgroundType |
|
215 { |
|
216 EBackgroundBlackRedGreenYellowStripes, |
|
217 EBackgroundYellow, |
|
218 EBackgroundBlue |
|
219 }; |
|
220 TBackgroundType iBackgroundType; |
|
221 CTestWindowControl* iCoveringWindowControl; |
|
222 |
|
223 private: |
|
224 TInt iFlags; |
|
225 TRgb iColor; |
|
226 CArrayPtrFlat<CAnimation>* iAnimationsArray; |
|
227 TFileName iFileName; |
|
228 }; |
|
229 |
|
230 class CSimpleAppUi : public CTestAppUi |
|
231 { |
|
232 public: |
|
233 public: |
|
234 CSimpleAppUi(CTmsTestStep* aStep); |
|
235 ~CSimpleAppUi(); |
|
236 void ConstructL(); |
|
237 private: // framework |
|
238 void HandleCommandL(TInt aCommand); |
|
239 private: // menu commands |
|
240 void CmdTestOutOfMemoryL(); |
|
241 void DialogWithAnimationL(TInt aResourceId); |
|
242 void RunTestStepL(TInt aNumStep); |
|
243 void RunAnimWithMaskedBgL(); |
|
244 void RunAnimWithWindowCoveringL(); |
|
245 private: |
|
246 void ConstructContainerL(); |
|
247 private: |
|
248 CTestContainer* iContainer; |
|
249 TInt iFlags; |
|
250 CAutoTestManager::TTestResult iTestResult; |
|
251 }; |
|
252 |
|
253 |
|
254 _LIT(KTBmpAnimStep,"TBmpAnim"); |
|
255 |
|
256 #endif |