os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/tsmallwindowstestopenvg.cpp
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
22 #include "tsmallwindowstestopenvg.h"
23 #include "tsmallwindowopenvg.h"
25 #include <imageconversion.h>
28 const TInt KNumberOfBounces = 3;
30 _LIT(KDummy, "dummy");
31 _LIT(KTestStep0014,"GRAPHICS-UI-BENCH-S60-0014");
33 const TInt KWindowsAcross = 2;
34 const TInt KWindowsDown = 2;
37 CTSmallWindowsTestOpenVG::CTSmallWindowsTestOpenVG()
39 SetTestStepName(KTSmallWindowsOpenVG);
42 CTSmallWindowsTestOpenVG::~CTSmallWindowsTestOpenVG()
44 delete iFlowWindowsController;
48 TVerdict CTSmallWindowsTestOpenVG::doTestStepPreambleL()
50 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
52 TSize screenSize = CTWindow::GetDisplaySizeInPixels();
54 // set window size to create required grid
55 iWindowSize.iHeight = screenSize.iHeight / KWindowsDown;
56 iWindowSize.iWidth = screenSize.iWidth / KWindowsAcross;
57 // adjust window size to maintain image aspect ratio
58 if (iWindowSize.iWidth > iWindowSize.iHeight)
60 iWindowSize.iWidth = iWindowSize.iHeight;
64 iWindowSize.iHeight = iWindowSize.iWidth;
67 TPoint initialPosition(0, 0);
68 RArray<TPoint> initialPositions;
69 RArray<pTWindowCreatorFunction> windowCreatorFunctions;
70 CleanupClosePushL(initialPositions);
71 CleanupClosePushL(windowCreatorFunctions);
72 for (TInt i = 0; i < KWindowsAcross; i++)
74 initialPosition.iY = 0;
75 for (TInt j = 0; j < KWindowsDown; j++)
77 windowCreatorFunctions.AppendL(CTSmallWindowOpenVG::NewL);
78 initialPositions.AppendL(initialPosition);
79 iFileNames.AppendL(KDummy());
80 initialPosition.iY += iWindowSize.iHeight;
82 initialPosition.iX += iWindowSize.iWidth;
85 iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iWindowSize, windowCreatorFunctions, initialPositions, ETrue);
86 CleanupStack::PopAndDestroy(2, &initialPositions);
88 // run the test enough frames to see move the grid across the screen
89 if (screenSize.iHeight > screenSize.iWidth)
91 iIterationsToTest = KNumberOfBounces * (screenSize.iHeight - iWindowSize.iHeight * KWindowsDown);
95 iIterationsToTest = KNumberOfBounces * (screenSize.iWidth - iWindowSize.iWidth * KWindowsAcross);
98 return TestStepResult();
102 Override of base class pure virtual
103 Our implementation only gets called if the base class doTestStepPreambleL() did
106 @return - TVerdict code
108 TVerdict CTSmallWindowsTestOpenVG::doTestStepL()
110 SetTestStepID(KTestStep0014);
112 //RecordTestResultL(); // todo: not possible because of heap alloc panic
113 return TestStepResult();
118 GRAPHICS-UI-BENCH-S60-0014
121 Tests how long it takes to move small OpenVG windows over the screen.
124 Creates windows which draw OpenVG content and moves them over the screen.
126 @SYMTestExpectedResults
127 Test should pass and write the average framerate of the test to a log file.
129 void CTSmallWindowsTestOpenVG::FlowWindowsL()
131 iProfiler->InitResults();
132 iIterationsToTest = 10;
133 for (TInt i = 0; i <= iIterationsToTest; ++i)
135 iFlowWindowsController->MoveL();
137 iProfiler->MarkResultSetL();
138 TInt drawingRect = iWindowSize.iHeight * iWindowSize.iWidth * KWindowsAcross * KWindowsDown;
139 iProfiler->ResultsAnalysisFrameRate(KTestStep0014, 0, 0, 0, iIterationsToTest, drawingRect);