graphicstest/uibench/s60/src/tests_flowwindow/tflowwindowstest.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 "tflowwindowstest.h"
       
    24 #include "tsmallwindowraster.h"
       
    25 
       
    26 
       
    27 _LIT(KTestStep0006, "GRAPHICS-UI-BENCH-S60-0006");
       
    28 _LIT(KSectNameFlowsTest, "FlowTests");
       
    29 _LIT(KKeyNamePreload, "Preload");
       
    30 _LIT(KKeyNameFiles, "Files");
       
    31 _LIT(KKeyNameWindowWidth, "WindowWidth");
       
    32 _LIT(KKeyNameWindowHeight, "WindowHeight");
       
    33 
       
    34 CTFlowWindowsTest::CTFlowWindowsTest()
       
    35 	{
       
    36 	SetTestStepName(KTFlowWindows);
       
    37 	}
       
    38 
       
    39 CTFlowWindowsTest::~CTFlowWindowsTest()
       
    40 	{	
       
    41 	iFileNames.Close();
       
    42 	delete iFlowWindowsController;
       
    43 	}
       
    44 
       
    45 TVerdict CTFlowWindowsTest::doTestStepPreambleL()
       
    46 	{
       
    47   	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
       
    48 	
       
    49 	iPreload = EFalse; // default behaviour
       
    50 	GetBoolFromConfig(KSectNameFlowsTest, KKeyNamePreload, iPreload);
       
    51 
       
    52 	TPtrC fileNameList;
       
    53 	TEST(GetStringFromConfig(KSectNameFlowsTest,KKeyNameFiles, fileNameList));
       
    54 	ExtractListL(fileNameList, iFileNames);	
       
    55 	
       
    56 	TSize windowSize = CTWindow::GetDisplaySizeInPixels();
       
    57 	INFO_PRINTF2(_L("Window-width: %d"), windowSize.iWidth);
       
    58 	INFO_PRINTF2(_L("Window-height: %d"), windowSize.iHeight);
       
    59 	GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowWidth, windowSize.iWidth);
       
    60 	GetIntFromConfig(KSectNameFlowsTest, KKeyNameWindowHeight, windowSize.iHeight);
       
    61 	
       
    62 	RArray<TPoint> initialPositions;
       
    63 	RArray<pTWindowCreatorFunction> windowCreatorFunctions;
       
    64 	CleanupClosePushL(initialPositions);
       
    65 	CleanupClosePushL(windowCreatorFunctions);
       
    66 	TInt numberOfWindows = iFileNames.Count();
       
    67 	TPoint initialPosition(0, 0);
       
    68 	for (TInt i = 0; i < numberOfWindows; ++i)
       
    69 		{
       
    70 		windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
       
    71 		initialPositions.AppendL(initialPosition);
       
    72 		initialPosition.iX += windowSize.iWidth;
       
    73 		}
       
    74 	// run the test enough frames to see all the windows go by
       
    75 	iIterationsToTest = windowSize.iWidth * numberOfWindows;
       
    76     iFlowWindowsController = CTFlowWindowsController::NewL(iPreload, iFileNames, windowSize, windowCreatorFunctions, initialPositions, EFalse);
       
    77 	
       
    78 	CleanupStack::PopAndDestroy(2, &initialPositions);
       
    79 	return TestStepResult();
       
    80 	}
       
    81 
       
    82 /**
       
    83     Override of base class pure virtual
       
    84     Our implementation only gets called if the base class doTestStepPreambleL() did
       
    85     not leave.
       
    86     
       
    87     @return - TVerdict code
       
    88 */
       
    89 TVerdict CTFlowWindowsTest::doTestStepL()
       
    90     {
       
    91     SetTestStepID(KTestStep0006);
       
    92     TRAPD(err, FlowWindowsL());
       
    93     if (err != KErrNone)
       
    94         {
       
    95         SetTestStepResult(EAbort);
       
    96         }
       
    97     return TestStepResult();
       
    98     }
       
    99 
       
   100 /**
       
   101 @SYMTestCaseID
       
   102 GRAPHICS-UI-BENCH-S60-0006
       
   103 
       
   104 @SYMTestCaseDesc
       
   105 Tests how long it takes to moves windows over the screen.
       
   106 
       
   107 @SYMTestActions
       
   108 Creates windows which draw bitmaps and moves them over the screen.
       
   109 
       
   110 @SYMTestExpectedResults
       
   111 Test should pass and write the average framerate of the test to a log file.
       
   112 */
       
   113 void CTFlowWindowsTest::FlowWindowsL()
       
   114     {
       
   115     iIterationsToTest = 50;
       
   116     iProfiler->InitResults();
       
   117     for (TInt i = 0; i < iIterationsToTest; ++i)
       
   118         {
       
   119         iFlowWindowsController->MoveL();
       
   120         }
       
   121     iProfiler->MarkResultSetL();
       
   122     TSize windowSize = CTWindow::GetDisplaySizeInPixels();   
       
   123     iProfiler->ResultsAnalysisFrameRate(KTestStep0006, 0, 0, 0, iIterationsToTest, windowSize.iWidth * windowSize.iHeight);    
       
   124     }