os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/tflowwindowstest.cpp
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/tflowwindowstest.cpp	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,124 @@
     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 "tflowwindowstest.h"
    1.27 +#include "tsmallwindowraster.h"
    1.28 +
    1.29 +
    1.30 +_LIT(KTestStep0006, "GRAPHICS-UI-BENCH-S60-0006");
    1.31 +_LIT(KSectNameFlowsTest, "FlowTests");
    1.32 +_LIT(KKeyNamePreload, "Preload");
    1.33 +_LIT(KKeyNameFiles, "Files");
    1.34 +_LIT(KKeyNameWindowWidth, "WindowWidth");
    1.35 +_LIT(KKeyNameWindowHeight, "WindowHeight");
    1.36 +
    1.37 +CTFlowWindowsTest::CTFlowWindowsTest()
    1.38 +	{
    1.39 +	SetTestStepName(KTFlowWindows);
    1.40 +	}
    1.41 +
    1.42 +CTFlowWindowsTest::~CTFlowWindowsTest()
    1.43 +	{	
    1.44 +	iFileNames.Close();
    1.45 +	delete iFlowWindowsController;
    1.46 +	}
    1.47 +
    1.48 +TVerdict CTFlowWindowsTest::doTestStepPreambleL()
    1.49 +	{
    1.50 +  	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
    1.51 +	
    1.52 +	iPreload = EFalse; // default behaviour
    1.53 +	GetBoolFromConfig(KSectNameFlowsTest, KKeyNamePreload, iPreload);
    1.54 +
    1.55 +	TPtrC fileNameList;
    1.56 +	TEST(GetStringFromConfig(KSectNameFlowsTest,KKeyNameFiles, fileNameList));
    1.57 +	ExtractListL(fileNameList, iFileNames);	
    1.58 +	
    1.59 +	TSize windowSize = CTWindow::GetDisplaySizeInPixels();
    1.60 +	INFO_PRINTF2(_L("Window-width: %d"), windowSize.iWidth);
    1.61 +	INFO_PRINTF2(_L("Window-height: %d"), windowSize.iHeight);
    1.62 +	GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowWidth, windowSize.iWidth);
    1.63 +	GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowHeight, windowSize.iHeight);
    1.64 +	
    1.65 +	RArray<TPoint> initialPositions;
    1.66 +	RArray<pTWindowCreatorFunction> windowCreatorFunctions;
    1.67 +	CleanupClosePushL(initialPositions);
    1.68 +	CleanupClosePushL(windowCreatorFunctions);
    1.69 +	TInt numberOfWindows = iFileNames.Count();
    1.70 +	TPoint initialPosition(0, 0);
    1.71 +	for (TInt i = 0; i < numberOfWindows; ++i)
    1.72 +		{
    1.73 +		windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
    1.74 +		initialPositions.AppendL(initialPosition);
    1.75 +		initialPosition.iX += windowSize.iWidth;
    1.76 +		}
    1.77 +	// run the test enough frames to see all the windows go by
    1.78 +	iIterationsToTest = windowSize.iWidth * numberOfWindows;
    1.79 +    iFlowWindowsController = CTFlowWindowsController::NewL(iPreload, iFileNames, windowSize, windowCreatorFunctions, initialPositions, EFalse);
    1.80 +	
    1.81 +	CleanupStack::PopAndDestroy(2, &initialPositions);
    1.82 +	return TestStepResult();
    1.83 +	}
    1.84 +
    1.85 +/**
    1.86 +    Override of base class pure virtual
    1.87 +    Our implementation only gets called if the base class doTestStepPreambleL() did
    1.88 +    not leave.
    1.89 +    
    1.90 +    @return - TVerdict code
    1.91 +*/
    1.92 +TVerdict CTFlowWindowsTest::doTestStepL()
    1.93 +    {
    1.94 +    SetTestStepID(KTestStep0006);
    1.95 +    TRAPD(err, FlowWindowsL());
    1.96 +    if (err != KErrNone)
    1.97 +        {
    1.98 +        SetTestStepResult(EAbort);
    1.99 +        }
   1.100 +    return TestStepResult();
   1.101 +    }
   1.102 +
   1.103 +/**
   1.104 +@SYMTestCaseID
   1.105 +GRAPHICS-UI-BENCH-S60-0006
   1.106 +
   1.107 +@SYMTestCaseDesc
   1.108 +Tests how long it takes to moves windows over the screen.
   1.109 +
   1.110 +@SYMTestActions
   1.111 +Creates windows which draw bitmaps and moves them over the screen.
   1.112 +
   1.113 +@SYMTestExpectedResults
   1.114 +Test should pass and write the average framerate of the test to a log file.
   1.115 +*/
   1.116 +void CTFlowWindowsTest::FlowWindowsL()
   1.117 +    {
   1.118 +    iIterationsToTest = 50;
   1.119 +    iProfiler->InitResults();
   1.120 +    for (TInt i = 0; i < iIterationsToTest; ++i)
   1.121 +        {
   1.122 +        iFlowWindowsController->MoveL();
   1.123 +        }
   1.124 +    iProfiler->MarkResultSetL();
   1.125 +    TSize windowSize = CTWindow::GetDisplaySizeInPixels();   
   1.126 +    iProfiler->ResultsAnalysisFrameRate(KTestStep0006, 0, 0, 0, iIterationsToTest, windowSize.iWidth * windowSize.iHeight);    
   1.127 +    }