os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/tsmallwindowstestopengl.cpp
Update contrib.
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 "tsmallwindowstestopengl.h"
24 #include "tsmallwindowopengl.h"
26 #include <imageconversion.h>
29 const TInt KNumberOfBounces = 3;
31 _LIT(KDummy, "dummy");
32 _LIT(KTestStep0013,"GRAPHICS-UI-BENCH-S60-0013");
34 const TInt KWindowsAcross = 2;
35 const TInt KWindowsDown = 2;
38 CTSmallWindowsTestOpenGL::CTSmallWindowsTestOpenGL()
40 SetTestStepName(KTSmallWindowsOpenGL);
43 CTSmallWindowsTestOpenGL::~CTSmallWindowsTestOpenGL()
45 delete iFlowWindowsController;
49 TVerdict CTSmallWindowsTestOpenGL::doTestStepPreambleL()
51 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
53 TSize screenSize = CTWindow::GetDisplaySizeInPixels();
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)
61 iWindowSize.iWidth = iWindowSize.iHeight;
65 iWindowSize.iHeight = iWindowSize.iWidth;
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++)
75 initialPosition.iY = 0;
76 for (TInt j = 0; j < KWindowsDown; j++)
78 windowCreatorFunctions.AppendL(CTSmallWindowOpenGL::NewL);
79 initialPositions.AppendL(initialPosition);
80 iFileNames.AppendL(KDummy());
81 initialPosition.iY += iWindowSize.iHeight;
83 initialPosition.iX += iWindowSize.iWidth;
86 iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iWindowSize, windowCreatorFunctions, initialPositions, ETrue);
87 CleanupStack::PopAndDestroy(2, &initialPositions);
89 // run the test enough frames to see move the grid across the screen
90 if (screenSize.iHeight > screenSize.iWidth)
92 iIterationsToTest = KNumberOfBounces * (screenSize.iHeight - iWindowSize.iHeight * KWindowsDown);
96 iIterationsToTest = KNumberOfBounces * (screenSize.iWidth - iWindowSize.iWidth * KWindowsAcross);
99 return TestStepResult();
103 Override of base class pure virtual
104 Our implementation only gets called if the base class doTestStepPreambleL() did
107 @return - TVerdict code
109 TVerdict CTSmallWindowsTestOpenGL::doTestStepL()
111 SetTestStepID(KTestStep0013);
113 //RecordTestResultL(); // todo: not possible because of heap alloc panic
114 return TestStepResult();
119 GRAPHICS-UI-BENCH-S60-0013
122 Tests how long it takes to move small OpenGL ES windows over the screen.
125 Creates windows which draw OpenGL ES content and moves them over the screen.
127 @SYMTestExpectedResults
128 Test should pass and write the average framerate of the test to a log file.
130 void CTSmallWindowsTestOpenGL::FlowWindowsL()
132 iProfiler->InitResults();
133 iIterationsToTest = 50;
134 for (TInt i = 0; i < iIterationsToTest; ++i)
136 iFlowWindowsController->MoveL();
138 iProfiler->MarkResultSetL();
139 TInt drawingRect = iWindowSize.iHeight * iWindowSize.iWidth * KWindowsAcross * KWindowsDown;
140 iProfiler->ResultsAnalysisFrameRate(KTestStep0013, 0, 0, 0, iIterationsToTest, drawingRect);