First public contribution.
1 // Copyright (c) 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.
19 @internalComponent - Internal Symbian test code
23 #include "trotateteststep.h"
24 #include "tsmallwindowraster.h"
25 #include "tflowwindowscontroller.h"
28 _LIT(KTestStep0003,"GRAPHICS-UI-BENCH-S60-0003");
29 _LIT(KSectNameOpenFlowTests, "FlowTests");
30 _LIT(KKeyNameFiles, "Files");
32 const TInt KNumFullRotations = 20; // number of full rotations
33 const TInt KNumPartlyRotations = 4; // number of partly rotations within one full rotation
36 CTRotateTestStep::CTRotateTestStep()
38 SetTestStepName(KTRotateTestStep);
39 iScreenSize = CTWindow::GetDisplaySizeInPixels();
42 CTRotateTestStep::~CTRotateTestStep()
44 delete iFlowWindowsController;
48 TVerdict CTRotateTestStep::doTestStepPreambleL()
50 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
52 TESTL(GetStringFromConfig(KSectNameOpenFlowTests, KKeyNameFiles, fileNameList));
53 ExtractListL(fileNameList, iFileNames);
55 RArray<TPoint> initialPositions;
56 RArray<pTWindowCreatorFunction> windowCreatorFunctions;
57 CleanupClosePushL(initialPositions);
58 CleanupClosePushL(windowCreatorFunctions);
59 TInt numberOfWindows = iFileNames.Count();
60 TPoint initialPosition(0, 0);
61 for (TInt i = 0; i < numberOfWindows; i++)
63 windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
64 initialPositions.AppendL(initialPosition);
65 initialPosition.iX += iScreenSize.iWidth;
68 iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iScreenSize, windowCreatorFunctions, initialPositions, EFalse);
69 // Ensure all windows are visible so that the image appears when the screen is rotated.
70 iFlowWindowsController->SetWindowsVisibility(ETrue);
72 CleanupStack::PopAndDestroy(2, &initialPositions);
73 return TestStepResult();
77 Override of base class pure virtual
78 Our implementation only gets called if the base class doTestStepPreambleL() did
81 @return - TVerdict code
83 TVerdict CTRotateTestStep::doTestStepL()
85 SetTestStepID(KTestStep0003);
86 TRAPD(err, RotateWindowsL());
89 SetTestStepResult(EAbort);
91 return TestStepResult();
96 GRAPHICS-UI-BENCH-S60-0003
99 Tests how long it takes to rotate and redraw the screen.
102 Creates windows which draw bitmaps and rotates the screen.
104 @SYMTestExpectedResults
105 Test should pass and write the average framerate of the test to a log file.
107 void CTRotateTestStep::RotateWindowsL()
109 iProfiler->InitResults();
110 for (TInt i = 0; i < KNumFullRotations; i++)
112 iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated90);
113 iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated180);
114 iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated270);
115 iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationNormal);
117 iProfiler->MarkResultSetL();
118 iProfiler->ResultsAnalysisScreenRotationRate(KTestStep0003, 0, 0, 0, KNumFullRotations * KNumPartlyRotations,
119 iScreenSize.iWidth * iScreenSize.iHeight);