1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/trotateteststep.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,120 @@
1.4 +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +/**
1.20 + @file
1.21 + @test
1.22 + @internalComponent - Internal Symbian test code
1.23 +*/
1.24 +
1.25 +
1.26 +#include "trotateteststep.h"
1.27 +#include "tsmallwindowraster.h"
1.28 +#include "tflowwindowscontroller.h"
1.29 +
1.30 +
1.31 +_LIT(KTestStep0003,"GRAPHICS-UI-BENCH-S60-0003");
1.32 +_LIT(KSectNameOpenFlowTests, "FlowTests");
1.33 +_LIT(KKeyNameFiles, "Files");
1.34 +
1.35 +const TInt KNumFullRotations = 20; // number of full rotations
1.36 +const TInt KNumPartlyRotations = 4; // number of partly rotations within one full rotation
1.37 +
1.38 +
1.39 +CTRotateTestStep::CTRotateTestStep()
1.40 + {
1.41 + SetTestStepName(KTRotateTestStep);
1.42 + iScreenSize = CTWindow::GetDisplaySizeInPixels();
1.43 + }
1.44 +
1.45 +CTRotateTestStep::~CTRotateTestStep()
1.46 + {
1.47 + delete iFlowWindowsController;
1.48 + iFileNames.Close();
1.49 + }
1.50 +
1.51 +TVerdict CTRotateTestStep::doTestStepPreambleL()
1.52 + {
1.53 + CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
1.54 + TPtrC fileNameList;
1.55 + TESTL(GetStringFromConfig(KSectNameOpenFlowTests, KKeyNameFiles, fileNameList));
1.56 + ExtractListL(fileNameList, iFileNames);
1.57 +
1.58 + RArray<TPoint> initialPositions;
1.59 + RArray<pTWindowCreatorFunction> windowCreatorFunctions;
1.60 + CleanupClosePushL(initialPositions);
1.61 + CleanupClosePushL(windowCreatorFunctions);
1.62 + TInt numberOfWindows = iFileNames.Count();
1.63 + TPoint initialPosition(0, 0);
1.64 + for (TInt i = 0; i < numberOfWindows; i++)
1.65 + {
1.66 + windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
1.67 + initialPositions.AppendL(initialPosition);
1.68 + initialPosition.iX += iScreenSize.iWidth;
1.69 + }
1.70 +
1.71 + iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iScreenSize, windowCreatorFunctions, initialPositions, EFalse);
1.72 + // Ensure all windows are visible so that the image appears when the screen is rotated.
1.73 + iFlowWindowsController->SetWindowsVisibility(ETrue);
1.74 +
1.75 + CleanupStack::PopAndDestroy(2, &initialPositions);
1.76 + return TestStepResult();
1.77 + }
1.78 +
1.79 +/**
1.80 + Override of base class pure virtual
1.81 + Our implementation only gets called if the base class doTestStepPreambleL() did
1.82 + not leave.
1.83 +
1.84 + @return - TVerdict code
1.85 +*/
1.86 +TVerdict CTRotateTestStep::doTestStepL()
1.87 + {
1.88 + SetTestStepID(KTestStep0003);
1.89 + TRAPD(err, RotateWindowsL());
1.90 + if (err != KErrNone)
1.91 + {
1.92 + SetTestStepResult(EAbort);
1.93 + }
1.94 + return TestStepResult();
1.95 + }
1.96 +
1.97 +/**
1.98 +@SYMTestCaseID
1.99 +GRAPHICS-UI-BENCH-S60-0003
1.100 +
1.101 +@SYMTestCaseDesc
1.102 +Tests how long it takes to rotate and redraw the screen.
1.103 +
1.104 +@SYMTestActions
1.105 +Creates windows which draw bitmaps and rotates the screen.
1.106 +
1.107 +@SYMTestExpectedResults
1.108 +Test should pass and write the average framerate of the test to a log file.
1.109 +*/
1.110 +void CTRotateTestStep::RotateWindowsL()
1.111 + {
1.112 + iProfiler->InitResults();
1.113 + for (TInt i = 0; i < KNumFullRotations; i++)
1.114 + {
1.115 + iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated90);
1.116 + iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated180);
1.117 + iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated270);
1.118 + iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationNormal);
1.119 + }
1.120 + iProfiler->MarkResultSetL();
1.121 + iProfiler->ResultsAnalysisScreenRotationRate(KTestStep0003, 0, 0, 0, KNumFullRotations * KNumPartlyRotations,
1.122 + iScreenSize.iWidth * iScreenSize.iHeight);
1.123 + }