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 "trotateteststep.h" sl@0: #include "tsmallwindowraster.h" sl@0: #include "tflowwindowscontroller.h" sl@0: sl@0: sl@0: _LIT(KTestStep0003,"GRAPHICS-UI-BENCH-S60-0003"); sl@0: _LIT(KSectNameOpenFlowTests, "FlowTests"); sl@0: _LIT(KKeyNameFiles, "Files"); sl@0: sl@0: const TInt KNumFullRotations = 20; // number of full rotations sl@0: const TInt KNumPartlyRotations = 4; // number of partly rotations within one full rotation sl@0: sl@0: sl@0: CTRotateTestStep::CTRotateTestStep() sl@0: { sl@0: SetTestStepName(KTRotateTestStep); sl@0: iScreenSize = CTWindow::GetDisplaySizeInPixels(); sl@0: } sl@0: sl@0: CTRotateTestStep::~CTRotateTestStep() sl@0: { sl@0: delete iFlowWindowsController; sl@0: iFileNames.Close(); sl@0: } sl@0: sl@0: TVerdict CTRotateTestStep::doTestStepPreambleL() sl@0: { sl@0: CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL(); sl@0: TPtrC fileNameList; sl@0: TESTL(GetStringFromConfig(KSectNameOpenFlowTests, KKeyNameFiles, fileNameList)); sl@0: ExtractListL(fileNameList, iFileNames); sl@0: sl@0: RArray initialPositions; sl@0: RArray windowCreatorFunctions; sl@0: CleanupClosePushL(initialPositions); sl@0: CleanupClosePushL(windowCreatorFunctions); sl@0: TInt numberOfWindows = iFileNames.Count(); sl@0: TPoint initialPosition(0, 0); sl@0: for (TInt i = 0; i < numberOfWindows; i++) sl@0: { sl@0: windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL); sl@0: initialPositions.AppendL(initialPosition); sl@0: initialPosition.iX += iScreenSize.iWidth; sl@0: } sl@0: sl@0: iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iScreenSize, windowCreatorFunctions, initialPositions, EFalse); sl@0: // Ensure all windows are visible so that the image appears when the screen is rotated. sl@0: iFlowWindowsController->SetWindowsVisibility(ETrue); sl@0: sl@0: CleanupStack::PopAndDestroy(2, &initialPositions); 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 CTRotateTestStep::doTestStepL() sl@0: { sl@0: SetTestStepID(KTestStep0003); sl@0: TRAPD(err, RotateWindowsL()); sl@0: if (err != KErrNone) sl@0: { sl@0: SetTestStepResult(EAbort); sl@0: } sl@0: return TestStepResult(); sl@0: } sl@0: sl@0: /** sl@0: @SYMTestCaseID sl@0: GRAPHICS-UI-BENCH-S60-0003 sl@0: sl@0: @SYMTestCaseDesc sl@0: Tests how long it takes to rotate and redraw the screen. sl@0: sl@0: @SYMTestActions sl@0: Creates windows which draw bitmaps and rotates 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 CTRotateTestStep::RotateWindowsL() sl@0: { sl@0: iProfiler->InitResults(); sl@0: for (TInt i = 0; i < KNumFullRotations; i++) sl@0: { sl@0: iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated90); sl@0: iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated180); sl@0: iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated270); sl@0: iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationNormal); sl@0: } sl@0: iProfiler->MarkResultSetL(); sl@0: iProfiler->ResultsAnalysisScreenRotationRate(KTestStep0003, 0, 0, 0, KNumFullRotations * KNumPartlyRotations, sl@0: iScreenSize.iWidth * iScreenSize.iHeight); sl@0: }