graphicstest/uibench/s60/src/tests_flowwindow/tflowwindowstestopenglvg.cpp
changeset 0 5d03bc08d59c
equal deleted inserted replaced
-1:000000000000 0:5d03bc08d59c
       
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 /**
       
    17  @file
       
    18  @test
       
    19  @internalComponent - Internal Symbian test code 
       
    20 */
       
    21 
       
    22 
       
    23 #include "tflowwindowstestopenglvg.h"
       
    24 #include "tflowwindowopengl.h"
       
    25 #include "tflowwindowopenvg.h"
       
    26 #include "tsmallwindowraster.h"
       
    27 #include "tflowwindowscontroller.h"
       
    28 
       
    29 
       
    30 _LIT(KTestStep0002,"GRAPHICS-UI-BENCH-S60-0002");
       
    31 _LIT(KSectNameOpenGLVGTest, "OpenGLVGTest");
       
    32 _LIT(KKeyNamePreload, "Preload");
       
    33 _LIT(KKeyNameFiles, "Files");
       
    34 _LIT(KKeyNameWindowWidth, "WindowWidth");
       
    35 _LIT(KKeyNameWindowHeight, "WindowHeight");
       
    36 
       
    37 CTFlowWindowsTestOpenGLVG::CTFlowWindowsTestOpenGLVG()
       
    38 	{
       
    39 	SetTestStepName(KTFlowWindowsOpenGLVG);
       
    40 	}
       
    41 
       
    42 CTFlowWindowsTestOpenGLVG::~CTFlowWindowsTestOpenGLVG()
       
    43 	{
       
    44 	delete iFlowWindowsController;
       
    45 	iFileNames.Close();
       
    46 	}
       
    47 
       
    48 TVerdict CTFlowWindowsTestOpenGLVG::doTestStepPreambleL()
       
    49 	{
       
    50 	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
       
    51 
       
    52 	iPreload = EFalse; // default behaviour
       
    53 	GetBoolFromConfig(KSectNameOpenGLVGTest, KKeyNamePreload, iPreload);
       
    54 	
       
    55 	TSize windowSize = CTWindow::GetDisplaySizeInPixels();
       
    56 	GetIntFromConfig(KSectNameOpenGLVGTest, KKeyNameWindowWidth, windowSize.iWidth);
       
    57 	GetIntFromConfig(KSectNameOpenGLVGTest, KKeyNameWindowHeight, windowSize.iHeight);
       
    58 	TPtrC fileNameList;
       
    59 	TEST(GetStringFromConfig(KSectNameOpenGLVGTest, KKeyNameFiles, fileNameList));
       
    60 	ExtractListL(fileNameList, iFileNames);
       
    61 	iIterationsToTest = windowSize.iWidth * iFileNames.Count();
       
    62 	
       
    63 	RArray<TPoint> initialPositions;
       
    64 	RArray<pTWindowCreatorFunction> windowCreatorFunctions;
       
    65 	TPoint initialPosition(0, 0);
       
    66 	CleanupClosePushL(initialPositions);
       
    67 	CleanupClosePushL(windowCreatorFunctions);
       
    68 	windowCreatorFunctions.AppendL(CTFlowWindowOpenGL::NewL);
       
    69 	initialPositions.AppendL(initialPosition);
       
    70 	
       
    71     windowCreatorFunctions.AppendL(CTFlowWindowOpenVG::NewL);
       
    72     initialPosition.iX += windowSize.iWidth;
       
    73     initialPositions.AppendL(initialPosition);
       
    74 
       
    75 	windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
       
    76 	initialPosition.iX += windowSize.iWidth;
       
    77 	initialPositions.AppendL(initialPosition);
       
    78 
       
    79 	iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, windowSize, windowCreatorFunctions, initialPositions, EFalse);
       
    80 	CleanupStack::PopAndDestroy(2, &initialPositions);	    
       
    81 	return TestStepResult();
       
    82 	}
       
    83 
       
    84 /**
       
    85     Override of base class pure virtual
       
    86     Our implementation only gets called if the base class doTestStepPreambleL() did
       
    87     not leave.
       
    88     
       
    89     @return - TVerdict code
       
    90 */
       
    91 TVerdict CTFlowWindowsTestOpenGLVG::doTestStepL()
       
    92     {
       
    93     SetTestStepID(KTestStep0002);
       
    94     TRAPD(err, FlowOpenGLVGWindowsL());
       
    95     if (err != KErrNone)
       
    96         {
       
    97         SetTestStepResult(EAbort);
       
    98         }
       
    99     return TestStepResult();
       
   100     }
       
   101 
       
   102 /**
       
   103 @SYMTestCaseID
       
   104 GRAPHICS-UI-BENCH-S60-0002
       
   105 
       
   106 @SYMTestCaseDesc
       
   107 Tests how long it takes to moves windows over the screen.
       
   108 
       
   109 @SYMTestActions
       
   110 Creates windows which draw bitmaps, OpenVG and OpenGL ES content and moves them over the screen.
       
   111 
       
   112 @SYMTestExpectedResults
       
   113 Test should pass and write the average framerate of the test to a log file.
       
   114 */
       
   115 void CTFlowWindowsTestOpenGLVG::FlowOpenGLVGWindowsL()
       
   116     {
       
   117     iProfiler->InitResults();
       
   118     iIterationsToTest = 25;
       
   119     for (TInt i = 0; i < iIterationsToTest; ++i)
       
   120         {
       
   121         iFlowWindowsController->MoveL();
       
   122         }
       
   123     iProfiler->MarkResultSetL();
       
   124     TSize windowSize = CTWindow::GetDisplaySizeInPixels();   
       
   125     iProfiler->ResultsAnalysisFrameRate(KTestStep0002, 0, 0, 0, iIterationsToTest, windowSize.iWidth * windowSize.iHeight);
       
   126     }