graphicstest/uibench/s60/src/tests_copyrect/tcopyrect.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 "tcopyrect.h"
       
    24 
       
    25 
       
    26 const TInt KIterationsToTest = 100;
       
    27 _LIT(KTestStep0017,"GRAPHICS-UI-BENCH-S60-0017");
       
    28 
       
    29 
       
    30 CTCopyRect::CTCopyRect()
       
    31 	{
       
    32 	SetTestStepName(KTCopyRect);
       
    33 	}
       
    34 	
       
    35 CTCopyRect::~CTCopyRect()	
       
    36 	{
       
    37 	// empty
       
    38 	}
       
    39 
       
    40 /**
       
    41 Override of base class pure virtual
       
    42 Our implementation only gets called if the base class doTestStepPreambleL() did
       
    43 not leave. That being the case, the current test result value will be EPass.
       
    44 
       
    45 @return - TVerdict code
       
    46 */
       
    47 TVerdict CTCopyRect::doTestStepL()
       
    48     {
       
    49     SetTestStepID(KTestStep0017);
       
    50     TRAPD(err, CopyRectL());
       
    51     if (err != KErrNone)
       
    52         {
       
    53         SetTestStepResult(EAbort);
       
    54         }
       
    55     return TestStepResult();
       
    56 	}
       
    57 
       
    58 /**
       
    59 @SYMTestCaseID
       
    60 GRAPHICS-UI-BENCH-S60-0017
       
    61 
       
    62 @SYMTestCaseDesc
       
    63 Tests how long it takes to copy a rectangle to a different location with CFbsBitGc.
       
    64 The test runs with the display modes EColor16MAP, EColor16MA, EColor16MU and EColor64K.
       
    65 
       
    66 @SYMTestActions
       
    67 Copy a rectangular area several times and measure the time it takes.
       
    68 
       
    69 @SYMTestExpectedResults
       
    70 Test should pass and display the average framerate.
       
    71 */
       
    72 void CTCopyRect::CopyRectL()
       
    73     {
       
    74     for (TInt dispModeIndex = KNumValidDisplayModes - 1; dispModeIndex >= 0; --dispModeIndex)
       
    75         {
       
    76         SetScreenModeL(KValidDisplayModes[dispModeIndex]);
       
    77         iSourceRect = TRect(TPoint(0, 1), iScreenDevice->SizeInPixels());   
       
    78         iSourceRect.Resize(0, -2);
       
    79         iProfiler->InitResults();
       
    80         for(TInt i = 0; i < KIterationsToTest; ++i)
       
    81             {
       
    82             iGc->CopyRect(TPoint(0,1),iSourceRect);
       
    83             iScreenDevice->Update();
       
    84             }        
       
    85         iProfiler->MarkResultSetL();
       
    86         iProfiler->ResultsAnalysisFrameRate(KTestStep0017, 0, 0, iScreenDevice->BitmapDevice().DisplayMode(),
       
    87                 KIterationsToTest, iSourceRect.Size().iWidth * iSourceRect.Size().iHeight);   
       
    88         }    
       
    89     }