|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: CAlfPerfAppImageTestCase implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "alfperfappbasetestcasecontrol.h" |
|
20 #include "alfperfappimagetestcase.h" |
|
21 #include "alfperfapp.hrh" |
|
22 #include "alfperfappconfigconstants.h" |
|
23 #include <aknutils.h> |
|
24 #include <alf/alfenv.h> |
|
25 #include <alf/alfdisplay.h> |
|
26 #include <alf/alfcontrol.h> |
|
27 #include <alf/alfcontrolgroup.h> |
|
28 #include <alf/alfroster.h> |
|
29 #include <alf/alfcommand.h> |
|
30 #include <alf/alfevent.h> |
|
31 #include <alf/alftexturemanager.h> |
|
32 #include <alf/alfimagevisual.h> |
|
33 #include <alf/alfimageloaderutil.h> |
|
34 #include <alf/alfutil.h> |
|
35 #ifdef __NVG |
|
36 #include <alf/alfbitmapprovider.h> |
|
37 #endif |
|
38 #include <e32math.h> |
|
39 |
|
40 #include <alfperfapp_imagetest.mbg> |
|
41 |
|
42 /* |
|
43 * Square root of sequence length for the image sequence cases |
|
44 */ |
|
45 const TInt SEQUENCE_LENGTH_SQRT = 7; |
|
46 |
|
47 /** |
|
48 * Control group for image test cases. |
|
49 */ |
|
50 const TInt KAlfPerfAppImageControlGroup = 1; |
|
51 |
|
52 /** |
|
53 * Start next 'cycle' command. |
|
54 */ |
|
55 const TInt KAlfPerfAppImageCmdNext = 0x5001; |
|
56 |
|
57 /** |
|
58 * Amount of image visuals. |
|
59 */ |
|
60 const TInt KAlfPerfAppImageTestCaseBasicImageCount = 16; |
|
61 |
|
62 /** |
|
63 * Image data for test cases. |
|
64 */ |
|
65 _LIT( KAlfPerfAppImageTestCaseData, "\\resource\\apps\\alfperfapp_imagetest.mif" ); |
|
66 _LIT( KAlfPerfAppImageTestCaseNvgCSData, "\\resource\\apps\\alfperfapp_imagetest_NVGCS.mif" ); |
|
67 // NVG TLV Files have to be loaded from a certain place defined by icontype.cfg (in c:\ root) |
|
68 _LIT( KAlfPerfAppImageTestCaseNvgTLVData, "\\data\\nvg_mif\\3musk.mif" ); |
|
69 |
|
70 #ifdef __NVG |
|
71 // Enum that defines what icon (normal or NVG) is being used |
|
72 // with the basic scale & movement test |
|
73 enum TMoveScaleIcon |
|
74 { |
|
75 EMoveScaleIconMif = 0, |
|
76 EMoveScaleIconCS, |
|
77 EMoveScaleIconTLV |
|
78 }; |
|
79 #endif |
|
80 |
|
81 /** |
|
82 * Basic image scale & movement test case. |
|
83 */ |
|
84 class CAlfPerfAppImageTestCaseBasic : public CAlfPerfAppBaseTestCaseControl |
|
85 #ifdef __NVG |
|
86 , public MAlfBitmapProvider |
|
87 #endif |
|
88 { |
|
89 public: |
|
90 CAlfPerfAppImageTestCaseBasic(); |
|
91 ~CAlfPerfAppImageTestCaseBasic(); |
|
92 |
|
93 virtual void ConstructL( |
|
94 CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea ); |
|
95 virtual void DoStartExecuteL(); |
|
96 virtual TBool OfferEventL( const TAlfEvent& aEvent ); |
|
97 virtual void SetVisibleArea( const TRect& aVisibleArea ); |
|
98 |
|
99 #ifdef __NVG |
|
100 void SetIconType( TMoveScaleIcon aIconType ); |
|
101 #endif |
|
102 |
|
103 private: |
|
104 |
|
105 /** |
|
106 * Next cycle. |
|
107 */ |
|
108 void NextCycleL(); |
|
109 |
|
110 /** |
|
111 * Returns opacity for index. |
|
112 */ |
|
113 TReal32 OpacityForIndex( TInt aIndex ); |
|
114 |
|
115 /** |
|
116 * Returns size for index. |
|
117 */ |
|
118 TAlfRealSize SizeForIndex( TInt aIndex ); |
|
119 |
|
120 /** |
|
121 * Returns position for index. |
|
122 */ |
|
123 TAlfRealPoint PositionForIndex( TInt aIndex, const TAlfRealSize& aSize ); |
|
124 |
|
125 #ifdef __NVG |
|
126 void ProvideBitmapL(TInt aId, CFbsBitmap*& aBitmap, CFbsBitmap*& aMaskBitmap); |
|
127 CFbsBitmap* iBitmapToBeProvided; |
|
128 TMoveScaleIcon iIconType; |
|
129 #endif |
|
130 |
|
131 private: |
|
132 |
|
133 /** |
|
134 * Image visuals. |
|
135 */ |
|
136 RPointerArray< CAlfImageVisual > iImages; |
|
137 |
|
138 /** |
|
139 * Cycle counter. |
|
140 */ |
|
141 TInt iCycleCounter; |
|
142 |
|
143 /** |
|
144 * Image loader utility. |
|
145 * Owned. |
|
146 */ |
|
147 CAlfImageLoaderUtil* iLoader; |
|
148 }; |
|
149 |
|
150 /** |
|
151 * Many images at the same time |
|
152 */ |
|
153 #ifdef __NVG |
|
154 class CAlfPerfAppImageTestCaseManyImages : public CAlfPerfAppBaseTestCaseControl, public MAlfBitmapProvider |
|
155 #else |
|
156 class CAlfPerfAppImageTestCaseManyImages : public CAlfPerfAppBaseTestCaseControl |
|
157 #endif |
|
158 { |
|
159 public: |
|
160 CAlfPerfAppImageTestCaseManyImages(); |
|
161 ~CAlfPerfAppImageTestCaseManyImages(); |
|
162 |
|
163 virtual void ConstructL( |
|
164 CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea, TInt aSequenceIndex, TInt aVisualCount ); |
|
165 virtual void DoStartExecuteL(); |
|
166 virtual TBool OfferEventL( const TAlfEvent& aEvent ); |
|
167 virtual void SetVisibleArea( const TRect& aVisibleArea ); |
|
168 |
|
169 #ifdef __NVG |
|
170 void ProvideBitmapL(TInt /*aId*/, CFbsBitmap*& aBitmap, CFbsBitmap*& /*aMaskBitmap*/); |
|
171 #endif |
|
172 |
|
173 private: |
|
174 |
|
175 /** |
|
176 * Next cycle. |
|
177 */ |
|
178 void NextCycleL(); |
|
179 |
|
180 /** |
|
181 * Returns opacity for index. |
|
182 */ |
|
183 TBool OpacityForIndex( TInt aIndex, TReal32& aOpacity ); |
|
184 |
|
185 /** |
|
186 * Returns size for index. |
|
187 */ |
|
188 TBool SizeForIndex( TInt aIndex, TAlfRealSize& aSize ); |
|
189 |
|
190 /** |
|
191 * Returns position for index. |
|
192 */ |
|
193 TBool PositionForIndex( TInt aIndex, TAlfRealPoint& aPos ); |
|
194 |
|
195 |
|
196 |
|
197 private: |
|
198 |
|
199 #ifdef __NVG |
|
200 CFbsBitmap* iBitmapToBeProvided; |
|
201 #endif |
|
202 /** |
|
203 * Image visuals. |
|
204 */ |
|
205 RPointerArray< CAlfImageVisual > iImages; |
|
206 |
|
207 /** |
|
208 * Cycle counter. |
|
209 */ |
|
210 TInt iCycleCounter; |
|
211 |
|
212 /** |
|
213 * Image loader utility. |
|
214 * Owned. |
|
215 */ |
|
216 CAlfImageLoaderUtil* iLoader; |
|
217 |
|
218 |
|
219 /** |
|
220 * Test case parameters |
|
221 */ |
|
222 TInt iVisualCount; // Number of visual to be created |
|
223 TInt iVisualColums; |
|
224 TInt iVisualRows; |
|
225 TAlfRealPoint iVisualSpeed; // Pixels to move between cycles |
|
226 TFileName iImageFileName; // File name of the texture image file |
|
227 TInt iImageCount; // Number of different images |
|
228 TSize iImageSize; // Image size |
|
229 TAlfTextureFlags iTextureFlags; // Texture flags |
|
230 TAlfRealSize iVisualSize; // Initial size of the visual |
|
231 TAlfRealPoint iVisualSizeVel; // Velocity of visual size change per cycle |
|
232 TInt iSimulatedPointerEventCount; // Number of pointer events sent to visula in one cycle |
|
233 //TSize iAnimatedAreaSize; |
|
234 TInt iLastIndexInAnimatedArea; // the index of the last visual that is animated, all before this are also animated |
|
235 TInt iSequenceIndex; |
|
236 }; |
|
237 |
|
238 // ============================ MEMBER FUNCTIONS =============================== |
|
239 |
|
240 // ----------------------------------------------------------------------------- |
|
241 // Checks if specified case is supported by this class. |
|
242 // ----------------------------------------------------------------------------- |
|
243 // |
|
244 TBool CAlfPerfAppImageTestCase::IsSupported( TInt aCaseId ) |
|
245 { |
|
246 return aCaseId > EAlfPerfAppImageMin && |
|
247 aCaseId < EAlfPerfAppImageMax; |
|
248 } |
|
249 |
|
250 CAlfPerfAppImageTestCase* CAlfPerfAppImageTestCase::NewL( TInt aCaseId, TInt aSequenceIndex ) |
|
251 { |
|
252 if ( !IsSupported( aCaseId ) ) |
|
253 { |
|
254 User::Leave( KErrNotSupported ); |
|
255 } |
|
256 |
|
257 CAlfPerfAppImageTestCase* self = |
|
258 new (ELeave) CAlfPerfAppImageTestCase( aCaseId, aSequenceIndex ); |
|
259 CleanupStack::PushL( self ); |
|
260 self->ConstructL(); |
|
261 CleanupStack::Pop( self ); |
|
262 return self; |
|
263 } |
|
264 |
|
265 CAlfPerfAppImageTestCase::~CAlfPerfAppImageTestCase() |
|
266 { |
|
267 if ( iEnv && iControl ) |
|
268 { |
|
269 iControl->CancelExecution(); |
|
270 iEnv->DeleteControlGroup( KAlfPerfAppImageControlGroup ); |
|
271 } |
|
272 } |
|
273 |
|
274 // ----------------------------------------------------------------------------- |
|
275 // Starts setup phase. |
|
276 // ----------------------------------------------------------------------------- |
|
277 // |
|
278 void CAlfPerfAppImageTestCase::SetupL( |
|
279 CAlfEnv& aEnv, const TRect& aVisibleArea, TRequestStatus& aStatus ) |
|
280 { |
|
281 |
|
282 iEnv = &aEnv; |
|
283 |
|
284 CAlfDisplay* display = 0; |
|
285 CAlfControlGroup& group = iEnv->NewControlGroupL( KAlfPerfAppImageControlGroup ); |
|
286 CAlfPerfAppBaseTestCaseControl* control = 0; |
|
287 iTotalVisualCount = -1; |
|
288 iAnimationDivider = 0; |
|
289 |
|
290 if(SequenceIndex() != 0) |
|
291 { |
|
292 // Calculate |
|
293 TInt caseNum = SEQUENCE_LENGTH_SQRT - (SequenceIndex()-1) / SEQUENCE_LENGTH_SQRT - 1; |
|
294 TReal trg = 0.0; |
|
295 Math::Pow(trg, 2.0, caseNum); |
|
296 iAnimationDivider = trg+0.5; |
|
297 |
|
298 TRect rect; |
|
299 AknLayoutUtils::LayoutMetricsRect( |
|
300 AknLayoutUtils::EApplicationWindow, |
|
301 rect ); |
|
302 iEnv->SetFullScreenDrawing( ETrue ); |
|
303 |
|
304 |
|
305 TInt counter = 10 - ((SequenceIndex()-1)%SEQUENCE_LENGTH_SQRT) - 1; // 2^3...2^9 always choose the |
|
306 trg = 0.0; |
|
307 Math::Pow(trg, 2.0, counter); |
|
308 iTotalVisualCount = trg+0.5; |
|
309 |
|
310 display = &iEnv->NewDisplayL( rect, CAlfEnv::ENewDisplayFullScreen ); |
|
311 |
|
312 display->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground ); |
|
313 |
|
314 control = new (ELeave) CAlfPerfAppImageTestCaseManyImages(); |
|
315 CleanupStack::PushL( control ); |
|
316 ((CAlfPerfAppImageTestCaseManyImages*)control)->ConstructL( *iEnv, iCaseId, aVisibleArea,SequenceIndex(),iTotalVisualCount ); |
|
317 |
|
318 } |
|
319 else |
|
320 { |
|
321 display = &iEnv->NewDisplayL( aVisibleArea, CAlfEnv::ENewDisplayAsCoeControl); |
|
322 display->SetClearBackgroundL( CAlfDisplay::EClearWithSkinBackground ); |
|
323 |
|
324 switch ( iCaseId ) |
|
325 { |
|
326 case EAlfPerfAppImageBasicMoveScale: |
|
327 control = new (ELeave) CAlfPerfAppImageTestCaseBasic; |
|
328 CleanupStack::PushL( control ); |
|
329 control->ConstructL( *iEnv, iCaseId, aVisibleArea ); |
|
330 break; |
|
331 |
|
332 #ifdef __NVG |
|
333 case EAlfPerfAppImageBasicMoveScaleNvgCS: |
|
334 CAlfPerfAppImageTestCaseBasic* temp = new (ELeave) CAlfPerfAppImageTestCaseBasic; |
|
335 temp->SetIconType(EMoveScaleIconCS); |
|
336 control = temp; |
|
337 CleanupStack::PushL( control ); |
|
338 control->ConstructL( *iEnv, iCaseId, aVisibleArea); |
|
339 break; |
|
340 |
|
341 case EAlfPerfAppImageBasicMoveScaleNvgTLV: |
|
342 CAlfPerfAppImageTestCaseBasic* temp2 = new (ELeave) CAlfPerfAppImageTestCaseBasic; |
|
343 temp2->SetIconType(EMoveScaleIconTLV); |
|
344 control = temp2; |
|
345 CleanupStack::PushL( control ); |
|
346 control->ConstructL( *iEnv, iCaseId, aVisibleArea); |
|
347 break; |
|
348 |
|
349 case EAlfPerfAppImageManyNvgCSImages: |
|
350 case EAlfPerfAppImageManyNvgTLVImages: |
|
351 #endif |
|
352 case EAlfPerfAppImageManyImages: |
|
353 case EAlfPerfAppImageManyGifImages: |
|
354 case EAlfPerfAppImageManyPngImages: |
|
355 case EAlfPerfAppImageManySvgImages: |
|
356 case EAlfPerfAppImageManyImagesWithPointerEvent: |
|
357 case EAlfPerfAppImageManyImagesWithAutoSize: |
|
358 case EAlfPerfAppImageAnimateFull: |
|
359 case EAlfPerfAppImageAnimate1of2: |
|
360 case EAlfPerfAppImageAnimate1of4: |
|
361 case EAlfPerfAppImageAnimate1of8: |
|
362 control = new (ELeave) CAlfPerfAppImageTestCaseManyImages; |
|
363 CleanupStack::PushL( control ); |
|
364 ((CAlfPerfAppImageTestCaseManyImages*)control)->ConstructL( *iEnv, iCaseId, aVisibleArea,SequenceIndex(),iTotalVisualCount ); |
|
365 break; |
|
366 |
|
367 default: |
|
368 User::Leave( KErrNotSupported ); |
|
369 break; |
|
370 } |
|
371 |
|
372 } |
|
373 group.AppendL( control ); // ownership passed to control group. |
|
374 iControl = control; |
|
375 CleanupStack::Pop( control ); |
|
376 |
|
377 display->Roster().ShowL( group ); |
|
378 |
|
379 // This must be last statement. |
|
380 CAlfPerfAppTestCase::CompleteNow( aStatus, KErrNone ); |
|
381 } |
|
382 |
|
383 // ----------------------------------------------------------------------------- |
|
384 // Starts execution phase. |
|
385 // ----------------------------------------------------------------------------- |
|
386 // |
|
387 void CAlfPerfAppImageTestCase::ExecuteL( TRequestStatus& aStatus ) |
|
388 { |
|
389 // SetupL must have been called first. |
|
390 __ASSERT_ALWAYS( iEnv, User::Invariant() ); |
|
391 __ASSERT_ALWAYS( iControl, User::Invariant() ); |
|
392 |
|
393 iControl->StartExecuteL( aStatus ); |
|
394 } |
|
395 |
|
396 // ----------------------------------------------------------------------------- |
|
397 // Tears down. |
|
398 // ----------------------------------------------------------------------------- |
|
399 // |
|
400 void CAlfPerfAppImageTestCase::TearDown() |
|
401 { |
|
402 // Execution side will delete CAlfEnv, so it will delete everything |
|
403 // related to this. |
|
404 iEnv = NULL; |
|
405 iControl = NULL; |
|
406 } |
|
407 |
|
408 void CAlfPerfAppImageTestCase::HandleVisibleAreaChange( const TRect& aRect ) |
|
409 { |
|
410 if ( iEnv && iControl ) |
|
411 { |
|
412 if ( iEnv->DisplayCount() > 0 ) |
|
413 { |
|
414 iEnv->PrimaryDisplay().SetVisibleArea( aRect ); |
|
415 } |
|
416 iControl->SetVisibleArea( aRect ); |
|
417 } |
|
418 } |
|
419 |
|
420 TInt CAlfPerfAppImageTestCase::CaseID() |
|
421 { |
|
422 return iCaseId; |
|
423 } |
|
424 |
|
425 CAlfPerfAppImageTestCase::CAlfPerfAppImageTestCase( TInt aCaseId, TInt aSequenceIndex ) |
|
426 : CAlfPerfAppTestCase(aSequenceIndex), iCaseId ( aCaseId ) |
|
427 { |
|
428 } |
|
429 |
|
430 void CAlfPerfAppImageTestCase::ConstructL() |
|
431 { |
|
432 } |
|
433 |
|
434 // Implementation of CAlfPerfAppImageTestCaseBasic: |
|
435 #ifdef __NVG |
|
436 CAlfPerfAppImageTestCaseBasic::CAlfPerfAppImageTestCaseBasic(): iIconType(EMoveScaleIconMif) |
|
437 #else |
|
438 CAlfPerfAppImageTestCaseBasic::CAlfPerfAppImageTestCaseBasic() |
|
439 #endif |
|
440 { |
|
441 } |
|
442 |
|
443 CAlfPerfAppImageTestCaseBasic::~CAlfPerfAppImageTestCaseBasic() |
|
444 { |
|
445 iImages.Close(); |
|
446 |
|
447 delete iLoader; |
|
448 } |
|
449 |
|
450 void CAlfPerfAppImageTestCaseBasic::ConstructL( |
|
451 CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea ) |
|
452 { |
|
453 CAlfPerfAppBaseTestCaseControl::ConstructL( aEnv, aCaseId, aVisibleArea ); |
|
454 CAlfTextureManager& textureManager = aEnv.TextureManager(); |
|
455 |
|
456 iLoader = new (ELeave) CAlfImageLoaderUtil; |
|
457 iLoader->SetSize( TSize( 64, 64 ) ); |
|
458 |
|
459 const TInt max = 4; |
|
460 TInt count = 0; |
|
461 TInt baseId = 16384; |
|
462 |
|
463 TFileName imageFile; |
|
464 |
|
465 #ifdef __NVG |
|
466 TBool isNvg = EFalse; |
|
467 if (iIconType == EMoveScaleIconCS) |
|
468 { |
|
469 imageFile.Append( KAlfPerfAppImageTestCaseNvgCSData ); |
|
470 isNvg = ETrue; |
|
471 } |
|
472 else if (iIconType == EMoveScaleIconTLV) |
|
473 { |
|
474 imageFile.Append( KAlfPerfAppImageTestCaseNvgTLVData ); |
|
475 isNvg = ETrue; |
|
476 } |
|
477 else if (iIconType == EMoveScaleIconMif) |
|
478 { |
|
479 imageFile.Append( KAlfPerfAppImageTestCaseData ); |
|
480 } |
|
481 else |
|
482 { |
|
483 // Error! Leave |
|
484 User::Leave(KErrArgument); |
|
485 } |
|
486 // Add the drive letter to the imageFile path |
|
487 ::CompleteWithAppPath( imageFile ); |
|
488 #else |
|
489 imageFile.Append( KAlfPerfAppImageTestCaseData ); |
|
490 ::CompleteWithAppPath( imageFile ); |
|
491 #endif |
|
492 |
|
493 while ( count < max && baseId < EMbmAlfperfapp_imagetestLastElement ) |
|
494 { |
|
495 #ifdef __NVG |
|
496 if (isNvg) |
|
497 { |
|
498 TAlfTextureFlags flags = EAlfTextureFlagDefault; |
|
499 // Use the modified AknIconUtils to create the extended bitmap |
|
500 CFbsBitmap* extendedBitmap; |
|
501 CFbsBitmap* extendedMask; |
|
502 if(iIconType == EMoveScaleIconTLV) |
|
503 { |
|
504 // The TLV icon file has only one icon |
|
505 AknIconUtils::CreateIconL(extendedBitmap, extendedMask, imageFile, 16384, 16385); |
|
506 } |
|
507 else |
|
508 { |
|
509 AknIconUtils::CreateIconL(extendedBitmap, extendedMask, imageFile, baseId, baseId + 1); |
|
510 } |
|
511 AknIconUtils::ExcludeFromCache(extendedBitmap); |
|
512 AknIconUtils::SetSize( extendedBitmap, TSize(64,64) ); |
|
513 |
|
514 // This will be returned, when ProvideBitmapL is called for creating the texture |
|
515 //delete iBitmapToBeProvided; |
|
516 iBitmapToBeProvided = extendedBitmap; |
|
517 delete extendedMask; |
|
518 |
|
519 count++; |
|
520 textureManager.CreateTextureL(count, this, flags); |
|
521 } |
|
522 else |
|
523 { |
|
524 // Else load the icons normally from the mif file |
|
525 count++; |
|
526 textureManager.CreateTextureL( |
|
527 count, |
|
528 iLoader->CreateImageLoaderL( |
|
529 KAknsIIDNone, |
|
530 imageFile, |
|
531 baseId, |
|
532 baseId + 1 ), |
|
533 EAlfTextureFlagDefault ); |
|
534 } |
|
535 #else |
|
536 count++; |
|
537 textureManager.CreateTextureL( |
|
538 count, |
|
539 iLoader->CreateImageLoaderL( |
|
540 KAknsIIDNone, |
|
541 imageFile, |
|
542 baseId, |
|
543 baseId + 1 ), |
|
544 EAlfTextureFlagDefault ); |
|
545 #endif |
|
546 baseId += 2; // odd values are masks |
|
547 } |
|
548 |
|
549 for ( TInt ii = 0; ii < KAlfPerfAppImageTestCaseBasicImageCount; ii++ ) |
|
550 { |
|
551 CAlfImageVisual* visual = CAlfImageVisual::AddNewL( *this ); |
|
552 visual->SetFlag( EAlfVisualFlagManualLayout ); |
|
553 visual->SetOpacity( 1.0f ); |
|
554 |
|
555 visual->SetOpacity( OpacityForIndex( ii ) ); |
|
556 TAlfRealSize sz = SizeForIndex( ii ); |
|
557 visual->SetSize( sz ); |
|
558 visual->SetPos( PositionForIndex( ii, sz ) ); |
|
559 |
|
560 const CAlfTexture* texture = textureManager.Texture( 1 + ( ii & 3 ) ); |
|
561 TAlfImage image( *texture ); |
|
562 visual->SetImage( image ); |
|
563 |
|
564 iImages.AppendL( visual ); |
|
565 } |
|
566 } |
|
567 |
|
568 #ifdef __NVG |
|
569 void CAlfPerfAppImageTestCaseBasic::SetIconType(TMoveScaleIcon aIconType) |
|
570 { |
|
571 iIconType = aIconType; |
|
572 } |
|
573 #endif |
|
574 |
|
575 void CAlfPerfAppImageTestCaseBasic::DoStartExecuteL() |
|
576 { |
|
577 NextCycleL(); |
|
578 |
|
579 CompleteAfterL( 5000 ); |
|
580 } |
|
581 |
|
582 void CAlfPerfAppImageTestCaseBasic::SetVisibleArea( |
|
583 const TRect& /*aVisibleArea*/ ) |
|
584 { |
|
585 if ( IsExecutionOngoing() ) |
|
586 { |
|
587 Env().CancelCustomCommands( this, KAlfPerfAppImageCmdNext ); |
|
588 TRAPD( err, NextCycleL() ); |
|
589 if ( err != KErrNone ) |
|
590 { |
|
591 CompleteNow( err ); |
|
592 } |
|
593 } |
|
594 } |
|
595 |
|
596 TBool CAlfPerfAppImageTestCaseBasic::OfferEventL( const TAlfEvent& aEvent ) |
|
597 { |
|
598 if ( aEvent.IsCustomEvent() && |
|
599 aEvent.CustomParameter() == KAlfPerfAppImageCmdNext ) |
|
600 { |
|
601 TRAPD( err, NextCycleL() ); |
|
602 if ( err != KErrNone ) |
|
603 { |
|
604 CompleteNow( err ); |
|
605 } |
|
606 return ETrue; |
|
607 } |
|
608 |
|
609 return CAlfPerfAppBaseTestCaseControl::OfferEventL( aEvent ); |
|
610 } |
|
611 |
|
612 void CAlfPerfAppImageTestCaseBasic::NextCycleL() |
|
613 { |
|
614 TAlfCustomEventCommand command( KAlfPerfAppImageCmdNext, this ); |
|
615 User::LeaveIfError( Env().Send( command, 500 ) ); |
|
616 |
|
617 iCycleCounter++; |
|
618 |
|
619 for ( TInt ii = 0; ii < iImages.Count(); ii++ ) |
|
620 { |
|
621 CAlfImageVisual* visual = iImages[ ii ]; |
|
622 |
|
623 TInt speed = KVisualAnimSpeed; |
|
624 if ( ii & 1 ) |
|
625 { |
|
626 speed /= 2; |
|
627 } |
|
628 |
|
629 visual->SetOpacity( TAlfTimedValue( OpacityForIndex( ii ), speed ) ); |
|
630 TAlfRealSize sz = SizeForIndex( ii ); |
|
631 visual->SetSize( sz, speed ); |
|
632 visual->SetPos( PositionForIndex( ii, sz ), speed ); |
|
633 } |
|
634 } |
|
635 |
|
636 TReal32 CAlfPerfAppImageTestCaseBasic::OpacityForIndex( TInt aIndex ) |
|
637 { |
|
638 switch ( ( iCycleCounter + aIndex ) % 3 ) |
|
639 { |
|
640 case 0: |
|
641 return 1.0f; |
|
642 case 1: |
|
643 return 0.5f; |
|
644 case 2: |
|
645 default: |
|
646 return 0.25f; |
|
647 } |
|
648 } |
|
649 |
|
650 TAlfRealSize CAlfPerfAppImageTestCaseBasic::SizeForIndex( TInt aIndex ) |
|
651 { |
|
652 switch ( ( iCycleCounter + aIndex ) % 3 ) |
|
653 { |
|
654 case 0: |
|
655 return TAlfRealSize( 25.f, 25.f ); |
|
656 case 1: |
|
657 return TAlfRealSize( 50.f, 50.f ); |
|
658 case 2: |
|
659 default: |
|
660 return TAlfRealSize( 100.f, 100.f ); |
|
661 } |
|
662 } |
|
663 |
|
664 TAlfRealPoint CAlfPerfAppImageTestCaseBasic::PositionForIndex( |
|
665 TInt aIndex, const TAlfRealSize& aSize ) |
|
666 { |
|
667 const TSize KSize( Env().PrimaryDisplay().VisibleArea().Size() ); |
|
668 |
|
669 switch ( ( iCycleCounter + aIndex ) & 3 ) |
|
670 { |
|
671 case 0: |
|
672 return TAlfRealPoint( 0.0f, 0.0f ); |
|
673 |
|
674 case 1: |
|
675 return TAlfRealPoint( KSize.iWidth - aSize.iWidth, KSize.iHeight - aSize.iHeight ); |
|
676 |
|
677 case 2: |
|
678 return TAlfRealPoint( KSize.iWidth - aSize.iWidth, 0.0f ); |
|
679 |
|
680 case 3: |
|
681 default: |
|
682 return TAlfRealPoint( 0.0f, KSize.iHeight - aSize.iHeight ); |
|
683 } |
|
684 } |
|
685 |
|
686 #ifdef __NVG |
|
687 void CAlfPerfAppImageTestCaseBasic::ProvideBitmapL(TInt /*aId*/, CFbsBitmap*& aBitmap, CFbsBitmap*& /*aMaskBitmap*/) |
|
688 { |
|
689 aBitmap = iBitmapToBeProvided; |
|
690 } |
|
691 #endif |
|
692 |
|
693 // Implementation of CAlfPerfAppImageTestCaseManyImages: |
|
694 |
|
695 CAlfPerfAppImageTestCaseManyImages::CAlfPerfAppImageTestCaseManyImages() |
|
696 { |
|
697 } |
|
698 |
|
699 CAlfPerfAppImageTestCaseManyImages::~CAlfPerfAppImageTestCaseManyImages() |
|
700 { |
|
701 iImages.Close(); |
|
702 |
|
703 delete iLoader; |
|
704 } |
|
705 |
|
706 void CAlfPerfAppImageTestCaseManyImages::ConstructL( |
|
707 CAlfEnv& aEnv, TInt aCaseId, const TRect& aVisibleArea, TInt aSequenceIndex, TInt aVisualCount ) |
|
708 { |
|
709 CAlfPerfAppBaseTestCaseControl::ConstructL( aEnv, aCaseId, aVisibleArea ); |
|
710 CAlfTextureManager& textureManager = aEnv.TextureManager(); |
|
711 |
|
712 TFileName privatePath; |
|
713 CEikonEnv::Static()->FsSession().PrivatePath( privatePath ); |
|
714 ::CompleteWithAppPath( privatePath ); |
|
715 textureManager.SetImagePathL( privatePath ); |
|
716 |
|
717 TSize displaySize(Env().PrimaryDisplay().VisibleArea().Size()); |
|
718 TInt KItemStep = 20; |
|
719 |
|
720 // Parameters for test cases |
|
721 |
|
722 iImageFileName = _L("\\resource\\apps\\alfperfapp_imagetest.mif"); |
|
723 iVisualSpeed = TAlfRealPoint(1,0); |
|
724 iImageCount = 4; |
|
725 iVisualCount = (aVisualCount != -1) ? aVisualCount : KVisualCout; |
|
726 iVisualColums = displaySize.iWidth/KItemStep; |
|
727 iVisualRows = displaySize.iHeight/KItemStep;; |
|
728 iTextureFlags = EAlfTextureFlagDefault; |
|
729 iVisualSize = TAlfRealSize( 25.f, 25.f ); |
|
730 iVisualSizeVel = TAlfRealPoint(); |
|
731 iSimulatedPointerEventCount = 0; |
|
732 iLastIndexInAnimatedArea = iVisualCount; |
|
733 iImageSize = TSize( 64, 64 ); |
|
734 iSequenceIndex = aSequenceIndex; |
|
735 |
|
736 if (iSequenceIndex != 0) |
|
737 { |
|
738 TInt caseNum = SEQUENCE_LENGTH_SQRT - (aSequenceIndex-1) / SEQUENCE_LENGTH_SQRT - 1; |
|
739 TReal trg = 0.0; |
|
740 Math::Pow(trg, 2.0, caseNum); |
|
741 TInt pow = trg+0.5; |
|
742 TReal animatedAreaRelativeSize = 1.f/pow; |
|
743 |
|
744 iImageFileName = _L("alfperfapp_imagetest.png"); |
|
745 iLastIndexInAnimatedArea = iVisualCount*animatedAreaRelativeSize+0.5; |
|
746 iLastIndexInAnimatedArea = (iLastIndexInAnimatedArea < 1) ? 1 : iLastIndexInAnimatedArea; |
|
747 RDebug::Print(_L("CAlfPerfAppImageTestCaseManyImages::ConstructL(). Animated visual count = %d, percentage=%3.2f"), iLastIndexInAnimatedArea, animatedAreaRelativeSize); |
|
748 |
|
749 trg = 0.0; |
|
750 Math::Sqrt(trg,TReal(iVisualCount)); |
|
751 iVisualColums = (trg + 0.5); |
|
752 iVisualRows = ((TReal)iVisualCount/iVisualColums) + 0.5; |
|
753 |
|
754 TSize displaySize(Env().PrimaryDisplay().VisibleArea().Size()); |
|
755 iVisualSize = TAlfRealSize((TReal32)displaySize.iWidth/iVisualColums, (TReal32)displaySize.iHeight/iVisualRows); |
|
756 iImageCount = 1; |
|
757 iImageSize = TSize(iVisualSize.iWidth+0.5, iVisualSize.iHeight+0.5); |
|
758 |
|
759 iTextureFlags = EAlfTextureFlagDoNotRetainResolution; |
|
760 } |
|
761 else |
|
762 { |
|
763 |
|
764 switch(CaseId()) |
|
765 { |
|
766 case EAlfPerfAppImageManyImages: |
|
767 break; |
|
768 |
|
769 case EAlfPerfAppImageManyGifImages: |
|
770 iImageFileName = _L("alfperfapp_imagetest.gif"); |
|
771 break; |
|
772 |
|
773 case EAlfPerfAppImageManyPngImages: |
|
774 iImageFileName = _L("alfperfapp_imagetest.png"); |
|
775 break; |
|
776 |
|
777 case EAlfPerfAppImageManySvgImages: |
|
778 iImageFileName = _L("alfperfapp_imagetest.svg"); |
|
779 break; |
|
780 #ifdef __NVG |
|
781 case EAlfPerfAppImageManyNvgCSImages: |
|
782 iImageFileName = KAlfPerfAppImageTestCaseNvgCSData; |
|
783 //iImageFileName = _L("icons_mif_new2.mif"); |
|
784 break; |
|
785 |
|
786 case EAlfPerfAppImageManyNvgTLVImages: |
|
787 iImageFileName = KAlfPerfAppImageTestCaseNvgTLVData; |
|
788 //iImageFileName = _L("TLV\\3musk.mif"); |
|
789 break; |
|
790 #endif |
|
791 case EAlfPerfAppImageManyImagesWithPointerEvent: |
|
792 iSimulatedPointerEventCount = 10; |
|
793 break; |
|
794 |
|
795 case EAlfPerfAppImageManyImagesWithAutoSize: |
|
796 iTextureFlags = EAlfTextureFlagAutoSize; |
|
797 iVisualSizeVel = TAlfRealPoint(10,10); |
|
798 break; |
|
799 |
|
800 case EAlfPerfAppImageAnimateFull: |
|
801 { |
|
802 iVisualCount = KVisualCout; |
|
803 iLastIndexInAnimatedArea = iVisualCount * KRelativeAnimatedArea ; |
|
804 iImageFileName = _L("alfperfapp_imagetest.svg"); |
|
805 |
|
806 TReal trg = 0.0; |
|
807 Math::Sqrt(trg,TReal(iVisualCount)); |
|
808 iVisualColums = (trg + 0.5); |
|
809 iVisualRows = ((TReal)iVisualCount/iVisualColums) + 0.5; |
|
810 |
|
811 iVisualSize = TAlfRealSize((TReal32)displaySize.iWidth/iVisualColums, (TReal32)displaySize.iHeight/iVisualRows); |
|
812 iImageCount = 1; |
|
813 iImageSize = TSize(iVisualSize.iWidth+0.5, iVisualSize.iHeight+0.5); |
|
814 |
|
815 break; |
|
816 } |
|
817 case EAlfPerfAppImageAnimate1of2: |
|
818 { |
|
819 TReal animatedAreaRelativeSize = 1.f/2.f; |
|
820 iVisualCount = KVisualCout; |
|
821 iImageFileName = _L("alfperfapp_imagetest.svg"); |
|
822 iLastIndexInAnimatedArea = iVisualCount*animatedAreaRelativeSize; |
|
823 |
|
824 TReal trg = 0.0; |
|
825 Math::Sqrt(trg,TReal(iVisualCount)); |
|
826 iVisualColums = (trg + 0.5); |
|
827 iVisualRows = ((TReal)iVisualCount/iVisualColums) + 0.5; |
|
828 |
|
829 iVisualSize = TAlfRealSize((TReal32)displaySize.iWidth/iVisualColums, (TReal32)displaySize.iHeight/iVisualRows); |
|
830 iImageCount = 1; |
|
831 iImageSize = TSize(iVisualSize.iWidth+0.5, iVisualSize.iHeight+0.5); |
|
832 |
|
833 break; |
|
834 } |
|
835 |
|
836 case EAlfPerfAppImageAnimate1of4: |
|
837 { |
|
838 TReal animatedAreaRelativeSize = 1.f/4.f; |
|
839 iVisualCount = KVisualCout; |
|
840 iImageFileName = _L("alfperfapp_imagetest.svg"); |
|
841 iLastIndexInAnimatedArea = iVisualCount*animatedAreaRelativeSize; |
|
842 |
|
843 TReal trg = 0.0; |
|
844 Math::Sqrt(trg,TReal(iVisualCount)); |
|
845 iVisualColums = (trg + 0.5); |
|
846 iVisualRows = ((TReal)iVisualCount/iVisualColums) + 0.5; |
|
847 |
|
848 iVisualSize = TAlfRealSize((TReal32)displaySize.iWidth/iVisualColums, (TReal32)displaySize.iHeight/iVisualRows); |
|
849 iImageCount = 1; |
|
850 iImageSize = TSize(iVisualSize.iWidth+0.5, iVisualSize.iHeight+0.5); |
|
851 |
|
852 break; |
|
853 } |
|
854 |
|
855 case EAlfPerfAppImageAnimate1of8: |
|
856 { |
|
857 TReal animatedAreaRelativeSize = 1.f/8.f; |
|
858 iVisualCount = KVisualCout; |
|
859 iImageFileName = _L("alfperfapp_imagetest.svg"); |
|
860 iLastIndexInAnimatedArea = iVisualCount*animatedAreaRelativeSize; |
|
861 |
|
862 TReal trg = 0.0; |
|
863 Math::Sqrt(trg,TReal(iVisualCount)); |
|
864 iVisualColums = (trg + 0.5); |
|
865 iVisualRows = ((TReal)iVisualCount/iVisualColums) + 0.5; |
|
866 |
|
867 iVisualSize = TAlfRealSize((TReal32)displaySize.iWidth/iVisualColums, (TReal32)displaySize.iHeight/iVisualRows); |
|
868 iImageCount = 1; |
|
869 iImageSize = TSize(iVisualSize.iWidth+0.5, iVisualSize.iHeight+0.5); |
|
870 |
|
871 break; |
|
872 } |
|
873 |
|
874 default: |
|
875 User::Leave( KErrNotSupported ); |
|
876 break; |
|
877 } |
|
878 } |
|
879 |
|
880 TParsePtr parse(iImageFileName); |
|
881 |
|
882 |
|
883 #ifdef __NVG |
|
884 if ( (CaseId() == EAlfPerfAppImageManyNvgCSImages || |
|
885 CaseId() == EAlfPerfAppImageManyNvgTLVImages) && |
|
886 parse.Ext().CompareF(_L(".mif")) == KErrNone) |
|
887 { |
|
888 TAlfTextureFlags flags = EAlfTextureFlagDefault; |
|
889 // Use the modified AknIconUtils to create the extended bitmap |
|
890 CFbsBitmap* extendedBitmap; |
|
891 CFbsBitmap* extendedMask; |
|
892 |
|
893 AknIconUtils::CreateIconL( extendedBitmap, extendedMask, iImageFileName, 16384, 16385); |
|
894 AknIconUtils::ExcludeFromCache(extendedBitmap); |
|
895 AknIconUtils::SetSize( extendedBitmap, TSize(64,64) ); |
|
896 |
|
897 // This will be returned, when ProvideBitmapL is called for creating the texture |
|
898 delete iBitmapToBeProvided; |
|
899 iBitmapToBeProvided = extendedBitmap; |
|
900 // We don't need the mask |
|
901 delete extendedMask; |
|
902 |
|
903 for ( TInt count = 0; count < iImageCount; count++ ) |
|
904 { |
|
905 CAlfTexture& texture = textureManager.CreateTextureL(count+1, this, flags); |
|
906 } |
|
907 } |
|
908 else if (parse.Ext().CompareF(_L(".mif")) == KErrNone) |
|
909 #else |
|
910 if (parse.Ext().CompareF(_L(".mif")) == KErrNone) |
|
911 #endif |
|
912 { |
|
913 iLoader = new (ELeave) CAlfImageLoaderUtil; |
|
914 iLoader->SetSize( iImageSize ); |
|
915 |
|
916 // mif file is from absolute path \\resource\\apps\\ |
|
917 textureManager.SetImagePathL(_L("")); |
|
918 |
|
919 TInt baseId = 16384; |
|
920 TInt count = 0; |
|
921 while ( count < iImageCount ) |
|
922 { |
|
923 count++; |
|
924 textureManager.CreateTextureL( |
|
925 count, |
|
926 iLoader->CreateImageLoaderL( |
|
927 KAknsIIDNone, |
|
928 iImageFileName, |
|
929 baseId, |
|
930 baseId + 1 ), |
|
931 iTextureFlags ); |
|
932 baseId += 2; // odd values are masks |
|
933 } |
|
934 } |
|
935 else if (parse.Ext().CompareF(_L(".svg")) == KErrNone) |
|
936 |
|
937 { |
|
938 iLoader = new (ELeave) CAlfImageLoaderUtil; |
|
939 iLoader->SetSize( iImageSize ); |
|
940 |
|
941 TInt count = 0; |
|
942 while ( count < iImageCount ) |
|
943 { |
|
944 count++; |
|
945 textureManager.CreateTextureL( |
|
946 count, |
|
947 iLoader->CreateSVGImageLoaderL( |
|
948 iImageFileName), |
|
949 iTextureFlags ); |
|
950 } |
|
951 } |
|
952 else |
|
953 { |
|
954 for ( TInt count = 0; count < iImageCount; count++ ) |
|
955 { |
|
956 CAlfTexture& texture = textureManager.LoadTextureL(iImageFileName, iTextureFlags, count+1); |
|
957 } |
|
958 } |
|
959 |
|
960 for ( TInt ii = 0; ii < iVisualCount; ii++ ) |
|
961 { |
|
962 CAlfImageVisual* visual = CAlfImageVisual::AddNewL( *this ); |
|
963 iImages.AppendL( visual ); |
|
964 |
|
965 visual->SetFlag( EAlfVisualFlagManualLayout ); |
|
966 visual->SetOpacity( 1.0f ); |
|
967 TReal32 opacity = 1.0; |
|
968 if (OpacityForIndex( ii, opacity )) |
|
969 { |
|
970 visual->SetOpacity( opacity ); |
|
971 } |
|
972 visual->SetSize( iVisualSize ); |
|
973 TAlfRealSize size(0,0); |
|
974 if (SizeForIndex( ii, size )) |
|
975 { |
|
976 visual->SetSize( size ); |
|
977 } |
|
978 |
|
979 visual->SetPos( TAlfRealPoint(0,0) ); |
|
980 TAlfRealPoint pos(0,0); |
|
981 if (PositionForIndex( ii, pos )) |
|
982 { |
|
983 visual->SetPos( pos ); |
|
984 } |
|
985 |
|
986 const CAlfTexture* texture = textureManager.Texture( 1 + ( ii % iImageCount ) ); |
|
987 TAlfImage image( *texture ); |
|
988 visual->SetImage( image ); |
|
989 |
|
990 } |
|
991 } |
|
992 |
|
993 #ifdef __NVG |
|
994 void CAlfPerfAppImageTestCaseManyImages::ProvideBitmapL(TInt /*aId*/, CFbsBitmap*& aBitmap, CFbsBitmap*& /*aMaskBitmap*/) |
|
995 { |
|
996 CFbsBitmap* bmp = new(ELeave) CFbsBitmap(); |
|
997 bmp->Duplicate(iBitmapToBeProvided->Handle()); |
|
998 aBitmap = bmp; |
|
999 }; |
|
1000 #endif |
|
1001 |
|
1002 void CAlfPerfAppImageTestCaseManyImages::DoStartExecuteL() |
|
1003 { |
|
1004 NextCycleL(); |
|
1005 |
|
1006 CompleteAfterL( 5000 ); |
|
1007 } |
|
1008 |
|
1009 void CAlfPerfAppImageTestCaseManyImages::SetVisibleArea( |
|
1010 const TRect& /*aVisibleArea*/ ) |
|
1011 { |
|
1012 if ( IsExecutionOngoing() ) |
|
1013 { |
|
1014 Env().CancelCustomCommands( this, KAlfPerfAppImageCmdNext ); |
|
1015 TRAPD( err, NextCycleL() ); |
|
1016 if ( err != KErrNone ) |
|
1017 { |
|
1018 CompleteNow( err ); |
|
1019 } |
|
1020 } |
|
1021 } |
|
1022 |
|
1023 TBool CAlfPerfAppImageTestCaseManyImages::OfferEventL( const TAlfEvent& aEvent ) |
|
1024 { |
|
1025 if ( aEvent.IsCustomEvent() && |
|
1026 aEvent.CustomParameter() == KAlfPerfAppImageCmdNext ) |
|
1027 { |
|
1028 TRAPD( err, NextCycleL() ); |
|
1029 if ( err != KErrNone ) |
|
1030 { |
|
1031 CompleteNow( err ); |
|
1032 } |
|
1033 return ETrue; |
|
1034 } |
|
1035 |
|
1036 return CAlfPerfAppBaseTestCaseControl::OfferEventL( aEvent ); |
|
1037 } |
|
1038 |
|
1039 void CAlfPerfAppImageTestCaseManyImages::NextCycleL() |
|
1040 { |
|
1041 TAlfCustomEventCommand command( KAlfPerfAppImageCmdNext, this ); |
|
1042 User::LeaveIfError( Env().Send( command, 500 ) ); |
|
1043 |
|
1044 iCycleCounter++; |
|
1045 |
|
1046 // Update cycle state |
|
1047 for ( TInt ii = 0; ii < iImages.Count(); ii++ ) |
|
1048 { |
|
1049 CAlfImageVisual* visual = iImages[ ii ]; |
|
1050 |
|
1051 TInt speed = KVisualAnimSpeed; |
|
1052 TReal32 opacity = 1.0; |
|
1053 if (OpacityForIndex( ii, opacity )) |
|
1054 { |
|
1055 visual->SetOpacity( TAlfTimedValue( opacity, speed ) ); |
|
1056 } |
|
1057 TAlfRealSize size(0,0); |
|
1058 if (SizeForIndex( ii, size )) |
|
1059 { |
|
1060 visual->SetSize( size, speed ); |
|
1061 } |
|
1062 |
|
1063 TAlfRealPoint pos(0,0); |
|
1064 if (PositionForIndex( ii, pos )) |
|
1065 { |
|
1066 visual->SetPos( pos, speed ); |
|
1067 } |
|
1068 } |
|
1069 |
|
1070 // Send pointer events, if wanted |
|
1071 for (TInt i=0; i <iSimulatedPointerEventCount; i++) |
|
1072 { |
|
1073 const TSize KSize( Env().PrimaryDisplay().VisibleArea().Size() ); |
|
1074 |
|
1075 TPoint pos(AlfUtil::RandomInt(0, KSize.iWidth-1), AlfUtil::RandomInt(0, KSize.iWidth-1)); |
|
1076 |
|
1077 // down |
|
1078 TPointerEvent eventDown(TPointerEvent::EButton1Down, 0, pos, TPoint(0,0)); |
|
1079 Env().PrimaryDisplay().HandlePointerEventL( eventDown ); |
|
1080 |
|
1081 //up |
|
1082 TPointerEvent eventUp(TPointerEvent::EButton1Up, 0, pos, TPoint(0,0)); |
|
1083 Env().PrimaryDisplay().HandlePointerEventL( eventUp ); |
|
1084 } |
|
1085 } |
|
1086 |
|
1087 TBool CAlfPerfAppImageTestCaseManyImages::OpacityForIndex( TInt aIndex, TReal32 &aOpacity ) |
|
1088 { |
|
1089 if (aIndex <= iLastIndexInAnimatedArea) |
|
1090 { |
|
1091 if (iCycleCounter&0x01) |
|
1092 { |
|
1093 aOpacity = 0.4; |
|
1094 } |
|
1095 else |
|
1096 { |
|
1097 aOpacity = 0.8; |
|
1098 } |
|
1099 return ETrue; |
|
1100 } |
|
1101 |
|
1102 |
|
1103 return EFalse; |
|
1104 |
|
1105 } |
|
1106 |
|
1107 |
|
1108 TBool CAlfPerfAppImageTestCaseManyImages::SizeForIndex( TInt aIndex, TAlfRealSize& aSize ) |
|
1109 { |
|
1110 // Call only if needed as Size().Target() will flush the command buffer! |
|
1111 if ((iVisualSizeVel.iX != 0) && (iVisualSizeVel.iY != 0)) |
|
1112 { |
|
1113 TAlfRealSize size = iImages[ aIndex ]->Size().Target(); |
|
1114 aSize = TAlfRealSize( size.iWidth + iVisualSizeVel.iX, size.iHeight + iVisualSizeVel.iY ); |
|
1115 return ETrue; |
|
1116 } |
|
1117 return EFalse; |
|
1118 } |
|
1119 |
|
1120 |
|
1121 TBool CAlfPerfAppImageTestCaseManyImages::PositionForIndex( |
|
1122 TInt aIndex, TAlfRealPoint& aPos ) |
|
1123 { |
|
1124 if (iCycleCounter == 0 || aIndex <= iLastIndexInAnimatedArea) |
|
1125 { |
|
1126 TInt index = aIndex + iCycleCounter; |
|
1127 TInt gridIndex = index; |
|
1128 TInt columnPos = gridIndex % iVisualColums; |
|
1129 TInt rowPos = aIndex / iVisualColums; |
|
1130 columnPos = columnPos % iVisualColums; |
|
1131 aPos = TAlfRealPoint( columnPos*iVisualSize.iWidth, rowPos*iVisualSize.iHeight ); |
|
1132 return ETrue; |
|
1133 } |
|
1134 else |
|
1135 { |
|
1136 return EFalse; |
|
1137 } |
|
1138 } |
|
1139 |
|
1140 |
|
1141 TTestCaseSpecificResultText CAlfPerfAppImageTestCase::getCaseSpecificResultL() |
|
1142 { |
|
1143 TTestCaseSpecificResultText result = HBufC::NewL(KAlfPerfAppMaxCharsInSpecificResultText); |
|
1144 if(SequenceIndex() != 0 && CaseID() == EAlfPerfAppImageManyImages) |
|
1145 { |
|
1146 result->Des().Append(_L("Total Visual Count: ")); |
|
1147 result->Des().AppendNum(iTotalVisualCount); |
|
1148 result->Des().Append(_L(" Animated: 1/")); |
|
1149 result->Des().AppendNum(iAnimationDivider); |
|
1150 } |
|
1151 return result; |
|
1152 |
|
1153 } |