sl@0: // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @test sl@0: @internalComponent - Internal Symbian test code sl@0: */ sl@0: sl@0: sl@0: #include "tsmallwindowstestopengl.h" sl@0: #include "tsmallwindowopengl.h" sl@0: sl@0: #include sl@0: sl@0: sl@0: const TInt KNumberOfBounces = 3; sl@0: sl@0: _LIT(KDummy, "dummy"); sl@0: _LIT(KTestStep0013,"GRAPHICS-UI-BENCH-S60-0013"); sl@0: sl@0: const TInt KWindowsAcross = 2; sl@0: const TInt KWindowsDown = 2; sl@0: sl@0: sl@0: CTSmallWindowsTestOpenGL::CTSmallWindowsTestOpenGL() sl@0: { sl@0: SetTestStepName(KTSmallWindowsOpenGL); sl@0: } sl@0: sl@0: CTSmallWindowsTestOpenGL::~CTSmallWindowsTestOpenGL() sl@0: { sl@0: delete iFlowWindowsController; sl@0: iFileNames.Close(); sl@0: } sl@0: sl@0: TVerdict CTSmallWindowsTestOpenGL::doTestStepPreambleL() sl@0: { sl@0: CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL(); sl@0: sl@0: TSize screenSize = CTWindow::GetDisplaySizeInPixels(); sl@0: sl@0: // set window size to create required grid sl@0: iWindowSize.iHeight = screenSize.iHeight / KWindowsDown; sl@0: iWindowSize.iWidth = screenSize.iWidth / KWindowsAcross; sl@0: // adjust window size to maintain image aspect ratio sl@0: if (iWindowSize.iWidth > iWindowSize.iHeight) sl@0: { sl@0: iWindowSize.iWidth = iWindowSize.iHeight; sl@0: } sl@0: else sl@0: { sl@0: iWindowSize.iHeight = iWindowSize.iWidth; sl@0: } sl@0: sl@0: TPoint initialPosition(0, 0); sl@0: RArray initialPositions; sl@0: RArray windowCreatorFunctions; sl@0: CleanupClosePushL(initialPositions); sl@0: CleanupClosePushL(windowCreatorFunctions); sl@0: for (TInt i = 0; i < KWindowsAcross; i++) sl@0: { sl@0: initialPosition.iY = 0; sl@0: for (TInt j = 0; j < KWindowsDown; j++) sl@0: { sl@0: windowCreatorFunctions.AppendL(CTSmallWindowOpenGL::NewL); sl@0: initialPositions.AppendL(initialPosition); sl@0: iFileNames.AppendL(KDummy()); sl@0: initialPosition.iY += iWindowSize.iHeight; sl@0: } sl@0: initialPosition.iX += iWindowSize.iWidth; sl@0: } sl@0: sl@0: iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iWindowSize, windowCreatorFunctions, initialPositions, ETrue); sl@0: CleanupStack::PopAndDestroy(2, &initialPositions); sl@0: sl@0: // run the test enough frames to see move the grid across the screen sl@0: if (screenSize.iHeight > screenSize.iWidth) sl@0: { sl@0: iIterationsToTest = KNumberOfBounces * (screenSize.iHeight - iWindowSize.iHeight * KWindowsDown); sl@0: } sl@0: else sl@0: { sl@0: iIterationsToTest = KNumberOfBounces * (screenSize.iWidth - iWindowSize.iWidth * KWindowsAcross); sl@0: } sl@0: sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: Override of base class pure virtual sl@0: Our implementation only gets called if the base class doTestStepPreambleL() did sl@0: not leave. sl@0: sl@0: @return - TVerdict code sl@0: */ sl@0: TVerdict CTSmallWindowsTestOpenGL::doTestStepL() sl@0: { sl@0: SetTestStepID(KTestStep0013); sl@0: FlowWindowsL(); sl@0: //RecordTestResultL(); // todo: not possible because of heap alloc panic sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-UI-BENCH-S60-0013 sl@0: sl@0: @SYMTestCaseDesc sl@0: Tests how long it takes to move small OpenGL ES windows over the screen. sl@0: sl@0: @SYMTestActions sl@0: Creates windows which draw OpenGL ES content and moves them over the screen. sl@0: sl@0: @SYMTestExpectedResults sl@0: Test should pass and write the average framerate of the test to a log file. sl@0: */ sl@0: void CTSmallWindowsTestOpenGL::FlowWindowsL() sl@0: { sl@0: iProfiler->InitResults(); sl@0: iIterationsToTest = 50; sl@0: for (TInt i = 0; i < iIterationsToTest; ++i) sl@0: { sl@0: iFlowWindowsController->MoveL(); sl@0: } sl@0: iProfiler->MarkResultSetL(); sl@0: TInt drawingRect = iWindowSize.iHeight * iWindowSize.iWidth * KWindowsAcross * KWindowsDown; sl@0: iProfiler->ResultsAnalysisFrameRate(KTestStep0013, 0, 0, 0, iIterationsToTest, drawingRect); sl@0: }