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 "tflowwindowstest.h" sl@0: #include "tsmallwindowraster.h" sl@0: sl@0: sl@0: _LIT(KTestStep0006, "GRAPHICS-UI-BENCH-S60-0006"); sl@0: _LIT(KSectNameFlowsTest, "FlowTests"); sl@0: _LIT(KKeyNamePreload, "Preload"); sl@0: _LIT(KKeyNameFiles, "Files"); sl@0: _LIT(KKeyNameWindowWidth, "WindowWidth"); sl@0: _LIT(KKeyNameWindowHeight, "WindowHeight"); sl@0: sl@0: CTFlowWindowsTest::CTFlowWindowsTest() sl@0: { sl@0: SetTestStepName(KTFlowWindows); sl@0: } sl@0: sl@0: CTFlowWindowsTest::~CTFlowWindowsTest() sl@0: { sl@0: iFileNames.Close(); sl@0: delete iFlowWindowsController; sl@0: } sl@0: sl@0: TVerdict CTFlowWindowsTest::doTestStepPreambleL() sl@0: { sl@0: CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL(); sl@0: sl@0: iPreload = EFalse; // default behaviour sl@0: GetBoolFromConfig(KSectNameFlowsTest, KKeyNamePreload, iPreload); sl@0: sl@0: TPtrC fileNameList; sl@0: TEST(GetStringFromConfig(KSectNameFlowsTest,KKeyNameFiles, fileNameList)); sl@0: ExtractListL(fileNameList, iFileNames); sl@0: sl@0: TSize windowSize = CTWindow::GetDisplaySizeInPixels(); sl@0: INFO_PRINTF2(_L("Window-width: %d"), windowSize.iWidth); sl@0: INFO_PRINTF2(_L("Window-height: %d"), windowSize.iHeight); sl@0: GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowWidth, windowSize.iWidth); sl@0: GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowHeight, windowSize.iHeight); 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 += windowSize.iWidth; sl@0: } sl@0: // run the test enough frames to see all the windows go by sl@0: iIterationsToTest = windowSize.iWidth * numberOfWindows; sl@0: iFlowWindowsController = CTFlowWindowsController::NewL(iPreload, iFileNames, windowSize, windowCreatorFunctions, initialPositions, EFalse); 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 CTFlowWindowsTest::doTestStepL() sl@0: { sl@0: SetTestStepID(KTestStep0006); sl@0: TRAPD(err, FlowWindowsL()); 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-0006 sl@0: sl@0: @SYMTestCaseDesc sl@0: Tests how long it takes to moves windows over the screen. sl@0: sl@0: @SYMTestActions sl@0: Creates windows which draw bitmaps 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 CTFlowWindowsTest::FlowWindowsL() sl@0: { sl@0: iIterationsToTest = 50; sl@0: iProfiler->InitResults(); sl@0: for (TInt i = 0; i < iIterationsToTest; ++i) sl@0: { sl@0: iFlowWindowsController->MoveL(); sl@0: } sl@0: iProfiler->MarkResultSetL(); sl@0: TSize windowSize = CTWindow::GetDisplaySizeInPixels(); sl@0: iProfiler->ResultsAnalysisFrameRate(KTestStep0006, 0, 0, 0, iIterationsToTest, windowSize.iWidth * windowSize.iHeight); sl@0: }