|
1 // Copyright (c) 2004-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 #if (!defined __TESTSTEPIMAGEDISPLAY_H__) |
|
17 #define __TESTSTEPIMAGEDISPLAY_H__ |
|
18 |
|
19 #include <imagedisplay.h> |
|
20 #include <apgcli.h> |
|
21 |
|
22 |
|
23 class TImageDisplayUnitTestParams |
|
24 { |
|
25 public: |
|
26 enum TDataType |
|
27 { |
|
28 ETypeUndefined =-1, |
|
29 ETypeFileName = 0, |
|
30 ETypeData, |
|
31 ETypeFileHandle |
|
32 }; |
|
33 enum TImageTestType |
|
34 { |
|
35 ENormal, |
|
36 EAlloc |
|
37 }; |
|
38 enum |
|
39 { |
|
40 KNoIntent=-1, |
|
41 }; |
|
42 |
|
43 public: |
|
44 const TText* iTestName; // name of the test |
|
45 const TText* iTestDescription; // description |
|
46 const TText* iInputFilename; // source filename |
|
47 TInt iDestWidth; // dest width |
|
48 TInt iDestHeight; // dest height |
|
49 |
|
50 TInt iDisplayMode; // display mode |
|
51 TInt iImageOptions; // image options |
|
52 |
|
53 TBool iMaintainAspectRatio; // maintain aspect ratio |
|
54 TDataType iSourceType; // Source is a filename |
|
55 const TText8* iMimeType; // Mime type |
|
56 TInt32 iImageType; // image type |
|
57 TInt32 iImageSubType; // image subtype |
|
58 TInt32 iPluginUid; // plugin UID |
|
59 TImageTestType iTestType; // test type |
|
60 const TText* const* iUniqueId; // DRM content Unique ID |
|
61 ContentAccess::TIntent iIntent; // DRM intent |
|
62 TInt iExpectedError; // expected error Code |
|
63 TInt iPlayLoops; // number of "play" attempts |
|
64 }; |
|
65 |
|
66 class TMimeTypeRecogTestParam |
|
67 { |
|
68 public: |
|
69 enum TParamType |
|
70 { |
|
71 EParamIsFileName, |
|
72 EParamIsDataBuffer |
|
73 }; |
|
74 public: |
|
75 const TText* iTestName; // name of the test |
|
76 const TText* iTestDescription; // description |
|
77 TParamType iParamType; // what next parameter to use |
|
78 const TText8* iDataBufferParam; // databuffer parameter value |
|
79 const TText* iFileNameParam; // filename parameter value |
|
80 const TText8* iExpectedMimeType; // expected MIME type value |
|
81 CApaDataRecognizerType::TRecognitionConfidence iMinConfidence; // minimum confidence |
|
82 }; |
|
83 |
|
84 class CImageDisplay; |
|
85 class CTestSuite; |
|
86 class CTestSuiteImageDisplay; |
|
87 |
|
88 /** |
|
89 * |
|
90 * CTestStepImageDisplay, which is the base class for all |
|
91 * the ImageTransform suite test steps, providing common functionality. |
|
92 * |
|
93 * @lib "TSU_ICL_ImageTransform.lib" |
|
94 * |
|
95 */ |
|
96 class CImageDisplay; |
|
97 class CTestStepImageDisplay : public CTestStep, public MIclImageDisplayObserver |
|
98 { |
|
99 public: |
|
100 CTestStepImageDisplay(); |
|
101 ~CTestStepImageDisplay(); |
|
102 |
|
103 virtual TVerdict DoTestStepPreambleL(); |
|
104 virtual TVerdict DoTestStepPostambleL(); |
|
105 |
|
106 void SetSuite(CTestSuiteImageDisplay* aPtr ); |
|
107 CTestSuiteImageDisplay* Suite(); |
|
108 |
|
109 protected: |
|
110 virtual void Cleanup(){}; |
|
111 void SetSourceFilename(const TDesC& aPathNameAndExtn); |
|
112 void SetDestFilenameL(const TDesC& aPathNameAndExtn); |
|
113 void SetRefFilenameL(const TDesC& aPathNameAndExtn); |
|
114 void DeleteDestFilenameL(); |
|
115 TVerdict CompareBitmapWithFileL(const CFbsBitmap& aBitmap,const TDesC& aFile) const; |
|
116 TVerdict CompareFilesL(const TDesC& aFile1,const TDesC& aFile2); |
|
117 |
|
118 TFileName& SourceFilename(); |
|
119 TFileName& DestFilename(); |
|
120 TFileName& RefFilename(); |
|
121 void DefaultPath(TFileName& aName); |
|
122 |
|
123 protected: |
|
124 RFs iFs; |
|
125 CImageDisplay* iImageDisplay; |
|
126 |
|
127 private: |
|
128 CTestSuiteImageDisplay* iImageDisplaySuite; |
|
129 |
|
130 TFileName iSourceFilename; |
|
131 TFileName iDestFilename; |
|
132 TFileName iRefFilename; |
|
133 CActiveScheduler* iScheduler; |
|
134 }; |
|
135 |
|
136 |
|
137 /** |
|
138 * |
|
139 * The following classes provide test steps to Transform an image |
|
140 * See TestStepImageTransform.cpp or the test specification |
|
141 * for details of individual test cases. |
|
142 * |
|
143 */ |
|
144 |
|
145 /** |
|
146 * CTestStepImgDisplayGeneric |
|
147 */ |
|
148 class CTestStepImgDisplayGeneric : public CTestStepImageDisplay |
|
149 { |
|
150 public: |
|
151 |
|
152 CTestStepImgDisplayGeneric(const TImageDisplayUnitTestParams& aTestParams); |
|
153 ~CTestStepImgDisplayGeneric(); |
|
154 // from CTestStep |
|
155 virtual TVerdict DoTestStepL(); |
|
156 |
|
157 protected: |
|
158 // |
|
159 virtual void MiidoImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError); |
|
160 virtual TBool ConsumeFrame(const CFbsBitmap* aBitmap); |
|
161 // |
|
162 void SetImageSourceL(); |
|
163 void SetFilenamesL(const TDesC& aSourceFilename); |
|
164 void SetupPluginL(); |
|
165 virtual TVerdict TestL(); |
|
166 virtual void Cleanup(); |
|
167 |
|
168 private: |
|
169 TVerdict DoTestStepFbsL(); |
|
170 |
|
171 protected: |
|
172 // pointer to current test data |
|
173 const TImageDisplayUnitTestParams* iTestParams; |
|
174 |
|
175 // pointer to previous test data (for API re-use tests) |
|
176 const TImageDisplayUnitTestParams* iTestParamsPrev; |
|
177 |
|
178 HBufC8* iSourceBuf; |
|
179 TInt iLastError; |
|
180 TInt iFrameNumber; |
|
181 RFile iFileHandle; |
|
182 TBool iFbsConnection; |
|
183 TUint iLatestPlugintStatus; |
|
184 const TText* const* iCurrentUId; |
|
185 }; |
|
186 |
|
187 class CTestStepDecode2Frames : public CTestStepImgDisplayGeneric { |
|
188 public: |
|
189 CTestStepDecode2Frames(const TImageDisplayUnitTestParams& aTestParams):CTestStepImgDisplayGeneric(aTestParams) |
|
190 { |
|
191 } |
|
192 protected: |
|
193 virtual TBool ConsumeFrame(const CFbsBitmap* aBitmap); |
|
194 private: |
|
195 virtual TVerdict TestL(); |
|
196 }; |
|
197 |
|
198 class CTestStepPanic_1 : public CTestStepImgDisplayGeneric { |
|
199 public: |
|
200 CTestStepPanic_1(const TImageDisplayUnitTestParams& aTestParams):CTestStepImgDisplayGeneric(aTestParams) |
|
201 { |
|
202 } |
|
203 private: |
|
204 virtual TVerdict TestL(); |
|
205 }; |
|
206 |
|
207 class CTestStepPanic_2 : public CTestStepImgDisplayGeneric { |
|
208 public: |
|
209 CTestStepPanic_2(const TImageDisplayUnitTestParams& aTestParams):CTestStepImgDisplayGeneric(aTestParams) |
|
210 { |
|
211 } |
|
212 private: |
|
213 virtual TVerdict TestL(); |
|
214 }; |
|
215 |
|
216 class CTestStepPanic_3 : public CTestStepImgDisplayGeneric { |
|
217 public: |
|
218 CTestStepPanic_3(const TImageDisplayUnitTestParams& aTestParams):CTestStepImgDisplayGeneric(aTestParams) |
|
219 { |
|
220 } |
|
221 private: |
|
222 virtual TVerdict TestL(); |
|
223 }; |
|
224 |
|
225 class CTestStepPanic_4 : public CTestStepImgDisplayGeneric { |
|
226 public: |
|
227 CTestStepPanic_4(const TImageDisplayUnitTestParams& aTestParams):CTestStepImgDisplayGeneric(aTestParams) |
|
228 { |
|
229 } |
|
230 private: |
|
231 virtual TVerdict TestL(); |
|
232 }; |
|
233 |
|
234 class CTestStepPanic_6 : public CTestStepImgDisplayGeneric { |
|
235 public: |
|
236 CTestStepPanic_6(const TImageDisplayUnitTestParams& aTestParams):CTestStepImgDisplayGeneric(aTestParams) |
|
237 { |
|
238 } |
|
239 private: |
|
240 virtual TVerdict TestL(); |
|
241 }; |
|
242 |
|
243 // DRM tests // |
|
244 class CTestStepDrm : public CTestStepImgDisplayGeneric { |
|
245 public: |
|
246 CTestStepDrm(const TImageDisplayUnitTestParams& aTestParams):CTestStepImgDisplayGeneric(aTestParams) |
|
247 { |
|
248 } |
|
249 protected: |
|
250 virtual TBool ConsumeFrame(const CFbsBitmap* aBitmap); |
|
251 private: |
|
252 virtual TVerdict TestL(); |
|
253 }; |
|
254 |
|
255 // MNG Mime Type recognition tests // |
|
256 class CTestStepImageDisplayRecog : public CTestStepImageDisplay |
|
257 { |
|
258 public: |
|
259 CTestStepImageDisplayRecog(const TMimeTypeRecogTestParam& aTestParam); |
|
260 virtual TVerdict DoTestStepL(); |
|
261 protected: |
|
262 virtual TVerdict DoTestStepPreambleL(); |
|
263 virtual TVerdict DoTestStepPostambleL(); |
|
264 virtual void MiidoImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError); |
|
265 const TMimeTypeRecogTestParam& iTestParam; |
|
266 RApaLsSession iApaLsSession; |
|
267 }; |
|
268 |
|
269 // |
|
270 // Regression test case for defect: DEF082108: Browsing to www.mobil.se will crash the phone |
|
271 class CTestStepImageDisplayMimeCheck : public CTestStepImageDisplay |
|
272 { |
|
273 public: |
|
274 CTestStepImageDisplayMimeCheck(); |
|
275 virtual TVerdict DoTestStepL(); |
|
276 protected: |
|
277 virtual TVerdict DoTestStepPreambleL(); |
|
278 virtual TVerdict DoTestStepPostambleL(); |
|
279 virtual void MiidoImageReady(const CFbsBitmap* aBitmap, TUint aStatus, const TRect& aUpdatedArea, TInt aError); |
|
280 RApaLsSession iApaLsSession; |
|
281 }; |
|
282 |
|
283 #endif // __TESTSTEPIMAGEDISPLAY_H__ |
|
284 |