os/graphics/graphicstest/uibench/s60/src/tests_flowwindow/trotateteststep.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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 "trotateteststep.h"
    24 #include "tsmallwindowraster.h"
    25 #include "tflowwindowscontroller.h"
    26 
    27 
    28 _LIT(KTestStep0003,"GRAPHICS-UI-BENCH-S60-0003");
    29 _LIT(KSectNameOpenFlowTests, "FlowTests");
    30 _LIT(KKeyNameFiles, "Files");
    31 
    32 const TInt KNumFullRotations = 20; // number of full rotations
    33 const TInt KNumPartlyRotations = 4; // number of partly rotations within one full rotation
    34 
    35 
    36 CTRotateTestStep::CTRotateTestStep()
    37 	{
    38 	SetTestStepName(KTRotateTestStep);
    39 	iScreenSize = CTWindow::GetDisplaySizeInPixels();
    40 	}
    41 
    42 CTRotateTestStep::~CTRotateTestStep()
    43 	{	
    44 	delete iFlowWindowsController;	
    45 	iFileNames.Close();
    46 	}
    47 
    48 TVerdict CTRotateTestStep::doTestStepPreambleL()
    49 	{
    50 	CTe_graphicsperformanceSuiteStepBase::doTestStepPreambleL();
    51 	TPtrC fileNameList;
    52 	TESTL(GetStringFromConfig(KSectNameOpenFlowTests, KKeyNameFiles, fileNameList));
    53 	ExtractListL(fileNameList, iFileNames);
    54  
    55 	RArray<TPoint> initialPositions;
    56 	RArray<pTWindowCreatorFunction> windowCreatorFunctions;
    57 	CleanupClosePushL(initialPositions);
    58 	CleanupClosePushL(windowCreatorFunctions);
    59     TInt numberOfWindows = iFileNames.Count();
    60     TPoint initialPosition(0, 0);
    61 	for (TInt i = 0; i < numberOfWindows; i++)
    62 		{
    63 		windowCreatorFunctions.AppendL(CTSmallWindowRaster::NewL);
    64 		initialPositions.AppendL(initialPosition);
    65 		initialPosition.iX += iScreenSize.iWidth;
    66 		}
    67 
    68 	iFlowWindowsController = CTFlowWindowsController::NewL(ETrue, iFileNames, iScreenSize, windowCreatorFunctions, initialPositions, EFalse);
    69 	// Ensure all windows are visible so that the image appears when the screen is rotated.
    70 	iFlowWindowsController->SetWindowsVisibility(ETrue);
    71 	
    72 	CleanupStack::PopAndDestroy(2, &initialPositions);
    73 	return TestStepResult();
    74 	}
    75 
    76 /**
    77     Override of base class pure virtual
    78     Our implementation only gets called if the base class doTestStepPreambleL() did
    79     not leave.
    80     
    81     @return - TVerdict code
    82 */
    83 TVerdict CTRotateTestStep::doTestStepL()
    84     {
    85     SetTestStepID(KTestStep0003);
    86     TRAPD(err, RotateWindowsL());
    87     if (err != KErrNone)
    88         {
    89         SetTestStepResult(EAbort);
    90         }
    91     return TestStepResult();
    92     }
    93 
    94 /**
    95 @SYMTestCaseID
    96 GRAPHICS-UI-BENCH-S60-0003
    97 
    98 @SYMTestCaseDesc
    99 Tests how long it takes to rotate and redraw the screen.
   100 
   101 @SYMTestActions
   102 Creates windows which draw bitmaps and rotates the screen.
   103 
   104 @SYMTestExpectedResults
   105 Test should pass and write the average framerate of the test to a log file.
   106 */
   107 void CTRotateTestStep::RotateWindowsL()
   108     {
   109     iProfiler->InitResults();
   110     for (TInt i = 0; i < KNumFullRotations; i++)
   111         {
   112         iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated90);
   113         iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated180);
   114         iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationRotated270);
   115         iFlowWindowsController->Rotate(CFbsBitGc::EGraphicsOrientationNormal);
   116         }
   117     iProfiler->MarkResultSetL();
   118     iProfiler->ResultsAnalysisScreenRotationRate(KTestStep0003, 0, 0, 0, KNumFullRotations * KNumPartlyRotations,
   119             iScreenSize.iWidth * iScreenSize.iHeight);
   120     }