|
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". |
|
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 |
|
23 #include "tsmallwindowstestopengl.h" |
|
24 #include "tsmallwindowopengl.h" |
|
25 |
|
26 #include <imageconversion.h> |
|
27 |
|
28 |
|
29 const TInt KNumberOfBounces = 3; |
|
30 |
|
31 _LIT(KDummy, "dummy"); |
|
32 _LIT(KTestStep0013,"GRAPHICS-UI-BENCH-S60-0013"); |
|
33 |
|
34 const TInt KWindowsAcross = 2; |
|
35 const TInt KWindowsDown = 2; |
|
36 |
|
37 |
|
38 CTSmallWindowsTestOpenGL::CTSmallWindowsTestOpenGL() |
|
39 { |
|
40 SetTestStepName(KTSmallWindowsOpenGL); |
|
41 } |
|
42 |
|
43 CTSmallWindowsTestOpenGL::~CTSmallWindowsTestOpenGL() |
|
44 { |
|
45 delete iFlowWindowsController; |
|
46 iFileNames.Close(); |
|
47 } |
|
48 |
|
49 TVerdict CTSmallWindowsTestOpenGL::doTestStepPreambleL() |
|
50 { |
|
51 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL(); |
|
52 |
|
53 TSize screenSize = CTWindow::GetDisplaySizeInPixels(); |
|
54 |
|
55 // set window size to create required grid |
|
56 iWindowSize.iHeight = screenSize.iHeight / KWindowsDown; |
|
57 iWindowSize.iWidth = screenSize.iWidth / KWindowsAcross; |
|
58 // adjust window size to maintain image aspect ratio |
|
59 if (iWindowSize.iWidth > iWindowSize.iHeight) |
|
60 { |
|
61 iWindowSize.iWidth = iWindowSize.iHeight; |
|
62 } |
|
63 else |
|
64 { |
|
65 iWindowSize.iHeight = iWindowSize.iWidth; |
|
66 } |
|
67 |
|
68 TPoint initialPosition(0, 0); |
|
69 RArray<TPoint> initialPositions; |
|
70 RArray<pTWindowCreatorFunction> windowCreatorFunctions; |
|
71 CleanupClosePushL(initialPositions); |
|
72 CleanupClosePushL(windowCreatorFunctions); |
|
73 for (TInt i = 0; i < KWindowsAcross; i++) |
|
74 { |
|
75 initialPosition.iY = 0; |
|
76 for (TInt j = 0; j < KWindowsDown; j++) |
|
77 { |
|
78 windowCreatorFunctions.AppendL(CTSmallWindowOpenGL::NewL); |
|
79 initialPositions.AppendL(initialPosition); |
|
80 iFileNames.AppendL(KDummy()); |
|
81 initialPosition.iY += iWindowSize.iHeight; |
|
82 } |
|
83 initialPosition.iX += iWindowSize.iWidth; |
|
84 } |
|
85 |
|
86 iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iWindowSize, windowCreatorFunctions, initialPositions, ETrue); |
|
87 CleanupStack::PopAndDestroy(2, &initialPositions); |
|
88 |
|
89 // run the test enough frames to see move the grid across the screen |
|
90 if (screenSize.iHeight > screenSize.iWidth) |
|
91 { |
|
92 iIterationsToTest = KNumberOfBounces * (screenSize.iHeight - iWindowSize.iHeight * KWindowsDown); |
|
93 } |
|
94 else |
|
95 { |
|
96 iIterationsToTest = KNumberOfBounces * (screenSize.iWidth - iWindowSize.iWidth * KWindowsAcross); |
|
97 } |
|
98 |
|
99 return TestStepResult(); |
|
100 } |
|
101 |
|
102 /** |
|
103 Override of base class pure virtual |
|
104 Our implementation only gets called if the base class doTestStepPreambleL() did |
|
105 not leave. |
|
106 |
|
107 @return - TVerdict code |
|
108 */ |
|
109 TVerdict CTSmallWindowsTestOpenGL::doTestStepL() |
|
110 { |
|
111 SetTestStepID(KTestStep0013); |
|
112 FlowWindowsL(); |
|
113 //RecordTestResultL(); // todo: not possible because of heap alloc panic |
|
114 return TestStepResult(); |
|
115 } |
|
116 |
|
117 /** |
|
118 @SYMTestCaseID |
|
119 GRAPHICS-UI-BENCH-S60-0013 |
|
120 |
|
121 @SYMTestCaseDesc |
|
122 Tests how long it takes to move small OpenGL ES windows over the screen. |
|
123 |
|
124 @SYMTestActions |
|
125 Creates windows which draw OpenGL ES content and moves them over the screen. |
|
126 |
|
127 @SYMTestExpectedResults |
|
128 Test should pass and write the average framerate of the test to a log file. |
|
129 */ |
|
130 void CTSmallWindowsTestOpenGL::FlowWindowsL() |
|
131 { |
|
132 iProfiler->InitResults(); |
|
133 iIterationsToTest = 50; |
|
134 for (TInt i = 0; i < iIterationsToTest; ++i) |
|
135 { |
|
136 iFlowWindowsController->MoveL(); |
|
137 } |
|
138 iProfiler->MarkResultSetL(); |
|
139 TInt drawingRect = iWindowSize.iHeight * iWindowSize.iWidth * KWindowsAcross * KWindowsDown; |
|
140 iProfiler->ResultsAnalysisFrameRate(KTestStep0013, 0, 0, 0, iIterationsToTest, drawingRect); |
|
141 } |