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