os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/tsmallwindowstestzoom.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 "tsmallwindowstestzoom.h"
23 #include "tsmallwindowzoom.h"
26 const TInt KWindowsAcross = 2;
27 const TInt KWindowsDown = 2;
29 const TInt KNumberOfBounces = 3;
31 _LIT(KSmallBitmap,"z:\\resource\\apps\\uibench_s60_small.mbm");
32 _LIT(KTestStep0016,"GRAPHICS-UI-BENCH-S60-0016");
35 CTSmallWindowsTestZoom::CTSmallWindowsTestZoom()
37 SetTestStepName(KTSmallWindowsZoom);
40 CTSmallWindowsTestZoom::~CTSmallWindowsTestZoom()
42 delete iFlowWindowsController;
46 TVerdict CTSmallWindowsTestZoom::doTestStepPreambleL()
48 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
50 TSize screenSize = CTWindow::GetDisplaySizeInPixels();
52 // set window size to create required grid
53 iWindowSize.iHeight = screenSize.iHeight / KWindowsDown;
54 iWindowSize.iWidth = screenSize.iWidth / KWindowsAcross;
55 // adjust window size to maintain image aspect ratio
56 if (iWindowSize.iWidth > iWindowSize.iHeight)
58 iWindowSize.iWidth = iWindowSize.iHeight;
62 iWindowSize.iHeight = iWindowSize.iWidth;
65 TPoint initialPosition(0, 0);
66 RArray<TPoint> initialPositions;
67 RArray<pTWindowCreatorFunction> windowCreatorFunctions;
68 CleanupClosePushL(initialPositions);
69 CleanupClosePushL(windowCreatorFunctions);
70 for (TInt i = 0; i < KWindowsAcross; i++)
72 initialPosition.iY = 0;
73 for (TInt j = 0; j < KWindowsDown; j++)
75 windowCreatorFunctions.AppendL(CTSmallWindowZoom::NewL);
76 initialPositions.AppendL(initialPosition);
77 iFileNames.AppendL(KSmallBitmap());
78 initialPosition.iY += iWindowSize.iHeight;
80 initialPosition.iX += iWindowSize.iWidth;
83 iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iWindowSize, windowCreatorFunctions, initialPositions, ETrue);
84 CleanupStack::PopAndDestroy(2, &initialPositions);
86 // run the test enough frames to see move the grid across the screen
87 if (screenSize.iHeight > screenSize.iWidth)
89 iIterationsToTest = KNumberOfBounces * (screenSize.iHeight - iWindowSize.iHeight * KWindowsDown);
93 iIterationsToTest = KNumberOfBounces * (screenSize.iWidth - iWindowSize.iWidth * KWindowsAcross);
96 return TestStepResult();
100 Override of base class pure virtual
101 Our implementation only gets called if the base class doTestStepPreambleL() did
104 @return - TVerdict code
106 TVerdict CTSmallWindowsTestZoom::doTestStepL()
108 SetTestStepID(KTestStep0016);
110 //RecordTestResultL(); // todo: not possible because of heap alloc panic
111 return TestStepResult();
116 GRAPHICS-UI-BENCH-S60-0016
119 Tests how long it takes to zoom small windows.
122 Creates windows which draw Bitmaps and zooms them.
124 @SYMTestExpectedResults
125 Test should pass and write the average framerate of the test to a log file.
127 void CTSmallWindowsTestZoom::FlowWindowsL()
129 iProfiler->InitResults();
130 iIterationsToTest = 50;
131 for (TInt i = 0; i <= iIterationsToTest; ++i)
133 iFlowWindowsController->MoveL();
134 // todo: why is a pause needed to let wserv redraw the screen?
135 User::After(10000); // needed, otherwise test is not waiting for wserv to redraw (10 ms)
137 iProfiler->MarkResultSetL();
138 TInt drawingRect = iWindowSize.iHeight * iWindowSize.iWidth * KWindowsAcross * KWindowsDown;
139 iProfiler->ResultsAnalysisFrameRate(KTestStep0016, 0, 0, 0, iIterationsToTest, drawingRect);