sl@0
|
1 |
// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
//
|
sl@0
|
15 |
|
sl@0
|
16 |
/**
|
sl@0
|
17 |
@file
|
sl@0
|
18 |
@test
|
sl@0
|
19 |
@internalComponent - Internal Symbian test code
|
sl@0
|
20 |
*/
|
sl@0
|
21 |
|
sl@0
|
22 |
|
sl@0
|
23 |
#include "trotateteststep.h"
|
sl@0
|
24 |
#include "tsmallwindowraster.h"
|
sl@0
|
25 |
#include "tflowwindowscontroller.h"
|
sl@0
|
26 |
|
sl@0
|
27 |
|
sl@0
|
28 |
_LIT(KTestStep0003,"GRAPHICS-UI-BENCH-S60-0003");
|
sl@0
|
29 |
_LIT(KSectNameOpenFlowTests, "FlowTests");
|
sl@0
|
30 |
_LIT(KKeyNameFiles, "Files");
|
sl@0
|
31 |
|
sl@0
|
32 |
const TInt KNumFullRotations = 20; // number of full rotations
|
sl@0
|
33 |
const TInt KNumPartlyRotations = 4; // number of partly rotations within one full rotation
|
sl@0
|
34 |
|
sl@0
|
35 |
|
sl@0
|
36 |
CTRotateTestStep::CTRotateTestStep()
|
sl@0
|
37 |
{
|
sl@0
|
38 |
SetTestStepName(KTRotateTestStep);
|
sl@0
|
39 |
iScreenSize = CTWindow::GetDisplaySizeInPixels();
|
sl@0
|
40 |
}
|
sl@0
|
41 |
|
sl@0
|
42 |
CTRotateTestStep::~CTRotateTestStep()
|
sl@0
|
43 |
{
|
sl@0
|
44 |
delete iFlowWindowsController;
|
sl@0
|
45 |
iFileNames.Close();
|
sl@0
|
46 |
}
|
sl@0
|
47 |
|
sl@0
|
48 |
TVerdict CTRotateTestStep::doTestStepPreambleL()
|
sl@0
|
49 |
{
|
sl@0
|
50 |
CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
|
sl@0
|
51 |
TPtrC fileNameList;
|
sl@0
|
52 |
TESTL(GetStringFromConfig(KSectNameOpenFlowTests, KKeyNameFiles, fileNameList));
|
sl@0
|
53 |
ExtractListL(fileNameList, iFileNames);
|
sl@0
|
54 |
|
sl@0
|
55 |
RArray<TPoint> initialPositions;
|
sl@0
|
56 |
RArray<pTWindowCreatorFunction> windowCreatorFunctions;
|
sl@0
|
57 |
CleanupClosePushL(initialPositions);
|
sl@0
|
58 |
CleanupClosePushL(windowCreatorFunctions);
|
sl@0
|
59 |
TInt numberOfWindows = iFileNames.Count();
|
sl@0
|
60 |
TPoint initialPosition(0, 0);
|
sl@0
|
61 |
for (TInt i = 0; i < numberOfWindows; i++)
|
sl@0
|
62 |
{
|
sl@0
|
63 |
windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
|
sl@0
|
64 |
initialPositions.AppendL(initialPosition);
|
sl@0
|
65 |
initialPosition.iX += iScreenSize.iWidth;
|
sl@0
|
66 |
}
|
sl@0
|
67 |
|
sl@0
|
68 |
iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iScreenSize, windowCreatorFunctions, initialPositions, EFalse);
|
sl@0
|
69 |
// Ensure all windows are visible so that the image appears when the screen is rotated.
|
sl@0
|
70 |
iFlowWindowsController->SetWindowsVisibility(ETrue);
|
sl@0
|
71 |
|
sl@0
|
72 |
CleanupStack::PopAndDestroy(2, &initialPositions);
|
sl@0
|
73 |
return TestStepResult();
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
/**
|
sl@0
|
77 |
Override of base class pure virtual
|
sl@0
|
78 |
Our implementation only gets called if the base class doTestStepPreambleL() did
|
sl@0
|
79 |
not leave.
|
sl@0
|
80 |
|
sl@0
|
81 |
@return - TVerdict code
|
sl@0
|
82 |
*/
|
sl@0
|
83 |
TVerdict CTRotateTestStep::doTestStepL()
|
sl@0
|
84 |
{
|
sl@0
|
85 |
SetTestStepID(KTestStep0003);
|
sl@0
|
86 |
TRAPD(err, RotateWindowsL());
|
sl@0
|
87 |
if (err != KErrNone)
|
sl@0
|
88 |
{
|
sl@0
|
89 |
SetTestStepResult(EAbort);
|
sl@0
|
90 |
}
|
sl@0
|
91 |
return TestStepResult();
|
sl@0
|
92 |
}
|
sl@0
|
93 |
|
sl@0
|
94 |
/**
|
sl@0
|
95 |
@SYMTestCaseID
|
sl@0
|
96 |
GRAPHICS-UI-BENCH-S60-0003
|
sl@0
|
97 |
|
sl@0
|
98 |
@SYMTestCaseDesc
|
sl@0
|
99 |
Tests how long it takes to rotate and redraw the screen.
|
sl@0
|
100 |
|
sl@0
|
101 |
@SYMTestActions
|
sl@0
|
102 |
Creates windows which draw bitmaps and rotates the screen.
|
sl@0
|
103 |
|
sl@0
|
104 |
@SYMTestExpectedResults
|
sl@0
|
105 |
Test should pass and write the average framerate of the test to a log file.
|
sl@0
|
106 |
*/
|
sl@0
|
107 |
void CTRotateTestStep::RotateWindowsL()
|
sl@0
|
108 |
{
|
sl@0
|
109 |
iProfiler->InitResults();
|
sl@0
|
110 |
for (TInt i = 0; i < KNumFullRotations; i++)
|
sl@0
|
111 |
{
|
sl@0
|
112 |
iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated90);
|
sl@0
|
113 |
iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated180);
|
sl@0
|
114 |
iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated270);
|
sl@0
|
115 |
iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationNormal);
|
sl@0
|
116 |
}
|
sl@0
|
117 |
iProfiler->MarkResultSetL();
|
sl@0
|
118 |
iProfiler->ResultsAnalysisScreenRotationRate(KTestStep0003, 0, 0, 0, KNumFullRotations * KNumPartlyRotations,
|
sl@0
|
119 |
iScreenSize.iWidth * iScreenSize.iHeight);
|
sl@0
|
120 |
}
|