os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/tsmallwindowstestraster.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 "tsmallwindowstestraster.h"
24 #include "tsmallwindowraster.h"
27 const TInt KWindowsAcross = 2;
28 const TInt KWindowsDown = 2;
30 const TInt KNumberOfBounces = 3;
32 _LIT(KSmallBitmap,"z:\\resource\\apps\\uibench_s60_small.mbm");
33 _LIT(KTestStep0015,"GRAPHICS-UI-BENCH-S60-0015");
36 CTSmallWindowsTestRaster::CTSmallWindowsTestRaster()
38 SetTestStepName(KTSmallWindowsRaster);
41 CTSmallWindowsTestRaster::~CTSmallWindowsTestRaster()
43 delete iFlowWindowsController;
47 TVerdict CTSmallWindowsTestRaster::doTestStepPreambleL()
49 CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
51 TSize screenSize = CTWindow::GetDisplaySizeInPixels();
53 // set window size to create required grid
54 iWindowSize.iHeight = screenSize.iHeight / KWindowsDown;
55 iWindowSize.iWidth = screenSize.iWidth / KWindowsAcross;
56 // adjust window size to maintain image aspect ratio
57 if (iWindowSize.iWidth > iWindowSize.iHeight)
59 iWindowSize.iWidth = iWindowSize.iHeight;
63 iWindowSize.iHeight = iWindowSize.iWidth;
66 TPoint initialPosition(0, 0);
67 RArray<TPoint> initialPositions;
68 RArray<pTWindowCreatorFunction> windowCreatorFunctions;
69 CleanupClosePushL(initialPositions);
70 CleanupClosePushL(windowCreatorFunctions);
71 for (TInt i = 0; i < KWindowsAcross; i++)
73 initialPosition.iY = 0;
74 for (TInt j = 0; j < KWindowsDown; j++)
76 windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
77 initialPositions.AppendL(initialPosition);
78 iFileNames.AppendL(KSmallBitmap());
79 initialPosition.iY += iWindowSize.iHeight;
81 initialPosition.iX += iWindowSize.iWidth;
84 iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iWindowSize, windowCreatorFunctions, initialPositions, ETrue);
85 CleanupStack::PopAndDestroy(2, &initialPositions);
87 // run the test enough frames to see move the grid across the screen
88 if (screenSize.iHeight > screenSize.iWidth)
90 iIterationsToTest = KNumberOfBounces * (screenSize.iHeight - iWindowSize.iHeight * KWindowsDown);
94 iIterationsToTest = KNumberOfBounces * (screenSize.iWidth - iWindowSize.iWidth * KWindowsAcross);
97 return TestStepResult();
101 Override of base class pure virtual
102 Our implementation only gets called if the base class doTestStepPreambleL() did
105 @return - TVerdict code
107 TVerdict CTSmallWindowsTestRaster::doTestStepL()
109 SetTestStepID(KTestStep0015);
110 TRAPD(err, FlowWindowsL());
113 SetTestStepResult(EAbort);
115 return TestStepResult();
120 GRAPHICS-UI-BENCH-S60-0015
123 Tests how long it takes to move small windows over the screen.
126 Creates windows which draw Bitmaps and moves them over the screen.
128 @SYMTestExpectedResults
129 Test should pass and write the average framerate of the test to a log file.
131 void CTSmallWindowsTestRaster::FlowWindowsL()
133 iProfiler->InitResults();
134 iIterationsToTest = 50;
135 for (TInt i = 0; i < iIterationsToTest; ++i)
137 iFlowWindowsController->MoveL();
138 // todo: why is a pause needed to let wserv redraw the screen?
139 User::After(10000); // needed, otherwise test is not waiting for wserv to redraw (10 ms)
141 iProfiler->MarkResultSetL();
142 TInt drawingRect = iWindowSize.iHeight * iWindowSize.iWidth * KWindowsAcross * KWindowsDown;
143 iProfiler->ResultsAnalysisFrameRate(KTestStep0015, 0, 0, 0, iIterationsToTest, drawingRect);